mercurial/cmdutil.py
changeset 18206 2c1276825e93
parent 18172 e6c5e0092469
parent 18198 9b4adaef0db9
child 18235 9807e7d596c3
--- a/mercurial/cmdutil.py	Thu Dec 20 19:22:12 2012 +0100
+++ b/mercurial/cmdutil.py	Wed Jan 02 00:24:28 2013 -0600
@@ -1617,7 +1617,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()
@@ -1633,10 +1633,13 @@
             # First, do a regular commit to record all changes in the working
             # directory (if there are any)
             ui.callhooks = False
+            currentbookmark = repo._bookmarkcurrent
             try:
+                repo._bookmarkcurrent = None
                 opts['message'] = 'temporary amend commit for %s' % old
                 node = commit(ui, repo, commitfunc, pats, opts)
             finally:
+                repo._bookmarkcurrent = currentbookmark
                 ui.callhooks = True
             ctx = repo[node]
 
@@ -1781,6 +1784,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