[Pkg-bazaar-commits] ./bzr-gtk/unstable r470: Merge patch from Adrian dealing with null revision in a couple of places.

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


------------------------------------------------------------
revno: 470
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Fri 2008-04-25 21:23:28 +0100
message:
  Merge patch from Adrian dealing with null revision in a couple of places.
modified:
  annotate/gannotate.py
  branchview/treemodel.py
  branchview/treeview.py
  viz/branchwin.py
    ------------------------------------------------------------
    revno: 464.2.1
    committer: Adrian Wilkins <adrian.wilkins at gmail.com>
    branch nick: gtk
    timestamp: Thu 2008-04-24 16:26:14 +0100
    message:
      Detect the reserved null: revision in appropriate places. 
      
      This removes a huge shower of stack traces that get dumped to console when 
      you look at the bottom of a log.
    modified:
      annotate/gannotate.py
      branchview/treemodel.py
      branchview/treeview.py
      viz/branchwin.py
-------------- next part --------------
=== modified file 'annotate/gannotate.py'
--- a/annotate/gannotate.py	2008-03-04 18:03:39 +0000
+++ b/annotate/gannotate.py	2008-04-24 15:26:14 +0000
@@ -177,7 +177,7 @@
 
     def _activate_selected_revision(self, w):
         rev_id = self._selected_revision()
-        if rev_id is None:
+        if not rev_id or rev_id == NULL_REVISION:
             return
         selected = self.revisions[rev_id]
         self.revisionview.set_revision(selected)

=== modified file 'branchview/treemodel.py'
--- a/branchview/treemodel.py	2008-01-23 16:24:25 +0000
+++ b/branchview/treemodel.py	2008-04-24 15:26:14 +0000
@@ -12,6 +12,7 @@
 import pango
 import re
 from xml.sax.saxutils import escape
+from bzrlib.revision import NULL_REVISION
 
 from time import (strftime, localtime)
 
@@ -100,7 +101,7 @@
 
         if column == TAGS: return self.tags.get(revid, [])
 
-        if revid is None:
+        if not revid or revid == NULL_REVISION:
             return None
         if revid not in self.revisions:
             revision = self.repository.get_revisions([revid])[0]

=== modified file 'branchview/treeview.py'
--- a/branchview/treeview.py	2008-02-14 19:59:06 +0000
+++ b/branchview/treeview.py	2008-04-24 15:26:14 +0000
@@ -301,7 +301,7 @@
         self.index = index
         self.treeview.set_model(self.model)
 
-        if revision is None:
+        if not revision or revision == NULL_REVISION:
             self.treeview.set_cursor(0)
         else:
             self.set_revision(revision)

=== modified file 'viz/branchwin.py'
--- a/viz/branchwin.py	2008-04-25 20:03:44 +0000
+++ b/viz/branchwin.py	2008-04-25 20:23:28 +0000
@@ -306,20 +306,21 @@
         parents  = self.treeview.get_parents()
         children = self.treeview.get_children()
 
-        if revision is not None:
+        if revision and revision != NULL_REVISION:
             prev_menu = gtk.Menu()
             if len(parents) > 0:
                 self.prev_rev_action.set_sensitive(True)
                 for parent_id in parents:
-                    parent = self.branch.repository.get_revision(parent_id)
-                    try:
-                        str = ' (' + parent.properties['branch-nick'] + ')'
-                    except KeyError:
-                        str = ""
+                    if parent_id and parent_id != NULL_REVISION:
+                        parent = self.branch.repository.get_revision(parent_id)
+                        try:
+                            str = ' (' + parent.properties['branch-nick'] + ')'
+                        except KeyError:
+                            str = ""
 
-                    item = gtk.MenuItem(parent.message.split("\n")[0] + str)
-                    item.connect('activate', self._set_revision_cb, parent_id)
-                    prev_menu.add(item)
+                        item = gtk.MenuItem(parent.message.split("\n")[0] + str)
+                        item.connect('activate', self._set_revision_cb, parent_id)
+                        prev_menu.add(item)
                 prev_menu.show_all()
             else:
                 self.prev_rev_action.set_sensitive(False)



More information about the Pkg-bazaar-commits mailing list