Patch: Finer-grained control over AppleSingle decoding

Ben Artin <[email protected]>
Newsgroups gmane.comp.version-control.subversion.cvs2svn.devel
Message-ID <[email protected]>
I am converting a large CVS repository to Subversion. Some parts of  
this repository have AppleSingle files that I want to convert to  
ordinary files, and some of them I want to leave as AppleSingle.

To make this possible, I extended cvs2svn to accept a callable for the  
decode_apple_single options file parameter. True and False are  
accepted as before, but if a callable is given, then it is called for  
every revision, and expected to return True or False indicating  
whether that specific CVS revision should be decoded.

I am attaching the patch.

------------------------------------------------------
http://cvs2svn.tigris.org/ds/viewMessage.do?dsForumId=1667&dsMessageId=2381178

To unsubscribe from this discussion, e-mail: [[email protected]].

I am converting a large CVS repository to Subversion. Some parts of  
this repository have AppleSingle files that I want to convert to  
ordinary files, and some of them I want to leave as AppleSingle.

To make this possible, I extended cvs2svn to accept a callable for the  
decode_apple_single options file parameter. True and False are  
accepted as before, but if a callable is given, then it is called for  
every revision, and expected to return True or False indicating  
whether that specific CVS revision should be decoded.

I am attaching the patch.

------------------------------------------------------
http://cvs2svn.tigris.org/ds/viewMessage.do?dsForumId=1667&dsMessageId=2381178

To unsubscribe from this discussion, e-mail: [[email protected]].
decode-apple-single.patch (application/octet-stream, 1.8 KB)
Index: cvs2svn-example.options
===================================================================
--- cvs2svn-example.options	(revision 4840)
+++ cvs2svn-example.options	(working copy)
@@ -301,11 +301,18 @@
 # following option to True if you would like cvs2svn to identify files
 # whose contents are encoded in AppleSingle format, and discard all
 # but the data fork for such files before committing them to
-# Subversion.  (Please note that AppleSingle contents are identified
+# Subversion.  If you want finer-grained control over decoding of
+# AppleSingle files, set the following option to a function that returns
+# True for all files that should be decoded
+# def decode_myproject(cvs_rev):
+#   path = cvs_rev.cvs_path
+#   return path.startswith('myproject/')
+# (Please note that AppleSingle contents are identified
 # by the AppleSingle magic number as the first four bytes of the file.
 # This check is not failproof, so only set this option if you think
 # you need it.)
 ctx.decode_apple_single = False
+# ctx.decode_apple_single = decode_myproject
 
 # This option can be set to the name of a filename to which are stored
 # statistics and conversion decisions about the CVS symbols.
Index: cvs2svn_lib/dumpfile_delegate.py
===================================================================
--- cvs2svn_lib/dumpfile_delegate.py	(revision 4840)
+++ cvs2svn_lib/dumpfile_delegate.py	(working copy)
@@ -259,7 +259,7 @@
         cvs_rev, suppress_keyword_substitution=s_item.has_keywords()
         )
 
-    if Ctx().decode_apple_single:
+    if callable(Ctx().decode_apple_single) and Ctx().decode_apple_single(cvs_rev) or Ctx().decode_apple_single:
       # Insert a filter to decode any files that are in AppleSingle
       # format:
       stream = get_maybe_apple_single_stream(stream)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.