diff --git a/kallithea/lib/diffs.py b/kallithea/lib/diffs.py --- a/kallithea/lib/diffs.py +++ b/kallithea/lib/diffs.py @@ -473,10 +473,8 @@ class DiffProcessor(object): 'stats': stats, }) - sorter = lambda info: {'A': 0, 'M': 1, 'D': 2}.get(info['operation']) - if not inline_diff: - return diff_container(sorted(_files, key=sorter)) + return diff_container(_files) # highlight inline changes for diff_data in _files: @@ -494,7 +492,7 @@ class DiffProcessor(object): except StopIteration: pass - return diff_container(sorted(_files, key=sorter)) + return diff_container(_files) def _parse_udiff(self, inline_diff=True): raise NotImplementedError() diff --git a/kallithea/tests/models/test_diff_parsers.py b/kallithea/tests/models/test_diff_parsers.py --- a/kallithea/tests/models/test_diff_parsers.py +++ b/kallithea/tests/models/test_diff_parsers.py @@ -87,16 +87,27 @@ DIFF_FIXTURES = { 'binary': True, 'ops': {NEW_FILENODE: 'new file 100644', BIN_FILENODE: 'binary diff not shown'}}), + ('img/baseline-20px.png', 'D', + {'added': 0, + 'deleted': 0, + 'binary': True, + 'ops': {DEL_FILENODE: 'deleted file', + BIN_FILENODE: 'binary diff not shown'}}), + ('index.html', 'M', + {'added': 3, + 'deleted': 2, + 'binary': False, + 'ops': {MOD_FILENODE: 'modified file'}}), + ('js/global.js', 'D', + {'added': 0, + 'deleted': 75, + 'binary': False, + 'ops': {DEL_FILENODE: 'deleted file'}}), ('js/jquery/hashgrid.js', 'A', {'added': 340, 'deleted': 0, 'binary': False, 'ops': {NEW_FILENODE: 'new file 100755'}}), - ('index.html', 'M', - {'added': 3, - 'deleted': 2, - 'binary': False, - 'ops': {MOD_FILENODE: 'modified file'}}), ('less/docs.less', 'M', {'added': 34, 'deleted': 0, @@ -112,17 +123,6 @@ DIFF_FIXTURES = { 'deleted': 10, 'binary': False, 'ops': {MOD_FILENODE: 'modified file'}}), - ('img/baseline-20px.png', 'D', - {'added': 0, - 'deleted': 0, - 'binary': True, - 'ops': {DEL_FILENODE: 'deleted file', - BIN_FILENODE: 'binary diff not shown'}}), - ('js/global.js', 'D', - {'added': 0, - 'deleted': 75, - 'binary': False, - 'ops': {DEL_FILENODE: 'deleted file'}}) ], 'git_diff_chmod.diff': [ ('work-horus.xls', 'M', @@ -153,16 +153,27 @@ DIFF_FIXTURES = { 'binary': True, 'ops': {NEW_FILENODE: 'new file 100644', BIN_FILENODE: 'binary diff not shown'}}), + ('img/baseline-20px.png', 'D', + {'added': 0, + 'deleted': 0, + 'binary': True, + 'ops': {DEL_FILENODE: 'deleted file', + BIN_FILENODE: 'binary diff not shown'}}), + ('index.html', 'M', + {'added': 3, + 'deleted': 2, + 'binary': False, + 'ops': {MOD_FILENODE: 'modified file'}}), + ('js/global.js', 'D', + {'added': 0, + 'deleted': 75, + 'binary': False, + 'ops': {DEL_FILENODE: 'deleted file'}}), ('js/jquery/hashgrid.js', 'A', {'added': 340, 'deleted': 0, 'binary': False, 'ops': {NEW_FILENODE: 'new file 100755'}}), - ('index.html', 'M', - {'added': 3, - 'deleted': 2, - 'binary': False, - 'ops': {MOD_FILENODE: 'modified file'}}), ('less/docs.less', 'M', {'added': 34, 'deleted': 0, @@ -178,17 +189,6 @@ DIFF_FIXTURES = { 'deleted': 10, 'binary': False, 'ops': {MOD_FILENODE: 'modified file'}}), - ('img/baseline-20px.png', 'D', - {'added': 0, - 'deleted': 0, - 'binary': True, - 'ops': {DEL_FILENODE: 'deleted file', - BIN_FILENODE: 'binary diff not shown'}}), - ('js/global.js', 'D', - {'added': 0, - 'deleted': 75, - 'binary': False, - 'ops': {DEL_FILENODE: 'deleted file'}}), ], 'diff_with_diff_data.diff': [ ('vcs/backends/base.py', 'M',