cleanly abort on unknown archive type (issue966)
authorDirkjan Ochtman <dirkjan@ochtman.nl>
Tue, 05 Feb 2008 15:54:42 +0100
changeset 6019 b70a530bdb93
parent 6017 b29b75ce9645
child 6020 20b05618b3e2
child 6027 cee68264ed92
cleanly abort on unknown archive type (issue966)
mercurial/archival.py
tests/test-archive
tests/test-archive.out
--- a/mercurial/archival.py	Tue Feb 05 14:02:03 2008 +0100
+++ b/mercurial/archival.py	Tue Feb 05 15:54:42 2008 +0100
@@ -208,6 +208,8 @@
         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()
--- a/tests/test-archive	Tue Feb 05 14:02:03 2008 +0100
+++ b/tests/test-archive	Tue Feb 05 15:54:42 2008 +0100
@@ -69,6 +69,8 @@
     echo 'rev-0.tar created'
 fi
 
+hg archive -t bogus test.bogus
+
 echo '% empty repo'
 hg init ../empty
 cd ../empty
--- a/tests/test-archive.out	Tue Feb 05 14:02:03 2008 +0100
+++ b/tests/test-archive.out	Tue Feb 05 15:54:42 2008 +0100
@@ -39,5 +39,6 @@
 test-TIP/baz/bletch
 test-TIP/foo
 rev-0.tar created
+abort: unknown archive type 'bogus'
 % empty repo
 abort: repository has no revisions