comparison mercurial/logcmdutil.py @ 42336:604c086ddde6

log: add config for making `hg log -G` always topo-sorted I (and everyone else at Google) have an log alias that adds graph mode and templating. I have another one that builds on the first and also restricts the set of revisions to only show those I'm most likely to care about. This second alias also adds topological sorting. I still sometimes use the first one. When I do, it very often bothers me that it's not topologically sorted (branches are interleaved). This patch adds a config option for always using topological sorting with graph log. The revision set is sorted eagerly, which seems like a bad idea, but it doesn't seem to make a big difference in the hg repo (150ms). I initially tried to instead wrap the user's revset in sort(...,topo), but that seemed much harder. Differential Revision: https://phab.mercurial-scm.org/D6331
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 01 May 2019 09:34:47 -0700
parents 1ce46f0ee218
children b162229ebe0d
comparison
equal deleted inserted replaced
42335:1ce46f0ee218 42336:604c086ddde6
744 744
745 expr = _makerevset(repo, match, pats, slowpath, opts) 745 expr = _makerevset(repo, match, pats, slowpath, opts)
746 if opts.get('graph'): 746 if opts.get('graph'):
747 # User-specified revs might be unsorted, but don't sort before 747 # User-specified revs might be unsorted, but don't sort before
748 # _makerevset because it might depend on the order of revs 748 # _makerevset because it might depend on the order of revs
749 if not (revs.isdescending() or revs.istopo()): 749 if repo.ui.configbool('experimental', 'log.topo'):
750 if not revs.istopo():
751 revs = dagop.toposort(revs, repo.changelog.parentrevs)
752 # TODO: try to iterate the set lazily
753 revs = revset.baseset(list(revs))
754 elif not (revs.isdescending() or revs.istopo()):
750 revs.sort(reverse=True) 755 revs.sort(reverse=True)
751 if expr: 756 if expr:
752 matcher = revset.match(None, expr) 757 matcher = revset.match(None, expr)
753 revs = matcher(repo, revs) 758 revs = matcher(repo, revs)
754 if limit is not None: 759 if limit is not None: