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

Yuya Nishihara yuya at tcha.org
Wed Feb 4 07:27:04 CST 2015


# HG changeset patch
# User Yuya Nishihara <yuya at 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)

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])
 


More information about the Mercurial-devel mailing list