Rev 328: Use repository instead of branch in more places, to make it easier to support multiple branches in viz. in file:///data/jelmer/bzr-gtk/trunk/

Jelmer Vernooij jelmer at samba.org
Wed Oct 31 02:11:05 GMT 2007


At file:///data/jelmer/bzr-gtk/trunk/

------------------------------------------------------------
revno: 328
revision-id:jelmer at samba.org-20071031021104-sivvm8lfgam8l1xt
parent: jelmer at samba.org-20071030234227-cm6b5m8itw4bsntu
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Wed 2007-10-31 03:11:04 +0100
message:
  Use repository instead of branch in more places, to make it easier to support multiple branches in viz.
modified:
  revisionmenu.py                revisionmenu.py-20070715160146-pd4ew0wtlevga2mx-1
  viz/linegraph.py               graph.py-20051016214152-ebf565808c860cf7
  viz/treemodel.py               treemodel.py-20070909175138-leue3q5w1rxy86hw-1
  viz/treeview.py                treeview.py-20071020204704-vk1erblrjhbcgw94-1
=== modified file 'revisionmenu.py'
--- a/revisionmenu.py	2007-10-22 18:21:00 +0000
+++ b/revisionmenu.py	2007-10-31 02:11:04 +0000
@@ -26,10 +26,11 @@
 from bzrlib import (errors, ui)
 
 class RevisionPopupMenu(gtk.Menu):
-    def __init__(self, repository, revids, branch=None):
+    def __init__(self, repository, revids, branch=None, wt=None):
         super(RevisionPopupMenu, self).__init__()
         self.branch = branch
         self.repository = repository
+        self.wt = wt
         self.revids = revids
         self.create_items()
 
@@ -55,13 +56,7 @@
             # FIXME: self.append(item)
             self.show_all()
             
-            self.bzrdir = self.branch.bzrdir
-            self.wt = None
-            try:
-                self.wt = self.bzrdir.open_workingtree()
-            except errors.NoWorkingTree:
-                return False
-            if self.wt :
+            if self.wt:
                 item = gtk.MenuItem("_Revert to this revision")
                 item.connect('activate', self.revert)
                 self.append(item)

=== modified file 'viz/linegraph.py'
--- a/viz/linegraph.py	2007-10-01 21:45:28 +0000
+++ b/viz/linegraph.py	2007-10-31 02:11:04 +0000
@@ -11,8 +11,8 @@
 
 from bzrlib.tsort import merge_sort
 
-def linegraph(branch, start, maxnum):
-    """Produce a directed graph of a bzr branch.
+def linegraph(repository, start, maxnum):
+    """Produce a directed graph of a bzr repository.
 
     Returns a tuple of (line_graph, revid_index, columns_len) where
     * line_graph is a list of tuples of (revid,
@@ -44,11 +44,7 @@
     # FIXME: This should be configurable
     BROKEN_LINE_LENGTH = 32
     
-    # We get the mainline so we can pass it to merge_sort to make merge_sort
-    # run faster.
-    mainline = [None]
-    mainline.extend(branch.revision_history())
-    graph_parents = branch.repository.get_revision_graph(start)
+    graph_parents = repository.get_revision_graph(start)
     graph_children = {}
     for revid in graph_parents.iterkeys():
         graph_children[revid] = []
@@ -56,7 +52,6 @@
     merge_sorted_revisions = merge_sort(
         graph_parents,
         start,
-        mainline,
         generate_revno=True)
     
     revid_index = {}

=== modified file 'viz/treemodel.py'
--- a/viz/treemodel.py	2007-10-02 22:55:24 +0000
+++ b/viz/treemodel.py	2007-10-31 02:11:04 +0000
@@ -29,10 +29,10 @@
 class TreeModel(gtk.GenericTreeModel):
 
     
-    def __init__ (self, branch, line_graph_data):
+    def __init__ (self, repository, line_graph_data):
         gtk.GenericTreeModel.__init__(self)
         self.revisions = {}
-        self.branch = branch
+        self.repository = repository
         self.line_graph_data = line_graph_data
     
     def on_get_flags(self):
@@ -76,7 +76,7 @@
                                       for revno in revno_sequence])
         
         if revid not in self.revisions:
-            revision = self.branch.repository.get_revisions([revid])[0]
+            revision = self.repository.get_revisions([revid])[0]
             self.revisions[revid] = revision
         else:
             revision = self.revisions[revid]

=== modified file 'viz/treeview.py'
--- a/viz/treeview.py	2007-10-24 18:03:11 +0000
+++ b/viz/treeview.py	2007-10-31 02:11:04 +0000
@@ -124,11 +124,11 @@
         :param maxnum: Maximum number of revisions to display, or None 
                        for no limit.
         """
-        (linegraphdata, index, columns_len) = linegraph(self.branch,
+        (linegraphdata, index, columns_len) = linegraph(self.branch.repository,
                                                         start,
                                                         maxnum)
 
-        self.model = TreeModel(self.branch, linegraphdata)
+        self.model = TreeModel(self.branch.repository, linegraphdata)
         self.graph_cell.columns_len = columns_len
         width = self.graph_cell.get_size(self.treeview)[2]
         self.graph_column.set_fixed_width(width)




More information about the bazaar-commits mailing list