comparison pylons_app/lib/differ.py @ 152:0c00fbaff55a

Fixed differ to properly extract filenames, and dates from diff file. and swaped order of columns with lines nr in diff html
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 15 May 2010 19:53:23 +0200
parents ffddbd80649e
children
comparison
equal deleted inserted replaced
151:988477a05db6 152:0c00fbaff55a
38 38
39 def _extract_rev(self, line1, line2): 39 def _extract_rev(self, line1, line2):
40 """Extract the filename and revision hint from a line.""" 40 """Extract the filename and revision hint from a line."""
41 try: 41 try:
42 if line1.startswith('--- ') and line2.startswith('+++ '): 42 if line1.startswith('--- ') and line2.startswith('+++ '):
43 filename, old_rev = line1[4:].split(None, 1) 43 l1 = line1[4:].split(None, 1)
44 new_rev = line2[4:].split(None, 1)[1] 44 old_filename = l1[0] if len(l1) >= 1 else None
45 return filename, 'old', 'new' 45 old_rev = l1[1] if len(l1) == 2 else 'old'
46
47 l2 = line1[4:].split(None, 1)
48 new_filename = l2[0] if len(l2) >= 1 else None
49 new_rev = l2[1] if len(l2) == 2 else 'new'
50
51 return old_filename, new_rev, old_rev
46 except (ValueError, IndexError): 52 except (ValueError, IndexError):
47 pass 53 pass
54
48 return None, None, None 55 return None, None, None
49 56
50 def _highlight_line_difflib(self, line, next): 57 def _highlight_line_difflib(self, line, next):
51 """Highlight inline changes in both lines.""" 58 """Highlight inline changes in both lines."""
52 59