Changeset - 8df1bc51aa9c
[Not reviewed]
beta
0 1 0
Mads Kiilerich - 13 years ago 2013-04-10 03:00:20
madski@unity3d.com
diff parser: prefer git headers over old unified diff headers

Makes the diff show both rename and chmod info and the diff.
1 file changed with 9 insertions and 12 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/diffs.py
Show inline comments
 
@@ -360,18 +360,6 @@ class DiffProcessor(object):
 
            stats = None
 
            msgs = []
 

	
 
            if not head['a_file'] and head['b_file']:
 
                op = 'A'
 
                stats = ['b', NEW_FILENODE]
 
                msgs.append('new file')
 
            elif head['a_file'] and head['b_file']:
 
                op = 'M'
 
                stats = ['b', MOD_FILENODE]
 
            elif head['a_file'] and not head['b_file']:
 
                op = 'D'
 
                stats = ['b', DEL_FILENODE]
 
                msgs.append('deleted file')
 
            else:
 
                if head['deleted_file_mode']:
 
                    op = 'D'
 
                    stats = ['b', DEL_FILENODE]
 
@@ -392,6 +380,15 @@ class DiffProcessor(object):
 
                        stats = ['b', RENAMED_FILENODE] # might overwrite CHMOD_FILENODE
 
                        msgs.append('file renamed from %s to %s'
 
                                      % (head['rename_from'], head['rename_to']))
 
                if op is None: # fall back: detect missed old style add or remove
 
                    if not head['a_file'] and head['b_file']:
 
                        op = 'A'
 
                        stats = ['b', NEW_FILENODE]
 
                        msgs.append('new file')
 
                    elif head['a_file'] and not head['b_file']:
 
                        op = 'D'
 
                        stats = ['b', DEL_FILENODE]
 
                        msgs.append('deleted file')
 
                    if op is None:
 
                        op = 'M'
 
                        stats = ['b', MOD_FILENODE]
0 comments (0 inline, 0 general)