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

Merge branch 'rdiff_issues_only' of https://github.com/lethliel/osc

Add --issues-only option to the rdiff command.
This commit is contained in:
Marcus Huewe 2017-05-28 19:23:34 +02:00
commit 5d480fd370
2 changed files with 22 additions and 7 deletions

View File

@ -3753,6 +3753,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
@cmdln.option('--oldpkg', metavar='OLDPKG',
help='package to compare against'
' (deprecated, use 3 argument form)')
@cmdln.option('--issues-only', action='store_true',
help='show only issues in diff')
@cmdln.option('-M', '--meta', action='store_true',
help='diff meta data')
@cmdln.option('-r', '--revision', metavar='N[:M]',
@ -3842,9 +3844,12 @@ Please submit there instead, or use --nodevelproject to force direct submission.
old_project, old_package, rev1,
new_project, new_package, rev2, not opts.plain, opts.missingok,
meta=opts.meta,
expand=not opts.unexpand)
run_pager(rdiff)
expand=not opts.unexpand,
onlyissues=opts.issues_only)
if opts.issues_only:
print(rdiff)
else:
run_pager(rdiff)
def _pdiff_raise_non_existing_package(self, project, package, msg = None):
raise oscerr.PackageMissing(project, package, msg or '%s/%s does not exist.' % (project, package))

View File

@ -4660,7 +4660,7 @@ def get_source_file_diff(dir, filename, rev, oldfilename = None, olddir = None,
def server_diff(apiurl,
old_project, old_package, old_revision,
new_project, new_package, new_revision,
unified=False, missingok=False, meta=False, expand=True, full=True):
unified=False, missingok=False, meta=False, expand=True, onlyissues=False, full=True):
query = {'cmd': 'diff'}
if expand:
query['expand'] = 1
@ -4681,21 +4681,31 @@ def server_diff(apiurl,
if full:
query['filelimit'] = 0
query['tarlimit'] = 0
if onlyissues:
query['onlyissues'] = 1
query['view'] = 'xml'
query['unified'] = 0
u = makeurl(apiurl, ['source', new_project, new_package], query=query)
f = http_POST(u)
if onlyissues:
issue_list = []
root = ET.fromstring(f.read())
node = root.find('issues')
for issuenode in node.findall('issue'):
issue_list.append(issuenode.get('label'))
return '\n'.join(issue_list)
return f.read()
def server_diff_noex(apiurl,
old_project, old_package, old_revision,
new_project, new_package, new_revision,
unified=False, missingok=False, meta=False, expand=True):
unified=False, missingok=False, meta=False, expand=True, onlyissues=False):
try:
return server_diff(apiurl,
old_project, old_package, old_revision,
new_project, new_package, new_revision,
unified, missingok, meta, expand)
unified, missingok, meta, expand, onlyissues)
except HTTPError as e:
msg = None
body = None