Mercurial > hg-allpaths
diff 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 |
line wrap: on
line diff
--- a/allpaths.py Sun Nov 08 09:01:49 2015 +0100 +++ b/allpaths.py Sun Nov 08 09:08:58 2015 +0100 @@ -24,14 +24,21 @@ if not paths: raise mercurial.util.Abort(_('No paths defined in section %s') % group) - # Push! - for path in paths: - try: - command(ui, repo, path[1], **opts) - except Exception as e: - if not ignore_errors: - raise - ui.warn(_('error handling %s: %s') % (path[1], e)) + # Used to avoid handling duplicate paths twice + handled = {} + + # Act! + for alias, path in paths: + if path in handled: + ui.note(_("Skipping %s as it aliases already handled %s\n") % (alias, handled[path])) + else: + handled[path] = alias + try: + command(ui, repo, path, **opts) + except Exception as e: + if not ignore_errors: + raise + ui.warn(_('error handling %s: %s') % (path[1], e)) def pushall(ui, repo, **opts):