1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 22:56:15 +01:00

Merge pull request #606 from adrianschroeter/maint_enforce_branch

allow implicit branch on maintenance request creation
This commit is contained in:
Marco Strigl 2019-07-25 13:46:58 +02:00 committed by GitHub
commit 5c75566d22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 6 deletions

4
NEWS
View File

@ -1,5 +1,5 @@
0.166
-
0.166.0
- allow optional fork when creating a maintenance request
0.165.3
- switch to difflib.diff_bytes and sys.stdout.buffer.write for diffing.

View File

@ -3185,6 +3185,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
help='specify message TEXT')
@cmdln.option('--release-project', metavar='RELEASEPROJECT',
help='Specify the release project')
@cmdln.option('--enforce-branching', action='store_true',
help='submit from a fresh branched project')
@cmdln.option('--no-cleanup', action='store_true',
help='do not remove source project on accept')
@cmdln.option('--cleanup', action='store_true',
@ -3286,7 +3288,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
target_project,
None) # unspecified release project
r = create_maintenance_request(apiurl, source_project, source_packages, target_project, release_project, opt_sourceupdate, opts.message)
r = create_maintenance_request(apiurl, source_project, source_packages, target_project, release_project, opt_sourceupdate, opts.message, opts.enforce_branching)
print(r.reqid)
if supersede_existing:

View File

@ -3049,11 +3049,13 @@ class Request:
def __cmp__(self, other):
return cmp(int(self.reqid), int(other.reqid))
def create(self, apiurl, addrevision=False):
def create(self, apiurl, addrevision=False, enforce_branching=False):
"""create a new request"""
query = {'cmd' : 'create' }
if addrevision:
query['addrevision'] = "1"
if enforce_branching:
query['enforce_branching'] = "1"
u = makeurl(apiurl, ['request'], query=query)
f = http_POST(u, data=self.to_str())
root = ET.fromstring(f.read())
@ -4179,7 +4181,7 @@ def create_release_request(apiurl, src_project, message=''):
return r
# create a maintenance incident per request
def create_maintenance_request(apiurl, src_project, src_packages, tgt_project, tgt_releaseproject, opt_sourceupdate, message=''):
def create_maintenance_request(apiurl, src_project, src_packages, tgt_project, tgt_releaseproject, opt_sourceupdate, message='', enforce_branching=False):
import cgi
r = Request()
if src_packages:
@ -4189,7 +4191,7 @@ def create_maintenance_request(apiurl, src_project, src_packages, tgt_project, t
r.add_action('maintenance_incident', src_project=src_project, tgt_project=tgt_project, tgt_releaseproject=tgt_releaseproject, opt_sourceupdate = opt_sourceupdate)
# XXX: clarify why we need the unicode(...) stuff
r.description = cgi.escape(unicode(message, 'utf8'))
r.create(apiurl, addrevision=True)
r.create(apiurl, addrevision=True, enforce_branching=enforce_branching)
return r
def create_submit_request(apiurl,