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
#require symlink
$ origdir=`pwd`
$ hg init repo
$ cd repo
$ ln -s nothing dangling
avoid tar warnings about old timestamp
$ hg ci -d '2000-01-01 00:00:00 +0000' -qAm 'add symlink'
$ hg archive -t files ../archive
$ hg archive -t tar -p tar ../archive.tar
$ hg archive -t zip -p zip ../archive.zip
files
$ cd "$origdir"
$ cd archive
$ "$TESTDIR/readlink.py" dangling
dangling -> nothing
tar
$ cd "$origdir"
$ tar xf archive.tar
$ cd tar
$ "$TESTDIR/readlink.py" dangling
dangling -> nothing
zip
$ cd "$origdir"
$ unzip archive.zip > /dev/null 2>&1
$ cd zip
$ "$TESTDIR/readlink.py" dangling
dangling -> nothing
$ cd ..