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

Fix Repository.get_revision_graph()

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from bzrlib.plugins.git import tests
24
24
from bzrlib.plugins.git.gitlib import (
25
25
    git_repository,
 
26
    ids,
26
27
    model,
27
28
    )
28
29
 
42
43
 
43
44
        repo = repository.Repository.open('.')
44
45
        self.assertIsInstance(repo._git, model.GitModel)
 
46
 
 
47
    def test_revision_graph(self):
 
48
        tests.run_git('init')
 
49
        self.build_tree(['a'])
 
50
        tests.run_git('add', 'a')
 
51
        tests.run_git('commit', '-m', 'a')
 
52
        tests.run_git('branch', 'foo')
 
53
        self.build_tree_contents([('a', 'new a\n')])
 
54
        tests.run_git('commit', '-a', '-m', 'new a')
 
55
        tests.run_git('checkout', 'foo')
 
56
        self.build_tree(['b'])
 
57
        tests.run_git('add', 'b')
 
58
        tests.run_git('commit', '-m', 'b')
 
59
        tests.run_git('merge', 'master')
 
60
 
 
61
        revisions = tests.run_git('rev-list', '--topo-order', 'HEAD')
 
62
        revisions = [ids.convert_revision_id_git_to_bzr(r)
 
63
                     for r in revisions.splitlines()]
 
64
        graph = {revisions[0]:[revisions[2], revisions[1]],
 
65
                 revisions[1]:[revisions[3]],
 
66
                 revisions[2]:[revisions[3]],
 
67
                 revisions[3]:[],
 
68
                }
 
69
 
 
70
        repo = repository.Repository.open('.')
 
71
        self.assertEqual(graph, repo.get_revision_graph(revisions[0]))
 
72
        self.assertEqual({revisions[3]:[]},
 
73
                         repo.get_revision_graph(revisions[3]))