D6750: context: filter out invalid copies from workingctx.p[12]copies()

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Sep 5 15:16:24 EDT 2019


Closed by commit rHG2b869a515ba6: context: filter out invalid copies from workingctx.p[12]copies() (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6750?vs=16283&id=16379

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6750/new/

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

AFFECTED FILES
  mercurial/context.py
  tests/test-copies-in-changeset.t

CHANGE DETAILS

diff --git a/tests/test-copies-in-changeset.t b/tests/test-copies-in-changeset.t
--- a/tests/test-copies-in-changeset.t
+++ b/tests/test-copies-in-changeset.t
@@ -197,13 +197,37 @@
   $ echo a2 > a
   $ hg mv b c
   $ hg ci -m 'modify a, move b to c'
-  $ (hg --config ui.interactive=yes split 2>&1 | grep mercurial.error) <<EOF
+  $ hg --config ui.interactive=yes split <<EOF
   > y
   > y
   > n
   > y
   > EOF
-  mercurial.error.ProgrammingError: some copy targets missing from file list
+  diff --git a/a b/a
+  1 hunks, 1 lines changed
+  examine changes to 'a'?
+  (enter ? for help) [Ynesfdaq?] y
+  
+  @@ -1,1 +1,1 @@
+  -a
+  +a2
+  record this change to 'a'?
+  (enter ? for help) [Ynesfdaq?] y
+  
+  diff --git a/b b/c
+  rename from b
+  rename to c
+  examine changes to 'b' and 'c'?
+  (enter ? for help) [Ynesfdaq?] n
+  
+  created new head
+  diff --git a/b b/c
+  rename from b
+  rename to c
+  examine changes to 'b' and 'c'?
+  (enter ? for help) [Ynesfdaq?] y
+  
+  saved backup bundle to $TESTTMP/split/.hg/strip-backup/9a396d463e04-2d9e6864-split.hg
   $ cd ..
 
 Test committing half a rename
@@ -213,6 +237,5 @@
   $ echo a > a
   $ hg ci -Aqm 'add a'
   $ hg mv a b
-  $ hg ci -m 'remove a' a 2>&1 | grep mercurial.error
-  mercurial.error.ProgrammingError: some copy targets missing from file list
+  $ hg ci -m 'remove a' a
   $ cd ..
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1558,9 +1558,10 @@
         parents = self._repo.dirstate.parents()
         p1manifest = self._repo[parents[0]].manifest()
         p2manifest = self._repo[parents[1]].manifest()
+        changedset = set(self.added()) | set(self.modified())
         narrowmatch = self._repo.narrowmatch()
         for dst, src in self._repo.dirstate.copies().items():
-            if not narrowmatch(dst):
+            if dst not in changedset or not narrowmatch(dst):
                 continue
             if src in p1manifest:
                 p1copies[dst] = src



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


More information about the Mercurial-devel mailing list