comparison mercurial/subrepo.py @ 12167:d2c5b0927c28

diff: recurse into subrepositories with --subrepos/-S flag
author Martin Geisler <mg@lazybytes.net>
date Fri, 03 Sep 2010 12:58:51 +0200
parents 441a74b8def1
children ecab10820983
comparison
equal deleted inserted replaced
12166:441a74b8def1 12167:d2c5b0927c28
5 # This software may be used and distributed according to the terms of the 5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 import errno, os, re, xml.dom.minidom, shutil, urlparse, posixpath 8 import errno, os, re, xml.dom.minidom, shutil, urlparse, posixpath
9 from i18n import _ 9 from i18n import _
10 import config, util, node, error 10 import config, util, node, error, cmdutil
11 hg = None 11 hg = None
12 12
13 nullstate = ('', '', 'empty') 13 nullstate = ('', '', 'empty')
14 14
15 def state(ctx, ui): 15 def state(ctx, ui):
247 247
248 248
249 def status(self, rev2, **opts): 249 def status(self, rev2, **opts):
250 return [], [], [], [], [], [], [] 250 return [], [], [], [], [], [], []
251 251
252 def diff(self, diffopts, node2, match, prefix, **opts):
253 pass
254
252 class hgsubrepo(abstractsubrepo): 255 class hgsubrepo(abstractsubrepo):
253 def __init__(self, ctx, path, state): 256 def __init__(self, ctx, path, state):
254 self._path = path 257 self._path = path
255 self._state = state 258 self._state = state
256 r = ctx._repo 259 r = ctx._repo
286 return self._repo.status(ctx1, ctx2, **opts) 289 return self._repo.status(ctx1, ctx2, **opts)
287 except error.RepoLookupError, inst: 290 except error.RepoLookupError, inst:
288 self._repo.ui.warn(_("warning: %s in %s\n") 291 self._repo.ui.warn(_("warning: %s in %s\n")
289 % (inst, relpath(self))) 292 % (inst, relpath(self)))
290 return [], [], [], [], [], [], [] 293 return [], [], [], [], [], [], []
294
295 def diff(self, diffopts, node2, match, prefix, **opts):
296 try:
297 node1 = node.bin(self._state[1])
298 cmdutil.diffordiffstat(self._repo.ui, self._repo, diffopts,
299 node1, node2, match,
300 prefix=os.path.join(prefix, self._path),
301 listsubrepos=True, **opts)
302 except error.RepoLookupError, inst:
303 self._repo.ui.warn(_("warning: %s in %s\n")
304 % (inst, relpath(self)))
291 305
292 def dirty(self): 306 def dirty(self):
293 r = self._state[1] 307 r = self._state[1]
294 if r == '': 308 if r == '':
295 return True 309 return True