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

  • Committer: Martin Pool
  • Date: 2009-08-28 04:13:16 UTC
  • mfrom: (4634.6.8 2.0)
  • mto: This revision was merged to the branch mainline in revision 4660.
  • Revision ID: mbp@sourcefrog.net-20090828041316-adcbxfnfpc4bjtpl
Merge 2.0 back to trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1190
1190
        generator = _VFContentMapGenerator(self, [key])
1191
1191
        return generator._get_content(key)
1192
1192
 
 
1193
    def get_known_graph_ancestry(self, keys):
 
1194
        """Get a KnownGraph instance with the ancestry of keys."""
 
1195
        parent_map, missing_keys = self._index.find_ancestry(keys)
 
1196
        kg = _mod_graph.KnownGraph(parent_map)
 
1197
        return kg
 
1198
 
1193
1199
    def get_parent_map(self, keys):
1194
1200
        """Get a map of the graph parents of keys.
1195
1201
 
2560
2566
        except KeyError:
2561
2567
            raise RevisionNotPresent(key, self)
2562
2568
 
 
2569
    def find_ancestry(self, keys):
 
2570
        """See CombinedGraphIndex.find_ancestry()"""
 
2571
        prefixes = set(key[:-1] for key in keys)
 
2572
        self._load_prefixes(prefixes)
 
2573
        result = {}
 
2574
        parent_map = {}
 
2575
        missing_keys = set()
 
2576
        pending_keys = list(keys)
 
2577
        # This assumes that keys will not reference parents in a different
 
2578
        # prefix, which is accurate so far.
 
2579
        while pending_keys:
 
2580
            key = pending_keys.pop()
 
2581
            if key in parent_map:
 
2582
                continue
 
2583
            prefix = key[:-1]
 
2584
            try:
 
2585
                suffix_parents = self._kndx_cache[prefix][0][key[-1]][4]
 
2586
            except KeyError:
 
2587
                missing_keys.add(key)
 
2588
            else:
 
2589
                parent_keys = tuple([prefix + (suffix,)
 
2590
                                     for suffix in suffix_parents])
 
2591
                parent_map[key] = parent_keys
 
2592
                pending_keys.extend([p for p in parent_keys
 
2593
                                        if p not in parent_map])
 
2594
        return parent_map, missing_keys
 
2595
 
2563
2596
    def get_parent_map(self, keys):
2564
2597
        """Get a map of the parents of keys.
2565
2598
 
3049
3082
            options.append('no-eol')
3050
3083
        return options
3051
3084
 
 
3085
    def find_ancestry(self, keys):
 
3086
        """See CombinedGraphIndex.find_ancestry()"""
 
3087
        return self._graph_index.find_ancestry(keys, 0)
 
3088
 
3052
3089
    def get_parent_map(self, keys):
3053
3090
        """Get a map of the parents of keys.
3054
3091