[PATCH] transplant: Add trailing CR in tmp file for filtering

Mads Kiilerich mads at kiilerich.com
Wed Sep 9 18:56:36 CDT 2009


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1252540585 -7200
# Node ID 674352c63cffacd91fcd1eaf63bdf173b59f1e6c
# Parent  fef209e657579ddd0b87ed728f1fee8912960eab
transplant: Add trailing CR in tmp file for filtering

Transplant filtering used a tmp file ending with the (stripped) commit message
and thus no final CR. Text files not ending with CR is usually not used on Unix
and is thus wrong ;-)

The missing CR had bad consequences because Solaris sed chokes on unterminated
input lines, so
  echo -n foo|sed 's,o,0,g'
doesn't output anything, and the filter used in tests/test-transplant thus
stripped the last (and only) line in the message away on solaris.

diff --git a/hgext/transplant.py b/hgext/transplant.py
--- a/hgext/transplant.py
+++ b/hgext/transplant.py
@@ -182,7 +182,7 @@
         fp.write("# HG changeset patch\n")
         fp.write("# User %s\n" % user)
         fp.write("# Date %d %d\n" % date)
-        fp.write(changelog[4])
+        fp.write(msg + '\n')
         fp.close()
 
         try:


More information about the Mercurial-devel mailing list