repoactive 0.2.7__tar.gz → 0.2.8.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/PKG-INFO +1 -1
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/pyproject.toml +1 -1
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/src/repoactive/platforms/gitlab.py +29 -13
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/.gitignore +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/LICENSE +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/README.md +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/src/repoactive/__init__.py +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/src/repoactive/boxquote.py +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/src/repoactive/cli.py +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/src/repoactive/config.py +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/src/repoactive/constants.py +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/src/repoactive/graph.py +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/src/repoactive/jj.py +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/src/repoactive/jobtree.py +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/src/repoactive/lock.py +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/src/repoactive/platforms/__init__.py +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/src/repoactive/platforms/base.py +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/src/repoactive/platforms/github.py +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/src/repoactive/progress.py +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/src/repoactive/runner.py +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/src/repoactive/selection.py +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/src/repoactive/settings.py +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/src/repoactive/trailers.py +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/src/repoactive/ui.py +0 -0
- {repoactive-0.2.7 → repoactive-0.2.8.dev1}/src/repoactive/updates.py +0 -0
|
@@ -11,14 +11,16 @@ from repoactive.platforms.base import MRParams, Platform, PlatformError
|
|
|
11
11
|
_DRAFT_PREFIX = "Draft: "
|
|
12
12
|
|
|
13
13
|
# detailed_merge_status / merge_status values that mean GitLab's async
|
|
14
|
-
# mergeability check hasn't finished yet.
|
|
15
|
-
#
|
|
14
|
+
# mergeability check hasn't finished yet. On GitLab without the auto_merge
|
|
15
|
+
# parameter (< 17.11), setting auto-merge while the check is pending returns
|
|
16
|
+
# 422 "Branch cannot be merged".
|
|
16
17
|
_MERGE_CHECK_PENDING = frozenset({"unchecked", "checking", "preparing"})
|
|
17
18
|
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
19
|
+
# Fallback for GitLab without the auto_merge parameter: a freshly created MR is
|
|
20
|
+
# not immediately ready for merge_when_pipeline_succeeds because GitLab runs
|
|
21
|
+
# the mergeability check and creates the MR pipeline in the background. Poll
|
|
22
|
+
# for that to settle, bounded by this timeout; the next run re-attempts if it
|
|
23
|
+
# never does.
|
|
22
24
|
_AUTO_MERGE_TIMEOUT = 60.0
|
|
23
25
|
_AUTO_MERGE_POLL_INTERVAL = 3.0
|
|
24
26
|
|
|
@@ -92,13 +94,27 @@ class GitLabPlatform(Platform):
|
|
|
92
94
|
return web_url
|
|
93
95
|
|
|
94
96
|
def _enable_auto_merge(self, mr: ProjectMergeRequest) -> None:
|
|
95
|
-
"""
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
"""Enable auto-merge on ``mr``, falling back to a readiness poll.
|
|
98
|
+
|
|
99
|
+
The merge call sends both auto-merge parameters. On GitLab >= 17.11
|
|
100
|
+
``auto_merge`` selects the "merge when checks pass" strategy, which is
|
|
101
|
+
accepted while the mergeability check is still running and needs no
|
|
102
|
+
pipeline, so the first call normally succeeds right away. Older GitLab
|
|
103
|
+
ignores the unknown parameter and honors the deprecated
|
|
104
|
+
merge_when_pipeline_succeeds, which is rejected until the check is
|
|
105
|
+
done and a pipeline exists; when the first call is rejected, poll the
|
|
106
|
+
MR (re-fetched, since list/create payloads omit head_pipeline) until
|
|
107
|
+
it is ready or the timeout passes and retry once. A repo with no CI
|
|
108
|
+
never grows a pipeline; there the poll times out and the final call
|
|
109
|
+
merges immediately, the best available behavior.
|
|
101
110
|
"""
|
|
111
|
+
try:
|
|
112
|
+
mr.merge(merge_when_pipeline_succeeds=True, auto_merge=True)
|
|
113
|
+
return
|
|
114
|
+
except GitlabMRClosedError:
|
|
115
|
+
# python-gitlab wraps every merge failure in GitlabMRClosedError;
|
|
116
|
+
# this is the 422/405 "not ready yet" case, not a closed MR.
|
|
117
|
+
pass
|
|
102
118
|
iid = mr.iid
|
|
103
119
|
deadline = time.monotonic() + _AUTO_MERGE_TIMEOUT
|
|
104
120
|
while True:
|
|
@@ -107,6 +123,6 @@ class GitLabPlatform(Platform):
|
|
|
107
123
|
break
|
|
108
124
|
time.sleep(_AUTO_MERGE_POLL_INTERVAL)
|
|
109
125
|
try:
|
|
110
|
-
mr.merge(merge_when_pipeline_succeeds=True)
|
|
126
|
+
mr.merge(merge_when_pipeline_succeeds=True, auto_merge=True)
|
|
111
127
|
except GitlabMRClosedError as e:
|
|
112
128
|
print(f" warning: could not enable auto-merge ({e})")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|