diff hgext/convert/subversion.py @ 36148:0f9e52f900c4

convert: fix line ending of mapfile and commit.desc file Follows up 42a393ea56d2. CRLF vs LF doesn't really matter as we do strip() or rstrip() on read, but mixing them isn't nice. So let's restore the old behavior. I don't know whether CVS/Root, CVS/Repository, and ~/.cvspass are written in native line ending, so I leave them read as binary files.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 13 Feb 2018 21:52:51 +0900
parents 42a393ea56d2
children 238646784294
line wrap: on
line diff
--- a/hgext/convert/subversion.py	Sun Feb 11 18:34:22 2018 -0800
+++ b/hgext/convert/subversion.py	Tue Feb 13 21:52:51 2018 +0900
@@ -640,7 +640,8 @@
         if self.convertfp is None:
             self.convertfp = open(os.path.join(self.wc, '.svn', 'hg-shamap'),
                                   'ab')
-        self.convertfp.write('%s %d\n' % (destrev, self.revnum(rev)))
+        self.convertfp.write(util.tonativeeol('%s %d\n'
+                                              % (destrev, self.revnum(rev))))
         self.convertfp.flush()
 
     def revid(self, revnum, module=None):
@@ -1309,7 +1310,7 @@
 
         fd, messagefile = tempfile.mkstemp(prefix='hg-convert-')
         fp = os.fdopen(fd, pycompat.sysstr('wb'))
-        fp.write(commit.desc)
+        fp.write(util.tonativeeol(commit.desc))
         fp.close()
         try:
             output = self.run0('commit',