Patchwork D8046: copies: fix crash when copy source is not in graft base

login
register
mail settings
Submitter phabricator
Date Jan. 30, 2020, 3:38 p.m.
Message ID <9ebba66d72fc3135ebf41e430104ea90@localhost.localdomain>
Download mbox | patch
Permalink /patch/44776/
State Not Applicable
Headers show

Comments

phabricator - Jan. 30, 2020, 3:38 p.m.
Closed by commit rHGa0f34033adf6: copies: fix crash when copy source is not in graft base (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8046?vs=19710&id=19716

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

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

AFFECTED FILES
  mercurial/copies.py
  tests/test-shelve.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -186,14 +186,9 @@ 
 
 the common case - no options or filenames
 
-  $ hg shelve 2>&1 | grep KeyError
-  KeyError: 'No such manifest entry.' (no-pure !)
-      raise KeyError (pure !)
-  KeyError (pure !)
-# Get out of the broken state so later tests work
-  $ hg forget b.rename/b c.copy ghost
-  $ hg revert a/a b/b d
-  $ rm a/a.orig b.rename/b c.copy
+  $ hg shelve
+  shelved as default-01
+  3 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ hg status -C
 
 ensure that our shelved changes exist
@@ -396,10 +391,10 @@ 
 #if phasebased
   $ hg heads -q --template '{rev}\n'
   8
-  6
+  5
   $ hg parents -q --template '{rev}\n'
   8
-  6
+  5
 #endif
 
 #if stripbased
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -527,6 +527,11 @@ 
         if src not in m1:
             # renamed on side 1, deleted on side 2
             renamedelete[src] = dsts1
+    elif src not in mb:
+        # Work around the "short-circuit to avoid issues with merge states"
+        # thing in pathcopies(): pathcopies(x, y) can return a copy where the
+        # destination doesn't exist in y.
+        pass
     elif m2[src] != mb[src]:
         if not _related(c2[src], base[src]):
             return