Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hbisect.py @ 30067:6e88cd060ba2
bisect: move 'printresult' in the 'hbisect' module
The logic is already extracted into a closure. We move it into the module
dedicated to bisect.
A minor change is applied: the creation of the 'displayer' is kept in the main
command function, it remove the needs to import 'cmdutil' in 'hbisect'. This
would create an import circle otherwise.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Wed, 24 Aug 2016 04:19:11 +0200 |
parents | 5f93737d0ba8 |
children | 755730fc1e48 |
comparison
equal
deleted
inserted
replaced
30066:5f93737d0ba8 | 30067:6e88cd060ba2 |
---|---|
277 def shortlabel(label): | 277 def shortlabel(label): |
278 if label: | 278 if label: |
279 return label[0].upper() | 279 return label[0].upper() |
280 | 280 |
281 return None | 281 return None |
282 | |
283 def printresult(ui, repo, state, displayer, nodes, good): | |
284 if len(nodes) == 1: | |
285 # narrowed it down to a single revision | |
286 if good: | |
287 ui.write(_("The first good revision is:\n")) | |
288 else: | |
289 ui.write(_("The first bad revision is:\n")) | |
290 displayer.show(repo[nodes[0]]) | |
291 extendnode = extendrange(repo, state, nodes, good) | |
292 if extendnode is not None: | |
293 ui.write(_('Not all ancestors of this changeset have been' | |
294 ' checked.\nUse bisect --extend to continue the ' | |
295 'bisection from\nthe common ancestor, %s.\n') | |
296 % extendnode) | |
297 else: | |
298 # multiple possible revisions | |
299 if good: | |
300 ui.write(_("Due to skipped revisions, the first " | |
301 "good revision could be any of:\n")) | |
302 else: | |
303 ui.write(_("Due to skipped revisions, the first " | |
304 "bad revision could be any of:\n")) | |
305 for n in nodes: | |
306 displayer.show(repo[n]) | |
307 displayer.close() |