comparison allpaths.py @ 12:bed42905e871

Avoiding doing pull or push twice in case some path has more than one alias (like when both default and bitbucket are aliases to the same remote path)
author Marcin Kasperski <Marcin.Kasperski@mekk.waw.pl>
date Sun, 08 Nov 2015 09:08:58 +0100
parents e702b63eea3f
children
comparison
equal deleted inserted replaced
11:e702b63eea3f 12:bed42905e871
22 # Get the paths to push to. 22 # Get the paths to push to.
23 paths = ui.configitems(group) 23 paths = ui.configitems(group)
24 if not paths: 24 if not paths:
25 raise mercurial.util.Abort(_('No paths defined in section %s') % group) 25 raise mercurial.util.Abort(_('No paths defined in section %s') % group)
26 26
27 # Push! 27 # Used to avoid handling duplicate paths twice
28 for path in paths: 28 handled = {}
29 try: 29
30 command(ui, repo, path[1], **opts) 30 # Act!
31 except Exception as e: 31 for alias, path in paths:
32 if not ignore_errors: 32 if path in handled:
33 raise 33 ui.note(_("Skipping %s as it aliases already handled %s\n") % (alias, handled[path]))
34 ui.warn(_('error handling %s: %s') % (path[1], e)) 34 else:
35 handled[path] = alias
36 try:
37 command(ui, repo, path, **opts)
38 except Exception as e:
39 if not ignore_errors:
40 raise
41 ui.warn(_('error handling %s: %s') % (path[1], e))
35 42
36 43
37 def pushall(ui, repo, **opts): 44 def pushall(ui, repo, **opts):
38 """execute pull on multiple paths""" 45 """execute pull on multiple paths"""
39 _iter_over_paths(mercurial.commands.push, ui, repo, **opts) 46 _iter_over_paths(mercurial.commands.push, ui, repo, **opts)