Commit 8e55b9e2 authored by Lorenz Huedepohl's avatar Lorenz Huedepohl
Browse files

Option --private in mpcdf_sync_projects

parent bcf4e44f
......@@ -563,7 +563,7 @@ def set_as_branch(api_url, my_project, my_package, main_project, main_package):
return True
def sync_projects(api_url, package=None, from_project="software", to_projects=None, redo_all=False):
def sync_projects(api_url, package=None, from_project="software", to_projects=None, redo_all=False, add_to_maintainers=True):
if package is not None and redo_all:
raise osc.oscerr.WrongArgs('Cannot specify `redo_all` and package')
......@@ -612,18 +612,19 @@ def sync_projects(api_url, package=None, from_project="software", to_projects=No
continue
set_attribute(api_url, to_project, orig_package, attr)
from_maintainers = maintainers(api_url, from_project, orig_package)
if from_maintainers:
to_maintainers = maintainers(api_url, to_project, orig_package)
if from_maintainers - to_maintainers:
new_maintainers = from_maintainers - to_maintainers
to_meta = package_meta(api_url, to_project, orig_package)
for userid in new_maintainers:
person = ElementTree.Element("person")
person.set("userid", userid)
person.set("role", "maintainer")
to_meta.insert(2, person)
osc.core.edit_meta("pkg", (to_project, orig_package), data=ElementTree.tostring(to_meta))
if add_to_maintainers:
from_maintainers = maintainers(api_url, from_project, orig_package)
if from_maintainers:
to_maintainers = maintainers(api_url, to_project, orig_package)
if from_maintainers - to_maintainers:
new_maintainers = from_maintainers - to_maintainers
to_meta = package_meta(api_url, to_project, orig_package)
for userid in sorted(new_maintainers):
person = ElementTree.Element("person")
person.set("userid", userid)
person.set("role", "maintainer")
to_meta.insert(2, person)
osc.core.edit_meta("pkg", (to_project, orig_package), data=ElementTree.tostring(to_meta))
if package is None and redo_all:
# Check if distribution is already set in to_project
......
......@@ -15,6 +15,8 @@ import osc.cmdln
help="Source project")
@osc.cmdln.option('-t', '--to',
help="Just sync with this single destination project")
@osc.cmdln.option('-p', '--private', action="store_true", default=False,
help="Do not copy over maintainer field (for test projects)")
@osc.cmdln.alias("mpcdf_sync_proj")
def do_mpcdf_sync_projects(self, subcmd, opts, *args):
"""${cmd_name}: Branch all/missing packages from a project to another and sync their metadata
......@@ -54,4 +56,6 @@ def do_mpcdf_sync_projects(self, subcmd, opts, *args):
else:
to_projects = None
mpcdf_common.sync_projects(api_url, package, from_project=from_project, to_projects=to_projects, redo_all=opts.all)
mpcdf_common.sync_projects(api_url, package,
from_project=from_project, to_projects=to_projects, redo_all=opts.all,
add_to_maintainers=not opts.private)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment