comparison mercurial/copies.py @ 30075:2c8ec8c2ddfe

copies: don't record divergence for files needing no merge This is left over from when _checkcopies was factored out from mergecopies. The 2nd break has "of = None" before it, so it's a functionally equivalent change. The 1st one, however, causes a divergence to be recorded when a file has been renamed, but there is nothing to be merged to it. This is currently harmless, since the extra divergence is simply ignored later. However, the new _checkcopies introduced in the rest of this series does more than just record a divergence after completing the main loop, and it's important that the "post-processing" stage is really skipped for no-merge-needed renames.
author Gábor Stefanik <gabor.stefanik@nng.com>
date Mon, 03 Oct 2016 13:29:59 +0200
parents 91a3c58ecf93
children 3eae81c0a09d
comparison
equal deleted inserted replaced
30074:8f34e217338b 30075:2c8ec8c2ddfe
522 522
523 fullcopy[f] = of # remember for dir rename detection 523 fullcopy[f] = of # remember for dir rename detection
524 if of not in m2: 524 if of not in m2:
525 continue # no match, keep looking 525 continue # no match, keep looking
526 if m2[of] == ma.get(of): 526 if m2[of] == ma.get(of):
527 break # no merge needed, quit early 527 return # no merge needed, quit early
528 c2 = getfctx(of, m2[of]) 528 c2 = getfctx(of, m2[of])
529 cr = _related(oc, c2, ca.rev()) 529 cr = _related(oc, c2, ca.rev())
530 if cr and (of == f or of == c2.path()): # non-divergent 530 if cr and (of == f or of == c2.path()): # non-divergent
531 copy[f] = of 531 copy[f] = of
532 of = None 532 return
533 break
534 533
535 if of in ma: 534 if of in ma:
536 diverge.setdefault(of, []).append(f) 535 diverge.setdefault(of, []).append(f)
537 536
538 def duplicatecopies(repo, rev, fromrev, skiprev=None): 537 def duplicatecopies(repo, rev, fromrev, skiprev=None):