comparison mercurial/patch.py @ 35319:10cce12fdcd3

patch: reverse _inlinediff output for consistency
author Matthieu Laneuville <matthieu.laneuville@octobus.net>
date Fri, 08 Dec 2017 16:47:18 +0900
parents 6ba79cf34f5e
children 12ce62c72c24
comparison
equal deleted inserted replaced
35318:d13526333835 35319:10cce12fdcd3
2513 for token in tabsplitter.findall(stripline): 2513 for token in tabsplitter.findall(stripline):
2514 if '\t' == token[0]: 2514 if '\t' == token[0]:
2515 yield (token, 'diff.tab') 2515 yield (token, 'diff.tab')
2516 else: 2516 else:
2517 if i in matches: 2517 if i in matches:
2518 for l, t in _inlinediff( 2518 for t, l in _inlinediff(
2519 lines[i].rstrip(), 2519 lines[i].rstrip(),
2520 lines[matches[i]].rstrip(), 2520 lines[matches[i]].rstrip(),
2521 label): 2521 label):
2522 yield (t, l) 2522 yield (t, l)
2523 else: 2523 else:
2585 l = operation 2585 l = operation
2586 if l == label: # contiguous token with same label 2586 if l == label: # contiguous token with same label
2587 token += part[2:] 2587 token += part[2:]
2588 continue 2588 continue
2589 else: 2589 else:
2590 buff.append((label, token)) 2590 buff.append((token, label))
2591 label = l 2591 label = l
2592 token = part[2:] 2592 token = part[2:]
2593 buff.append((label, token)) 2593 buff.append((token, label))
2594 2594
2595 return buff 2595 return buff
2596 2596
2597 def diffui(*args, **kw): 2597 def diffui(*args, **kw):
2598 '''like diff(), but yields 2-tuples of (output, label) for ui.write()''' 2598 '''like diff(), but yields 2-tuples of (output, label) for ui.write()'''