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

- cut *.changes message after 30 lines (as request by darix)

This commit is contained in:
Marcus Huewe 2010-05-09 21:36:51 +02:00
parent 5bfbf5b1a9
commit 4273114ac1

View File

@ -2508,12 +2508,17 @@ def run_editor(filename):
return subprocess.call([ editor, filename ])
def edit_message(footer='', template=''):
def edit_message(footer='', template='', templatelen=30):
delim = '--This line, and those below, will be ignored--\n'
import tempfile
(fd, filename) = tempfile.mkstemp(prefix = 'osc-commitmsg', suffix = '.diff')
f = os.fdopen(fd, 'w')
if template != '':
if not templatelen is None:
lines = template.splitlines()
template = '\n'.join(lines[:templatelen])
if lines[templatelen:]:
footer = '%s\n\n%s' % ('\n'.join(lines[templatelen:]), footer)
f.write(template)
f.write('\n')
f.write(delim)