changeset 22040:122fa73657c6

shelve: do not retract phase boundary by hand We rely on the internal mechanism to commit the changeset in the right state. This is similar to what the mq extension is doing. This is an important change as we plan to move phase movement with the transaction. Avoiding phase movement from high level code will avoid them the burden of transaction handling. It is also important to limit the need for transaction handling as this limits the odds of people messing up. Most common expected mess-up is to use a different transaction for changesets creation and phase adjustment.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 05 Aug 2014 14:37:45 -0700
parents 0aa2cb965f4c
children 97f86ce79abe
files hgext/shelve.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/shelve.py	Tue Aug 05 18:53:05 2014 -0700
+++ b/hgext/shelve.py	Tue Aug 05 14:37:45 2014 -0700
@@ -177,11 +177,14 @@
         hasmq = util.safehasattr(repo, 'mq')
         if hasmq:
             saved, repo.mq.checkapplied = repo.mq.checkapplied, False
+        backup = repo.ui.backupconfig('phases', 'new-commit')
         try:
+            repo.ui. setconfig('phases', 'new-commit', phases.secret)
             editor = cmdutil.getcommiteditor(editform='shelve.shelve', **opts)
             return repo.commit(message, user, opts.get('date'), match,
                                editor=editor)
         finally:
+            repo.ui.restoreconfig(backup)
             if hasmq:
                 repo.mq.checkapplied = saved
 
@@ -235,8 +238,6 @@
                 ui.status(_("nothing changed\n"))
             return 1
 
-        phases.retractboundary(repo, phases.secret, [node])
-
         fp = shelvedfile(repo, name, 'files').opener('wb')
         fp.write('\0'.join(shelvedfiles))
 
@@ -559,10 +560,13 @@
                 if hasmq:
                     saved, repo.mq.checkapplied = repo.mq.checkapplied, False
 
+                backup = repo.ui.backupconfig('phases', 'new-commit')
                 try:
+                    repo.ui. setconfig('phases', 'new-commit', phases.secret)
                     return repo.commit(message, 'shelve@localhost',
                                        opts.get('date'), match)
                 finally:
+                    repo.ui.restoreconfig(backup)
                     if hasmq:
                         repo.mq.checkapplied = saved