##// END OF EJS Templates
convert: better error on invalid repository type
Patrick Mezard -
r9962:a7178ecc default
parent child Browse files
Show More
@@ -48,6 +48,8 b' sink_converters = ['
48
48
49 def convertsource(ui, path, type, rev):
49 def convertsource(ui, path, type, rev):
50 exceptions = []
50 exceptions = []
51 if type and type not in [s[0] for s in source_converters]:
52 raise util.Abort(_('%s: invalid source repository type') % type)
51 for name, source, sortmode in source_converters:
53 for name, source, sortmode in source_converters:
52 try:
54 try:
53 if not type or name == type:
55 if not type or name == type:
@@ -60,6 +62,8 b' def convertsource(ui, path, type, rev):'
60 raise util.Abort(_('%s: missing or unsupported repository') % path)
62 raise util.Abort(_('%s: missing or unsupported repository') % path)
61
63
62 def convertsink(ui, path, type):
64 def convertsink(ui, path, type):
65 if type and type not in [s[0] for s in sink_converters]:
66 raise util.Abort(_('%s: invalid destination repository type') % type)
63 for name, sink in sink_converters:
67 for name, sink in sink_converters:
64 try:
68 try:
65 if not type or name == type:
69 if not type or name == type:
@@ -50,3 +50,10 b' mkdir emptydir'
50 # override $PATH to ensure p4 not visible; use $PYTHON in case we're
50 # override $PATH to ensure p4 not visible; use $PYTHON in case we're
51 # running from a devel copy, not a temp installation
51 # running from a devel copy, not a temp installation
52 PATH=$BINDIR $PYTHON $BINDIR/hg convert emptydir 2>&1 | sed 's,file://.*/emptydir,.../emptydir,g'
52 PATH=$BINDIR $PYTHON $BINDIR/hg convert emptydir 2>&1 | sed 's,file://.*/emptydir,.../emptydir,g'
53
54 echo % convert with imaginary source type
55 hg convert --source-type foo a a-foo
56 echo % convert with imaginary sink type
57 hg convert --dest-type foo a a-foo
58
59 true
@@ -259,3 +259,8 b' emptydir does not look like a GNU Arch r'
259 emptydir does not look like a Bazaar repo
259 emptydir does not look like a Bazaar repo
260 cannot find required "p4" tool
260 cannot find required "p4" tool
261 abort: emptydir: missing or unsupported repository
261 abort: emptydir: missing or unsupported repository
262 % convert with imaginary source type
263 initializing destination a-foo repository
264 abort: foo: invalid source repository type
265 % convert with imaginary sink type
266 abort: foo: invalid destination repository type
General Comments 0
You need to be logged in to leave comments. Login now