1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-30 01:44:11 +02:00

bugfix: templates in edit commit message causes an empty commit logs

This commit is contained in:
Michal Vyskocil
2009-04-28 07:15:57 +00:00
parent 1ec537e9de
commit 3e837ce9d8
2 changed files with 5 additions and 5 deletions

1
NEWS
View File

@@ -1,6 +1,7 @@
0.118: 0.118:
- support of added .changes in commit message template - support of added .changes in commit message template
- make submit request listing fast by server side filtering - make submit request listing fast by server side filtering
- bugfix: templates in edit commit message causes an empty commit logs
0.117: 0.117:
- support checkout of single package via "osc co PACKAGE" when local dir is project - support checkout of single package via "osc co PACKAGE" when local dir is project

View File

@@ -1962,12 +1962,12 @@ def read_meta_from_spec(specfile, *args):
def edit_message(footer='', template=''): def edit_message(footer='', template=''):
delim = '--This line, and those below, will be ignored--\n\n' + footer delim = '--This line, and those below, will be ignored--\n\n' + footer
hash_orig = dgst_from_string('\n' + delim)
if template != '':
delim = template + '\n' + delim
import tempfile import tempfile
(fd, filename) = tempfile.mkstemp(prefix = 'osc-commitmsg', suffix = '.diff', dir = '/tmp') (fd, filename) = tempfile.mkstemp(prefix = 'osc-commitmsg', suffix = '.diff', dir = '/tmp')
f = os.fdopen(fd, 'w') f = os.fdopen(fd, 'w')
if template != '':
f.write(template)
f.write('\n')
f.write(delim) f.write(delim)
f.close() f.close()
mtime_orig = os.stat(filename).st_mtime mtime_orig = os.stat(filename).st_mtime
@@ -1975,10 +1975,9 @@ def edit_message(footer='', template=''):
editor = os.getenv('EDITOR', default='vim') editor = os.getenv('EDITOR', default='vim')
while 1: while 1:
subprocess.call('%s %s' % (editor, filename), shell=True) subprocess.call('%s %s' % (editor, filename), shell=True)
hash = dgst(filename)
mtime = os.stat(filename).st_mtime mtime = os.stat(filename).st_mtime
if mtime_orig < mtime and hash != hash_orig: if mtime_orig < mtime:
msg = open(filename).read() msg = open(filename).read()
os.unlink(filename) os.unlink(filename)
return msg.split(delim)[0].rstrip() return msg.split(delim)[0].rstrip()