Patchwork [2,of,2] revset: have rev() validate input by repo.changelog.__contains__()

login
register
mail settings
Submitter Yuya Nishihara
Date Feb. 4, 2015, 1:27 p.m.
Message ID <0baf93f6596356137e85.1423056424@mimosa>
Download mbox | patch
Permalink /patch/7658/
State Accepted
Headers show

Comments

Yuya Nishihara - Feb. 4, 2015, 1:27 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1423053426 -32400
#      Wed Feb 04 21:37:06 2015 +0900
# Node ID 0baf93f6596356137e85126ac340971fe4ec667e
# Parent  f65a44d4905a5b4767e4b901de6ed1efe703611f
revset: have rev() validate input by repo.changelog.__contains__()

fullreposet.__contains__() will be rewritten in order to support "null"
revision, and "rev()" won't be possible to rely on it.

This backs out eb763217152a, but there is no performance regression now.

revisions:
0) e1dbe0b215ae "l not in fullreposet(repo)"
1) this patch   "l not in repo.changelog"

revset #0: rev(210000)
0) wall 0.000056 comb 0.000000 user 0.000000 sys 0.000000 (best of 48036)
1) wall 0.000049 comb 0.000000 user 0.000000 sys 0.000000 (best of 54969)
Pierre-Yves David - Feb. 4, 2015, 4:21 p.m.
On 02/04/2015 01:27 PM, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1423053426 -32400
> #      Wed Feb 04 21:37:06 2015 +0900
> # Node ID 0baf93f6596356137e85126ac340971fe4ec667e
> # Parent  f65a44d4905a5b4767e4b901de6ed1efe703611f
> revset: have rev() validate input by repo.changelog.__contains__()

pushed to the clowncopter.

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1547,7 +1547,7 @@  def rev(repo, subset, x):
     except (TypeError, ValueError):
         # i18n: "rev" is a keyword
         raise error.ParseError(_("rev expects a number"))
-    if l not in fullreposet(repo) and l != node.nullrev:
+    if l not in repo.changelog and l != node.nullrev:
         return baseset()
     return subset & baseset([l])