##// END OF EJS Templates
subrepo: add _relpath field to centralize subrelpath logic...
FUJIWARA Katsunori -
r24673:105758d1 default
parent child Browse files
Show More
@@ -280,11 +280,7 b' def reporelpath(repo):'
280
280
281 def subrelpath(sub):
281 def subrelpath(sub):
282 """return path to this subrepo as seen from outermost repo"""
282 """return path to this subrepo as seen from outermost repo"""
283 if util.safehasattr(sub, '_relpath'):
283 return sub._relpath
284 return sub._relpath
285 if not util.safehasattr(sub, '_repo'):
286 return sub._path
287 return reporelpath(sub._repo)
288
284
289 def _abssource(repo, push=False, abort=True):
285 def _abssource(repo, push=False, abort=True):
290 """return pull/push path of repo - either based on parent repo .hgsub info
286 """return pull/push path of repo - either based on parent repo .hgsub info
@@ -558,6 +554,12 b' class abstractsubrepo(object):'
558 """
554 """
559 return scmutil.vfs(self._ctx.repo().wvfs.join(self._path))
555 return scmutil.vfs(self._ctx.repo().wvfs.join(self._path))
560
556
557 @propertycache
558 def _relpath(self):
559 """return path to this subrepository as seen from outermost repository
560 """
561 return self.wvfs.reljoin(reporelpath(self._ctx.repo()), self._path)
562
561 class hgsubrepo(abstractsubrepo):
563 class hgsubrepo(abstractsubrepo):
562 def __init__(self, ctx, path, state):
564 def __init__(self, ctx, path, state):
563 super(hgsubrepo, self).__init__(ctx, path)
565 super(hgsubrepo, self).__init__(ctx, path)
@@ -1188,7 +1190,6 b' class gitsubrepo(abstractsubrepo):'
1188 def __init__(self, ctx, path, state):
1190 def __init__(self, ctx, path, state):
1189 super(gitsubrepo, self).__init__(ctx, path)
1191 super(gitsubrepo, self).__init__(ctx, path)
1190 self._state = state
1192 self._state = state
1191 self._relpath = os.path.join(reporelpath(ctx.repo()), path)
1192 self._abspath = ctx.repo().wjoin(path)
1193 self._abspath = ctx.repo().wjoin(path)
1193 self._subparent = ctx.repo()
1194 self._subparent = ctx.repo()
1194 self._ensuregit()
1195 self._ensuregit()
General Comments 0
You need to be logged in to leave comments. Login now