comparison mercurial/shelve.py @ 49560:5f778b3a94ca stable

shelve: handle empty parents and nodestoremove in shelvedstate (issue6748)
author Jason R. Coombs <jaraco@jaraco.com>
date Wed, 19 Oct 2022 16:23:42 -0400
parents a3356ab610fc
children 636cd96806a7
comparison
equal deleted inserted replaced
49559:7787174f0a5a 49560:5f778b3a94ca
276 def _verifyandtransform(cls, d): 276 def _verifyandtransform(cls, d):
277 """Some basic shelvestate syntactic verification and transformation""" 277 """Some basic shelvestate syntactic verification and transformation"""
278 try: 278 try:
279 d[b'originalwctx'] = bin(d[b'originalwctx']) 279 d[b'originalwctx'] = bin(d[b'originalwctx'])
280 d[b'pendingctx'] = bin(d[b'pendingctx']) 280 d[b'pendingctx'] = bin(d[b'pendingctx'])
281 d[b'parents'] = [bin(h) for h in d[b'parents'].split(b' ')] 281 d[b'parents'] = [bin(h) for h in d[b'parents'].split(b' ') if h]
282 d[b'nodestoremove'] = [ 282 d[b'nodestoremove'] = [
283 bin(h) for h in d[b'nodestoremove'].split(b' ') 283 bin(h) for h in d[b'nodestoremove'].split(b' ') if h
284 ] 284 ]
285 except (ValueError, KeyError) as err: 285 except (ValueError, KeyError) as err:
286 raise error.CorruptedState(stringutil.forcebytestr(err)) 286 raise error.CorruptedState(stringutil.forcebytestr(err))
287 287
288 @classmethod 288 @classmethod