mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-04 10:36:17 +01:00
osc submitreq: look up the develproject of the target, and if there is one,
don't create the request, unless forced with --nodevelproject.
This commit is contained in:
parent
7641ed0c8c
commit
5438e4023a
@ -402,6 +402,9 @@ class Osc(cmdln.Cmdln):
|
||||
help='specify message TEXT')
|
||||
@cmdln.option('-r', '--revision', metavar='REV',
|
||||
help='for "create", specify a certain source revision ID (the md5 sum)')
|
||||
@cmdln.option('--nodevelproject', action='store_true',
|
||||
help='do not follow a defined devel project ' \
|
||||
'(primary project where a package is developed)')
|
||||
def do_submitreq(self, subcmd, opts, *args):
|
||||
"""${cmd_name}: Handle requests to submit a package into another project
|
||||
|
||||
@ -462,6 +465,14 @@ class Osc(cmdln.Cmdln):
|
||||
dst_package = args[3]
|
||||
else:
|
||||
dst_package = src_package
|
||||
devloc = show_develproject(conf.config['apiurl'], dst_project, dst_package)
|
||||
if devloc and dst_project != devloc and not opts.nodevelproject:
|
||||
print """\
|
||||
Sorry, but a different project, %s, is defined as the place where development
|
||||
of the package %s primarily takes place.
|
||||
Please submit there instead, or use --nodevelproject to force direct submission.""" \
|
||||
% (devloc, dst_package)
|
||||
sys.exit(1)
|
||||
|
||||
elif cmd == 'list':
|
||||
project = args[0]
|
||||
|
@ -1544,6 +1544,14 @@ def show_package_meta(apiurl, prj, pac):
|
||||
raise
|
||||
|
||||
|
||||
def show_develproject(apiurl, prj, pac):
|
||||
m = show_package_meta(apiurl, prj, pac)
|
||||
try:
|
||||
return ET.parse(StringIO(''.join(m))).getroot().find('devel').get('project')
|
||||
except:
|
||||
return None
|
||||
|
||||
|
||||
def show_pattern_metalist(apiurl, prj):
|
||||
url = makeurl(apiurl, ['source', prj, '_pattern'])
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user