changeset 4695:97ed7d05d3d2

diff: eat trailing tabs in ---/+++ lines of diffs There is usually no date in the diffs we parse but there might still be the tab that was used as separator between filename and date. The a_file and b_file entries are usually not used ... but nice to have them right.
author Mads Kiilerich <madski@unity3d.com>
date Mon, 15 Dec 2014 13:47:36 +0100
parents 11d6d1cec667
children fbb992c719aa
files kallithea/lib/diffs.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/diffs.py	Mon Dec 15 13:47:36 2014 +0100
+++ b/kallithea/lib/diffs.py	Mon Dec 15 13:47:36 2014 +0100
@@ -170,8 +170,8 @@
         (?:^index[ ](?P<a_blob_id>[0-9A-Fa-f]+)
             \.\.(?P<b_blob_id>[0-9A-Fa-f]+)[ ]?(?P<b_mode>.+)?(?:\n|$))?
         (?:^(?P<bin_patch>GIT[ ]binary[ ]patch)(?:\n|$))?
-        (?:^---[ ](a/(?P<a_file>.+)|/dev/null)(?:\n|$))?
-        (?:^\+\+\+[ ](b/(?P<b_file>.+)|/dev/null)(?:\n|$))?
+        (?:^---[ ](a/(?P<a_file>.+?)|/dev/null)\t?(?:\n|$))?
+        (?:^\+\+\+[ ](b/(?P<b_file>.+?)|/dev/null)\t?(?:\n|$))?
     """, re.VERBOSE | re.MULTILINE)
     _hg_header_re = re.compile(r"""
         # has already been split on this:
@@ -189,8 +189,8 @@
         (?:^index[ ](?P<a_blob_id>[0-9A-Fa-f]+)
             \.\.(?P<b_blob_id>[0-9A-Fa-f]+)[ ]?(?P<b_mode>.+)?(?:\n|$))?
         (?:^(?P<bin_patch>GIT[ ]binary[ ]patch)(?:\n|$))?
-        (?:^---[ ](a/(?P<a_file>.+)|/dev/null)(?:\n|$))?
-        (?:^\+\+\+[ ](b/(?P<b_file>.+)|/dev/null)(?:\n|$))?
+        (?:^---[ ](a/(?P<a_file>.+?)|/dev/null)\t?(?:\n|$))?
+        (?:^\+\+\+[ ](b/(?P<b_file>.+?)|/dev/null)\t?(?:\n|$))?
     """, re.VERBOSE | re.MULTILINE)
 
     #used for inline highlighter word split