如何使用分支名称知道分支是否已关闭?
How to know if a branch is closed using it's branch name?
我的问题很直接 - 是否有关于 mercurial 的命令,您可以在其中检查分支是否已关闭或未使用其分支名称?
hg branch_name status
- closed
类似的东西。 .?
谢谢
考虑具有此历史记录的回购:
> hg log -G
_ changeset: 3:fde10e155a4c
| branch: two
| tag: tip
| summary: close branch two
|
o changeset: 2:dec57b99f3d8
| branch: two
| parent: 0:4b5a1a000402
| summary: add c
|
| o changeset: 1:1b3feb10b30e
|/ branch: one
| summary: add b
|
@ changeset: 0:4b5a1a000402
summary: Add a
有 3 个分支:default
、one
和 two
。分支 two
已关闭。
我们可以这样使用hg branches
:
--closed
选项还打印关闭的分支:
> hg branches --closed
one 1:1b3feb10b30e
two 3:fde10e155a4c (closed)
default 0:4b5a1a000402 (inactive)
因此,使用带有 grep 的简单 shell 管道:
> hg branches --closed | grep closed | grep two
two 3:fde10e155a4c (closed)
>
作为反例,使用分支 one
给出空输出,因为它没有关闭:
> hg branches --closed | grep closed | grep one
>
hg log -r "branch('branch_name') and head() and (closed())" -T "{branch}"
我用过的就是这个。
这基本上指出了T
之后的分支名称作为模板。
将 branch_name
替换为您的分支名称。
我的问题很直接 - 是否有关于 mercurial 的命令,您可以在其中检查分支是否已关闭或未使用其分支名称?
hg branch_name status
- closed
类似的东西。 .?
谢谢
考虑具有此历史记录的回购:
> hg log -G
_ changeset: 3:fde10e155a4c
| branch: two
| tag: tip
| summary: close branch two
|
o changeset: 2:dec57b99f3d8
| branch: two
| parent: 0:4b5a1a000402
| summary: add c
|
| o changeset: 1:1b3feb10b30e
|/ branch: one
| summary: add b
|
@ changeset: 0:4b5a1a000402
summary: Add a
有 3 个分支:default
、one
和 two
。分支 two
已关闭。
我们可以这样使用hg branches
:
--closed
选项还打印关闭的分支:
> hg branches --closed
one 1:1b3feb10b30e
two 3:fde10e155a4c (closed)
default 0:4b5a1a000402 (inactive)
因此,使用带有 grep 的简单 shell 管道:
> hg branches --closed | grep closed | grep two
two 3:fde10e155a4c (closed)
>
作为反例,使用分支 one
给出空输出,因为它没有关闭:
> hg branches --closed | grep closed | grep one
>
hg log -r "branch('branch_name') and head() and (closed())" -T "{branch}"
我用过的就是这个。
这基本上指出了T
之后的分支名称作为模板。
将 branch_name
替换为您的分支名称。