Permalink
Browse files

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

  • Loading branch information...
1 parent 1ec537e commit 3e837ce9d81137f42fb7d88642f1d7560ae0e923 @mvyskocil mvyskocil committed Apr 28, 2009
Showing with 5 additions and 5 deletions.
  1. +1 −0 NEWS
  2. +4 −5 osc/core.py
View
1 NEWS
@@ -1,6 +1,7 @@
0.118:
- support of added .changes in commit message template
- make submit request listing fast by server side filtering
+- bugfix: templates in edit commit message causes an empty commit logs
0.117:
- support checkout of single package via "osc co PACKAGE" when local dir is project
View
9 osc/core.py
@@ -1962,23 +1962,22 @@ def read_meta_from_spec(specfile, *args):
def edit_message(footer='', template=''):
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
(fd, filename) = tempfile.mkstemp(prefix = 'osc-commitmsg', suffix = '.diff', dir = '/tmp')
f = os.fdopen(fd, 'w')
+ if template != '':
+ f.write(template)
+ f.write('\n')
f.write(delim)
f.close()
mtime_orig = os.stat(filename).st_mtime
editor = os.getenv('EDITOR', default='vim')
while 1:
subprocess.call('%s %s' % (editor, filename), shell=True)
- hash = dgst(filename)
mtime = os.stat(filename).st_mtime
- if mtime_orig < mtime and hash != hash_orig:
+ if mtime_orig < mtime:
msg = open(filename).read()
os.unlink(filename)
return msg.split(delim)[0].rstrip()

0 comments on commit 3e837ce

Please sign in to comment.