mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-02 09:46:16 +01:00
- set_link_rev: minor cleanup; baserev always implies expand=True
also renamed "xsrcmd5" keyword argument to "expand"
This commit is contained in:
parent
e247cf358c
commit
02726a6a07
@ -2050,10 +2050,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
args = slash_split(args)
|
args = slash_split(args)
|
||||||
apiurl = self.get_api_url()
|
apiurl = self.get_api_url()
|
||||||
package = None
|
package = None
|
||||||
xsrcmd5 = True
|
expand = True
|
||||||
baserev = False
|
baserev = False
|
||||||
if opts.use_plain_revision:
|
if opts.use_plain_revision:
|
||||||
xsrcmd5 = False
|
expand = False
|
||||||
if opts.use_baserev:
|
if opts.use_baserev:
|
||||||
baserev = True
|
baserev = True
|
||||||
|
|
||||||
@ -2084,7 +2084,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
for p in packages:
|
for p in packages:
|
||||||
print 'setting revision for package %s' % p
|
print 'setting revision for package %s' % p
|
||||||
set_link_rev(apiurl, project, p, revision=rev, xsrcmd5=xsrcmd5, baserev=baserev)
|
set_link_rev(apiurl, project, p, revision=rev, expand=expand, baserev=baserev)
|
||||||
|
|
||||||
|
|
||||||
def do_linktobranch(self, subcmd, opts, *args):
|
def do_linktobranch(self, subcmd, opts, *args):
|
||||||
|
16
osc/core.py
16
osc/core.py
@ -5453,7 +5453,7 @@ def search(apiurl, **kwargs):
|
|||||||
res[urlpath] = ET.parse(f).getroot()
|
res[urlpath] = ET.parse(f).getroot()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def set_link_rev(apiurl, project, package, revision='', xsrcmd5=False, baserev=False):
|
def set_link_rev(apiurl, project, package, revision='', expand=False, baserev=False):
|
||||||
"""
|
"""
|
||||||
updates the rev attribute of the _link xml. If revision is set to None
|
updates the rev attribute of the _link xml. If revision is set to None
|
||||||
the rev attribute is removed from the _link xml. If revision is set to ''
|
the rev attribute is removed from the _link xml. If revision is set to ''
|
||||||
@ -5469,22 +5469,16 @@ def set_link_rev(apiurl, project, package, revision='', xsrcmd5=False, baserev=F
|
|||||||
|
|
||||||
# set revision element
|
# set revision element
|
||||||
src_project = root.get('project', project)
|
src_project = root.get('project', project)
|
||||||
src_package = root.get('package')
|
src_package = root.get('package', package)
|
||||||
if src_project == None:
|
|
||||||
src_project = project
|
|
||||||
if src_package == None:
|
|
||||||
src_package = package
|
|
||||||
linkrev=None
|
linkrev=None
|
||||||
if baserev:
|
if baserev:
|
||||||
linkrev='base'
|
linkrev = 'base'
|
||||||
|
expand = True
|
||||||
if revision is None:
|
if revision is None:
|
||||||
if 'rev' in root.keys():
|
if 'rev' in root.keys():
|
||||||
del root.attrib['rev']
|
del root.attrib['rev']
|
||||||
elif xsrcmd5:
|
|
||||||
# don't use xsrcmd5 sum, because packages with links on remote instance do not have a linkinfo
|
|
||||||
revision = show_upstream_rev(apiurl, src_project, src_package, expand=True, linkrev=linkrev)
|
|
||||||
elif revision == '':
|
elif revision == '':
|
||||||
revision = show_upstream_rev(apiurl, src_project, src_package, linkrev=linkrev)
|
revision = show_upstream_rev(apiurl, src_project, src_package, linkrev=linkrev, expand=expand)
|
||||||
|
|
||||||
if revision:
|
if revision:
|
||||||
root.set('rev', revision)
|
root.set('rev', revision)
|
||||||
|
Loading…
Reference in New Issue
Block a user