localrepo: refactor prepush logic
Simplifies the prepush check logic and makes it a lot more direct and
comprehensible. Instead of comparing the total local vs. remote head count, it
compares the number of new vs. removed heads.
#!/bin/sh
#
hg init foo
cd foo
touch a
unset HGUSER
echo "[ui]" >> .hg/hgrc
echo "username= foo" >> .hg/hgrc
echo " bar1" >> .hg/hgrc
hg ci -Am m
rm .hg/hgrc
HGUSER=`(echo foo; echo bar2)` hg ci -Am m
hg ci -Am m -u "`(echo foo; echo bar3)`"
true