[PATCH 2 of 3] cmdutil: normalize log message eols when reading from file

Patrick Mezard pmezard at gmail.com
Sat May 7 11:54:11 CDT 2011


# HG changeset patch
# User Patrick Mezard <pmezard at gmail.com>
# Date 1304786345 -7200
# Node ID b5ca6ec56ebbe371f58d4e5e084b06ea05f948dd
# Parent  2d0e8c441bc5b938f71107fb1c8928b97b7bc536
cmdutil: normalize log message eols when reading from file

This will be necessary once util.readfile() operates in binary mode. While
changelog.add() already normalizes the message, doing so in logmessage() is
required as ui.edit() or others expect messages with LF only.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -91,7 +91,7 @@
             if logfile == '-':
                 message = sys.stdin.read()
             else:
-                message = util.readfile(logfile)
+                message = '\n'.join(util.readfile(logfile).splitlines())
         except IOError, inst:
             raise util.Abort(_("can't read commit message '%s': %s") %
                              (logfile, inst.strerror))


More information about the Mercurial-devel mailing list