diff --git a/contrib/all-revsets.txt b/contrib/all-revsets.txt --- a/contrib/all-revsets.txt +++ b/contrib/all-revsets.txt @@ -118,3 +118,9 @@ roots((0:tip)::) # those two `roots(...)` inputs are close to what phase movement use. roots((tip~100::) - (tip~100::tip)) roots((0::) - (0::tip)) + +# Testing the behavior of "head()" in various situations +head() +head() - public() +draft() and head() +head() and author("mpm") diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -1107,8 +1107,9 @@ def head(repo, subset, x): # i18n: "head" is a keyword getargs(x, 0, 0, _("head takes no arguments")) hs = set() + cl = repo.changelog for b, ls in repo.branchmap().iteritems(): - hs.update(repo[h].rev() for h in ls) + hs.update(cl.rev(h) for h in ls) # XXX using a set to feed the baseset is wrong. Sets are not ordered. # This does not break because of other fullreposet misbehavior. # XXX We should not be using '.filter' here, but combines subset with '&'