Mercurial > hg
changeset 23950:caff3675cba5 stable
log: evaluate filesets on working copy, not its parent
When running "hg log 'set:added()'", we create two matchers: one used
for producing the revset and one used for finding files to match. In
1fd352aa08fc (graphlog: evaluate FILE/-I/-X filesets on the working
dir, 2012-02-26), we started passing a revision argument along from
what's currently in cmdutil._makelogrevset() to
revset._matchfiles(). When the revision was an empty string, it
referred to the working copy. This was subtly done with "repo[rev or
None]". Then, in f2aeff8a87b6 (revset: avoid recalculating filesets,
2014-10-22), that conversion from empty string to None was lost. Note
that repo[''] is equivalent to repo['.'], not repo[None].
The consequence of this, to the user, is that when running "hg log
'set:added()'", the file matcher matches files added in the working
copy, while the revset matcher matches revisions that touch files
added in the parent of the working copy. As a result, only revisions
that touch any files added in the parent of the working copy will be
considered, but they will only be included if they also touch files
added in the working copy.
Fix the bug by converting '' to None again, but make it a little more
explicit this time (plus, we now have tests for it).
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 21 Jan 2015 15:23:13 -0800 |
parents | 8efb7130a519 |
children | 42f3042cc17f |
files | mercurial/revset.py tests/test-fileset-generated.t |
diffstat | 2 files changed, 35 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revset.py Wed Jan 21 15:40:24 2015 -0800 +++ b/mercurial/revset.py Wed Jan 21 15:23:13 2015 -0800 @@ -1048,7 +1048,8 @@ # i18n: "_matchfiles" is a keyword raise error.ParseError(_('_matchfiles expected at most one ' 'revision')) - rev = value + if value != '': # empty means working directory; leave rev as None + rev = value elif prefix == 'd:': if default is not None: # i18n: "_matchfiles" is a keyword
--- a/tests/test-fileset-generated.t Wed Jan 21 15:40:24 2015 -0800 +++ b/tests/test-fileset-generated.t Wed Jan 21 15:23:13 2015 -0800 @@ -72,14 +72,17 @@ content1_content2_content3-tracked | 1 + 3 files changed, 3 insertions(+), 0 deletions(-) -BROKEN: rev 0 affects content1_missing_content*-tracked - $ hg log -T '{rev}\n' --stat 'set:added()' 1 content1_missing_content1-tracked | 1 - content1_missing_content3-tracked | 1 - 2 files changed, 0 insertions(+), 2 deletions(-) + 0 + content1_missing_content1-tracked | 1 + + content1_missing_content3-tracked | 1 + + 2 files changed, 2 insertions(+), 0 deletions(-) + $ hg log -T '{rev}\n' --stat 'set:removed()' 1 content1_content2_content1-untracked | 2 +- @@ -100,22 +103,37 @@ content1_content2_content3-untracked | 1 + content1_content2_missing-untracked | 1 + 7 files changed, 7 insertions(+), 0 deletions(-) - -BROKEN: rev 0 affects content1_content1_missing-tracked, -content1_content2_missing-tracked and content1_missing_missing-tracked. -rev 1 affects content1_content2_missing-tracked, -content1_missing_missing-tracked and missing_content2_missing-tracked - + $ hg log -T '{rev}\n' --stat 'set:deleted()' - -BROKEN: rev 0 and 1 affect content1_missing_content*-untracked - + 1 + content1_content2_missing-tracked | 2 +- + content1_missing_missing-tracked | 1 - + missing_content2_missing-tracked | 1 + + 3 files changed, 2 insertions(+), 2 deletions(-) + + 0 + content1_content1_missing-tracked | 1 + + content1_content2_missing-tracked | 1 + + content1_missing_missing-tracked | 1 + + 3 files changed, 3 insertions(+), 0 deletions(-) + $ hg log -T '{rev}\n' --stat 'set:unknown()' - -BROKEN: rev 1 affects content1_content2_content2-tracked and -missing_content2_content2-tracked - + 1 + content1_missing_content1-untracked | 1 - + content1_missing_content3-untracked | 1 - + 2 files changed, 0 insertions(+), 2 deletions(-) + + 0 + content1_missing_content1-untracked | 1 + + content1_missing_content3-untracked | 1 + + 2 files changed, 2 insertions(+), 0 deletions(-) + $ hg log -T '{rev}\n' --stat 'set:clean()' + 1 + content1_content2_content2-tracked | 2 +- + missing_content2_content2-tracked | 1 + + 2 files changed, 2 insertions(+), 1 deletions(-) + 0 content1_content1_content1-tracked | 1 + content1_content2_content2-tracked | 1 +