D5621: commit: print "commit message saved in" message also if bookmark update fails

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Jan 17 05:28:29 UTC 2019


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5621

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2474,16 +2474,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)



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list