diff mercurial_all_paths.py @ 44:2d6c7e0c1b2f

Added newline between successive items output
author Marcin Kasperski <Marcin.Kasperski@mekk.waw.pl>
date Sun, 25 Sep 2016 08:38:27 +0200
parents b8a7342fbf23
children 237dd8c4fe78
line wrap: on
line diff
--- a/mercurial_all_paths.py	Sat Sep 24 23:31:49 2016 +0200
+++ b/mercurial_all_paths.py	Sun Sep 25 08:38:27 2016 +0200
@@ -13,7 +13,7 @@
 # pylint:disable=invalid-name,broad-except,line-too-long
 
 
-def _iter_over_paths(command, ui, repo, **opts):
+def _iter_over_paths(command, ui, repo, add_sep, **opts):
     """execute given command on multiple paths"""
     # Extract our options and filter them out
     group = opts.pop('group', None) or 'paths'
@@ -26,12 +26,17 @@
 
     # Used to avoid handling duplicate paths twice
     handled = {}
+    # Used to add extra newline between items
+    sep = ''
 
     # Act!
     for alias, path in paths:
         if path in handled:
-            ui.note(_("Skipping %s as path %s was already handled %s\n") % (alias, handled[path]))
+            ui.status(sep + _("Skipping %s as path %s was already handled %s\n") % (alias, handled[path]))
+            sep = '\n' if add_sep else ''
         else:
+            ui.status(sep)
+            sep = '\n' if add_sep else ''
             handled[path] = alias
             try:
                 command(ui, repo, path, **opts)
@@ -39,26 +44,26 @@
                 if not ignore_errors:
                     raise
                 ui.warn(_('error handling %s: %s\n') % (alias, e))
-
+                sep = '\n'
 
 def pushall(ui, repo, **opts):
     """execute push on multiple paths"""
-    _iter_over_paths(mercurial.commands.push, ui, repo, **opts)
+    _iter_over_paths(mercurial.commands.push, ui, repo, True, **opts)
 
 
 def pullall(ui, repo, **opts):
     """execute pull on multiple paths"""
-    _iter_over_paths(mercurial.commands.pull, ui, repo, **opts)
+    _iter_over_paths(mercurial.commands.pull, ui, repo, True, **opts)
 
 
 def incomingall(ui, repo, **opts):
     """execute incoming on multiple paths"""
-    _iter_over_paths(mercurial.commands.incoming, ui, repo, **opts)
+    _iter_over_paths(mercurial.commands.incoming, ui, repo, False, **opts)
 
 
 def outgoingall(ui, repo, **opts):
     """execute outgoing on multiple paths"""
-    _iter_over_paths(mercurial.commands.outgoing, ui, repo, **opts)
+    _iter_over_paths(mercurial.commands.outgoing, ui, repo, False, **opts)
 
 
 def _original_options(cmdname):