1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-09 22:36:14 +01:00

Merge branch 'fix_detachbranch' of https://github.com/adrianschroeter/osc

Fix/Workaround for "osc detachbranch" in case of a missing link target
(in this case, the _link file is removed; an alternative would be to
fall back to the last working rev). Also improve the Linkinfo.is_link
check.
This commit is contained in:
Marcus Huewe 2021-09-16 18:51:07 +02:00
commit db2e489cce
2 changed files with 9 additions and 2 deletions

View File

@ -2855,7 +2855,14 @@ Please submit there instead, or use --nodevelproject to force direct submission.
li = Linkinfo()
li.read(root.find('linkinfo'))
if li.islink() and li.haserror():
raise oscerr.LinkExpandError(project, package, li.error)
try:
show_package_meta(apiurl, li.project, li.package)
except HTTPError as e:
if e.code == 404:
print("Link target got removed, dropping link. WARNING: latest submissions in link target might be lost!")
delete_files(apiurl, project, package, ['_link'])
else:
raise oscerr.LinkExpandError(project, package, li.error)
elif not li.islink():
print('package \'%s/%s\' is no link' % (project, package), file=sys.stderr)
else:

View File

@ -540,7 +540,7 @@ class Linkinfo:
def islink(self):
"""returns True if the linkinfo is not empty, otherwise False"""
if self.xsrcmd5 or self.lsrcmd5:
if self.xsrcmd5 or self.lsrcmd5 or self.error is not None:
return True
return False