/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

startĀ onĀ 0.5.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
108
108
        self._cache.add(tree.get_revision_id(), tree)
109
109
 
110
110
 
111
 
def _find_missing_bzr_revids(get_parent_map, want, have):
 
111
def _find_missing_bzr_revids(graph, want, have):
112
112
    """Find the revisions that have to be pushed.
113
113
 
114
114
    :param get_parent_map: Function that returns the parents for a sequence
117
117
    :param have: Revisions the target already has
118
118
    :return: Set of revisions to fetch
119
119
    """
120
 
    pending = want - have
121
 
    processed = set()
122
120
    todo = set()
123
 
    while pending:
124
 
        processed.update(pending)
125
 
        next_map = get_parent_map(pending)
126
 
        next_pending = set()
127
 
        for item in next_map.iteritems():
128
 
            if item[0] in have:
129
 
                continue
130
 
            todo.add(item[0])
131
 
            next_pending.update(p for p in item[1] if p not in processed)
132
 
        pending = next_pending
 
121
    for rev in want:
 
122
        todo.update(graph.find_unique_ancestors(rev, have))
133
123
    if NULL_REVISION in todo:
134
124
        todo.remove(NULL_REVISION)
135
125
    return todo
622
612
        ret = self.lookup_git_shas(have + want)
623
613
        for commit_sha in have:
624
614
            try:
625
 
                (type, (revid, tree_sha)) = ret[commit_sha]
 
615
                (type, (revid, tree_sha, verifiers)) = ret[commit_sha]
626
616
            except KeyError:
627
617
                pass
628
618
            else:
633
623
            if commit_sha in have:
634
624
                continue
635
625
            try:
636
 
                (type, (revid, tree_sha)) = ret[commit_sha]
 
626
                (type, (revid, tree_sha, verifiers)) = ret[commit_sha]
637
627
            except KeyError:
638
628
                pass
639
629
            else:
640
630
                assert type == "commit"
641
631
                pending.add(revid)
642
632
 
643
 
        todo = _find_missing_bzr_revids(self.repository.get_parent_map, 
644
 
                                        pending, processed)
 
633
        graph = self.repository.get_graph()
 
634
        todo = _find_missing_bzr_revids(graph, pending, processed)
645
635
        trace.mutter('sending revisions %r', todo)
646
636
        ret = []
647
637
        pb = ui.ui_factory.nested_progress_bar()
648
638
        try:
649
639
            for i, revid in enumerate(todo):
650
640
                pb.update("generating git objects", i, len(todo))
651
 
                rev = self.repository.get_revision(revid)
 
641
                try:
 
642
                    rev = self.repository.get_revision(revid)
 
643
                except errors.NoSuchRevision:
 
644
                    continue
652
645
                tree = self.tree_cache.revision_tree(revid)
653
646
                for path, obj, ie in self._revision_to_objects(rev, tree,
654
647
                    roundtrip=not lossy):