D1698: copies: group wdir-handling in one place

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Dec 15 08:52:36 EST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG143f09cfc80f: copies: group wdir-handling in one place (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1698?vs=4447&id=4479

REVISION DETAIL
  https://phab.mercurial-scm.org/D1698

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -195,21 +195,16 @@
     """find {dst at b: src at a} copy mapping where a is an ancestor of b"""
 
     # check for working copy
-    w = None
     if b.rev() is None:
-        w = b
-        b = w.p1()
-        if a == b:
+        if a == b.p1():
             # short-circuit to avoid issues with merge states
-            return _dirstatecopies(w, match)
+            return _dirstatecopies(b, match)
 
-    cm = _committedforwardcopies(a, b, match)
-
-    # combine copies from dirstate if necessary
-    if w is not None:
-        cm = _chain(a, w, cm, _dirstatecopies(w, match))
-
-    return cm
+        cm = _committedforwardcopies(a, b.p1(), match)
+        # combine copies from dirstate if necessary
+        return _chain(a, b, cm, _dirstatecopies(b, match))
+    else:
+        return _committedforwardcopies(a, b, match)
 
 def _backwardrenames(a, b):
     if a._repo.ui.config('experimental', 'copytrace') == 'off':



To: martinvonz, #hg-reviewers, yuja
Cc: mercurial-devel


More information about the Mercurial-devel mailing list