[PATCH V2] revset: evaluate filesets against each revision for 'file()' (issue5778)

Yuya Nishihara yuya at tcha.org
Thu Feb 1 12:34:57 UTC 2018


On Wed, 31 Jan 2018 23:28:53 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1517166539 18000
> #      Sun Jan 28 14:08:59 2018 -0500
> # Branch stable
> # Node ID 1cb013a6f74e22a1867962bdd9a810c787dd4944
> # Parent  768326377e4d34e3724fe14033723e2c50adb98e
> revset: evaluate filesets against each revision for 'file()' (issue5778)

Queued modified version for stable, thanks.

> I'm not sure what the right behavior for that is (1fd352aa08fc
> explicitly enabled this behavior for graphlog), but the day before the release
> isn't the time to experiment.

It's desired behavior. Log filesets are evaluated against wctx no matter if
they are "slow" or not.

> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -1065,8 +1065,7 @@
>              if rev is not None:
>                  raise error.ParseError('_matchfiles expected at most one '
>                                         'revision')
> -            if value != '': # empty means working directory; leave rev as None
> -                rev = value
> +            rev = value
>          elif prefix == 'd:':
>              if default is not None:
>                  raise error.ParseError('_matchfiles expected at most one '
> @@ -1076,9 +1075,11 @@
>              raise error.ParseError('invalid _matchfiles prefix: %s' % prefix)
>      if not default:
>          default = 'glob'
> +    if rev == '':
> +        rev = node.wdirrev

I've mode this back to the loop so _matchfiles('r:', 'r:bar') is rejected.

> +The fileset revset is evaluated for each revision, instead of once on wdir(),
> +and then patterns matched on each revision.  Here, no exec bits are set in
> +wdir(), but a matching revision is detected.

Added "chmod -x" here because .hgfs/large2 matched 'set:exec()' on Linux.
Perhaps this is a bug of largefiles.

#if execbit
  $ chmod -x .hglf/large2
#endif

> +
> +  $ hg file 'set:exec()'
> +  [1]
> +  $ hg log -r 'file("set:exec()")'

And made it -q because the revision 9 isn't tip.

> +  changeset:   9:be1b433a65b1
> +  tag:         tip


More information about the Mercurial-devel mailing list