cleanup: use the deque type where appropriate
There have been quite a few places where we pop elements off the
front of a list. This can turn O(n) algorithms into something more
like O(n**2). Python has provided a deque type that can do this
efficiently since at least 2.4.
As an example of the difference a deque can make, it improves
perfancestors performance on a Linux repo from 0.50 seconds to 0.36.
test that 'hg commit' does not crash if the user removes a newly added file
$ hg init
$ echo This is file a1 > a
$ hg add a
$ hg commit -m "commit #0"
$ touch b
$ hg add b
$ rm b
$ hg commit -A -m"comment #1"
removing b
nothing changed
[1]