1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-10 06:46:15 +01:00

* add "osc request list -t <type>" to list only submit, delete or

develchange requests
* fix support of listing requests with multiple actions
This commit is contained in:
Adrian Schröter 2009-06-18 13:49:23 +00:00
parent 2adaaeba09
commit d017b16426
3 changed files with 32 additions and 31 deletions

6
NEWS
View File

@ -1,7 +1,9 @@
0.120:
- support "setlinkrev" for whole projects
- support "setlinkrev -u" for removing revision references
- added dist directory with completion scripts for packaging
- add "setlinkrev --unset" for removing revision references
- add "osc request list -t <type>" to list only submit, delete or develchange requests
- add shell completion scripts
- fix support of listing requests with multiple actions
0.119:
- Support new request types

View File

@ -656,6 +656,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
help='output the diff in the unified diff format')
@cmdln.option('-m', '--message', metavar='TEXT',
help='specify message TEXT')
@cmdln.option('-t', '--type', metavar='TEXT',
help='limit to requests which contain a given action type (submit/delete/develchange)')
@cmdln.option('-s', '--state', default='new',
help='only list requests in one of the comma separated given states [default=new]')
@cmdln.option('-b', '--brief', action='store_true', default=False,
@ -700,7 +702,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
usage:
osc request list [-M] [PRJ [PKG]]
osc request list [-M] [-t type] [PRJ [PKG]]
osc request log ID
osc request show [-d] [-b] ID
osc request accept [-m TEXT] ID
@ -760,7 +762,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
who = conf.get_apiurl_usr(apiurl)
results = get_request_list(apiurl,
project, package, who, state_list)
project, package, who, state_list, opts.type)
results.sort(reverse=True)

View File

@ -80,8 +80,8 @@ It also does some weird stuff.
<arch>x86_64</arch>
<arch>i586</arch>
</repository>
<repository name="Fedora_10">
<path project="Fedora:10" repository="standard" />
<repository name="Fedora_11">
<path project="Fedora:11" repository="standard" />
<arch>x86_64</arch>
<arch>i586</arch>
</repository>
@ -1271,21 +1271,12 @@ class Request:
type = action.get('type', 'submit')
try:
n = action.find('source')
if n:
src_prj = n.get('project')
src_pkg = n.get('package')
src_prj = n.get('project', None)
src_pkg = n.get('package', None)
src_rev = n.get('rev', None)
else:
src_prj = None
src_pkg = None
src_rev = None
n = action.find('target')
if n:
dst_prj = n.get('project')
dst_prj = n.get('project', None)
dst_pkg = n.get('package', None)
else:
dst_prj = None
dst_pkg = None
self.add_action(type, src_prj, src_pkg, src_rev, dst_prj, dst_pkg)
except:
msg = 'invalid request format:\n%s' % ET.tostring(root)
@ -1326,19 +1317,22 @@ class Request:
)
def list_view(self):
dst = "%s/%s" % (self.actions[0].dst_project, self.actions[0].dst_package)
if self.actions[0].src_package == self.actions[0].dst_package:
dst = self.actions[0].dst_project
ret = '%6d State:%-7s Creator:%-12s When:%-12s' % (self.reqid, self.state.name, self.state.who, self.state.when)
for a in self.actions:
dst = "%s/%s" % (a.dst_project, a.dst_package)
if a.src_package == a.dst_package:
dst = a.dst_project
ret += '\n %s: %-50s -> %-20s ' % \
(a.type,
"%s/%s" % (a.src_project, a.src_package), dst)
desc = ""
if self.descr:
desc = "\n %s" % (repr(self.descr))
ret += "\n Comment: %s" % (repr(self.descr))
ret += "\n"
return '%6d %-7s %-12s %-50s -> %-20s %s' % \
(self.reqid,
self.state.name, "(%s)" % self.state.who,
"%s/%s" % (self.actions[0].src_project, self.actions[0].src_package),
dst, desc)
return ret
def __cmp__(self, other):
return cmp(self.reqid, other.reqid)
@ -2159,7 +2153,7 @@ def change_request_state(apiurl, reqid, newstate, message=''):
return f.read()
def get_request_list(apiurl, project, package, req_who='', req_state=('new',) ):
def get_request_list(apiurl, project, package, req_who='', req_state=('new',), req_type=None ):
requests = []
matches = []
@ -2182,6 +2176,9 @@ def get_request_list(apiurl, project, package, req_who='', req_state=('new',) ):
if package:
if len(m): m += '%20and%20'
m += '%s/target/@package=\'%s\'' % (what, quote_plus(package))
if req_type:
if len(m): m += '%20and%20'
m += '%s/@type=\'%s\'' % (what, quote_plus(req_type))
matches.append(m)
else: