From e2aa5cc65ccf6cdd90327ee829dc355f606a2090 Mon Sep 17 00:00:00 2001 From: Marcus Huewe Date: Wed, 28 Mar 2012 23:14:28 +0200 Subject: [PATCH] - do_update: rewrote code path for expanding/unexpanding a wc The way for determining the revision was completely "wrong". --- osc/commandline.py | 14 ++------------ osc/core.py | 5 +++-- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/osc/commandline.py b/osc/commandline.py index ee0946dd..983ee7e3 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -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) diff --git a/osc/core.py b/osc/core.py index 93c27fc2..c09b8dc5 100644 --- a/osc/core.py +++ b/osc/core.py @@ -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: