1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-25 01:16:14 +01:00

show diff when mr is created

As in do_submitrequest show the diff also when do_maintenancerequest is called.
This commit is contained in:
lethliel 2020-05-25 20:47:51 +02:00
parent 3967133022
commit 14899b4d76

View File

@ -3291,7 +3291,27 @@ Please submit there instead, or use --nodevelproject to force direct submission.
print('Using target project \'%s\'%s' % (target_project, release_in))
if not opts.message:
opts.message = edit_message()
try:
rdiff = b'old: %s/%s\nnew: %s/%s\n' % (target_project.encode(), source_package.encode(), release_project.encode(), source_package.encode())
rdiff += server_diff(apiurl,
release_project, source_package, None,
source_project, source_package, None, True)
except:
rdiff = b''
if rdiff is not None:
rdiff = decode_it(rdiff)
difflines = []
doappend = False
changes_re = re.compile(r'^--- .*\.changes ')
for line in rdiff.split('\n'):
if line.startswith('--- '):
if changes_re.match(line):
doappend = True
else:
doappend = False
if doappend:
difflines.append(line)
opts.message = edit_message(footer=rdiff, template='\n'.join(parse_diff_for_commit_message('\n'.join(difflines))))
supersede_existing = False
reqs = []