/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

Fix dpushing without changes necessary.

Show diffs side-by-side

added added

removed removed

Lines of Context:
145
145
            stop_revision = source.last_revision()
146
146
        # FIXME: Check for diverged branches
147
147
        revidmap = self.repository.dfetch(source.repository, stop_revision)
148
 
        self.generate_revision_history(revidmap[stop_revision])
 
148
        if revidmap != {}:
 
149
            self.generate_revision_history(revidmap[stop_revision])
149
150
        return revidmap
150
151
 
151
152
    def generate_revision_history(self, revid, old_revid=None):
154
155
        self._set_head(newhead)
155
156
 
156
157
    def _set_head(self, head):
 
158
        self.head = head
157
159
        self.repository._git.set_ref(self.name, self.head)
158
 
        self.head = head
159
160
 
160
161
    def lock_write(self):
161
162
        self.control_files.lock_write()
295
296
            prev_last_revid = self.target.last_revision()
296
297
        self.target.generate_revision_history(self._last_revid, prev_last_revid)
297
298
 
 
299
    def pull(self, overwrite=False, stop_revision=None,
 
300
             possible_transports=None, _hook_master=None, run_hooks=True,
 
301
             _override_hook_target=None):
 
302
        """See Branch.pull.
 
303
 
 
304
        :param _hook_master: Private parameter - set the branch to
 
305
            be supplied as the master to pull hooks.
 
306
        :param run_hooks: Private parameter - if false, this branch
 
307
            is being called because it's the master of the primary branch,
 
308
            so it should not run its hooks.
 
309
        :param _override_hook_target: Private parameter - set the branch to be
 
310
            supplied as the target_branch to pull hooks.
 
311
        """
 
312
        result = branch.PullResult()
 
313
        result.source_branch = self.source
 
314
        if _override_hook_target is None:
 
315
            result.target_branch = self.target
 
316
        else:
 
317
            result.target_branch = _override_hook_target
 
318
        self.source.lock_read()
 
319
        try:
 
320
            # We assume that during 'pull' the target repository is closer than
 
321
            # the source one.
 
322
            graph = self.target.repository.get_graph(self.source.repository)
 
323
            result.old_revno, result.old_revid = \
 
324
                self.target.last_revision_info()
 
325
            self.target.update_revisions(self.source, stop_revision,
 
326
                overwrite=overwrite, graph=graph)
 
327
            result.tag_conflicts = self.source.tags.merge_to(self.target.tags,
 
328
                overwrite)
 
329
            result.new_revno, result.new_revid = self.target.last_revision_info()
 
330
            if _hook_master:
 
331
                result.master_branch = _hook_master
 
332
                result.local_branch = result.target_branch
 
333
            else:
 
334
                result.master_branch = result.target_branch
 
335
                result.local_branch = None
 
336
            if run_hooks:
 
337
                for hook in branch.Branch.hooks['post_pull']:
 
338
                    hook(result)
 
339
        finally:
 
340
            self.source.unlock()
 
341
        return result
 
342
 
 
343
 
 
344
 
298
345
 
299
346
branch.InterBranch.register_optimiser(InterGitGenericBranch)
300
347