/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to commands.py

Error out on non-git repositories.

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
 
62
62
    def run(self, src_location, dest_location=None):
63
63
        from bzrlib.bzrdir import BzrDir, format_registry
64
 
        from bzrlib.errors import NoRepositoryPresent, NotBranchError
 
64
        from bzrlib.errors import (
 
65
            BzrCommandError,
 
66
            NoRepositoryPresent,
 
67
            NotBranchError,
 
68
            )
65
69
        from bzrlib.repository import Repository
66
70
        import os
 
71
        from bzrlib.plugins.git.repository import GitRepository
67
72
 
68
73
        if dest_location is None:
69
74
            dest_location = os.path.basename(src_location.rstrip("/\\"))
70
75
 
71
76
        source_repo = Repository.open(src_location)
 
77
        if not isinstance(source_repo, GitRepository):
 
78
            raise BzrCommandError("%r is not a git repository" % src_location)
72
79
        format = format_registry.make_bzrdir('rich-root-pack')
73
80
        try:
74
81
            target_bzrdir = BzrDir.open(dest_location)