# HG changeset patch
# User Jason R. Coombs <jaraco@jaraco.com>
# Date 1666211022 14400
#      Wed Oct 19 16:23:42 2022 -0400
# Branch stable
# Node ID 5f778b3a94ca1c9f048e002d267899ed4651473e
# Parent  7787174f0a5a51361f846f5d90993b075c576ba9
shelve: handle empty parents and nodestoremove in shelvedstate (issue6748)

diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -278,9 +278,9 @@
         try:
             d[b'originalwctx'] = bin(d[b'originalwctx'])
             d[b'pendingctx'] = bin(d[b'pendingctx'])
-            d[b'parents'] = [bin(h) for h in d[b'parents'].split(b' ')]
+            d[b'parents'] = [bin(h) for h in d[b'parents'].split(b' ') if h]
             d[b'nodestoremove'] = [
-                bin(h) for h in d[b'nodestoremove'].split(b' ')
+                bin(h) for h in d[b'nodestoremove'].split(b' ') if h
             ]
         except (ValueError, KeyError) as err:
             raise error.CorruptedState(stringutil.forcebytestr(err))