##// END OF EJS Templates
cmdutil: support inferrepo in command decorator
Gregory Szorc -
r21777:17d1ac45 default
parent child Browse files
Show More
@@ -2496,8 +2496,14 b' def command(table):'
2496
2496
2497 The optionalrepo argument defines whether the command optionally requires
2497 The optionalrepo argument defines whether the command optionally requires
2498 a local repository.
2498 a local repository.
2499
2500 The inferrepo argument defines whether to try to find a repository from the
2501 command line arguments. If True, arguments will be examined for potential
2502 repository locations. See ``findrepo()``. If a repository is found, it
2503 will be used.
2499 """
2504 """
2500 def cmd(name, options=(), synopsis=None, norepo=False, optionalrepo=False):
2505 def cmd(name, options=(), synopsis=None, norepo=False, optionalrepo=False,
2506 inferrepo=False):
2501 def decorator(func):
2507 def decorator(func):
2502 if synopsis:
2508 if synopsis:
2503 table[name] = func, list(options), synopsis
2509 table[name] = func, list(options), synopsis
@@ -2513,6 +2519,10 b' def command(table):'
2513 import commands
2519 import commands
2514 commands.optionalrepo += ' %s' % ' '.join(parsealiases(name))
2520 commands.optionalrepo += ' %s' % ' '.join(parsealiases(name))
2515
2521
2522 if inferrepo:
2523 import commands
2524 commands.inferrepo += ' %s' % ' '.join(parsealiases(name))
2525
2516 return func
2526 return func
2517 return decorator
2527 return decorator
2518
2528
General Comments 0
You need to be logged in to leave comments. Login now