diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -87,7 +87,7 @@ def _revdescendants(repo, revs, followfi return generatorset(iterate(), iterasc=True) -def reachableroots(repo, roots, heads, includepath=False): +def reachablerootspure(repo, minroot, roots, heads, includepath): """return (heads(:: and ::)) If includepath is True, return (::).""" @@ -97,10 +97,6 @@ def reachableroots(repo, roots, heads, i visit = list(heads) reachable = set() seen = {} - # XXX this should be 'parentset.min()' assuming 'parentset' is a smartset - # (and if it is not, it should.) - minroot = min(roots) - roots = set(roots) # prefetch all the things! (because python is slow) reached = reachable.add dovisit = visit.append @@ -128,6 +124,22 @@ def reachableroots(repo, roots, heads, i reached(rev) return baseset(sorted(reachable)) +def reachableroots(repo, roots, heads, includepath=False): + """return (heads(:: and ::)) + + If includepath is True, return (::).""" + if not roots: + return baseset() + # XXX this should be 'parentset.min()' assuming 'parentset' is a smartset + # (and if it is not, it should.) + minroot = min(roots) + roots = set(roots) + heads = list(heads) + try: + return repo.changelog.reachableroots(minroot, heads, roots, includepath) + except AttributeError: + return reachablerootspure(repo, minroot, roots, heads, includepath) + elements = { # token-type: binding-strength, primary, prefix, infix, suffix "(": (21, None, ("group", 1, ")"), ("func", 1, ")"), None),