Submitter | Yuya Nishihara |
---|---|
Date | March 21, 2020, 5:26 a.m. |
Message ID | <98b60b759e2623db637a.1584768415@mimosa> |
Download | mbox | patch |
Permalink | /patch/45860/ |
State | Accepted |
Headers | show |
Comments
That series looks good to me. On 3/21/20 6:26 AM, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1584765728 -32400 > # Sat Mar 21 13:42:08 2020 +0900 > # Node ID 98b60b759e2623db637a2ff68eadd5b7e6a8dc12 > # Parent 1c189a6e5aa76bf71d5078597fd01c1f959244a2 > revset: leverage internal _rev() function to implement rev() > > Now 'rev(n)' is identical to 'present(_rev(n))'. > > diff --git a/mercurial/revset.py b/mercurial/revset.py > --- a/mercurial/revset.py > +++ b/mercurial/revset.py > @@ -2082,19 +2082,11 @@ def removes(repo, subset, x): > > @predicate(b'rev(number)', safe=True) > def rev(repo, subset, x): > - """Revision with the given numeric identifier. > - """ > - # i18n: "rev" is a keyword > - l = getargs(x, 1, 1, _(b"rev requires one argument")) > + """Revision with the given numeric identifier.""" > try: > - # i18n: "rev" is a keyword > - l = int(getstring(l[0], _(b"rev requires a number"))) > - except (TypeError, ValueError): > - # i18n: "rev" is a keyword > - raise error.ParseError(_(b"rev expects a number")) > - if l not in repo.changelog and l not in _virtualrevs: > + return _rev(repo, subset, x) > + except error.RepoLookupError: > return baseset() > - return subset & baseset([l]) > > > @predicate(b'_rev(number)', safe=True) > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel >
queued per marmoute review, thanks > On Mar 21, 2020, at 06:51, Pierre-Yves David <pierre-yves.david@ens-lyon.org> wrote: > > That series looks good to me. > > On 3/21/20 6:26 AM, Yuya Nishihara wrote: >> # HG changeset patch >> # User Yuya Nishihara <yuya@tcha.org> >> # Date 1584765728 -32400 >> # Sat Mar 21 13:42:08 2020 +0900 >> # Node ID 98b60b759e2623db637a2ff68eadd5b7e6a8dc12 >> # Parent 1c189a6e5aa76bf71d5078597fd01c1f959244a2 >> revset: leverage internal _rev() function to implement rev() >> Now 'rev(n)' is identical to 'present(_rev(n))'. >> diff --git a/mercurial/revset.py b/mercurial/revset.py >> --- a/mercurial/revset.py >> +++ b/mercurial/revset.py >> @@ -2082,19 +2082,11 @@ def removes(repo, subset, x): >> @predicate(b'rev(number)', safe=True) >> def rev(repo, subset, x): >> - """Revision with the given numeric identifier. >> - """ >> - # i18n: "rev" is a keyword >> - l = getargs(x, 1, 1, _(b"rev requires one argument")) >> + """Revision with the given numeric identifier.""" >> try: >> - # i18n: "rev" is a keyword >> - l = int(getstring(l[0], _(b"rev requires a number"))) >> - except (TypeError, ValueError): >> - # i18n: "rev" is a keyword >> - raise error.ParseError(_(b"rev expects a number")) >> - if l not in repo.changelog and l not in _virtualrevs: >> + return _rev(repo, subset, x) >> + except error.RepoLookupError: >> return baseset() >> - return subset & baseset([l]) >> @predicate(b'_rev(number)', safe=True) >> _______________________________________________ >> Mercurial-devel mailing list >> Mercurial-devel@mercurial-scm.org >> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > > -- > Pierre-Yves David > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Patch
diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2082,19 +2082,11 @@ def removes(repo, subset, x): @predicate(b'rev(number)', safe=True) def rev(repo, subset, x): - """Revision with the given numeric identifier. - """ - # i18n: "rev" is a keyword - l = getargs(x, 1, 1, _(b"rev requires one argument")) + """Revision with the given numeric identifier.""" try: - # i18n: "rev" is a keyword - l = int(getstring(l[0], _(b"rev requires a number"))) - except (TypeError, ValueError): - # i18n: "rev" is a keyword - raise error.ParseError(_(b"rev expects a number")) - if l not in repo.changelog and l not in _virtualrevs: + return _rev(repo, subset, x) + except error.RepoLookupError: return baseset() - return subset & baseset([l]) @predicate(b'_rev(number)', safe=True)