[PATCH 4 of 5 VFS] subrepo: inline reporelpath into abstractsubrepo._relpath to centralize logic
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Thu Apr 9 10:51:17 CDT 2015
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1428593802 -32400
# Fri Apr 10 00:36:42 2015 +0900
# Node ID 01b48b1b6786c8fb5c2a6b785a85aa413f552ba6
# Parent f058247059f549cbeeaddc0f1891b41575c75d0c
subrepo: inline reporelpath into abstractsubrepo._relpath to centralize logic
"reporelpath()" is referred only from "abstractsubrepo._relpath()".
diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -271,13 +271,6 @@ def _updateprompt(ui, sub, dirty, local,
% (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 @@ class abstractsubrepo(object):
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):
More information about the Mercurial-devel
mailing list