util: add removedirs as platform depending function
According to fa901423ac23 introducing "windows._removedirs()":
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.
"windows._removedirs()" should be used instead of "os.removedirs()" on
Windows.
This patch adds "removedirs" as platform depending function to replace
"os.removedirs()" invocations for portability and safety
$ hg init
$ touch a
$ unset HGUSER
$ echo "[ui]" >> .hg/hgrc
$ echo "username= foo" >> .hg/hgrc
$ echo " bar1" >> .hg/hgrc
$ hg ci -Am m
adding a
abort: username 'foo\nbar1' contains a newline
[255]
$ rm .hg/hgrc
$ HGUSER=`(echo foo; echo bar2)` hg ci -Am m
abort: username 'foo\nbar2' contains a newline
[255]
$ hg ci -Am m -u "`(echo foo; echo bar3)`"
transaction abort!
rollback completed
abort: username 'foo\nbar3' contains a newline!
[255]