diff -r b0153cb8b64e -r f042d4b263f4 mercurial/localrepo.py --- a/mercurial/localrepo.py Thu Mar 13 19:48:41 2014 +0900 +++ b/mercurial/localrepo.py Wed Mar 19 01:07:41 2014 +0900 @@ -1270,6 +1270,11 @@ cctx._text = editor(self, cctx, subs) edited = (text != cctx._text) + # Save commit message in case this transaction gets rolled back + # (e.g. by a pretxncommit hook). Leave the content alone on + # the assumption that the user will use the same editor again. + msgfn = self.savecommitmessage(cctx._text) + # commit subs and write new state if subs: for s in sorted(commitsubs): @@ -1280,11 +1285,6 @@ newstate[s] = (newstate[s][0], sr) subrepo.writestate(self, newstate) - # Save commit message in case this transaction gets rolled back - # (e.g. by a pretxncommit hook). Leave the content alone on - # the assumption that the user will use the same editor again. - msgfn = self.savecommitmessage(cctx._text) - p1, p2 = self.dirstate.parents() hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '') try: