changeset 44210:d0c3eead515a

copies: fix crash when copy source is not in graft base Differential Revision: https://phab.mercurial-scm.org/D8046
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 29 Jan 2020 23:14:31 -0800
parents ae4d729eb3c8
children fc7175df6359
files mercurial/copies.py tests/test-shelve.t
diffstat 2 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/copies.py	Wed Jan 29 23:05:02 2020 -0800
+++ b/mercurial/copies.py	Wed Jan 29 23:14:31 2020 -0800
@@ -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
--- a/tests/test-shelve.t	Wed Jan 29 23:05:02 2020 -0800
+++ b/tests/test-shelve.t	Wed Jan 29 23:14:31 2020 -0800
@@ -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