Mercurial - how to find the first commit on a specific branch

I have not determined the age of the "foo" branch. As far as I understand, it is impossible to get this information directly. I am trying to write a command that will find information about the first commit in the "foo" branch.

hg log -r "parents(min(branch(foo)))"

      

This returns not what I want. Can anyone help me?

+3


source to share


2 answers


Does it give you what you need?

hg log -r "branch(default) and 0:" -l 1 --template "{date|isodate}\n"

      

I think this gives you the date of the first set of changes on the named branch.

So the first set of changes on the "testbranch"

% hg log -r "branch(testbranch) and 0:" -l 1
changeset:   107:bd91c8e6fa5f
branch:      testbranch
user:        Nick Pierpoint
date:        Fri May 15 15:16:44 2015 +0100
summary:     test one

      



... adding template

just to get the date:

% hg log -r "branch(testbranch) and 0:" -l 1 --template "{date|isodate}\n"
2015-05-15 15:16 +0100

      

Yours min

also works if you always want to revert one changeset:

% hg log -r "min(branch(testbranch))"
changeset:   107:bd91c8e6fa5f
branch:      testbranch
user:        Nick Pierpoint <nick.pierpoint@uk.bp.com>
date:        Fri May 15 15:16:44 2015 +0100
summary:     test one

      

+2


source


I have to write it without parents

:

hg log -r "min(branch(foo))"

      



Now he does what I need.

+2


source







All Articles