##// END OF EJS Templates
color: move git-subrepo support into the subrepo module...
Pierre-Yves David -
r31102:96d561c9 default
parent child Browse files
Show More
@@ -177,7 +177,6 b' from mercurial import ('
177 commands,
177 commands,
178 dispatch,
178 dispatch,
179 extensions,
179 extensions,
180 subrepo,
181 ui as uimod,
180 ui as uimod,
182 )
181 )
183
182
@@ -198,14 +197,7 b' def uisetup(ui):'
198 if mode and mode != 'debug':
197 if mode and mode != 'debug':
199 color.configstyles(ui_)
198 color.configstyles(ui_)
200 return orig(ui_, opts, cmd, cmdfunc)
199 return orig(ui_, opts, cmd, cmdfunc)
201 def colorgit(orig, gitsub, commands, env=None, stream=False, cwd=None):
202 if gitsub.ui._colormode and len(commands) and commands[0] == "diff":
203 # insert the argument in the front,
204 # the end of git diff arguments is used for paths
205 commands.insert(1, '--color')
206 return orig(gitsub, commands, env, stream, cwd)
207 extensions.wrapfunction(dispatch, '_runcommand', colorcmd)
200 extensions.wrapfunction(dispatch, '_runcommand', colorcmd)
208 extensions.wrapfunction(subrepo.gitsubrepo, '_gitnodir', colorgit)
209
201
210 def extsetup(ui):
202 def extsetup(ui):
211 commands.globalopts.append(
203 commands.globalopts.append(
@@ -1414,6 +1414,10 b' class gitsubrepo(abstractsubrepo):'
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)
General Comments 0
You need to be logged in to leave comments. Login now