示例#1
0
    def test_branch_tips_date_sorted(self):
        trunk, old, new = self.make_banches_for_tips_date_sorted()

        trunk_bi = loggraphviz.BranchInfo('trunk', None, trunk)
        gv = loggraphviz.GraphVizLoader([
            trunk_bi,
            loggraphviz.BranchInfo('old', None, old),
            loggraphviz.BranchInfo('new', None, new),
        ], trunk_bi, False)
        gv.load()

        state = loggraphviz.GraphVizFilterState(gv)
        computed = gv.compute_viz(state)

        self.assertComputed(
            [
                ('rev-new', 2, None, [(2, 2, 0, True)]),  #     ○ 
                #     │
                ('rev-old', 1, None, [(1, 1, 0, True),
                                      (2, 2, 0, True)]),  #   ○ │ 
                #   │ │
                (
                    'rev-trunk',
                    0,
                    None,
                    [
                        (0, 0, 0, True),
                        (1, 0, 0, True),  # ○ │ │ 
                        (2, 0, 0, True)
                    ]),  # ├─╯─╯ 
                ('rev-a', 0, None, [])
            ],  # ○ 
            computed)
示例#2
0
    def test_get_revid_branch_info(self):
        builder = self.make_branch_builder('trunk')
        builder.start_series()
        builder.build_snapshot('rev-a', None, [
            ('add', ('', 'TREE_ROOT', 'directory', '')),
        ])
        builder.build_snapshot('rev-branch', ['rev-a'], [])
        builder.build_snapshot('rev-trunk', ['rev-a'], [])
        builder.finish_series()
        #   ○ branch
        #   │
        # ○ │ trunk
        # ├─╯
        # ○ rev-a

        trunk = builder.get_branch()
        #trunk.set_last_revision('rev-trunk')

        branch = trunk.bzrdir.sprout('../branch',
                                     revision_id='rev-branch').open_branch()

        trunk_bi = loggraphviz.BranchInfo('trunk', None, trunk)
        branch_bi = loggraphviz.BranchInfo('branch', None, branch)
        gv = loggraphviz.GraphVizLoader([trunk_bi, branch_bi], trunk_bi, False)
        gv.load()

        self.assertEqual(trunk_bi, gv.get_revid_branch_info('rev-trunk'))
        self.assertEqual(branch_bi, gv.get_revid_branch_info('rev-branch'))

        # may return either
        self.assertIn(gv.get_revid_branch_info('rev-a'), (branch_bi, trunk_bi))
示例#3
0
    def test_no_commits(self):
        br = self.make_branch('.')

        bi = loggraphviz.BranchInfo('', None, br)
        gv = loggraphviz.GraphVizLoader([bi], bi, False)
        gv.load()

        self.assertEqual(len(gv.revisions), 0)

        state = loggraphviz.GraphVizFilterState(gv)
        computed = gv.compute_viz(state)
        self.assertEqual(len(computed.revisions), 0)
示例#4
0
    def test_out_of_date_wt(self):
        tree = self.make_tree_not_up_to_date('branch')
        bi = loggraphviz.BranchInfo(None, tree, tree.branch)
        gv = loggraphviz.GraphVizLoader([bi], bi, False)
        gv.load()

        state = loggraphviz.GraphVizFilterState(gv)
        computed = gv.compute_viz(state)

        self.assertComputed(
            [
                ('rev-b', 0, None, [(0, 0, 0, True)], [None]),  # ○ 
                # │
                ('rev-a', 0, None, [], ['Working Tree'])
            ],  # ○
            computed,
            branch_labels=True)
示例#5
0
    def test_get_revid_branch_info_with_ghost(self):
        tree = self.make_branch_and_tree('tree')
        tree.commit('a', rev_id='rev-a')
        tree.add_parent_tree_id('rev-b')
        tree.commit('c', rev_id='rev-c')
        # rev-b is a ghost. We think he is there, but he dose not exist. Boo!
        # c
        # ├─╮
        # │ b
        # │
        # a

        bi = loggraphviz.BranchInfo(None, tree, tree.branch)
        gv = loggraphviz.GraphVizLoader([bi], bi, False)
        gv.load()

        self.assertRaises(loggraphviz.GhostRevisionError,
                          gv.get_revid_branch_info, 'rev-b')
示例#6
0
    def test_with_ghost_mainline(self):
        tree = self.make_branch_and_tree('tree')
        tree.add_parent_tree_id('rev-a', allow_leftmost_as_ghost=True)
        tree.commit('b', rev_id='rev-b')

        bi = loggraphviz.BranchInfo(None, tree, tree.branch)
        gv = loggraphviz.GraphVizLoader([bi], bi, False)
        gv.load()

        state = loggraphviz.GraphVizFilterState(gv)
        computed = gv.compute_viz(state)

        self.assertComputed(
            [
                ('rev-b', 0, None, [(0, 0, 0, True)]),  # ○ 
                # │
                ('rev-a', 0, None, [])
            ],  # ○
            computed)
示例#7
0
    def test_pending_merge(self):
        tree = self.make_tree_with_pending_merge('branch')

        bi = loggraphviz.BranchInfo(None, tree, tree.branch)
        gv = loggraphviz.GraphVizLoader([bi], bi, False)
        gv.load()

        state = loggraphviz.GraphVizFilterState(gv)
        computed = gv.compute_viz(state)

        self.assertComputed(
            [
                ('rev-b', 1, None, [(1, 0, 0, True)], ['Pending Merge'
                                                       ]),  #   ○ 
                # ╭─╯
                ('rev-a', 0, None, [], [None])
            ],  # ○ 
            computed,
            branch_labels=True)
示例#8
0
    def test_with_ghost(self):
        tree = self.make_branch_and_tree('tree')
        tree.commit('a', rev_id='rev-a')
        tree.add_parent_tree_id('rev-b')
        tree.commit('c', rev_id='rev-c')
        # rev-b is a ghost. We think he is there, but he dose not exist. Boo!

        bi = loggraphviz.BranchInfo(None, tree, tree.branch)
        gv = loggraphviz.GraphVizLoader([bi], bi, False)
        gv.load()

        state = loggraphviz.GraphVizFilterState(gv)
        state.expand_all_branch_lines()
        computed = gv.compute_viz(state)

        self.assertComputed(
            [
                ('rev-c', 0, True, [(0, 0, 0, True), (0, 1, 1, True)]),  # ⊖   
                # ├─╮
                ('rev-b', 1, None, [(0, 0, 0, True)]),  # │ ○ 
                # │
                ('rev-a', 0, None, [])
            ],  # ○ 
            computed)