# HG changeset patch # User Marcin Kasperski # Date 1446969025 -3600 # Node ID eced61373a74a1af691a0d5ce0b29fdd7b8dc150 # Parent 1ea915867337978f427543f48d622dad656c881a Added pullall diff -r 1ea915867337 -r eced61373a74 allpaths.py --- 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] ')), + "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] ')), }