/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 branch.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:
27
27
    bzrdir,
28
28
    config,
29
29
    errors,
30
 
    foreign,
31
30
    repository,
32
31
    revision,
33
32
    tag,
52
51
    NoSuchRef,
53
52
    )
54
53
 
55
 
try:
56
 
    from bzrlib.foreign import ForeignBranch
57
 
except ImportError:
58
 
    class ForeignBranch(branch.Branch):
59
 
        def __init__(self, mapping):
60
 
            self.mapping = mapping
61
 
            super(ForeignBranch, self).__init__()
 
54
from bzrlib.foreign import ForeignBranch
62
55
 
63
56
 
64
57
def extract_tags(refs, mapping):
112
105
            self.branch.mapping.revision_id_bzr_to_foreign(revid)
113
106
 
114
107
 
 
108
class DictTagDict(LocalGitTagDict):
 
109
 
 
110
 
 
111
    def __init__(self, branch, tags):
 
112
        super(DictTagDict, self).__init__(branch)
 
113
        self._tags = tags
 
114
 
 
115
    def get_tag_dict(self):
 
116
        return self._tags
 
117
 
 
118
 
 
119
 
115
120
class GitBranchFormat(branch.BranchFormat):
116
121
 
117
122
    def get_format_description(self):
131
136
class GitBranch(ForeignBranch):
132
137
    """An adapter to git repositories for bzr Branch objects."""
133
138
 
134
 
    def __init__(self, bzrdir, repository, name, lockfiles):
 
139
    def __init__(self, bzrdir, repository, name, lockfiles, tagsdict=None):
135
140
        self.repository = repository
136
141
        self._format = GitBranchFormat()
137
142
        self.control_files = lockfiles
138
143
        self.bzrdir = bzrdir
139
144
        super(GitBranch, self).__init__(repository.get_mapping())
 
145
        if tagsdict is not None:
 
146
            self.tags = DictTagDict(self, tagsdict)
140
147
        self.name = name
141
148
        self._head = None
142
149
        self.base = bzrdir.transport.base
143
150
 
 
151
    def _get_checkout_format(self):
 
152
        """Return the most suitable metadir for a checkout of this branch.
 
153
        Weaves are used if this branch's repository uses weaves.
 
154
        """
 
155
        return get_rich_root_format()
 
156
 
 
157
    def get_child_submit_format(self):
 
158
        """Return the preferred format of submissions to this branch."""
 
159
        ret = self.get_config().get_user_option("child_submit_format")
 
160
        if ret is not None:
 
161
            return ret
 
162
        return "git"
 
163
 
144
164
    def _get_nick(self, local=False, possible_master_transports=None):
145
165
        """Find the nick name for this branch.
146
166
 
204
224
class LocalGitBranch(GitBranch):
205
225
    """A local Git branch."""
206
226
 
207
 
    def _get_checkout_format(self):
208
 
        """Return the most suitable metadir for a checkout of this branch.
209
 
        Weaves are used if this branch's repository uses weaves.
210
 
        """
211
 
        format = self.repository.bzrdir.checkout_metadir()
212
 
        format.set_branch_format(self._format)
213
 
        return format
214
 
 
215
227
    def create_checkout(self, to_location, revision_id=None, lightweight=False,
216
228
        accelerator_tree=None, hardlink=False):
217
229
        if lightweight: