diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -208,6 +208,8 @@ def archive(repo, dest, node, kind, deco archiver.addfile(name, mode, islink, data) ctx = repo.changectx(node) + if kind not in archivers: + raise util.Abort(_("unknown archive type '%s'" % kind)) archiver = archivers[kind](dest, prefix, mtime or ctx.date()[0]) m = ctx.manifest() items = m.items() diff --git a/tests/test-archive b/tests/test-archive --- a/tests/test-archive +++ b/tests/test-archive @@ -69,6 +69,8 @@ if [ -f rev-0.tar ]; then echo 'rev-0.tar created' fi +hg archive -t bogus test.bogus + echo '% empty repo' hg init ../empty cd ../empty diff --git a/tests/test-archive.out b/tests/test-archive.out --- a/tests/test-archive.out +++ b/tests/test-archive.out @@ -39,5 +39,6 @@ test-TIP/bar test-TIP/baz/bletch test-TIP/foo rev-0.tar created +abort: unknown archive type 'bogus' % empty repo abort: repository has no revisions