Patchwork D6380: copies: fix duplicatecopies() with overlay context

login
register
mail settings
Submitter phabricator
Date May 15, 2019, 11:25 p.m.
Message ID <differential-rev-PHID-DREV-hmb5zv5krm7iykqb55l6-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/40071/
State Superseded
Headers show

Comments

phabricator - May 15, 2019, 11:25 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The reasoning for this check is in https://phab.mercurial-scm.org/rHG78d760aa3607f13c8d24b9a6807aa998c4d61f0a (duplicatecopies: do
  not mark items not in the dirstate as copies, 2013-03-28). The check
  was then moved to workingfilectx in https://phab.mercurial-scm.org/rHG754b5117622f2a60c408fcd61fa6183ccb1c1e92 (context: add
  workingfilectx.markcopied, 2017-10-15) and no corresponding check was
  added later when overlayworkingfilectx was added. Rather than adding
  the check there, this patch adds a more generic check on the callers
  side and removes the check in workingfilectx.markcopied().

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/context.py
  mercurial/copies.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -795,12 +795,10 @@ 
   $ hg co -q 0
   $ echo a2 > a
   $ hg ci -qm 'modify a'
-BROKEN: obviously...
   $ hg rebase -r . -d 1 --collapse
   rebasing 2:41c4ea50d4cf "modify a" (tip)
   merging b and a to b
-  abort: a@b977edf6f839: not found in manifest!
-  [255]
+  saved backup bundle to $TESTTMP/rebase-rename-collapse/.hg/strip-backup/41c4ea50d4cf-b90b7994-rebase.hg
   $ cd ..
 
 Test rebasing when the file we are merging in destination is empty
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -798,4 +798,5 @@ 
     for dst, src in pathcopies(repo[fromrev], repo[rev]).iteritems():
         if dst in exclude:
             continue
-        wctx[dst].markcopied(src)
+        if dst in wctx:
+            wctx[dst].markcopied(src)
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1773,8 +1773,7 @@ 
 
     def markcopied(self, src):
         """marks this file a copy of `src`"""
-        if self._repo.dirstate[self._path] in "nma":
-            self._repo.dirstate.copy(src, self._path)
+        self._repo.dirstate.copy(src, self._path)
 
     def clearunknown(self):
         """Removes conflicting items in the working directory so that