changeset 24674:93b0e0db7929

subrepo: inline reporelpath into abstractsubrepo._relpath to centralize logic "reporelpath()" is referred only from "abstractsubrepo._relpath()".
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Fri, 10 Apr 2015 00:36:42 +0900
parents 105758d1b37b
children 47e7d5fbbf04
files mercurial/subrepo.py
diffstat 1 files changed, 7 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/subrepo.py	Fri Apr 10 00:36:42 2015 +0900
+++ b/mercurial/subrepo.py	Fri Apr 10 00:36:42 2015 +0900
@@ -271,13 +271,6 @@
                % (subrelpath(sub), local, remote))
     return ui.promptchoice(msg, 0)
 
-def reporelpath(repo):
-    """return path to this (sub)repo as seen from outermost repo"""
-    parent = repo
-    while util.safehasattr(parent, '_subparent'):
-        parent = parent._subparent
-    return repo.root[len(pathutil.normasprefix(parent.root)):]
-
 def subrelpath(sub):
     """return path to this subrepo as seen from outermost repo"""
     return sub._relpath
@@ -558,7 +551,13 @@
     def _relpath(self):
         """return path to this subrepository as seen from outermost repository
         """
-        return self.wvfs.reljoin(reporelpath(self._ctx.repo()), self._path)
+        repo = self._ctx.repo()
+        parent = repo
+        while util.safehasattr(parent, '_subparent'):
+            parent = parent._subparent
+        reporelpath = repo.root[len(pathutil.normasprefix(parent.root)):]
+
+        return self.wvfs.reljoin(reporelpath, self._path)
 
 class hgsubrepo(abstractsubrepo):
     def __init__(self, ctx, path, state):