Show More
@@ -24,7 +24,7 import heapq | |||||
24 |
|
24 | |||
25 | CHANGESET = 'C' |
|
25 | CHANGESET = 'C' | |
26 |
|
26 | |||
27 | def groupbranchiter(revs, parentsfunc): |
|
27 | def groupbranchiter(revs, parentsfunc, firstbranch=()): | |
28 | """yield revision from heads to roots one (topo) branch after the other. |
|
28 | """yield revision from heads to roots one (topo) branch after the other. | |
29 |
|
29 | |||
30 | This function aims to be used by a graph generator that wishes to minimize |
|
30 | This function aims to be used by a graph generator that wishes to minimize | |
@@ -44,8 +44,8 def groupbranchiter(revs, parentsfunc): | |||||
44 |
|
44 | |||
45 | Currently consider every changeset under a merge to be on the same branch |
|
45 | Currently consider every changeset under a merge to be on the same branch | |
46 | using revision number to sort them. |
|
46 | using revision number to sort them. | |
|
47 | """ | |||
47 |
|
48 | |||
48 | Could be easily extend to give priority to an initial branch.""" |
|
|||
49 | ### Quick summary of the algorithm |
|
49 | ### Quick summary of the algorithm | |
50 | # |
|
50 | # | |
51 | # This function is based around a "retention" principle. We keep revisions |
|
51 | # This function is based around a "retention" principle. We keep revisions | |
@@ -78,7 +78,11 def groupbranchiter(revs, parentsfunc): | |||||
78 | # Set of parents of revision that have been yield. They can be considered |
|
78 | # Set of parents of revision that have been yield. They can be considered | |
79 | # unblocked as the graph generator is already aware of them so there is no |
|
79 | # unblocked as the graph generator is already aware of them so there is no | |
80 | # need to delay the one that reference them. |
|
80 | # need to delay the one that reference them. | |
81 | unblocked = set() |
|
81 | # | |
|
82 | # If someone wants to prioritize a branch over the others, pre-filling this | |||
|
83 | # set will force all other branches to wait until this branch is ready to be | |||
|
84 | # outputed. | |||
|
85 | unblocked = set(firstbranch) | |||
82 |
|
86 | |||
83 | # list of group waiting to be displayed, each group is defined by: |
|
87 | # list of group waiting to be displayed, each group is defined by: | |
84 | # |
|
88 | # | |
@@ -224,7 +228,13 def dagwalker(repo, revs): | |||||
224 | gpcache = {} |
|
228 | gpcache = {} | |
225 |
|
229 | |||
226 | if repo.ui.configbool('experimental', 'graph-topological', False): |
|
230 | if repo.ui.configbool('experimental', 'graph-topological', False): | |
227 | revs = list(groupbranchiter(revs, repo.changelog.parentrevs)) |
|
231 | firstbranch = () | |
|
232 | firstbranchrevset = repo.ui.config('experimental', | |||
|
233 | 'graph-topological.firstbranch', '') | |||
|
234 | if firstbranchrevset: | |||
|
235 | firstbranch = repo.revs(firstbranchrevset) | |||
|
236 | parentrevs = repo.changelog.parentrevs | |||
|
237 | revs = list(groupbranchiter(revs, parentrevs, firstbranch)) | |||
228 |
|
238 | |||
229 | for rev in revs: |
|
239 | for rev in revs: | |
230 | ctx = repo[rev] |
|
240 | ctx = repo[rev] |
@@ -78,3 +78,24 later. | |||||
78 | o 0 |
|
78 | o 0 | |
79 |
|
79 | |||
80 |
|
80 | |||
|
81 | (begin) from the other branch | |||
|
82 | ||||
|
83 | $ hg --config experimental.graph-topological=1 --config experimental.graph-topological.firstbranch=5 log -G | |||
|
84 | o 7 | |||
|
85 | | | |||
|
86 | o 6 | |||
|
87 | | | |||
|
88 | o 5 | |||
|
89 | | | |||
|
90 | o 4 | |||
|
91 | | | |||
|
92 | | o 8 | |||
|
93 | | | | |||
|
94 | | o 3 | |||
|
95 | | | | |||
|
96 | | o 2 | |||
|
97 | | | | |||
|
98 | | o 1 | |||
|
99 | |/ | |||
|
100 | o 0 | |||
|
101 |
General Comments 0
You need to be logged in to leave comments.
Login now