Show More
@@ -1,8 +1,14 b'' | |||
|
1 | 1 | # Extension dedicated to test patch.diff() upgrade modes |
|
2 | 2 | # |
|
3 | 3 | # |
|
4 | from mercurial import scmutil, patch, util | |
|
4 | from mercurial import cmdutil, scmutil, patch, util | |
|
5 | 5 | |
|
6 | cmdtable = {} | |
|
7 | command = cmdutil.command(cmdtable) | |
|
8 | ||
|
9 | @command('autodiff', | |
|
10 | [('', 'git', '', 'git upgrade mode (yes/no/auto/warn/abort)')], | |
|
11 | '[OPTION]... [FILE]...') | |
|
6 | 12 | def autodiff(ui, repo, *pats, **opts): |
|
7 | 13 | diffopts = patch.diffopts(ui, opts) |
|
8 | 14 | git = opts.get('git', 'no') |
@@ -36,11 +42,3 b' def autodiff(ui, repo, *pats, **opts):' | |||
|
36 | 42 | ui.write(chunk) |
|
37 | 43 | for fn in sorted(brokenfiles): |
|
38 | 44 | ui.write(('data lost for: %s\n' % fn)) |
|
39 | ||
|
40 | cmdtable = { | |
|
41 | "autodiff": | |
|
42 | (autodiff, | |
|
43 | [('', 'git', '', 'git upgrade mode (yes/no/auto/warn/abort)'), | |
|
44 | ], | |
|
45 | '[OPTION]... [FILE]...'), | |
|
46 | } |
@@ -16,19 +16,18 b' Test alignment of multibyte characters' | |||
|
16 | 16 | > f = file('l', 'w'); f.write(l); f.close() |
|
17 | 17 | > # instant extension to show list of options |
|
18 | 18 | > f = file('showoptlist.py', 'w'); f.write("""# encoding: utf-8 |
|
19 | > from mercurial import cmdutil | |
|
20 | > cmdtable = {} | |
|
21 | > command = cmdutil.command(cmdtable) | |
|
22 | > | |
|
23 | > @command('showoptlist', | |
|
24 | > [('s', 'opt1', '', 'short width' + ' %(s)s' * 8, '%(s)s'), | |
|
25 | > ('m', 'opt2', '', 'middle width' + ' %(m)s' * 8, '%(m)s'), | |
|
26 | > ('l', 'opt3', '', 'long width' + ' %(l)s' * 8, '%(l)s')], | |
|
27 | > '') | |
|
19 | 28 | > def showoptlist(ui, repo, *pats, **opts): |
|
20 | 29 | > '''dummy command to show option descriptions''' |
|
21 | 30 | > return 0 |
|
22 | > cmdtable = { | |
|
23 | > 'showoptlist': | |
|
24 | > (showoptlist, | |
|
25 | > [('s', 'opt1', '', 'short width' + ' %(s)s' * 8, '%(s)s'), | |
|
26 | > ('m', 'opt2', '', 'middle width' + ' %(m)s' * 8, '%(m)s'), | |
|
27 | > ('l', 'opt3', '', 'long width' + ' %(l)s' * 8, '%(l)s') | |
|
28 | > ], | |
|
29 | > "" | |
|
30 | > ) | |
|
31 | > } | |
|
32 | 31 | > """ % globals()) |
|
33 | 32 | > f.close() |
|
34 | 33 | > EOF |
@@ -6,7 +6,13 b' Test text wrapping for multibyte charact' | |||
|
6 | 6 | define commands to display help text |
|
7 | 7 | |
|
8 | 8 | $ cat << EOF > show.py |
|
9 | > from mercurial import cmdutil | |
|
10 | > | |
|
11 | > cmdtable = {} | |
|
12 | > command = cmdutil.command(cmdtable) | |
|
13 | > | |
|
9 | 14 | > # Japanese full-width characters: |
|
15 | > @command('show_full_ja', [], '') | |
|
10 | 16 | > def show_full_ja(ui, **opts): |
|
11 | 17 | > u'''\u3042\u3044\u3046\u3048\u304a\u304b\u304d\u304f\u3051 \u3042\u3044\u3046\u3048\u304a\u304b\u304d\u304f\u3051 \u3042\u3044\u3046\u3048\u304a\u304b\u304d\u304f\u3051 |
|
12 | 18 | > |
@@ -16,6 +22,7 b' define commands to display help text' | |||
|
16 | 22 | > ''' |
|
17 | 23 | > |
|
18 | 24 |
> # |
|
25 | > @command('show_half_ja', [], '') | |
|
19 | 26 | > def show_half_ja(ui, *opts): |
|
20 | 27 | > u'''\uff71\uff72\uff73\uff74\uff75\uff76\uff77\uff78\uff79 \uff71\uff72\uff73\uff74\uff75\uff76\uff77\uff78\uff79 \uff71\uff72\uff73\uff74\uff75\uff76\uff77\uff78\uff79 \uff71\uff72\uff73\uff74\uff75\uff76\uff77\uff78\uff79 |
|
21 | 28 | > |
@@ -25,6 +32,7 b' define commands to display help text' | |||
|
25 | 32 | > ''' |
|
26 | 33 | > |
|
27 | 34 | > # Japanese ambiguous-width characters: |
|
35 | > @command('show_ambig_ja', [], '') | |
|
28 | 36 | > def show_ambig_ja(ui, **opts): |
|
29 | 37 | > u'''\u03b1\u03b2\u03b3\u03b4\u03c5\u03b6\u03b7\u03b8\u25cb \u03b1\u03b2\u03b3\u03b4\u03c5\u03b6\u03b7\u03b8\u25cb \u03b1\u03b2\u03b3\u03b4\u03c5\u03b6\u03b7\u03b8\u25cb |
|
30 | 38 | > |
@@ -34,6 +42,7 b' define commands to display help text' | |||
|
34 | 42 | > ''' |
|
35 | 43 | > |
|
36 | 44 |
> # |
|
45 | > @command('show_ambig_ru', [], '') | |
|
37 | 46 | > def show_ambig_ru(ui, **opts): |
|
38 | 47 | > u'''\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 |
|
39 | 48 | > |
@@ -41,13 +50,6 b' define commands to display help text' | |||
|
41 | 50 | > |
|
42 | 51 | > \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 |
|
43 | 52 | > ''' |
|
44 | > | |
|
45 | > cmdtable = { | |
|
46 | > 'show_full_ja': (show_full_ja, [], ""), | |
|
47 | > 'show_half_ja': (show_half_ja, [], ""), | |
|
48 | > 'show_ambig_ja': (show_ambig_ja, [], ""), | |
|
49 | > 'show_ambig_ru': (show_ambig_ru, [], ""), | |
|
50 | > } | |
|
51 | 53 | > EOF |
|
52 | 54 | |
|
53 | 55 | "COLUMNS=60" means that there is no lines which has grater than 58 width |
@@ -2,7 +2,10 b' Test basic extension support' | |||
|
2 | 2 | |
|
3 | 3 | $ cat > foobar.py <<EOF |
|
4 | 4 | > import os |
|
5 | > from mercurial import commands | |
|
5 | > from mercurial import cmdutil, commands | |
|
6 | > | |
|
7 | > cmdtable = {} | |
|
8 | > command = cmdutil.command(cmdtable) | |
|
6 | 9 | > |
|
7 | 10 | > def uisetup(ui): |
|
8 | 11 | > ui.write("uisetup called\\n") |
@@ -11,17 +14,14 b' Test basic extension support' | |||
|
11 | 14 | > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root)) |
|
12 | 15 | > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!")) |
|
13 | 16 | > |
|
17 | > @command('foo', [], 'hg foo') | |
|
14 | 18 | > def foo(ui, *args, **kwargs): |
|
15 | 19 | > ui.write("Foo\\n") |
|
16 | 20 | > |
|
21 | > @command('bar', [], 'hg bar') | |
|
17 | 22 | > def bar(ui, *args, **kwargs): |
|
18 | 23 | > ui.write("Bar\\n") |
|
19 | 24 | > |
|
20 | > cmdtable = { | |
|
21 | > "foo": (foo, [], "hg foo"), | |
|
22 | > "bar": (bar, [], "hg bar"), | |
|
23 | > } | |
|
24 | > | |
|
25 | 25 | > commands.norepo += ' bar' |
|
26 | 26 | > EOF |
|
27 | 27 |
$ |
@@ -288,21 +288,22 b' hide outer repo' | |||
|
288 | 288 | $ cat > debugextension.py <<EOF |
|
289 | 289 | > '''only debugcommands |
|
290 | 290 | > ''' |
|
291 | > from mercurial import cmdutil | |
|
292 | > cmdtable = {} | |
|
293 | > command = cmdutil.command(cmdtable) | |
|
294 | > | |
|
295 | > @command('debugfoobar', [], 'hg debugfoobar') | |
|
291 | 296 | > def debugfoobar(ui, repo, *args, **opts): |
|
292 | 297 | > "yet another debug command" |
|
293 | 298 | > pass |
|
294 | 299 | > |
|
300 | > @command('foo', [], 'hg foo') | |
|
295 | 301 | > def foo(ui, repo, *args, **opts): |
|
296 | 302 | > """yet another foo command |
|
297 | 303 | > |
|
298 | 304 | > This command has been DEPRECATED since forever. |
|
299 | 305 | > """ |
|
300 | 306 | > pass |
|
301 | > | |
|
302 | > cmdtable = { | |
|
303 | > "debugfoobar": (debugfoobar, (), "hg debugfoobar"), | |
|
304 | > "foo": (foo, (), "hg foo") | |
|
305 | > } | |
|
306 | 307 | > EOF |
|
307 | 308 | $ debugpath=`pwd`/debugextension.py |
|
308 | 309 | $ echo "debugextension = $debugpath" >> $HGRCPATH |
@@ -475,15 +476,15 b' Extension module help vs command help:' | |||
|
475 | 476 | Test help topic with same name as extension |
|
476 | 477 | |
|
477 | 478 | $ cat > multirevs.py <<EOF |
|
478 | > from mercurial import commands | |
|
479 | > from mercurial import cmdutil, commands | |
|
480 | > cmdtable = {} | |
|
481 | > command = cmdutil.command(cmdtable) | |
|
479 | 482 | > """multirevs extension |
|
480 | 483 | > Big multi-line module docstring.""" |
|
484 | > @command('multirevs', [], 'ARG') | |
|
481 | 485 | > def multirevs(ui, repo, arg, *args, **opts): |
|
482 | 486 | > """multirevs command""" |
|
483 | 487 | > pass |
|
484 | > cmdtable = { | |
|
485 | > "multirevs": (multirevs, [], 'ARG') | |
|
486 | > } | |
|
487 | 488 | > commands.norepo += ' multirevs' |
|
488 | 489 | > EOF |
|
489 | 490 | $ echo "multirevs = multirevs.py" >> $HGRCPATH |
@@ -532,13 +533,15 b' Issue811: Problem loading extensions twi' | |||
|
532 | 533 | $ cat > debugissue811.py <<EOF |
|
533 | 534 | > '''show all loaded extensions |
|
534 | 535 | > ''' |
|
535 |
> from mercurial import |
|
|
536 | > from mercurial import cmdutil, commands, extensions | |
|
537 | > cmdtable = {} | |
|
538 | > command = cmdutil.command(cmdtable) | |
|
536 | 539 | > |
|
540 | > @command('debugextensions', [], 'hg debugextensions') | |
|
537 | 541 | > def debugextensions(ui): |
|
538 | 542 | > "yet another debug command" |
|
539 | 543 | > ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()])) |
|
540 | 544 | > |
|
541 | > cmdtable = {"debugextensions": (debugextensions, (), "hg debugextensions")} | |
|
542 | 545 | > commands.norepo += " debugextensions" |
|
543 | 546 | > EOF |
|
544 | 547 | $ echo "debugissue811 = $debugpath" >> $HGRCPATH |
@@ -652,19 +652,20 b' Test command without options' | |||
|
652 | 652 | |
|
653 | 653 | $ cat > helpext.py <<EOF |
|
654 | 654 | > import os |
|
655 | > from mercurial import commands | |
|
655 | > from mercurial import cmdutil, commands | |
|
656 | > | |
|
657 | > cmdtable = {} | |
|
658 | > command = cmdutil.command(cmdtable) | |
|
656 | 659 | > |
|
660 | > @command('nohelp', | |
|
661 | > [('', 'longdesc', 3, 'x'*90), | |
|
662 | > ('n', '', None, 'normal desc'), | |
|
663 | > ('', 'newline', '', 'line1\nline2')], | |
|
664 | > 'hg nohelp') | |
|
665 | > @command('debugoptDEP', [('', 'dopt', None, 'option is DEPRECATED')]) | |
|
657 | 666 | > def nohelp(ui, *args, **kwargs): |
|
658 | 667 | > pass |
|
659 | 668 | > |
|
660 | > cmdtable = { | |
|
661 | > "debugoptDEP": (nohelp, [('', 'dopt', None, 'option is DEPRECATED')],), | |
|
662 | > "nohelp": (nohelp, [('', 'longdesc', 3, 'x'*90), | |
|
663 | > ('n', '', None, 'normal desc'), | |
|
664 | > ('', 'newline', '', 'line1\nline2'), | |
|
665 | > ], "hg nohelp"), | |
|
666 | > } | |
|
667 | > | |
|
668 | 669 | > commands.norepo += ' nohelp' |
|
669 | 670 | > EOF |
|
670 | 671 |
$ |
@@ -1,7 +1,11 b'' | |||
|
1 | 1 | |
|
2 | 2 | $ cat > loop.py <<EOF |
|
3 | > from mercurial import commands | |
|
3 | > from mercurial import cmdutil, commands | |
|
4 | 4 | > import time |
|
5 | > | |
|
6 | > cmdtable = {} | |
|
7 | > command = cmdutil.command(cmdtable) | |
|
8 | > | |
|
5 | 9 | > class incrementingtime(object): |
|
6 | 10 | > def __init__(self): |
|
7 | 11 | > self._time = 0.0 |
@@ -10,6 +14,11 b'' | |||
|
10 | 14 | > return self._time |
|
11 | 15 | > time.time = incrementingtime() |
|
12 | 16 | > |
|
17 | > @command('loop', | |
|
18 | > [('', 'total', '', 'override for total'), | |
|
19 | > ('', 'nested', False, 'show nested results'), | |
|
20 | > ('', 'parallel', False, 'show parallel sets of results')], | |
|
21 | > 'hg loop LOOPS') | |
|
13 | 22 | > def loop(ui, loops, **opts): |
|
14 | 23 | > loops = int(loops) |
|
15 | 24 | > total = None |
@@ -38,14 +47,6 b'' | |||
|
38 | 47 | > ui.progress('loop', None, 'loop.done', 'loopnum', total) |
|
39 | 48 | > |
|
40 | 49 | > commands.norepo += " loop" |
|
41 | > | |
|
42 | > cmdtable = { | |
|
43 | > "loop": (loop, [('', 'total', '', 'override for total'), | |
|
44 | > ('', 'nested', False, 'show nested results'), | |
|
45 | > ('', 'parallel', False, 'show parallel sets of results'), | |
|
46 | > ], | |
|
47 | > 'hg loop LOOPS'), | |
|
48 | > } | |
|
49 | 50 | > EOF |
|
50 | 51 | |
|
51 | 52 | $ cp $HGRCPATH $HGRCPATH.orig |
General Comments 0
You need to be logged in to leave comments.
Login now