/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

  • Committer: Jelmer Vernooij
  • Date: 2009-09-10 13:13:15 UTC
  • mto: (0.200.602 trunk)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20090910131315-6890xg58pl2jseml
Allow serving remote URLs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
from bzrlib.plugins.git import (
32
32
    get_rich_root_format,
33
 
    lazy_check_versions,
34
33
    )
35
34
 
36
35
class cmd_git_import(Command):
48
47
            )
49
48
        from bzrlib.bzrdir import (
50
49
            BzrDir,
51
 
            format_registry,
52
50
            )
53
51
        from bzrlib.errors import (
54
52
            BzrCommandError,
59
57
            InterRepository,
60
58
            Repository,
61
59
            )
62
 
        from bzrlib.plugins.git.branch import GitBranch
 
60
        from bzrlib.plugins.git.branch import (
 
61
            GitBranch,
 
62
            extract_tags,
 
63
            )
63
64
        from bzrlib.plugins.git.repository import GitRepository
64
65
 
65
66
        if dest_location is None:
78
79
        except NoRepositoryPresent:
79
80
            target_repo = target_bzrdir.create_repository(shared=True)
80
81
 
 
82
        if not target_repo.supports_rich_root():
 
83
            raise BzrCommandError("Target repository doesn't support rich roots")
 
84
 
81
85
        interrepo = InterRepository.get(source_repo, target_repo)
82
86
        mapping = source_repo.get_mapping()
83
87
        refs = interrepo.fetch_refs()
 
88
        tags = extract_tags(refs, mapping)
84
89
        pb = ui.ui_factory.nested_progress_bar()
85
90
        try:
86
91
            for i, (name, ref) in enumerate(refs.iteritems()):
101
106
                    head_branch = head_bzrdir.create_branch()
102
107
                revid = mapping.revision_id_foreign_to_bzr(ref)
103
108
                source_branch = GitBranch(source_repo.bzrdir, source_repo, 
104
 
                    name, None)
 
109
                    name, None, tags)
105
110
                source_branch.head = ref
106
 
                head_branch.generate_revision_history(revid)
 
111
                if head_branch.last_revision() != revid:
 
112
                    head_branch.generate_revision_history(revid)
107
113
                source_branch.tags.merge_to(head_branch.tags)
108
114
        finally:
109
115
            pb.finished()