##// END OF EJS Templates
commit: if relevant, tell user their commit message was saved....
Greg Ward -
r9935:48b81d9b default
parent child Browse files
Show More
@@ -825,6 +825,7 b' class localrepository(repo.repository):'
825 extra, changes)
825 extra, changes)
826 if editor:
826 if editor:
827 cctx._text = editor(self, cctx, subs)
827 cctx._text = editor(self, cctx, subs)
828 edited = (text != cctx._text)
828
829
829 # commit subs
830 # commit subs
830 if subs:
831 if subs:
@@ -844,7 +845,14 b' class localrepository(repo.repository):'
844 msgfile.write(cctx._text.rstrip() + '\n')
845 msgfile.write(cctx._text.rstrip() + '\n')
845 msgfile.close()
846 msgfile.close()
846
847
847 ret = self.commitctx(cctx, True)
848 try:
849 ret = self.commitctx(cctx, True)
850 except:
851 if edited:
852 msgfn = self.pathto(msgfile.name[len(self.root)+1:])
853 self.ui.write(
854 _('note: commit message saved in %s\n') % msgfn)
855 raise
848
856
849 # update dirstate and mergestate
857 # update dirstate and mergestate
850 for f in changes[0] + changes[1]:
858 for f in changes[0] + changes[1]:
@@ -34,6 +34,15 b' hg branch'
34 echo '% rollback by pretxncommit saves commit message (issue 1635)'
34 echo '% rollback by pretxncommit saves commit message (issue 1635)'
35 echo a >> a
35 echo a >> a
36 hg --config hooks.pretxncommit=/bin/false commit -m"precious commit message"
36 hg --config hooks.pretxncommit=/bin/false commit -m"precious commit message"
37
38 echo '.hg/last-message.txt:'
37 echo '.hg/last-message.txt:'
39 cat .hg/last-message.txt
38 cat .hg/last-message.txt
39
40 echo '% same thing, but run $EDITOR'
41 cat > $HGTMP/editor <<'__EOF__'
42 #!/bin/sh
43 echo "another precious commit message" > "$1"
44 __EOF__
45 chmod +x $HGTMP/editor
46 HGEDITOR=$HGTMP/editor hg --config hooks.pretxncommit=/bin/false commit
47 echo '.hg/last-message.txt:'
48 cat .hg/last-message.txt
@@ -34,3 +34,10 b' rollback completed'
34 abort: pretxncommit hook exited with status 1
34 abort: pretxncommit hook exited with status 1
35 .hg/last-message.txt:
35 .hg/last-message.txt:
36 precious commit message
36 precious commit message
37 % same thing, but run $EDITOR
38 transaction abort!
39 rollback completed
40 note: commit message saved in .hg/last-message.txt
41 abort: pretxncommit hook exited with status 1
42 .hg/last-message.txt:
43 another precious commit message
General Comments 0
You need to be logged in to leave comments. Login now