/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to tools/time_graph.py

  • Committer: Vincent Ladeuil
  • Author(s): Jelmer Vernooij
  • Date: 2018-03-01 05:46:59 UTC
  • mfrom: (6861.4.1 pb-context)
  • Revision ID: v.ladeuil+lp@free.fr-20180301054659-7fzum8cexsk421r3
Make progress bars context managers.

Merged from https://code.launchpad.net/~jelmer/brz/pb-context/+merge/339449

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
 
40
40
def all_heads_comp(g, combinations):
41
41
    h = []
42
 
    pb = ui.ui_factory.nested_progress_bar()
43
 
    try:
 
42
    with ui.ui_factory.nested_progress_bar() as pb:
44
43
        for idx, combo in enumerate(combinations):
45
44
            if idx & 0x1f == 0:
46
45
                pb.update('proc', idx, len(combinations))
47
46
            h.append(g.heads(combo))
48
 
    finally:
49
 
        pb.finished()
50
47
    return h
51
48
 
52
49
combinations = []