##// END OF EJS Templates
pull-requests: allow to show range diff in pr view
marcink -
r3124:ddd1ae7b default
parent child Browse files
Show More
@@ -303,7 +303,8 b' class PathFilter(object):'
303
303
304 def render_patchset_filtered(self, diffset, patchset, source_ref=None, target_ref=None):
304 def render_patchset_filtered(self, diffset, patchset, source_ref=None, target_ref=None):
305 filtered_patchset, has_hidden_changes = self.filter_patchset(patchset)
305 filtered_patchset, has_hidden_changes = self.filter_patchset(patchset)
306 result = diffset.render_patchset(filtered_patchset, source_ref=source_ref, target_ref=target_ref)
306 result = diffset.render_patchset(
307 filtered_patchset, source_ref=source_ref, target_ref=target_ref)
307 result.has_hidden_changes = has_hidden_changes
308 result.has_hidden_changes = has_hidden_changes
308 return result
309 return result
309
310
@@ -135,12 +135,18 b' class TestRepoCommitCommentsView(TestCon'
135 if backend.alias == 'svn':
135 if backend.alias == 'svn':
136 response.mustcontain(
136 response.mustcontain(
137 '''data-f-path="vcs/commands/summary.py" '''
137 '''data-f-path="vcs/commands/summary.py" '''
138 '''id="a_c--ad05457a43f8"'''
138 '''id="a_c-300-ad05457a43f8"'''
139 )
139 )
140 else:
140 if backend.alias == 'git':
141 response.mustcontain(
141 response.mustcontain(
142 '''data-f-path="vcs/backends/hg.py" '''
142 '''data-f-path="vcs/backends/hg.py" '''
143 '''id="a_c--9c390eb52cd6"'''
143 '''id="a_c-883e775e89ea-9c390eb52cd6"'''
144 )
145
146 if backend.alias == 'hg':
147 response.mustcontain(
148 '''data-f-path="vcs/backends/hg.py" '''
149 '''id="a_c-e58d85a3973b-9c390eb52cd6"'''
144 )
150 )
145
151
146 assert Notification.query().count() == 1
152 assert Notification.query().count() == 1
@@ -104,13 +104,11 b' class TestCompareView(object):'
104 # Comparing the revisions
104 # Comparing the revisions
105 response = self.app.get(
105 response = self.app.get(
106 route_path('repo_compare',
106 route_path('repo_compare',
107 repo_name=origin.repo_name,
107 repo_name=origin.repo_name,
108 source_ref_type="rev",
108 source_ref_type="rev", source_ref=commit3.raw_id,
109 source_ref=commit3.raw_id,
109 target_ref_type="rev", target_ref=commit4.raw_id,
110 target_ref_type="rev",
110 params=dict(merge='1', target_repo=fork.repo_name)
111 target_ref=commit4.raw_id,
111 ))
112 params=dict(merge='1', target_repo=fork.repo_name)
113 ))
114
112
115 compare_page = ComparePage(response)
113 compare_page = ComparePage(response)
116 compare_page.contains_commits([commit4])
114 compare_page.contains_commits([commit4])
@@ -142,13 +140,11 b' class TestCompareView(object):'
142
140
143 response = self.app.get(
141 response = self.app.get(
144 route_path('repo_compare',
142 route_path('repo_compare',
145 repo_name=repo1.repo_name,
143 repo_name=repo1.repo_name,
146 source_ref_type="branch",
144 source_ref_type="branch", source_ref=commit_id2,
147 source_ref=commit_id2,
145 target_ref_type="branch", target_ref=commit_id1,
148 target_ref_type="branch",
146 params=dict(merge='1', target_repo=repo2.repo_name)
149 target_ref=commit_id1,
147 ))
150 params=dict(merge='1', target_repo=repo2.repo_name)
151 ))
152
148
153 response.mustcontain('%s@%s' % (repo1.repo_name, commit_id2))
149 response.mustcontain('%s@%s' % (repo1.repo_name, commit_id2))
154 response.mustcontain('%s@%s' % (repo2.repo_name, commit_id1))
150 response.mustcontain('%s@%s' % (repo2.repo_name, commit_id1))
@@ -156,9 +152,9 b' class TestCompareView(object):'
156 compare_page = ComparePage(response)
152 compare_page = ComparePage(response)
157 compare_page.contains_change_summary(1, 2, 0)
153 compare_page.contains_change_summary(1, 2, 0)
158 compare_page.contains_commits([commit1, commit2])
154 compare_page.contains_commits([commit1, commit2])
159 compare_page.contains_file_links_and_anchors([
155
160 ('file1', 'a_c--826e8142e6ba'),
156 anchor = 'a_c-{}-826e8142e6ba'.format(commit0.short_id)
161 ])
157 compare_page.contains_file_links_and_anchors([('file1', anchor), ])
162
158
163 # Swap is removed when comparing branches since it's a PR feature and
159 # Swap is removed when comparing branches since it's a PR feature and
164 # it is then a preview mode
160 # it is then a preview mode
@@ -199,13 +195,11 b' class TestCompareView(object):'
199
195
200 response = self.app.get(
196 response = self.app.get(
201 route_path('repo_compare',
197 route_path('repo_compare',
202 repo_name=repo1.repo_name,
198 repo_name=repo1.repo_name,
203 source_ref_type="branch",
199 source_ref_type="branch", source_ref=commit_id2,
204 source_ref=commit_id2,
200 target_ref_type="branch", target_ref=commit_id1,
205 target_ref_type="branch",
201 params=dict(merge='1', target_repo=repo2.repo_name),
206 target_ref=commit_id1,
202 ))
207 params=dict(merge='1', target_repo=repo2.repo_name),
208 ))
209
203
210 response.mustcontain('%s@%s' % (repo1.repo_name, commit_id2))
204 response.mustcontain('%s@%s' % (repo1.repo_name, commit_id2))
211 response.mustcontain('%s@%s' % (repo2.repo_name, commit_id1))
205 response.mustcontain('%s@%s' % (repo2.repo_name, commit_id1))
@@ -213,9 +207,8 b' class TestCompareView(object):'
213 compare_page = ComparePage(response)
207 compare_page = ComparePage(response)
214 compare_page.contains_change_summary(1, 2, 0)
208 compare_page.contains_change_summary(1, 2, 0)
215 compare_page.contains_commits([commit1, commit2])
209 compare_page.contains_commits([commit1, commit2])
216 compare_page.contains_file_links_and_anchors([
210 anchor = 'a_c-{}-826e8142e6ba'.format(commit0.short_id)
217 ('file1', 'a_c--826e8142e6ba'),
211 compare_page.contains_file_links_and_anchors([('file1', anchor), ])
218 ])
219
212
220 # Swap is removed when comparing branches since it's a PR feature and
213 # Swap is removed when comparing branches since it's a PR feature and
221 # it is then a preview mode
214 # it is then a preview mode
@@ -230,13 +223,11 b' class TestCompareView(object):'
230
223
231 response = self.app.get(
224 response = self.app.get(
232 route_path('repo_compare',
225 route_path('repo_compare',
233 repo_name=orig.repo_name,
226 repo_name=orig.repo_name,
234 source_ref_type="rev",
227 source_ref_type="rev", source_ref="tip",
235 source_ref="tip",
228 target_ref_type="rev", target_ref="tip",
236 target_ref_type="rev",
229 params=dict(merge='1', target_repo=fork.repo_name),
237 target_ref="tip",
230 ),
238 params=dict(merge='1', target_repo=fork.repo_name),
239 ),
240 status=302)
231 status=302)
241 response = response.follow()
232 response = response.follow()
242 response.mustcontain("Repositories unrelated.")
233 response.mustcontain("Repositories unrelated.")
@@ -289,14 +280,12 b' class TestCompareView(object):'
289
280
290 response = self.app.get(
281 response = self.app.get(
291 route_path('repo_compare',
282 route_path('repo_compare',
292 repo_name=repo2.repo_name,
283 repo_name=repo2.repo_name,
293 source_ref_type="rev",
284 # parent of commit2, in target repo2
294 # parent of commit2, in target repo2
285 source_ref_type="rev", source_ref=commit1.raw_id,
295 source_ref=commit1.raw_id,
286 target_ref_type="rev", target_ref=commit4.raw_id,
296 target_ref_type="rev",
287 params=dict(merge='1', target_repo=repo1.repo_name),
297 target_ref=commit4.raw_id,
288 ))
298 params=dict(merge='1', target_repo=repo1.repo_name),
299 ))
300 response.mustcontain('%s@%s' % (repo2.repo_name, commit1.short_id))
289 response.mustcontain('%s@%s' % (repo2.repo_name, commit1.short_id))
301 response.mustcontain('%s@%s' % (repo1.repo_name, commit4.short_id))
290 response.mustcontain('%s@%s' % (repo1.repo_name, commit4.short_id))
302
291
@@ -304,9 +293,8 b' class TestCompareView(object):'
304 compare_page = ComparePage(response)
293 compare_page = ComparePage(response)
305 compare_page.contains_change_summary(1, 3, 0)
294 compare_page.contains_change_summary(1, 3, 0)
306 compare_page.contains_commits([commit2, commit3, commit4])
295 compare_page.contains_commits([commit2, commit3, commit4])
307 compare_page.contains_file_links_and_anchors([
296 anchor = 'a_c-{}-826e8142e6ba'.format(commit1.short_id)
308 ('file1', 'a_c--826e8142e6ba'),
297 compare_page.contains_file_links_and_anchors([('file1', anchor),])
309 ])
310
298
311 @pytest.mark.xfail_backends("svn")
299 @pytest.mark.xfail_backends("svn")
312 def test_compare_cherry_pick_commits_from_top(self, backend):
300 def test_compare_cherry_pick_commits_from_top(self, backend):
@@ -355,14 +343,11 b' class TestCompareView(object):'
355
343
356 response = self.app.get(
344 response = self.app.get(
357 route_path('repo_compare',
345 route_path('repo_compare',
358 repo_name=repo1.repo_name,
346 repo_name=repo1.repo_name,
359 source_ref_type="rev",
347 # parent of commit3, not in source repo2
360 # parent of commit3, not in source repo2
348 source_ref_type="rev", source_ref=commit2.raw_id,
361 source_ref=commit2.raw_id,
349 target_ref_type="rev", target_ref=commit5.raw_id,
362 target_ref_type="rev",
350 params=dict(merge='1'),))
363 target_ref=commit5.raw_id,
364 params=dict(merge='1'),
365 ))
366
351
367 response.mustcontain('%s@%s' % (repo1.repo_name, commit2.short_id))
352 response.mustcontain('%s@%s' % (repo1.repo_name, commit2.short_id))
368 response.mustcontain('%s@%s' % (repo1.repo_name, commit5.short_id))
353 response.mustcontain('%s@%s' % (repo1.repo_name, commit5.short_id))
@@ -372,9 +357,8 b' class TestCompareView(object):'
372 compare_page.contains_commits([commit3, commit4, commit5])
357 compare_page.contains_commits([commit3, commit4, commit5])
373
358
374 # files
359 # files
375 compare_page.contains_file_links_and_anchors([
360 anchor = 'a_c-{}-826e8142e6ba'.format(commit2.short_id)
376 ('file1', 'a_c--826e8142e6ba'),
361 compare_page.contains_file_links_and_anchors([('file1', anchor),])
377 ])
378
362
379 @pytest.mark.xfail_backends("svn")
363 @pytest.mark.xfail_backends("svn")
380 def test_compare_remote_branches(self, backend):
364 def test_compare_remote_branches(self, backend):
@@ -382,17 +366,17 b' class TestCompareView(object):'
382 repo2 = backend.create_fork()
366 repo2 = backend.create_fork()
383
367
384 commit_id1 = repo1.get_commit(commit_idx=3).raw_id
368 commit_id1 = repo1.get_commit(commit_idx=3).raw_id
369 commit_id1_short = repo1.get_commit(commit_idx=3).short_id
385 commit_id2 = repo1.get_commit(commit_idx=6).raw_id
370 commit_id2 = repo1.get_commit(commit_idx=6).raw_id
371 commit_id2_short = repo1.get_commit(commit_idx=6).short_id
386
372
387 response = self.app.get(
373 response = self.app.get(
388 route_path('repo_compare',
374 route_path('repo_compare',
389 repo_name=repo1.repo_name,
375 repo_name=repo1.repo_name,
390 source_ref_type="rev",
376 source_ref_type="rev", source_ref=commit_id1,
391 source_ref=commit_id1,
377 target_ref_type="rev", target_ref=commit_id2,
392 target_ref_type="rev",
378 params=dict(merge='1', target_repo=repo2.repo_name),
393 target_ref=commit_id2,
379 ))
394 params=dict(merge='1', target_repo=repo2.repo_name),
395 ))
396
380
397 response.mustcontain('%s@%s' % (repo1.repo_name, commit_id1))
381 response.mustcontain('%s@%s' % (repo1.repo_name, commit_id1))
398 response.mustcontain('%s@%s' % (repo2.repo_name, commit_id2))
382 response.mustcontain('%s@%s' % (repo2.repo_name, commit_id2))
@@ -405,9 +389,9 b' class TestCompareView(object):'
405
389
406 # files
390 # files
407 compare_page.contains_file_links_and_anchors([
391 compare_page.contains_file_links_and_anchors([
408 ('vcs/backends/hg.py', 'a_c--9c390eb52cd6'),
392 ('vcs/backends/hg.py', 'a_c-{}-9c390eb52cd6'.format(commit_id2_short)),
409 ('vcs/backends/__init__.py', 'a_c--41b41c1f2796'),
393 ('vcs/backends/__init__.py', 'a_c-{}-41b41c1f2796'.format(commit_id1_short)),
410 ('vcs/backends/base.py', 'a_c--2f574d260608'),
394 ('vcs/backends/base.py', 'a_c-{}-2f574d260608'.format(commit_id1_short)),
411 ])
395 ])
412
396
413 @pytest.mark.xfail_backends("svn")
397 @pytest.mark.xfail_backends("svn")
@@ -451,13 +435,11 b' class TestCompareView(object):'
451
435
452 response = self.app.get(
436 response = self.app.get(
453 route_path('repo_compare',
437 route_path('repo_compare',
454 repo_name=r2_name,
438 repo_name=r2_name,
455 source_ref_type="branch",
439 source_ref_type="branch", source_ref=commit_id1,
456 source_ref=commit_id1,
440 target_ref_type="branch", target_ref=commit_id2,
457 target_ref_type="branch",
441 params=dict(merge='1', target_repo=r1_name),
458 target_ref=commit_id2,
442 ))
459 params=dict(merge='1', target_repo=r1_name),
460 ))
461
443
462 response.mustcontain('%s@%s' % (r2_name, commit_id1))
444 response.mustcontain('%s@%s' % (r2_name, commit_id1))
463 response.mustcontain('%s@%s' % (r1_name, commit_id2))
445 response.mustcontain('%s@%s' % (r1_name, commit_id2))
@@ -472,13 +454,11 b' class TestCompareView(object):'
472 # compare !
454 # compare !
473 response = self.app.get(
455 response = self.app.get(
474 route_path('repo_compare',
456 route_path('repo_compare',
475 repo_name=r2_name,
457 repo_name=r2_name,
476 source_ref_type="branch",
458 source_ref_type="branch", source_ref=commit_id1,
477 source_ref=commit_id1,
459 target_ref_type="branch", target_ref=commit_id2,
478 target_ref_type="branch",
460 params=dict(merge='1', target_repo=r1_name),
479 target_ref=commit_id2,
461 ))
480 params=dict(merge='1', target_repo=r1_name),
481 ))
482
462
483 response.mustcontain('%s@%s' % (r2_name, commit_id1))
463 response.mustcontain('%s@%s' % (r2_name, commit_id1))
484 response.mustcontain('%s@%s' % (r1_name, commit_id2))
464 response.mustcontain('%s@%s' % (r1_name, commit_id2))
@@ -495,14 +475,12 b' class TestCompareView(object):'
495
475
496 response = self.app.get(
476 response = self.app.get(
497 route_path('repo_compare',
477 route_path('repo_compare',
498 repo_name=backend.repo_name,
478 repo_name=backend.repo_name,
499 source_ref_type="rev",
479 source_ref_type="rev", source_ref=commit0.raw_id,
500 source_ref=commit0.raw_id,
480 target_ref_type="rev", target_ref=commit1.raw_id,
501 target_ref_type="rev",
481 params=dict(merge='1')
502 target_ref=commit1.raw_id,
482 ),
503 params=dict(merge='1')
483 extra_environ=xhr_header, )
504 ),
505 extra_environ=xhr_header,)
506
484
507 # outgoing commits between those commits
485 # outgoing commits between those commits
508 compare_page = ComparePage(response)
486 compare_page = ComparePage(response)
@@ -514,13 +492,11 b' class TestCompareView(object):'
514
492
515 response = self.app.get(
493 response = self.app.get(
516 route_path('repo_compare',
494 route_path('repo_compare',
517 repo_name=badrepo,
495 repo_name=badrepo,
518 source_ref_type="rev",
496 source_ref_type="rev", source_ref='tip',
519 source_ref='tip',
497 target_ref_type="rev", target_ref='tip',
520 target_ref_type="rev",
498 params=dict(merge='1', target_repo=repo.repo_name)
521 target_ref='tip',
499 ),
522 params=dict(merge='1', target_repo=repo.repo_name)
523 ),
524 status=404)
500 status=404)
525
501
526 def test_errors_when_comparing_unknown_target_repo(self, backend):
502 def test_errors_when_comparing_unknown_target_repo(self, backend):
@@ -529,13 +505,11 b' class TestCompareView(object):'
529
505
530 response = self.app.get(
506 response = self.app.get(
531 route_path('repo_compare',
507 route_path('repo_compare',
532 repo_name=repo.repo_name,
508 repo_name=repo.repo_name,
533 source_ref_type="rev",
509 source_ref_type="rev", source_ref='tip',
534 source_ref='tip',
510 target_ref_type="rev", target_ref='tip',
535 target_ref_type="rev",
511 params=dict(merge='1', target_repo=badrepo),
536 target_ref='tip',
512 ),
537 params=dict(merge='1', target_repo=badrepo),
538 ),
539 status=302)
513 status=302)
540 redirected = response.follow()
514 redirected = response.follow()
541 redirected.mustcontain(
515 redirected.mustcontain(
@@ -547,12 +521,10 b' class TestCompareView(object):'
547
521
548 response = self.app.get(
522 response = self.app.get(
549 route_path('repo_compare',
523 route_path('repo_compare',
550 repo_name=backend_stub.repo_name,
524 repo_name=backend_stub.repo_name,
551 source_ref_type="rev",
525 source_ref_type="rev", source_ref=commit0.raw_id,
552 source_ref=commit0.raw_id,
526 target_ref_type="rev", target_ref=commit1.raw_id,
553 target_ref_type="rev",
527 ))
554 target_ref=commit1.raw_id,
555 ))
556
528
557 # outgoing commits between those commits
529 # outgoing commits between those commits
558 compare_page = ComparePage(response)
530 compare_page = ComparePage(response)
@@ -575,13 +547,11 b' class TestCompareView(object):'
575
547
576 response = self.app.get(
548 response = self.app.get(
577 route_path('repo_compare',
549 route_path('repo_compare',
578 repo_name=orig.repo_name,
550 repo_name=orig.repo_name,
579 source_ref_type="rev",
551 source_ref_type="rev", source_ref="tip",
580 source_ref="tip",
552 target_ref_type="rev", target_ref="tip",
581 target_ref_type="rev",
553 params=dict(merge='1', target_repo=fork.repo_name),
582 target_ref="tip",
554 ),
583 params=dict(merge='1', target_repo=fork.repo_name),
584 ),
585 status=302)
555 status=302)
586
556
587 assert_session_flash(
557 assert_session_flash(
@@ -597,13 +567,13 b' class TestCompareControllerSvn(object):'
597 commit_id = repo.get_commit(commit_idx=-1).raw_id
567 commit_id = repo.get_commit(commit_idx=-1).raw_id
598 response = app.get(
568 response = app.get(
599 route_path('repo_compare',
569 route_path('repo_compare',
600 repo_name=repo.repo_name,
570 repo_name=repo.repo_name,
601 source_ref_type="tag",
571 source_ref_type="tag",
602 source_ref="%s@%s" % ('tags/v0.1', commit_id),
572 source_ref="%s@%s" % ('tags/v0.1', commit_id),
603 target_ref_type="tag",
573 target_ref_type="tag",
604 target_ref="%s@%s" % ('tags/v0.2', commit_id),
574 target_ref="%s@%s" % ('tags/v0.2', commit_id),
605 params=dict(merge='1'),
575 params=dict(merge='1'),
606 ),
576 ),
607 status=200)
577 status=200)
608
578
609 # Expecting no commits, since both paths are at the same revision
579 # Expecting no commits, since both paths are at the same revision
@@ -620,13 +590,13 b' class TestCompareControllerSvn(object):'
620 target_id = repo.get_commit(commit_idx=-1).raw_id
590 target_id = repo.get_commit(commit_idx=-1).raw_id
621 response = app.get(
591 response = app.get(
622 route_path('repo_compare',
592 route_path('repo_compare',
623 repo_name=repo.repo_name,
593 repo_name=repo.repo_name,
624 source_ref_type="tag",
594 source_ref_type="tag",
625 source_ref="%s@%s" % ('tags/v0.1', source_id),
595 source_ref="%s@%s" % ('tags/v0.1', source_id),
626 target_ref_type="tag",
596 target_ref_type="tag",
627 target_ref="%s@%s" % ('tags/v0.2', target_id),
597 target_ref="%s@%s" % ('tags/v0.2', target_id),
628 params=dict(merge='1')
598 params=dict(merge='1')
629 ),
599 ),
630 status=200)
600 status=200)
631
601
632 # It should show commits
602 # It should show commits
@@ -694,4 +664,3 b' class ComparePage(AssertResponse):'
694 def target_source_are_enabled(self):
664 def target_source_are_enabled(self):
695 response = self.response
665 response = self.response
696 response.mustcontain("var enable_fields = true;")
666 response.mustcontain("var enable_fields = true;")
697
@@ -47,10 +47,8 b' class TestCompareView(object):'
47 route_path(
47 route_path(
48 'repo_compare',
48 'repo_compare',
49 repo_name=backend.repo_name,
49 repo_name=backend.repo_name,
50 source_ref_type="tag",
50 source_ref_type="tag", source_ref=tag1,
51 source_ref=tag1,
51 target_ref_type="tag", target_ref=tag2),
52 target_ref_type="tag",
53 target_ref=tag2),
54 status=200)
52 status=200)
55
53
56 response.mustcontain('%s@%s' % (backend.repo_name, tag1))
54 response.mustcontain('%s@%s' % (backend.repo_name, tag1))
@@ -69,18 +67,28 b' class TestCompareView(object):'
69 compare_page.contains_commits(commits)
67 compare_page.contains_commits(commits)
70
68
71 # files diff
69 # files diff
70 short_id = short_id_new = ''
71 if backend.alias == 'git':
72 short_id = '5a3a8fb00555'
73 short_id_new = '0ba5f8a46600'
74 if backend.alias == 'hg':
75 short_id = '17544fbfcd33'
76 short_id_new = 'a7e60bff65d5'
77
72 compare_page.contains_file_links_and_anchors([
78 compare_page.contains_file_links_and_anchors([
73 ('docs/api/utils/index.rst', 'a_c--1c5cf9e91c12'),
79 # modified
74 ('test_and_report.sh', 'a_c--e3305437df55'),
80 ('docs/api/utils/index.rst', 'a_c-{}-1c5cf9e91c12'.format(short_id)),
75 ('.hgignore', 'a_c--c8e92ef85cd1'),
81 ('test_and_report.sh', 'a_c-{}-e3305437df55'.format(short_id)),
76 ('.hgtags', 'a_c--6e08b694d687'),
82 # added
77 ('docs/api/index.rst', 'a_c--2c14b00f3393'),
83 ('.hgignore', 'a_c-{}-c8e92ef85cd1'.format(short_id_new)),
78 ('vcs/__init__.py', 'a_c--430ccbc82bdf'),
84 ('.hgtags', 'a_c-{}-6e08b694d687'.format(short_id_new)),
79 ('vcs/backends/hg.py', 'a_c--9c390eb52cd6'),
85 ('docs/api/index.rst', 'a_c-{}-2c14b00f3393'.format(short_id_new)),
80 ('vcs/utils/__init__.py', 'a_c--ebb592c595c0'),
86 ('vcs/__init__.py', 'a_c-{}-430ccbc82bdf'.format(short_id_new)),
81 ('vcs/utils/annotate.py', 'a_c--7abc741b5052'),
87 ('vcs/backends/hg.py', 'a_c-{}-9c390eb52cd6'.format(short_id_new)),
82 ('vcs/utils/diffs.py', 'a_c--2ef0ef106c56'),
88 ('vcs/utils/__init__.py', 'a_c-{}-ebb592c595c0'.format(short_id_new)),
83 ('vcs/utils/lazy.py', 'a_c--3150cb87d4b7'),
89 ('vcs/utils/annotate.py', 'a_c-{}-7abc741b5052'.format(short_id_new)),
90 ('vcs/utils/diffs.py', 'a_c-{}-2ef0ef106c56'.format(short_id_new)),
91 ('vcs/utils/lazy.py', 'a_c-{}-3150cb87d4b7'.format(short_id_new)),
84 ])
92 ])
85
93
86 @pytest.mark.xfail_backends("svn", msg="Depends on branch and tag support")
94 @pytest.mark.xfail_backends("svn", msg="Depends on branch and tag support")
@@ -104,12 +112,10 b' class TestCompareView(object):'
104
112
105 response = self.app.get(
113 response = self.app.get(
106 route_path(
114 route_path(
107 'repo_compare',
115 'repo_compare',
108 repo_name=backend.repo_name,
116 repo_name=backend.repo_name,
109 source_ref_type='branch',
117 source_ref_type='branch', source_ref=data['branch'],
110 source_ref=data['branch'],
118 target_ref_type="tag", target_ref=data['tag'],
111 target_ref_type="tag",
112 target_ref=data['tag'],
113 ))
119 ))
114
120
115 response.mustcontain('%s@%s' % (backend.repo_name, data['branch']))
121 response.mustcontain('%s@%s' % (backend.repo_name, data['branch']))
@@ -121,12 +127,10 b' class TestCompareView(object):'
121 head_id = backend.default_head_id
127 head_id = backend.default_head_id
122 response = self.app.get(
128 response = self.app.get(
123 route_path(
129 route_path(
124 'repo_compare',
130 'repo_compare',
125 repo_name=backend.repo_name,
131 repo_name=backend.repo_name,
126 source_ref_type="branch",
132 source_ref_type="branch", source_ref=head_id,
127 source_ref=head_id,
133 target_ref_type="branch", target_ref=head_id,
128 target_ref_type="branch",
129 target_ref=head_id,
130 ))
134 ))
131
135
132 response.mustcontain('%s@%s' % (backend.repo_name, head_id))
136 response.mustcontain('%s@%s' % (backend.repo_name, head_id))
@@ -138,16 +142,16 b' class TestCompareView(object):'
138 def test_compare_commits(self, backend):
142 def test_compare_commits(self, backend):
139 repo = backend.repo
143 repo = backend.repo
140 commit1 = repo.get_commit(commit_idx=0)
144 commit1 = repo.get_commit(commit_idx=0)
145 commit1_short_id = commit1.short_id
141 commit2 = repo.get_commit(commit_idx=1)
146 commit2 = repo.get_commit(commit_idx=1)
147 commit2_short_id = commit2.short_id
142
148
143 response = self.app.get(
149 response = self.app.get(
144 route_path(
150 route_path(
145 'repo_compare',
151 'repo_compare',
146 repo_name=backend.repo_name,
152 repo_name=backend.repo_name,
147 source_ref_type="rev",
153 source_ref_type="rev", source_ref=commit1.raw_id,
148 source_ref=commit1.raw_id,
154 target_ref_type="rev", target_ref=commit2.raw_id,
149 target_ref_type="rev",
150 target_ref=commit2.raw_id,
151 ))
155 ))
152 response.mustcontain('%s@%s' % (backend.repo_name, commit1.raw_id))
156 response.mustcontain('%s@%s' % (backend.repo_name, commit1.raw_id))
153 response.mustcontain('%s@%s' % (backend.repo_name, commit2.raw_id))
157 response.mustcontain('%s@%s' % (backend.repo_name, commit2.raw_id))
@@ -158,6 +162,6 b' class TestCompareView(object):'
158
162
159 # outgoing commits between those commits
163 # outgoing commits between those commits
160 compare_page.contains_commits([commit2])
164 compare_page.contains_commits([commit2])
161 compare_page.contains_file_links_and_anchors([
165 anchor = 'a_c-{}-c8e92ef85cd1'.format(commit2_short_id)
162 ('.hgignore', 'a_c--c8e92ef85cd1'),
166 response.mustcontain(anchor)
163 ])
167 compare_page.contains_file_links_and_anchors([('.hgignore', anchor),])
@@ -81,20 +81,21 b' class TestPullrequestsView(object):'
81 repo = backend.repo
81 repo = backend.repo
82
82
83 self.app.get(
83 self.app.get(
84 route_path('pullrequest_new',
84 route_path('pullrequest_new', repo_name=repo.repo_name,
85 repo_name=repo.repo_name,
85 commit=repo.get_commit().raw_id),
86 commit=repo.get_commit().raw_id),
87 status=200)
86 status=200)
88
87
89 @pytest.mark.parametrize('pr_merge_enabled', [True, False])
88 @pytest.mark.parametrize('pr_merge_enabled', [True, False])
90 def test_show(self, pr_util, pr_merge_enabled):
89 @pytest.mark.parametrize('range_diff', ["0", "1"])
90 def test_show(self, pr_util, pr_merge_enabled, range_diff):
91 pull_request = pr_util.create_pull_request(
91 pull_request = pr_util.create_pull_request(
92 mergeable=pr_merge_enabled, enable_notifications=False)
92 mergeable=pr_merge_enabled, enable_notifications=False)
93
93
94 response = self.app.get(route_path(
94 response = self.app.get(route_path(
95 'pullrequest_show',
95 'pullrequest_show',
96 repo_name=pull_request.target_repo.scm_instance().name,
96 repo_name=pull_request.target_repo.scm_instance().name,
97 pull_request_id=pull_request.pull_request_id))
97 pull_request_id=pull_request.pull_request_id,
98 params={'range-diff': range_diff}))
98
99
99 for commit_id in pull_request.revisions:
100 for commit_id in pull_request.revisions:
100 response.mustcontain(commit_id)
101 response.mustcontain(commit_id)
@@ -105,9 +106,13 b' class TestPullrequestsView(object):'
105 assert target_clone_url in response
106 assert target_clone_url in response
106
107
107 assert 'class="pull-request-merge"' in response
108 assert 'class="pull-request-merge"' in response
108 assert (
109 if pr_merge_enabled:
109 'Server-side pull request merging is disabled.'
110 response.mustcontain('Pull request reviewer approval is pending')
110 in response) != pr_merge_enabled
111 else:
112 response.mustcontain('Server-side pull request merging is disabled.')
113
114 if range_diff == "1":
115 response.mustcontain('Turn off: Show the diff as commit range')
111
116
112 def test_close_status_visibility(self, pr_util, user_util, csrf_token):
117 def test_close_status_visibility(self, pr_util, user_util, csrf_token):
113 # Logout
118 # Logout
@@ -245,7 +245,7 b' class RepoCommitsView(RepoAppView):'
245 c.changes[commit.raw_id] = []
245 c.changes[commit.raw_id] = []
246
246
247 commit2 = commit
247 commit2 = commit
248 commit1 = commit.parents[0] if commit.parents else EmptyCommit()
248 commit1 = commit.first_parent
249
249
250 if method == 'show':
250 if method == 'show':
251 inline_comments = CommentsModel().get_inline_comments(
251 inline_comments = CommentsModel().get_inline_comments(
@@ -138,6 +138,13 b' class RepoPullRequestsView(RepoAppView, '
138 })
138 })
139 return data
139 return data
140
140
141 def get_recache_flag(self):
142 for flag_name in ['force_recache', 'force-recache', 'no-cache']:
143 flag_val = self.request.GET.get(flag_name)
144 if str2bool(flag_val):
145 return True
146 return False
147
141 @LoginRequired()
148 @LoginRequired()
142 @HasRepoPermissionAnyDecorator(
149 @HasRepoPermissionAnyDecorator(
143 'repository.read', 'repository.write', 'repository.admin')
150 'repository.read', 'repository.write', 'repository.admin')
@@ -234,6 +241,30 b' class RepoPullRequestsView(RepoAppView, '
234
241
235 return diffset
242 return diffset
236
243
244 def _get_range_diffset(self, source_scm, source_repo,
245 commit1, commit2, diff_limit, file_limit,
246 fulldiff, ign_whitespace_lcl, context_lcl):
247 vcs_diff = source_scm.get_diff(
248 commit1, commit2,
249 ignore_whitespace=ign_whitespace_lcl,
250 context=context_lcl)
251
252 diff_processor = diffs.DiffProcessor(
253 vcs_diff, format='newdiff', diff_limit=diff_limit,
254 file_limit=file_limit, show_full_diff=fulldiff)
255
256 _parsed = diff_processor.prepare()
257
258 diffset = codeblocks.DiffSet(
259 repo_name=source_repo.repo_name,
260 source_node_getter=codeblocks.diffset_node_getter(commit1),
261 target_node_getter=codeblocks.diffset_node_getter(commit2))
262
263 diffset = self.path_filter.render_patchset_filtered(
264 diffset, _parsed, commit1.raw_id, commit2.raw_id)
265
266 return diffset
267
237 @LoginRequired()
268 @LoginRequired()
238 @HasRepoPermissionAnyDecorator(
269 @HasRepoPermissionAnyDecorator(
239 'repository.read', 'repository.write', 'repository.admin')
270 'repository.read', 'repository.write', 'repository.admin')
@@ -265,6 +296,9 b' class RepoPullRequestsView(RepoAppView, '
265 pull_request_id=pull_request_id))
296 pull_request_id=pull_request_id))
266
297
267 versions = pull_request_display_obj.versions()
298 versions = pull_request_display_obj.versions()
299 # used to store per-commit range diffs
300 c.changes = collections.OrderedDict()
301 c.range_diff_on = self.request.GET.get('range-diff') == "1"
268
302
269 c.at_version = at_version
303 c.at_version = at_version
270 c.at_version_num = (at_version
304 c.at_version_num = (at_version
@@ -453,14 +487,13 b' class RepoPullRequestsView(RepoAppView, '
453 version_normalized = version or 'latest'
487 version_normalized = version or 'latest'
454 from_version_normalized = from_version or 'latest'
488 from_version_normalized = from_version or 'latest'
455
489
456 cache_path = self.rhodecode_vcs_repo.get_create_shadow_cache_pr_path(
490 cache_path = self.rhodecode_vcs_repo.get_create_shadow_cache_pr_path(target_repo)
457 target_repo)
458 cache_file_path = diff_cache_exist(
491 cache_file_path = diff_cache_exist(
459 cache_path, 'pull_request', pull_request_id, version_normalized,
492 cache_path, 'pull_request', pull_request_id, version_normalized,
460 from_version_normalized, source_ref_id, target_ref_id, c.fulldiff)
493 from_version_normalized, source_ref_id, target_ref_id, c.fulldiff)
461
494
462 caching_enabled = self._is_diff_cache_enabled(c.target_repo)
495 caching_enabled = self._is_diff_cache_enabled(c.target_repo)
463 force_recache = str2bool(self.request.GET.get('force_recache'))
496 force_recache = self.get_recache_flag()
464
497
465 cached_diff = None
498 cached_diff = None
466 if caching_enabled:
499 if caching_enabled:
@@ -471,7 +504,8 b' class RepoPullRequestsView(RepoAppView, '
471 and len(cached_diff.get('commits', [])) == 5
504 and len(cached_diff.get('commits', [])) == 5
472 and cached_diff.get('commits')[0]
505 and cached_diff.get('commits')[0]
473 and cached_diff.get('commits')[3])
506 and cached_diff.get('commits')[3])
474 if not force_recache and has_proper_commit_cache:
507
508 if not force_recache and not c.range_diff_on and has_proper_commit_cache:
475 diff_commit_cache = \
509 diff_commit_cache = \
476 (ancestor_commit, commit_cache, missing_requirements,
510 (ancestor_commit, commit_cache, missing_requirements,
477 source_commit, target_commit) = cached_diff['commits']
511 source_commit, target_commit) = cached_diff['commits']
@@ -546,8 +580,41 b' class RepoPullRequestsView(RepoAppView, '
546 c.deleted_files_comments[fname]['stats'] = 0
580 c.deleted_files_comments[fname]['stats'] = 0
547 c.deleted_files_comments[fname]['comments'] = list()
581 c.deleted_files_comments[fname]['comments'] = list()
548 for lno, comments in per_line_comments.items():
582 for lno, comments in per_line_comments.items():
549 c.deleted_files_comments[fname]['comments'].extend(
583 c.deleted_files_comments[fname]['comments'].extend(comments)
550 comments)
584
585 # maybe calculate the range diff
586 if c.range_diff_on:
587 # TODO(marcink): set whitespace/context
588 context_lcl = 3
589 ign_whitespace_lcl = False
590
591 for commit in c.commit_ranges:
592 commit2 = commit
593 commit1 = commit.first_parent
594
595 range_diff_cache_file_path = diff_cache_exist(
596 cache_path, 'diff', commit.raw_id,
597 ign_whitespace_lcl, context_lcl, c.fulldiff)
598
599 cached_diff = None
600 if caching_enabled:
601 cached_diff = load_cached_diff(range_diff_cache_file_path)
602
603 has_proper_diff_cache = cached_diff and cached_diff.get('diff')
604 if not force_recache and has_proper_diff_cache:
605 diffset = cached_diff['diff']
606 else:
607 diffset = self._get_range_diffset(
608 source_scm, source_repo,
609 commit1, commit2, diff_limit, file_limit,
610 c.fulldiff, ign_whitespace_lcl, context_lcl
611 )
612
613 # save cached diff
614 if caching_enabled:
615 cache_diff(range_diff_cache_file_path, diffset, None)
616
617 c.changes[commit.raw_id] = diffset
551
618
552 # this is a hack to properly display links, when creating PR, the
619 # this is a hack to properly display links, when creating PR, the
553 # compare view and others uses different notation, and
620 # compare view and others uses different notation, and
@@ -607,7 +674,7 b' class RepoPullRequestsView(RepoAppView, '
607 commit_cache = collections.OrderedDict()
674 commit_cache = collections.OrderedDict()
608 missing_requirements = False
675 missing_requirements = False
609 try:
676 try:
610 pre_load = ["author", "branch", "date", "message"]
677 pre_load = ["author", "branch", "date", "message", "parents"]
611 show_revs = pull_request_at_ver.revisions
678 show_revs = pull_request_at_ver.revisions
612 for rev in show_revs:
679 for rev in show_revs:
613 comm = commits_source_repo.get_commit(
680 comm = commits_source_repo.get_commit(
@@ -469,6 +469,13 b' class DiffSet(object):'
469
469
470 source_file = self.source_nodes.get(source_filename, source_filename)
470 source_file = self.source_nodes.get(source_filename, source_filename)
471 target_file = self.target_nodes.get(target_filename, target_filename)
471 target_file = self.target_nodes.get(target_filename, target_filename)
472 raw_id_uid = ''
473 if self.source_nodes.get(source_filename):
474 raw_id_uid = self.source_nodes[source_filename].commit.raw_id
475
476 if not raw_id_uid and self.target_nodes.get(target_filename):
477 # in case this is a new file we only have it in target
478 raw_id_uid = self.target_nodes[target_filename].commit.raw_id
472
479
473 source_filenode, target_filenode = None, None
480 source_filenode, target_filenode = None, None
474
481
@@ -512,7 +519,9 b' class DiffSet(object):'
512 'hunks': [],
519 'hunks': [],
513 'hunk_ops': None,
520 'hunk_ops': None,
514 'diffset': self,
521 'diffset': self,
522 'raw_id': raw_id_uid,
515 })
523 })
524
516 file_chunks = patch['chunks'][1:]
525 file_chunks = patch['chunks'][1:]
517 for hunk in file_chunks:
526 for hunk in file_chunks:
518 hunkbit = self.parse_hunk(hunk, source_file, target_file)
527 hunkbit = self.parse_hunk(hunk, source_file, target_file)
@@ -821,6 +821,13 b' class BaseCommit(object):'
821 """
821 """
822 raise NotImplementedError
822 raise NotImplementedError
823
823
824 @LazyProperty
825 def first_parent(self):
826 """
827 Returns list of parent commits.
828 """
829 return self.parents[0] if self.parents else EmptyCommit()
830
824 @property
831 @property
825 def merge(self):
832 def merge(self):
826 """
833 """
@@ -1099,8 +1106,7 b' class BaseCommit(object):'
1099 """
1106 """
1100 Returns a `Diff` object representing the change made by this commit.
1107 Returns a `Diff` object representing the change made by this commit.
1101 """
1108 """
1102 parent = (
1109 parent = self.first_parent
1103 self.parents[0] if self.parents else self.repository.EMPTY_COMMIT)
1104 diff = self.repository.get_diff(
1110 diff = self.repository.get_diff(
1105 parent, self,
1111 parent, self,
1106 ignore_whitespace=ignore_whitespace,
1112 ignore_whitespace=ignore_whitespace,
@@ -47,7 +47,7 b" return '%s_%s_%i' % (h.safeid(filename),"
47 deleted_files_comments=None,
47 deleted_files_comments=None,
48
48
49 # for cache purpose
49 # for cache purpose
50 inline_comments=None
50 inline_comments=None,
51
51
52 )">
52 )">
53 %if use_comments:
53 %if use_comments:
@@ -118,7 +118,7 b' collapse_all = len(diffset.files) > coll'
118 <h2 class="clearinner">
118 <h2 class="clearinner">
119 ## invidual commit
119 ## invidual commit
120 % if commit:
120 % if commit:
121 <a class="tooltip revision" title="${h.tooltip(commit.message)}" href="${h.route_path('repo_commit',repo_name=c.repo_name,commit_id=commit.raw_id)}">${('r%s:%s' % (commit.idx,h.short_id(commit.raw_id)))}</a> -
121 <a class="tooltip revision" title="${h.tooltip(commit.message)}" href="${h.route_path('repo_commit',repo_name=diffset.repo_name,commit_id=commit.raw_id)}">${('r%s:%s' % (commit.idx,h.short_id(commit.raw_id)))}</a> -
122 ${h.age_component(commit.date)}
122 ${h.age_component(commit.date)}
123 % if diffset.limited_diff:
123 % if diffset.limited_diff:
124 - ${_('The requested commit is too big and content was truncated.')}
124 - ${_('The requested commit is too big and content was truncated.')}
@@ -158,7 +158,7 b' collapse_all = len(diffset.files) > coll'
158 <div
158 <div
159 class="filediff"
159 class="filediff"
160 data-f-path="${filediff.patch['filename']}"
160 data-f-path="${filediff.patch['filename']}"
161 id="a_${h.FID('', filediff.patch['filename'])}"
161 id="a_${h.FID(filediff.raw_id, filediff.patch['filename'])}"
162 >
162 >
163
163
164 <label for="filediff-collapse-${id(filediff)}" class="filediff-heading">
164 <label for="filediff-collapse-${id(filediff)}" class="filediff-heading">
@@ -290,7 +290,7 b' collapse_all = len(diffset.files) > coll'
290 %>
290 %>
291 <div class="filediffs filediff-outdated" style="${display_state}">
291 <div class="filediffs filediff-outdated" style="${display_state}">
292 <input ${(collapse_all and 'checked' or '')} class="filediff-collapse-state" id="filediff-collapse-${id(filename)}" type="checkbox">
292 <input ${(collapse_all and 'checked' or '')} class="filediff-collapse-state" id="filediff-collapse-${id(filename)}" type="checkbox">
293 <div class="filediff" data-f-path="${filename}" id="a_${h.FID('', filename)}">
293 <div class="filediff" data-f-path="${filename}" id="a_${h.FID(filediff.raw_id, filename)}">
294 <label for="filediff-collapse-${id(filename)}" class="filediff-heading">
294 <label for="filediff-collapse-${id(filename)}" class="filediff-heading">
295 <div class="filediff-collapse-indicator"></div>
295 <div class="filediff-collapse-indicator"></div>
296 <span class="pill">
296 <span class="pill">
@@ -301,7 +301,7 b' collapse_all = len(diffset.files) > coll'
301 ## file op, doesn't need translation
301 ## file op, doesn't need translation
302 <span class="pill" op="removed">removed in this version</span>
302 <span class="pill" op="removed">removed in this version</span>
303 </span>
303 </span>
304 <a class="pill filediff-anchor" href="#a_${h.FID('', filename)}">ΒΆ</a>
304 <a class="pill filediff-anchor" href="#a_${h.FID(filediff.raw_id, filename)}">ΒΆ</a>
305 <span class="pill-group" style="float: right">
305 <span class="pill-group" style="float: right">
306 <span class="pill" op="deleted">-${comments_dict['stats']}</span>
306 <span class="pill" op="deleted">-${comments_dict['stats']}</span>
307 </span>
307 </span>
@@ -384,7 +384,7 b' from rhodecode.lib.diffs import NEW_FILE'
384 <i style="color: #aaa" class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${final_path}" title="${_('Copy the full path')}" onclick="return false;"></i>
384 <i style="color: #aaa" class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${final_path}" title="${_('Copy the full path')}" onclick="return false;"></i>
385 </span>
385 </span>
386 ## anchor link
386 ## anchor link
387 <a class="pill filediff-anchor" href="#a_${h.FID('', filediff.patch['filename'])}">ΒΆ</a>
387 <a class="pill filediff-anchor" href="#a_${h.FID(filediff.raw_id, filediff.patch['filename'])}">ΒΆ</a>
388
388
389 <span class="pill-group" style="float: right">
389 <span class="pill-group" style="float: right">
390
390
@@ -493,10 +493,10 b' from rhodecode.lib.diffs import NEW_FILE'
493
493
494 ## TODO: dan: refactor ignorews_url and context_url into the diff renderer same as diffmode=unified/sideside. Also use ajax to load more context (by clicking hunks)
494 ## TODO: dan: refactor ignorews_url and context_url into the diff renderer same as diffmode=unified/sideside. Also use ajax to load more context (by clicking hunks)
495 %if hasattr(c, 'ignorews_url'):
495 %if hasattr(c, 'ignorews_url'):
496 ${c.ignorews_url(request, h.FID('', filediff.patch['filename']))}
496 ${c.ignorews_url(request, h.FID(filediff.raw_id, filediff.patch['filename']))}
497 %endif
497 %endif
498 %if hasattr(c, 'context_url'):
498 %if hasattr(c, 'context_url'):
499 ${c.context_url(request, h.FID('', filediff.patch['filename']))}
499 ${c.context_url(request, h.FID(filediff.raw_id, filediff.patch['filename']))}
500 %endif
500 %endif
501
501
502 %if use_comments:
502 %if use_comments:
@@ -721,7 +721,7 b' def get_comments_for(diff_type, comments'
721 <td>unknown diff mode</td>
721 <td>unknown diff mode</td>
722 </tr>
722 </tr>
723 % endif
723 % endif
724 </%def>
724 </%def>file changes
725
725
726
726
727 <%def name="render_add_comment_button()">
727 <%def name="render_add_comment_button()">
@@ -730,7 +730,7 b' def get_comments_for(diff_type, comments'
730 </button>
730 </button>
731 </%def>
731 </%def>
732
732
733 <%def name="render_diffset_menu(diffset=None)">
733 <%def name="render_diffset_menu(diffset=None, range_diff_on=None)">
734
734
735 <div class="diffset-menu clearinner">
735 <div class="diffset-menu clearinner">
736 <div class="pull-right">
736 <div class="pull-right">
@@ -747,6 +747,21 b' def get_comments_for(diff_type, comments'
747 title="${h.tooltip(_('View unified'))}" href="${h.current_route_path(request, diffmode='unified')}">
747 title="${h.tooltip(_('View unified'))}" href="${h.current_route_path(request, diffmode='unified')}">
748 <span>${_('Unified')}</span>
748 <span>${_('Unified')}</span>
749 </a>
749 </a>
750 % if range_diff_on is True:
751 <a
752 title="${_('Turn off: Show the diff as commit range')}"
753 class="btn btn-primary"
754 href="${h.current_route_path(request, **{"range-diff":"0"})}">
755 <span>${_('Range Diff')}</span>
756 </a>
757 % elif range_diff_on is False:
758 <a
759 title="${_('Show the diff as commit range')}"
760 class="btn"
761 href="${h.current_route_path(request, **{"range-diff":"1"})}">
762 <span>${_('Range Diff')}</span>
763 </a>
764 % endif
750 </div>
765 </div>
751 </div>
766 </div>
752
767
@@ -834,7 +849,7 b' def get_comments_for(diff_type, comments'
834 var preloadData = {
849 var preloadData = {
835 results: [
850 results: [
836 % for filediff in diffset.files:
851 % for filediff in diffset.files:
837 {id:"a_${h.FID('', filediff.patch['filename'])}",
852 {id:"a_${h.FID(filediff.raw_id, filediff.patch['filename'])}",
838 text:"${filediff.patch['filename']}",
853 text:"${filediff.patch['filename']}",
839 ops:${h.json.dumps(filediff.patch['stats'])|n}}${('' if loop.last else ',')}
854 ops:${h.json.dumps(filediff.patch['stats'])|n}}${('' if loop.last else ',')}
840 % endfor
855 % endfor
@@ -448,16 +448,6 b''
448 onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false">
448 onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false">
449 ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
449 ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
450 </a>
450 </a>
451 <%
452 range_commit_id = '{}...{}'.format(c.commit_ranges[-1].raw_id, c.commit_ranges[0].raw_id)
453 %>
454 <a
455 class="btn"
456 href="${request.route_path('repo_commit', repo_name=c.source_repo.repo_name, commit_id=range_commit_id)}"
457 >
458 ${_('Show range diff')}
459 </a>
460
461 </div>
451 </div>
462 </div>
452 </div>
463
453
@@ -578,13 +568,28 b''
578
568
579 <div class="cs_files">
569 <div class="cs_files">
580 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
570 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
581 ${cbdiffs.render_diffset_menu(c.diffset)}
571
582 ${cbdiffs.render_diffset(
572 ${cbdiffs.render_diffset_menu(c.diffset, range_diff_on=c.range_diff_on)}
583 c.diffset, use_comments=True,
573
584 collapse_when_files_over=30,
574 % if c.range_diff_on:
585 disable_new_comments=not c.allowed_to_comment,
575 % for commit in c.commit_ranges:
586 deleted_files_comments=c.deleted_files_comments,
576 ${cbdiffs.render_diffset(
587 inline_comments=c.inline_comments)}
577 c.changes[commit.raw_id],
578 commit=commit, use_comments=True,
579 collapse_when_files_over=5,
580 disable_new_comments=True,
581 deleted_files_comments=c.deleted_files_comments,
582 inline_comments=c.inline_comments)}
583 % endfor
584 % else:
585 ${cbdiffs.render_diffset(
586 c.diffset, use_comments=True,
587 collapse_when_files_over=30,
588 disable_new_comments=not c.allowed_to_comment,
589 deleted_files_comments=c.deleted_files_comments,
590 inline_comments=c.inline_comments)}
591 % endif
592
588 </div>
593 </div>
589 % else:
594 % else:
590 ## skipping commits we need to clear the view for missing commits
595 ## skipping commits we need to clear the view for missing commits
General Comments 0
You need to be logged in to leave comments. Login now