[Pkg-bazaar-commits] ./bzr-gtk/unstable r246: Use repository rather than branch where possible.

Jelmer Vernooij jelmer at samba.org
Fri Apr 10 07:49:24 UTC 2009


------------------------------------------------------------
revno: 246
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Sat 2007-07-21 20:40:41 +0200
message:
  Use repository rather than branch where possible.
modified:
  viz/branchwin.py
  viz/graph.py
-------------- next part --------------
=== modified file 'viz/branchwin.py'
--- a/viz/branchwin.py	2007-07-19 14:11:55 +0000
+++ b/viz/branchwin.py	2007-07-21 18:40:41 +0000
@@ -176,7 +176,7 @@
 
         last_lines = []
         (self.revisions, colours, self.children, self.parent_ids,
-            merge_sorted) = distances(branch, start)
+            merge_sorted) = distances(branch.repository, start)
         for (index, (revision, node, lines)) in enumerate(graph(
                 self.revisions, colours, merge_sorted)):
             # FIXME: at this point we should be able to show the graph order

=== modified file 'viz/graph.py'
--- a/viz/graph.py	2007-06-08 08:55:48 +0000
+++ b/viz/graph.py	2007-07-21 18:40:41 +0000
@@ -64,24 +64,24 @@
 
 class DistanceMethod(object):
 
-    def __init__(self, branch, start):
-        self.branch = branch
-        self.start = start
+    def __init__(self, repository, start_revid):
+        self.repository = repository
+        self.start_revid = start_revid
         self.revisions = {}
         self.children = {}
-        self.children_of_id = {start: set()}
+        self.children_of_id = {start_revid: set()}
         self.parent_ids_of = {}
-        self.colours = { start: 0 }
+        self.colours = { start_revid: 0 }
         self.last_colour = 0
         self.direct_parent_of = {}
         self.graph = {}
 
     def fill_caches(self):
-        graph = self.branch.repository.get_revision_graph_with_ghosts([self.start])
+        graph = self.repository.get_revision_graph_with_ghosts([self.start_revid])
         for revid in graph.ghosts:
             self.cache_revision(DummyRevision(revid))
         for revid, parents in graph.get_ancestors().items():
-            self.cache_revision(RevisionProxy(revid, parents, self.branch.repository))
+            self.cache_revision(RevisionProxy(revid, parents, self.repository))
 
     def cache_revision(self, revision):
         "Set the caches for a newly retrieved revision."""
@@ -236,7 +236,7 @@
                 self.colours[revid] = self.last_colour = self.last_colour + 1
 
 
-def distances(branch, start):
+def distances(repository, start_revid):
     """Sort the revisions.
 
     Traverses the branch revision tree starting at start and produces an
@@ -245,9 +245,9 @@
 
     Returns a tuple of (revids, revisions, colours, children)
     """
-    distance = DistanceMethod(branch, start)
+    distance = DistanceMethod(repository, start_revid)
     distance.fill_caches()
-    distance.merge_sorted = merge_sort(distance.graph, distance.start)
+    distance.merge_sorted = merge_sort(distance.graph, distance.start_revid)
     children = distance.make_children_map()
     
     for seq, revid, merge_depth, end_of_merge in distance.merge_sorted:



More information about the Pkg-bazaar-commits mailing list