Mercurial > hg-stable
diff mercurial/graphmod.py @ 32921:27932a76a88d
dagop: split module hosting DAG-related algorithms from revset
This module hosts the following functions. They are somewhat similar (e.g.
scanning revisions using heap queue or stack) and seem non-trivial in
algorithmic point of view.
- _revancestors()
- _revdescendants()
- reachableroots()
- _toposort()
I was thinking of adding revset._fileancestors() generator for better follow()
implementation, but it would be called from context.py as well. So I decided
to create new module.
Naming is hard. I couldn't come up with any better module name, so it's called
"dag operation" now. I rejected the following candidates:
- ancestor.py - existing, revlog-level DAG algorithm
- ancestorset.py - doesn't always return a set
- dagalgorithm.py - hard to type
- dagutil.py - existing
- revancestor.py - I want to add fileancestors()
% wc -l mercurial/dagop.py mercurial/revset.py
339 mercurial/dagop.py
2020 mercurial/revset.py
2359 total
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 16 Oct 2016 18:03:24 +0900 |
parents | 906da89821ce |
children | 6f6c87888b22 |
line wrap: on
line diff
--- a/mercurial/graphmod.py Thu Jun 15 17:14:53 2017 -0700 +++ b/mercurial/graphmod.py Sun Oct 16 18:03:24 2016 +0900 @@ -21,7 +21,7 @@ from .node import nullrev from . import ( - revset, + dagop, smartset, util, ) @@ -70,7 +70,7 @@ # through all revs (issue4782) if not isinstance(revs, smartset.baseset): revs = smartset.baseset(revs) - gp = gpcache[mpar] = sorted(set(revset.reachableroots( + gp = gpcache[mpar] = sorted(set(dagop.reachableroots( repo, revs, [mpar]))) if not gp: parents.append((MISSINGPARENT, mpar))