tags:

views:

67

answers:

4

Occasionally I commit some code to the repository, add a comment/summary, then read the summary back and realise I've made a mistake or should have included a bit more information. It is possible to edit the summary after a commit in TortoiseHg? I'm using version 1.1

+1  A: 

If you commit, but not pushed, you can rollback the last commit using

hg rollback

I'm not sure that this functionality is implemented in TortoiseHG, but you always can open console, go to the repo and type this command by self.

Zada Zorg
+1  A: 

If that is the last commit, you can press "Undo" button in the commit dialog (it is an interface to hg rollback) and then commit the same files again with a new message. If this is a commit in a middle of the tree, you need to use mq extension to delete all later commits and reapply them. And if the commit with an incorrect summary is pushed to a public repo, you should accept and live with that, because you should not change published commits.

wRAR
+1  A: 

Judging by the answers .. so the sum-up answer is,

Yes, it is possible if the last action was the commit of the changeset in question (in which case, execute the rollback command), and

No, it is not possible, not out of the box (without the mq extension and a lot of gruntwork), if the changeset in question has already been pushed or subsequent check-ins have been made.

I'm posting this answer because the other answers did not admit the 'no', only the 'if'. :) Feel free to vote down, I just wanted to spell out the inferences here.

stimpy77
+2  A: 

Phil - I'll post the same answer I just posted on this question (asked after yours):

One appropriate way to do this is to use histedit. Histedit allows you to remove, modify, combine or otherwise edit your previous commits.

Histedit does not ship with Mercurial and it cannot be used with TortoiseHg, but the command line usage is very simple:

> hg histedit <rev>

where is the revision you want to change the comment on. Histedit will generate a list of changesets and show you their SHA1. Besides each changeset there is a word indicating what histedit will do with each changeset once you close the text window. Next to the changeset you want to modify - replace 'pick' with 'edit'. Close the text window and then issue this command:

> hg histedit --continue

and another text window will appear containing the log message. Change the message to whatever you want. You can do this for multiple changesets in one go, provided the files have not been shared yet. This is a pretty trivial use of histedit, more complicated uses involved combining commits or removing a portion of some commit.

dls
+1 for the info. Thanks
Phil Hale