1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-24 00:56:15 +01:00

- do_update: rewrote code path for expanding/unexpanding a wc

The way for determining the revision was completely "wrong".
This commit is contained in:
Marcus Huewe 2012-03-28 23:14:28 +02:00
parent 25c4cb1cc1
commit e2aa5cc65c
2 changed files with 5 additions and 14 deletions

View File

@ -4035,20 +4035,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if not rev:
if opts.expand_link and p.islink() and not p.isexpanded():
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:
p.update(rev, opts.server_side_source_service_files, opts.limit_size)
rev = p.linkinfo.xsrcmd5
rev = p.latest_rev(expand=True)
print 'Expanding to rev', rev
elif opts.unexpand_link and p.islink() and p.isexpanded():
p.update(rev, opts.server_side_source_service_files, opts.limit_size)
# XXX: calling update again is redundant (see below)
rev = p.rev
rev = show_upstream_rev(p.apiurl, p.prjname, p.name, meta=p.meta)
print 'Unexpanding to rev', rev
elif (p.islink() and p.isexpanded()) or opts.server_side_source_service_files:
rev = p.latest_rev(include_service_files=opts.server_side_source_service_files)

View File

@ -1820,10 +1820,11 @@ rev: %s
if os.path.exists(os.path.join(self.storedir, '_frozenlink')):
os.unlink(os.path.join(self.storedir, '_frozenlink'))
def latest_rev(self, include_service_files=False):
def latest_rev(self, include_service_files=False, expand=False):
# if expand is True the xsrcmd5 will be returned (even if the wc is unexpanded)
if self.islinkrepair():
upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrepair=1, meta=self.meta, include_service_files=include_service_files)
elif self.islink() and self.isexpanded():
elif self.islink() and (self.isexpanded() or expand):
if self.isfrozen() or self.ispulled():
upstream_rev = show_upstream_xsrcmd5(self.apiurl, self.prjname, self.name, linkrev=self.linkinfo.srcmd5, meta=self.meta, include_service_files=include_service_files)
else: