/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

Use ZERO_SHA constant where possible.

Show diffs side-by-side

added added

removed removed

Lines of Context:
496
496
                isinstance(target, RemoteGitBranch))
497
497
 
498
498
    def _basic_push(self, overwrite=False, stop_revision=None):
 
499
        from dulwich.protocol import ZERO_SHA
499
500
        result = GitBranchPushResult()
500
501
        result.source_branch = self.source
501
502
        result.target_branch = self.target
503
504
            stop_revision = self.source.last_revision()
504
505
        # FIXME: Check for diverged branches
505
506
        def get_changed_refs(old_refs):
506
 
            result.old_revid = self.target.mapping.revision_id_foreign_to_bzr(old_refs.get(self.target.ref, "0" * 40))
 
507
            result.old_revid = self.target.mapping.revision_id_foreign_to_bzr(old_refs.get(self.target.ref, ZERO_SHA))
507
508
            refs = { self.target.ref: self.source.repository.lookup_bzr_revision_id(stop_revision)[0] }
508
509
            result.new_revid = stop_revision
509
510
            for name, sha in self.source.repository._git.refs.as_dict("refs/tags").iteritems():
585
586
        raise NoPushSupport()
586
587
 
587
588
    def lossy_push(self, stop_revision=None):
 
589
        from dulwich.protocol import ZERO_SHA
588
590
        result = GitBranchPushResult()
589
591
        result.source_branch = self.source
590
592
        result.target_branch = self.target
598
600
        revidmap, old_refs, new_refs = self.target.repository.dfetch_refs(
599
601
            self.source.repository, refs)
600
602
        result.old_revid = self.target.mapping.revision_id_foreign_to_bzr(
601
 
            old_refs.get(self.target.ref, "0" * 40))
 
603
            old_refs.get(self.target.ref, ZERO_SHA))
602
604
        result.new_revid = self.target.mapping.revision_id_foreign_to_bzr(
603
605
            new_refs[self.target.ref])
604
606
        result.revidmap = revidmap