Show More
@@ -248,6 +248,7 b' class RepoPullRequestsView(RepoAppView, ' | |||
|
248 | 248 | from_version = self.request.GET.get('from_version') or version |
|
249 | 249 | merge_checks = self.request.GET.get('merge_checks') |
|
250 | 250 | c.fulldiff = str2bool(self.request.GET.get('fulldiff')) |
|
251 | force_refresh = str2bool(self.request.GET.get('force_refresh')) | |
|
251 | 252 | |
|
252 | 253 | (pull_request_latest, |
|
253 | 254 | pull_request_at_ver, |
@@ -339,7 +340,7 b' class RepoPullRequestsView(RepoAppView, ' | |||
|
339 | 340 | # check merge capabilities |
|
340 | 341 | _merge_check = MergeCheck.validate( |
|
341 | 342 | pull_request_latest, user=self._rhodecode_user, |
|
342 | translator=self.request.translate) | |
|
343 | translator=self.request.translate, force_shadow_repo_refresh=force_refresh) | |
|
343 | 344 | c.pr_merge_errors = _merge_check.error_details |
|
344 | 345 | c.pr_merge_possible = not _merge_check.failed |
|
345 | 346 | c.pr_merge_message = _merge_check.merge_msg |
@@ -1211,7 +1211,8 b' class PullRequestModel(BaseModel):' | |||
|
1211 | 1211 | |
|
1212 | 1212 | return comment, status |
|
1213 | 1213 | |
|
1214 |
def merge_status(self, pull_request, translator=None |
|
|
1214 | def merge_status(self, pull_request, translator=None, | |
|
1215 | force_shadow_repo_refresh=False): | |
|
1215 | 1216 | _ = translator or get_current_request().translate |
|
1216 | 1217 | |
|
1217 | 1218 | if not self._is_merge_enabled(pull_request): |
@@ -1225,7 +1226,9 b' class PullRequestModel(BaseModel):' | |||
|
1225 | 1226 | return merge_possible, msg |
|
1226 | 1227 | |
|
1227 | 1228 | try: |
|
1228 |
resp = self._try_merge( |
|
|
1229 | resp = self._try_merge( | |
|
1230 | pull_request, | |
|
1231 | force_shadow_repo_refresh=force_shadow_repo_refresh) | |
|
1229 | 1232 | log.debug("Merge response: %s", resp) |
|
1230 | 1233 | status = resp.possible, self.merge_status_message( |
|
1231 | 1234 | resp.failure_reason) |
@@ -1262,13 +1265,13 b' class PullRequestModel(BaseModel):' | |||
|
1262 | 1265 | 'extensions', 'largefiles') |
|
1263 | 1266 | return largefiles_ui and largefiles_ui[0].active |
|
1264 | 1267 | |
|
1265 | def _try_merge(self, pull_request): | |
|
1268 | def _try_merge(self, pull_request, force_shadow_repo_refresh=False): | |
|
1266 | 1269 | """ |
|
1267 | 1270 | Try to merge the pull request and return the merge status. |
|
1268 | 1271 | """ |
|
1269 | 1272 | log.debug( |
|
1270 | "Trying out if the pull request %s can be merged.", | |
|
1271 | pull_request.pull_request_id) | |
|
1273 | "Trying out if the pull request %s can be merged. Force_refresh=%s", | |
|
1274 | pull_request.pull_request_id, force_shadow_repo_refresh) | |
|
1272 | 1275 | target_vcs = pull_request.target_repo.scm_instance() |
|
1273 | 1276 | |
|
1274 | 1277 | # Refresh the target reference. |
@@ -1285,7 +1288,8 b' class PullRequestModel(BaseModel):' | |||
|
1285 | 1288 | log.debug("The target repository is locked.") |
|
1286 | 1289 | merge_state = MergeResponse( |
|
1287 | 1290 | False, False, None, MergeFailureReason.TARGET_IS_LOCKED) |
|
1288 |
elif self._needs_merge_state_refresh( |
|
|
1291 | elif force_shadow_repo_refresh or self._needs_merge_state_refresh( | |
|
1292 | pull_request, target_ref): | |
|
1289 | 1293 | log.debug("Refreshing the merge status of the repository.") |
|
1290 | 1294 | merge_state = self._refresh_merge_state( |
|
1291 | 1295 | pull_request, target_vcs, target_ref) |
@@ -1575,7 +1579,8 b' class MergeCheck(object):' | |||
|
1575 | 1579 | ) |
|
1576 | 1580 | |
|
1577 | 1581 | @classmethod |
|
1578 |
def validate(cls, pull_request, user, translator, fail_early=False |
|
|
1582 | def validate(cls, pull_request, user, translator, fail_early=False, | |
|
1583 | force_shadow_repo_refresh=False): | |
|
1579 | 1584 | _ = translator |
|
1580 | 1585 | merge_check = cls() |
|
1581 | 1586 | |
@@ -1626,7 +1631,8 b' class MergeCheck(object):' | |||
|
1626 | 1631 | |
|
1627 | 1632 | # merge possible |
|
1628 | 1633 | merge_status, msg = PullRequestModel().merge_status( |
|
1629 |
pull_request, translator=translator |
|
|
1634 | pull_request, translator=translator, | |
|
1635 | force_shadow_repo_refresh=force_shadow_repo_refresh) | |
|
1630 | 1636 | merge_check.merge_possible = merge_status |
|
1631 | 1637 | merge_check.merge_msg = msg |
|
1632 | 1638 | if not merge_status: |
General Comments 0
You need to be logged in to leave comments.
Login now