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

fallback to unexpanded diff mode on "osc diff" on merge error. Same behaviour as rdiff is doing.

This commit is contained in:
Adrian Schröter 2011-01-12 17:09:41 +01:00
parent d11e9f8514
commit 8fed7847e4
2 changed files with 21 additions and 2 deletions

1
NEWS
View File

@ -5,6 +5,7 @@
- add "createrequest -a add_group" option to create a group request
- add "createrequest -a add_me" shortcut
- add "less" command, doing the same as "osc cat" but with pager
- fallback to unexpanded diff mode on "osc diff" on merge error.
0.130
- new "revert" command to restore the original working copy file (without

View File

@ -2662,8 +2662,26 @@ Please submit there instead, or use --nodevelproject to force direct submission.
for i in pac.get_diff(rev1):
sys.stdout.write(''.join(i))
else:
diff += server_diff(pac.apiurl, pac.prjname, pac.name, rev1,
pac.prjname, pac.name, rev2, not opts.plain, opts.missingok)
try:
diff += server_diff(pac.apiurl, pac.prjname, pac.name, rev1,
pac.prjname, pac.name, rev2, not opts.plain, opts.missingok)
except urllib2.HTTPError, e:
if not e.code in [ 400, 403, 404, 500 ]:
raise
msg = None
body = None
try:
body = e.read()
if not 'bad link' in body:
raise e
except:
raise e
diff = "## diff on expanded link not possible, showing unexpanded version\n"
diff += server_diff(pac.apiurl, pac.prjname, pac.name, rev1,
pac.prjname, pac.name, rev2, not opts.plain, opts.missingok,
expand=False)
run_pager(diff)