/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 bzrlib/repofmt/pack_repo.py

  • Committer: Martin Albisetti
  • Date: 2008-04-04 01:06:44 UTC
  • mfrom: (3331 +trunk)
  • mto: (3350.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 3351.
  • Revision ID: argentina@gmail.com-20080404010644-3vurp3zln4uzu9nv
Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
642
642
        # at this point.
643
643
        self.pb.update("Copying inventory texts", 2)
644
644
        total_items, readv_group_iter = self._least_readv_node_readv(inv_nodes)
 
645
        # Only grab the output lines if we will be processing them
 
646
        output_lines = bool(self.revision_ids)
645
647
        inv_lines = self._copy_nodes_graph(inventory_index_map,
646
648
            self.new_pack._writer, self.new_pack.inventory_index,
647
 
            readv_group_iter, total_items, output_lines=True)
 
649
            readv_group_iter, total_items, output_lines=output_lines)
648
650
        if self.revision_ids:
649
651
            self._process_inventory_lines(inv_lines)
650
652
        else:
1926
1928
            found_parents[key[0]] = parents
1927
1929
        return found_parents
1928
1930
 
 
1931
    @symbol_versioning.deprecated_method(symbol_versioning.one_four)
 
1932
    @needs_read_lock
 
1933
    def get_revision_graph(self, revision_id=None):
 
1934
        """Return a dictionary containing the revision graph.
 
1935
 
 
1936
        :param revision_id: The revision_id to get a graph from. If None, then
 
1937
        the entire revision graph is returned. This is a deprecated mode of
 
1938
        operation and will be removed in the future.
 
1939
        :return: a dictionary of revision_id->revision_parents_list.
 
1940
        """
 
1941
        if 'evil' in debug.debug_flags:
 
1942
            mutter_callsite(3,
 
1943
                "get_revision_graph scales with size of history.")
 
1944
        # special case NULL_REVISION
 
1945
        if revision_id == _mod_revision.NULL_REVISION:
 
1946
            return {}
 
1947
        if revision_id is None:
 
1948
            revision_vf = self._get_revision_vf()
 
1949
            return revision_vf.get_graph()
 
1950
        g = self.get_graph()
 
1951
        first = g.get_parent_map([revision_id])
 
1952
        if revision_id not in first:
 
1953
            raise errors.NoSuchRevision(self, revision_id)
 
1954
        else:
 
1955
            ancestry = {}
 
1956
            children = {}
 
1957
            NULL_REVISION = _mod_revision.NULL_REVISION
 
1958
            ghosts = set([NULL_REVISION])
 
1959
            for rev_id, parent_ids in g.iter_ancestry([revision_id]):
 
1960
                if parent_ids is None: # This is a ghost
 
1961
                    ghosts.add(rev_id)
 
1962
                    continue
 
1963
                ancestry[rev_id] = parent_ids
 
1964
                for p in parent_ids:
 
1965
                    if p in children:
 
1966
                        children[p].append(rev_id)
 
1967
                    else:
 
1968
                        children[p] = [rev_id]
 
1969
 
 
1970
            if NULL_REVISION in ancestry:
 
1971
                del ancestry[NULL_REVISION]
 
1972
 
 
1973
            # Find all nodes that reference a ghost, and filter the ghosts out
 
1974
            # of their parent lists. To preserve the order of parents, and
 
1975
            # avoid double filtering nodes, we just find all children first,
 
1976
            # and then filter.
 
1977
            children_of_ghosts = set()
 
1978
            for ghost in ghosts:
 
1979
                children_of_ghosts.update(children[ghost])
 
1980
 
 
1981
            for child in children_of_ghosts:
 
1982
                ancestry[child] = tuple(p for p in ancestry[child]
 
1983
                                           if p not in ghosts)
 
1984
            return ancestry
 
1985
 
1929
1986
    def has_revisions(self, revision_ids):
1930
1987
        """See Repository.has_revisions()."""
1931
1988
        revision_ids = set(revision_ids)