Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
drupalorg
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupalorg
Commits
afa17fdd
Commit
afa17fdd
authored
3 weeks ago
by
Neil Drumm
Browse files
Options
Downloads
Patches
Plain Diff
Also wait for preparing merge status, log what does happen
parent
0594b4f2
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
drupalorg/includes/DrupalorgIssueFork.php
+11
-5
11 additions, 5 deletions
drupalorg/includes/DrupalorgIssueFork.php
with
11 additions
and
5 deletions
drupalorg/includes/DrupalorgIssueFork.php
+
11
−
5
View file @
afa17fdd
...
...
@@ -591,9 +591,10 @@ class DrupalorgIssueFork extends Entity {
* Number of microseconds to wait between polling requests.
*
* @return bool
* If the merge request can currently be merged.
* Detailed merge status from
* https://docs.gitlab.com/api/merge_requests/#merge-status
*/
public
function
mergeRequestC
anBeMerged
(
$iid
,
$poll_delay
=
10000
)
{
public
function
mergeRequestC
heckStatus
(
$iid
,
$poll_delay
=
10000
)
{
/* todo use when https://github.com/GitLabPHP/Client/pull/588 lands, and watch out for https://github.com/GitLabPHP/Client/issues/573
$client = versioncontrol_gitlab_get_client()->api('merge_requests');
$project_repository = versioncontrol_project_repository_load($this->project_nid);
...
...
@@ -608,10 +609,11 @@ class DrupalorgIssueFork extends Entity {
'with_merge_status_recheck'
=>
TRUE
,
]));
timer_start
(
'merge_status_check'
);
while
(
in_array
((
$merge_status
=
$this
->
fetchMergeRequestInfo
(
$iid
)[
'detailed_merge_status'
]),
[
'unchecked'
,
'checking'
])
&&
timer_read
(
'merge_status_check'
)
<
60
*
1000
)
{
usleep
(
$poll_delay
);
while
(
in_array
((
$merge_status
=
$this
->
fetchMergeRequestInfo
(
$iid
)[
'detailed_merge_status'
]),
[
'unchecked'
,
'checking'
,
'preparing'
])
&&
timer_read
(
'merge_status_check'
)
<
60
*
1000
)
{
usleep
(
$poll_delay
);
}
return
$merge_status
===
'mergeable'
;
return
$merge_status
;
}
/**
...
...
@@ -653,8 +655,12 @@ class DrupalorgIssueFork extends Entity {
return
FALSE
;
}
// Wait for merge status rechecking.
if
(
!
$this
->
mergeRequestCanBeMerged
(
$iid
))
{
$merge_status
=
$this
->
mergeRequestCheckStatus
(
$iid
);
if
(
$merge_status
!==
'mergeable'
)
{
drupal_set_message
(
t
(
'Merge request can not be merged.'
),
'error'
);
throw
new
Exception
(
format_string
(
'detailed_merge_status is <pre>@merge_status</pre>'
,
[
'@merge_status'
=>
$merge_status
,
]));
return
FALSE
;
}
// Merge.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment