Mercurial > hg > mercurial
diff mercurial-common/src/python/load-commands-command.py @ 830:ef19cc8d5bc1
support parameters throug file for every mercurial command
author | eugene.petrenko@jetbrains.com |
---|---|
date | Fri, 30 May 2014 18:38:47 +0200 |
parents | 8d02c7b1f812 |
children | 16ad8d51b001 |
line wrap: on
line diff
--- a/mercurial-common/src/python/load-commands-command.py Fri May 30 17:35:01 2014 +0200 +++ b/mercurial-common/src/python/load-commands-command.py Fri May 30 18:38:47 2014 +0200 @@ -26,33 +26,31 @@ import codecs from mercurial import dispatch +from mercurial import commands def loadArguments(ui, params_file): file_commands = [] - ui.write("Parameters from the file (one by line):\n") with codecs.open(params_file, "r", "utf-8") as f: for _line in f: line = _line.strip() if len(line) <= 0: continue - ui.write(" " + line + "\n") - file_commands.append(line) + file_commands.append(str(line)) return file_commands -def load_commands_command(ui, repo, params_file, *pats, **opts): - ui.write("Staring command with arguments from " + params_file + "\n") +def load_commands_command(ui, params_file, *params): command_arguments = loadArguments(ui, params_file) - - ui.write("\nRunning the command...\n\n") return dispatch.dispatch(dispatch.request(command_arguments)) #so here goes command registration and options cmdtable = { - "CMD": (load_commands_command, [ ], "params_file [foo]...") + "CMD": (load_commands_command, [], " OUTPUT_FILE") } +commands.norepo += " CMD" + testedwith = '2.2.2' buglink = "@jonnyzzz"