1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-11 16:36:14 +01:00

- osc rq show <id> -d: store tmpfile with suffix ".diff" (for syntax highlighting)

- run_pager: added optional "tmp_suffix" parameter
This commit is contained in:
Marcus Huewe 2011-04-24 00:27:47 +02:00
parent f7a781e730
commit 023a2426d9
2 changed files with 4 additions and 4 deletions

View File

@ -1982,7 +1982,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
action.tgt_project, action.tgt_package)
diff += submit_action_diff(apiurl, action)
diff += '\n\n'
run_pager(diff)
run_pager(diff, tmp_suffix='')
# checkout
elif cmd == 'checkout' or cmd == 'co':

View File

@ -3394,7 +3394,7 @@ def get_default_pager():
return 'less'
return 'more'
def run_pager(message):
def run_pager(message, tmp_suffix=''):
import tempfile, sys
if not message:
@ -3403,7 +3403,7 @@ def run_pager(message):
if not sys.stdout.isatty():
print message
else:
tmpfile = tempfile.NamedTemporaryFile()
tmpfile = tempfile.NamedTemporaryFile(suffix=tmp_suffix)
tmpfile.write(message)
tmpfile.flush()
pager = os.getenv('PAGER', default=get_default_pager())
@ -5972,7 +5972,7 @@ def request_interactive_review(apiurl, request, initial_cmd=''):
tmpfile.close()
tmpfile = None
if tmpfile is None:
tmpfile = tempfile.NamedTemporaryFile()
tmpfile = tempfile.NamedTemporaryFile(suffix='.diff')
for action in sr_actions:
diff = 'old: %s/%s\nnew: %s/%s\n' % (action.src_project, action.src_package,
action.tgt_project, action.tgt_package)