contrib/convert-repo
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
Wed, 05 Aug 2009 17:19:37 +0200
changeset 9315 fb66a7d3f28f
parent 6365 1d3eb332f3cb
permissions -rwxr-xr-x
dispatch: also pass level argument to __import__ for ignored modules I wanted to check if mercurial.demandimport could speed up the loading of PyObjC, and ran into this: the level argument for __import__, available in Python 2.5 and later, is silently dropped when doing an 'import *'. I have no idea what these arguments mean, but this minor change made it work. (Oh, and because of that 'from ... import *', PyObjC still took about 2s...)

#!/usr/bin/env python
#
# Wrapper script around the convert.py hgext extension
# for foreign SCM conversion to mercurial format.
#

import sys
from mercurial import ui, fancyopts
from hgext import convert

# Options extracted from the cmdtable
func, options, help = convert.cmdtable['convert']

# An ui instance
u = ui.ui()

opts = {}
args = []
try:
    args = list(fancyopts.fancyopts(sys.argv[1:], options, opts))
    args += [None]*(3 - len(args))
    src, dest, revmapfile = args
except (fancyopts.getopt.GetoptError, ValueError), inst:
    u.warn('Usage:\n%s\n' % help)
    sys.exit(-1)

convert.convert(u, src, dest, revmapfile, **opts)