extdiff: refactor logic which does diff of patches
The current extdiff code is hard to understand on first look. Took me few hours
to grasp the code. Before adding more things, decided to do some refactoring.
Differential Revision: https://phab.mercurial-scm.org/D8686
To run the tests, do:
cd tests/
python run-tests.py
See https://mercurial-scm.org/wiki/WritingTests for
more information on writing tests.