From 120d8908073ce49a040292b6ef7dfac8a4ffc7e7 Mon Sep 17 00:00:00 2001 From: Marcus Huewe Date: Fri, 9 Apr 2010 01:22:26 +0200 Subject: [PATCH] - handle linkerrors more gracefully - show revision --- osc/commandline.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/osc/commandline.py b/osc/commandline.py index 4ab15e12..d05c69eb 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -342,13 +342,14 @@ class Osc(cmdln.Cmdln): elif len(args) == 2 or len(args) == 3: link_seen = False print_not_found = True + rev = opts.revision for i in [ 1, 2 ]: l = meta_get_filelist(conf.config['apiurl'], project, package, verbose=opts.verbose, expand=opts.expand, - revision=opts.revision) + revision=rev) link_seen = '_link' in l if opts.verbose: out = [ '%s %7s %9d %s %s' % (i.md5, i.rev, i.size, shorttime(i.mtime), i.name) \ @@ -365,9 +366,15 @@ class Osc(cmdln.Cmdln): print '\n'.join(l) if opts.expand or opts.unexpand or not link_seen: break m = show_files_meta(conf.config['apiurl'], project, package) - xml = ET.fromstring(''.join(m)).find('linkinfo') - project, package = xml.get('project'), xml.get('package') - print "# -> %s %s" % (project, package) + li = Linkinfo() + li.read(ET.fromstring(''.join(m)).find('linkinfo')) + if li.haserror(): + raise oscerr.LinkExpandError(project, package, li.error) + project, package, rev = li.project, li.package, li.rev + if rev: + print '# -> %s %s (%s)' % (project, package, rev) + else: + print '# -> %s %s (latest)' % (project, package) opts.expand = True if fname and print_not_found: print 'file \'%s\' does not exist' % fname