mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-13 17:16:23 +01:00
- do_diff()/do_rdiff(): added "--missingok" parameter
- always use "missingok=1" when showing the diff for a sr
This commit is contained in:
parent
d65f0c81e4
commit
d3a01a72c0
@ -1241,7 +1241,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
try:
|
||||
print server_diff(conf.config['apiurl'],
|
||||
r.actions[0].dst_project, r.actions[0].dst_package, None,
|
||||
r.actions[0].src_project, r.actions[0].src_package, r.actions[0].src_rev, opts.unified)
|
||||
r.actions[0].src_project, r.actions[0].src_package, r.actions[0].src_rev, opts.unified, True)
|
||||
except urllib2.HTTPError, e:
|
||||
e.osc_msg = 'Diff not possible'
|
||||
raise
|
||||
@ -1830,6 +1830,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
'(NOTE: changes in your working copy are ignored in this case)')
|
||||
@cmdln.option('-p', '--plain', action='store_true',
|
||||
help='output the diff in plain (not unified) diff format')
|
||||
@cmdln.option('--missingok', action='store_true',
|
||||
help='do not fail if the source or target project/package does not exist on the server')
|
||||
def do_diff(self, subcmd, opts, *args):
|
||||
"""${cmd_name}: Generates a diff
|
||||
|
||||
@ -1867,7 +1869,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
diff += ''.join(make_diff(pac, rev1))
|
||||
else:
|
||||
diff += server_diff(pac.apiurl, pac.prjname, pac.name, rev1,
|
||||
pac.prjname, pac.name, rev2, not opts.plain)
|
||||
pac.prjname, pac.name, rev2, not opts.plain, opts.missingok)
|
||||
if len(diff) > 0:
|
||||
print diff
|
||||
|
||||
@ -1885,6 +1887,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
@cmdln.option('-c', '--change', metavar='rev',
|
||||
help='the change made by revision rev (like -r rev-1:rev). '
|
||||
'If rev is negative this is like -r rev:rev-1.')
|
||||
@cmdln.option('--missingok', action='store_true',
|
||||
help='do not fail if the source or target project/package does not exist on the server')
|
||||
def do_rdiff(self, subcmd, opts, *args):
|
||||
"""${cmd_name}: Server-side "pretty" diff of two packages
|
||||
|
||||
@ -1953,8 +1957,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
|
||||
rdiff = server_diff(conf.config['apiurl'],
|
||||
old_project, old_package, rev1,
|
||||
new_project, new_package, rev2, not opts.plain)
|
||||
|
||||
new_project, new_package, rev2, not opts.plain, opts.missingok)
|
||||
print rdiff
|
||||
|
||||
@cmdln.hide(1)
|
||||
|
@ -2976,8 +2976,7 @@ def make_diff(wc, revision):
|
||||
|
||||
def server_diff(apiurl,
|
||||
old_project, old_package, old_revision,
|
||||
new_project, new_package, new_revision, unified=False):
|
||||
|
||||
new_project, new_package, new_revision, unified=False, missingok=False):
|
||||
query = {'cmd': 'diff', 'expand': '1'}
|
||||
if old_project:
|
||||
query['oproject'] = old_project
|
||||
@ -2989,6 +2988,8 @@ def server_diff(apiurl,
|
||||
query['rev'] = new_revision
|
||||
if unified:
|
||||
query['unified'] = 1
|
||||
if missingok:
|
||||
query['missingok'] = 1
|
||||
|
||||
u = makeurl(apiurl, ['source', new_project, new_package], query=query)
|
||||
|
||||
@ -4640,7 +4641,7 @@ def request_interactive_review(apiurl, request):
|
||||
if tmpfile is None:
|
||||
tmpfile = tempfile.NamedTemporaryFile()
|
||||
tmpfile.write(server_diff(apiurl, request.actions[0].dst_project, request.actions[0].dst_package, None,
|
||||
request.actions[0].src_project, request.actions[0].src_package, request.actions[0].src_rev, True))
|
||||
request.actions[0].src_project, request.actions[0].src_package, request.actions[0].src_rev, True, True))
|
||||
tmpfile.flush()
|
||||
pager = os.getenv('EDITOR', default='less')
|
||||
subprocess.call('%s %s' % (pager, tmpfile.name), shell=True)
|
||||
|
Loading…
Reference in New Issue
Block a user