Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial - how to find first commit on specific branch

Tags:

mercurial

I wan't to determine the age of the "foo" branch. As I understand it is impossible to get this info straight. I trying to write command that will find information about first commit on the "foo" branch.

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

This one returns not exactly what I want. Can somebody help me?

like image 864
Kirill Reznikov Avatar asked May 15 '15 11:05

Kirill Reznikov


2 Answers

I should write it without parents:

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

Now it does what I need.

like image 166
Kirill Reznikov Avatar answered Nov 09 '22 01:11

Kirill Reznikov


Does this 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 changeset on the named branch.

So, first changeset on branch "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 the 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

Your min also works if you always want to return a single changeset:

% hg log -r "min(branch(testbranch))"
changeset:   107:bd91c8e6fa5f
branch:      testbranch
user:        Nick Pierpoint <[email protected]>
date:        Fri May 15 15:16:44 2015 +0100
summary:     test one
like image 40
Nick Pierpoint Avatar answered Nov 09 '22 00:11

Nick Pierpoint