Amending a changeset

Giorgos Keramidas keramida at ceid.upatras.gr
Tue Apr 22 09:24:17 CDT 2008


On Tue, 22 Apr 2008 11:10:27 +0200, Christian Boos <cboos at neuf.fr> wrote:
> leslie.polzer at gmx.net wrote:
>> Hello,
>>
>> in a recent changeset some changes that semantically belong to it are missing.
>> In Darcs I would now use AMEND-RECORD to add the remaining changes (they
>> are in the working copy right now and have not been committed yet).
>>
>> Is there a way to do this in hg?
>
> `hg rollback', then: `hg ci' again and this will now contain the new
> changes as well.
>
> The only feature I miss in the above sequence is that the original
> commit message is lost, so you actually have to remember to do something
> like:
>  hg tip --template '{desc}' > msg
> before doing the rollback.
>
> An `hg amend' extension automating the above would be handy (or maybe
> this could be grafted in the 'record' extension, as an --amend option?)

You can keep the original message (or even 'amend' it too), by using the
MQ extension to refresh/extend the latest 'tip' changeset:

    # Import the latest 'tip' to an MQ-controlled patch.

      hg qimport --git -r tip

    # Make some local workspace changes.

      hg add foo.c
      hg rm bar.c

    # Refresh the patch to include more files modified in the
    # current workspace, and edit its current commit log entry.

      hg qrefresh --edit

    # Release the tip from MQ control.

      hg qdelete -r tip



More information about the Mercurial mailing list