I tried several different methods (including the Convert Extension , which I found created an unrelated repository). The recommendations of the Mercurial wiki for editing history using MQ were most helpful. (Of course, the usual warnings about changing any public history are a bad idea, but the local changes that you only have are OK for editing).
I briefly outline the main steps here and clarify the mechanics of changing the author. Assuming that the first erroneous author was fixed in the BAD edition (and you did not publish anything anywhere), you should be able to do the following (suppose you are in the root of the repository):
Enable MQ by adding it to $ HOME / .hg / hgrc
[extensions] hgext.mq=
Convert recent changes to patches:
$ hg qimport -r BAD:tip
(Now they can be found in .hg/patches )
Do not use all patches (suppose they were applied and canceled them) to get your repository in check state before BAD :
$ hg qpop -a
If you look at your patches, you will see that the author is encoded as a comment line in all corrections:
$ grep User .hg/patches/* .hg/patches/102.diff:
Now use your favorite search / replace tool to fix corrections (I use Perl here). Suppose you want the commit name to be f.lastname@righturl.example.com :
$ perl -pi -e 's/f\.lastname\@oops\.wrongurl\.example\.com/f.lastname\@righturl.example.com/' .hg/patches/*.diff
Now verify that you have successfully changed the author’s name and reapplied the corrections:
$ hg qpush -a
Then convert the applied fixes to the necessary changes:
$ hg qfinish -a
And you're done. Your repository is still displayed as linked, so you won’t receive complaints that you clicked.
Andy MacKinlay Oct 15 '13 at 3:43 on 2013-10-15 03:43
source share