Mercurial > public > mercurial-scm > hg-stable
comparison 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 |
comparison
equal
deleted
inserted
replaced
31118:9021a94a7dbf | 31119:96d561c90ad0 |
---|---|
1412 # unless ui.quiet is set, print git's stderr, | 1412 # unless ui.quiet is set, print git's stderr, |
1413 # which is mostly progress and useful info | 1413 # which is mostly progress and useful info |
1414 errpipe = None | 1414 errpipe = None |
1415 if self.ui.quiet: | 1415 if self.ui.quiet: |
1416 errpipe = open(os.devnull, 'w') | 1416 errpipe = open(os.devnull, 'w') |
1417 if self.ui._colormode and len(commands) and commands[0] == "diff": | |
1418 # insert the argument in the front, | |
1419 # the end of git diff arguments is used for paths | |
1420 commands.insert(1, '--color') | |
1417 p = subprocess.Popen([self._gitexecutable] + commands, bufsize=-1, | 1421 p = subprocess.Popen([self._gitexecutable] + commands, bufsize=-1, |
1418 cwd=cwd, env=env, close_fds=util.closefds, | 1422 cwd=cwd, env=env, close_fds=util.closefds, |
1419 stdout=subprocess.PIPE, stderr=errpipe) | 1423 stdout=subprocess.PIPE, stderr=errpipe) |
1420 if stream: | 1424 if stream: |
1421 return p.stdout, None | 1425 return p.stdout, None |