comparison mercurial/subrepo.py @ 18006:0c10cf819146 stable 2.4.1

subrepo: add argument to "diff()" to pass "ui" of caller side (issue3712) (API) Color extension achieves colorization by overriding the class of "ui" object just before command execution. Before this patch, "diff()" of abstractsubrepo and classes derived from it has no "ui" argument, so "diff()" of hgsubrepo uses "self._repo.ui" to invoke "cmdutil.diffordiffstat()". For separation of configuration between repositories, revision 573bec4ab7ba changed the initialization source of "self._repo.ui" from "ui"(overridden) to "baseui"(plain) of parent repository. And this caused break of colorization. This patch adds "ui" argument to "diff()" of abstractsubrepo and classes derived from it to pass "ui" object of caller side.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Fri, 30 Nov 2012 00:43:55 +0900
parents 17c030014ddf
children 54f063acc5ea
comparison
equal deleted inserted replaced
17988:848345a8d6ad 18006:0c10cf819146
328 return [] 328 return []
329 329
330 def status(self, rev2, **opts): 330 def status(self, rev2, **opts):
331 return [], [], [], [], [], [], [] 331 return [], [], [], [], [], [], []
332 332
333 def diff(self, diffopts, node2, match, prefix, **opts): 333 def diff(self, ui, diffopts, node2, match, prefix, **opts):
334 pass 334 pass
335 335
336 def outgoing(self, ui, dest, opts): 336 def outgoing(self, ui, dest, opts):
337 return 1 337 return 1
338 338
435 except error.RepoLookupError, inst: 435 except error.RepoLookupError, inst:
436 self._repo.ui.warn(_('warning: error "%s" in subrepository "%s"\n') 436 self._repo.ui.warn(_('warning: error "%s" in subrepository "%s"\n')
437 % (inst, subrelpath(self))) 437 % (inst, subrelpath(self)))
438 return [], [], [], [], [], [], [] 438 return [], [], [], [], [], [], []
439 439
440 def diff(self, diffopts, node2, match, prefix, **opts): 440 def diff(self, ui, diffopts, node2, match, prefix, **opts):
441 try: 441 try:
442 node1 = node.bin(self._state[1]) 442 node1 = node.bin(self._state[1])
443 # We currently expect node2 to come from substate and be 443 # We currently expect node2 to come from substate and be
444 # in hex format 444 # in hex format
445 if node2 is not None: 445 if node2 is not None:
446 node2 = node.bin(node2) 446 node2 = node.bin(node2)
447 cmdutil.diffordiffstat(self._repo.ui, self._repo, diffopts, 447 cmdutil.diffordiffstat(ui, self._repo, diffopts,
448 node1, node2, match, 448 node1, node2, match,
449 prefix=os.path.join(prefix, self._path), 449 prefix=os.path.join(prefix, self._path),
450 listsubrepos=True, **opts) 450 listsubrepos=True, **opts)
451 except error.RepoLookupError, inst: 451 except error.RepoLookupError, inst:
452 self._repo.ui.warn(_('warning: error "%s" in subrepository "%s"\n') 452 self._repo.ui.warn(_('warning: error "%s" in subrepository "%s"\n')