comparison hgext/shelve.py @ 40853:d7e44da4dc70

shelve: drop unnecessary backup of dirstate for phase-based case Regular shelve has a hack using an uncommitted transaction that's then aborted at the end of the operation. It preserves the dirstate across the abort, however, by saving a backup copy of it. Phase-based shelve instead commits the transaction, so the hack shouldn't be necessary there. Differential Revision: https://phab.mercurial-scm.org/D5389
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 05 Dec 2018 14:08:01 -0800
parents 29e4a77b5305
children 236af7cfa4c3
comparison
equal deleted inserted replaced
40852:1b836cee2d91 40853:d7e44da4dc70
444 extra['shelve_unknown'] = '\0'.join(s.unknown) 444 extra['shelve_unknown'] = '\0'.join(s.unknown)
445 repo[None].add(s.unknown) 445 repo[None].add(s.unknown)
446 446
447 def _finishshelve(repo): 447 def _finishshelve(repo):
448 if phases.supportinternal(repo): 448 if phases.supportinternal(repo):
449 backupname = 'dirstate.shelve'
450 tr = repo.currenttransaction() 449 tr = repo.currenttransaction()
451 repo.dirstate.savebackup(tr, backupname)
452 tr.close() 450 tr.close()
453 repo.dirstate.restorebackup(None, backupname)
454 else: 451 else:
455 _aborttransaction(repo) 452 _aborttransaction(repo)
456 453
457 def createcmd(ui, repo, pats, opts): 454 def createcmd(ui, repo, pats, opts):
458 """subcommand that creates a new shelve""" 455 """subcommand that creates a new shelve"""