[PATCH] revset: support "follow(renamed.py, e22f4f3f06c3)" (issue5334)

Gábor STEFANIK Gabor.STEFANIK at nng.com
Fri Aug 19 09:56:58 EDT 2016



>


--------------------------------------------------------------------------
This message, including its attachments, is confidential. For more information please read NNG's email policy here:
http://www.nng.com/emailpolicy/
By responding to this email you accept the email policy.


-----Original Message-----
> From: Yuya Nishihara [mailto:youjah at gmail.com] On Behalf Of Yuya
> Nishihara
> Sent: Friday, August 19, 2016 3:43 PM
> To: Gábor STEFANIK <Gabor.STEFANIK at nng.com>
> Cc: mercurial-devel at mercurial-scm.org
> Subject: Re: [PATCH] revset: support "follow(renamed.py, e22f4f3f06c3)"
> (issue5334)
>
> On Thu, 18 Aug 2016 10:30:47 -0500, Gábor Stefanik wrote:
> > # HG changeset patch
> > # User Gábor Stefanik <gabor.stefanik at nng.com> # Date 1471533910 -7200
> > #      Thu Aug 18 17:25:10 2016 +0200
> > # Node ID fa3058c43a2378ad9256bbe2aa735ed20de4396b
> > # Parent  b1809f5d7630a3fff0fa715bbd30dba0f07672a8
> > revset: support "follow(renamed.py, e22f4f3f06c3)" (issue5334)
>
> Adding startrev makes sense to me.
>
> > --- a/mercurial/revset.py
> > +++ b/mercurial/revset.py
> > @@ -999,12 +999,17 @@
> >      return limit(repo, subset, x)
> >
> >  def _follow(repo, subset, x, name, followfirst=False):
> > -    l = getargs(x, 0, 1, _("%s takes no arguments or a pattern") % name)
> > +    l = getargs(x, 0, 2, _("%s takes no arguments or a pattern "
> > +                           "and an optional revset") % name)
> >      c = repo['.']
> >      if l:
> >          x = getstring(l[0], _("%s expected a pattern") % name)
> > +        rev = None
> > +        if len(l) >= 2:
> > +            rev = getset(repo, subset, l[1]).last()
> > +            c = repo[rev]
>
> startrev shouldn't be narrowed by the subset. Instead, use fullreposet(repo)
> so we can do ":10 & follow(file, 100)" for example.

Good catch.

>
> And we'll need to check if startrev is empty or not. last() returns None if the
> set is empty. Or we might want to specify a set of start revisions?

Will add an "if rev is not None:" check here.

A set of multiple start revisions doesn't really make sense IMO. The only reason why this parameter is a revset rather than just a string is to avoid exposing the index domain of repo[...] (an implementation detail) in the UI.


More information about the Mercurial-devel mailing list