问题描述
我希望能够获取图表之间出现的每个变更集的汞日志"变更集1和变更集2.我无法找到一种方法来做到这一点a)省略在changeset1:changset2之间合并的命名分支上的节点或b)在命名分支上包含不是changeet2祖先的节点
I want to be able to get a "hg log" of every changeset that appears in the graph betweenchangeset1 and changeset2. I cannot find a way to do it without eithera) omitting nodes on named branches that ARE merged between changeset1:changset2or b) including nodes on named branches that ARE NOT ancestors of changeset2
这是一个简单示例的"hg glog",其中包含2个命名分支和默认分支.一个命名分支被合并,因此它的节点是相关的,另一分支是不相关的:
Here's a "hg glog" of a simple example with 2 named branches plus the default branch. One named branch gets merged and so its nodes are relevant, the other is irrelevant:
@ changeset: 5:e384fe418e9b
|\ tag: tip
| | parent: 2:7dc7af503071
| | parent: 3:0a9be59d576e
| | summary: merge somefeature branch into default
| |
| | o changeset: 4:4e8c9ca127c9
| | | branch: unmerged_feature
| | | parent: 1:ef98ad136fa8
| | | summary: change that is not merged into ending changeset
| | |
| o | changeset: 3:0a9be59d576e
| |/ branch: somefeature
| | parent: 1:ef98ad136fa8
| | summary: changed b.txt
| |
o | changeset: 2:7dc7af503071
| summary: changed a.txt
|
o changeset: 1:ef98ad136fa8
| summary: added b.txt
|
o changeset: 0:271b22b4ad30
summary: added a.txt
我想要一个log命令,该命令将为我提供所有版本0的后代节点和版本5的祖先节点.这是除了版本4之外的所有内容.
I want a log command that will give me all the nodes that are descendent of rev 0 and ancestors of rev 5. This is everything except rev 4.
我可以获得太多信息:
hg log -r 0:5 --template "{rev}:branch={branches},desc={desc}\n"
这给了我第4版的日志条目,而不是第5版的祖先:
This gives me a log entry for rev 4, which is not an ancestor of rev 5:
0:branch=,desc=added a.txt
1:branch=,desc=added b.txt
2:branch=,desc=changed a.txt
3:branch=somefeature,desc=changed b.txt
4:branch=unmerged_feature,desc=change that is not merged into ending changeset
5:branch=,desc=merge somefeature branch into default
我得到的信息太少了:
hg log -b default -r 0:5 --template "{rev}:branch={branches},desc={desc}\n"
省略版本3,它是版本0的后代,是版本5的祖先.
omits rev 3, which is a descendent of rev 0 and ancestor of rev 5
0:branch=,desc=added a.txt
1:branch=,desc=added b.txt
2:branch=,desc=changed a.txt
5:branch=,desc=merge somefeature branch into default
推荐答案
如果您使用的是Mercurial的较新版本(1.6.0或更高版本),则可以使用功能.在这种情况下,您需要ancestors()运算符:
If you're using a newer version of Mercurial (1.6.0 or higher), you can use the revsets feature. In this case, you need the ancestors() operator:
hg log --rev ancestors(5)
有关更多信息,请参见hg help revsets
.
See hg help revsets
for more information.
这篇关于合并的命名分支上的变更日志,但未合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!