changeset 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 8f34e217338b
children 400dfded8a29
files mercurial/copies.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/copies.py	Sat Oct 08 19:32:54 2016 +0900
+++ b/mercurial/copies.py	Mon Oct 03 13:29:59 2016 +0200
@@ -524,13 +524,12 @@
         if of not in m2:
             continue # no match, keep looking
         if m2[of] == ma.get(of):
-            break # no merge needed, quit early
+            return # no merge needed, quit early
         c2 = getfctx(of, m2[of])
         cr = _related(oc, c2, ca.rev())
         if cr and (of == f or of == c2.path()): # non-divergent
             copy[f] = of
-            of = None
-            break
+            return
 
     if of in ma:
         diverge.setdefault(of, []).append(f)