[Pkg-bazaar-commits] ./bzr-gtk/unstable r33: add --maxnum option to cut-off long histories

David Allouche david.allouche at canonical.com
Fri Apr 10 07:15:45 UTC 2009


------------------------------------------------------------
revno: 33
committer: David Allouche <david.allouche at canonical.com>
timestamp: Sat 2005-12-03 14:13:08 +0100
message:
  add --maxnum option to cut-off long histories
modified:
  __init__.py
  branchwin.py
  bzrkapp.py
  graph.py
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py	2005-12-03 04:03:24 +0000
+++ b/__init__.py	2005-12-03 13:13:08 +0000
@@ -40,11 +40,13 @@
     takes_options = [
         "revision",
         Option('robust', "ignore redundant parents"),
-        Option('accurate', "sort revisions more carefully")]
+        Option('accurate', "sort revisions more carefully"),
+        Option('maxnum', "maximum number of revisions to display", int, 'count')]
     takes_args = [ "location?" ]
     aliases = [ "visualize", "vis", "viz" ]
 
-    def run(self, location=".", revision=None, robust=False, accurate=False):
+    def run(self, location=".", revision=None, robust=False, accurate=False,
+            maxnum=None):
         (branch, path) = Branch.open_containing(location)
         if revision is None:
             revid = branch.last_revision()
@@ -56,7 +58,7 @@
         from bzrkapp import BzrkApp
 
         app = BzrkApp()
-        app.show(branch, revid, robust, accurate)
+        app.show(branch, revid, robust, accurate, maxnum)
         app.main()
 
 

=== modified file 'branchwin.py'
--- a/branchwin.py	2005-12-03 04:03:24 +0000
+++ b/branchwin.py	2005-12-03 13:13:08 +0000
@@ -222,7 +222,7 @@
 
         return vbox
 
-    def set_branch(self, branch, start, robust, accurate):
+    def set_branch(self, branch, start, robust, accurate, maxnum):
         """Set the branch and start position for this window.
 
         Creates a new TreeModel and populates it with information about
@@ -242,7 +242,7 @@
 
         last_lines = []
         (revids, self.revisions, colours, self.children, self.parent_ids) \
-                 = distances(branch, start, robust, accurate)
+                 = distances(branch, start, robust, accurate, maxnum)
         for revision, node, lines in graph(
                 revids, self.revisions, colours, self.parent_ids):
             message = revision.message.split("\n")[0]

=== modified file 'bzrkapp.py'
--- a/bzrkapp.py	2005-12-03 04:03:24 +0000
+++ b/bzrkapp.py	2005-12-03 13:13:08 +0000
@@ -27,10 +27,10 @@
     the last window is closed.
     """
 
-    def show(self, branch, start, robust, accurate):
+    def show(self, branch, start, robust, accurate, maxnum):
         """Open a new window to show the given branch."""
         window = BranchWindow(self)
-        window.set_branch(branch, start, robust, accurate)
+        window.set_branch(branch, start, robust, accurate, maxnum)
         window.connect("destroy", self._destroy_cb)
         window.show()
 

=== modified file 'graph.py'
--- a/graph.py	2005-12-03 04:03:24 +0000
+++ b/graph.py	2005-12-03 13:13:08 +0000
@@ -263,7 +263,7 @@
                 self.colours[revid] = self.last_colour = self.last_colour + 1
 
 
-def distances(branch, start, robust, accurate):
+def distances(branch, start, robust, accurate, maxnum):
     """Sort the revisions.
 
     Traverses the branch revision tree starting at start and produces an
@@ -285,6 +285,9 @@
     for revid in sorted_revids:
         distance.choose_colour(revid)
 
+    if maxnum is not None:
+        del sorted_revids[maxnum:]
+
     revisions = distance.revisions
     colours = distance.colours
     parent_ids_of = distance.parent_ids_of



More information about the Pkg-bazaar-commits mailing list