commit: print "commit message saved in" message also if bookmark update fails
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 16 Jan 2019 17:46:39 -0800
changeset 41361 092c5d05ba01
parent 41360 784ab13b340f
child 41362 57c462db87fd
commit: print "commit message saved in" message also if bookmark update fails The bookmark update is done within the same transaction, so if fails, the commit will also be rolled back. I just happened to notice this while messing with this code; we have not had reports of crashing bookmark updates from our users. The same applies to the clearing of the merge state, although I don't think that's currently tied into the transaction. Differential Revision: https://phab.mercurial-scm.org/D5621
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Thu Jan 17 22:07:58 2019 -0800
+++ b/mercurial/localrepo.py	Wed Jan 16 17:46:39 2019 -0800
@@ -2475,16 +2475,16 @@
                           parent2=hookp2)
                 tr = self.transaction('commit')
                 ret = self.commitctx(cctx, True)
+                # update bookmarks, dirstate and mergestate
+                bookmarks.update(self, [p1, p2], ret)
+                cctx.markcommitted(ret)
+                ms.reset()
+                tr.close()
             except: # re-raises
                 if edited:
                     self.ui.write(
                         _('note: commit message saved in %s\n') % msgfn)
                 raise
-            # update bookmarks, dirstate and mergestate
-            bookmarks.update(self, [p1, p2], ret)
-            cctx.markcommitted(ret)
-            ms.reset()
-            tr.close()
 
         finally:
             lockmod.release(tr, lock, wlock)