Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mercurial log of changests on merged named branches, but not unmerged

I want to be able to get a "hg log" of every changeset that appears in the graph between changeset1 and changeset2. I cannot find a way to do it without either a) omitting nodes on named branches that ARE merged between changeset1:changset2 or b) including nodes on named branches that ARE NOT ancestors of changeset2

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

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.

I can get too much info:

hg log -r 0:5 --template "{rev}:branch={branches},desc={desc}\n"

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

I can get too little info:

hg log -b default -r 0:5 --template "{rev}:branch={branches},desc={desc}\n"

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
like image 655
Mark Borgerding Avatar asked Dec 20 '10 22:12

Mark Borgerding


1 Answers

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)

See hg help revsets for more information.

like image 53
Niall C. Avatar answered Sep 24 '22 23:09

Niall C.