The current diff being used by tests upon failing is not very good. Sometimes there is a lot of redundancy.
To see for yourself, follow these steps:
- Download this bundle : http://bit.ly/2DuJjsS
$ hg clone https://www.mercurial-scm.org/hg $ cd hg/ $ hg unbundle af8efb83e1d6.hg $ hg up a1e70c1dbec0^ $ g revert --all --rev a1e70c1dbec0 $ hg revert -i tests/test-bookmarks-pushpull.t # revert only the last three hunks (press 'n' for the first 8, and 'y' for the last three) $ cd tests $ hg diff --rev a1e70c1dbec0 # nice output from Mercurial $ ./run-test.py test-bookmarks-pushpull.t # poor output from the test runner
If you couldn't follow those steps, you can simply check the diffs here:
- test's diff: https://pastebin.com/Z4LRg4vx
--- /media/sangeet/Stuff/hgrepo/Octobus/MD4/tests/test-bookmarks-pushpull.t +++ /media/sangeet/Stuff/hgrepo/Octobus/MD4/tests/test-bookmarks-pushpull.t.b2-binary.err @@ -1086,8 +1086,7 @@ pushing to $TESTTMP/issue4455-dest (glob) searching for changes no changes found - pushkey-abort: prepushkey hook exited with status 1 - abort: exporting bookmark @ failed! + abort: prepushkey hook exited with status 1 [255] #endif @@ -1126,27 +1125,27 @@ pushing to ssh://user@dummy/issue4455-dest searching for changes no changes found + remote: prepushkey hook exited with status 1 + abort: push failed on remote + [255] + +#endif + + $ hg -R ../issue4455-dest/ bookmarks + no bookmarks set + +Using http +---------- + +#if b2-pushkey + $ hg push -B @ http # bundle2+ + pushing to http://localhost:$HGPORT/ + searching for changes + no changes found remote: pushkey-abort: prepushkey hook exited with status 1 abort: exporting bookmark @ failed! [255] -#endif - - $ hg -R ../issue4455-dest/ bookmarks - no bookmarks set - -Using http ----------- - -#if b2-pushkey - $ hg push -B @ http # bundle2+ - pushing to http://localhost:$HGPORT/ - searching for changes - no changes found - remote: pushkey-abort: prepushkey hook exited with status 1 - abort: exporting bookmark @ failed! - [255] - $ hg -R ../issue4455-dest/ bookmarks no bookmarks set @@ -1166,8 +1165,8 @@ pushing to ssh://user@dummy/issue4455-dest searching for changes no changes found - remote: pushkey-abort: prepushkey hook exited with status 1 - abort: exporting bookmark @ failed! + remote: prepushkey hook exited with status 1 + abort: push failed on remote [255] #endif ERROR: test-bookmarks-pushpull.t (case b2-binary) output changed !. Failed test-bookmarks-pushpull.t (case b2-binary): output changed # Ran 2 tests, 0 skipped, 1 failed. python hash seed: 133193196
- diff used by hg diff: https://pastebin.com/qanQEsiA
diff -r a1e70c1dbec0 tests/test-bookmarks-pushpull.t --- a/tests/test-bookmarks-pushpull.t Thu Nov 01 22:20:00 2018 +0530 +++ b/tests/test-bookmarks-pushpull.t Tue Oct 17 12:38:13 2017 +0200 @@ -1086,8 +1086,7 @@ pushing to $TESTTMP/issue4455-dest (glob) searching for changes no changes found - pushkey-abort: prepushkey hook exited with status 1 - abort: exporting bookmark @ failed! + abort: prepushkey hook exited with status 1 [255] #endif @@ -1126,8 +1125,8 @@ pushing to ssh://user@dummy/issue4455-dest searching for changes no changes found - remote: pushkey-abort: prepushkey hook exited with status 1 - abort: exporting bookmark @ failed! + remote: prepushkey hook exited with status 1 + abort: push failed on remote [255] #endif @@ -1166,8 +1165,8 @@ pushing to ssh://user@dummy/issue4455-dest searching for changes no changes found - remote: pushkey-abort: prepushkey hook exited with status 1 - abort: exporting bookmark @ failed! + remote: prepushkey hook exited with status 1 + abort: push failed on remote [255] #endif
Tests uses _unified_diff based on difflib.py . The output isn't great!
Mercurial's diff uses mdiff which gives better diffs.
This patch uses mdiff's unidiff function to generate the diff for the failed tests.
At least add a docstring taht explains this is designed to be a similar API to difflib.unified_diff?