mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
- also freeze if 'up -e' fails, code cleanup
This commit is contained in:
parent
14288a9468
commit
151b9b699d
@ -2409,27 +2409,34 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if len(pacs) > 1:
|
||||
print 'Updating %s' % p.name
|
||||
|
||||
if opts.expand_link and p.haslinkerror() and not p.islinkrepair():
|
||||
raise oscerr.LinkExpandError(p.prjname, p.name, p.linkerror())
|
||||
# FIXME: ugly workaround for #399247
|
||||
if opts.expand_link or opts.unexpand_link:
|
||||
if [ i for i in p.filenamelist+p.filenamelist_unvers if p.status(i) != ' ' and p.status(i) != '?']:
|
||||
print >>sys.stderr, 'osc: cannot expand/unexpand because your working ' \
|
||||
'copy has local modifications.\nPlease revert/commit them ' \
|
||||
'and try again.'
|
||||
sys.exit(1)
|
||||
|
||||
if not rev:
|
||||
if opts.expand_link and p.islink() and not p.isexpanded():
|
||||
print 'Expanding to rev', p.linkinfo.xsrcmd5
|
||||
rev = p.linkinfo.xsrcmd5
|
||||
if p.haslinkerror():
|
||||
try:
|
||||
rev = show_upstream_xsrcmd5(p.apiurl, p.prjname, p.name, revision=p.rev)
|
||||
except:
|
||||
rev = show_upstream_xsrcmd5(p.apiurl, p.prjname, p.name, revision=p.rev, linkrev="base")
|
||||
p.mark_frozen()
|
||||
else:
|
||||
rev = p.linkinfo.xsrcmd5
|
||||
print 'Expanding to rev', rev
|
||||
elif opts.unexpand_link and p.islink() and p.isexpanded():
|
||||
print 'Unexpanding to rev', p.linkinfo.lsrcmd5
|
||||
rev = p.linkinfo.lsrcmd5
|
||||
elif p.islink() and p.isexpanded():
|
||||
rev = p.latest_rev()
|
||||
|
||||
# FIXME: ugly workaround for #399247
|
||||
if opts.expand_link or opts.unexpand_link:
|
||||
if [ i for i in p.filenamelist+p.filenamelist_unvers if p.status(i) != ' ' and p.status(i) != '?']:
|
||||
print >>sys.stderr, 'osc: cannot expand/unexpand because your working ' \
|
||||
'copy has local modifications. Please remove them ' \
|
||||
'and try again'
|
||||
sys.exit(1)
|
||||
p.update(rev, service_files)
|
||||
if opts.unexpand_link:
|
||||
p.unmark_frozen()
|
||||
rev = None
|
||||
print_request_list(p.apiurl, p.prjname, p.name)
|
||||
|
||||
@ -4607,8 +4614,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
raise oscerr.APIError('link target is broken')
|
||||
if linkinfo_new.get('srcmd5') == baserev:
|
||||
print "Already up-to-date."
|
||||
if os.path.exists(os.path.join(p.storedir, '_frozenlink')):
|
||||
os.unlink(os.path.join(p.storedir, '_frozenlink'))
|
||||
p.unmark_frozen()
|
||||
return
|
||||
dir_new = { 'apiurl': p.apiurl, 'project': p.prjname, 'package': p.name }
|
||||
dir_new['srcmd5'] = root_new.get('srcmd5')
|
||||
@ -4680,8 +4686,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
p.write_conflictlist()
|
||||
# store new linkrev
|
||||
store_write_string(p.absdir, '_pulled', linkinfo_new.get('srcmd5'))
|
||||
if os.path.exists(os.path.join(p.storedir, '_frozenlink')):
|
||||
os.unlink(os.path.join(p.storedir, '_frozenlink'))
|
||||
p.unmark_frozen()
|
||||
print
|
||||
if len(p.in_conflict):
|
||||
print 'Please fix the conflicts (files marked with \'C\' above),'
|
||||
|
31
osc/core.py
31
osc/core.py
@ -1262,6 +1262,18 @@ rev: %s
|
||||
|
||||
mf.discard()
|
||||
|
||||
def mark_frozen(self):
|
||||
store_write_string(self.absdir, '_frozenlink', '')
|
||||
print
|
||||
print "The link in this package is currently broken. I have checked"
|
||||
print "out the last working version instead, please use 'osc pull'"
|
||||
print "to repair the link."
|
||||
print
|
||||
|
||||
def unmark_frozen(self):
|
||||
if os.path.exists(os.path.join(self.storedir, '_frozenlink')):
|
||||
os.unlink(os.path.join(self.storedir, '_frozenlink'))
|
||||
|
||||
def latest_rev(self):
|
||||
if self.islinkrepair():
|
||||
upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrepair=1)
|
||||
@ -1272,13 +1284,11 @@ rev: %s
|
||||
try:
|
||||
upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name)
|
||||
except:
|
||||
upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrev=self.linkinfo.srcmd5)
|
||||
store_write_string(self.absdir, '_frozenlink', '')
|
||||
print
|
||||
print "The link in this package is currently broken. I have checked"
|
||||
print "out the last working version instead, please use 'osc pull'"
|
||||
print "to repair the link."
|
||||
print
|
||||
try:
|
||||
upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrev=self.linkinfo.srcmd5)
|
||||
except:
|
||||
upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrev="base")
|
||||
self.mark_frozen()
|
||||
else:
|
||||
upstream_rev = show_upstream_rev(self.apiurl, self.prjname, self.name)
|
||||
return upstream_rev
|
||||
@ -3034,12 +3044,7 @@ def checkout_package(apiurl, project, package,
|
||||
os.chdir(os.pardir)
|
||||
p = Package(package)
|
||||
if isfrozen:
|
||||
store_write_string(p.absdir, '_frozenlink', '')
|
||||
print
|
||||
print "The link in this package is currently broken. I have checked"
|
||||
print "out the last working version instead, please use 'osc pull'"
|
||||
print "to repair the link."
|
||||
print
|
||||
p.mark_frozen()
|
||||
for filename in p.filenamelist:
|
||||
if service_files or not filename.startswith('_service:'):
|
||||
p.updatefile(filename, revision)
|
||||
|
Loading…
Reference in New Issue
Block a user