问题
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?
回答1:
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 <nick.pierpoint@uk.bp.com>
date: Fri May 15 15:16:44 2015 +0100
summary: test one
回答2:
I should write it without parents:
hg log -r "min(branch(foo))"
Now it does what I need.
来源:https://stackoverflow.com/questions/30258322/mercurial-how-to-find-first-commit-on-specific-branch