/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

Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
105
105
            self.branch.mapping.revision_id_bzr_to_foreign(revid)
106
106
 
107
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
 
108
120
class GitBranchFormat(branch.BranchFormat):
109
121
 
110
122
    def get_format_description(self):
124
136
class GitBranch(ForeignBranch):
125
137
    """An adapter to git repositories for bzr Branch objects."""
126
138
 
127
 
    def __init__(self, bzrdir, repository, name, lockfiles):
 
139
    def __init__(self, bzrdir, repository, name, lockfiles, tagsdict=None):
128
140
        self.repository = repository
129
141
        self._format = GitBranchFormat()
130
142
        self.control_files = lockfiles
131
143
        self.bzrdir = bzrdir
132
144
        super(GitBranch, self).__init__(repository.get_mapping())
 
145
        if tagsdict is not None:
 
146
            self.tags = DictTagDict(self, tagsdict)
133
147
        self.name = name
134
148
        self._head = None
135
149
        self.base = bzrdir.transport.base
136
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
 
137
157
    def get_child_submit_format(self):
138
158
        """Return the preferred format of submissions to this branch."""
139
159
        ret = self.get_config().get_user_option("child_submit_format")
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:
524
536
        result = GitBranchPushResult()
525
537
        result.source_branch = self.source
526
538
        result.target_branch = self.target
527
 
        result.old_revid = self.target.last_revision()
 
539
        try:
 
540
            result.old_revid = self.target.last_revision()
 
541
        except NoSuchRef:
 
542
            result.old_revid = revision.NULL_REVISION
528
543
        if stop_revision is None:
529
544
            stop_revision = self.source.last_revision()
530
545
        # FIXME: Check for diverged branches