Re: Weird scoping issue in options file
Greg Ward <[email protected]>
| Newsgroups | gmane.comp.version-control.subversion.cvs2svn.devel |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Aug 20, 2009 at 6:52 PM, Michael Haggerty<[email protected]> wrote: > I think that your fix has nothing to do with where ctx and run_options > are stored. Rather it has to do with the fact that you pass only one > dictionary to execfile(), which means that a single dictionary is used > for both globals and locals. Therefore the file-level imports end up > (also) in the globals dictionary, and are visible from within nested scopes. Hmmm, OK, I'll buy that. > I have committed your suggested patch (as trunk r4879), since it seems > like the right thing to do (even aside from the fact that it actually > works). Cool. Is there any way to write a test for that? It would be nice to catch if someone in 3 years breaks the execfile() call. The fact that you couldn't repro my problem with a cvs2svn options file is troubling. Why don't I just explain exactly what I did. First, I turned cvs2svn-example.options into cvs2svn-test.options with this patch: """ --- cvs2svn-example.options 2009-08-18 15:53:37.000000000 -0400 +++ cvs2svn-test.options 2009-08-21 09:32:34.000000000 -0400 @@ -130,6 +130,12 @@ # cvs2svn conversion. Please choose one of the following and adjust # the parameters as necessary: +class MyOutputOption(NewRepositoryOutputOption): + def __init__(self, *args, **kwargs): + #from cvs2svn_lib.svn_output_option import NewRepositoryOutputOption + NewRepositoryOutputOption.__init__(self, *args, **kwargs) + + # Use this output option if you would like cvs2svn to create a new SVN # repository and store the converted repository there. The first # argument is the path to which the repository should be written (this @@ -141,7 +147,7 @@ # options to be passed to "svnadmin create". The (optional) # author_transforms argument allows CVS author names to be transformed # arbitrarily into SVN author names (as described above): -ctx.output_option = NewRepositoryOutputOption( +ctx.output_option = MyOutputOption( r'/path/to/svnrepo', #fs_type='fsfs', #bdb_txn_nosync=False, """ (Note the commented-out import at method scope, necessary for this to work pre-r4879.) Then I ran cvs2svn --options cvs2svn-test.options And it crashed pretty darn soon. Is that enough info to create a proper test case? Greg ------------------------------------------------------ http://cvs2svn.tigris.org/ds/viewMessage.do?dsForumId=1667&dsMessageId=2386000 To unsubscribe from this discussion, e-mail: [[email protected]].