Show More
@@ -72,6 +72,7 b' class RepoReviewRulesView(RepoAppView):' | |||||
72 | target_type = request.GET['target_ref_type'] |
|
72 | target_type = request.GET['target_ref_type'] | |
73 | target_name = request.GET['target_ref_name'] |
|
73 | target_name = request.GET['target_ref_name'] | |
74 |
|
74 | |||
|
75 | try: | |||
75 | review_data = get_default_reviewers_data( |
|
76 | review_data = get_default_reviewers_data( | |
76 | current_user, |
|
77 | current_user, | |
77 | source_repo, |
|
78 | source_repo, | |
@@ -79,4 +80,10 b' class RepoReviewRulesView(RepoAppView):' | |||||
79 | target_repo, |
|
80 | target_repo, | |
80 | Reference(target_type, target_name, target_commit_id) |
|
81 | Reference(target_type, target_name, target_commit_id) | |
81 | ) |
|
82 | ) | |
|
83 | except ValueError: | |||
|
84 | # No common ancestor | |||
|
85 | msg = "No Common ancestor found between target and source reference" | |||
|
86 | log.exception(msg) | |||
|
87 | return {'diff_info': {'error': msg}} | |||
|
88 | ||||
82 | return review_data |
|
89 | return review_data |
@@ -332,7 +332,10 b' window.ReviewersController = function ()' | |||||
332 |
|
332 | |||
333 | // review rules |
|
333 | // review rules | |
334 | self.loadReviewRules(data); |
|
334 | self.loadReviewRules(data); | |
335 | self.handleDiffData(data["diff_info"]); |
|
335 | var diffHandled = self.handleDiffData(data["diff_info"]); | |
|
336 | if (diffHandled === false) { | |||
|
337 | return | |||
|
338 | } | |||
336 |
|
339 | |||
337 | for (var i = 0; i < data.reviewers.length; i++) { |
|
340 | for (var i = 0; i < data.reviewers.length; i++) { | |
338 | var reviewer = data.reviewers[i]; |
|
341 | var reviewer = data.reviewers[i]; | |
@@ -473,7 +476,7 b' window.ReviewersController = function ()' | |||||
473 | }; |
|
476 | }; | |
474 |
|
477 | |||
475 | this.handleDiffData = function (data) { |
|
478 | this.handleDiffData = function (data) { | |
476 | self.diffDataHandler(data) |
|
479 | return self.diffDataHandler(data) | |
477 | } |
|
480 | } | |
478 | }; |
|
481 | }; | |
479 |
|
482 |
@@ -309,6 +309,13 b'' | |||||
309 | var codeMirrorInstance = $('#pullrequest_desc').get(0).MarkupForm.cm; |
|
309 | var codeMirrorInstance = $('#pullrequest_desc').get(0).MarkupForm.cm; | |
310 |
|
310 | |||
311 | var diffDataHandler = function(data) { |
|
311 | var diffDataHandler = function(data) { | |
|
312 | if (data['error'] !== undefined) { | |||
|
313 | var noCommitsMsg = '<span class="alert-text-error">{0}</span>'.format(data['error']); | |||
|
314 | prButtonLock(true, noCommitsMsg, 'compare'); | |||
|
315 | //make both panels equal | |||
|
316 | $('.target-panel').height($('.source-panel').height()) | |||
|
317 | return false | |||
|
318 | } | |||
312 |
|
319 | |||
313 | var commitElements = data['commits']; |
|
320 | var commitElements = data['commits']; | |
314 | var files = data['files']; |
|
321 | var files = data['files']; | |
@@ -395,7 +402,8 b'' | |||||
395 | } |
|
402 | } | |
396 |
|
403 | |||
397 | //make both panels equal |
|
404 | //make both panels equal | |
398 | $('.target-panel').height($('.source-panel').height()) |
|
405 | $('.target-panel').height($('.source-panel').height()); | |
|
406 | return true | |||
399 | }; |
|
407 | }; | |
400 |
|
408 | |||
401 | reviewersController = new ReviewersController(); |
|
409 | reviewersController = new ReviewersController(); |
General Comments 0
You need to be logged in to leave comments.
Login now