tests/test-progress.t
changeset 14838 5d261fd00446
parent 13236 3f299f5d9a29
child 15372 695ac6aca77f
equal deleted inserted replaced
14837:ec4ba216ddef 14838:5d261fd00446
     7   >     total = None
     7   >     total = None
     8   >     if loops >= 0:
     8   >     if loops >= 0:
     9   >         total = loops
     9   >         total = loops
    10   >     if opts.get('total', None):
    10   >     if opts.get('total', None):
    11   >         total = int(opts.get('total'))
    11   >         total = int(opts.get('total'))
       
    12   >     nested = False
       
    13   >     if opts.get('nested', None):
       
    14   >         nested = True
    12   >     loops = abs(loops)
    15   >     loops = abs(loops)
    13   > 
    16   > 
    14   >     for i in range(loops):
    17   >     for i in range(loops):
    15   >         ui.progress('loop', i, 'loop.%d' % i, 'loopnum', total)
    18   >         ui.progress('loop', i, 'loop.%d' % i, 'loopnum', total)
       
    19   >         if opts.get('parallel'):
       
    20   >             ui.progress('other', i, 'other.%d' % i, 'othernum', total)
       
    21   >         if nested:
       
    22   >             for j in range(2):
       
    23   >                 ui.progress('nested', j, 'nested.%d' % j, 'nestnum', 2)
       
    24   >             ui.progress('nested', None, 'nested.done', 'nestnum', 2)
    16   >     ui.progress('loop', None, 'loop.done', 'loopnum', total)
    25   >     ui.progress('loop', None, 'loop.done', 'loopnum', total)
    17   > 
    26   > 
    18   > commands.norepo += " loop"
    27   > commands.norepo += " loop"
    19   > 
    28   > 
    20   > cmdtable = {
    29   > cmdtable = {
    21   >     "loop": (loop, [('', 'total', '', 'override for total')],
    30   >     "loop": (loop, [('', 'total', '', 'override for total'),
       
    31   >                     ('', 'nested', False, 'show nested results'),
       
    32   >                     ('', 'parallel', False, 'show parallel sets of results'),
       
    33   >                    ],
    22   >              'hg loop LOOPS'),
    34   >              'hg loop LOOPS'),
    23   > }
    35   > }
    24   > EOF
    36   > EOF
    25 
    37 
    26   $ echo "[extensions]" >> $HGRCPATH
    38   $ echo "[extensions]" >> $HGRCPATH
    45   loop [                                                ] 0/3
    57   loop [                                                ] 0/3
    46   loop [===============>                                ] 1/3
    58   loop [===============>                                ] 1/3
    47   loop [===============================>                ] 2/3
    59   loop [===============================>                ] 2/3
    48                                                               \r (esc)
    60                                                               \r (esc)
    49 
    61 
       
    62 
       
    63 test nested short-lived topics (which shouldn't display with nestdelay):
       
    64 
       
    65   $ hg -y loop 3 --nested 2>&1 | \
       
    66   > python $TESTDIR/filtercr.py
       
    67   
       
    68   loop [                                                ] 0/3
       
    69   loop [===============>                                ] 1/3
       
    70   loop [===============================>                ] 2/3
       
    71                                                               \r (esc)
       
    72 
       
    73 
       
    74   $ hg --config progress.changedelay=0 -y loop 3 --nested 2>&1 | \
       
    75   > python $TESTDIR/filtercr.py
       
    76   
       
    77   loop [                                                ] 0/3
       
    78   nested [                                              ] 0/2
       
    79   nested [======================>                       ] 1/2
       
    80   loop [===============>                                ] 1/3
       
    81   nested [                                              ] 0/2
       
    82   nested [======================>                       ] 1/2
       
    83   loop [===============================>                ] 2/3
       
    84   nested [                                              ] 0/2
       
    85   nested [======================>                       ] 1/2
       
    86                                                               \r (esc)
       
    87 
       
    88 
       
    89 test two topics being printed in parallel (as when we're doing a local
       
    90 --pull clone, where you get the unbundle and bundle progress at the
       
    91 same time):
       
    92   $ hg loop 3 --parallel 2>&1 | python $TESTDIR/filtercr.py
       
    93   
       
    94   loop [                                                ] 0/3
       
    95   loop [===============>                                ] 1/3
       
    96   loop [===============================>                ] 2/3
       
    97                                                               \r (esc)
    50 test refresh is taken in account
    98 test refresh is taken in account
    51 
    99 
    52   $ hg -y --config progress.refresh=100 loop 3 2>&1 | $TESTDIR/filtercr.py
   100   $ hg -y --config progress.refresh=100 loop 3 2>&1 | $TESTDIR/filtercr.py
    53   
   101   
    54 
   102