mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-13 09:16:14 +01:00
"osc cat" now auto-expands through link. New option -n to suppress this.
This commit is contained in:
parent
5a97588b85
commit
f9855a821b
2
NEWS
2
NEWS
@ -1,3 +1,5 @@
|
||||
- "osc cat" now auto-expands through link.
|
||||
- fixed "osc add" after "osc delete".
|
||||
|
||||
0.126
|
||||
- fix "osc patchinfo" command (crashed before)
|
||||
|
@ -4527,7 +4527,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
@cmdln.option('-r', '--revision', metavar='rev',
|
||||
help='print out the specified revision')
|
||||
@cmdln.option('-e', '--expand', action='store_true',
|
||||
help='expand linked package')
|
||||
help='force expand linked package. Use with -n')
|
||||
@cmdln.option('-n', '--no-auto-expand', action='store_true',
|
||||
help='expand link only when -e given. Default: try without expansion, then with.')
|
||||
def do_cat(self, subcmd, opts, *args):
|
||||
"""${cmd_name}: Output the content of a file to standard output
|
||||
|
||||
@ -4562,8 +4564,19 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
if opts.expand:
|
||||
query['rev'] = show_upstream_srcmd5(conf.config['apiurl'], args[0], args[1], expand=True, revision=opts.revision)
|
||||
u = makeurl(conf.config['apiurl'], ['source', args[0], args[1], args[2]], query=query)
|
||||
for data in streamfile(u):
|
||||
sys.stdout.write(data)
|
||||
try:
|
||||
for data in streamfile(u):
|
||||
sys.stdout.write(data)
|
||||
except urllib2.HTTPError, e:
|
||||
if e.code == 404 and not opts.expand and not opts.no_auto_expand:
|
||||
print >>sys.stderr, 'expanding link...'
|
||||
query['rev'] = show_upstream_srcmd5(conf.config['apiurl'], args[0], args[1], expand=True, revision=opts.revision)
|
||||
u = makeurl(conf.config['apiurl'], ['source', args[0], args[1], args[2]], query=query)
|
||||
for data in streamfile(u):
|
||||
sys.stdout.write(data)
|
||||
else:
|
||||
e.osc_msg = 'If linked, try: cat -e'
|
||||
raise e
|
||||
|
||||
|
||||
# helper function to download a file from a specific revision
|
||||
|
Loading…
Reference in New Issue
Block a user