Re: PATCHES: more refactoring and skeletal cvs2hg

Greg Ward <[email protected]>
Newsgroups gmane.comp.version-control.subversion.cvs2svn.devel
Message-ID <[email protected]>
On Mon, Aug 31, 2009 at 4:38 AM, Michael Haggerty<[email protected]> wrote:
> Yes, exactly.  I think renaming classes and changing class hierarchies
> happen with comparable frequency, so it seem that you are gaining in one
> situation and losing in the other at a high cost in verbosity.  It's
> just a pity that Python doesn't have a nicer way of spelling super(...).

Totally agreed.  It sounds like this has been fixed in 3.0, but at the
cost of some magic:
http://lucumr.pocoo.org/2008/4/30/how-super-in-python3-works-and-why-its-retarded
.  Anyways, this is getting waaaaay off-topic.

>> Hmmm.  IMHO the duplication between cvs2{svn,git,hg,bzr} is worse than
>> the duplication in main.py.
>
> I don't mind the duplication in main.py, which is really quite minimal.
>  What I would like to avoid is that cvs2xxx has to import code that is
> only useful for cvs2yyy.  Currently, all scripts import main.py, and
> main unconditionally imports svn_run_options, git_run_options, and
> bzr_run_options, which probably import lots more junk that is
> backend-specific.

Yes.  Note that hg_main() does things differently:

def hg_main(progname, cmd_args):
  # Import late so cvs2{svn,git} do not depend on being able to import
  # the Mercurial API.
  from cvs2svn_lib.hg_run_options import HgRunOptions

Moving each main() to *_run_options.py might complicate that slightly.
 Would not be difficult to overcome, though; it's only the import of
hg_output_option that needs to be delayed, because that's where the
"import mercurial" happens.

> I suppose we could have a python_version_check.py module, import it from
> each of the main scripts, then call
> python_version_check.check_version(progname).  I don't think we want to
> move this check to main.py, though, because it has to be loadable from
> the widest possible range of Python versions.

Why not just put it in cvs2svn_lib/__init__.py?  That would enable a
fairly simple idiom:

  import cvs2svn_lib
  cvs2svn_lib.check_python_version()

which could be the same in each cvs2* script as well as run-tests.py.
That means __init__.py must be tiny and compatible with everything
from 1.5.2 to 3.1, which I *think* is possible.

Greg

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

To unsubscribe from this discussion, e-mail: [[email protected]].
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.