def test_with_working_tree_provider_out_of_date_wt(self): tree = self.make_tree_not_up_to_date('branch') bi = loggraphviz.BranchInfo('branch', tree, tree.branch) gv = loggraphviz.WithWorkingTreeGraphVizLoader([bi], bi, False) gv.load() state = loggraphviz.GraphVizFilterState(gv) computed = gv.compute_viz(state) self.assertComputed( [ ( u'current:%s' % tree.basedir, 1, None, [(1, 1, 0, True)], # ○ ['branch - Working Tree']), # │ ( 'rev-b', 0, None, [(0, 0, 0, True), (1, 0, 0, True)], # ○ │ ['branch']), # ├─╯ ('rev-a', 0, None, [], []) ], # ○ computed, branch_labels=True)
def test_merge_line_hidden_merge_rev_filtered(self): gv = BasicGraphVizLoader( ('rev-e', ), { 'rev-a': (NULL_REVISION, ), 'rev-b': ('rev-a', ), 'rev-c': ('rev-b', ), 'rev-d': ('rev-a', 'rev-c'), 'rev-e': ('rev-a', 'rev-d'), }) gv.load() state = loggraphviz.GraphVizFilterState(gv) state.filters.append(BasicFilterer(set(['rev-c']))) state.branch_line_state[(1, 1)] = None computed = gv.compute_viz(state) # when the merge by branch line, we should show a non direct line self.assertComputed( [ ('rev-e', 0, False, [(0, 0, 0, True), (0, 1, 2, False)]), # ⊕ # ├┄╮ ('rev-b', 1, None, [(0, 0, 0, True), (1, 0, 0, True)]), # │ ○ # ├─╯ ('rev-a', 0, None, []) ], # ○ computed)
def test_with_working_tree_provider(self): tree = self.make_tree_with_pending_merge('branch') bi = loggraphviz.BranchInfo('branch', tree, tree.branch) gv = loggraphviz.WithWorkingTreeGraphVizLoader([bi], bi, False) gv.load() state = loggraphviz.GraphVizFilterState(gv) computed = gv.compute_viz(state) self.assertComputed( [ ( u'current:%s' % tree.basedir, 0, True, # ⊖ [(0, 0, 0, True), (0, 1, 2, True)], # ├─╮ ['branch - Working Tree']), # │ │ ( 'rev-b', 1, None, [(0, 0, 0, True), (1, 0, 0, True)], # │ ○ ['branch - Pending Merge']), # ├─╯ ('rev-a', 0, None, [], ['branch']) ], # ○ computed, branch_labels=True)
def test_filter(self): gv = BasicGraphVizLoader( ('e', ), { 'a': (NULL_REVISION, ), 'b': ('a', ), 'c': ('a', 'b'), 'd': ('c', ), 'e': ('d', ), }) gv.load() # e # │ # d # │ # c # ├─╮ # │ b # ├─╯ # a state = loggraphviz.GraphVizFilterState(gv) # expand 'c' state.collapse_expand_rev(gv.compute_viz(state).filtered_revs[2]) # all should be showing self.assertFilteredRevisions('edcba', state) state.filters.append(BasicFilterer(('d', 'c', 'a'))) state.filter_changed() # d and a not showing bucause of filter # c shows even though it is filtered, because it merges a revision # that is not filtered. self.assertFilteredRevisions('ecb', state)
def test_non_direct_hidden_parent(self): gv = BasicGraphVizLoader( ('rev-e', ), { 'rev-a': (NULL_REVISION, ), 'rev-b': ('rev-a', ), 'rev-c': ('rev-b', ), 'rev-d': ('rev-a', 'rev-c'), 'rev-e': ('rev-a', 'rev-d'), }) gv.load() state = loggraphviz.GraphVizFilterState(gv) state.filters.append(BasicFilterer(set(['rev-c']))) state.expand_all_branch_lines() computed = gv.compute_viz(state) self.assertComputed( [ ('rev-e', 0, True, [(0, 0, 0, True), (0, 1, 3, True)]), # ⊖ # ├─╮ ('rev-d', 1, True, [(0, 0, 0, True), (1, 1, 0, True), (1, 2, 2, False)]), # │ ⊖ # │ ├┄╮ ('rev-b', 2, None, [(0, 0, 0, True), (1, 0, 0, True), (2, 0, 0, True)]), # │ │ ○ # ├─╯─╯ ('rev-a', 0, None, []) ], # ○ computed)
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)
def test_collapse_expand_rev_basic(self): gv = BasicGraphVizLoader(('c', ), { 'a': (NULL_REVISION, ), 'b': ('a', ), 'c': ('a', 'b'), }) gv.load() # c # ├─╮ # │ b # ├─╯ # a state = loggraphviz.GraphVizFilterState(gv) # just mainline showing self.assertFilteredRevisions('ca', state) # bla - we need a computed to call collapse_expand_rev # expand 'c' state.collapse_expand_rev(gv.compute_viz(state).filtered_revs[0]) # all should be showing self.assertFilteredRevisions('cba', state) # colapse 'c' state.collapse_expand_rev(gv.compute_viz(state).filtered_revs[0]) # just mainline showing self.assertFilteredRevisions('ca', state)
def load(self, branches, primary_bi, file_ids, no_graph, graph_provider_type): self.throbber.show() self.processEvents() try: graph_viz = graph_provider_type( branches, primary_bi, no_graph, processEvents=self.processEvents, throbber=self.throbber) graph_viz.load() graph_viz.on_filter_changed = self.on_filter_changed state = loggraphviz.GraphVizFilterState( graph_viz, self.compute_lines) # Copy the expanded branches from the old state to the new. for (branch_id, value) in self.state.branch_line_state.iteritems(): if branch_id in graph_viz.branch_lines: state.branch_line_state[branch_id] = value #for branch_id in graph_viz.branch_lines.keys(): # state.branch_line_state[branch_id] = None scheduler = FilterScheduler(state.filter_changed) if file_ids: file_id_filter = FileIdFilter( graph_viz, scheduler.filter_changed, file_ids) state.filters.append(file_id_filter) else: file_id_filter = None if isinstance(graph_viz, WithWorkingTreeGraphVizLoader): working_tree_filter = WorkingTreeHasChangeFilter( graph_viz, scheduler.filter_changed, file_ids) state.filters.append(working_tree_filter) else: working_tree_filter = None prop_search_filter = PropertySearchFilter(graph_viz, scheduler.filter_changed) state.filters.append(prop_search_filter) self.emit(QtCore.SIGNAL("layoutAboutToBeChanged()")) self.graph_viz = graph_viz self.state = state self.file_ids = file_ids self.file_id_filter = file_id_filter self.working_tree_filter = working_tree_filter self.prop_search_filter = prop_search_filter self.computed = loggraphviz.ComputedGraphViz(graph_viz) self.emit(QtCore.SIGNAL("layoutChanged()")) self.compute_lines() # Start later so that it does not run in the loading queue. if self.working_tree_filter: QtCore.QTimer.singleShot(1, self.working_tree_filter.load) if self.file_id_filter: QtCore.QTimer.singleShot(1, self.file_id_filter.load) finally: self.throbber.hide()
def test_merge_line_hidden2(self): gv = BasicGraphVizLoader( ('rev-e', ), { 'rev-a': (NULL_REVISION, ), 'rev-z': ('rev-a', ), 'rev-y': ( 'rev-a', 'rev-z', ), 'rev-b': ('rev-a', ), 'rev-c': ('rev-a', ), 'rev-d': ('rev-a', 'rev-c'), 'rev-e': ('rev-y', 'rev-b', 'rev-d'), }) # f # ├─╮─╮ # │ b │ # │ │ │ # │ │ e # │ │ ├─╮ # │ │ │ d # ├─╯─╯─╯ # a gv.load() state = loggraphviz.GraphVizFilterState(gv) #state.expand_all_branch_lines() state.branch_line_state[(1, 1)] = None state.branch_line_state[(1, 2)] = None #state.branch_line_state[(1, 3)] = None state.branch_line_state[(1, 4)] = None computed = gv.compute_viz(state) # when the merge by branch line, we should show a non direct line # this could layout better, but that's another story... self.assertComputed( [ ('rev-e', 0, False, [(0, 0, 0, True), (0, 1, 3, False), (0, 2, 5, True)]), # ⊕ # ├┄╮─╮ ('rev-b', 2, None, [(0, 0, 0, True), (1, 3, 3, False), (2, 2, 0, True)]), # │ ┆ ○ # │ ╰┄┼┄╮ ('rev-c', 3, None, [(0, 0, 0, True), (2, 2, 0, True), (3, 3, 0, True)]), # │ │ ○ # │ │ │ ('rev-y', 0, True, [(0, 0, 0, True), (0, 1, 2, True), (2, 2, 0, True), (3, 3, 0, True)]), # ⊖ │ │ # ├─╮ │ │ ('rev-z', 1, None, [(0, 0, 0, True), (1, 0, 0, True), (2, 0, 0, True), (3, 0, 0, True)]), # │ ○ │ │ # ├─╯─╯─╯ ('rev-a', 0, None, []) ], # ○ computed)
def test_branch_tips_date_sorted_with_working_tree_provider(self): trunk, old, new = self.make_banches_for_tips_date_sorted() trunk_tree = trunk.bzrdir.create_workingtree() old_tree = old.bzrdir.open_workingtree() new_tree = new.bzrdir.open_workingtree() trunk_bi = loggraphviz.BranchInfo('trunk', trunk_tree, trunk) gv = loggraphviz.WithWorkingTreeGraphVizLoader([ trunk_bi, loggraphviz.BranchInfo('old', old_tree, old), loggraphviz.BranchInfo('new', new_tree, new), ], trunk_bi, False) gv.load() state = loggraphviz.GraphVizFilterState(gv) computed = gv.compute_viz(state) self.assertComputed( [ (gv.tree_revid(new_tree), 2, None, [(2, 2, 3, True) ]), # ○ # │ ('rev-new', 2, None, [(2, 2, 0, True)]), # ○ # │ ( gv.tree_revid(old_tree), 1, None, [ (1, 1, 2, True), # ○ │ (2, 2, 0, True) ]), # │ │ ('rev-old', 1, None, [(1, 1, 0, True), (2, 2, 0, True)]), # ○ │ # │ │ ( gv.tree_revid(trunk_tree), 0, None, [ # ○ │ │ (0, 0, 0, True), (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)
def test_collapse_deep_expanded_by(self): # This use to error at one point gv = BasicGraphVizLoader( ('g', ), { 'a': (NULL_REVISION, ), 'b': ('a', ), 'c': ('a', 'b'), 'd': ( 'a', 'c', ), 'e': ('b', ), 'f': ('d', 'e'), 'g': ('a', 'f'), }) # g v-----1.3 # ├─╮ # │ f v-1.1 # │ ├───╮ # │ │ e # │ │ │ # │ d v-│-1.2 # │ ├─╮ │ # │ │ c │ # │ │ │\│ # │ │ │ b # ├─╯─╯─╯ # a gv.load() state = loggraphviz.GraphVizFilterState(gv) # just mainline showing self.assertFilteredRevisions('ga', state) # expand 'g' state.collapse_expand_rev(gv.compute_viz(state).revisions[0]) # branchline fd now showing self.assertFilteredRevisions('gfda', state) # expand 'f' state.collapse_expand_rev(gv.compute_viz(state).revisions[1]) # branchline eb now showing self.assertFilteredRevisions('gfedba', state) # expand 'd' state.collapse_expand_rev(gv.compute_viz(state).revisions[3]) # branchline c now showing (all showing) self.assertFilteredRevisions('gfedcba', state) # colapse 'g' state.collapse_expand_rev(gv.compute_viz(state).filtered_revs[0]) # back to just mainline showing self.assertFilteredRevisions('ga', state)
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)
def test_lots_of_merges_between_branch_lines(self): gv = BasicGraphVizLoader( ('rev-g', ), { 'rev-a': (NULL_REVISION, ), 'rev-b': ('rev-a', ), 'rev-c': ('rev-b', ), 'rev-d': ('rev-a', ), 'rev-e': ( 'rev-d', 'rev-b', ), 'rev-f': ( 'rev-e', 'rev-c', ), 'rev-g': ( 'rev-c', 'rev-f', ), }) gv.load() state = loggraphviz.GraphVizFilterState(gv) state.expand_all_branch_lines() computed = gv.compute_viz(state) self.assertComputed( [ ('rev-g', 0, True, [(0, 0, 0, True), (0, 2, 2, True)]), # ⊖ # ├───╮ ('rev-f', 2, None, [(0, 0, 0, True), (2, 0.75, 0, True), (2, 2, 2, True)]), # │ ○ # │ ╭─┤ ('rev-e', 2, None, [(0, 0, 0, True), (0.75, 0.75, 0, True), (2, 1.25, 0, True), (2, 2, 2, True)]), # │ │ ○ # │ ├─┤ ('rev-d', 2, None, [(0, 0, 0, True), (0.75, 0, 0, True), (1.25, 1.25, 0, True), (2, 2, 0, True)]), # │ │ ○ # ├─┤ │ ('rev-c', 0, None, [(0, 0, 0, True), (1.25, 0, 0, True), (2, 2, 0, True)]), # ○ │ │ # ├─╯ │ ('rev-b', 0, None, [(0, 0, 0, True), (2, 0, 0, True)]), # ○ │ # ├───╯ ('rev-a', 0, None, []) ], # ○ computed)
def __init__(self, processEvents, throbber, parent=None): QtCore.QAbstractTableModel.__init__(self, parent) self.processEvents = processEvents self.throbber = throbber self.graph_viz = GraphVizLoader((), None, False, processEvents, throbber) self.state = loggraphviz.GraphVizFilterState( self.graph_viz, self.compute_lines) self.computed = loggraphviz.ComputedGraphViz(self.graph_viz) self.clicked_f_index = None self.last_rev_is_placeholder = False self.bugtext = gettext("bug #%s")
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)
def test_pending_merges_provider(self): tree = self.make_tree_with_pending_merge('branch') bi = loggraphviz.BranchInfo(None, tree, tree.branch) gv = loggraphviz.PendingMergesGraphVizLoader([bi], bi, False) gv.load() state = loggraphviz.GraphVizFilterState(gv) computed = gv.compute_viz(state) self.assertComputed( [ ('rev-b', 1, None, [(1, 0, 0, True)]), # ○ # ╭─╯ ('root:', 0, None, []) ], # ○ computed)
def test_branch_line_order2(self): gv = BasicGraphVizLoader( ('rev-h', ), { 'rev-a': (NULL_REVISION, ), 'rev-b': ('rev-a', ), 'rev-c': ('rev-b', ), 'rev-d': ('rev-a', ), 'rev-e': ('rev-d', 'rev-b'), 'rev-f': ('rev-e', ), 'rev-g': ('rev-e', 'rev-f'), 'rev-h': ('rev-c', 'rev-g'), }) gv.load() state = loggraphviz.GraphVizFilterState(gv) state.expand_all_branch_lines() computed = gv.compute_viz(state) # branch lines should not cross over self.assertComputed( [ ('rev-h', 0, True, [(0, 0, 0, True), (0, 2, 2, True)]), # ⊖ # ├───╮ ('rev-g', 2, True, [(0, 0, 0, True), (2, 2, 2, True), (2, 3, 3, True)]), # │ ⊖ # │ ├─╮ ('rev-f', 3, None, [(0, 0, 0, True), (2, 2, 2, True), (3, 2, 2, True)]), # │ │ ○ # │ ├─╯ ('rev-e', 2, None, [(0, 0, 0, True), (2, 1, 0, True), (2, 2, 2, True)]), # │ ○ # │ ╭─┤ ('rev-d', 2, None, [(0, 0, 0, True), (1, 1, 0, True), (2, 2, 0, True)]), # │ │ ○ # │ │ │ ('rev-c', 0, None, [(0, 0, 0, True), (1, 0, 0, True), (2, 2, 0, True)]), # ○ │ │ # ├─╯ │ ('rev-b', 0, None, [(0, 0, 0, True), (2, 0, 0, True)]), # ○ │ # ├───╯ ('rev-a', 0, None, []) ], # ○ computed)
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)
def test_hidden_branch_line_hides_child_line(self): gv = BasicGraphVizLoader( ('rev-g', ), { 'rev-a': (NULL_REVISION, ), 'rev-b': ('rev-a', ), 'rev-c': ('rev-a', ), 'rev-d': ( 'rev-b', 'rev-c', ), 'rev-e': ( 'rev-b', 'rev-d', ), 'rev-f': ('rev-c', ), 'rev-g': ( 'rev-e', 'rev-f', ), }) gv.load() state = loggraphviz.GraphVizFilterState(gv) state.branch_line_state[(2, 1)] = None computed = gv.compute_viz(state) self.assertComputed( [ ('rev-g', 0, False, [(0, 0, 0, True)]), # ⊕ # │ ('rev-e', 0, True, [(0, 0, 0, True), (0, 1, 3, True)]), # ⊖ # ├─╮ ('rev-d', 1, False, [(0, 0, 0, True), (1, 0, 0, True)]), # │ ⊕ # ├─╯ ('rev-b', 0, None, [(0, 0, 0, True)]), # ○ # │ ('rev-a', 0, None, []) ], # ○ computed)
def test_collapse_colapses_sub_expand(self): gv = self.get_expanded_by_graph_provider() state = loggraphviz.GraphVizFilterState(gv) # just mainline showing self.assertFilteredRevisions('fda', state) # expand 'd' state.collapse_expand_rev(gv.compute_viz(state).revisions[2]) # branchline c now showing self.assertFilteredRevisions('fdca', state) # expand 'c' state.collapse_expand_rev(gv.compute_viz(state).revisions[3]) # all showing self.assertFilteredRevisions('fedcba', state) # colapse 'd' state.collapse_expand_rev(gv.compute_viz(state).filtered_revs[2]) # cause c expanded branchline eb, and d expanded c, d colapses # just mainline showing self.assertFilteredRevisions('fda', state)
def test_basic_branch_line(self): gv = BasicGraphVizLoader( ('rev-d', ), { 'rev-a': (NULL_REVISION, ), 'rev-b': ('rev-a', ), 'rev-c': ('rev-a', ), 'rev-d': ('rev-b', 'rev-c'), }) gv.load() state = loggraphviz.GraphVizFilterState(gv) computed = gv.compute_viz(state) # only mainline. self.assertComputed( [ ('rev-d', 0, False, [(0, 0, 0, True)]), # ⊕ # │ ('rev-b', 0, None, [(0, 0, 0, True)]), # ○ # │ ('rev-a', 0, None, []) ], # ○ computed) state.collapse_expand_rev(computed.filtered_revs[0]) computed = gv.compute_viz(state) # expanded branch line. self.assertComputed( [ ('rev-d', 0, True, [(0, 0, 0, True), (0, 1, 2, True)]), # ⊖ # ├─╮ ('rev-c', 1, None, [(0, 0, 0, True), (1, 1, 0, True)]), # │ ○ # │ │ ('rev-b', 0, None, [(0, 0, 0, True), (1, 0, 0, True)]), # ○ │ # ├─╯ ('rev-a', 0, None, []) ], # ○ computed)
def test_with_working_tree_provider_filtered(self): # This test makes sure that lable for a Working Tree shows for on it's # nearest visble unique ansestor when the working tree node is # filtered. builder = self.make_branch_builder('branch') builder.start_series() builder.build_snapshot('rev-a', None, [ ('add', ('', 'TREE_ROOT', 'directory', '')), ]) builder.build_snapshot('rev-b', ['rev-a'], []) builder.build_snapshot('rev-c', ['rev-a'], []) builder.finish_series() branch = builder.get_branch() tree = branch.bzrdir.create_workingtree() tree.update(revision='rev-b') bi = loggraphviz.BranchInfo('branch', tree, tree.branch) gv = loggraphviz.WithWorkingTreeGraphVizLoader([bi], bi, False) gv.load() state = loggraphviz.GraphVizFilterState(gv) state.filters.append( BasicFilterer( set(['current:%s' % tree.basedir.encode('unicode-escape')]))) computed = gv.compute_viz(state) self.assertComputed( [ ('rev-b', 1, None, [(1, 1, 0, True) ], ['branch - Working Tree']), # ○ # │ ('rev-c', 0, None, [(0, 0, 0, True), (1, 0, 0, True)], ['branch']), # ○ │ # ├─╯ ('rev-a', 0, None, [], []) ], # ○ computed, branch_labels=True)
def test_no_graph_filtered(self): gv = BasicGraphVizLoader( ('rev-d', ), { 'rev-a': (NULL_REVISION, ), 'rev-b': ('rev-a', ), 'rev-c': ('rev-a', ), 'rev-d': ('rev-b', 'rev-c'), }, no_graph=True) gv.load() state = loggraphviz.GraphVizFilterState(gv) state.filters.append(BasicFilterer(set(['rev-b']))) computed = gv.compute_viz(state) self.assertComputed( [ ('rev-d', 0.0, None, []), # ○ # ('rev-c', 0.5, None, []), # ○ # ('rev-a', 0.0, None, []) ], # ○ computed)
def test_collapse_dosent_colapses_prev_expand(self): gv = self.get_expanded_by_graph_provider() state = loggraphviz.GraphVizFilterState(gv) # just mainline showing self.assertFilteredRevisions('fda', state) # expand 'f' state.collapse_expand_rev(gv.compute_viz(state).revisions[0]) # branchline eb now showing self.assertFilteredRevisions('fedba', state) # expand 'd' state.collapse_expand_rev(gv.compute_viz(state).revisions[2]) # all showing self.assertFilteredRevisions('fedcba', state) # colapse 'd' state.collapse_expand_rev(gv.compute_viz(state).filtered_revs[2]) # cause branchline eb was expanded by f, and not d, collapsing d dose # not collapse branchline eb, even though it expanded it # branchline eb and mainline left showing self.assertFilteredRevisions('fedba', state)
def test_octopus_merge(self): gv = BasicGraphVizLoader( ('rev-e', ), { 'rev-a': (NULL_REVISION, ), 'rev-b': ('rev-a', ), 'rev-c': ('rev-a', ), 'rev-d': ('rev-a', ), 'rev-e': ('rev-a', 'rev-b', 'rev-c', 'rev-d'), }) gv.load() state = loggraphviz.GraphVizFilterState(gv) state.expand_all_branch_lines() computed = gv.compute_viz(state) self.assertComputed( [ ('rev-e', 0, True, [(0, 0, 0, True), (0, 1, 2, True), (0, 2, 3, True), (0, 3, 4, True)]), # ⊖ # ├─╮─╮─╮ ('rev-b', 3, None, [(0, 0, 0, True), (1, 1, 2, True), (2, 2, 3, True), (3, 3, 0, True)]), # │ │ │ ○ # │ │ │ │ ('rev-c', 2, None, [(0, 0, 0, True), (1, 1, 2, True), (2, 2, 0, True), (3, 3, 0, True)]), # │ │ ○ │ # │ │ │ │ ('rev-d', 1, None, [(0, 0, 0, True), (1, 0, 0, True), (2, 0, 0, True), (3, 0, 0, True)]), # │ ○ │ │ # ├─╯─╯─╯ ('rev-a', 0, None, []) ], # ○ computed)
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)