##// 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 281 def subrelpath(sub):
282 282 """return path to this subrepo as seen from outermost repo"""
283 if util.safehasattr(sub, '_relpath'):
284 return sub._relpath
285 if not util.safehasattr(sub, '_repo'):
286 return sub._path
287 return reporelpath(sub._repo)
283 return sub._relpath
288 284
289 285 def _abssource(repo, push=False, abort=True):
290 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 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 563 class hgsubrepo(abstractsubrepo):
562 564 def __init__(self, ctx, path, state):
563 565 super(hgsubrepo, self).__init__(ctx, path)
@@ -1188,7 +1190,6 b' class gitsubrepo(abstractsubrepo):'
1188 1190 def __init__(self, ctx, path, state):
1189 1191 super(gitsubrepo, self).__init__(ctx, path)
1190 1192 self._state = state
1191 self._relpath = os.path.join(reporelpath(ctx.repo()), path)
1192 1193 self._abspath = ctx.repo().wjoin(path)
1193 1194 self._subparent = ctx.repo()
1194 1195 self._ensuregit()
General Comments 0
You need to be logged in to leave comments. Login now