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
echo a > a
hg add
hg ci -m1
# set mtime of a into the future
touch -t 202101011200 a
# status must not set a's entry to unset (issue1790)
hg status
hg debugstate