Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/graphmod.py @ 29348:2188f170f5b6
revset: add new topographical sort
Sort revisions in reverse revision order but grouped by topographical branches.
Visualised as a graph, instead of:
o 4
|
| o 3
| |
| o 2
| |
o | 1
|/
o 0
revisions on a 'main' branch are emitted before 'side' branches:
o 4
|
o 1
|
| o 3
| |
| o 2
|/
o 0
where what constitutes a 'main' branch is configurable, so the sort could also
result in:
o 3
|
o 2
|
| o 4
| |
| o 1
|/
o 0
This sort was already available as an experimental option in the graphmod
module, from which it is now removed.
This sort is best used with hg log -G:
$ hg log -G "sort(all(), topo)"
author | Martijn Pieters <mjpieters@fb.com> |
---|---|
date | Mon, 13 Jun 2016 18:20:00 +0100 |
parents | 98535ad46fc0 |
children | aea06029919e |
comparison
equal
deleted
inserted
replaced
29347:98535ad46fc0 | 29348:2188f170f5b6 |
---|---|
49 """ | 49 """ |
50 if not revs: | 50 if not revs: |
51 return | 51 return |
52 | 52 |
53 gpcache = {} | 53 gpcache = {} |
54 | |
55 if repo.ui.configbool('experimental', 'graph-group-branches', False): | |
56 firstbranch = () | |
57 firstbranchrevset = repo.ui.config( | |
58 'experimental', 'graph-group-branches.firstbranch', '') | |
59 if firstbranchrevset: | |
60 firstbranch = repo.revs(firstbranchrevset) | |
61 parentrevs = repo.changelog.parentrevs | |
62 revs = revset.groupbranchiter(revs, parentrevs, firstbranch) | |
63 revs = revset.baseset(revs) | |
64 | 54 |
65 for rev in revs: | 55 for rev in revs: |
66 ctx = repo[rev] | 56 ctx = repo[rev] |
67 # partition into parents in the rev set and missing parents, then | 57 # partition into parents in the rev set and missing parents, then |
68 # augment the lists with markers, to inform graph drawing code about | 58 # augment the lists with markers, to inform graph drawing code about |