changing repository history

Giorgos Keramidas keramida at ceid.upatras.gr
Fri Aug 31 21:39:09 UTC 2007


On 2007-08-31 10:32, Charles Samuels <charles at vmware.com> wrote:
>On Friday 2007 August 31 04:45:51 am Manlio Perillo wrote:
>> 2) Is is possible to exclude "sections" of a repository?
>>     I have a repository converted from Subversion with this layout
>
> I would like to be able to change the last commit message made, before
> the push. So many times I think "oh, I forgot to say /this/ in my
> commit log".
>
> Sounds a bit tricky to implement though too.

If you haven't pushed the commit out to another repository yet,
you should be able to use MQ to change the commit log (but note
that this will also change the changeset hash too):

    1. Enable the MercurialQueues extension

       This can be done by adding to your ~/.hgrc file:

           [extensions]
           mq =

    2. Create a new "patch queue" in the workspace you committed

       You can use the "hg qinit" command inside the workspace where you
       committed the interesting change:

           $ hg qinit

    3. Import the "tip" of the repository as an "MQ patch"

       With MQ enabled and a patch-queue initialized, you can strip the
       tip of the repository, and extract its changes into an "MQ patch".
       This "MQ patch" can then be popped/pushed at will, or it can even
       be modified/edited:

           $ hg qimport --git -r tip PATCHNAME

    4. Now you can change the commit log with:

           $ hg qrefresh --git --edit

       Since you haven't modified anything, the patch contents will not
       be modified by step #4, but you will get a chance to edit the
       "commit log" of the patch.

       Save the editor buffer that "qrefresh" opened, and quit.

    5. Now that you have changed the commit log, you can convert the "MQ
       patch" back to a "real changeset" with "hg qdelete":

           $ hg qdelete -r tip

PS: This is a question which comes up so often that I should really add
it to the Wiki one of these days :-)




More information about the Mercurial mailing list