Re: [PATCH] New SymbolTransforms

Michael Haggerty <[email protected]> Mon, 29 Mar 2010 19:41:52 +0200
Newsgroups gmane.comp.version-control.subversion.cvs2svn.devel
Message-ID <[email protected]>
Jon Foster wrote:
> Michael Haggerty wrote:
>> Jon Foster wrote:
>>> P.S. It looks like SymbolTransforms have to be defined in the
>>> cvs2svn core - I originally tried to define these in my
>>> options.py file, but that fails with a pickle error.
>>
>> Oh, yes, that's awkward.  The reason is that the options file
>> is execfile()ed rather than imported, so the Pickle module has
>> no way to know how to access the class definitions when it is
>> trying to unpickle the SymbolTransform instances.
>>
>> [...]
>>
>> It would be nice if this were easier.  But off the top of my head
>> I can't think of a way.
> 
> My thoughts on seeing this problem were along the lines of "why is
> cvs2svn pickling the settings from the options file, rather than
> just reading the options file each time?"  Unfortunately, I doubt
> I'll get time to fix this.

Here was my thinking: it's because the Project objects created by the
options file are rather complex and interdependent objects.  For
example, they are given numeric IDs on the fly which are used all over
the rest of the code.  Many changes made to the options file between
passes would change the project instances in ways that would break the
databases that were created by earlier passes.  And the
SymbolTransforms, in turn, are stored in the Project instances, so they
get pickled along with them.

So it seemed easier and less error-prone to just pickle up the whole
Project instances rather than dealing with the ensuing user pain.

In fact, the SymbolTransforms are only used in pass1, so one could
consider deleting them from the Project instances before pickling.  But
this wouldn't solve similar problems with other nested objects, like
SymbolStrategyRules.

(For reference, the change to pickling Project objects was originally
made in r4009.)

Michael

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

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