[Pkg-bazaar-commits] ./bzr-gtk/unstable r32: make expensive sorting and parent filtering optional

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


------------------------------------------------------------
revno: 32
committer: David Allouche <david.allouche at canonical.com>
timestamp: Sat 2005-12-03 05:03:24 +0100
message:
  make expensive sorting and parent filtering optional
modified:
  __init__.py
  branchwin.py
  bzrkapp.py
  graph.py
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py	2005-10-18 12:21:32 +0000
+++ b/__init__.py	2005-12-03 04:03:24 +0000
@@ -18,7 +18,7 @@
 
 import bzrlib
 import bzrlib.commands
-
+from bzrlib.option import Option
 from bzrlib.branch import Branch
 
 
@@ -30,12 +30,21 @@
 
     The default starting point is latest revision on the branch, you can
     specify a starting point with -r revision.
+
+    The --robust option enables removal of redundant parents. It is sometimes
+    useful on branches that contain corrupt revisions.
+
+    The --accurate option enables a more expensive sorting algorithm to keep
+    revisions on the same branch close.
     """
-    takes_options = [ "revision" ]
+    takes_options = [
+        "revision",
+        Option('robust', "ignore redundant parents"),
+        Option('accurate', "sort revisions more carefully")]
     takes_args = [ "location?" ]
     aliases = [ "visualize", "vis", "viz" ]
 
-    def run(self, location=".", revision=None):
+    def run(self, location=".", revision=None, robust=False, accurate=False):
         (branch, path) = Branch.open_containing(location)
         if revision is None:
             revid = branch.last_revision()
@@ -47,7 +56,7 @@
         from bzrkapp import BzrkApp
 
         app = BzrkApp()
-        app.show(branch, revid)
+        app.show(branch, revid, robust, accurate)
         app.main()
 
 

=== modified file 'branchwin.py'
--- a/branchwin.py	2005-11-26 02:03:28 +0000
+++ b/branchwin.py	2005-12-03 04:03:24 +0000
@@ -222,7 +222,7 @@
 
         return vbox
 
-    def set_branch(self, branch, start):
+    def set_branch(self, branch, start, robust, accurate):
         """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)
+                 = distances(branch, start, robust, accurate)
         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-10-18 12:21:57 +0000
+++ b/bzrkapp.py	2005-12-03 04:03:24 +0000
@@ -27,10 +27,10 @@
     the last window is closed.
     """
 
-    def show(self, branch, start):
+    def show(self, branch, start, robust, accurate):
         """Open a new window to show the given branch."""
         window = BranchWindow(self)
-        window.set_branch(branch, start)
+        window.set_branch(branch, start, robust, accurate)
         window.connect("destroy", self._destroy_cb)
         window.show()
 

=== modified file 'graph.py'
--- a/graph.py	2005-12-03 03:38:49 +0000
+++ b/graph.py	2005-12-03 04:03:24 +0000
@@ -263,7 +263,7 @@
                 self.colours[revid] = self.last_colour = self.last_colour + 1
 
 
-def distances(branch, start):
+def distances(branch, start, robust, accurate):
     """Sort the revisions.
 
     Traverses the branch revision tree starting at start and produces an
@@ -275,9 +275,13 @@
     distance = DistanceMethod(branch, start)
     distance.fill_caches()
     sorted_revids = distance.first_ancestry_traversal()
-    distance.remove_redundant_parents(sorted_revids)
+    if robust:
+        print 'robust filtering'
+        distance.remove_redundant_parents(sorted_revids)
     children = distance.make_children_map()
-    sorted_revids = distance.sort_revisions(sorted_revids)
+    if accurate:
+        print 'accurate sorting'
+        sorted_revids = distance.sort_revisions(sorted_revids)
     for revid in sorted_revids:
         distance.choose_colour(revid)
 



More information about the Pkg-bazaar-commits mailing list