diff --git a/mercurial/registrar.py b/mercurial/registrar.py --- a/mercurial/registrar.py +++ b/mercurial/registrar.py @@ -104,6 +104,14 @@ """ pass +class cmdtype(object): + """ enum for the type of command which will tell whether the command is + write, if so either recoverable or unrecoverable or just read only + """ + UNRECOVERABLE_WRITE = "unrecoverable" + RECOVERABLE_WRITE = "recoverable" + READ_ONLY = "readonly" + class command(_funcregistrarbase): """Decorator to register a command function to table @@ -132,10 +140,15 @@ command line arguments. If True, arguments will be examined for potential repository locations. See ``findrepo()``. If a repository is found, it will be used. + + The cmdtype argument tells us the type of command that whether its a read + only command, or a recoverable write command or an unrecoverable write + command. The values of the argument should be one from the cmdtype enum. """ def _doregister(self, func, name, options=(), synopsis=None, - norepo=False, optionalrepo=False, inferrepo=False): + norepo=False, optionalrepo=False, inferrepo=False, + cmdtype=cmdtype.UNRECOVERABLE_WRITE): func.norepo = norepo func.optionalrepo = optionalrepo func.inferrepo = inferrepo @@ -145,14 +158,6 @@ self._table[name] = func, list(options) return func -class cmdtype(object): - """ enum for the type of command which will tell whether the command is - write, if so either recoverable or unrecoverable or just read only - """ - UNRECOVERABLE_WRITE = "unrecoverable" - RECOVERABLE_WRITE = "recoverable" - READ_ONLY = "readonly" - class revsetpredicate(_funcregistrarbase): """Decorator to register revset predicate