##// END OF EJS Templates
subrepo: introduce files and filedata methods for subrepo classes
Martin Geisler -
r12322:510afb31 default
parent child Browse files
Show More
@@ -270,6 +270,18 b' class abstractsubrepo(object):'
270 def incoming(self, ui, source, opts):
270 def incoming(self, ui, source, opts):
271 return 1
271 return 1
272
272
273 def files(self):
274 """return filename iterator"""
275 raise NotImplementedError
276
277 def filedata(self, name):
278 """return file data"""
279 raise NotImplementedError
280
281 def fileflags(self, name):
282 """return file flags"""
283 return ''
284
273 class hgsubrepo(abstractsubrepo):
285 class hgsubrepo(abstractsubrepo):
274 def __init__(self, ctx, path, state):
286 def __init__(self, ctx, path, state):
275 self._path = path
287 self._path = path
@@ -406,6 +418,21 b' class hgsubrepo(abstractsubrepo):'
406 def incoming(self, ui, source, opts):
418 def incoming(self, ui, source, opts):
407 return hg.incoming(ui, self._repo, _abssource(self._repo, False), opts)
419 return hg.incoming(ui, self._repo, _abssource(self._repo, False), opts)
408
420
421 def files(self):
422 rev = self._state[1]
423 ctx = self._repo[rev]
424 return ctx.manifest()
425
426 def filedata(self, name):
427 rev = self._state[1]
428 return self._repo[rev][name].data()
429
430 def fileflags(self, name):
431 rev = self._state[1]
432 ctx = self._repo[rev]
433 return ctx.flags(name)
434
435
409 class svnsubrepo(abstractsubrepo):
436 class svnsubrepo(abstractsubrepo):
410 def __init__(self, ctx, path, state):
437 def __init__(self, ctx, path, state):
411 self._path = path
438 self._path = path
@@ -508,6 +535,15 b' class svnsubrepo(abstractsubrepo):'
508 # push is a no-op for SVN
535 # push is a no-op for SVN
509 return True
536 return True
510
537
538 def files(self):
539 output = self._svncommand(['list'])
540 # This works because svn forbids \n in filenames.
541 return output.splitlines()
542
543 def filedata(self, name):
544 return self._svncommand(['cat'], name)
545
546
511 types = {
547 types = {
512 'hg': hgsubrepo,
548 'hg': hgsubrepo,
513 'svn': svnsubrepo,
549 'svn': svnsubrepo,
General Comments 0
You need to be logged in to leave comments. Login now