/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 push.py

Fix support for older versions of Dulwich.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Push implementation that simply prints message saying push is not supported."""
18
18
 
19
19
from bzrlib import (
 
20
    errors,
20
21
    ui,
21
22
    )
22
23
from bzrlib.repository import (
70
71
            yield (revid, git_commit)
71
72
 
72
73
    def need_sha(self, sha):
73
 
        if sha in self._sent_shas:
 
74
        if sha is None or sha in self._sent_shas:
74
75
            return False
75
76
        (type, (fileid, revid)) = self._object_store._idmap.lookup_git_sha(sha)
76
77
        assert type in ("blob", "tree")
81
82
        # or already present remotely (as git doesn't do ghosts)
82
83
        return False
83
84
 
84
 
    def queue(self, sha, obj, path, ie=None, inv=None):
 
85
    def queue(self, sha, obj, path, ie=None, inv=None, unusual_modes=None):
85
86
        if obj is None:
86
 
            obj = (ie, inv)
 
87
            # Can't lazy-evaluate directories, since they might be eliminated
 
88
            if ie.kind == "directory":
 
89
                obj = self._object_store._get_ie_object(ie, inv, unusual_modes)
 
90
                if obj is None:
 
91
                    return
 
92
            else:
 
93
                obj = (ie, inv, unusual_modes)
87
94
        self._pending.append((obj, path))
88
95
        self._sent_shas.add(sha)
89
96
 
103
110
                tree_sha = sha
104
111
            if not self.need_sha(sha):
105
112
                continue
106
 
            self.queue(sha, object, inv.id2path(ie.file_id), ie, inv)
 
113
            self.queue(sha, object, inv.id2path(ie.file_id), ie, inv, unusual_modes)
107
114
            if ie.kind == "directory":
108
115
                todo.extend(ie.children.values())
109
116
        assert tree_sha is not None
110
117
        commit = self._object_store._get_commit(rev, tree_sha)
111
 
        self.queue(commit.id, commit, None)
 
118
        self.queue(commit.id, commit, None, None)
112
119
        return commit.id
113
120
 
114
121
    def __len__(self):
183
190
            def check_revid(revid):
184
191
                if revid == NULL_REVISION:
185
192
                    return True
186
 
                return (self.source_store._lookup_revision_sha1(revid) in target_store)
 
193
                try:
 
194
                    return (self.source_store._lookup_revision_sha1(revid) in target_store)
 
195
                except errors.NoSuchRevision:
 
196
                    # Ghost, can't dpush
 
197
                    return True
187
198
            todo = list(self.missing_revisions(stop_revisions, check_revid))
188
199
            pb = ui.ui_factory.nested_progress_bar()
189
200
            try: