verify: check the subrepository references in .hgsubstate
While hopefully atypical, there are reasons that a subrepository revision can be
lost that aren't covered by corruption of the .hgsubstate revlog. Such things
can happen when a subrepo is amended, stripped or simply isn't pulled from
upstream because the parent repo revision wasn't updated yet. There's no way to
know if it is an error, but this will find potential problems sooner than when
some random revision is updated.
Until recently, convert made no attempt at rewriting the .hgsubstate file. The
impetuous for this is to verify the conversion of some repositories, and this is
orders of magnitude faster than a bash script from 0..tip that does an
'hg update -C $rev'. But it is equally useful to determine if everything has
been pulled down before taking a thumb drive on the go.
It feels somewhat wrong to leave this out of verifymod (mostly because the file
is already read in there, and the final summary is printed before the subrepos
are checked). But verifymod looks very low level, so importing subrepo stuff
there seems more wrong.
#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
$ readlink.py dangling
dangling -> nothing
tar
$ cd "$origdir"
$ tar xf archive.tar
$ cd tar
$ readlink.py dangling
dangling -> nothing
zip
$ cd "$origdir"
$ unzip archive.zip > /dev/null 2>&1
$ cd zip
$ readlink.py dangling
dangling -> nothing
$ cd ..