Mercurial > hg-allpaths
changeset 8:eced61373a74
Added pullall
author | Marcin Kasperski <Marcin.Kasperski@mekk.waw.pl> |
---|---|
date | Sun, 08 Nov 2015 08:50:25 +0100 |
parents | 1ea915867337 |
children | dac7580bfff2 |
files | allpaths.py |
diffstat | 1 files changed, 22 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/allpaths.py Sun Nov 08 08:45:26 2015 +0100 +++ b/allpaths.py Sun Nov 08 08:50:25 2015 +0100 @@ -12,8 +12,9 @@ #pylint:disable=invalid-name,broad-except,line-too-long -def pushall(ui, repo, **opts): - """execute a push command on multiple paths""" + +def _iter_over_paths(command, ui, repo, **opts): + """execute given command on multiple paths""" # Extract our options and filter them out group = opts.pop('group', None) ignore_errors = opts.pop('ignore_errors', None) @@ -26,11 +27,21 @@ # Push! for path in paths: try: - mercurial.commands.push(ui, repo, path[1], **opts) + command(ui, repo, path[1], **opts) except Exception as e: if not ignore_errors: raise - ui.warn(_('error pushing to %s: %s') % (path[1], e)) + ui.warn(_('error handling %s: %s') % (path[1], e)) + + +def pushall(ui, repo, **opts): + """execute pull on multiple paths""" + _iter_over_paths(mercurial.commands.push, ui, repo, **opts) + + +def pullall(ui, repo, **opts): + """execute push on multiple paths""" + _iter_over_paths(mercurial.commands.pull, ui, repo, **opts) def _original_options(cmdname): @@ -47,4 +58,11 @@ ('', 'ignore-errors', None, _('continue execution despite errors')), ] + _original_options('push'), _('[-g GROUP] [--ignore-errors] <push options>')), + "pullall": ( + pullall, + [ + ('g', 'group', 'paths', _('use a named group of paths')), + ('', 'ignore-errors', None, _('continue execution despite errors')), + ] + _original_options('pull'), + _('[-g GROUP] [--ignore-errors] <pull options>')), }