Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine in Mercurial, if changeset, specified by revision, has already been grafted?

Tags:

mercurial

How can I see, if the changeset has already been grafted between branchX and default? I know, hg graft checks this for me, there I can't graft twice, but I want to list all changesets, which were not grafted between branchX and default. Thanks in advance for your answers.

like image 246
Yevgeniy Avatar asked Apr 24 '12 17:04

Yevgeniy


People also ask

What is HG graft?

hg graft allows "cherry-picking," as you noted in your question. For example, you can run hg graft -D "2085::2093 and not 2091" to copy only some changes from another revision. By comparison, hg rebase (with or without --keep ) will grab whatever changeset you specify and all of its decendant changes.

What does hg commit do?

Use the command hg update to switch to an existing branch. Use hg commit --close-branch to mark this branch head as closed. When all heads of a branch are closed, the branch will be considered closed.

What does HG update do?

Update sets the working directory's parent revision to the specified changeset (see hg help parents). If the changeset is not a descendant or ancestor of the working directory's parent and there are uncommitted changes, the update is aborted.


1 Answers

This information is stored in the so-called "extra" dictionary inside the grafted changeset. This is a simple key-value mapping that you can see with hg log --debug.

The information is unfortunately not exposed as a revset predicate yet, so you'll have to do it the old-fashioned way: start with

$ hg --debug log -b branchX

to get the changesets on branchX. Then grep or otherwise search for lines matching

extra:       source=[0-9a-f]{40}

You could use the Mercurial bindings if you want a more high-level access. There are libraries for Java, Python, and Scala at the moment.

like image 104
Martin Geisler Avatar answered Sep 20 '22 00:09

Martin Geisler