Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/debugcommands.py @ 39196:26f3d075f36e
debugcommands: use a revset instead of dagutil
All this code was doing was finding the nodes that are heads
from the ancestors of an input set. This can easily be expressed
with a revset without having to go through dagutil.
This was the last use of ancestorset() outside of dagutil itself.
Differential Revision: https://phab.mercurial-scm.org/D4308
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 16 Aug 2018 19:55:55 +0000 |
parents | 858a12846f4f |
children | 73cf21b2e8a6 |
comparison
equal
deleted
inserted
replaced
39195:9539553f6d17 | 39196:26f3d075f36e |
---|---|
40 changegroup, | 40 changegroup, |
41 cmdutil, | 41 cmdutil, |
42 color, | 42 color, |
43 context, | 43 context, |
44 dagparser, | 44 dagparser, |
45 dagutil, | |
46 encoding, | 45 encoding, |
47 error, | 46 error, |
48 exchange, | 47 exchange, |
49 extensions, | 48 extensions, |
50 filemerge, | 49 filemerge, |
789 force=True) | 788 force=True) |
790 common = set(common) | 789 common = set(common) |
791 if not opts.get('nonheads'): | 790 if not opts.get('nonheads'): |
792 ui.write(("unpruned common: %s\n") % | 791 ui.write(("unpruned common: %s\n") % |
793 " ".join(sorted(short(n) for n in common))) | 792 " ".join(sorted(short(n) for n in common))) |
794 cl = repo.changelog | 793 |
795 clnode = cl.node | 794 clnode = repo.changelog.node |
796 dag = dagutil.revlogdag(cl) | 795 common = repo.revs('heads(::%ln)', common) |
797 all = dag.ancestorset(cl.rev(n) for n in common) | 796 common = {clnode(r) for r in common} |
798 common = {clnode(r) for r in dag.headsetofconnecteds(all)} | |
799 else: | 797 else: |
800 nodes = None | 798 nodes = None |
801 if pushedrevs: | 799 if pushedrevs: |
802 revs = scmutil.revrange(repo, pushedrevs) | 800 revs = scmutil.revrange(repo, pushedrevs) |
803 nodes = [repo[r].node() for r in revs] | 801 nodes = [repo[r].node() for r in revs] |