diff mercurial/subrepo.py @ 23938:de519517f597 stable

subrepo: correctly add newline for git subrepo diffs Previously, git subrepo diffs did not have a newline at the end. This caused multiple subrepo diffs to be joined on the same line. Additionally, the command prompt after the diff still contained a part of the diff.
author Mathias De Mar? <mathias.demare@gmail.com>
date Wed, 21 Jan 2015 21:47:27 +0100
parents 9994f45ba714
children 8f02682ff3b0
line wrap: on
line diff
--- a/mercurial/subrepo.py	Thu Jan 22 00:10:26 2015 +0900
+++ b/mercurial/subrepo.py	Wed Jan 21 21:47:27 2015 +0100
@@ -1648,13 +1648,17 @@
         if match.anypats():
             return #No support for include/exclude yet
 
+        output = ""
         if match.always():
-            ui.write(self._gitcommand(cmd))
+            output += self._gitcommand(cmd) + '\n'
         elif match.files():
             for f in match.files():
-                ui.write(self._gitcommand(cmd + [f]))
+                output += self._gitcommand(cmd + [f]) + '\n'
         elif match(gitprefix): #Subrepo is matched
-            ui.write(self._gitcommand(cmd))
+            output += self._gitcommand(cmd) + '\n'
+
+        if output.strip():
+            ui.write(output)
 
     @annotatesubrepoerror
     def revert(self, substate, *pats, **opts):