Submitter | Martin von Zweigbergk |
---|---|
Date | Jan. 22, 2015, 10:21 p.m. |
Message ID | <4c7f9074043babd43c99.1421965288@martinvonz.mtv.corp.google.com> |
Download | mbox | patch |
Permalink | /patch/7534/ |
State | Accepted |
Commit | caff3675cba5225c4f32a2585eaa50fe53c2d942 |
Headers | show |
Comments
On Thu, 22 Jan 2015 14:21:28 -0800, Martin von Zweigbergk wrote: > # HG changeset patch > # User Martin von Zweigbergk <martinvonz@google.com> > # Date 1421882593 28800 > # Wed Jan 21 15:23:13 2015 -0800 > # Branch stable > # Node ID 4c7f9074043babd43c99f208279956f6814b5053 > # Parent 9e6464357f9dc8f145e30b0af89e3deb1bc5c2dd > 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). > > diff -r 9e6464357f9d -r 4c7f9074043b mercurial/fileset.py > --- a/mercurial/fileset.py Wed Jan 21 15:40:24 2015 -0800 > +++ b/mercurial/fileset.py Wed Jan 21 15:23:13 2015 -0800 > @@ -8,6 +8,7 @@ > import re > import parser, error, util, merge > from i18n import _ > +from mercurial.util import dst > > elements = { > "(": (20, ("group", 1, ")"), ("func", 1, ")")), > diff -r 9e6464357f9d -r 4c7f9074043b mercurial/revset.py > --- 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 I hope it will be possible to use "r:wdir" or "r:wc" here. I have experimental patch for "wdir" symbol. ;) Regards,
On Thu, 2015-01-22 at 14:21 -0800, Martin von Zweigbergk wrote: > # HG changeset patch > # User Martin von Zweigbergk <martinvonz@google.com> > # Date 1421882593 28800 > # Wed Jan 21 15:23:13 2015 -0800 > # Branch stable > # Node ID 4c7f9074043babd43c99f208279956f6814b5053 > # Parent 9e6464357f9dc8f145e30b0af89e3deb1bc5c2dd > log: evaluate filesets on working copy, not its parent These are both queued for stable, thanks.
Patch
diff -r 9e6464357f9d -r 4c7f9074043b mercurial/fileset.py --- a/mercurial/fileset.py Wed Jan 21 15:40:24 2015 -0800 +++ b/mercurial/fileset.py Wed Jan 21 15:23:13 2015 -0800 @@ -8,6 +8,7 @@ import re import parser, error, util, merge from i18n import _ +from mercurial.util import dst elements = { "(": (20, ("group", 1, ")"), ("func", 1, ")")), diff -r 9e6464357f9d -r 4c7f9074043b mercurial/revset.py --- 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 diff -r 9e6464357f9d -r 4c7f9074043b tests/test-fileset-generated.t --- 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 +