I have a few branches and a commit with ID X, I want Mercurial to return me a list of branches where that commit exists.
Mercurial already stores information about branch in every commit, but only about a branch in which that commit was introduced. If you merge that commit into some other branch, commit will still store only original branch name.
I think you could get what you want with this formula
hg log -r 'descendants(X) and head()'
head()
includes all named branch heads, so even if the tip of a branch has been merged into another named branch, it will still be listed with this formula.
If you only want to show branch names, you will probably want to use the --template '{branches}\n'
directive for the hg log
command. If you have more than one head per named branch, you may end up using uniq
or similar.
EDIT: To describe what this will do
A----B----C----D----E Branch: default (E is a merge of F into D)
\ \ \ /
\ \ F Branch B1 (closed)
\ G-----H Branch B2
\ \
\ I Branch B2
J Branch B3
If you execute hg log -r 'descendants(C) and head()'
, you should get E, F, H and I.
head()
, so it shows up on this listIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With