Trouble writing a simple symbol transformer

Markus Schöpflin <[email protected]> Fri, 14 Dec 2012 15:37:43 +0100
Newsgroups gmane.comp.version-control.subversion.cvs2svn.user
Message-ID <[email protected]>
Hello,

I'm trying to use a custom symbol transformation class as explained in the 
FAQ. The class looks like this:

class MySymbolTransform:
     def __init__(self):
         self.mapping = {
             "foo" : "bar" }
     def transform(self, cvs_file, symbol_name, revision):
         return self.mapping.get(symbol_name, "CVS_%s" % symbol_name)

This is then used like this:

run_options.set_project(
     ...
     symbol_transforms=[
         MySymbolTransform(),
         ReplaceSubstringsSymbolTransform('\\','/'),
         NormalizePathsSymbolTransform(),
         ],


This seems to work as I'm getting the following output from pass 1:

Summary of symbol transforms:
...
     "unlabeled-1.1.1.1.12" transformed to "CVS_unlabeled-1.1.1.1.12" in 17 files
     "unlabeled-1.1.1.1.14" transformed to "CVS_unlabeled-1.1.1.1.14" in 3 files
     "unlabeled-1.1.1.1.16" transformed to "CVS_unlabeled-1.1.1.1.16" in 17 files
     "unlabeled-1.1.1.1.18" transformed to "CVS_unlabeled-1.1.1.1.18" in 3 files
     "unlabeled-1.1.1.1.2" transformed to "CVS_unlabeled-1.1.1.1.2" in 34 files
...

The problem is that after pass 1 I get the following python exception:

Traceback (most recent call last):
   File ".../local/git/cvs2svn-trunk/cvs2git", line 70, in <module>
     git_main(os.path.basename(sys.argv[0]), sys.argv[1:])
   File ".../git/cvs2svn-trunk/cvs2svn_lib/main.py", line 119, in git_main
     main(progname, run_options, pass_manager)
   File ".../git/cvs2svn-trunk/cvs2svn_lib/main.py", line 96, in main
     pass_manager.run(run_options)
   File ".../git/cvs2svn-trunk/cvs2svn_lib/pass_manager.py", line 181, in run
     the_pass.run(run_options, stats_keeper)
   File ".../git/cvs2svn-trunk/cvs2svn_lib/passes.py", line 123, in run
     write_projects(artifact_manager.get_temp_file(config.PROJECTS))
   File ".../git/cvs2svn-trunk/cvs2svn_lib/project.py", line 220, in 
write_projects
     cPickle.dump(Ctx()._projects.values(), open(filename, 'wb'), -1)
cPickle.PicklingError: Can't pickle __builtin__.MySymbolTransform: attribute 
lookup __builtin__.MySymbolTransform failed

Can anyone tell me what to do about this, as I have no idea what could be wrong.

TIA,
Markus

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

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