Patchwork [1,of,7] copies: don't record divergence for files needing no merge

login
register
mail settings
Submitter Gábor Stefanik
Date Oct. 7, 2016, 12:31 p.m.
Message ID <5b7cd65a9be6c82b3ad1.1475843494@waste.org>
Download mbox | patch
Permalink /patch/16876/
State Changes Requested
Delegated to: Matt Mackall
Headers show

Comments

Gábor Stefanik - Oct. 7, 2016, 12:31 p.m.
# HG changeset patch
# User Gábor Stefanik <gabor.stefanik@nng.com>
# Date 1475494199 -7200
#      Mon Oct 03 13:29:59 2016 +0200
# Node ID 5b7cd65a9be6c82b3ad14096b41db44c198a6769
# Parent  91a3c58ecf938ed675f5364b88f0d663f12b0047
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.
Pierre-Yves David - Oct. 8, 2016, 4:31 p.m.
On 10/07/2016 02:31 PM, Gábor Stefanik wrote:
> # HG changeset patch
> # User Gábor Stefanik <gabor.stefanik@nng.com>
> # Date 1475494199 -7200
> #      Mon Oct 03 13:29:59 2016 +0200
> # Node ID 5b7cd65a9be6c82b3ad14096b41db44c198a6769
> # Parent  91a3c58ecf938ed675f5364b88f0d663f12b0047
> copies: don't record divergence for files needing no merge

Patch 1 is pushed.
Pierre-Yves David - Oct. 12, 2016, 1:54 p.m.
On 10/08/2016 06:31 PM, Pierre-Yves David wrote:
> On 10/07/2016 02:31 PM, Gábor Stefanik wrote:
>> # HG changeset patch
>> # User Gábor Stefanik <gabor.stefanik@nng.com>
>> # Date 1475494199 -7200
>> #      Mon Oct 03 13:29:59 2016 +0200
>> # Node ID 5b7cd65a9be6c82b3ad14096b41db44c198a6769
>> # Parent  91a3c58ecf938ed675f5364b88f0d663f12b0047
>> copies: don't record divergence for files needing no merge
>
> Patch 1 is pushed.

Gábor and I are working out of band for a new iteration of this series.

Cheers,

Patch

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -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)