Rev 456: Support displaying multiple tips in viz. in file:///data/jelmer/bzr-gtk/multi-heads/
Jelmer Vernooij
jelmer at samba.org
Thu Mar 27 16:27:30 GMT 2008
At file:///data/jelmer/bzr-gtk/multi-heads/
------------------------------------------------------------
revno: 456
revision-id: jelmer at samba.org-20080327162729-eydrkliuspbqyu6x
parent: jelmer at samba.org-20080314153635-xo30yuoowr2f9gcx
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: multi-heads
timestamp: Thu 2008-03-27 17:27:29 +0100
message:
Support displaying multiple tips in viz.
modified:
__init__.py __init__.py-20060519165329-a1fd52c8a829fcd5
branchview/linegraph.py graph.py-20051016214152-ebf565808c860cf7
viz/branchwin.py branchwin.py-20051016222514-15fd120652fcf25c
=== modified file '__init__.py'
--- a/__init__.py 2008-03-12 15:20:01 +0000
+++ b/__init__.py 2008-03-27 16:27:29 +0000
@@ -215,13 +215,13 @@
wt.unlock()
-def start_viz_window(branch, revision, limit=None):
+def start_viz_window(branch, revisions, limit=None):
"""Start viz on branch with revision revision.
:return: The viz window object.
"""
from viz import BranchWindow
- return BranchWindow(branch, revision, limit)
+ return BranchWindow(branch, revisions, limit)
class cmd_visualise(Command):
@@ -237,21 +237,23 @@
"revision",
Option('limit', "Maximum number of revisions to display.",
int, 'count')]
- takes_args = [ "location?" ]
+ takes_args = [ "locations*" ]
aliases = [ "visualize", "vis", "viz" ]
- def run(self, location=".", revision=None, limit=None):
+ def run(self, locations_list, revision=None, limit=None):
set_ui_factory()
- (br, path) = branch.Branch.open_containing(location)
- if revision is None:
- revid = br.last_revision()
- if revid is None:
- return
- else:
- (revno, revid) = revision[0].in_history(br)
-
+ if locations_list is None:
+ locations_list = ["."]
+ revids = []
+ for location in locations_list:
+ (br, path) = branch.Branch.open_containing(location)
+ if revision is None:
+ revids.append(br.last_revision())
+ else:
+ (revno, revid) = revision[0].in_history(br)
+ revids.append(revid)
import gtk
- pp = start_viz_window(br, revid, limit)
+ pp = start_viz_window(br, revids, limit)
pp.connect("destroy", lambda w: gtk.main_quit())
pp.show()
gtk.main()
=== modified file 'branchview/linegraph.py'
--- a/branchview/linegraph.py 2008-02-14 19:59:06 +0000
+++ b/branchview/linegraph.py 2008-03-27 16:27:29 +0000
@@ -11,7 +11,7 @@
from bzrlib.tsort import merge_sort
-def linegraph(repository, start, maxnum, broken_line_length = None,
+def linegraph(repository, start_revs, maxnum, broken_line_length = None,
graph_data = True, mainline_only = False):
"""Produce a directed graph of a bzr repository.
@@ -42,15 +42,19 @@
curved, kinked, etc.) and to pick the actual colours for each index.
"""
- graph_parents = repository.get_revision_graph(start)
+ graph = repository.get_graph()
+ graph_parents = {}
graph_children = {}
- for revid in graph_parents.iterkeys():
+ for (revid, parent_revids) in graph.iter_ancestry(start_revs):
+ graph_parents[revid] = parent_revids
graph_children[revid] = []
+ graph_parents["top:"] = start_revs
+
if len(graph_parents)>0:
merge_sorted_revisions = merge_sort(
graph_parents,
- start,
+ "top:",
generate_revno=True)
else:
merge_sorted_revisions = ()
@@ -58,6 +62,9 @@
if mainline_only:
merge_sorted_revisions = [elem for elem in merge_sorted_revisions \
if len(elem[3])==1 ]
+
+ assert merge_sorted_revisions[0][1] == "top:"
+ merge_sorted_revisions = merge_sorted_revisions[1:]
revid_index = {}
revno_index = {}
=== modified file 'viz/branchwin.py'
--- a/viz/branchwin.py 2008-03-13 15:12:43 +0000
+++ b/viz/branchwin.py 2008-03-27 16:27:29 +0000
@@ -28,11 +28,11 @@
for a particular branch.
"""
- def __init__(self, branch, start, maxnum, parent=None):
+ def __init__(self, branch, start_revs, maxnum, parent=None):
"""Create a new BranchWindow.
:param branch: Branch object for branch to show.
- :param start: Revision id of top revision.
+ :param start_revs: Revision ids of top revisions.
:param maxnum: Maximum number of revisions to display,
None for no limit.
"""
@@ -41,7 +41,7 @@
self.set_border_width(0)
self.branch = branch
- self.start = start
+ self.start_revs = start_revs
self.maxnum = maxnum
self.config = GlobalConfig()
@@ -222,7 +222,7 @@
"""Construct the top-half of the window."""
# FIXME: Make broken_line_length configurable
- self.treeview = TreeView(self.branch, self.start, self.maxnum, self.compact_view)
+ self.treeview = TreeView(self.branch, self.start_revs, self.maxnum, self.compact_view)
self.treeview.connect('revision-selected',
self._treeselection_changed_cb)
More information about the bazaar-commits
mailing list