[Pkg-bazaar-commits] ./bzr-gtk/unstable r457: Merge from trunk

Martin Albisetti argentina at gmail.com
Fri Apr 10 07:44:51 UTC 2009


------------------------------------------------------------
revno: 457
committer: Martin Albisetti <argentina at gmail.com>
branch nick: gtk.nautilus
timestamp: Sun 2008-03-30 17:20:03 -0300
message:
  Merge from trunk
modified:
  NEWS
  __init__.py
  about.py
  branch.py
  branchview/linegraph.py
  olive.glade
  olive/__init__.py
  viz/branchwin.py
    ------------------------------------------------------------
    revno: 452.4.1
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: multi-heads
    timestamp: Thu 2008-03-27 17:27:29 +0100
    message:
      Support displaying multiple tips in viz.
    modified:
      __init__.py
      branchview/linegraph.py
      viz/branchwin.py
    ------------------------------------------------------------
    revno: 452.4.2
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: multi-heads
    timestamp: Fri 2008-03-28 20:12:27 +0100
    message:
      Hide revision number column if more than one branch was specified.
    modified:
      viz/branchwin.py
    ------------------------------------------------------------
    revno: 450.1.5
    committer: Daniel Schierbeck <daniel.schierbeck at gmail.com>
    branch nick: trunk
    timestamp: Fri 2008-03-28 22:55:35 +0100
    message:
      Merged multihead branch.
    modified:
      __init__.py
      branchview/linegraph.py
      viz/branchwin.py
    ------------------------------------------------------------
    revno: 450.1.6
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Sat 2008-03-29 03:44:43 +0100
    message:
      Support showing multiple branches in bzr viz.
    modified:
      NEWS
    ------------------------------------------------------------
    revno: 450.1.7
    committer: Szilveszter Farkas (Phanatic) <szilveszter.farkas at gmail.com>
    branch nick: trunk
    timestamp: Sun 2008-03-30 16:11:42 +0200
    message:
      Merged an approved request (File menu item).
    modified:
      olive.glade
      olive/__init__.py
        ------------------------------------------------------------
        revno: 435.2.1
        committer: Szilveszter Farkas (Phanatic) <szilveszter.farkas at gmail.com>
        branch nick: bug130245
        timestamp: Tue 2008-03-04 15:14:42 +0100
        message:
          Added a Bookmark current directory to the File menu (#130245).
        modified:
          olive.glade
          olive/__init__.py
    ------------------------------------------------------------
    revno: 450.1.8
    committer: Szilveszter Farkas (Phanatic) <szilveszter.farkas at gmail.com>
    branch nick: trunk
    timestamp: Sun 2008-03-30 16:12:10 +0200
    message:
      Merged an approved request (single clicking bookmark).
    modified:
      olive.glade
      olive/__init__.py
        ------------------------------------------------------------
        revno: 435.3.1
        committer: Farkas Szilveszter <szilveszter at szilveszter-desktop>
        branch nick: bug151824
        timestamp: Tue 2008-03-04 14:52:14 +0100
        message:
          Allow opening bookmarks with a single click (#151824).
        modified:
          olive.glade
          olive/__init__.py
    ------------------------------------------------------------
    revno: 450.1.9
    committer: Szilveszter Farkas (Phanatic) <szilveszter.farkas at gmail.com>
    branch nick: trunk
    timestamp: Sun 2008-03-30 16:12:56 +0200
    message:
      Merged an approved request (quick fix for Branch dialog).
    modified:
      branch.py
        ------------------------------------------------------------
        revno: 442.3.1
        committer: Szilveszter Farkas (Phanatic) <szilveszter.farkas at gmail.com>
        branch nick: fix-branchdialog
        timestamp: Fri 2008-03-07 17:01:35 +0100
        message:
          Remove some deprecated stuff that breaks the Branch dialog.
        modified:
          branch.py
    ------------------------------------------------------------
    revno: 450.1.10
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Sun 2008-03-30 18:19:28 +0200
    message:
      Clarify license - it's GPLv2 /or later/
    modified:
      __init__.py
      about.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2008-03-27 16:45:34 +0000
+++ b/NEWS	2008-03-29 02:44:43 +0000
@@ -16,6 +16,8 @@
   * New Tango-styled icons. This time properly licensed under the GPL.
     (Simon Pascal Klein)
 
+  * Support showing multiple branches in "bzr viz". (Jelmer Vernooij)
+
  BUG FIXES
 
   * Make adding tags from the viz work again. (Daniel Schierbeck)

=== modified file '__init__.py'
--- a/__init__.py	2008-03-12 15:20:01 +0000
+++ b/__init__.py	2008-03-30 16:19:28 +0000
@@ -109,6 +109,10 @@
     return os.path.dirname(__file__)
 
 
+def icon_path(*args):
+    return os.path.join(data_path(), *args)
+
+
 class GTKCommand(Command):
     """Abstract class providing GTK specific run commands."""
 
@@ -215,13 +219,13 @@
             wt.unlock()
 
 
-def start_viz_window(branch, revision, limit=None):
+def start_viz_window(branch, revisions, limit=None):
     """Start viz on branch with revision revision.
     
     :return: The viz window object.
     """
     from viz import BranchWindow
-    return BranchWindow(branch, revision, limit)
+    return BranchWindow(branch, revisions, limit)
 
 
 class cmd_visualise(Command):
@@ -237,21 +241,23 @@
         "revision",
         Option('limit', "Maximum number of revisions to display.",
                int, 'count')]
-    takes_args = [ "location?" ]
+    takes_args = [ "locations*" ]
     aliases = [ "visualize", "vis", "viz" ]
 
-    def run(self, location=".", revision=None, limit=None):
+    def run(self, locations_list, revision=None, limit=None):
         set_ui_factory()
-        (br, path) = branch.Branch.open_containing(location)
-        if revision is None:
-            revid = br.last_revision()
-            if revid is None:
-                return
-        else:
-            (revno, revid) = revision[0].in_history(br)
-
+        if locations_list is None:
+            locations_list = ["."]
+        revids = []
+        for location in locations_list:
+            (br, path) = branch.Branch.open_containing(location)
+            if revision is None:
+                revids.append(br.last_revision())
+            else:
+                (revno, revid) = revision[0].in_history(br)
+                revids.append(revid)
         import gtk
-        pp = start_viz_window(br, revid, limit)
+        pp = start_viz_window(br, revids, limit)
         pp.connect("destroy", lambda w: gtk.main_quit())
         pp.show()
         gtk.main()
@@ -514,7 +520,7 @@
         from notify import NotifyPopupMenu
         gtk = self.open_display()
         menu = NotifyPopupMenu()
-        icon = gtk.status_icon_new_from_file(os.path.join(data_path(), "bzr-icon-64.png"))
+        icon = gtk.status_icon_new_from_file(icon_path("bzr-icon-64.png"))
         icon.connect('popup-menu', menu.display)
 
         import cgi

=== modified file 'about.py'
--- a/about.py	2008-01-27 01:13:38 +0000
+++ b/about.py	2008-03-30 16:19:28 +0000
@@ -31,7 +31,7 @@
         self.set_name("Bazaar GTK")
         self.set_version(bzrlib.plugins.gtk.version_string)
         self.set_website("http://bazaar-vcs.org/BzrGtk")
-        self.set_license("GNU GPL v2")
+        self.set_license("GNU GPL v2 or later")
         self.set_icon(gtk.gdk.pixbuf_new_from_file(os.path.join(data_path(), "bzr-icon-64.png")))
         self.connect ("response", lambda d, r: d.destroy())
 

=== modified file 'branch.py'
--- a/branch.py	2007-08-27 12:38:18 +0000
+++ b/branch.py	2008-03-07 16:01:35 +0000
@@ -177,7 +177,6 @@
         finally:
             br_from.unlock()
                 
-        self._history.add_entry(location)
         info_dialog(_('Branching successful'),
                     _('%d revision(s) branched.') % revs)
         

=== modified file 'branchview/linegraph.py'
--- a/branchview/linegraph.py	2008-02-14 19:59:06 +0000
+++ b/branchview/linegraph.py	2008-03-27 16:27:29 +0000
@@ -11,7 +11,7 @@
 
 from bzrlib.tsort import merge_sort
 
-def linegraph(repository, start, maxnum, broken_line_length = None,
+def linegraph(repository, start_revs, maxnum, broken_line_length = None,
               graph_data = True, mainline_only = False):
     """Produce a directed graph of a bzr repository.
 
@@ -42,15 +42,19 @@
     curved, kinked, etc.) and to pick the actual colours for each index.
     """
     
-    graph_parents = repository.get_revision_graph(start)
+    graph = repository.get_graph()
+    graph_parents = {}
     graph_children = {}
-    for revid in graph_parents.iterkeys():
+    for (revid, parent_revids) in graph.iter_ancestry(start_revs):
+        graph_parents[revid] = parent_revids
         graph_children[revid] = []
 
+    graph_parents["top:"] = start_revs
+
     if len(graph_parents)>0:
         merge_sorted_revisions = merge_sort(
             graph_parents,
-            start,
+            "top:",
             generate_revno=True)
     else:
         merge_sorted_revisions = ()
@@ -58,6 +62,9 @@
     if mainline_only:
         merge_sorted_revisions = [elem for elem in merge_sorted_revisions \
                                   if len(elem[3])==1 ]
+
+    assert merge_sorted_revisions[0][1] == "top:"
+    merge_sorted_revisions = merge_sorted_revisions[1:]
     
     revid_index = {}
     revno_index = {}

=== modified file 'olive.glade'
--- a/olive.glade	2007-11-28 18:00:03 +0000
+++ b/olive.glade	2008-03-30 14:12:10 +0000
@@ -58,6 +58,14 @@
                       </widget>
                     </child>
                     <child>
+                      <widget class="GtkMenuItem" id="menuitem_file_bookmark">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">_Bookmark current directory</property>
+                        <property name="use_underline">True</property>
+                        <signal name="activate" handler="on_menuitem_file_bookmark_activate"/>
+                      </widget>
+                    </child>
+                    <child>
                       <widget class="GtkMenuItem" id="menuitem_file_make_directory">
                         <property name="visible">True</property>
                         <property name="label" translatable="yes">Make _directory...</property>
@@ -507,6 +515,7 @@
                     <property name="can_focus">True</property>
                     <property name="headers_visible">False</property>
                     <signal name="button_press_event" handler="on_treeview_left_button_press_event"/>
+                    <signal name="button_release_event" handler="on_treeview_left_button_release_event"/>
                     <signal name="row_activated" handler="on_treeview_left_row_activated"/>
                   </widget>
                 </child>

=== modified file 'olive/__init__.py'
--- a/olive/__init__.py	2008-03-04 14:18:03 +0000
+++ b/olive/__init__.py	2008-03-30 14:12:10 +0000
@@ -106,6 +106,7 @@
         # Get some important menu items
         self.menuitem_add_files = self.toplevel.get_widget('menuitem_add_files')
         self.menuitem_remove_files = self.toplevel.get_widget('menuitem_remove_file')
+        self.menuitem_file_bookmark = self.toplevel.get_widget('menuitem_file_bookmark')
         self.menuitem_file_make_directory = self.toplevel.get_widget('menuitem_file_make_directory')
         self.menuitem_file_rename = self.toplevel.get_widget('menuitem_file_rename')
         self.menuitem_file_move = self.toplevel.get_widget('menuitem_file_move')
@@ -162,6 +163,7 @@
                 "on_about_activate": self.on_about_activate,
                 "on_menuitem_add_files_activate": self.on_menuitem_add_files_activate,
                 "on_menuitem_remove_file_activate": self.on_menuitem_remove_file_activate,
+                "on_menuitem_file_bookmark_activate": self.on_menuitem_file_bookmark_activate,
                 "on_menuitem_file_make_directory_activate": self.on_menuitem_file_make_directory_activate,
                 "on_menuitem_file_move_activate": self.on_menuitem_file_move_activate,
                 "on_menuitem_file_rename_activate": self.on_menuitem_file_rename_activate,
@@ -196,6 +198,7 @@
                 "on_treeview_right_button_press_event": self.on_treeview_right_button_press_event,
                 "on_treeview_right_row_activated": self.on_treeview_right_row_activated,
                 "on_treeview_left_button_press_event": self.on_treeview_left_button_press_event,
+                "on_treeview_left_button_release_event": self.on_treeview_left_button_release_event,
                 "on_treeview_left_row_activated": self.on_treeview_left_row_activated,
                 "on_button_location_up_clicked": self.on_button_location_up_clicked,
                 "on_button_location_jump_clicked": self.on_button_location_jump_clicked,
@@ -699,6 +702,18 @@
         finally:
             branch.unlock()
     
+    def on_menuitem_file_bookmark_activate(self, widget):
+        """ File/Bookmark current directory menu handler. """
+        if self.pref.add_bookmark(self.path):
+            info_dialog(_('Bookmark successfully added'),
+                        _('The current directory was bookmarked. You can reach\nit by selecting it from the left panel.'))
+            self.pref.write()
+        else:
+            warning_dialog(_('Location already bookmarked'),
+                           _('The current directory is already bookmarked.\nSee the left panel for reference.'))
+        
+        self.refresh_left()
+    
     def on_menuitem_file_make_directory_activate(self, widget):
         """ File/Make directory... menu handler. """
         from mkdir import OliveMkdir
@@ -796,6 +811,20 @@
             menu.left_context_menu().popup(None, None, None, 0,
                                            event.time)
 
+    def on_treeview_left_button_release_event(self, widget, event):
+        """ Occurs when somebody just clicks a bookmark. """
+        if event.button != 3:
+            # Allow one-click bookmark opening
+            if self.get_selected_left() == None:
+                return
+            
+            newdir = self.get_selected_left()
+            if newdir == None:
+                return
+
+            if self.set_path(newdir):
+                self.refresh_right()
+
     def on_treeview_left_row_activated(self, treeview, path, view_column):
         """ Occurs when somebody double-clicks or enters an item in the
         bookmark list. """

=== modified file 'viz/branchwin.py'
--- a/viz/branchwin.py	2008-03-13 15:12:43 +0000
+++ b/viz/branchwin.py	2008-03-28 19:12:27 +0000
@@ -28,11 +28,11 @@
     for a particular branch.
     """
 
-    def __init__(self, branch, start, maxnum, parent=None):
+    def __init__(self, branch, start_revs, maxnum, parent=None):
         """Create a new BranchWindow.
 
         :param branch: Branch object for branch to show.
-        :param start: Revision id of top revision.
+        :param start_revs: Revision ids of top revisions.
         :param maxnum: Maximum number of revisions to display, 
                        None for no limit.
         """
@@ -41,7 +41,7 @@
         self.set_border_width(0)
 
         self.branch      = branch
-        self.start       = start
+        self.start_revs  = start_revs
         self.maxnum      = maxnum
         self.config      = GlobalConfig()
 
@@ -155,8 +155,16 @@
         view_menu.add(view_menu_compact)
         view_menu.add(gtk.SeparatorMenuItem())
 
-        for (label, name) in [("Revision _Number", "revno"), ("_Date", "date")]:
-            col = gtk.CheckMenuItem("Show " + label + " Column")
+        self.mnu_show_revno_column = gtk.CheckMenuItem("Show Revision _Number Column")
+        self.mnu_show_date_column = gtk.CheckMenuItem("Show _Date Column")
+
+        # Revision numbers are pointless if there are multiple branches
+        if len(self.start_revs) > 1:
+            self.mnu_show_revno_column.set_sensitive(False)
+            self.treeview.set_property('revno-column-visible', False)
+
+        for (col, name) in [(self.mnu_show_revno_column, "revno"), 
+                            (self.mnu_show_date_column, "date")]:
             col.set_active(self.treeview.get_property(name + "-column-visible"))
             col.connect('toggled', self._col_visibility_changed, name)
             view_menu.add(col)
@@ -222,7 +230,7 @@
         """Construct the top-half of the window."""
         # FIXME: Make broken_line_length configurable
 
-        self.treeview = TreeView(self.branch, self.start, self.maxnum, self.compact_view)
+        self.treeview = TreeView(self.branch, self.start_revs, self.maxnum, self.compact_view)
 
         self.treeview.connect('revision-selected',
                 self._treeselection_changed_cb)
@@ -236,6 +244,7 @@
             if option is not None:
                 self.treeview.set_property(col + '-column-visible', option == 'True')
 
+        self.treeview.set_property(col + '-column-visible', False)
         self.treeview.show()
 
         align = gtk.Alignment(0.0, 0.0, 1.0, 1.0)



More information about the Pkg-bazaar-commits mailing list