changeset 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 9d5c27890790
files mercurial/subrepo.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/subrepo.py	Wed Apr 15 11:23:26 2015 -0400
+++ b/mercurial/subrepo.py	Wed Apr 15 11:49:44 2015 -0400
@@ -959,6 +959,13 @@
         """
         return self._repo.wvfs
 
+    @propertycache
+    def _relpath(self):
+        """return path to this subrepository as seen from outermost repository
+        """
+        # Keep consistent dir separators by avoiding vfs.join(self._path)
+        return reporelpath(self._repo)
+
 class svnsubrepo(abstractsubrepo):
     def __init__(self, ctx, path, state):
         super(svnsubrepo, self).__init__(ctx, path)