From b37a869e6b49e9f04131788d80063add5c376610 Mon Sep 17 00:00:00 2001 From: mhagger Date: Wed, 16 Jun 2010 04:28:43 +0000 Subject: [PATCH] Move the function canonicalize_eol() to common.py. git-svn-id: http://cvs2svn.tigris.org/svn/cvs2svn/trunk@5191 be7e6eca-30d4-0310-a8e5-ac0d63af7087 --- cvs2svn_lib/common.py | 10 ++++++++++ cvs2svn_lib/dumpfile_delegate.py | 11 +---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/cvs2svn_lib/common.py b/cvs2svn_lib/common.py index 81319663..d60b2b4c 100644 --- a/cvs2svn_lib/common.py +++ b/cvs2svn_lib/common.py @@ -87,6 +87,16 @@ class CommandError(FatalError): % (self.command, self.exit_status)) +def canonicalize_eol(text, eol): + """Replace any end-of-line sequences in TEXT with the string EOL.""" + + text = text.replace('\r\n', '\n') + text = text.replace('\r', '\n') + if eol != '\n': + text = text.replace('\n', eol) + return text + + def path_join(*components): """Join two or more pathname COMPONENTS, inserting '/' as needed. Empty component are skipped.""" diff --git a/cvs2svn_lib/dumpfile_delegate.py b/cvs2svn_lib/dumpfile_delegate.py index d0eb9c32..0178eb78 100644 --- a/cvs2svn_lib/dumpfile_delegate.py +++ b/cvs2svn_lib/dumpfile_delegate.py @@ -26,6 +26,7 @@ except ImportError: from cvs2svn_lib import config from cvs2svn_lib.common import FatalError from cvs2svn_lib.common import InternalError +from cvs2svn_lib.common import canonicalize_eol from cvs2svn_lib.common import path_split from cvs2svn_lib.context import Ctx from cvs2svn_lib.cvs_path import CVSDirectory @@ -49,16 +50,6 @@ EOL_STYLE_REPLACEMENTS = { } -def canonicalize_eol(text, eol): - """Replace any end-of-line sequences in TEXT with the string EOL.""" - - text = text.replace('\r\n', '\n') - text = text.replace('\r', '\n') - if eol != '\n': - text = text.replace('\n', eol) - return text - - class DumpfileDelegate(SVNRepositoryDelegate): """Create a Subversion dumpfile.""" -- 2.11.4.GIT