Show More
@@ -1,8 +1,14 b'' | |||||
1 | # Extension dedicated to test patch.diff() upgrade modes |
|
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 | def autodiff(ui, repo, *pats, **opts): |
|
12 | def autodiff(ui, repo, *pats, **opts): | |
7 | diffopts = patch.diffopts(ui, opts) |
|
13 | diffopts = patch.diffopts(ui, opts) | |
8 | git = opts.get('git', 'no') |
|
14 | git = opts.get('git', 'no') | |
@@ -36,11 +42,3 b' def autodiff(ui, repo, *pats, **opts):' | |||||
36 | ui.write(chunk) |
|
42 | ui.write(chunk) | |
37 | for fn in sorted(brokenfiles): |
|
43 | for fn in sorted(brokenfiles): | |
38 | ui.write(('data lost for: %s\n' % fn)) |
|
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 | > f = file('l', 'w'); f.write(l); f.close() |
|
16 | > f = file('l', 'w'); f.write(l); f.close() | |
17 | > # instant extension to show list of options |
|
17 | > # instant extension to show list of options | |
18 | > f = file('showoptlist.py', 'w'); f.write("""# encoding: utf-8 |
|
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 | > def showoptlist(ui, repo, *pats, **opts): |
|
28 | > def showoptlist(ui, repo, *pats, **opts): | |
20 | > '''dummy command to show option descriptions''' |
|
29 | > '''dummy command to show option descriptions''' | |
21 | > return 0 |
|
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 | > """ % globals()) |
|
31 | > """ % globals()) | |
33 | > f.close() |
|
32 | > f.close() | |
34 | > EOF |
|
33 | > EOF |
@@ -6,7 +6,13 b' Test text wrapping for multibyte charact' | |||||
6 | define commands to display help text |
|
6 | define commands to display help text | |
7 |
|
7 | |||
8 | $ cat << EOF > show.py |
|
8 | $ cat << EOF > show.py | |
|
9 | > from mercurial import cmdutil | |||
|
10 | > | |||
|
11 | > cmdtable = {} | |||
|
12 | > command = cmdutil.command(cmdtable) | |||
|
13 | > | |||
9 | > # Japanese full-width characters: |
|
14 | > # Japanese full-width characters: | |
|
15 | > @command('show_full_ja', [], '') | |||
10 | > def show_full_ja(ui, **opts): |
|
16 | > def show_full_ja(ui, **opts): | |
11 | > 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 |
|
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 | > # Japanese half-width characters: | |
|
25 | > @command('show_half_ja', [], '') | |||
19 | > def show_half_ja(ui, *opts): |
|
26 | > def show_half_ja(ui, *opts): | |
20 | > 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 |
|
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 | > # Japanese ambiguous-width characters: |
|
34 | > # Japanese ambiguous-width characters: | |
|
35 | > @command('show_ambig_ja', [], '') | |||
28 | > def show_ambig_ja(ui, **opts): |
|
36 | > def show_ambig_ja(ui, **opts): | |
29 | > 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 |
|
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 | > # Russian ambiguous-width characters: | |
|
45 | > @command('show_ambig_ru', [], '') | |||
37 | > def show_ambig_ru(ui, **opts): |
|
46 | > def show_ambig_ru(ui, **opts): | |
38 | > 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 |
|
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 | > \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 |
|
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 | > EOF |
|
53 | > EOF | |
52 |
|
54 | |||
53 | "COLUMNS=60" means that there is no lines which has grater than 58 width |
|
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 | $ cat > foobar.py <<EOF |
|
3 | $ cat > foobar.py <<EOF | |
4 | > import os |
|
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 | > def uisetup(ui): |
|
10 | > def uisetup(ui): | |
8 | > ui.write("uisetup called\\n") |
|
11 | > ui.write("uisetup called\\n") | |
@@ -11,17 +14,14 b' Test basic extension support' | |||||
11 | > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root)) |
|
14 | > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root)) | |
12 | > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!")) |
|
15 | > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!")) | |
13 | > |
|
16 | > | |
|
17 | > @command('foo', [], 'hg foo') | |||
14 | > def foo(ui, *args, **kwargs): |
|
18 | > def foo(ui, *args, **kwargs): | |
15 | > ui.write("Foo\\n") |
|
19 | > ui.write("Foo\\n") | |
16 | > |
|
20 | > | |
|
21 | > @command('bar', [], 'hg bar') | |||
17 | > def bar(ui, *args, **kwargs): |
|
22 | > def bar(ui, *args, **kwargs): | |
18 | > ui.write("Bar\\n") |
|
23 | > ui.write("Bar\\n") | |
19 | > |
|
24 | > | |
20 | > cmdtable = { |
|
|||
21 | > "foo": (foo, [], "hg foo"), |
|
|||
22 | > "bar": (bar, [], "hg bar"), |
|
|||
23 | > } |
|
|||
24 | > |
|
|||
25 | > commands.norepo += ' bar' |
|
25 | > commands.norepo += ' bar' | |
26 | > EOF |
|
26 | > EOF | |
27 |
$ |
|
27 | $ abspath=`pwd`/foobar.py | |
@@ -288,21 +288,22 b' hide outer repo' | |||||
288 | $ cat > debugextension.py <<EOF |
|
288 | $ cat > debugextension.py <<EOF | |
289 | > '''only debugcommands |
|
289 | > '''only debugcommands | |
290 | > ''' |
|
290 | > ''' | |
|
291 | > from mercurial import cmdutil | |||
|
292 | > cmdtable = {} | |||
|
293 | > command = cmdutil.command(cmdtable) | |||
|
294 | > | |||
|
295 | > @command('debugfoobar', [], 'hg debugfoobar') | |||
291 | > def debugfoobar(ui, repo, *args, **opts): |
|
296 | > def debugfoobar(ui, repo, *args, **opts): | |
292 | > "yet another debug command" |
|
297 | > "yet another debug command" | |
293 | > pass |
|
298 | > pass | |
294 | > |
|
299 | > | |
|
300 | > @command('foo', [], 'hg foo') | |||
295 | > def foo(ui, repo, *args, **opts): |
|
301 | > def foo(ui, repo, *args, **opts): | |
296 | > """yet another foo command |
|
302 | > """yet another foo command | |
297 | > |
|
303 | > | |
298 | > This command has been DEPRECATED since forever. |
|
304 | > This command has been DEPRECATED since forever. | |
299 | > """ |
|
305 | > """ | |
300 | > pass |
|
306 | > pass | |
301 | > |
|
|||
302 | > cmdtable = { |
|
|||
303 | > "debugfoobar": (debugfoobar, (), "hg debugfoobar"), |
|
|||
304 | > "foo": (foo, (), "hg foo") |
|
|||
305 | > } |
|
|||
306 | > EOF |
|
307 | > EOF | |
307 | $ debugpath=`pwd`/debugextension.py |
|
308 | $ debugpath=`pwd`/debugextension.py | |
308 | $ echo "debugextension = $debugpath" >> $HGRCPATH |
|
309 | $ echo "debugextension = $debugpath" >> $HGRCPATH | |
@@ -475,15 +476,15 b' Extension module help vs command help:' | |||||
475 | Test help topic with same name as extension |
|
476 | Test help topic with same name as extension | |
476 |
|
477 | |||
477 | $ cat > multirevs.py <<EOF |
|
478 | $ cat > multirevs.py <<EOF | |
478 | > from mercurial import commands |
|
479 | > from mercurial import cmdutil, commands | |
|
480 | > cmdtable = {} | |||
|
481 | > command = cmdutil.command(cmdtable) | |||
479 | > """multirevs extension |
|
482 | > """multirevs extension | |
480 | > Big multi-line module docstring.""" |
|
483 | > Big multi-line module docstring.""" | |
|
484 | > @command('multirevs', [], 'ARG') | |||
481 | > def multirevs(ui, repo, arg, *args, **opts): |
|
485 | > def multirevs(ui, repo, arg, *args, **opts): | |
482 | > """multirevs command""" |
|
486 | > """multirevs command""" | |
483 | > pass |
|
487 | > pass | |
484 | > cmdtable = { |
|
|||
485 | > "multirevs": (multirevs, [], 'ARG') |
|
|||
486 | > } |
|
|||
487 | > commands.norepo += ' multirevs' |
|
488 | > commands.norepo += ' multirevs' | |
488 | > EOF |
|
489 | > EOF | |
489 | $ echo "multirevs = multirevs.py" >> $HGRCPATH |
|
490 | $ echo "multirevs = multirevs.py" >> $HGRCPATH | |
@@ -532,13 +533,15 b' Issue811: Problem loading extensions twi' | |||||
532 | $ cat > debugissue811.py <<EOF |
|
533 | $ cat > debugissue811.py <<EOF | |
533 | > '''show all loaded extensions |
|
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 | > def debugextensions(ui): |
|
541 | > def debugextensions(ui): | |
538 | > "yet another debug command" |
|
542 | > "yet another debug command" | |
539 | > ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()])) |
|
543 | > ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()])) | |
540 | > |
|
544 | > | |
541 | > cmdtable = {"debugextensions": (debugextensions, (), "hg debugextensions")} |
|
|||
542 | > commands.norepo += " debugextensions" |
|
545 | > commands.norepo += " debugextensions" | |
543 | > EOF |
|
546 | > EOF | |
544 | $ echo "debugissue811 = $debugpath" >> $HGRCPATH |
|
547 | $ echo "debugissue811 = $debugpath" >> $HGRCPATH |
@@ -652,19 +652,20 b' Test command without options' | |||||
652 |
|
652 | |||
653 | $ cat > helpext.py <<EOF |
|
653 | $ cat > helpext.py <<EOF | |
654 | > import os |
|
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 | > def nohelp(ui, *args, **kwargs): |
|
666 | > def nohelp(ui, *args, **kwargs): | |
658 | > pass |
|
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 | > commands.norepo += ' nohelp' |
|
669 | > commands.norepo += ' nohelp' | |
669 | > EOF |
|
670 | > EOF | |
670 |
$ |
|
671 | $ echo '[extensions]' >> $HGRCPATH |
@@ -1,7 +1,11 b'' | |||||
1 |
|
1 | |||
2 | $ cat > loop.py <<EOF |
|
2 | $ cat > loop.py <<EOF | |
3 | > from mercurial import commands |
|
3 | > from mercurial import cmdutil, commands | |
4 | > import time |
|
4 | > import time | |
|
5 | > | |||
|
6 | > cmdtable = {} | |||
|
7 | > command = cmdutil.command(cmdtable) | |||
|
8 | > | |||
5 | > class incrementingtime(object): |
|
9 | > class incrementingtime(object): | |
6 | > def __init__(self): |
|
10 | > def __init__(self): | |
7 | > self._time = 0.0 |
|
11 | > self._time = 0.0 | |
@@ -10,6 +14,11 b'' | |||||
10 | > return self._time |
|
14 | > return self._time | |
11 | > time.time = incrementingtime() |
|
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 | > def loop(ui, loops, **opts): |
|
22 | > def loop(ui, loops, **opts): | |
14 | > loops = int(loops) |
|
23 | > loops = int(loops) | |
15 | > total = None |
|
24 | > total = None | |
@@ -38,14 +47,6 b'' | |||||
38 | > ui.progress('loop', None, 'loop.done', 'loopnum', total) |
|
47 | > ui.progress('loop', None, 'loop.done', 'loopnum', total) | |
39 | > |
|
48 | > | |
40 | > commands.norepo += " loop" |
|
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 | > EOF |
|
50 | > EOF | |
50 |
|
51 | |||
51 | $ cp $HGRCPATH $HGRCPATH.orig |
|
52 | $ cp $HGRCPATH $HGRCPATH.orig |
General Comments 0
You need to be logged in to leave comments.
Login now