Mercurial > public > mercurial-scm > hg
diff mercurial/revset.py @ 25265:e16456831516 stable
revset: drop magic of fullreposet membership test (issue4682)
This patch partially backs out d2de20e1451f and adds an alternative workaround
to functions that evaluate "null" and "wdir()". Because the new workaround is
incomplete, "first(null)" and "min(null)" don't work as expected. But they were
not usable until 3.4 and "null" isn't commonly used, we can postpone a complete
fix for 3.5.
The issue4682 was caused because "branch(default)" is evaluated to
"<filteredset <fullreposet>>", keeping fullreposet magic. The next patch will
fix crash on "branch(null)", but without this patch, it would make
"null in <branch(default)>" be True, which means "children(branch(default))"
would return all revisions but merge (p2 != null).
I believe the right fix is to stop propagating fullreposet magic on filter(),
but it wouldn't fit to stable release. Also, we should discuss how to handle
"null" and "wdir()" in revset before.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 24 May 2015 10:29:33 +0900 |
parents | 8b99e9a8db05 |
children | 61b3529e2377 |
line wrap: on
line diff
--- a/mercurial/revset.py Fri May 22 12:13:18 2015 -0500 +++ b/mercurial/revset.py Sun May 24 10:29:33 2015 +0900 @@ -330,7 +330,8 @@ def stringset(repo, subset, x): x = repo[x].rev() - if x in subset: + if (x in subset + or x == node.nullrev and isinstance(subset, fullreposet)): return baseset([x]) return baseset() @@ -1905,7 +1906,7 @@ def wdir(repo, subset, x): # i18n: "wdir" is a keyword getargs(x, 0, 0, _("wdir takes no arguments")) - if None in subset: + if None in subset or isinstance(subset, fullreposet): return baseset([None]) return baseset() @@ -3408,11 +3409,6 @@ def __init__(self, repo): super(fullreposet, self).__init__(repo) - def __contains__(self, rev): - # assumes the given rev is valid - hidden = self._hiddenrevs - return not (hidden and rev in hidden) - def __and__(self, other): """As self contains the whole repo, all of the other set should also be in self. Therefore `self & other = other`.