[Pkg-bazaar-commits] ./bzr-gtk/unstable r40: remove --robust, pyflakes fixes, update README

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


------------------------------------------------------------
revno: 40
committer: David Allouche <david.allouche at canonical.com>
branch nick: ddaa
timestamp: Mon 2006-05-08 15:03:59 +0200
message:
  remove --robust, pyflakes fixes, update README
  
  Thanks to Robert Collins' new graphing logic, the --robust option is
  no longer needed to prevent extreme graph width on broken branches.
  That allows removing a bunch of flaky code.
  
  Remove a few spurious imports (thanks to pyflakes).
  
  Update README to request bzr>=0.8.
modified:
  README
  __init__.py
  branchwin.py
  bzrkapp.py
  diffwin.py
  graph.py
-------------- next part --------------
=== modified file 'README'
--- a/README	2005-10-28 16:29:57 +0000
+++ b/README	2006-05-08 13:03:59 +0000
@@ -12,7 +12,7 @@
 need the following runtime dependencies:
 
   * Python 2.4
-  * bzr 0.6 or later
+  * bzr 0.8 or later
   * PyGTK 2.8 or later
   * PyCairo 1.0 or later
 
@@ -31,8 +31,8 @@
 Usage
 -----
 
-Simply run "bzr visualise" (or "bzr viz") while in a bzr working tree,
-a window will appear with the history of the branch and a graph
+Simply run "bzr visualise" (or "bzr viz") while in a bzr working tree or
+branch, a window will appear with the history of the branch and a graph
 connecting the individual revisions.
 
 You can move through the revision history by clicking or with the arrow

=== modified file '__init__.py'
--- a/__init__.py	2006-03-29 17:40:50 +0000
+++ b/__init__.py	2006-05-08 13:03:59 +0000
@@ -16,13 +16,12 @@
 __author__    = "Scott James Remnant <scott at ubuntu.com>"
 
 
-import bzrlib
-import bzrlib.commands
+from bzrlib.commands import Command, register_command
 from bzrlib.option import Option
 from bzrlib.branch import Branch
 
 
-class cmd_visualise(bzrlib.commands.Command):
+class cmd_visualise(Command):
     """Graphically visualise this branch.
 
     Opens a graphical window to allow you to see the history of the branch
@@ -30,19 +29,14 @@
 
     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.
     """
     takes_options = [
         "revision",
-        Option('robust', "ignore redundant parents"),
         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,
-            maxnum=None):
+    def run(self, location=".", revision=None, maxnum=None):
         (branch, path) = Branch.open_containing(location)
         branch.lock_read()
         branch.repository.lock_read()
@@ -57,11 +51,11 @@
             from bzrkapp import BzrkApp
                 
             app = BzrkApp()
-            app.show(branch, revid, robust, maxnum)
+            app.show(branch, revid, maxnum)
         finally:
             branch.repository.unlock()
             branch.unlock()
         app.main()
 
 
-bzrlib.commands.register_command(cmd_visualise)
+register_command(cmd_visualise)

=== modified file 'branchwin.py'
--- a/branchwin.py	2006-04-05 08:38:53 +0000
+++ b/branchwin.py	2006-05-08 13:03:59 +0000
@@ -10,8 +10,6 @@
 __author__    = "Scott James Remnant <scott at ubuntu.com>"
 
 
-import os
-
 import gtk
 import gobject
 import pango
@@ -238,7 +236,7 @@
 
         return vbox
 
-    def set_branch(self, branch, start, robust, maxnum):
+    def set_branch(self, branch, start, maxnum):
         """Set the branch and start position for this window.
 
         Creates a new TreeModel and populates it with information about
@@ -257,8 +255,8 @@
         index = 0
 
         last_lines = []
-        (self.revisions, colours, self.children, self.parent_ids, merge_sorted) \
-                 = distances(branch, start, robust, maxnum)
+        (self.revisions, colours, self.children, self.parent_ids,
+         merge_sorted) = distances(branch, start, maxnum)
         for revision, node, lines in graph(
                 self.revisions, colours, merge_sorted):
             # FIXME: at this point we should be able to show the graph order and

=== modified file 'bzrkapp.py'
--- a/bzrkapp.py	2006-03-29 17:40:50 +0000
+++ b/bzrkapp.py	2006-05-08 13:03:59 +0000
@@ -27,10 +27,10 @@
     the last window is closed.
     """
 
-    def show(self, branch, start, robust, maxnum):
+    def show(self, branch, start, maxnum):
         """Open a new window to show the given branch."""
         window = BranchWindow(self)
-        window.set_branch(branch, start, robust, maxnum)
+        window.set_branch(branch, start, maxnum)
         window.connect("destroy", self._destroy_cb)
         window.show()
 

=== modified file 'diffwin.py'
--- a/diffwin.py	2006-03-30 09:20:32 +0000
+++ b/diffwin.py	2006-05-08 13:03:59 +0000
@@ -10,12 +10,9 @@
 __author__    = "Scott James Remnant <scott at ubuntu.com>"
 
 
-import os
-
 from cStringIO import StringIO
 
 import gtk
-import gobject
 import pango
 
 try:

=== modified file 'graph.py'
--- a/graph.py	2006-04-03 02:31:25 +0000
+++ b/graph.py	2006-05-08 13:03:59 +0000
@@ -11,7 +11,6 @@
 __author__    = "Scott James Remnant <scott at ubuntu.com>"
 
 
-from bzrlib.errors import NoSuchRevision
 from bzrlib.tsort import merge_sort
 
 
@@ -113,50 +112,6 @@
         return dict((revisions[revid], c)
                     for (revid, c) in self.children_of_id.iteritems())
 
-    def remove_redundant_parents(self, sorted_revids):
-        children_of_id = self.children_of_id
-        revisions = self.revisions
-        parent_ids_of = self.parent_ids_of
-        
-        # Count the number of children of each revision, so we can release
-        # memory for ancestry data as soon as it's not going to be needed
-        # anymore.
-        pending_count_of = {}
-        for parent_id, children in children_of_id.iteritems():
-            pending_count_of[parent_id] = len(children)
-
-        # Build the ancestry dictionnary by examining older revisions first,
-        # and remove revision parents that are ancestors of other parents of
-        # the same revision.
-        ancestor_ids_of = {}
-        for revid in reversed(sorted_revids):
-            revision = revisions[revid]
-            parent_ids = parent_ids_of[revision]
-            # ignore candidate parents which are an ancestor of another parent,
-            # but never ignore the leftmost parent
-            redundant_ids = []
-            ignorable_parent_ids = parent_ids[1:] # never ignore leftmost
-            for candidate_id in ignorable_parent_ids: 
-                for parent_id in list(parent_ids):
-                    if candidate_id in ancestor_ids_of[parent_id]:
-                        redundant_ids.append(candidate_id)
-                        parent_ids.remove(candidate_id)
-                        children_of_candidate = children_of_id[candidate_id]
-                        children_of_candidate.remove(revision)
-                        break
-            # save the set of ancestors of that revision
-            ancestor_ids = set(parent_ids)
-            for parent_id in parent_ids:
-                ancestor_ids.update(ancestor_ids_of[parent_id])
-            ancestor_ids_of[revid] = ancestor_ids
-            # discard ancestry data for revisions whose children are already
-            # done
-            for parent_id in parent_ids + redundant_ids:
-                pending_count = pending_count_of[parent_id] - 1
-                pending_count_of[parent_id] = pending_count
-                if pending_count == 0:
-                    ancestor_ids_of[parent_id] = None
-
     def sort_revisions(self, sorted_revids, maxnum):
         revisions = self.revisions
         parent_ids_of = self.parent_ids_of
@@ -282,7 +237,7 @@
                 self.colours[revid] = self.last_colour = self.last_colour + 1
 
 
-def distances(branch, start, robust, maxnum):
+def distances(branch, start, maxnum):
     """Sort the revisions.
 
     Traverses the branch revision tree starting at start and produces an
@@ -293,9 +248,6 @@
     """
     distance = DistanceMethod(branch, start)
     distance.fill_caches()
-    if robust:
-        print 'robust filtering'
-        distance.remove_redundant_parents(self.graph.keys())
     distance.merge_sorted = merge_sort(distance.graph, distance.start)
     children = distance.make_children_map()
     



More information about the Pkg-bazaar-commits mailing list