1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-11 16:36:14 +01:00

- added "lock" command to lock a project or package

This commit is contained in:
Marcus Huewe 2015-05-30 16:27:54 +02:00
parent 56a9ab60dc
commit 4dc236dea4

View File

@ -3321,6 +3321,33 @@ Please submit there instead, or use --nodevelproject to force direct submission.
delete_project(apiurl, prj, opts.force, msg)
def do_lock(self, subcmd, opts, project, package=None):
"""${cmd_name}: Locks a project or package.
usage:
osc lock PROJECT [PACKAGE]
${cmd_option_list}
"""
apiurl = self.get_api_url()
kind = 'prj'
path_args = (project,)
if package is not None:
kind = 'pkg'
path_args = (project, package)
meta = meta_exists(kind, path_args, create_new=False, apiurl=apiurl)
root = ET.fromstring(''.join(meta))
if root.find('lock') is not None:
print('Already locked', file=sys.stderr)
sys.exit(1)
# alternatively, we could also use the set_flag api call
# instead of manually manipulating the xml
lock = ET.SubElement(root, 'lock')
ET.SubElement(lock, 'enable')
meta = ET.tostring(root)
edit_meta(kind, path_args=path_args, data=meta)
@cmdln.option('-m', '--message', metavar='TEXT',
help='specify log message TEXT')
def do_unlock(self, subcmd, opts, *args):