views:

63

answers:

2

Possible Duplicate:
Is it possible to edit a summary after a commit using TortoiseHg?

In Mercurial, if I forget to include the defect # in a check-in summary, how do you change the summary of a previously checked-in changeset, besides tweaking a flat-file and checking in a subsequent changeset just to comment on the previous check-in?

Using TortoiseHG.

+4  A: 

If you haven't shared the changeset, you can use rollback and/or strip to undo the changesets, then redo them correctly. rollback will undo a single changeset, while strip removes a arbitrary changeset, and all descendants.

Again, do not do this if you have already shared/pushed the changesets, or it can cause confusion.

In TortoiseHG, rollback is in the Recovery dialog, and strip is available in the revision context menu if you enable MQ.

Matthew Flaschen
+3  A: 

the 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 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
Thanks for your answser. Since this question is about to get closed/dropped, please copy your answer here: http://stackoverflow.com/questions/3510781/is-it-possible-to-edit-a-summary-after-a-commit-using-tortoisehg
stimpy77