comparison 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
comparison
equal deleted inserted replaced
25263:fd905b2bea59 25265:e16456831516
328 328
329 # operator methods 329 # operator methods
330 330
331 def stringset(repo, subset, x): 331 def stringset(repo, subset, x):
332 x = repo[x].rev() 332 x = repo[x].rev()
333 if x in subset: 333 if (x in subset
334 or x == node.nullrev and isinstance(subset, fullreposet)):
334 return baseset([x]) 335 return baseset([x])
335 return baseset() 336 return baseset()
336 337
337 def symbolset(repo, subset, x): 338 def symbolset(repo, subset, x):
338 if x in symbols: 339 if x in symbols:
1903 1904
1904 # experimental 1905 # experimental
1905 def wdir(repo, subset, x): 1906 def wdir(repo, subset, x):
1906 # i18n: "wdir" is a keyword 1907 # i18n: "wdir" is a keyword
1907 getargs(x, 0, 0, _("wdir takes no arguments")) 1908 getargs(x, 0, 0, _("wdir takes no arguments"))
1908 if None in subset: 1909 if None in subset or isinstance(subset, fullreposet):
1909 return baseset([None]) 1910 return baseset([None])
1910 return baseset() 1911 return baseset()
1911 1912
1912 # for internal use 1913 # for internal use
1913 def _list(repo, subset, x): 1914 def _list(repo, subset, x):
3406 """ 3407 """
3407 3408
3408 def __init__(self, repo): 3409 def __init__(self, repo):
3409 super(fullreposet, self).__init__(repo) 3410 super(fullreposet, self).__init__(repo)
3410 3411
3411 def __contains__(self, rev):
3412 # assumes the given rev is valid
3413 hidden = self._hiddenrevs
3414 return not (hidden and rev in hidden)
3415
3416 def __and__(self, other): 3412 def __and__(self, other):
3417 """As self contains the whole repo, all of the other set should also be 3413 """As self contains the whole repo, all of the other set should also be
3418 in self. Therefore `self & other = other`. 3414 in self. Therefore `self & other = other`.
3419 3415
3420 This boldly assumes the other contains valid revs only. 3416 This boldly assumes the other contains valid revs only.