log: fix log revset instability
The log/graphlog revset was not producing stable results since it was
iterating over a dict. Now we sort before iterating to guarantee a fixed order.
This fixes some potential flakiness in the tests.
To run the tests, do:cd tests/python run-tests.pySee http://mercurial.selenic.com/wiki/WritingTests formore information on writing tests.