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 |