Patchwork D1698: copies: group wdir-handling in one place

login
register
mail settings
Submitter phabricator
Date Dec. 15, 2017, 1:52 p.m.
Message ID <a1e365d7be4035e2efb80c6adad273b9@localhost.localdomain>
Download mbox | patch
Permalink /patch/26308/
State Not Applicable
Headers show

Comments

phabricator - Dec. 15, 2017, 1:52 p.m.
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




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

Patch

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -195,21 +195,16 @@ 
     """find {dst@b: src@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':