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

Special-case NULL_REVISION when looking for Git shas.

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
        self._cache = lru_cache.LRUSizeCache(max_size=MAX_TREE_CACHE_SIZE,
72
72
            after_cleanup_size=None, compute_size=approx_tree_size)
73
73
 
74
 
    def revision_tree(self, revid):            
 
74
    def revision_tree(self, revid):
75
75
        try:
76
 
            return self._cache[revid] 
 
76
            return self._cache[revid]
77
77
        except KeyError:
78
78
            tree = self.repository.revision_tree(revid)
79
79
            self.add(tree)
175
175
                    pie.symlink_target == ie.symlink_target):
176
176
                    return pie
177
177
        raise KeyError
178
 
    
 
178
 
179
179
    # Find all the changed blobs
180
180
    for (file_id, path, changed_content, versioned, parent, name, kind,
181
181
         executable) in tree.iter_changes(base_tree):
398
398
        updater = self._get_updater(rev)
399
399
        for path, obj, ie in self._revision_to_objects(rev, tree,
400
400
            roundtrip=True):
401
 
            updater.add_object(obj, ie)
 
401
            updater.add_object(obj, ie, path)
402
402
        commit_obj = updater.finish()
403
403
        return commit_obj.id
404
404
 
502
502
            if type == "commit":
503
503
                return self.repository.has_revision(type_data[0])
504
504
            elif type == "blob":
505
 
                return self.repository.texts.has_version(type_data)
 
505
                return self.repository.texts.has_key(type_data)
506
506
            elif type == "tree":
507
507
                return self.repository.has_revision(type_data[1])
508
508
            else:
511
511
            return False
512
512
 
513
513
    def lookup_git_shas(self, shas, update_map=True):
 
514
        from dulwich.protocol import ZERO_SHA
514
515
        ret = {}
515
516
        for sha in shas:
 
517
            if sha == ZERO_SHA:
 
518
                ret[sha] = NULL_REVISION
 
519
                continue
516
520
            try:
517
521
                ret[sha] = self._cache.idmap.lookup_git_sha(sha)
518
522
            except KeyError: