is it possible to edit the commit message after the commit ?

Yves Dorfsman yves at zioup.com
Thu Jan 8 00:18:31 CST 2009


Zorba wrote:
> unfortunately the commit I'd like to change the error msg for is several 
> commits ago, and I don't want to undo the whole chain

There is a long (very long) winded way, and it will change the sha1's on all 
the successive change sets (not so good if you've shared your changes). I've 
being doing this a lot lately to fix tag issues (I have problems to get my 
head around mercurial tags !).

Assuming:
-your main repo is in /usr/local/repo/projectX
-tip is rev 51
-the rev you want to change the comment on is rev 26

Here you go, you need to add "transplant=" to your [extensions] ~/.hgrc, 
note that you need to pull and update twice in order to make a meaningfull 
rollback.

cd /tmp
hg init projectX
cd projectX
hg pull -r 25 /usr/local/repo/projectX
hg update
hg pull -r 26 /usr/local/repo/projectX
hg update
hg rollback
hg status
hg add xxx # here you need to hg do everything you did for this change, so 
hg add, hg rm etc....
for i in 27 28 ...... 50 51
   do
   hg transplant -s /usr/local/repo/projectX $i
   done

Unfortunately this will also completely screw up your tags (yoohoo !), so 
you should transplant the sets one by one, and rollback the ones that apply 
tags, and correct the .hgtags with the new sha1.

By the way, this is now your main repo, look at it carefully and delete the 
original when happy with this one.

-- 
Yves.
http://www.sollers.ca/blog/2008/FreeRunner/first_look/
http://www.sollers.ca/blog/2008/FreeRunner/premier_coup_d_%c5%93il/.fr



More information about the Mercurial mailing list