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

fix usage of linkrev in show_xsrcmd5 function.

make usage of linkrev=base options in setlinkrev.
This commit is contained in:
Adrian Schröter 2010-09-07 15:03:01 +02:00
parent 492edaa794
commit 36c0245e80
2 changed files with 22 additions and 6 deletions

View File

@ -1873,6 +1873,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
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('-b', '--use-baserev', action='store_true',
help='Use the revisions which exists when the original commit happend and don\'t try to merge later commits.')
@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):
@ -1890,7 +1892,8 @@ 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
use_baserev = None
use_xsrcmd5 = 1
if len(args) == 0:
p = findpacs(os.curdir)[0]
project = p.prjname
@ -1913,7 +1916,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
packages = meta_get_packagelist(apiurl, project)
if opts.use_plain_revision:
use_baserev = None
use_xsrcmd5 = None
if opts.use_baserev:
use_baserev = 1
for p in packages:
print "setting revision for package", p
@ -1921,7 +1926,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
rev=-1
else:
rev, dummy = parseRevisionOption(opts.revision)
set_link_rev(apiurl, project, p, revision = rev, use_baserev = use_baserev)
set_link_rev(apiurl, project, p, revision = rev, use_xsrcmd5 = use_xsrcmd5, use_baserev = use_baserev)
def do_linktobranch(self, subcmd, opts, *args):

View File

@ -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, use_baserev = None):
def set_link_rev(apiurl, project, package, revision = None, use_xsrcmd5 = None, use_baserev = None):
url = makeurl(apiurl, ['source', project, package, '_link'])
try:
f = http_GET(url)
@ -4873,8 +4873,19 @@ def set_link_rev(apiurl, project, package, revision = None, use_baserev = None):
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' )
if use_xsrcmd5:
if use_baserev:
try:
root.attrib['rev'] = show_upstream_xsrcmd5(apiurl, src_project, src_package, revision=root.attrib['rev'], linkrev='base' )
except oscerr.LinkExpandError, e:
e.osc_msg = 'Unable to merge packages via links from package \'%s\' for project \'%s\'. These revisions have never worked!' % (package, project)
raise
else:
try:
root.attrib['rev'] = show_upstream_xsrcmd5(apiurl, src_project, src_package, revision=root.attrib['rev'] )
except oscerr.LinkExpandError, e:
e.osc_msg = 'Unable to merge packages via links from package \'%s\' for project \'%s\'. Please try again using baserev to use source revisions when created the commits.' % (package, project)
raise
l = ET.tostring(root)
# upload _link file again