[PATCH RFC] revset: completely ignore "null" symbol in new-style query (BC)

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Jan 8 17:51:48 CST 2015



On 01/06/2015 07:38 AM, Yuya Nishihara wrote:
> On Mon, 05 Jan 2015 15:45:17 -0600, Matt Mackall wrote:
>> On Sun, 2015-01-04 at 12:21 +0900, Yuya Nishihara wrote:
>>> This depends on my previous patch "revset: drop pre-lazyset optimization for
>>> stringset of subset == entire repo."  I want to know if "null" revision is
>>> supported in revset.
>>
>> We probably do want to support null. It's one of the primary barriers to
>> eliminating old-style queries. We also want to eventually support a
>> symbol/identifier that means "the working copy".
>
> So maybe we'll need a magic to extend the initial "subset" to null or "the
> working copy" symbol.  I'll try something like the following.
>
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -252,8 +252,6 @@ def _getrevsource(repo, r):
>
>   def stringset(repo, subset, x):
>       x = repo[x].rev()
> -    if x == -1 and len(subset) == len(repo):
> -        return baseset([-1])
>       if x in subset:
>           return baseset([x])
>       return baseset()
> @@ -3070,5 +3068,8 @@ class fullreposet(_spanset):
>               other.sort(reverse)
>           return other
>
> +    def __contains__(self, rev):
> +        return rev == -1 or super(fullreposet, self).__contains__(rev)
> +
>   # tell hggettext to extract docstrings from these functions:
>   i18nfunctions = symbols.values()

This looks a reasonable approach to me (and a good incentive to use 
fullreposet)


-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list