~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_foreign.py

(jelmer) Deprecate Branch.revision_history(). (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
148
148
        return "Dummy Foreign Vcs Repository"
149
149
 
150
150
 
 
151
def branch_history(graph, revid):
 
152
    ret = list(graph.iter_lefthand_ancestry(revid,
 
153
        (revision.NULL_REVISION,)))
 
154
    ret.reverse()
 
155
    return ret
 
156
 
 
157
 
151
158
class InterToDummyVcsBranch(branch.GenericInterBranch):
152
159
 
153
160
    @staticmethod
165
172
        try:
166
173
            graph = self.source.repository.get_graph()
167
174
            # This just handles simple cases, but that's good enough for tests
168
 
            my_history = self.target.revision_history()
 
175
            my_history = branch_history(self.target.repository.get_graph(),
 
176
                result.old_revid)
169
177
            if stop_revision is None:
170
178
                stop_revision = self.source.last_revision()
171
 
            their_history = list(graph.iter_lefthand_ancestry(stop_revision,
172
 
                (revision.NULL_REVISION,)))
173
 
            their_history.reverse()
 
179
            their_history = branch_history(graph, stop_revision)
174
180
            if their_history[:min(len(my_history), len(their_history))] != my_history:
175
181
                raise errors.DivergedBranches(self.target, self.source)
176
182
            todo = their_history[len(my_history):]
465
471
            format=DummyForeignVcsDirFormat())
466
472
        target_tree.branch.lock_write()
467
473
        try:
468
 
            pushresult = source_tree.branch.push(target_tree.branch, lossy=True)
 
474
            pushresult = source_tree.branch.push(
 
475
                target_tree.branch, lossy=True)
469
476
        finally:
470
477
            target_tree.branch.unlock()
471
478
        self.assertEquals(revision.NULL_REVISION, pushresult.old_revid)