annotate kallithea/tests/models/test_diff_parsers.py @ 6913:24a9bec8138c

diffs: inline prepare() into __init__ and make the result available as .parsed Make it more clear what the DiffProcessor is: Something that works on a raw diff as input, mainly compute when initialized, and returns an object where the result is available in different ways.
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 03 Oct 2017 00:14:40 +0200
parents 8d98924c58b1
children ceaa65df5add
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6217
8d98924c58b1 tests: add as little code as possible in __init__.py
Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
parents: 6131
diff changeset
1 from kallithea.tests.base import *
4186
7e5f8c12a3fc First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4116
diff changeset
2 from kallithea.lib.diffs import DiffProcessor, NEW_FILENODE, DEL_FILENODE, \
3997
156cb1cdd7ad Added handling of copied files diff parsing
Marcin Kuzminski <marcin@python-works.com>
parents: 3893
diff changeset
3 MOD_FILENODE, RENAMED_FILENODE, CHMOD_FILENODE, BIN_FILENODE, COPIED_FILENODE
4186
7e5f8c12a3fc First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4116
diff changeset
4 from kallithea.tests.fixture import Fixture
2995
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
5
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4007
diff changeset
6 fixture = Fixture()
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4007
diff changeset
7
2995
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
8
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9 DIFF_FIXTURES = {
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
10 'hg_diff_add_single_binary_file.diff': [
3821
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
11 ('US Warszawa.jpg', 'A',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
12 {'added': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
13 'deleted': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
14 'binary': True,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
15 'ops': {NEW_FILENODE: 'new file 100755',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
16 BIN_FILENODE: 'binary diff not shown'}}),
2995
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
17 ],
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
18 'hg_diff_mod_single_binary_file.diff': [
3821
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
19 ('US Warszawa.jpg', 'M',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
20 {'added': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
21 'deleted': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
22 'binary': True,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
23 'ops': {MOD_FILENODE: 'modified file',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
24 BIN_FILENODE: 'binary diff not shown'}}),
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
25 ],
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
26
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
27 'hg_diff_mod_single_file_and_rename_and_chmod.diff': [
4634
fbf75412c609 diff: add op for renamed file
Sean Farley <sean.michael.farley@gmail.com>
parents: 4507
diff changeset
28 ('README', 'R',
3821
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
29 {'added': 3,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
30 'deleted': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
31 'binary': False,
4634
fbf75412c609 diff: add op for renamed file
Sean Farley <sean.michael.farley@gmail.com>
parents: 4507
diff changeset
32 'ops': {RENAMED_FILENODE: 'file renamed from README.rst to README',
3821
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
33 CHMOD_FILENODE: 'modified file chmod 100755 => 100644'}}),
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
34 ],
3893
7e9776f38c55 fixed duplicated test in diff tests
Marcin Kuzminski <marcin@python-works.com>
parents: 3829
diff changeset
35 'hg_diff_mod_file_and_rename.diff': [
4634
fbf75412c609 diff: add op for renamed file
Sean Farley <sean.michael.farley@gmail.com>
parents: 4507
diff changeset
36 ('README.rst', 'R',
3821
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
37 {'added': 3,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
38 'deleted': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
39 'binary': False,
4634
fbf75412c609 diff: add op for renamed file
Sean Farley <sean.michael.farley@gmail.com>
parents: 4507
diff changeset
40 'ops': {RENAMED_FILENODE: 'file renamed from README to README.rst'}}),
2995
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
41 ],
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
42 'hg_diff_del_single_binary_file.diff': [
3821
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
43 ('US Warszawa.jpg', 'D',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
44 {'added': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
45 'deleted': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
46 'binary': True,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
47 'ops': {DEL_FILENODE: 'deleted file',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
48 BIN_FILENODE: 'binary diff not shown'}}),
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
49 ],
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
50 'hg_diff_chmod_and_mod_single_binary_file.diff': [
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
51 ('gravatar.png', 'M',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
52 {'added': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
53 'deleted': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
54 'binary': True,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
55 'ops': {CHMOD_FILENODE: 'modified file chmod 100644 => 100755',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
56 BIN_FILENODE: 'binary diff not shown'}}),
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
57 ],
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
58 'hg_diff_chmod.diff': [
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
59 ('file', 'M',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
60 {'added': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
61 'deleted': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
62 'binary': True,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
63 'ops': {CHMOD_FILENODE: 'modified file chmod 100755 => 100644'}}),
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
64 ],
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
65 'hg_diff_rename_file.diff': [
4634
fbf75412c609 diff: add op for renamed file
Sean Farley <sean.michael.farley@gmail.com>
parents: 4507
diff changeset
66 ('file_renamed', 'R',
3821
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
67 {'added': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
68 'deleted': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
69 'binary': True,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
70 'ops': {RENAMED_FILENODE: 'file renamed from file to file_renamed'}}),
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
71 ],
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
72 'hg_diff_rename_and_chmod_file.diff': [
4634
fbf75412c609 diff: add op for renamed file
Sean Farley <sean.michael.farley@gmail.com>
parents: 4507
diff changeset
73 ('README', 'R',
3821
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
74 {'added': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
75 'deleted': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
76 'binary': True,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
77 'ops': {CHMOD_FILENODE: 'modified file chmod 100644 => 100755',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
78 RENAMED_FILENODE: 'file renamed from README.rst to README'}}),
2995
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
79 ],
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
80 'hg_diff_binary_and_normal.diff': [
3821
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
81 ('img/baseline-10px.png', 'A',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
82 {'added': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
83 'deleted': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
84 'binary': True,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
85 'ops': {NEW_FILENODE: 'new file 100644',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
86 BIN_FILENODE: 'binary diff not shown'}}),
4507
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
87 ('img/baseline-20px.png', 'D',
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
88 {'added': 0,
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
89 'deleted': 0,
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
90 'binary': True,
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
91 'ops': {DEL_FILENODE: 'deleted file',
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
92 BIN_FILENODE: 'binary diff not shown'}}),
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
93 ('index.html', 'M',
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
94 {'added': 3,
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
95 'deleted': 2,
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
96 'binary': False,
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
97 'ops': {MOD_FILENODE: 'modified file'}}),
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
98 ('js/global.js', 'D',
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
99 {'added': 0,
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
100 'deleted': 75,
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
101 'binary': False,
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
102 'ops': {DEL_FILENODE: 'deleted file'}}),
3821
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
103 ('js/jquery/hashgrid.js', 'A',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
104 {'added': 340,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
105 'deleted': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
106 'binary': False,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
107 'ops': {NEW_FILENODE: 'new file 100755'}}),
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
108 ('less/docs.less', 'M',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
109 {'added': 34,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
110 'deleted': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
111 'binary': False,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
112 'ops': {MOD_FILENODE: 'modified file'}}),
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
113 ('less/scaffolding.less', 'M',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
114 {'added': 1,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
115 'deleted': 3,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
116 'binary': False,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
117 'ops': {MOD_FILENODE: 'modified file'}}),
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
118 ('readme.markdown', 'M',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
119 {'added': 1,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
120 'deleted': 10,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
121 'binary': False,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
122 'ops': {MOD_FILENODE: 'modified file'}}),
2995
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
123 ],
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
124 'git_diff_chmod.diff': [
3821
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
125 ('work-horus.xls', 'M',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
126 {'added': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
127 'deleted': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
128 'binary': True,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
129 'ops': {CHMOD_FILENODE: 'modified file chmod 100644 => 100755'}})
2995
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
130 ],
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
131 'git_diff_rename_file.diff': [
4634
fbf75412c609 diff: add op for renamed file
Sean Farley <sean.michael.farley@gmail.com>
parents: 4507
diff changeset
132 ('file.xls', 'R',
3821
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
133 {'added': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
134 'deleted': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
135 'binary': True,
5606
2bf5e8731154 git: fix parsing of git mode change + rename diffs
Mads Kiilerich <madski@unity3d.com>
parents: 5474
diff changeset
136 'ops': {RENAMED_FILENODE: 'file renamed from work-horus.xls to file.xls'}}),
2bf5e8731154 git: fix parsing of git mode change + rename diffs
Mads Kiilerich <madski@unity3d.com>
parents: 5474
diff changeset
137 ('files/var/www/favicon.ico/DEFAULT',
2bf5e8731154 git: fix parsing of git mode change + rename diffs
Mads Kiilerich <madski@unity3d.com>
parents: 5474
diff changeset
138 'R',
2bf5e8731154 git: fix parsing of git mode change + rename diffs
Mads Kiilerich <madski@unity3d.com>
parents: 5474
diff changeset
139 {'added': 0,
2bf5e8731154 git: fix parsing of git mode change + rename diffs
Mads Kiilerich <madski@unity3d.com>
parents: 5474
diff changeset
140 'binary': True,
2bf5e8731154 git: fix parsing of git mode change + rename diffs
Mads Kiilerich <madski@unity3d.com>
parents: 5474
diff changeset
141 'deleted': 0,
2bf5e8731154 git: fix parsing of git mode change + rename diffs
Mads Kiilerich <madski@unity3d.com>
parents: 5474
diff changeset
142 'ops': {4: 'file renamed from files/var/www/favicon.ico to files/var/www/favicon.ico/DEFAULT',
2bf5e8731154 git: fix parsing of git mode change + rename diffs
Mads Kiilerich <madski@unity3d.com>
parents: 5474
diff changeset
143 6: 'modified file chmod 100644 => 100755'}})
2995
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
144 ],
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
145 'git_diff_mod_single_binary_file.diff': [
3821
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
146 ('US Warszawa.jpg', 'M',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
147 {'added': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
148 'deleted': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
149 'binary': True,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
150 'ops': {MOD_FILENODE: 'modified file',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
151 BIN_FILENODE: 'binary diff not shown'}})
2995
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
152 ],
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
153 'git_diff_binary_and_normal.diff': [
3821
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
154 ('img/baseline-10px.png', 'A',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
155 {'added': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
156 'deleted': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
157 'binary': True,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
158 'ops': {NEW_FILENODE: 'new file 100644',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
159 BIN_FILENODE: 'binary diff not shown'}}),
4507
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
160 ('img/baseline-20px.png', 'D',
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
161 {'added': 0,
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
162 'deleted': 0,
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
163 'binary': True,
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
164 'ops': {DEL_FILENODE: 'deleted file',
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
165 BIN_FILENODE: 'binary diff not shown'}}),
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
166 ('index.html', 'M',
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
167 {'added': 3,
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
168 'deleted': 2,
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
169 'binary': False,
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
170 'ops': {MOD_FILENODE: 'modified file'}}),
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
171 ('js/global.js', 'D',
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
172 {'added': 0,
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
173 'deleted': 75,
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
174 'binary': False,
cd9bb3e07e68 diff: don't group diffs based on the kind of change
Mads Kiilerich <madski@unity3d.com>
parents: 4505
diff changeset
175 'ops': {DEL_FILENODE: 'deleted file'}}),
3821
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
176 ('js/jquery/hashgrid.js', 'A',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
177 {'added': 340,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
178 'deleted': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
179 'binary': False,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
180 'ops': {NEW_FILENODE: 'new file 100755'}}),
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
181 ('less/docs.less', 'M',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
182 {'added': 34,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
183 'deleted': 0,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
184 'binary': False,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
185 'ops': {MOD_FILENODE: 'modified file'}}),
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
186 ('less/scaffolding.less', 'M',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
187 {'added': 1,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
188 'deleted': 3,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
189 'binary': False,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
190 'ops': {MOD_FILENODE: 'modified file'}}),
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
191 ('readme.markdown', 'M',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
192 {'added': 1,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
193 'deleted': 10,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
194 'binary': False,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
195 'ops': {MOD_FILENODE: 'modified file'}}),
2995
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
196 ],
3022
0ed42ca7ff9e Fixed issue with inproper handling of diff parsing that could lead to infinit loops.
Marcin Kuzminski <marcin@python-works.com>
parents: 2995
diff changeset
197 'diff_with_diff_data.diff': [
3821
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
198 ('vcs/backends/base.py', 'M',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
199 {'added': 18,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
200 'deleted': 2,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
201 'binary': False,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
202 'ops': {MOD_FILENODE: 'modified file'}}),
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
203 ('vcs/backends/git/repository.py', 'M',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
204 {'added': 46,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
205 'deleted': 15,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
206 'binary': False,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
207 'ops': {MOD_FILENODE: 'modified file'}}),
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
208 ('vcs/backends/hg.py', 'M',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
209 {'added': 22,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
210 'deleted': 3,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
211 'binary': False,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
212 'ops': {MOD_FILENODE: 'modified file'}}),
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
213 ('vcs/tests/test_git.py', 'M',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
214 {'added': 5,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
215 'deleted': 5,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
216 'binary': False,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
217 'ops': {MOD_FILENODE: 'modified file'}}),
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
218 ('vcs/tests/test_repository.py', 'M',
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
219 {'added': 174,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
220 'deleted': 2,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
221 'binary': False,
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
222 'ops': {MOD_FILENODE: 'modified file'}}),
3022
0ed42ca7ff9e Fixed issue with inproper handling of diff parsing that could lead to infinit loops.
Marcin Kuzminski <marcin@python-works.com>
parents: 2995
diff changeset
223 ],
4823
2d2856fd1144 diff: handle GIT delta binary patches
duanhongyi <duanhongyi@doopai.com>
parents: 4696
diff changeset
224 'git_diff_modify_binary_file.diff': [
2d2856fd1144 diff: handle GIT delta binary patches
duanhongyi <duanhongyi@doopai.com>
parents: 4696
diff changeset
225 ('file.name', 'M',
2d2856fd1144 diff: handle GIT delta binary patches
duanhongyi <duanhongyi@doopai.com>
parents: 4696
diff changeset
226 {'added': 0,
2d2856fd1144 diff: handle GIT delta binary patches
duanhongyi <duanhongyi@doopai.com>
parents: 4696
diff changeset
227 'deleted': 0,
2d2856fd1144 diff: handle GIT delta binary patches
duanhongyi <duanhongyi@doopai.com>
parents: 4696
diff changeset
228 'binary': True,
2d2856fd1144 diff: handle GIT delta binary patches
duanhongyi <duanhongyi@doopai.com>
parents: 4696
diff changeset
229 'ops': {MOD_FILENODE: 'modified file',
2d2856fd1144 diff: handle GIT delta binary patches
duanhongyi <duanhongyi@doopai.com>
parents: 4696
diff changeset
230 BIN_FILENODE: 'binary diff not shown'}})
2d2856fd1144 diff: handle GIT delta binary patches
duanhongyi <duanhongyi@doopai.com>
parents: 4696
diff changeset
231 ],
3997
156cb1cdd7ad Added handling of copied files diff parsing
Marcin Kuzminski <marcin@python-works.com>
parents: 3893
diff changeset
232 'hg_diff_copy_file.diff': [
156cb1cdd7ad Added handling of copied files diff parsing
Marcin Kuzminski <marcin@python-works.com>
parents: 3893
diff changeset
233 ('file2', 'M',
156cb1cdd7ad Added handling of copied files diff parsing
Marcin Kuzminski <marcin@python-works.com>
parents: 3893
diff changeset
234 {'added': 0,
156cb1cdd7ad Added handling of copied files diff parsing
Marcin Kuzminski <marcin@python-works.com>
parents: 3893
diff changeset
235 'deleted': 0,
156cb1cdd7ad Added handling of copied files diff parsing
Marcin Kuzminski <marcin@python-works.com>
parents: 3893
diff changeset
236 'binary': True,
156cb1cdd7ad Added handling of copied files diff parsing
Marcin Kuzminski <marcin@python-works.com>
parents: 3893
diff changeset
237 'ops': {COPIED_FILENODE: 'file copied from file1 to file2'}}),
4007
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
238 ],
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
239 'hg_diff_copy_and_modify_file.diff': [
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
240 ('file3', 'M',
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
241 {'added': 1,
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
242 'deleted': 0,
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
243 'binary': False,
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
244 'ops': {COPIED_FILENODE: 'file copied from file2 to file3',
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
245 MOD_FILENODE: 'modified file'}}),
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
246 ],
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
247 'hg_diff_copy_and_chmod_file.diff': [
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
248 ('file4', 'M',
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
249 {'added': 0,
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
250 'deleted': 0,
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
251 'binary': True,
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
252 'ops': {COPIED_FILENODE: 'file copied from file3 to file4',
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
253 CHMOD_FILENODE: 'modified file chmod 100644 => 100755'}}),
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
254 ],
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
255 'hg_diff_copy_chmod_and_edit_file.diff': [
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
256 ('file5', 'M',
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
257 {'added': 2,
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
258 'deleted': 1,
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
259 'binary': False,
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
260 'ops': {COPIED_FILENODE: 'file copied from file4 to file5',
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
261 CHMOD_FILENODE: 'modified file chmod 100755 => 100644',
3e8f48ccca86 Added some missing tests for copy+chmod, copy+chmod+modify
Marcin Kuzminski <marcin@python-works.com>
parents: 3997
diff changeset
262 MOD_FILENODE: 'modified file'}}),
4693
9740ec3be07a diff: test rename with tab after ---/+++ and bare CR in diff
Mads Kiilerich <madski@unity3d.com>
parents: 4692
diff changeset
263 ],
9740ec3be07a diff: test rename with tab after ---/+++ and bare CR in diff
Mads Kiilerich <madski@unity3d.com>
parents: 4692
diff changeset
264 'hg_diff_rename_space_cr.diff': [
4694
11d6d1cec667 diff: fix diff of renamed files with whitespace in their names
Mads Kiilerich <madski@unity3d.com>
parents: 4693
diff changeset
265 ('oh yes', 'R',
4696
fbb992c719aa diff: don't split lines on bare CR as python splitlines do
Mads Kiilerich <madski@unity3d.com>
parents: 4694
diff changeset
266 {'added': 3,
4693
9740ec3be07a diff: test rename with tab after ---/+++ and bare CR in diff
Mads Kiilerich <madski@unity3d.com>
parents: 4692
diff changeset
267 'deleted': 2,
9740ec3be07a diff: test rename with tab after ---/+++ and bare CR in diff
Mads Kiilerich <madski@unity3d.com>
parents: 4692
diff changeset
268 'binary': False,
4694
11d6d1cec667 diff: fix diff of renamed files with whitespace in their names
Mads Kiilerich <madski@unity3d.com>
parents: 4693
diff changeset
269 'ops': {RENAMED_FILENODE: 'file renamed from oh no to oh yes'}}),
4693
9740ec3be07a diff: test rename with tab after ---/+++ and bare CR in diff
Mads Kiilerich <madski@unity3d.com>
parents: 4692
diff changeset
270 ],
2995
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
271 }
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
272
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
273
5922
7f2aa3ec2931 pytest migration: rename TestControllerPytest back to TestController
Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
parents: 5912
diff changeset
274 class TestDiffLib(TestController):
3821
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
275
5805
be1d20bfd2dd pytest migration: model: convert all tests to TestControllerPytest
Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
parents: 5610
diff changeset
276 @parametrize('diff_fixture', DIFF_FIXTURES)
3821
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
277 def test_diff(self, diff_fixture):
6913
24a9bec8138c diffs: inline prepare() into __init__ and make the result available as .parsed
Mads Kiilerich <mads@kiilerich.com>
parents: 6217
diff changeset
278 raw_diff = fixture.load_resource(diff_fixture, strip=False)
5610
eb072b2cfa18 tests: run git diff tests using the git diff parser
Mads Kiilerich <madski@unity3d.com>
parents: 5606
diff changeset
279 vcs = 'hg'
eb072b2cfa18 tests: run git diff tests using the git diff parser
Mads Kiilerich <madski@unity3d.com>
parents: 5606
diff changeset
280 if diff_fixture.startswith('git_'):
eb072b2cfa18 tests: run git diff tests using the git diff parser
Mads Kiilerich <madski@unity3d.com>
parents: 5606
diff changeset
281 vcs = 'git'
6913
24a9bec8138c diffs: inline prepare() into __init__ and make the result available as .parsed
Mads Kiilerich <mads@kiilerich.com>
parents: 6217
diff changeset
282 diff_processor = DiffProcessor(raw_diff, vcs=vcs)
24a9bec8138c diffs: inline prepare() into __init__ and make the result available as .parsed
Mads Kiilerich <mads@kiilerich.com>
parents: 6217
diff changeset
283 data = [(x['filename'], x['operation'], x['stats']) for x in diff_processor.parsed]
3821
ce4b7023a492 diff parser: redefined operations stats for changes
Marcin Kuzminski <marcin@python-works.com>
parents: 3035
diff changeset
284 expected_data = DIFF_FIXTURES[diff_fixture]
5912
7483b3f3bea5 pytest migration: models: switch to standard assert statements
Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
parents: 5805
diff changeset
285 assert expected_data == data
5176
c417ef1f43b1 diffs: avoid conflicts between inline diff mechanism and special markup
Mads Kiilerich <madski@unity3d.com>
parents: 4823
diff changeset
286
c417ef1f43b1 diffs: avoid conflicts between inline diff mechanism and special markup
Mads Kiilerich <madski@unity3d.com>
parents: 4823
diff changeset
287 def test_diff_markup(self):
6913
24a9bec8138c diffs: inline prepare() into __init__ and make the result available as .parsed
Mads Kiilerich <mads@kiilerich.com>
parents: 6217
diff changeset
288 raw_diff = fixture.load_resource('markuptest.diff', strip=False)
24a9bec8138c diffs: inline prepare() into __init__ and make the result available as .parsed
Mads Kiilerich <mads@kiilerich.com>
parents: 6217
diff changeset
289 diff_processor = DiffProcessor(raw_diff)
24a9bec8138c diffs: inline prepare() into __init__ and make the result available as .parsed
Mads Kiilerich <mads@kiilerich.com>
parents: 6217
diff changeset
290 chunks = diff_processor.parsed[0]['chunks']
5912
7483b3f3bea5 pytest migration: models: switch to standard assert statements
Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
parents: 5805
diff changeset
291 assert not chunks[0]
5176
c417ef1f43b1 diffs: avoid conflicts between inline diff mechanism and special markup
Mads Kiilerich <madski@unity3d.com>
parents: 4823
diff changeset
292 #from pprint import pprint; pprint(chunks[1])
c417ef1f43b1 diffs: avoid conflicts between inline diff mechanism and special markup
Mads Kiilerich <madski@unity3d.com>
parents: 4823
diff changeset
293 l = ['\n']
c417ef1f43b1 diffs: avoid conflicts between inline diff mechanism and special markup
Mads Kiilerich <madski@unity3d.com>
parents: 4823
diff changeset
294 for d in chunks[1]:
c417ef1f43b1 diffs: avoid conflicts between inline diff mechanism and special markup
Mads Kiilerich <madski@unity3d.com>
parents: 4823
diff changeset
295 l.append('%(action)-7s %(new_lineno)3s %(old_lineno)3s %(line)r\n' % d)
c417ef1f43b1 diffs: avoid conflicts between inline diff mechanism and special markup
Mads Kiilerich <madski@unity3d.com>
parents: 4823
diff changeset
296 s = ''.join(l)
c417ef1f43b1 diffs: avoid conflicts between inline diff mechanism and special markup
Mads Kiilerich <madski@unity3d.com>
parents: 4823
diff changeset
297 print s
5912
7483b3f3bea5 pytest migration: models: switch to standard assert statements
Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
parents: 5805
diff changeset
298 assert s == r'''
6131
6b723a49a9a1 diff: only highlight of difference between del and add line for one-liners
Mads Kiilerich <madski@unity3d.com>
parents: 5922
diff changeset
299 context ... ... u'@@ -51,6 +51,13 @@\n'
5176
c417ef1f43b1 diffs: avoid conflicts between inline diff mechanism and special markup
Mads Kiilerich <madski@unity3d.com>
parents: 4823
diff changeset
300 unmod 51 51 u'<u>\t</u>begin();\n'
c417ef1f43b1 diffs: avoid conflicts between inline diff mechanism and special markup
Mads Kiilerich <madski@unity3d.com>
parents: 4823
diff changeset
301 unmod 52 52 u'<u>\t</u>\n'
c417ef1f43b1 diffs: avoid conflicts between inline diff mechanism and special markup
Mads Kiilerich <madski@unity3d.com>
parents: 4823
diff changeset
302 add 53 u'<u>\t</u>int foo;<u class="cr"></u>\n'
c417ef1f43b1 diffs: avoid conflicts between inline diff mechanism and special markup
Mads Kiilerich <madski@unity3d.com>
parents: 4823
diff changeset
303 add 54 u'<u>\t</u>int bar; <u class="cr"></u>\n'
c417ef1f43b1 diffs: avoid conflicts between inline diff mechanism and special markup
Mads Kiilerich <madski@unity3d.com>
parents: 4823
diff changeset
304 add 55 u'<u>\t</u>int baz;<u>\t</u><u class="cr"></u>\n'
c417ef1f43b1 diffs: avoid conflicts between inline diff mechanism and special markup
Mads Kiilerich <madski@unity3d.com>
parents: 4823
diff changeset
305 add 56 u'<u>\t</u>int space; <i></i>'
c417ef1f43b1 diffs: avoid conflicts between inline diff mechanism and special markup
Mads Kiilerich <madski@unity3d.com>
parents: 4823
diff changeset
306 add 57 u'<u>\t</u>int tab;<u>\t</u>\n'
c417ef1f43b1 diffs: avoid conflicts between inline diff mechanism and special markup
Mads Kiilerich <madski@unity3d.com>
parents: 4823
diff changeset
307 add 58 u'<u>\t</u>\n'
c417ef1f43b1 diffs: avoid conflicts between inline diff mechanism and special markup
Mads Kiilerich <madski@unity3d.com>
parents: 4823
diff changeset
308 unmod 59 53 u' <i></i>'
6131
6b723a49a9a1 diff: only highlight of difference between del and add line for one-liners
Mads Kiilerich <madski@unity3d.com>
parents: 5922
diff changeset
309 del 54 u'<u>\t</u>#define MAX_STEPS (48)\n'
6b723a49a9a1 diff: only highlight of difference between del and add line for one-liners
Mads Kiilerich <madski@unity3d.com>
parents: 5922
diff changeset
310 add 60 u'<u>\t</u><u class="cr"></u>\n'
5176
c417ef1f43b1 diffs: avoid conflicts between inline diff mechanism and special markup
Mads Kiilerich <madski@unity3d.com>
parents: 4823
diff changeset
311 add 61 u'<u>\t</u>#define MAX_STEPS (64)<u class="cr"></u>\n'
c417ef1f43b1 diffs: avoid conflicts between inline diff mechanism and special markup
Mads Kiilerich <madski@unity3d.com>
parents: 4823
diff changeset
312 unmod 62 55 u'\n'
6131
6b723a49a9a1 diff: only highlight of difference between del and add line for one-liners
Mads Kiilerich <madski@unity3d.com>
parents: 5922
diff changeset
313 del 56 u'<u>\t</u>#define MIN_STEPS (<del>48</del>)\n'
6b723a49a9a1 diff: only highlight of difference between del and add line for one-liners
Mads Kiilerich <madski@unity3d.com>
parents: 5922
diff changeset
314 add 63 u'<u>\t</u>#define MIN_STEPS (<ins>42</ins>)\n'
5912
7483b3f3bea5 pytest migration: models: switch to standard assert statements
Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
parents: 5805
diff changeset
315 '''