##// END OF EJS Templates
default-reviewers: handle no common ancestor case.
marcink -
r4520:10c5ceba stable
parent child
Show More
@@ -72,11 +72,18 class RepoReviewRulesView(RepoAppView):
72 72 target_type = request.GET['target_ref_type']
73 73 target_name = request.GET['target_ref_name']
74 74
75 review_data = get_default_reviewers_data(
76 current_user,
77 source_repo,
78 Reference(source_type, source_name, source_commit_id),
79 target_repo,
80 Reference(target_type, target_name, target_commit_id)
81 )
75 try:
76 review_data = get_default_reviewers_data(
77 current_user,
78 source_repo,
79 Reference(source_type, source_name, source_commit_id),
80 target_repo,
81 Reference(target_type, target_name, target_commit_id)
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 89 return review_data
@@ -332,7 +332,10 window.ReviewersController = function ()
332 332
333 333 // review rules
334 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 340 for (var i = 0; i < data.reviewers.length; i++) {
338 341 var reviewer = data.reviewers[i];
@@ -473,7 +476,7 window.ReviewersController = function ()
473 476 };
474 477
475 478 this.handleDiffData = function (data) {
476 self.diffDataHandler(data)
479 return self.diffDataHandler(data)
477 480 }
478 481 };
479 482
@@ -309,6 +309,13
309 309 var codeMirrorInstance = $('#pullrequest_desc').get(0).MarkupForm.cm;
310 310
311 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 320 var commitElements = data['commits'];
314 321 var files = data['files'];
@@ -395,7 +402,8
395 402 }
396 403
397 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 409 reviewersController = new ReviewersController();
General Comments 0
You need to be logged in to leave comments. Login now