# HG changeset patch # User Matt Harbison # Date 1429112984 14400 # Node ID 56e15db9109fede0778d08a6e101c521364507b4 # Parent 39f519be5e65a92d1bda5ec4ae366a215152a90c 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 diff -r 39f519be5e65 -r 56e15db9109f mercurial/subrepo.py --- 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)