Mercurial > hg
comparison tests/test-worker.t @ 32337:46ba2cdda476
registrar: move cmdutil.command to registrar module (API)
cmdutil.command wasn't a member of the registrar framework only for a
historical reason. Let's make that happen. This patch keeps cmdutil.command
as an alias for extension compatibility.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 09 Jan 2016 23:07:20 +0900 |
parents | 44a98a2ea431 |
children | fce4ed2912bb |
comparison
equal
deleted
inserted
replaced
32336:ff874d34c856 | 32337:46ba2cdda476 |
---|---|
2 | 2 |
3 $ cat > t.py <<EOF | 3 $ cat > t.py <<EOF |
4 > from __future__ import absolute_import, print_function | 4 > from __future__ import absolute_import, print_function |
5 > import time | 5 > import time |
6 > from mercurial import ( | 6 > from mercurial import ( |
7 > cmdutil, | |
8 > error, | 7 > error, |
8 > registrar, | |
9 > ui as uimod, | 9 > ui as uimod, |
10 > worker, | 10 > worker, |
11 > ) | 11 > ) |
12 > def abort(ui, args): | 12 > def abort(ui, args): |
13 > if args[0] == 0: | 13 > if args[0] == 0: |
28 > 'abort': abort, | 28 > 'abort': abort, |
29 > 'exc': exc, | 29 > 'exc': exc, |
30 > 'runme': runme, | 30 > 'runme': runme, |
31 > } | 31 > } |
32 > cmdtable = {} | 32 > cmdtable = {} |
33 > command = cmdutil.command(cmdtable) | 33 > command = registrar.command(cmdtable) |
34 > @command('test', [], 'hg test [COST] [FUNC]') | 34 > @command('test', [], 'hg test [COST] [FUNC]') |
35 > def t(ui, repo, cost=1.0, func='runme'): | 35 > def t(ui, repo, cost=1.0, func='runme'): |
36 > cost = float(cost) | 36 > cost = float(cost) |
37 > func = functable[func] | 37 > func = functable[func] |
38 > ui.status('start\n') | 38 > ui.status('start\n') |