Mercurial > hg-stable
diff mercurial/subrepo.py @ 31119:96d561c90ad0
color: move git-subrepo support into the subrepo module
Now that all ui instance carry a '_colormode' attribute, we can access and
comply to it directly in the subrepo code. The actual implementation could
probably be a bit smarter, but we stick close to the current one for the sake
of simplicity.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Tue, 21 Feb 2017 17:50:04 +0100 |
parents | b44ab288358e |
children | 8a0687a2be75 |
line wrap: on
line diff
--- a/mercurial/subrepo.py Thu Dec 22 14:30:46 2016 +0100 +++ b/mercurial/subrepo.py Tue Feb 21 17:50:04 2017 +0100 @@ -1414,6 +1414,10 @@ errpipe = None if self.ui.quiet: errpipe = open(os.devnull, 'w') + if self.ui._colormode and len(commands) and commands[0] == "diff": + # insert the argument in the front, + # the end of git diff arguments is used for paths + commands.insert(1, '--color') p = subprocess.Popen([self._gitexecutable] + commands, bufsize=-1, cwd=cwd, env=env, close_fds=util.closefds, stdout=subprocess.PIPE, stderr=errpipe)