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

Simplify checks against base hex sha a bit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
143
143
        base_ie = None
144
144
        base_sha = None
145
145
    else:
146
 
        if base_ie.text_id == hexsha:
147
 
            return [], []
 
146
        base_sha = base_ie.text_id
148
147
        try:
149
 
            base_sha = shagitmap.lookup_blob(file_id, base_ie.revision)
 
148
            if base_sha is None:
 
149
                base_sha = shagitmap.lookup_blob(file_id, base_ie.revision)
150
150
        except KeyError:
151
151
            base_sha = None
152
152
        else:
192
192
        assert ie.revision is not None
193
193
        texts.add_lines((file_id, ie.revision), tuple(parent_keys),
194
194
            osutils.split_lines(blob.data))
 
195
        shamap = [(hexsha, "blob", (ie.file_id, ie.revision))]
 
196
    else:
 
197
        shamap = []
195
198
    if file_id in base_inv:
196
199
        old_path = base_inv.id2path(file_id)
197
200
    else:
198
201
        old_path = None
199
 
    return ([(old_path, path, file_id, ie)],
200
 
            [(hexsha, "blob", (ie.file_id, ie.revision))])
 
202
    return ([(old_path, path, file_id, ie)], shamap)
201
203
 
202
204
 
203
205
def import_git_tree(texts, mapping, path, hexsha, base_inv, parent_id, 
225
227
        texts.add_lines((file_id, ie.revision), (), [])
226
228
        invdelta.append((None, path, file_id, ie))
227
229
    else:
228
 
        if base_ie.text_id == hexsha:
229
 
            return [], {}, []
 
230
        base_sha = base_ie.text_id
230
231
        # See if this has changed at all
231
232
        try:
232
 
            base_sha = shagitmap.lookup_tree(file_id, base_inv.revision_id)
 
233
            if base_sha is None:
 
234
                base_sha = shagitmap.lookup_tree(file_id, base_inv.revision_id)
233
235
        except KeyError:
234
236
            pass
235
237
        else: