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

Merge pull request #1470 from dmach/fix-linkdiff

Fix 'linkdiff' command error 400: prj/pac/md5 not in repository
This commit is contained in:
Daniel Mach 2024-01-22 08:50:19 +01:00 committed by GitHub
commit 3d7f79b706
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4662,9 +4662,15 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if opts.link: if opts.link:
query = {'rev': 'latest'} query = {'rev': 'latest'}
if pacs: if pacs:
u = makeurl(pacs[0].apiurl, ['source', pacs[0].prjname, pacs[0].name], query=query) apiurl = pacs[0].apiurl
project = pacs[0].prjname
package = pacs[0].name
else: else:
u = makeurl(self.get_api_url(), ['source', args[0], args[1]], query=query) apiurl = self.get_api_url()
project = args[0]
package = args[1]
u = makeurl(apiurl, ['source', project, package], query=query)
f = http_GET(u) f = http_GET(u)
root = ET.parse(f).getroot() root = ET.parse(f).getroot()
linkinfo = root.find('linkinfo') linkinfo = root.find('linkinfo')
@ -4672,26 +4678,24 @@ Please submit there instead, or use --nodevelproject to force direct submission.
raise oscerr.APIError('package is not a source link') raise oscerr.APIError('package is not a source link')
baserev = linkinfo.get('baserev') baserev = linkinfo.get('baserev')
opts.revision = baserev opts.revision = baserev
if pacs:
print("diff working copy against last committed version\n") print(f"diff committed package against linked revision {baserev}\n")
else: run_pager(
print(f"diff committed package against linked revision {baserev}\n") highlight_diff(
run_pager( server_diff(
highlight_diff( self.get_api_url(),
server_diff( linkinfo.get("project"),
self.get_api_url(), linkinfo.get("package"),
linkinfo.get("project"), baserev,
linkinfo.get("package"), project,
baserev, package,
args[0], linkinfo.get("lsrcmd5"),
args[1], not opts.plain,
linkinfo.get("lsrcmd5"), opts.missingok,
not opts.plain,
opts.missingok,
)
) )
) )
return )
return
if opts.change: if opts.change:
try: try: