##// END OF EJS Templates
changelog: extract description cleaning logic in a dedicated function...
Pierre-Yves David -
r17810:2894d180 default
parent child Browse files
Show More
@@ -49,6 +49,10 b' def encodeextra(d):'
49 items = [_string_escape('%s:%s' % (k, d[k])) for k in sorted(d)]
49 items = [_string_escape('%s:%s' % (k, d[k])) for k in sorted(d)]
50 return "\0".join(items)
50 return "\0".join(items)
51
51
52 def stripdesc(desc):
53 """strip trailing whitespace and leading and trailing empty lines"""
54 return '\n'.join([l.rstrip() for l in desc.splitlines()]).strip('\n')
55
52 class appender(object):
56 class appender(object):
53 '''the changelog index must be updated last on disk, so we use this class
57 '''the changelog index must be updated last on disk, so we use this class
54 to delay writes to it'''
58 to delay writes to it'''
@@ -308,8 +312,7 b' class changelog(revlog.revlog):'
308 raise error.RevlogError(_("username %s contains a newline")
312 raise error.RevlogError(_("username %s contains a newline")
309 % repr(user))
313 % repr(user))
310
314
311 # strip trailing whitespace and leading and trailing empty lines
315 desc = stripdesc(desc)
312 desc = '\n'.join([l.rstrip() for l in desc.splitlines()]).strip('\n')
313
316
314 if date:
317 if date:
315 parseddate = "%d %d" % util.parsedate(date)
318 parseddate = "%d %d" % util.parsedate(date)
General Comments 0
You need to be logged in to leave comments. Login now