Mercurial > public > src > rhodecode
diff 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 |
line wrap: on
line diff
--- a/pylons_app/lib/differ.py Sat May 15 19:05:13 2010 +0200 +++ b/pylons_app/lib/differ.py Sat May 15 19:53:23 2010 +0200 @@ -40,11 +40,18 @@ """Extract the filename and revision hint from a line.""" try: if line1.startswith('--- ') and line2.startswith('+++ '): - filename, old_rev = line1[4:].split(None, 1) - new_rev = line2[4:].split(None, 1)[1] - return filename, 'old', 'new' + l1 = line1[4:].split(None, 1) + old_filename = l1[0] if len(l1) >= 1 else None + old_rev = l1[1] if len(l1) == 2 else 'old' + + l2 = line1[4:].split(None, 1) + new_filename = l2[0] if len(l2) >= 1 else None + new_rev = l2[1] if len(l2) == 2 else 'new' + + return old_filename, new_rev, old_rev except (ValueError, IndexError): pass + return None, None, None def _highlight_line_difflib(self, line, next):