Mercurial > hg > mercurial-source
diff mercurial/revset.py @ 26324:5e1b0739611c
revset: use integer representation of wdir() in revset
This is the simplest way to handle wdir() revision in revset. None didn't
work well because revset heavily depends on integer operations such as min(),
max(), sorted(), x:y, etc.
One downside is that we cannot do "wctx.rev() in set" because wctx.rev() is
still None. We could wrap the result set by wdirproxyset that translates None
to wdirrev, but it seems overengineered at this point.
result = getset(repo, subset, tree)
if 'wdir' in funcsused(tree):
result = wdirproxyset(result)
Test cases need the '(all() + wdir()) &' hack because we have yet to fix the
bootstrapping issue of null and wdir.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Mon, 16 Mar 2015 16:17:06 +0900 |
parents | d50677c3bf44 |
children | d51dac68ec98 |
line wrap: on
line diff
--- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -1481,7 +1481,7 @@ up = ps.update parentrevs = cl.parentrevs for r in getset(repo, fullreposet(repo), x): - if r is None: + if r == node.wdirrev: up(p.rev() for p in repo[r].parents()) else: up(parentrevs(r)) @@ -1986,8 +1986,8 @@ def wdir(repo, subset, x): # i18n: "wdir" is a keyword getargs(x, 0, 0, _("wdir takes no arguments")) - if None in subset or isinstance(subset, fullreposet): - return baseset([None]) + if node.wdirrev in subset or isinstance(subset, fullreposet): + return baseset([node.wdirrev]) return baseset() # for internal use