contrib/convert-repo
author Martin Geisler <mg@aragost.com>
Thu, 10 Mar 2011 16:49:37 +0100
changeset 13576 edd06611a7c6
parent 6365 1d3eb332f3cb
permissions -rwxr-xr-x
ui: yield unchanged values in walkconfig Ever since walkconfig was introduced back in 25e7ea0f2cff, the values yielded has been mutated by replacing "\n" with "\\n". This makes walkconfig less useful than it could and there is no other way to iterate over all config sections. The third-party reposettings extension used ui.walkconfig but did not take the replacement into account -- this change will actually fix a bug in the extension when a value contains a newline.

#!/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)