From 3b8413b48ee4d86e76d7f31d13ad8cd5c8f79ca6 Mon Sep 17 00:00:00 2001 From: mhagger Date: Wed, 16 Jun 2010 04:28:27 +0000 Subject: [PATCH] Teach RevisionReader.get_content() to handle AppleSingle content. This effectively adds support for AppleSingle handling to the DVCSs. git-svn-id: http://cvs2svn.tigris.org/svn/cvs2svn/trunk@5190 be7e6eca-30d4-0310-a8e5-ac0d63af7087 --- cvs2svn_lib/checkout_internal.py | 6 ++++++ cvs2svn_lib/cvs_revision_manager.py | 11 ++++++++++- cvs2svn_lib/dumpfile_delegate.py | 5 ----- cvs2svn_lib/rcs_revision_manager.py | 11 ++++++++++- cvs2svn_lib/revision_manager.py | 3 ++- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/cvs2svn_lib/checkout_internal.py b/cvs2svn_lib/checkout_internal.py index f94aa378..399b8e1c 100644 --- a/cvs2svn_lib/checkout_internal.py +++ b/cvs2svn_lib/checkout_internal.py @@ -101,6 +101,7 @@ from cvs2svn_lib.revision_manager import RevisionReader from cvs2svn_lib.serializer import MarshalSerializer from cvs2svn_lib.serializer import CompressingSerializer from cvs2svn_lib.serializer import PrimedPickleSerializer +from cvs2svn_lib.apple_single_filter import get_maybe_apple_single import cvs2svn_rcsparse @@ -791,6 +792,11 @@ class InternalRevisionReader(RevisionReader): % (keyword_handling, cvs_rev,) ) + if Ctx().decode_apple_single: + # Insert a filter to decode any files that are in AppleSingle + # format: + text = get_maybe_apple_single(text) + return text def finish(self): diff --git a/cvs2svn_lib/cvs_revision_manager.py b/cvs2svn_lib/cvs_revision_manager.py index 01f465e3..bdc36e41 100644 --- a/cvs2svn_lib/cvs_revision_manager.py +++ b/cvs2svn_lib/cvs_revision_manager.py @@ -21,7 +21,9 @@ from cvs2svn_lib.common import FatalError from cvs2svn_lib.process import check_command_runs from cvs2svn_lib.process import get_command_output from cvs2svn_lib.process import CommandFailedException +from cvs2svn_lib.context import Ctx from cvs2svn_lib.revision_manager import RevisionReader +from cvs2svn_lib.apple_single_filter import get_maybe_apple_single class CVSRevisionReader(RevisionReader): @@ -106,6 +108,13 @@ class CVSRevisionReader(RevisionReader): if cvs_rev.get_property('_keyword_handling') == 'collapsed': pipe_cmd.append('-kk') pipe_cmd.append(project.cvs_module + cvs_rev.cvs_path) - return get_command_output(pipe_cmd) + data = get_command_output(pipe_cmd) + + if Ctx().decode_apple_single: + # Insert a filter to decode any files that are in AppleSingle + # format: + data = get_maybe_apple_single(data) + + return data diff --git a/cvs2svn_lib/dumpfile_delegate.py b/cvs2svn_lib/dumpfile_delegate.py index b356f651..d0eb9c32 100644 --- a/cvs2svn_lib/dumpfile_delegate.py +++ b/cvs2svn_lib/dumpfile_delegate.py @@ -270,11 +270,6 @@ class DumpfileDelegate(SVNRepositoryDelegate): data = self._revision_reader.get_content(cvs_rev) - if Ctx().decode_apple_single: - # Insert a filter to decode any files that are in AppleSingle - # format: - data = get_maybe_apple_single(data) - # Convert all EOLs to LFs if neccessary eol_style = svn_props.get('svn:eol-style', None) if eol_style: diff --git a/cvs2svn_lib/rcs_revision_manager.py b/cvs2svn_lib/rcs_revision_manager.py index f5af7027..7401a6b9 100644 --- a/cvs2svn_lib/rcs_revision_manager.py +++ b/cvs2svn_lib/rcs_revision_manager.py @@ -21,7 +21,9 @@ from cvs2svn_lib.common import FatalError from cvs2svn_lib.process import check_command_runs from cvs2svn_lib.process import get_command_output from cvs2svn_lib.process import CommandFailedException +from cvs2svn_lib.context import Ctx from cvs2svn_lib.revision_manager import RevisionReader +from cvs2svn_lib.apple_single_filter import get_maybe_apple_single class RCSRevisionReader(RevisionReader): @@ -46,6 +48,13 @@ class RCSRevisionReader(RevisionReader): if cvs_rev.get_property('_keyword_handling') == 'collapsed': pipe_cmd.append('-kk') pipe_cmd.append(cvs_rev.cvs_file.filename) - return get_command_output(pipe_cmd) + data = get_command_output(pipe_cmd) + + if Ctx().decode_apple_single: + # Insert a filter to decode any files that are in AppleSingle + # format: + data = get_maybe_apple_single(data) + + return data diff --git a/cvs2svn_lib/revision_manager.py b/cvs2svn_lib/revision_manager.py index 34c11c0c..b696faea 100644 --- a/cvs2svn_lib/revision_manager.py +++ b/cvs2svn_lib/revision_manager.py @@ -100,7 +100,8 @@ class RevisionReader(object): CVS_REV is a CVSRevision. If CVS_REV has a property _keyword_handling=='collapsed' then collapse RCS/CVS keywords in - the output.""" + the output. If Ctx().decode_apple_single is set, then extract the + data fork from any content that looks like AppleSingle format.""" raise NotImplementedError() -- 2.11.4.GIT