Mercurial > hg-allpaths
view allpaths.py @ 0:6f92e4c814d1
Initial commit.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 19 Feb 2013 17:29:34 -0800 |
parents | |
children | f8703c9e2fb9 |
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 from mercurial.i18n import _ push_flags = ['force', 'rev', 'bookmark', 'branch', 'new-branch'] def pushall(ui, repo, *args, **opts): """execute a push command on multiple paths""" # Filter options that should be passed on to `push`. push_opts = {} for key in opts: if key in push_flags: push_opts[key] = opts[key] # Get the paths to push to. group = opts.get('group') 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, **push_opts) except Exception as e: if not opts.get('ignore_errors'): raise ui.warn(_('error pushing to %s: %s') % (path, e)) cmdtable = { "pushall": ( pushall, [ ('g', 'group', 'paths', _('use a named group of paths')), ('', 'ignore-errors', None, _('continue execution despite errors')), ('f', 'force', None, _('force push')), ('r', 'rev', [], _('a changeset intended to be included in the destination'), _('REV')), ('B', 'bookmark', [], _('bookmark to push'), _('BOOKMARK')), ('b', 'branch', [], _('a specific branch you would like to push'), _('BRANCH')), ('', 'new-branch', False, _('allow pushing a new branch')) ], _('[-g GROUP] [--ignore-errors] <push options>')) }