comparison mercurial/subrepo.py @ 23536:fcbc66b5da6a

subrepo: store the ui object in the base class This will be used in the next patch to print a warning from the base class. It seems better than having to explicitly pass it to a new method, since a lot of existing methods also require it.
author Matt Harbison <matt_harbison@yahoo.com>
date Wed, 26 Nov 2014 16:13:38 -0500
parents 01a8dfc79cdc
children f1b06a8aad42
comparison
equal deleted inserted replaced
23535:72c23fa4f52f 23536:fcbc66b5da6a
370 370
371 # subrepo classes need to implement the following abstract class: 371 # subrepo classes need to implement the following abstract class:
372 372
373 class abstractsubrepo(object): 373 class abstractsubrepo(object):
374 374
375 def __init__(self, ui):
376 self._ui = ui
377
375 def storeclean(self, path): 378 def storeclean(self, path):
376 """ 379 """
377 returns true if the repository has not changed since it was last 380 returns true if the repository has not changed since it was last
378 cloned from or pushed to a given repository. 381 cloned from or pushed to a given repository.
379 """ 382 """
506 def shortid(self, revid): 509 def shortid(self, revid):
507 return revid 510 return revid
508 511
509 class hgsubrepo(abstractsubrepo): 512 class hgsubrepo(abstractsubrepo):
510 def __init__(self, ctx, path, state): 513 def __init__(self, ctx, path, state):
514 super(hgsubrepo, self).__init__(ctx._repo.ui)
511 self._path = path 515 self._path = path
512 self._state = state 516 self._state = state
513 r = ctx._repo 517 r = ctx._repo
514 root = r.wjoin(path) 518 root = r.wjoin(path)
515 create = not r.wvfs.exists('%s/.hg' % path) 519 create = not r.wvfs.exists('%s/.hg' % path)
876 def shortid(self, revid): 880 def shortid(self, revid):
877 return revid[:12] 881 return revid[:12]
878 882
879 class svnsubrepo(abstractsubrepo): 883 class svnsubrepo(abstractsubrepo):
880 def __init__(self, ctx, path, state): 884 def __init__(self, ctx, path, state):
885 super(svnsubrepo, self).__init__(ctx._repo.ui)
881 self._path = path 886 self._path = path
882 self._state = state 887 self._state = state
883 self._ctx = ctx 888 self._ctx = ctx
884 self._ui = ctx._repo.ui 889 self._ui = ctx._repo.ui
885 self._exe = util.findexe('svn') 890 self._exe = util.findexe('svn')
1106 return self._svncommand(['cat'], name)[0] 1111 return self._svncommand(['cat'], name)[0]
1107 1112
1108 1113
1109 class gitsubrepo(abstractsubrepo): 1114 class gitsubrepo(abstractsubrepo):
1110 def __init__(self, ctx, path, state): 1115 def __init__(self, ctx, path, state):
1116 super(gitsubrepo, self).__init__(ctx._repo.ui)
1111 self._state = state 1117 self._state = state
1112 self._ctx = ctx 1118 self._ctx = ctx
1113 self._path = path 1119 self._path = path
1114 self._relpath = os.path.join(reporelpath(ctx._repo), path) 1120 self._relpath = os.path.join(reporelpath(ctx._repo), path)
1115 self._abspath = ctx._repo.wjoin(path) 1121 self._abspath = ctx._repo.wjoin(path)