Skip to content

Commit

Permalink
- do_update: rewrote code path for expanding/unexpanding a wc
Browse files Browse the repository at this point in the history
The way for determining the revision was completely "wrong".
  • Loading branch information
marcus-h committed Mar 28, 2012
1 parent 25c4cb1 commit e2aa5cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
14 changes: 2 additions & 12 deletions osc/commandline.py
Expand Up @@ -4035,20 +4035,10 @@ def do_update(self, subcmd, opts, *args):

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)
Expand Down
5 changes: 3 additions & 2 deletions osc/core.py
Expand Up @@ -1820,10 +1820,11 @@ 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, 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:
Expand Down

0 comments on commit e2aa5cc

Please sign in to comment.