mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-25 03:32:15 +01:00
Go one step further with setlinkrev, use always xsrcmd5, even when given a normal revsion, except "-R" option is used.
This commit is contained in:
parent
10d999c479
commit
492edaa794
2
NEWS
2
NEWS
@ -1,6 +1,6 @@
|
||||
0.130
|
||||
- New "service" command to run source services locally or trigger a re-run on the server.
|
||||
- setlinkrev is setting now the revision to xsrcmd5 by default to avoid later breakage on indirect links
|
||||
- setlinkrev is setting now the revision to xsrcmd5 by default to avoid later breakage on indirect links by default.
|
||||
#
|
||||
# Feature which requires OBS 2.1
|
||||
#
|
||||
|
@ -1871,6 +1871,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
|
||||
@cmdln.option('-r', '--revision', metavar='rev',
|
||||
help='use the specified revision.')
|
||||
@cmdln.option('-R', '--use-plain-revision', action='store_true',
|
||||
help='Don\'t expand revsion based on baserev, the revision which was used when commit happened.')
|
||||
@cmdln.option('-u', '--unset', action='store_true',
|
||||
help='remove revision in link, it will point always to latest revision')
|
||||
def do_setlinkrev(self, subcmd, opts, *args):
|
||||
@ -1888,6 +1890,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
args = slash_split(args)
|
||||
apiurl = self.get_api_url()
|
||||
package = None
|
||||
use_baserev = 1
|
||||
if len(args) == 0:
|
||||
p = findpacs(os.curdir)[0]
|
||||
project = p.prjname
|
||||
@ -1909,13 +1912,16 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
else:
|
||||
packages = meta_get_packagelist(apiurl, project)
|
||||
|
||||
if opts.use_plain_revision:
|
||||
use_baserev = None
|
||||
|
||||
for p in packages:
|
||||
print "setting revision for package", p
|
||||
if opts.unset:
|
||||
rev=-1
|
||||
else:
|
||||
rev, dummy = parseRevisionOption(opts.revision)
|
||||
set_link_rev(apiurl, project, p, rev)
|
||||
set_link_rev(apiurl, project, p, revision = rev, use_baserev = use_baserev)
|
||||
|
||||
|
||||
def do_linktobranch(self, subcmd, opts, *args):
|
||||
|
11
osc/core.py
11
osc/core.py
@ -4854,7 +4854,7 @@ def search(apiurl, **kwargs):
|
||||
res[urlpath] = ET.parse(f).getroot()
|
||||
return res
|
||||
|
||||
def set_link_rev(apiurl, project, package, revision = None):
|
||||
def set_link_rev(apiurl, project, package, revision = None, use_baserev = None):
|
||||
url = makeurl(apiurl, ['source', project, package, '_link'])
|
||||
try:
|
||||
f = http_GET(url)
|
||||
@ -4864,15 +4864,18 @@ def set_link_rev(apiurl, project, package, revision = None):
|
||||
raise
|
||||
|
||||
# set revision element
|
||||
src_project = root.attrib['project']
|
||||
src_package = root.attrib['package']
|
||||
if not revision:
|
||||
src_project = root.attrib['project']
|
||||
src_package = root.attrib['package']
|
||||
root.attrib['rev'] = show_upstream_xsrcmd5(apiurl, src_project, src_package)
|
||||
root.attrib['rev'] = show_upstream_rev(apiurl, src_project, src_package)
|
||||
elif revision == -1:
|
||||
del root.attrib['rev']
|
||||
else:
|
||||
root.attrib['rev'] = revision
|
||||
|
||||
if use_baserev:
|
||||
root.attrib['rev'] = show_upstream_xsrcmd5(apiurl, src_project, src_package, revision=root.attrib['rev'], linkrev='base' )
|
||||
|
||||
l = ET.tostring(root)
|
||||
# upload _link file again
|
||||
http_PUT(url, data=l)
|
||||
|
Loading…
x
Reference in New Issue
Block a user