1

I stopped using hg fetch to pull and merge in another head for a Mercurial repository because I like to make the commit message say what is merging with what. Furthermore, I am moving from "merge repo1 -> repo2" to a more specific "merge head1guid -> head2guid" format.

How can I automate this so I don't have to list the heads with hg heads then copy and paste the guids for the two changesets into my commit message?

Community
  • 1
  • 1
adambox
  • 24,261
  • 9
  • 32
  • 34
  • You know that the guids from the two heads are already displayed in the commit log message? – Ned Deily Apr 18 '12 at 16:28
  • so they are! ha! I'm using Kiln (from Fog Creek Software) so I'm usually looking at that, and the two heads are shown only in the diff view, not the history view (DAG) – adambox Apr 18 '12 at 17:00

1 Answers1

1

As others have pointed out in comments the one or two parents of a changeset are already stored in a changeset and shown in hg log and other command line views -- You're probably better off not re-storing them.

If you really wanted to you could do something like:

hg commit -m "merging $(hg log -r . --template '{parents}')"

but I always try to put something actually useful in the message like "Merging Jim's work on foo into Alice's work on bar"; there's no new information in re-storing the nodeids of the parents.

Note that command only works when you're committing a merge -- it'll be empty otherise.

Ry4an Brase
  • 78,112
  • 7
  • 148
  • 169