Mercurial > hg-allpaths
view allpaths.py @ 7:1ea915867337
Standard push options are imported from mercurial, not copied here.
Functional effect it is now possible to specify: --ssh, --remotecmd,
and --insecure which were not handled previously. Extension will also
handle new push opts in future (would they happen)
author | Marcin Kasperski <Marcin.Kasperski@mekk.waw.pl> |
---|---|
date | Sun, 08 Nov 2015 08:45:26 +0100 |
parents | b1d440f1027a |
children | eced61373a74 |
line wrap: on
line source
# allpaths.py - execute commands on multiple paths # # This software may be used and distributed according to the terms of # the GNU General Public License version 2 or any later version. '''execute commands on multiple paths''' import mercurial.util import mercurial.commands import mercurial.cmdutil from mercurial.i18n import _ #pylint:disable=invalid-name,broad-except,line-too-long def pushall(ui, repo, **opts): """execute a push command on multiple paths""" # Extract our options and filter them out group = opts.pop('group', None) ignore_errors = opts.pop('ignore_errors', None) # Get the paths to push to. paths = ui.configitems(group) if not paths: raise mercurial.util.Abort(_('No paths defined in section %s') % group) # Push! for path in paths: try: mercurial.commands.push(ui, repo, path[1], **opts) except Exception as e: if not ignore_errors: raise ui.warn(_('error pushing to %s: %s') % (path[1], e)) def _original_options(cmdname): """Gets list of given command options as specified in Mercurial core""" _, spec = mercurial.cmdutil.findcmd(cmdname, mercurial.commands.table) return spec[1] cmdtable = { "pushall": ( pushall, [ ('g', 'group', 'paths', _('use a named group of paths')), ('', 'ignore-errors', None, _('continue execution despite errors')), ] + _original_options('push'), _('[-g GROUP] [--ignore-errors] <push options>')), }