##// END OF EJS Templates
diff parser: prefer git headers over old unified diff headers...
Mads Kiilerich -
r3820:8df1bc51 beta
parent child Browse files
Show More
@@ -360,41 +360,38 b' class DiffProcessor(object):'
360 stats = None
360 stats = None
361 msgs = []
361 msgs = []
362
362
363 if not head['a_file'] and head['b_file']:
363 if head['deleted_file_mode']:
364 op = 'A'
365 stats = ['b', NEW_FILENODE]
366 msgs.append('new file')
367 elif head['a_file'] and head['b_file']:
368 op = 'M'
369 stats = ['b', MOD_FILENODE]
370 elif head['a_file'] and not head['b_file']:
371 op = 'D'
364 op = 'D'
372 stats = ['b', DEL_FILENODE]
365 stats = ['b', DEL_FILENODE]
373 msgs.append('deleted file')
366 msgs.append('deleted file')
367 elif head['new_file_mode']:
368 op = 'A'
369 stats = ['b', NEW_FILENODE]
370 msgs.append('new file %s' % head['new_file_mode'])
374 else:
371 else:
375 if head['deleted_file_mode']:
372 if head['new_mode'] and head['old_mode']:
376 op = 'D'
373 op = 'M'
377 stats = ['b', DEL_FILENODE]
374 stats = ['b', CHMOD_FILENODE]
378 msgs.append('deleted file')
375 msgs.append('modified file chmod %s => %s'
379 elif head['new_file_mode']:
376 % (head['old_mode'], head['new_mode']))
380 op = 'A'
377 if (head['rename_from'] and head['rename_to']
381 stats = ['b', NEW_FILENODE]
378 and head['rename_from'] != head['rename_to']):
382 msgs.append('new file %s' % head['new_file_mode'])
379 op = 'M'
383 else:
380 stats = ['b', RENAMED_FILENODE] # might overwrite CHMOD_FILENODE
384 if head['new_mode'] and head['old_mode']:
381 msgs.append('file renamed from %s to %s'
385 op = 'M'
382 % (head['rename_from'], head['rename_to']))
386 stats = ['b', CHMOD_FILENODE]
383 if op is None: # fall back: detect missed old style add or remove
387 msgs.append('modified file chmod %s => %s'
384 if not head['a_file'] and head['b_file']:
388 % (head['old_mode'], head['new_mode']))
385 op = 'A'
389 if (head['rename_from'] and head['rename_to']
386 stats = ['b', NEW_FILENODE]
390 and head['rename_from'] != head['rename_to']):
387 msgs.append('new file')
391 op = 'M'
388 elif head['a_file'] and not head['b_file']:
392 stats = ['b', RENAMED_FILENODE] # might overwrite CHMOD_FILENODE
389 op = 'D'
393 msgs.append('file renamed from %s to %s'
390 stats = ['b', DEL_FILENODE]
394 % (head['rename_from'], head['rename_to']))
391 msgs.append('deleted file')
395 if op is None:
392 if op is None:
396 op = 'M'
393 op = 'M'
397 stats = ['b', MOD_FILENODE]
394 stats = ['b', MOD_FILENODE]
398
395
399 if head['a_file'] or head['b_file']: # a real diff
396 if head['a_file'] or head['b_file']: # a real diff
400 try:
397 try:
General Comments 0
You need to be logged in to leave comments. Login now