mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
Merge branch 'fix_string_literal_in_commit_msg' of https://github.com/lethliel/osc
Interprete unicode escape characters in a "--message" option. In some cases, this breaks the existing UI (but that's OK because it can be fixed by properly escaping the escape character(s)). Note: if we are going to do more advanced stuff in the future, we should move the logic into a separate function.
This commit is contained in:
commit
ce291abac6
@ -911,6 +911,10 @@ class Osc(cmdln.Cmdln):
|
|||||||
# If project or package arguments missing, assume to work
|
# If project or package arguments missing, assume to work
|
||||||
# with project and/or package in current local directory.
|
# with project and/or package in current local directory.
|
||||||
attributepath = []
|
attributepath = []
|
||||||
|
|
||||||
|
if opts.message:
|
||||||
|
opts.message = str(opts.message.encode().decode('unicode_escape'))
|
||||||
|
|
||||||
if cmd in ['prj', 'prjconf']:
|
if cmd in ['prj', 'prjconf']:
|
||||||
if len(args) < 1:
|
if len(args) < 1:
|
||||||
apiurl = store_read_apiurl(os.curdir)
|
apiurl = store_read_apiurl(os.curdir)
|
||||||
@ -1212,6 +1216,9 @@ class Osc(cmdln.Cmdln):
|
|||||||
elif opts.no_update:
|
elif opts.no_update:
|
||||||
src_update = "noupdate"
|
src_update = "noupdate"
|
||||||
|
|
||||||
|
if opts.message:
|
||||||
|
opts.message = str(opts.message.encode().decode('unicode_escape'))
|
||||||
|
|
||||||
myreqs = []
|
myreqs = []
|
||||||
if opts.supersede:
|
if opts.supersede:
|
||||||
myreqs = [opts.supersede]
|
myreqs = [opts.supersede]
|
||||||
@ -1872,6 +1879,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
if not opts.message:
|
if not opts.message:
|
||||||
opts.message = edit_message()
|
opts.message = edit_message()
|
||||||
|
else:
|
||||||
|
opts.message = str(opts.message.encode().decode('unicode_escape'))
|
||||||
|
|
||||||
xml = """<request> %s <state name="new"/> <description>%s</description> </request> """ % \
|
xml = """<request> %s <state name="new"/> <description>%s</description> </request> """ % \
|
||||||
(actionsxml, _html_escape(opts.message or ""))
|
(actionsxml, _html_escape(opts.message or ""))
|
||||||
@ -1949,6 +1958,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
raise oscerr.WrongOptions('invalid \'--role\': either specify \'maintainer\' or \'bugowner\'')
|
raise oscerr.WrongOptions('invalid \'--role\': either specify \'maintainer\' or \'bugowner\'')
|
||||||
if not opts.message:
|
if not opts.message:
|
||||||
opts.message = edit_message()
|
opts.message = edit_message()
|
||||||
|
else:
|
||||||
|
opts.message = str(opts.message.encode().decode('unicode_escape'))
|
||||||
|
|
||||||
r = Request()
|
r = Request()
|
||||||
if user.startswith('group:'):
|
if user.startswith('group:'):
|
||||||
@ -2027,6 +2038,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
footer = textwrap.TextWrapper(width = 66).fill(
|
footer = textwrap.TextWrapper(width = 66).fill(
|
||||||
'please explain why you like to delete project %s' % project)
|
'please explain why you like to delete project %s' % project)
|
||||||
opts.message = edit_message(footer)
|
opts.message = edit_message(footer)
|
||||||
|
else:
|
||||||
|
opts.message = str(opts.message.encode().decode('unicode_escape'))
|
||||||
|
|
||||||
r = Request()
|
r = Request()
|
||||||
r.add_action('delete', tgt_project=project, tgt_package=package, tgt_repository=repository)
|
r.add_action('delete', tgt_project=project, tgt_package=package, tgt_repository=repository)
|
||||||
@ -2074,6 +2087,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
'please explain why you like to change the devel project of %s/%s to %s/%s'
|
'please explain why you like to change the devel project of %s/%s to %s/%s'
|
||||||
% (project, package, devel_project, devel_package))
|
% (project, package, devel_project, devel_package))
|
||||||
opts.message = edit_message(footer)
|
opts.message = edit_message(footer)
|
||||||
|
else:
|
||||||
|
opts.message = str(opts.message.encode().decode('unicode_escape'))
|
||||||
|
|
||||||
r = Request()
|
r = Request()
|
||||||
r.add_action('change_devel', src_project=devel_project, src_package=devel_package,
|
r.add_action('change_devel', src_project=devel_project, src_package=devel_package,
|
||||||
@ -2241,6 +2256,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
if opts.incoming:
|
if opts.incoming:
|
||||||
conf.config['include_request_from_project'] = False
|
conf.config['include_request_from_project'] = False
|
||||||
|
|
||||||
|
if opts.message:
|
||||||
|
opts.message = str(opts.message.encode().decode('unicode_escape'))
|
||||||
|
|
||||||
if args[0] == 'help':
|
if args[0] == 'help':
|
||||||
return self.do_help(['help', 'request'])
|
return self.do_help(['help', 'request'])
|
||||||
|
|
||||||
@ -2785,7 +2803,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
raise oscerr.WrongArgs('Too many arguments (required none or two)')
|
raise oscerr.WrongArgs('Too many arguments (required none or two)')
|
||||||
else:
|
else:
|
||||||
raise oscerr.WrongArgs('Too few arguments (required none or two)')
|
raise oscerr.WrongArgs('Too few arguments (required none or two)')
|
||||||
|
if opts.message:
|
||||||
|
opts.message = str(opts.message.encode().decode('unicode_escape'))
|
||||||
try:
|
try:
|
||||||
copy_pac(apiurl, project, package, apiurl, project, package, expand=True, comment=opts.message)
|
copy_pac(apiurl, project, package, apiurl, project, package, expand=True, comment=opts.message)
|
||||||
except HTTPError as e:
|
except HTTPError as e:
|
||||||
@ -2990,7 +3009,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
rev, dummy = parseRevisionOption(opts.revision)
|
rev, dummy = parseRevisionOption(opts.revision)
|
||||||
|
|
||||||
if opts.message:
|
if opts.message:
|
||||||
comment = opts.message
|
comment = str(opts.message.encode().decode('unicode_escape'))
|
||||||
else:
|
else:
|
||||||
if not rev:
|
if not rev:
|
||||||
rev = show_upstream_rev(src_apiurl, src_project, src_package)
|
rev = show_upstream_rev(src_apiurl, src_project, src_package)
|
||||||
@ -3123,6 +3142,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
if not opts.message:
|
if not opts.message:
|
||||||
opts.message = edit_message()
|
opts.message = edit_message()
|
||||||
|
else:
|
||||||
|
opts.message = str(opts.message.encode().decode('unicode_escape'))
|
||||||
|
|
||||||
r = create_release_request(apiurl, source_project, opts.message)
|
r = create_release_request(apiurl, source_project, opts.message)
|
||||||
print(r.reqid)
|
print(r.reqid)
|
||||||
@ -3156,6 +3177,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
maintenance_attribute = conf.config['maintenance_attribute']
|
maintenance_attribute = conf.config['maintenance_attribute']
|
||||||
if opts.attribute:
|
if opts.attribute:
|
||||||
maintenance_attribute = opts.attribute
|
maintenance_attribute = opts.attribute
|
||||||
|
if opts.message:
|
||||||
|
opts.message = str(opts.message.encode().decode('unicode_escape'))
|
||||||
|
|
||||||
source_project = target_project = None
|
source_project = target_project = None
|
||||||
|
|
||||||
@ -3292,6 +3315,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
if not opts.message:
|
if not opts.message:
|
||||||
opts.message = edit_message()
|
opts.message = edit_message()
|
||||||
|
else:
|
||||||
|
opts.message = str(opts.message.encode().decode('unicode_escape'))
|
||||||
|
|
||||||
supersede_existing = False
|
supersede_existing = False
|
||||||
reqs = []
|
reqs = []
|
||||||
@ -3508,6 +3533,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
if len(args) >= 4:
|
if len(args) >= 4:
|
||||||
tpackage = args[3]
|
tpackage = args[3]
|
||||||
|
|
||||||
|
if opts.message:
|
||||||
|
opts.message = str(opts.message.encode().decode('unicode_escape'))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
exists, targetprj, targetpkg, srcprj, srcpkg = \
|
exists, targetprj, targetpkg, srcprj, srcpkg = \
|
||||||
branch_pkg(apiurl, args[0], args[1],
|
branch_pkg(apiurl, args[0], args[1],
|
||||||
@ -3601,7 +3629,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
msg = ''
|
msg = ''
|
||||||
if opts.message:
|
if opts.message:
|
||||||
msg = opts.message
|
msg = str(opts.message.encode().decode('unicode_escape'))
|
||||||
else:
|
else:
|
||||||
msg = edit_message()
|
msg = edit_message()
|
||||||
|
|
||||||
@ -3648,7 +3676,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
msg = ''
|
msg = ''
|
||||||
if opts.message:
|
if opts.message:
|
||||||
msg = opts.message
|
msg = str(opts.message.encode().decode('unicode_escape'))
|
||||||
else:
|
else:
|
||||||
msg = edit_message()
|
msg = edit_message()
|
||||||
|
|
||||||
@ -3694,6 +3722,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
${cmd_option_list}
|
${cmd_option_list}
|
||||||
"""
|
"""
|
||||||
apiurl = self.get_api_url()
|
apiurl = self.get_api_url()
|
||||||
|
if opts.message:
|
||||||
|
opts.message = str(opts.message.encode().decode('unicode_escape'))
|
||||||
kind = 'prj'
|
kind = 'prj'
|
||||||
path_args = (project,)
|
path_args = (project,)
|
||||||
if package is not None:
|
if package is not None:
|
||||||
@ -3734,7 +3764,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
msg = ''
|
msg = ''
|
||||||
if opts.message:
|
if opts.message:
|
||||||
msg = opts.message
|
msg = str(opts.message.encode().decode('unicode_escape'))
|
||||||
else:
|
else:
|
||||||
msg = edit_message()
|
msg = edit_message()
|
||||||
|
|
||||||
@ -4810,7 +4840,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
msg = ''
|
msg = ''
|
||||||
if opts.message:
|
if opts.message:
|
||||||
msg = opts.message
|
msg = str(opts.message.encode().decode('unicode_escape'))
|
||||||
elif opts.file:
|
elif opts.file:
|
||||||
if opts.file == '-':
|
if opts.file == '-':
|
||||||
msg = sys.stdin.read()
|
msg = sys.stdin.read()
|
||||||
@ -8240,7 +8270,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
if requestactionsxml != "":
|
if requestactionsxml != "":
|
||||||
if opts.message:
|
if opts.message:
|
||||||
message = opts.message
|
message = str(opts.message.encode().decode('unicode_escape'))
|
||||||
else:
|
else:
|
||||||
message = edit_message()
|
message = edit_message()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user