1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-14 09:36:21 +01:00

- handle linkerrors more gracefully

- show revision
This commit is contained in:
Marcus Huewe 2010-04-09 01:22:26 +02:00
parent 7cde15caee
commit 120d890807

View File

@ -342,13 +342,14 @@ class Osc(cmdln.Cmdln):
elif len(args) == 2 or len(args) == 3: elif len(args) == 2 or len(args) == 3:
link_seen = False link_seen = False
print_not_found = True print_not_found = True
rev = opts.revision
for i in [ 1, 2 ]: for i in [ 1, 2 ]:
l = meta_get_filelist(conf.config['apiurl'], l = meta_get_filelist(conf.config['apiurl'],
project, project,
package, package,
verbose=opts.verbose, verbose=opts.verbose,
expand=opts.expand, expand=opts.expand,
revision=opts.revision) revision=rev)
link_seen = '_link' in l link_seen = '_link' in l
if opts.verbose: if opts.verbose:
out = [ '%s %7s %9d %s %s' % (i.md5, i.rev, i.size, shorttime(i.mtime), i.name) \ 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) print '\n'.join(l)
if opts.expand or opts.unexpand or not link_seen: break if opts.expand or opts.unexpand or not link_seen: break
m = show_files_meta(conf.config['apiurl'], project, package) m = show_files_meta(conf.config['apiurl'], project, package)
xml = ET.fromstring(''.join(m)).find('linkinfo') li = Linkinfo()
project, package = xml.get('project'), xml.get('package') li.read(ET.fromstring(''.join(m)).find('linkinfo'))
print "# -> %s %s" % (project, package) 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 opts.expand = True
if fname and print_not_found: if fname and print_not_found:
print 'file \'%s\' does not exist' % fname print 'file \'%s\' does not exist' % fname