comparison mercurial/subrepo.py @ 24786:56e15db9109f

subrepo: calculate _relpath for hgsubrepo based on self instead of parent Prior to 105758d1b37b, the subrelpath() (now _relpath) for hgsubrepo was calculated by removing the root path of the outermost repo from the root path of the subrepo. Since the root paths use platform specific separators, and the relative path is printed by various commands, the output of these commands require a glob (and check-code.py enforces this). In an effort to be generic to all subrepos, 105758d1b37b started calculating this path based on the parent repo, and then joining the subrepo path in .hgsub. One of the tests in test-subrepo.t creates a subrepo inside a directory, so the path being joined contained '/' instead of '\'. This made the test fail with a '~' status, because the glob is unnecessary[1]. Removing them made the test work, but then check-code complains. We can't just drop the check-code rule, because sub-subrepos are still joined with '\'. Presumably the other subrepo types have this issue as well, but there likely isn't a test with git or svn repos inside a subdirectory. This simply restores the exact _relpath value (and output) for hgsubrepos prior to 105758d1b37b. [1] http://www.selenic.com/pipermail/mercurial-devel/2015-April/068720.html
author Matt Harbison <matt_harbison@yahoo.com>
date Wed, 15 Apr 2015 11:49:44 -0400
parents 39f519be5e65
children a99931201d1b
comparison
equal deleted inserted replaced
24785:39f519be5e65 24786:56e15db9109f
957 def wvfs(self): 957 def wvfs(self):
958 """return own wvfs for efficiency and consitency 958 """return own wvfs for efficiency and consitency
959 """ 959 """
960 return self._repo.wvfs 960 return self._repo.wvfs
961 961
962 @propertycache
963 def _relpath(self):
964 """return path to this subrepository as seen from outermost repository
965 """
966 # Keep consistent dir separators by avoiding vfs.join(self._path)
967 return reporelpath(self._repo)
968
962 class svnsubrepo(abstractsubrepo): 969 class svnsubrepo(abstractsubrepo):
963 def __init__(self, ctx, path, state): 970 def __init__(self, ctx, path, state):
964 super(svnsubrepo, self).__init__(ctx, path) 971 super(svnsubrepo, self).__init__(ctx, path)
965 self._state = state 972 self._state = state
966 self._exe = util.findexe('svn') 973 self._exe = util.findexe('svn')