Patchwork D1697: copies: extract method for getting non-wdir forward copies

login
register
mail settings
Submitter phabricator
Date Dec. 15, 2017, 1:52 p.m.
Message ID <516d22fb13dafbabfb61e20863bd9eea@localhost.localdomain>
Download mbox | patch
Permalink /patch/26307/
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 rHG8801cdcea01f: copies: extract method for getting non-wdir forward copies (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1697?vs=4446&id=4478

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

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
@@ -156,18 +156,8 @@ 
     mb = b.manifest()
     return mb.filesnotin(ma, match=match)
 
-def _forwardcopies(a, b, match=None):
-    """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:
-            # short-circuit to avoid issues with merge states
-            return _dirstatecopies(w, match)
-
+def _committedforwardcopies(a, b, match):
+    """Like _forwardcopies(), but b.rev() cannot be None (working copy)"""
     # files might have to be traced back to the fctx parent of the last
     # one-side-only changeset, but not further back than that
     limit = _findlimit(a._repo, a.rev(), b.rev())
@@ -199,6 +189,21 @@ 
         ofctx = _tracefile(fctx, am, limit)
         if ofctx:
             cm[f] = ofctx.path()
+    return cm
+
+def _forwardcopies(a, b, match=None):
+    """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:
+            # short-circuit to avoid issues with merge states
+            return _dirstatecopies(w, match)
+
+    cm = _committedforwardcopies(a, b, match)
 
     # combine copies from dirstate if necessary
     if w is not None: