##// END OF EJS Templates
tests: fixes #4168 git commit ids in compare tests
lisaq -
r675:dd5f11fb default
parent child Browse files
Show More
@@ -1,691 +1,691 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2
2
3 # Copyright (C) 2010-2016 RhodeCode GmbH
3 # Copyright (C) 2010-2016 RhodeCode GmbH
4 #
4 #
5 # This program is free software: you can redistribute it and/or modify
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License, version 3
6 # it under the terms of the GNU Affero General Public License, version 3
7 # (only), as published by the Free Software Foundation.
7 # (only), as published by the Free Software Foundation.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU Affero General Public License
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
16 #
17 # This program is dual-licensed. If you wish to learn more about the
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21 import mock
21 import mock
22 import pytest
22 import pytest
23
23
24 from rhodecode.lib.vcs.backends.base import EmptyCommit
24 from rhodecode.lib.vcs.backends.base import EmptyCommit
25 from rhodecode.lib.vcs.exceptions import RepositoryRequirementError
25 from rhodecode.lib.vcs.exceptions import RepositoryRequirementError
26 from rhodecode.model.db import Repository
26 from rhodecode.model.db import Repository
27 from rhodecode.model.scm import ScmModel
27 from rhodecode.model.scm import ScmModel
28 from rhodecode.tests import url, TEST_USER_ADMIN_LOGIN, assert_session_flash
28 from rhodecode.tests import url, TEST_USER_ADMIN_LOGIN, assert_session_flash
29 from rhodecode.tests.utils import AssertResponse
29 from rhodecode.tests.utils import AssertResponse
30
30
31
31
32 @pytest.mark.usefixtures("autologin_user", "app")
32 @pytest.mark.usefixtures("autologin_user", "app")
33 class TestCompareController:
33 class TestCompareController:
34
34
35 @pytest.mark.xfail_backends("svn", reason="Requires pull")
35 @pytest.mark.xfail_backends("svn", reason="Requires pull")
36 def test_compare_remote_with_different_commit_indexes(self, backend):
36 def test_compare_remote_with_different_commit_indexes(self, backend):
37 # Preparing the following repository structure:
37 # Preparing the following repository structure:
38 #
38 #
39 # Origin repository has two commits:
39 # Origin repository has two commits:
40 #
40 #
41 # 0 1
41 # 0 1
42 # A -- D
42 # A -- D
43 #
43 #
44 # The fork of it has a few more commits and "D" has a commit index
44 # The fork of it has a few more commits and "D" has a commit index
45 # which does not exist in origin.
45 # which does not exist in origin.
46 #
46 #
47 # 0 1 2 3 4
47 # 0 1 2 3 4
48 # A -- -- -- D -- E
48 # A -- -- -- D -- E
49 # \- B -- C
49 # \- B -- C
50 #
50 #
51
51
52 fork = backend.create_repo()
52 fork = backend.create_repo()
53
53
54 # prepare fork
54 # prepare fork
55 commit0 = _commit_change(
55 commit0 = _commit_change(
56 fork.repo_name, filename='file1', content='A',
56 fork.repo_name, filename='file1', content='A',
57 message='A', vcs_type=backend.alias, parent=None, newfile=True)
57 message='A', vcs_type=backend.alias, parent=None, newfile=True)
58
58
59 commit1 = _commit_change(
59 commit1 = _commit_change(
60 fork.repo_name, filename='file1', content='B',
60 fork.repo_name, filename='file1', content='B',
61 message='B, child of A', vcs_type=backend.alias, parent=commit0)
61 message='B, child of A', vcs_type=backend.alias, parent=commit0)
62
62
63 _commit_change( # commit 2
63 _commit_change( # commit 2
64 fork.repo_name, filename='file1', content='C',
64 fork.repo_name, filename='file1', content='C',
65 message='C, child of B', vcs_type=backend.alias, parent=commit1)
65 message='C, child of B', vcs_type=backend.alias, parent=commit1)
66
66
67 commit3 = _commit_change(
67 commit3 = _commit_change(
68 fork.repo_name, filename='file1', content='D',
68 fork.repo_name, filename='file1', content='D',
69 message='D, child of A', vcs_type=backend.alias, parent=commit0)
69 message='D, child of A', vcs_type=backend.alias, parent=commit0)
70
70
71 commit4 = _commit_change(
71 commit4 = _commit_change(
72 fork.repo_name, filename='file1', content='E',
72 fork.repo_name, filename='file1', content='E',
73 message='E, child of D', vcs_type=backend.alias, parent=commit3)
73 message='E, child of D', vcs_type=backend.alias, parent=commit3)
74
74
75 # prepare origin repository, taking just the history up to D
75 # prepare origin repository, taking just the history up to D
76 origin = backend.create_repo()
76 origin = backend.create_repo()
77
77
78 origin_repo = origin.scm_instance(cache=False)
78 origin_repo = origin.scm_instance(cache=False)
79 origin_repo.config.clear_section('hooks')
79 origin_repo.config.clear_section('hooks')
80 origin_repo.pull(fork.repo_full_path, commit_ids=[commit3.raw_id])
80 origin_repo.pull(fork.repo_full_path, commit_ids=[commit3.raw_id])
81
81
82 # Verify test fixture setup
82 # Verify test fixture setup
83 # This does not work for git
83 # This does not work for git
84 if backend.alias != 'git':
84 if backend.alias != 'git':
85 assert 5 == len(fork.scm_instance().commit_ids)
85 assert 5 == len(fork.scm_instance().commit_ids)
86 assert 2 == len(origin_repo.commit_ids)
86 assert 2 == len(origin_repo.commit_ids)
87
87
88 # Comparing the revisions
88 # Comparing the revisions
89 response = self.app.get(
89 response = self.app.get(
90 url('compare_url',
90 url('compare_url',
91 repo_name=origin.repo_name,
91 repo_name=origin.repo_name,
92 source_ref_type="rev",
92 source_ref_type="rev",
93 source_ref=commit3.raw_id,
93 source_ref=commit3.raw_id,
94 target_repo=fork.repo_name,
94 target_repo=fork.repo_name,
95 target_ref_type="rev",
95 target_ref_type="rev",
96 target_ref=commit4.raw_id,
96 target_ref=commit4.raw_id,
97 merge='1',))
97 merge='1',))
98
98
99 compare_page = ComparePage(response)
99 compare_page = ComparePage(response)
100 compare_page.contains_commits([commit4])
100 compare_page.contains_commits([commit4])
101
101
102 @pytest.mark.xfail_backends("svn", reason="Depends on branch support")
102 @pytest.mark.xfail_backends("svn", reason="Depends on branch support")
103 def test_compare_forks_on_branch_extra_commits(self, backend):
103 def test_compare_forks_on_branch_extra_commits(self, backend):
104 repo1 = backend.create_repo()
104 repo1 = backend.create_repo()
105
105
106 # commit something !
106 # commit something !
107 commit0 = _commit_change(
107 commit0 = _commit_change(
108 repo1.repo_name, filename='file1', content='line1\n',
108 repo1.repo_name, filename='file1', content='line1\n',
109 message='commit1', vcs_type=backend.alias, parent=None,
109 message='commit1', vcs_type=backend.alias, parent=None,
110 newfile=True)
110 newfile=True)
111
111
112 # fork this repo
112 # fork this repo
113 repo2 = backend.create_fork()
113 repo2 = backend.create_fork()
114
114
115 # add two extra commit into fork
115 # add two extra commit into fork
116 commit1 = _commit_change(
116 commit1 = _commit_change(
117 repo2.repo_name, filename='file1', content='line1\nline2\n',
117 repo2.repo_name, filename='file1', content='line1\nline2\n',
118 message='commit2', vcs_type=backend.alias, parent=commit0)
118 message='commit2', vcs_type=backend.alias, parent=commit0)
119
119
120 commit2 = _commit_change(
120 commit2 = _commit_change(
121 repo2.repo_name, filename='file1', content='line1\nline2\nline3\n',
121 repo2.repo_name, filename='file1', content='line1\nline2\nline3\n',
122 message='commit3', vcs_type=backend.alias, parent=commit1)
122 message='commit3', vcs_type=backend.alias, parent=commit1)
123
123
124 commit_id1 = repo1.scm_instance().DEFAULT_BRANCH_NAME
124 commit_id1 = repo1.scm_instance().DEFAULT_BRANCH_NAME
125 commit_id2 = repo2.scm_instance().DEFAULT_BRANCH_NAME
125 commit_id2 = repo2.scm_instance().DEFAULT_BRANCH_NAME
126
126
127 response = self.app.get(
127 response = self.app.get(
128 url('compare_url',
128 url('compare_url',
129 repo_name=repo1.repo_name,
129 repo_name=repo1.repo_name,
130 source_ref_type="branch",
130 source_ref_type="branch",
131 source_ref=commit_id2,
131 source_ref=commit_id2,
132 target_repo=repo2.repo_name,
132 target_repo=repo2.repo_name,
133 target_ref_type="branch",
133 target_ref_type="branch",
134 target_ref=commit_id1,
134 target_ref=commit_id1,
135 merge='1',))
135 merge='1',))
136
136
137 response.mustcontain('%s@%s' % (repo1.repo_name, commit_id2))
137 response.mustcontain('%s@%s' % (repo1.repo_name, commit_id2))
138 response.mustcontain('%s@%s' % (repo2.repo_name, commit_id1))
138 response.mustcontain('%s@%s' % (repo2.repo_name, commit_id1))
139
139
140 compare_page = ComparePage(response)
140 compare_page = ComparePage(response)
141 compare_page.contains_change_summary(1, 2, 0)
141 compare_page.contains_change_summary(1, 2, 0)
142 compare_page.contains_commits([commit1, commit2])
142 compare_page.contains_commits([commit1, commit2])
143 compare_page.contains_file_links_and_anchors([
143 compare_page.contains_file_links_and_anchors([
144 ('file1', 'a_c--826e8142e6ba'),
144 ('file1', 'a_c--826e8142e6ba'),
145 ])
145 ])
146
146
147 # Swap is removed when comparing branches since it's a PR feature and
147 # Swap is removed when comparing branches since it's a PR feature and
148 # it is then a preview mode
148 # it is then a preview mode
149 compare_page.swap_is_hidden()
149 compare_page.swap_is_hidden()
150 compare_page.target_source_are_disabled()
150 compare_page.target_source_are_disabled()
151
151
152 @pytest.mark.xfail_backends("svn", reason="Depends on branch support")
152 @pytest.mark.xfail_backends("svn", reason="Depends on branch support")
153 def test_compare_forks_on_branch_extra_commits_origin_has_incomming(
153 def test_compare_forks_on_branch_extra_commits_origin_has_incomming(
154 self, backend):
154 self, backend):
155 repo1 = backend.create_repo()
155 repo1 = backend.create_repo()
156
156
157 # commit something !
157 # commit something !
158 commit0 = _commit_change(
158 commit0 = _commit_change(
159 repo1.repo_name, filename='file1', content='line1\n',
159 repo1.repo_name, filename='file1', content='line1\n',
160 message='commit1', vcs_type=backend.alias, parent=None,
160 message='commit1', vcs_type=backend.alias, parent=None,
161 newfile=True)
161 newfile=True)
162
162
163 # fork this repo
163 # fork this repo
164 repo2 = backend.create_fork()
164 repo2 = backend.create_fork()
165
165
166 # now commit something to origin repo
166 # now commit something to origin repo
167 _commit_change(
167 _commit_change(
168 repo1.repo_name, filename='file2', content='line1file2\n',
168 repo1.repo_name, filename='file2', content='line1file2\n',
169 message='commit2', vcs_type=backend.alias, parent=commit0,
169 message='commit2', vcs_type=backend.alias, parent=commit0,
170 newfile=True)
170 newfile=True)
171
171
172 # add two extra commit into fork
172 # add two extra commit into fork
173 commit1 = _commit_change(
173 commit1 = _commit_change(
174 repo2.repo_name, filename='file1', content='line1\nline2\n',
174 repo2.repo_name, filename='file1', content='line1\nline2\n',
175 message='commit2', vcs_type=backend.alias, parent=commit0)
175 message='commit2', vcs_type=backend.alias, parent=commit0)
176
176
177 commit2 = _commit_change(
177 commit2 = _commit_change(
178 repo2.repo_name, filename='file1', content='line1\nline2\nline3\n',
178 repo2.repo_name, filename='file1', content='line1\nline2\nline3\n',
179 message='commit3', vcs_type=backend.alias, parent=commit1)
179 message='commit3', vcs_type=backend.alias, parent=commit1)
180
180
181 commit_id1 = repo1.scm_instance().DEFAULT_BRANCH_NAME
181 commit_id1 = repo1.scm_instance().DEFAULT_BRANCH_NAME
182 commit_id2 = repo2.scm_instance().DEFAULT_BRANCH_NAME
182 commit_id2 = repo2.scm_instance().DEFAULT_BRANCH_NAME
183
183
184 response = self.app.get(
184 response = self.app.get(
185 url('compare_url',
185 url('compare_url',
186 repo_name=repo1.repo_name,
186 repo_name=repo1.repo_name,
187 source_ref_type="branch",
187 source_ref_type="branch",
188 source_ref=commit_id2,
188 source_ref=commit_id2,
189 target_repo=repo2.repo_name,
189 target_repo=repo2.repo_name,
190 target_ref_type="branch",
190 target_ref_type="branch",
191 target_ref=commit_id1,
191 target_ref=commit_id1,
192 merge='1'))
192 merge='1'))
193
193
194 response.mustcontain('%s@%s' % (repo1.repo_name, commit_id2))
194 response.mustcontain('%s@%s' % (repo1.repo_name, commit_id2))
195 response.mustcontain('%s@%s' % (repo2.repo_name, commit_id1))
195 response.mustcontain('%s@%s' % (repo2.repo_name, commit_id1))
196
196
197 compare_page = ComparePage(response)
197 compare_page = ComparePage(response)
198 compare_page.contains_change_summary(1, 2, 0)
198 compare_page.contains_change_summary(1, 2, 0)
199 compare_page.contains_commits([commit1, commit2])
199 compare_page.contains_commits([commit1, commit2])
200 compare_page.contains_file_links_and_anchors([
200 compare_page.contains_file_links_and_anchors([
201 ('file1', 'a_c--826e8142e6ba'),
201 ('file1', 'a_c--826e8142e6ba'),
202 ])
202 ])
203
203
204 # Swap is removed when comparing branches since it's a PR feature and
204 # Swap is removed when comparing branches since it's a PR feature and
205 # it is then a preview mode
205 # it is then a preview mode
206 compare_page.swap_is_hidden()
206 compare_page.swap_is_hidden()
207 compare_page.target_source_are_disabled()
207 compare_page.target_source_are_disabled()
208
208
209 @pytest.mark.xfail_backends("svn", "git")
209 @pytest.mark.xfail_backends("svn", "git")
210 def test_compare_of_unrelated_forks(self, backend):
210 def test_compare_of_unrelated_forks(self, backend):
211 # TODO: johbo: Fails for git due to some other issue it seems
211 # TODO: johbo: Fails for git due to some other issue it seems
212 orig = backend.create_repo(number_of_commits=1)
212 orig = backend.create_repo(number_of_commits=1)
213 fork = backend.create_repo(number_of_commits=1)
213 fork = backend.create_repo(number_of_commits=1)
214
214
215 response = self.app.get(
215 response = self.app.get(
216 url('compare_url',
216 url('compare_url',
217 repo_name=orig.repo_name,
217 repo_name=orig.repo_name,
218 action="compare",
218 action="compare",
219 source_ref_type="rev",
219 source_ref_type="rev",
220 source_ref="tip",
220 source_ref="tip",
221 target_ref_type="rev",
221 target_ref_type="rev",
222 target_ref="tip",
222 target_ref="tip",
223 merge='1',
223 merge='1',
224 target_repo=fork.repo_name),
224 target_repo=fork.repo_name),
225 status=400)
225 status=400)
226
226
227 response.mustcontain("Repositories unrelated.")
227 response.mustcontain("Repositories unrelated.")
228
228
229 @pytest.mark.xfail_backends("svn", "git")
229 @pytest.mark.xfail_backends("svn")
230 def test_compare_cherry_pick_commits_from_bottom(self, backend):
230 def test_compare_cherry_pick_commits_from_bottom(self, backend):
231
231
232 # repo1:
232 # repo1:
233 # commit0:
233 # commit0:
234 # commit1:
234 # commit1:
235 # repo1-fork- in which we will cherry pick bottom commits
235 # repo1-fork- in which we will cherry pick bottom commits
236 # commit0:
236 # commit0:
237 # commit1:
237 # commit1:
238 # commit2: x
238 # commit2: x
239 # commit3: x
239 # commit3: x
240 # commit4: x
240 # commit4: x
241 # commit5:
241 # commit5:
242 # make repo1, and commit1+commit2
242 # make repo1, and commit1+commit2
243
243
244 repo1 = backend.create_repo()
244 repo1 = backend.create_repo()
245
245
246 # commit something !
246 # commit something !
247 commit0 = _commit_change(
247 commit0 = _commit_change(
248 repo1.repo_name, filename='file1', content='line1\n',
248 repo1.repo_name, filename='file1', content='line1\n',
249 message='commit1', vcs_type=backend.alias, parent=None,
249 message='commit1', vcs_type=backend.alias, parent=None,
250 newfile=True)
250 newfile=True)
251 commit1 = _commit_change(
251 commit1 = _commit_change(
252 repo1.repo_name, filename='file1', content='line1\nline2\n',
252 repo1.repo_name, filename='file1', content='line1\nline2\n',
253 message='commit2', vcs_type=backend.alias, parent=commit0)
253 message='commit2', vcs_type=backend.alias, parent=commit0)
254
254
255 # fork this repo
255 # fork this repo
256 repo2 = backend.create_fork()
256 repo2 = backend.create_fork()
257
257
258 # now make commit3-6
258 # now make commit3-6
259 commit2 = _commit_change(
259 commit2 = _commit_change(
260 repo1.repo_name, filename='file1', content='line1\nline2\nline3\n',
260 repo1.repo_name, filename='file1', content='line1\nline2\nline3\n',
261 message='commit3', vcs_type=backend.alias, parent=commit1)
261 message='commit3', vcs_type=backend.alias, parent=commit1)
262 commit3 = _commit_change(
262 commit3 = _commit_change(
263 repo1.repo_name, filename='file1',
263 repo1.repo_name, filename='file1',
264 content='line1\nline2\nline3\nline4\n', message='commit4',
264 content='line1\nline2\nline3\nline4\n', message='commit4',
265 vcs_type=backend.alias, parent=commit2)
265 vcs_type=backend.alias, parent=commit2)
266 commit4 = _commit_change(
266 commit4 = _commit_change(
267 repo1.repo_name, filename='file1',
267 repo1.repo_name, filename='file1',
268 content='line1\nline2\nline3\nline4\nline5\n', message='commit5',
268 content='line1\nline2\nline3\nline4\nline5\n', message='commit5',
269 vcs_type=backend.alias, parent=commit3)
269 vcs_type=backend.alias, parent=commit3)
270 _commit_change( # commit 5
270 _commit_change( # commit 5
271 repo1.repo_name, filename='file1',
271 repo1.repo_name, filename='file1',
272 content='line1\nline2\nline3\nline4\nline5\nline6\n',
272 content='line1\nline2\nline3\nline4\nline5\nline6\n',
273 message='commit6', vcs_type=backend.alias, parent=commit4)
273 message='commit6', vcs_type=backend.alias, parent=commit4)
274
274
275 response = self.app.get(
275 response = self.app.get(
276 url('compare_url',
276 url('compare_url',
277 repo_name=repo2.repo_name,
277 repo_name=repo2.repo_name,
278 source_ref_type="rev",
278 source_ref_type="rev",
279 # parent of commit2, in target repo2
279 # parent of commit2, in target repo2
280 source_ref=commit1.short_id,
280 source_ref=commit1.raw_id,
281 target_repo=repo1.repo_name,
281 target_repo=repo1.repo_name,
282 target_ref_type="rev",
282 target_ref_type="rev",
283 target_ref=commit4.short_id,
283 target_ref=commit4.raw_id,
284 merge='1',))
284 merge='1',))
285 response.mustcontain('%s@%s' % (repo2.repo_name, commit1.short_id))
285 response.mustcontain('%s@%s' % (repo2.repo_name, commit1.short_id))
286 response.mustcontain('%s@%s' % (repo1.repo_name, commit4.short_id))
286 response.mustcontain('%s@%s' % (repo1.repo_name, commit4.short_id))
287
287
288 # files
288 # files
289 compare_page = ComparePage(response)
289 compare_page = ComparePage(response)
290 compare_page.contains_change_summary(1, 3, 0)
290 compare_page.contains_change_summary(1, 3, 0)
291 compare_page.contains_commits([commit2, commit3, commit4])
291 compare_page.contains_commits([commit2, commit3, commit4])
292 compare_page.contains_file_links_and_anchors([
292 compare_page.contains_file_links_and_anchors([
293 ('file1', 'a_c--826e8142e6ba'),
293 ('file1', 'a_c--826e8142e6ba'),
294 ])
294 ])
295
295
296 @pytest.mark.xfail_backends("svn", "git")
296 @pytest.mark.xfail_backends("svn")
297 def test_compare_cherry_pick_commits_from_top(self, backend):
297 def test_compare_cherry_pick_commits_from_top(self, backend):
298 # repo1:
298 # repo1:
299 # commit0:
299 # commit0:
300 # commit1:
300 # commit1:
301 # repo1-fork- in which we will cherry pick bottom commits
301 # repo1-fork- in which we will cherry pick bottom commits
302 # commit0:
302 # commit0:
303 # commit1:
303 # commit1:
304 # commit2:
304 # commit2:
305 # commit3: x
305 # commit3: x
306 # commit4: x
306 # commit4: x
307 # commit5: x
307 # commit5: x
308
308
309 # make repo1, and commit1+commit2
309 # make repo1, and commit1+commit2
310 repo1 = backend.create_repo()
310 repo1 = backend.create_repo()
311
311
312 # commit something !
312 # commit something !
313 commit0 = _commit_change(
313 commit0 = _commit_change(
314 repo1.repo_name, filename='file1', content='line1\n',
314 repo1.repo_name, filename='file1', content='line1\n',
315 message='commit1', vcs_type=backend.alias, parent=None,
315 message='commit1', vcs_type=backend.alias, parent=None,
316 newfile=True)
316 newfile=True)
317 commit1 = _commit_change(
317 commit1 = _commit_change(
318 repo1.repo_name, filename='file1', content='line1\nline2\n',
318 repo1.repo_name, filename='file1', content='line1\nline2\n',
319 message='commit2', vcs_type=backend.alias, parent=commit0)
319 message='commit2', vcs_type=backend.alias, parent=commit0)
320
320
321 # fork this repo
321 # fork this repo
322 backend.create_fork()
322 backend.create_fork()
323
323
324 # now make commit3-6
324 # now make commit3-6
325 commit2 = _commit_change(
325 commit2 = _commit_change(
326 repo1.repo_name, filename='file1', content='line1\nline2\nline3\n',
326 repo1.repo_name, filename='file1', content='line1\nline2\nline3\n',
327 message='commit3', vcs_type=backend.alias, parent=commit1)
327 message='commit3', vcs_type=backend.alias, parent=commit1)
328 commit3 = _commit_change(
328 commit3 = _commit_change(
329 repo1.repo_name, filename='file1',
329 repo1.repo_name, filename='file1',
330 content='line1\nline2\nline3\nline4\n', message='commit4',
330 content='line1\nline2\nline3\nline4\n', message='commit4',
331 vcs_type=backend.alias, parent=commit2)
331 vcs_type=backend.alias, parent=commit2)
332 commit4 = _commit_change(
332 commit4 = _commit_change(
333 repo1.repo_name, filename='file1',
333 repo1.repo_name, filename='file1',
334 content='line1\nline2\nline3\nline4\nline5\n', message='commit5',
334 content='line1\nline2\nline3\nline4\nline5\n', message='commit5',
335 vcs_type=backend.alias, parent=commit3)
335 vcs_type=backend.alias, parent=commit3)
336 commit5 = _commit_change(
336 commit5 = _commit_change(
337 repo1.repo_name, filename='file1',
337 repo1.repo_name, filename='file1',
338 content='line1\nline2\nline3\nline4\nline5\nline6\n',
338 content='line1\nline2\nline3\nline4\nline5\nline6\n',
339 message='commit6', vcs_type=backend.alias, parent=commit4)
339 message='commit6', vcs_type=backend.alias, parent=commit4)
340
340
341 response = self.app.get(
341 response = self.app.get(
342 url('compare_url',
342 url('compare_url',
343 repo_name=repo1.repo_name,
343 repo_name=repo1.repo_name,
344 source_ref_type="rev",
344 source_ref_type="rev",
345 # parent of commit3, not in source repo2
345 # parent of commit3, not in source repo2
346 source_ref=commit2.short_id,
346 source_ref=commit2.raw_id,
347 target_ref_type="rev",
347 target_ref_type="rev",
348 target_ref=commit5.short_id,
348 target_ref=commit5.raw_id,
349 merge='1',))
349 merge='1',))
350
350
351 response.mustcontain('%s@%s' % (repo1.repo_name, commit2.short_id))
351 response.mustcontain('%s@%s' % (repo1.repo_name, commit2.short_id))
352 response.mustcontain('%s@%s' % (repo1.repo_name, commit5.short_id))
352 response.mustcontain('%s@%s' % (repo1.repo_name, commit5.short_id))
353
353
354 compare_page = ComparePage(response)
354 compare_page = ComparePage(response)
355 compare_page.contains_change_summary(1, 3, 0)
355 compare_page.contains_change_summary(1, 3, 0)
356 compare_page.contains_commits([commit3, commit4, commit5])
356 compare_page.contains_commits([commit3, commit4, commit5])
357
357
358 # files
358 # files
359 compare_page.contains_file_links_and_anchors([
359 compare_page.contains_file_links_and_anchors([
360 ('file1', 'a_c--826e8142e6ba'),
360 ('file1', 'a_c--826e8142e6ba'),
361 ])
361 ])
362
362
363 @pytest.mark.xfail_backends("svn")
363 @pytest.mark.xfail_backends("svn")
364 def test_compare_remote_branches(self, backend):
364 def test_compare_remote_branches(self, backend):
365 repo1 = backend.repo
365 repo1 = backend.repo
366 repo2 = backend.create_fork()
366 repo2 = backend.create_fork()
367
367
368 commit_id1 = repo1.get_commit(commit_idx=3).raw_id
368 commit_id1 = repo1.get_commit(commit_idx=3).raw_id
369 commit_id2 = repo1.get_commit(commit_idx=6).raw_id
369 commit_id2 = repo1.get_commit(commit_idx=6).raw_id
370
370
371 response = self.app.get(
371 response = self.app.get(
372 url('compare_url',
372 url('compare_url',
373 repo_name=repo1.repo_name,
373 repo_name=repo1.repo_name,
374 source_ref_type="rev",
374 source_ref_type="rev",
375 source_ref=commit_id1,
375 source_ref=commit_id1,
376 target_ref_type="rev",
376 target_ref_type="rev",
377 target_ref=commit_id2,
377 target_ref=commit_id2,
378 target_repo=repo2.repo_name,
378 target_repo=repo2.repo_name,
379 merge='1',))
379 merge='1',))
380
380
381 response.mustcontain('%s@%s' % (repo1.repo_name, commit_id1))
381 response.mustcontain('%s@%s' % (repo1.repo_name, commit_id1))
382 response.mustcontain('%s@%s' % (repo2.repo_name, commit_id2))
382 response.mustcontain('%s@%s' % (repo2.repo_name, commit_id2))
383
383
384 compare_page = ComparePage(response)
384 compare_page = ComparePage(response)
385
385
386 # outgoing commits between those commits
386 # outgoing commits between those commits
387 compare_page.contains_commits(
387 compare_page.contains_commits(
388 [repo2.get_commit(commit_idx=x) for x in [4, 5, 6]])
388 [repo2.get_commit(commit_idx=x) for x in [4, 5, 6]])
389
389
390 # files
390 # files
391 compare_page.contains_file_links_and_anchors([
391 compare_page.contains_file_links_and_anchors([
392 ('vcs/backends/hg.py', 'a_c--9c390eb52cd6'),
392 ('vcs/backends/hg.py', 'a_c--9c390eb52cd6'),
393 ('vcs/backends/__init__.py', 'a_c--41b41c1f2796'),
393 ('vcs/backends/__init__.py', 'a_c--41b41c1f2796'),
394 ('vcs/backends/base.py', 'a_c--2f574d260608'),
394 ('vcs/backends/base.py', 'a_c--2f574d260608'),
395 ])
395 ])
396
396
397 @pytest.mark.xfail_backends("svn")
397 @pytest.mark.xfail_backends("svn")
398 def test_source_repo_new_commits_after_forking_simple_diff(self, backend):
398 def test_source_repo_new_commits_after_forking_simple_diff(self, backend):
399 repo1 = backend.create_repo()
399 repo1 = backend.create_repo()
400 r1_name = repo1.repo_name
400 r1_name = repo1.repo_name
401
401
402 commit0 = _commit_change(
402 commit0 = _commit_change(
403 repo=r1_name, filename='file1',
403 repo=r1_name, filename='file1',
404 content='line1', message='commit1', vcs_type=backend.alias,
404 content='line1', message='commit1', vcs_type=backend.alias,
405 newfile=True)
405 newfile=True)
406 assert repo1.scm_instance().commit_ids == [commit0.raw_id]
406 assert repo1.scm_instance().commit_ids == [commit0.raw_id]
407
407
408 # fork the repo1
408 # fork the repo1
409 repo2 = backend.create_fork()
409 repo2 = backend.create_fork()
410 assert repo2.scm_instance().commit_ids == [commit0.raw_id]
410 assert repo2.scm_instance().commit_ids == [commit0.raw_id]
411
411
412 self.r2_id = repo2.repo_id
412 self.r2_id = repo2.repo_id
413 r2_name = repo2.repo_name
413 r2_name = repo2.repo_name
414
414
415 commit1 = _commit_change(
415 commit1 = _commit_change(
416 repo=r2_name, filename='file1-fork',
416 repo=r2_name, filename='file1-fork',
417 content='file1-line1-from-fork', message='commit1-fork',
417 content='file1-line1-from-fork', message='commit1-fork',
418 vcs_type=backend.alias, parent=repo2.scm_instance()[-1],
418 vcs_type=backend.alias, parent=repo2.scm_instance()[-1],
419 newfile=True)
419 newfile=True)
420
420
421 commit2 = _commit_change(
421 commit2 = _commit_change(
422 repo=r2_name, filename='file2-fork',
422 repo=r2_name, filename='file2-fork',
423 content='file2-line1-from-fork', message='commit2-fork',
423 content='file2-line1-from-fork', message='commit2-fork',
424 vcs_type=backend.alias, parent=commit1,
424 vcs_type=backend.alias, parent=commit1,
425 newfile=True)
425 newfile=True)
426
426
427 _commit_change( # commit 3
427 _commit_change( # commit 3
428 repo=r2_name, filename='file3-fork',
428 repo=r2_name, filename='file3-fork',
429 content='file3-line1-from-fork', message='commit3-fork',
429 content='file3-line1-from-fork', message='commit3-fork',
430 vcs_type=backend.alias, parent=commit2, newfile=True)
430 vcs_type=backend.alias, parent=commit2, newfile=True)
431
431
432 # compare !
432 # compare !
433 commit_id1 = repo1.scm_instance().DEFAULT_BRANCH_NAME
433 commit_id1 = repo1.scm_instance().DEFAULT_BRANCH_NAME
434 commit_id2 = repo2.scm_instance().DEFAULT_BRANCH_NAME
434 commit_id2 = repo2.scm_instance().DEFAULT_BRANCH_NAME
435
435
436 response = self.app.get(
436 response = self.app.get(
437 url('compare_url',
437 url('compare_url',
438 repo_name=r2_name,
438 repo_name=r2_name,
439 source_ref_type="branch",
439 source_ref_type="branch",
440 source_ref=commit_id1,
440 source_ref=commit_id1,
441 target_ref_type="branch",
441 target_ref_type="branch",
442 target_ref=commit_id2,
442 target_ref=commit_id2,
443 target_repo=r1_name,
443 target_repo=r1_name,
444 merge='1',))
444 merge='1',))
445
445
446 response.mustcontain('%s@%s' % (r2_name, commit_id1))
446 response.mustcontain('%s@%s' % (r2_name, commit_id1))
447 response.mustcontain('%s@%s' % (r1_name, commit_id2))
447 response.mustcontain('%s@%s' % (r1_name, commit_id2))
448 response.mustcontain('No files')
448 response.mustcontain('No files')
449 response.mustcontain('No Commits')
449 response.mustcontain('No Commits')
450
450
451 commit0 = _commit_change(
451 commit0 = _commit_change(
452 repo=r1_name, filename='file2',
452 repo=r1_name, filename='file2',
453 content='line1-added-after-fork', message='commit2-parent',
453 content='line1-added-after-fork', message='commit2-parent',
454 vcs_type=backend.alias, parent=None, newfile=True)
454 vcs_type=backend.alias, parent=None, newfile=True)
455
455
456 # compare !
456 # compare !
457 response = self.app.get(
457 response = self.app.get(
458 url('compare_url',
458 url('compare_url',
459 repo_name=r2_name,
459 repo_name=r2_name,
460 source_ref_type="branch",
460 source_ref_type="branch",
461 source_ref=commit_id1,
461 source_ref=commit_id1,
462 target_ref_type="branch",
462 target_ref_type="branch",
463 target_ref=commit_id2,
463 target_ref=commit_id2,
464 target_repo=r1_name,
464 target_repo=r1_name,
465 merge='1',))
465 merge='1',))
466
466
467 response.mustcontain('%s@%s' % (r2_name, commit_id1))
467 response.mustcontain('%s@%s' % (r2_name, commit_id1))
468 response.mustcontain('%s@%s' % (r1_name, commit_id2))
468 response.mustcontain('%s@%s' % (r1_name, commit_id2))
469
469
470 response.mustcontain("""commit2-parent""")
470 response.mustcontain("""commit2-parent""")
471 response.mustcontain("""line1-added-after-fork""")
471 response.mustcontain("""line1-added-after-fork""")
472 compare_page = ComparePage(response)
472 compare_page = ComparePage(response)
473 compare_page.contains_change_summary(1, 1, 0)
473 compare_page.contains_change_summary(1, 1, 0)
474
474
475 @pytest.mark.xfail_backends("svn")
475 @pytest.mark.xfail_backends("svn")
476 def test_compare_commits(self, backend):
476 def test_compare_commits(self, backend):
477 commit0 = backend.repo.get_commit(commit_idx=0)
477 commit0 = backend.repo.get_commit(commit_idx=0)
478 commit1 = backend.repo.get_commit(commit_idx=1)
478 commit1 = backend.repo.get_commit(commit_idx=1)
479
479
480 response = self.app.get(
480 response = self.app.get(
481 url('compare_url',
481 url('compare_url',
482 repo_name=backend.repo_name,
482 repo_name=backend.repo_name,
483 source_ref_type="rev",
483 source_ref_type="rev",
484 source_ref=commit0.raw_id,
484 source_ref=commit0.raw_id,
485 target_ref_type="rev",
485 target_ref_type="rev",
486 target_ref=commit1.raw_id,
486 target_ref=commit1.raw_id,
487 merge='1',),
487 merge='1',),
488 extra_environ={'HTTP_X_PARTIAL_XHR': '1'},)
488 extra_environ={'HTTP_X_PARTIAL_XHR': '1'},)
489
489
490 # outgoing commits between those commits
490 # outgoing commits between those commits
491 compare_page = ComparePage(response)
491 compare_page = ComparePage(response)
492 compare_page.contains_commits(commits=[commit1], ancestors=[commit0])
492 compare_page.contains_commits(commits=[commit1], ancestors=[commit0])
493
493
494 def test_errors_when_comparing_unknown_repo(self, backend):
494 def test_errors_when_comparing_unknown_repo(self, backend):
495 repo = backend.repo
495 repo = backend.repo
496 badrepo = 'badrepo'
496 badrepo = 'badrepo'
497
497
498 response = self.app.get(
498 response = self.app.get(
499 url('compare_url',
499 url('compare_url',
500 repo_name=repo.repo_name,
500 repo_name=repo.repo_name,
501 source_ref_type="rev",
501 source_ref_type="rev",
502 source_ref='tip',
502 source_ref='tip',
503 target_ref_type="rev",
503 target_ref_type="rev",
504 target_ref='tip',
504 target_ref='tip',
505 target_repo=badrepo,
505 target_repo=badrepo,
506 merge='1',),
506 merge='1',),
507 status=302)
507 status=302)
508 redirected = response.follow()
508 redirected = response.follow()
509 redirected.mustcontain('Could not find the other repo: %s' % badrepo)
509 redirected.mustcontain('Could not find the other repo: %s' % badrepo)
510
510
511 def test_compare_not_in_preview_mode(self, backend_stub):
511 def test_compare_not_in_preview_mode(self, backend_stub):
512 commit0 = backend_stub.repo.get_commit(commit_idx=0)
512 commit0 = backend_stub.repo.get_commit(commit_idx=0)
513 commit1 = backend_stub.repo.get_commit(commit_idx=1)
513 commit1 = backend_stub.repo.get_commit(commit_idx=1)
514
514
515 response = self.app.get(url('compare_url',
515 response = self.app.get(url('compare_url',
516 repo_name=backend_stub.repo_name,
516 repo_name=backend_stub.repo_name,
517 source_ref_type="rev",
517 source_ref_type="rev",
518 source_ref=commit0.raw_id,
518 source_ref=commit0.raw_id,
519 target_ref_type="rev",
519 target_ref_type="rev",
520 target_ref=commit1.raw_id,
520 target_ref=commit1.raw_id,
521 ),)
521 ),)
522
522
523 # outgoing commits between those commits
523 # outgoing commits between those commits
524 compare_page = ComparePage(response)
524 compare_page = ComparePage(response)
525 compare_page.swap_is_visible()
525 compare_page.swap_is_visible()
526 compare_page.target_source_are_enabled()
526 compare_page.target_source_are_enabled()
527
527
528 def test_compare_of_fork_with_largefiles(self, backend_hg, settings_util):
528 def test_compare_of_fork_with_largefiles(self, backend_hg, settings_util):
529 orig = backend_hg.create_repo(number_of_commits=1)
529 orig = backend_hg.create_repo(number_of_commits=1)
530 fork = backend_hg.create_fork()
530 fork = backend_hg.create_fork()
531
531
532 settings_util.create_repo_rhodecode_ui(
532 settings_util.create_repo_rhodecode_ui(
533 orig, 'extensions', value='', key='largefiles', active=False)
533 orig, 'extensions', value='', key='largefiles', active=False)
534 settings_util.create_repo_rhodecode_ui(
534 settings_util.create_repo_rhodecode_ui(
535 fork, 'extensions', value='', key='largefiles', active=True)
535 fork, 'extensions', value='', key='largefiles', active=True)
536
536
537 compare_module = ('rhodecode.lib.vcs.backends.hg.repository.'
537 compare_module = ('rhodecode.lib.vcs.backends.hg.repository.'
538 'MercurialRepository.compare')
538 'MercurialRepository.compare')
539 with mock.patch(compare_module) as compare_mock:
539 with mock.patch(compare_module) as compare_mock:
540 compare_mock.side_effect = RepositoryRequirementError()
540 compare_mock.side_effect = RepositoryRequirementError()
541
541
542 response = self.app.get(
542 response = self.app.get(
543 url('compare_url',
543 url('compare_url',
544 repo_name=orig.repo_name,
544 repo_name=orig.repo_name,
545 action="compare",
545 action="compare",
546 source_ref_type="rev",
546 source_ref_type="rev",
547 source_ref="tip",
547 source_ref="tip",
548 target_ref_type="rev",
548 target_ref_type="rev",
549 target_ref="tip",
549 target_ref="tip",
550 merge='1',
550 merge='1',
551 target_repo=fork.repo_name),
551 target_repo=fork.repo_name),
552 status=302)
552 status=302)
553
553
554 assert_session_flash(
554 assert_session_flash(
555 response,
555 response,
556 'Could not compare repos with different large file settings')
556 'Could not compare repos with different large file settings')
557
557
558
558
559 @pytest.mark.usefixtures("autologin_user")
559 @pytest.mark.usefixtures("autologin_user")
560 class TestCompareControllerSvn:
560 class TestCompareControllerSvn:
561
561
562 def test_supports_references_with_path(self, app, backend_svn):
562 def test_supports_references_with_path(self, app, backend_svn):
563 repo = backend_svn['svn-simple-layout']
563 repo = backend_svn['svn-simple-layout']
564 commit_id = repo.get_commit(commit_idx=-1).raw_id
564 commit_id = repo.get_commit(commit_idx=-1).raw_id
565 response = app.get(
565 response = app.get(
566 url('compare_url',
566 url('compare_url',
567 repo_name=repo.repo_name,
567 repo_name=repo.repo_name,
568 source_ref_type="tag",
568 source_ref_type="tag",
569 source_ref="%s@%s" % ('tags/v0.1', commit_id),
569 source_ref="%s@%s" % ('tags/v0.1', commit_id),
570 target_ref_type="tag",
570 target_ref_type="tag",
571 target_ref="%s@%s" % ('tags/v0.2', commit_id),
571 target_ref="%s@%s" % ('tags/v0.2', commit_id),
572 merge='1',),
572 merge='1',),
573 status=200)
573 status=200)
574
574
575 # Expecting no commits, since both paths are at the same revision
575 # Expecting no commits, since both paths are at the same revision
576 response.mustcontain('No Commits')
576 response.mustcontain('No Commits')
577
577
578 # Should find only one file changed when comparing those two tags
578 # Should find only one file changed when comparing those two tags
579 response.mustcontain('example.py')
579 response.mustcontain('example.py')
580 compare_page = ComparePage(response)
580 compare_page = ComparePage(response)
581 compare_page.contains_change_summary(1, 5, 1)
581 compare_page.contains_change_summary(1, 5, 1)
582
582
583 def test_shows_commits_if_different_ids(self, app, backend_svn):
583 def test_shows_commits_if_different_ids(self, app, backend_svn):
584 repo = backend_svn['svn-simple-layout']
584 repo = backend_svn['svn-simple-layout']
585 source_id = repo.get_commit(commit_idx=-6).raw_id
585 source_id = repo.get_commit(commit_idx=-6).raw_id
586 target_id = repo.get_commit(commit_idx=-1).raw_id
586 target_id = repo.get_commit(commit_idx=-1).raw_id
587 response = app.get(
587 response = app.get(
588 url('compare_url',
588 url('compare_url',
589 repo_name=repo.repo_name,
589 repo_name=repo.repo_name,
590 source_ref_type="tag",
590 source_ref_type="tag",
591 source_ref="%s@%s" % ('tags/v0.1', source_id),
591 source_ref="%s@%s" % ('tags/v0.1', source_id),
592 target_ref_type="tag",
592 target_ref_type="tag",
593 target_ref="%s@%s" % ('tags/v0.2', target_id),
593 target_ref="%s@%s" % ('tags/v0.2', target_id),
594 merge='1',),
594 merge='1',),
595 status=200)
595 status=200)
596
596
597 # It should show commits
597 # It should show commits
598 assert 'No Commits' not in response.body
598 assert 'No Commits' not in response.body
599
599
600 # Should find only one file changed when comparing those two tags
600 # Should find only one file changed when comparing those two tags
601 response.mustcontain('example.py')
601 response.mustcontain('example.py')
602 compare_page = ComparePage(response)
602 compare_page = ComparePage(response)
603 compare_page.contains_change_summary(1, 5, 1)
603 compare_page.contains_change_summary(1, 5, 1)
604
604
605
605
606 class ComparePage(AssertResponse):
606 class ComparePage(AssertResponse):
607 """
607 """
608 Abstracts the page template from the tests
608 Abstracts the page template from the tests
609 """
609 """
610
610
611 def contains_file_links_and_anchors(self, files):
611 def contains_file_links_and_anchors(self, files):
612 for filename, file_id in files:
612 for filename, file_id in files:
613 self.contains_one_link(filename, '#' + file_id)
613 self.contains_one_link(filename, '#' + file_id)
614 self.contains_one_anchor(file_id)
614 self.contains_one_anchor(file_id)
615
615
616 def contains_change_summary(self, files_changed, inserted, deleted):
616 def contains_change_summary(self, files_changed, inserted, deleted):
617 template = (
617 template = (
618 "{files_changed} file{plural} changed: "
618 "{files_changed} file{plural} changed: "
619 "{inserted} inserted, {deleted} deleted")
619 "{inserted} inserted, {deleted} deleted")
620 self.response.mustcontain(template.format(
620 self.response.mustcontain(template.format(
621 files_changed=files_changed,
621 files_changed=files_changed,
622 plural="s" if files_changed > 1 else "",
622 plural="s" if files_changed > 1 else "",
623 inserted=inserted,
623 inserted=inserted,
624 deleted=deleted))
624 deleted=deleted))
625
625
626 def contains_commits(self, commits, ancestors=None):
626 def contains_commits(self, commits, ancestors=None):
627 response = self.response
627 response = self.response
628
628
629 for commit in commits:
629 for commit in commits:
630 # Expecting to see the commit message in an element which
630 # Expecting to see the commit message in an element which
631 # has the ID "c-{commit.raw_id}"
631 # has the ID "c-{commit.raw_id}"
632 self.element_contains('#c-' + commit.raw_id, commit.message)
632 self.element_contains('#c-' + commit.raw_id, commit.message)
633 self.contains_one_link(
633 self.contains_one_link(
634 'r%s:%s' % (commit.idx, commit.short_id),
634 'r%s:%s' % (commit.idx, commit.short_id),
635 self._commit_url(commit))
635 self._commit_url(commit))
636 if ancestors:
636 if ancestors:
637 response.mustcontain('Ancestor')
637 response.mustcontain('Ancestor')
638 for ancestor in ancestors:
638 for ancestor in ancestors:
639 self.contains_one_link(
639 self.contains_one_link(
640 ancestor.short_id, self._commit_url(ancestor))
640 ancestor.short_id, self._commit_url(ancestor))
641
641
642 def _commit_url(self, commit):
642 def _commit_url(self, commit):
643 return '/%s/changeset/%s' % (commit.repository.name, commit.raw_id)
643 return '/%s/changeset/%s' % (commit.repository.name, commit.raw_id)
644
644
645 def swap_is_hidden(self):
645 def swap_is_hidden(self):
646 assert '<a id="btn-swap"' not in self.response.text
646 assert '<a id="btn-swap"' not in self.response.text
647
647
648 def swap_is_visible(self):
648 def swap_is_visible(self):
649 assert '<a id="btn-swap"' in self.response.text
649 assert '<a id="btn-swap"' in self.response.text
650
650
651 def target_source_are_disabled(self):
651 def target_source_are_disabled(self):
652 response = self.response
652 response = self.response
653 response.mustcontain("var enable_fields = false;")
653 response.mustcontain("var enable_fields = false;")
654 response.mustcontain('.select2("enable", enable_fields)')
654 response.mustcontain('.select2("enable", enable_fields)')
655
655
656 def target_source_are_enabled(self):
656 def target_source_are_enabled(self):
657 response = self.response
657 response = self.response
658 response.mustcontain("var enable_fields = true;")
658 response.mustcontain("var enable_fields = true;")
659
659
660
660
661 def _commit_change(
661 def _commit_change(
662 repo, filename, content, message, vcs_type, parent=None,
662 repo, filename, content, message, vcs_type, parent=None,
663 newfile=False):
663 newfile=False):
664 repo = Repository.get_by_repo_name(repo)
664 repo = Repository.get_by_repo_name(repo)
665 _commit = parent
665 _commit = parent
666 if not parent:
666 if not parent:
667 _commit = EmptyCommit(alias=vcs_type)
667 _commit = EmptyCommit(alias=vcs_type)
668
668
669 if newfile:
669 if newfile:
670 nodes = {
670 nodes = {
671 filename: {
671 filename: {
672 'content': content
672 'content': content
673 }
673 }
674 }
674 }
675 commit = ScmModel().create_nodes(
675 commit = ScmModel().create_nodes(
676 user=TEST_USER_ADMIN_LOGIN, repo=repo,
676 user=TEST_USER_ADMIN_LOGIN, repo=repo,
677 message=message,
677 message=message,
678 nodes=nodes,
678 nodes=nodes,
679 parent_commit=_commit,
679 parent_commit=_commit,
680 author=TEST_USER_ADMIN_LOGIN,
680 author=TEST_USER_ADMIN_LOGIN,
681 )
681 )
682 else:
682 else:
683 commit = ScmModel().commit_change(
683 commit = ScmModel().commit_change(
684 repo=repo.scm_instance(), repo_name=repo.repo_name,
684 repo=repo.scm_instance(), repo_name=repo.repo_name,
685 commit=parent, user=TEST_USER_ADMIN_LOGIN,
685 commit=parent, user=TEST_USER_ADMIN_LOGIN,
686 author=TEST_USER_ADMIN_LOGIN,
686 author=TEST_USER_ADMIN_LOGIN,
687 message=message,
687 message=message,
688 content=content,
688 content=content,
689 f_path=filename
689 f_path=filename
690 )
690 )
691 return commit
691 return commit
General Comments 0
You need to be logged in to leave comments. Login now