1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-23 05:26:16 +01:00

add --limit option to buildhistory

This commit is contained in:
Adrian Schröter 2015-12-07 10:05:08 +01:00
parent b15f97bcd0
commit b40d856e67
3 changed files with 9 additions and 3 deletions

1
NEWS
View File

@ -2,6 +2,7 @@
- "my sr" is using the server side request collection to get right results - "my sr" is using the server side request collection to get right results
- maintenance request offers to supersede old, but still open requests - maintenance request offers to supersede old, but still open requests
- add build --vm-telnet option for getting debug shell in KVM builds - add build --vm-telnet option for getting debug shell in KVM builds
- add buildhistory --limit option
OBS 2.7 only: OBS 2.7 only:
- add "addchannels" and "enablechannel" commands - add "addchannels" and "enablechannel" commands
- support new package instances on branching when using -N parameter - support new package instances on branching when using -N parameter

View File

@ -6088,6 +6088,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
@cmdln.option('', '--csv', action='store_true', @cmdln.option('', '--csv', action='store_true',
help='generate output in CSV (separated by |)') help='generate output in CSV (separated by |)')
@cmdln.option('-l', '--limit', metavar='limit',
help='for setting the number of results')
@cmdln.alias('buildhist') @cmdln.alias('buildhist')
def do_buildhistory(self, subcmd, opts, *args): def do_buildhistory(self, subcmd, opts, *args):
"""${cmd_name}: Shows the build history of a package """${cmd_name}: Shows the build history of a package
@ -6126,7 +6128,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if opts.csv: if opts.csv:
format = 'csv' format = 'csv'
print('\n'.join(get_buildhistory(apiurl, project, package, repository, arch, format))) print('\n'.join(get_buildhistory(apiurl, project, package, repository, arch, format, opts.limit)))
@cmdln.option('', '--csv', action='store_true', @cmdln.option('', '--csv', action='store_true',
help='generate output in CSV (separated by |)') help='generate output in CSV (separated by |)')

View File

@ -5791,9 +5791,12 @@ def get_source_rev(apiurl, project, package, revision=None):
e[k.tag] = k.text e[k.tag] = k.text
return e return e
def get_buildhistory(apiurl, prj, package, repository, arch, format = 'text'): def get_buildhistory(apiurl, prj, package, repository, arch, format = 'text', limit = None):
import time import time
u = makeurl(apiurl, ['build', prj, repository, arch, package, '_history']) query = {}
if limit != None and int(limit) > 0:
query['limit'] = int(limit)
u = makeurl(apiurl, ['build', prj, repository, arch, package, '_history'], query)
f = http_GET(u) f = http_GET(u)
root = ET.parse(f).getroot() root = ET.parse(f).getroot()