/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to viz/branchwin.py

  • Committer: Robert Collins
  • Date: 2007-07-07 22:02:45 UTC
  • mto: This revision was merged to the branch mainline in revision 216.
  • Revision ID: robertc@robertcollins.net-20070707220245-rqbiv4nerkk7z9oc
Add a Branch button to commit-notify.

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
        self.treeview.set_search_column(4)
76
76
        self.treeview.connect("cursor-changed", self._treeview_cursor_cb)
77
77
        self.treeview.connect("row-activated", self._treeview_row_activated_cb)
78
 
        self.treeview.connect("button-release-event", 
79
 
                self._treeview_row_mouseclick)
80
78
        scrollwin.add(self.treeview)
81
79
        self.treeview.show()
82
80
 
176
174
 
177
175
        last_lines = []
178
176
        (self.revisions, colours, self.children, self.parent_ids,
179
 
            merge_sorted) = distances(branch.repository, start)
 
177
         merge_sorted) = distances(branch, start)
180
178
        for (index, (revision, node, lines)) in enumerate(graph(
181
179
                self.revisions, colours, merge_sorted)):
182
180
            # FIXME: at this point we should be able to show the graph order
204
202
 
205
203
        self.back_button.set_sensitive(len(self.parent_ids[revision]) > 0)
206
204
        self.fwd_button.set_sensitive(len(self.children[revision]) > 0)
207
 
        tags = []
208
 
        if self.branch.supports_tags():
209
 
            tagdict = self.branch.tags.get_reverse_tag_dict()
210
 
            if tagdict.has_key(revision.revision_id):
211
 
                tags = tagdict[revision.revision_id]
212
 
        self.logview.set_revision(revision, tags)
 
205
        self.logview.set_revision(revision)
213
206
 
214
207
    def _back_clicked_cb(self, *args):
215
208
        """Callback for when the back button is clicked."""
253
246
        """Open a new window to show a diff between the given revisions."""
254
247
        from bzrlib.plugins.gtk.diff import DiffWindow
255
248
        window = DiffWindow()
256
 
        (parent_tree, rev_tree) = branch.repository.revision_trees([parentid, 
257
 
                                                                   revid])
 
249
        rev_tree = branch.repository.revision_tree(revid)
 
250
        parent_tree = branch.repository.revision_tree(parentid)
258
251
        description = revid + " - " + branch.nick
259
252
        window.set_diff(description, rev_tree, parent_tree)
260
253
        window.show()
264
257
        self.show_diff(self.branch, revid, parentid)
265
258
        self.treeview.grab_focus()
266
259
 
267
 
    def _treeview_row_mouseclick(self, widget, event):
268
 
        from bzrlib.plugins.gtk.revisionmenu import RevisionPopupMenu
269
 
        if event.button == 3:
270
 
            menu = RevisionPopupMenu(self.branch.repository, 
271
 
                [x.revision_id for x in self.selected_revisions()],
272
 
                self.branch)
273
 
            menu.popup(None, None, None, event.button, event.get_time())
274
 
 
275
 
    def selected_revision(self, path):
276
 
        return self.model[path][0]
277
 
 
278
 
    def selected_revisions(self):
279
 
        return [self.selected_revision(path) for path in \
280
 
                self.treeview.get_selection().get_selected_rows()[1]]
281
 
 
282
260
    def _treeview_row_activated_cb(self, widget, path, col):
283
261
        # TODO: more than one parent
284
262
        """Callback for when a treeview row gets activated."""
285
 
        revision = self.selected_revision(path)
 
263
        revision = self.model[path][0]
286
264
        if len(self.parent_ids[revision]) == 0:
287
265
            # Ignore revisions without parent
288
266
            return