windows: avoid deleting non-empty reparse points
If a hg repository including working directory is a reparse point (directory
symlinked or a junction point), then using os.removedirs will remove the
reparse point erroneously. This is fixed by only removing directories if they
are empty.
#!/bin/sh
hg init a
cd a
mkdir a
echo a > a/b
hg ci -Am m
hg rm a
hg ci -m m a
mkdir a b
echo a > a/b
hg ci -Am m
hg rm a
cd b
# relative delete
hg ci -m m ../a