/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/tests/test_graph.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-11-22 23:41:03 UTC
  • mfrom: (2988.1.9 reconcile.memory)
  • Revision ID: pqm@pqm.ubuntu.com-20071122234103-fn117zncqrqv39me
(robertc) Improve the performance of reconcile and reduce its memory
        consumption. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
145
145
        return self._real_parents_provider.get_parents(nodes)
146
146
 
147
147
 
148
 
class DictParentsProvider(object):
149
 
 
150
 
    def __init__(self, ancestry):
151
 
        self.ancestry = ancestry
152
 
 
153
 
    def __repr__(self):
154
 
        return 'DictParentsProvider(%r)' % self.ancestry
155
 
 
156
 
    def get_parents(self, revisions):
157
 
        return [self.ancestry.get(r, None) for r in revisions]
158
 
 
159
 
 
160
148
class TestGraph(TestCaseWithMemoryTransport):
161
149
 
162
150
    def make_graph(self, ancestors):
304
292
 
305
293
    def test_stacked_parents_provider(self):
306
294
 
307
 
        parents1 = DictParentsProvider({'rev2': ['rev3']})
308
 
        parents2 = DictParentsProvider({'rev1': ['rev4']})
 
295
        parents1 = _mod_graph.DictParentsProvider({'rev2': ['rev3']})
 
296
        parents2 = _mod_graph.DictParentsProvider({'rev1': ['rev4']})
309
297
        stacked = _mod_graph._StackedParentsProvider([parents1, parents2])
310
298
        self.assertEqual([['rev4',], ['rev3']],
311
299
                         stacked.get_parents(['rev1', 'rev2']))