Files
@ ffd45b185016
Branch filter:
Location: kallithea/rhodecode/tests/models/test_diff_parsers.py - annotation
ffd45b185016
9.9 KiB
text/x-python
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
This imports changes between changesets 21af6c4eab3d and 6177597791c2 in
RhodeCode's original repository, including only changes to Python files and HTML.
RhodeCode clearly licensed its changes to these files under GPLv3
in their /LICENSE file, which states the following:
The Python code and integrated HTML are licensed under the GPLv3 license.
(See:
https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE
or
http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE
for an online copy of that LICENSE file)
Conservancy reviewed these changes and confirmed that they can be licensed as
a whole to the Kallithea project under GPLv3-only.
While some of the contents committed herein are clearly licensed
GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the
statement above from RhodeCode indicates that they intend GPLv3-only as their
license, per GPLv3§14 and other relevant sections of GPLv3.
This imports changes between changesets 21af6c4eab3d and 6177597791c2 in
RhodeCode's original repository, including only changes to Python files and HTML.
RhodeCode clearly licensed its changes to these files under GPLv3
in their /LICENSE file, which states the following:
The Python code and integrated HTML are licensed under the GPLv3 license.
(See:
https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE
or
http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE
for an online copy of that LICENSE file)
Conservancy reviewed these changes and confirmed that they can be licensed as
a whole to the Kallithea project under GPLv3-only.
While some of the contents committed herein are clearly licensed
GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the
statement above from RhodeCode indicates that they intend GPLv3-only as their
license, per GPLv3§14 and other relevant sections of GPLv3.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | fb1709520112 32471bd1f4ee 32471bd1f4ee 156cb1cdd7ad ffd45b185016 32471bd1f4ee ffd45b185016 ffd45b185016 32471bd1f4ee 32471bd1f4ee 32471bd1f4ee ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 32471bd1f4ee 32471bd1f4ee ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 7e9776f38c55 7e9776f38c55 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 7e9776f38c55 32471bd1f4ee 32471bd1f4ee ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 32471bd1f4ee 32471bd1f4ee ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 32471bd1f4ee 32471bd1f4ee ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 32471bd1f4ee 32471bd1f4ee ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 32471bd1f4ee 32471bd1f4ee ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 32471bd1f4ee 32471bd1f4ee ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 32471bd1f4ee 0ed42ca7ff9e ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 0ed42ca7ff9e 156cb1cdd7ad 156cb1cdd7ad 156cb1cdd7ad 156cb1cdd7ad 156cb1cdd7ad 156cb1cdd7ad 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 3e8f48ccca86 156cb1cdd7ad ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 32471bd1f4ee 32471bd1f4ee 32471bd1f4ee 32471bd1f4ee 5067d6e826a5 ce4b7023a492 ce4b7023a492 ce4b7023a492 32471bd1f4ee ffd45b185016 32471bd1f4ee ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 ce4b7023a492 | from __future__ import with_statement
from rhodecode.tests import *
from rhodecode.lib.diffs import DiffProcessor, NEW_FILENODE, DEL_FILENODE, \
MOD_FILENODE, RENAMED_FILENODE, CHMOD_FILENODE, BIN_FILENODE, COPIED_FILENODE
from rhodecode.tests.fixture import Fixture
fixture = Fixture()
DIFF_FIXTURES = {
'hg_diff_add_single_binary_file.diff': [
('US Warszawa.jpg', 'A',
{'added': 0,
'deleted': 0,
'binary': True,
'ops': {NEW_FILENODE: 'new file 100755',
BIN_FILENODE: 'binary diff not shown'}}),
],
'hg_diff_mod_single_binary_file.diff': [
('US Warszawa.jpg', 'M',
{'added': 0,
'deleted': 0,
'binary': True,
'ops': {MOD_FILENODE: 'modified file',
BIN_FILENODE: 'binary diff not shown'}}),
],
'hg_diff_mod_single_file_and_rename_and_chmod.diff': [
('README', 'M',
{'added': 3,
'deleted': 0,
'binary': False,
'ops': {MOD_FILENODE: 'modified file',
RENAMED_FILENODE: 'file renamed from README.rst to README',
CHMOD_FILENODE: 'modified file chmod 100755 => 100644'}}),
],
'hg_diff_mod_file_and_rename.diff': [
('README.rst', 'M',
{'added': 3,
'deleted': 0,
'binary': False,
'ops': {MOD_FILENODE: 'modified file',
RENAMED_FILENODE: 'file renamed from README to README.rst'}}),
],
'hg_diff_del_single_binary_file.diff': [
('US Warszawa.jpg', 'D',
{'added': 0,
'deleted': 0,
'binary': True,
'ops': {DEL_FILENODE: 'deleted file',
BIN_FILENODE: 'binary diff not shown'}}),
],
'hg_diff_chmod_and_mod_single_binary_file.diff': [
('gravatar.png', 'M',
{'added': 0,
'deleted': 0,
'binary': True,
'ops': {CHMOD_FILENODE: 'modified file chmod 100644 => 100755',
BIN_FILENODE: 'binary diff not shown'}}),
],
'hg_diff_chmod.diff': [
('file', 'M',
{'added': 0,
'deleted': 0,
'binary': True,
'ops': {CHMOD_FILENODE: 'modified file chmod 100755 => 100644'}}),
],
'hg_diff_rename_file.diff': [
('file_renamed', 'M',
{'added': 0,
'deleted': 0,
'binary': True,
'ops': {RENAMED_FILENODE: 'file renamed from file to file_renamed'}}),
],
'hg_diff_rename_and_chmod_file.diff': [
('README', 'M',
{'added': 0,
'deleted': 0,
'binary': True,
'ops': {CHMOD_FILENODE: 'modified file chmod 100644 => 100755',
RENAMED_FILENODE: 'file renamed from README.rst to README'}}),
],
'hg_diff_binary_and_normal.diff': [
('img/baseline-10px.png', 'A',
{'added': 0,
'deleted': 0,
'binary': True,
'ops': {NEW_FILENODE: 'new file 100644',
BIN_FILENODE: 'binary diff not shown'}}),
('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,
'binary': False,
'ops': {MOD_FILENODE: 'modified file'}}),
('less/scaffolding.less', 'M',
{'added': 1,
'deleted': 3,
'binary': False,
'ops': {MOD_FILENODE: 'modified file'}}),
('readme.markdown', 'M',
{'added': 1,
'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',
{'added': 0,
'deleted': 0,
'binary': True,
'ops': {CHMOD_FILENODE: 'modified file chmod 100644 => 100755'}})
],
'git_diff_rename_file.diff': [
('file.xls', 'M',
{'added': 0,
'deleted': 0,
'binary': True,
'ops': {RENAMED_FILENODE: 'file renamed from work-horus.xls to file.xls'}})
],
'git_diff_mod_single_binary_file.diff': [
('US Warszawa.jpg', 'M',
{'added': 0,
'deleted': 0,
'binary': True,
'ops': {MOD_FILENODE: 'modified file',
BIN_FILENODE: 'binary diff not shown'}})
],
'git_diff_binary_and_normal.diff': [
('img/baseline-10px.png', 'A',
{'added': 0,
'deleted': 0,
'binary': True,
'ops': {NEW_FILENODE: 'new file 100644',
BIN_FILENODE: 'binary diff not shown'}}),
('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,
'binary': False,
'ops': {MOD_FILENODE: 'modified file'}}),
('less/scaffolding.less', 'M',
{'added': 1,
'deleted': 3,
'binary': False,
'ops': {MOD_FILENODE: 'modified file'}}),
('readme.markdown', 'M',
{'added': 1,
'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',
{'added': 18,
'deleted': 2,
'binary': False,
'ops': {MOD_FILENODE: 'modified file'}}),
('vcs/backends/git/repository.py', 'M',
{'added': 46,
'deleted': 15,
'binary': False,
'ops': {MOD_FILENODE: 'modified file'}}),
('vcs/backends/hg.py', 'M',
{'added': 22,
'deleted': 3,
'binary': False,
'ops': {MOD_FILENODE: 'modified file'}}),
('vcs/tests/test_git.py', 'M',
{'added': 5,
'deleted': 5,
'binary': False,
'ops': {MOD_FILENODE: 'modified file'}}),
('vcs/tests/test_repository.py', 'M',
{'added': 174,
'deleted': 2,
'binary': False,
'ops': {MOD_FILENODE: 'modified file'}}),
],
'hg_diff_copy_file.diff': [
('file2', 'M',
{'added': 0,
'deleted': 0,
'binary': True,
'ops': {COPIED_FILENODE: 'file copied from file1 to file2'}}),
],
'hg_diff_copy_and_modify_file.diff': [
('file3', 'M',
{'added': 1,
'deleted': 0,
'binary': False,
'ops': {COPIED_FILENODE: 'file copied from file2 to file3',
MOD_FILENODE: 'modified file'}}),
],
'hg_diff_copy_and_chmod_file.diff': [
('file4', 'M',
{'added': 0,
'deleted': 0,
'binary': True,
'ops': {COPIED_FILENODE: 'file copied from file3 to file4',
CHMOD_FILENODE: 'modified file chmod 100644 => 100755'}}),
],
'hg_diff_copy_chmod_and_edit_file.diff': [
('file5', 'M',
{'added': 2,
'deleted': 1,
'binary': False,
'ops': {COPIED_FILENODE: 'file copied from file4 to file5',
CHMOD_FILENODE: 'modified file chmod 100755 => 100644',
MOD_FILENODE: 'modified file'}}),
]
# 'large_diff.diff': [
# ('.hgignore', 'A', {'deleted': 0, 'binary': False, 'added': 3, 'ops': {1: 'new file 100644'}}),
# ('MANIFEST.in', 'A', {'deleted': 0, 'binary': False, 'added': 3, 'ops': {1: 'new file 100644'}}),
# ('README.txt', 'A', {'deleted': 0, 'binary': False, 'added': 19, 'ops': {1: 'new file 100644'}}),
# ('development.ini', 'A', {'deleted': 0, 'binary': False, 'added': 116, 'ops': {1: 'new file 100644'}}),
# ('docs/index.txt', 'A', {'deleted': 0, 'binary': False, 'added': 19, 'ops': {1: 'new file 100644'}}),
# ('ez_setup.py', 'A', {'deleted': 0, 'binary': False, 'added': 276, 'ops': {1: 'new file 100644'}}),
# ('hgapp.py', 'A', {'deleted': 0, 'binary': False, 'added': 26, 'ops': {1: 'new file 100644'}}),
# ('hgwebdir.config', 'A', {'deleted': 0, 'binary': False, 'added': 21, 'ops': {1: 'new file 100644'}}),
# ('pylons_app.egg-info/PKG-INFO', 'A', {'deleted': 0, 'binary': False, 'added': 10, 'ops': {1: 'new file 100644'}}),
# ('pylons_app.egg-info/SOURCES.txt', 'A', {'deleted': 0, 'binary': False, 'added': 33, 'ops': {1: 'new file 100644'}}),
# ('pylons_app.egg-info/dependency_links.txt', 'A', {'deleted': 0, 'binary': False, 'added': 1, 'ops': {1: 'new file 100644'}}),
# #TODO:
# ],
}
class DiffLibTest(BaseTestCase):
@parameterized.expand([(x,) for x in DIFF_FIXTURES])
def test_diff(self, diff_fixture):
diff = fixture.load_resource(diff_fixture)
diff_proc = DiffProcessor(diff)
diff_proc_d = diff_proc.prepare()
data = [(x['filename'], x['operation'], x['stats']) for x in diff_proc_d]
expected_data = DIFF_FIXTURES[diff_fixture]
self.assertListEqual(expected_data, data)
|