Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 21767:75a96326cecb
commands: add norepo argument to command decorator
Since decorators are evaluated at module load time and since the
@command decorator imports commands, the norepo variable (along with
its friends) may not be declared yet. These variables are now declared
before @command usage to ensure they are present.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 04 May 2014 20:58:25 -0700 |
parents | 0c6cdbb697d9 |
children | 16aeb28caaa6 |
comparison
equal
deleted
inserted
replaced
21766:a039e1f2326f | 21767:75a96326cecb |
---|---|
24 | 24 |
25 table = {} | 25 table = {} |
26 | 26 |
27 command = cmdutil.command(table) | 27 command = cmdutil.command(table) |
28 | 28 |
29 norepo = ("clone init version help debugcommands debugcomplete" | |
30 " debugdate debuginstall debugfsinfo debugpushkey debugwireargs" | |
31 " debugknown debuggetbundle debugbundle") | |
32 optionalrepo = ("identify paths serve config showconfig debugancestor debugdag" | |
33 " debugdata debugindex debugindexdot debugrevlog") | |
34 inferrepo = ("add addremove annotate cat commit diff grep forget log parents" | |
35 " remove resolve status debugwalk") | |
29 # common command options | 36 # common command options |
30 | 37 |
31 globalopts = [ | 38 globalopts = [ |
32 ('R', 'repository', '', | 39 ('R', 'repository', '', |
33 _('repository root directory or name of overlay bundle file'), | 40 _('repository root directory or name of overlay bundle file'), |
5975 "\nCopyright (C) 2005-2014 Matt Mackall and others\n" | 5982 "\nCopyright (C) 2005-2014 Matt Mackall and others\n" |
5976 "This is free software; see the source for copying conditions. " | 5983 "This is free software; see the source for copying conditions. " |
5977 "There is NO\nwarranty; " | 5984 "There is NO\nwarranty; " |
5978 "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" | 5985 "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" |
5979 )) | 5986 )) |
5980 | |
5981 norepo = ("clone init version help debugcommands debugcomplete" | |
5982 " debugdate debuginstall debugfsinfo debugpushkey debugwireargs" | |
5983 " debugknown debuggetbundle debugbundle") | |
5984 optionalrepo = ("identify paths serve config showconfig debugancestor debugdag" | |
5985 " debugdata debugindex debugindexdot debugrevlog") | |
5986 inferrepo = ("add addremove annotate cat commit diff grep forget log parents" | |
5987 " remove resolve status debugwalk") |