Mercurial > public > mercurial-scm > hg
diff hgext/shelve.py @ 39519:5d69e2412ec8
shelve: use the internal phase when possible
If the repository support it, use the internal phase for all changesets
created by shelve.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Tue, 29 May 2018 12:12:18 +0200 |
parents | da84cca65036 |
children | 84d6e9a2b104 |
line wrap: on
line diff
--- a/hgext/shelve.py Thu Aug 23 00:41:20 2018 -0700 +++ b/hgext/shelve.py Tue May 29 12:12:18 2018 +0200 @@ -140,11 +140,14 @@ def applybundle(self): fp = self.opener() try: + targetphase = phases.internal + if not phases.supportinternal(self.repo): + targetphase = phases.secret gen = exchange.readbundle(self.repo.ui, fp, self.fname, self.vfs) bundle2.applybundle(self.repo, gen, self.repo.currenttransaction(), source='unshelve', url='bundle:' + self.vfs.join(self.fname), - targetphase=phases.secret) + targetphase=targetphase) finally: fp.close() @@ -380,7 +383,11 @@ hasmq = util.safehasattr(repo, 'mq') if hasmq: saved, repo.mq.checkapplied = repo.mq.checkapplied, False - overrides = {('phases', 'new-commit'): phases.secret} + + targetphase = phases.internal + if not phases.supportinternal(repo): + targetphase = phases.secret + overrides = {('phases', 'new-commit'): targetphase} try: editor_ = False if editor: @@ -702,7 +709,10 @@ repo.setparents(state.pendingctx.node(), nodemod.nullid) repo.dirstate.write(repo.currenttransaction()) - overrides = {('phases', 'new-commit'): phases.secret} + targetphase = phases.internal + if not phases.supportinternal(repo): + targetphase = phases.secret + overrides = {('phases', 'new-commit'): targetphase} with repo.ui.configoverride(overrides, 'unshelve'): with repo.dirstate.parentchange(): repo.setparents(state.parents[0], nodemod.nullid)