Revsets, sub-directories and merge commits
Marc Strapetz
marc.strapetz at syntevo.com
Tue Sep 29 19:21:26 UTC 2015
On 28.09.2015 17:11, Matt Mackall wrote:
> On Fri, 2015-09-25 at 12:25 +0200, Marc Strapetz wrote:
>> We are using revsets to create sub-directory logs using something like:
>>
>> $ hg log -r "file('sub/**')"
>
> FYI, that should be equivalent to:
>
> $ hg log sub
Yes, this one is also missing merge commits.
>> However this does not give me merge commits which are affecting 'sub'.
>
> This is actually another variant of the classic "how do you diff a
> merge" conundrum:
>
> https://mercurial.selenic.com/wiki/MergeDiffs
>
>
> However, there is a trick that might do what you want, depending on your
> merge strategy:
>
> $ hg log -r "file('sub/**') or (merge() and contains('set:modified() and
> sub/**'))'
>
> The second clause says: "also show me merges which contain any file that
> is modified relative to the first parent in sub/".
Unfortunately, this doesn't work for me. Even:
$ hg log -r "contains('sub/**')"
returns nothing.
hg log -r "adds('sub/**')"
hg log -r "modifies('sub/**')"
return proper results. But in combination with merge(), they return
nothing again:
hg log -r "merge() and adds('sub/**')"
hg log -r "merge() and modifies('sub/**')"
This is the entire log:
11:e359b631ef407c8d86ad616ef7c503506ae9d1ef
sub/a | 11 ++++++-----
10:b20ccdbd5022700f8b4bbeb549629bf10d5529c9
sub/e | 3 +++
9:da6177f3d905a21bf5ef7283595572389a3a875e
sub/d | 3 +++
8:668695645e3999e141d33be362788c6485914058
sub/c | 3 +++
7:7dec67c5c51f32341925c1f0171ea477d87a73a8
sub/b | 3 +++
6:57061ba10914eaa031d83f2d16533d63365a1f65
sub/a | 9 +++++----
5:bf5f8b0477fd68cd0d0e362f047625d0e7da23e8
sub/e | 3 +++
4:f8922ed98b17612ddd406e137ebc88822350f8db
sub/d | 3 +++
3:a59066674768040bce7ba5d81e67374ca6e7481b
sub/c | 3 +++
2:11ebd1b8ec4ac189bc9106bf3cfb2753e3459a17
sub/b | 3 +++
1:511efed0c19da223920c2f2a3bef95fc87f4bb98
sub/a | 7 ++++---
0:b5c739d990694ac3d174b4ff02479befab80b379
sub/a | 3 +++
Is it expected to work in this case?
Can file('sub/**') easily be fixed in the code to return also merge
commits if they are affecting the given set of files? Then I guess, it
shouldn't be too hard to write a custom revset keyword (extension) which
gives the same results?
-Marc
More information about the Mercurial
mailing list