Give proper warning message when running 'bzr svn-import' on something that is
authorJelmer Vernooij <jelmer@samba.org>
Wed, 26 Sep 2007 12:05:21 +0000 (14:05 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 26 Sep 2007 12:05:21 +0000 (14:05 +0200)
not a Subversion repository.

NEWS
__init__.py

diff --git a/NEWS b/NEWS
index e6e0885ea79ae8905d28ad5aad9642027c490e13..d6e1194e5dbb54603b6bfd2e27fba5aaf9f5f76d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,9 @@ bzr-svn 0.4.4 UNRELEASED
    * Give proper warning message when running 'bzr svn-branching-scheme' on 
      something that is not a Subversion repository. (#145159)
 
+   * Give proper warning message when running 'bzr svn-import' on 
+     something that is not a Subversion repository. 
+
   DOCUMENTATION
 
    * Add simple FAQ file. (#144388)
index 63f311546ee937bef264ba7585bdfb0b7c960ed6..3c8e05821346a7b155e839a68610162285fabfb0 100644 (file)
@@ -167,9 +167,10 @@ class cmd_svn_import(Command):
     @display_command
     def run(self, from_location, to_location=None, trees=False, 
             standalone=False, scheme=None, all=False, prefix=None):
-        from bzrlib.errors import NoRepositoryPresent
+        from bzrlib.errors import BzrCommandError, NoRepositoryPresent
         from bzrlib.bzrdir import BzrDir
         from convert import convert_repository
+        from repository import SvnRepository
         import os
 
         if to_location is None:
@@ -193,10 +194,13 @@ class cmd_svn_import(Command):
         try:
             from_repos = from_dir.open_repository()
         except NoRepositoryPresent, e:
-            from bzrlib.errors import BzrCommandError
             raise BzrCommandError("No Repository found at %s. "
                 "For individual branches, use 'bzr branch'." % from_location)
 
+        if not isinstance(from_repos, SvnRepository):
+            raise BzrCommandError(
+                    "Not a Subversion repository: %s" % from_location)
+
         def filter_branch((branch_path, revnum, exists)):
             if prefix is not None and not branch_path.startswith(prefix):
                 return False