##// END OF EJS Templates
groubranchhiter: indent most of the inner code...
Pierre-Yves David -
r23566:fee7a30c default
parent child Browse files
Show More
@@ -110,29 +110,31 def groupbranchiter(revs, parentsfunc):
110 # parts of the initial set should be emitted.
110 # parts of the initial set should be emitted.
111 groups = [([], unblocked)]
111 groups = [([], unblocked)]
112 for current in revs:
112 for current in revs:
113 # Look for a subgroup blocked, waiting for the current revision.
113 if True:
114 # Seek for a subgroup blocked, waiting for the current revision.
114 matching = [i for i, g in enumerate(groups) if current in g[1]]
115 matching = [i for i, g in enumerate(groups) if current in g[1]]
115
116
116 if matching:
117 if matching:
117 # The main idea is to gather together all sets that await on the
118 # The main idea is to gather together all sets that await on
118 # same revision.
119 # the same revision.
119 #
120 #
120 # This merging is done at the time we are about to add this common
121 # This merging is done at the time we are about to add this
121 # awaited to the subgroup for simplicity purpose. Such merge could
122 # common awaited to the subgroup for simplicity purpose. Such
122 # happen sooner when we update the "blocked" set of revision.
123 # merge could happen sooner when we update the "blocked" set of
124 # revision.
123 #
125 #
124 # We also always keep the oldest subgroup first. We can probably
126 # We also always keep the oldest subgroup first. We can
125 # improve the behavior by having the longuest set first. That way,
127 # probably improve the behavior by having the longuest set
126 # graph algorythms could minimise the length of parallele lines
128 # first. That way, graph algorythms could minimise the length
127 # their draw. This is currently not done.
129 # of parallele lines their draw. This is currently not done.
128 targetidx = matching.pop(0)
130 targetidx = matching.pop(0)
129 trevs, tparents = groups[targetidx]
131 trevs, tparents = groups[targetidx]
130 for i in matching:
132 for i in matching:
131 gr = groups[i]
133 gr = groups[i]
132 trevs.extend(gr[0])
134 trevs.extend(gr[0])
133 tparents |= gr[1]
135 tparents |= gr[1]
134 # delete all merged subgroups (but the one we keep)
136 # delete all merged subgroups (but the one we keep) (starting
135 # (starting from the last subgroup for performance and sanity reason)
137 # from the last subgroup for performance and sanity reason)
136 for i in reversed(matching):
138 for i in reversed(matching):
137 del groups[i]
139 del groups[i]
138 else:
140 else:
@@ -142,9 +144,9 def groupbranchiter(revs, parentsfunc):
142
144
143 gr = groups[targetidx]
145 gr = groups[targetidx]
144
146
145 # We now adds the current nodes to this subgroups. This is done after
147 # We now adds the current nodes to this subgroups. This is done
146 # the subgroup merging because all elements from a subgroup that relied
148 # after the subgroup merging because all elements from a subgroup
147 # on this rev must preceed it.
149 # that relied on this rev must preceed it.
148 #
150 #
149 # we also update the <parents> set to includes the parents on the
151 # we also update the <parents> set to includes the parents on the
150 # new nodes.
152 # new nodes.
@@ -155,14 +157,14 def groupbranchiter(revs, parentsfunc):
155 # Look for a subgroup to display
157 # Look for a subgroup to display
156 #
158 #
157 # When unblocked is empty (if clause), We are not waiting over any
159 # When unblocked is empty (if clause), We are not waiting over any
158 # revision during the first iteration (if no priority was given) or if
160 # revision during the first iteration (if no priority was given) or
159 # we outputed a whole disconnected sets of the graph (reached a root).
161 # if we outputed a whole disconnected sets of the graph (reached a
160 # In that case we arbitrarily takes the oldest known subgroup. The
162 # root). In that case we arbitrarily takes the oldest known
161 # heuristique could probably be better.
163 # subgroup. The heuristique could probably be better.
162 #
164 #
163 # Otherwise (elif clause) this mean we have some emitted revision. if
165 # Otherwise (elif clause) this mean we have some emitted revision.
164 # the subgroup awaits on the same revision that the outputed ones, we
166 # if the subgroup awaits on the same revision that the outputed
165 # can safely output it.
167 # ones, we can safely output it.
166 if not unblocked:
168 if not unblocked:
167 if len(groups) > 1: # display other subset
169 if len(groups) > 1: # display other subset
168 targetidx = 1
170 targetidx = 1
General Comments 0
You need to be logged in to leave comments. Login now