##// END OF EJS Templates
subrepo: inline reporelpath into abstractsubrepo._relpath to centralize logic...
FUJIWARA Katsunori -
r24674:93b0e0db default
parent child Browse files
Show More
@@ -271,13 +271,6 b' def _updateprompt(ui, sub, dirty, local,'
271 % (subrelpath(sub), local, remote))
271 % (subrelpath(sub), local, remote))
272 return ui.promptchoice(msg, 0)
272 return ui.promptchoice(msg, 0)
273
273
274 def reporelpath(repo):
275 """return path to this (sub)repo as seen from outermost repo"""
276 parent = repo
277 while util.safehasattr(parent, '_subparent'):
278 parent = parent._subparent
279 return repo.root[len(pathutil.normasprefix(parent.root)):]
280
281 def subrelpath(sub):
274 def subrelpath(sub):
282 """return path to this subrepo as seen from outermost repo"""
275 """return path to this subrepo as seen from outermost repo"""
283 return sub._relpath
276 return sub._relpath
@@ -558,7 +551,13 b' class abstractsubrepo(object):'
558 def _relpath(self):
551 def _relpath(self):
559 """return path to this subrepository as seen from outermost repository
552 """return path to this subrepository as seen from outermost repository
560 """
553 """
561 return self.wvfs.reljoin(reporelpath(self._ctx.repo()), self._path)
554 repo = self._ctx.repo()
555 parent = repo
556 while util.safehasattr(parent, '_subparent'):
557 parent = parent._subparent
558 reporelpath = repo.root[len(pathutil.normasprefix(parent.root)):]
559
560 return self.wvfs.reljoin(reporelpath, self._path)
562
561
563 class hgsubrepo(abstractsubrepo):
562 class hgsubrepo(abstractsubrepo):
564 def __init__(self, ctx, path, state):
563 def __init__(self, ctx, path, state):
General Comments 0
You need to be logged in to leave comments. Login now