Mercurial-如何在特定分支上找到第一次提交 [英] Mercurial - how to find first commit on specific branch

查看:96
本文介绍了Mercurial-如何在特定分支上找到第一次提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不会确定"foo"分支的年龄.据我了解,不可能直接获得此信息.我试图编写命令来查找有关"foo"分支上第一次提交的信息.

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?

推荐答案

这是否满足您的需求?

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.

因此,分支"testbranch"上的第一个变更集

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

...添加template只是为了获取日期:

... 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

如果您始终想返回一个变更集,则您的min也可以使用:

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

这篇关于Mercurial-如何在特定分支上找到第一次提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆