diff mercurial/cmdutil.py @ 18197:153659e86a5f stable

amend: invalidate dirstate in case of failure (issue3670) The temporary commit created by amend update the dirstate. If the final commit fails, we need to invalidate the change made to the dirstate, otherwise the release of the wlock will write the dirstate created after the rollbacked temporary commit. This dirstate writing logic should probably be handled in the same object than the transaction one. However such change are too big for stable.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Sat, 29 Dec 2012 18:00:18 +0100
parents 0c10cf819146
children 9b4adaef0db9
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Thu Dec 20 16:36:45 2012 -0600
+++ b/mercurial/cmdutil.py	Sat Dec 29 18:00:18 2012 +0100
@@ -1619,7 +1619,7 @@
     ui.note(_('amending changeset %s\n') % old)
     base = old.p1()
 
-    wlock = lock = None
+    wlock = lock = newid = None
     try:
         wlock = repo.wlock()
         lock = repo.lock()
@@ -1782,6 +1782,8 @@
             ui.note(_('stripping amended changeset %s\n') % old)
             repair.strip(ui, repo, old.node(), topic='amend-backup')
     finally:
+        if newid is None:
+            repo.dirstate.invalidate()
         lockmod.release(wlock, lock)
     return newid