Changeset - 631e8000eae8
[Not reviewed]
beta
0 1 0
Mads Kiilerich - 13 years ago 2013-04-10 02:54:56
madski@unity3d.com
diff parser: match the header order of hg diff --git patches

The output might look like:

diff --git a/A b/B
old mode 100644
new mode 100755
rename from A
rename to B
--- a/A
+++ b/B

Such files were shown as 'modified binary file chmod 100644 => 100755' without
diff.

Now the chmod and diff will be shown ... but still not the rename.

Correct parsing of headers do require a better parser - one do not just use a
regexp.
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/diffs.py
Show inline comments
 
@@ -172,11 +172,11 @@ class DiffProcessor(object):
 
    _hg_header_re = re.compile(r"""
 
        #^diff[ ]--git
 
            [ ]a/(?P<a_path>.+?)[ ]b/(?P<b_path>.+?)\n
 
        (?:^old[ ]mode[ ](?P<old_mode>\d+)\n
 
           ^new[ ]mode[ ](?P<new_mode>\d+)(?:\n|$))?
 
        (?:^similarity[ ]index[ ](?P<similarity_index>\d+)%(?:\n|$))?
 
        (?:^rename[ ]from[ ](?P<rename_from>\S+)\n
 
           ^rename[ ]to[ ](?P<rename_to>\S+)(?:\n|$))?
 
        (?:^old[ ]mode[ ](?P<old_mode>\d+)\n
 
           ^new[ ]mode[ ](?P<new_mode>\d+)(?:\n|$))?
 
        (?:^new[ ]file[ ]mode[ ](?P<new_file_mode>.+)(?:\n|$))?
 
        (?:^deleted[ ]file[ ]mode[ ](?P<deleted_file_mode>.+)(?:\n|$))?
 
        (?:^index[ ](?P<a_blob_id>[0-9A-Fa-f]+)
0 comments (0 inline, 0 general)