changeset 45523:5ed6efedc457 stable

repoview: don't crash if mergestate points to non-existent node Differential Revision: https://phab.mercurial-scm.org/D9078
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 23 Sep 2020 15:36:15 -0700
parents 5a555d6e0d90
children 07731064ac41
files mercurial/repoview.py tests/test-obsolete.t
diffstat 2 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/repoview.py	Wed Sep 23 16:07:14 2020 -0700
+++ b/mercurial/repoview.py	Wed Sep 23 15:36:15 2020 -0700
@@ -70,8 +70,10 @@
 
     ms = mergestate.mergestate.read(repo)
     if ms.active():
-        pinned.add(ms.localctx.rev())
-        pinned.add(ms.otherctx.rev())
+        for node in (ms.local, ms.other):
+            rev = cl.index.get_rev(node)
+            if rev is not None:
+                pinned.add(rev)
 
     return pinned
 
--- a/tests/test-obsolete.t	Wed Sep 23 16:07:14 2020 -0700
+++ b/tests/test-obsolete.t	Wed Sep 23 15:36:15 2020 -0700
@@ -1826,8 +1826,8 @@
     ancestor path: file (node bc7ebe2d260cff30d2a39a130d84add36216f791)
     other path: file (node b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3)
     extra: ancestorlinknode = b73b8c9a4ab4da89a5a35a6f10dfb13edc84ca37
-BROKEN: We should be able to see the log (without the deleted commit, of course)
+We should be able to see the log (without the deleted commit, of course)
   $ hg log -G
-  abort: unknown revision 'b73b8c9a4ab4da89a5a35a6f10dfb13edc84ca37'!
-  [255]
+  @  0:f53e9479dce5 (draft) [tip ] first
+  
   $ cd ..