/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: Javier Derderian
  • Date: 2008-04-11 20:34:06 UTC
  • mto: (465.1.1 gtk.patch)
  • mto: This revision was merged to the branch mainline in revision 466.
  • Revision ID: javierder@gmail.com-20080411203406-ftlwyodw9vr87olv
Updated "Compare with..." (#78765) to use revbrowser.RevisionBrowser.
Also needed to fix #215872 to make it work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
from bzrlib.plugins.gtk.tags import AddTagDialog
19
19
from bzrlib.plugins.gtk.preferences import PreferencesWindow
20
20
from bzrlib.plugins.gtk.branchview import TreeView, treemodel
21
 
from bzrlib.plugins.gtk.dialog import _chooserevison_dialog
22
21
from bzrlib.revision import Revision, NULL_REVISION
23
22
from bzrlib.config import BranchConfig
24
23
from bzrlib.config import GlobalConfig
25
 
from bzrlib.tsort import merge_sort
26
24
 
27
25
class BranchWindow(Window):
28
26
    """Branch window.
388
386
        """Callback for revision 'compare with' menu. Will show a small
389
387
            dialog with branch revisions to compare with selected revision in TreeView"""
390
388
        
391
 
        start_revs = (self.branch.last_revision(),) #create touple with only last revision
392
 
        graph = self.branch.repository.get_graph()
393
 
 
394
 
        graph_parents = {} # this code is copied from "branchview/linegraph.linegraph()" and is the
395
 
                           # only way I found to generate a list of revision numbers...
396
 
                           
397
 
        for (revid, parent_revids) in graph.iter_ancestry(start_revs):
398
 
            graph_parents[revid] = parent_revids
399
 
 
400
 
        graph_parents["top:"] = start_revs
401
 
 
402
 
        if len(graph_parents)>0:
403
 
            merge_sorted_revisions = merge_sort(
404
 
                graph_parents,
405
 
                "top:",
406
 
                generate_revno=True)
407
 
        else:
408
 
            merge_sorted_revisions = ()
409
 
 
410
 
        response, revid2 = _chooserevison_dialog(merge_sorted_revisions) # show dialog passing revisions
411
 
 
412
 
        if response == gtk.RESPONSE_OK and revid2 != '':
 
389
        from bzrlib.plugins.gtk.revbrowser import RevisionBrowser
 
390
        
 
391
        rb = RevisionBrowser(self.branch,self)
 
392
        ret = rb.run()
 
393
        
 
394
        if ret == gtk.RESPONSE_OK:          
413
395
            (path, focus) = self.treeview.treeview.get_cursor()
414
396
            revid = self.treeview.model[path][treemodel.REVID]
415
 
 
416
 
            from bzrlib.plugins.gtk.diff import DiffWindow
417
 
            window = DiffWindow(parent=self)
418
 
            rev_tree = self.branch.repository.revision_tree(revid)
419
 
            parent_tree = self.branch.repository.revision_tree(revid2)
420
 
            window.set_diff(revid, rev_tree, parent_tree)
421
 
            window.show()
422
 
 
423
 
        elif response == gtk.RESPONSE_OK and revid2 == '':
424
 
            error_dialog("Bad revision","You must select a revision")
 
397
            self.show_diff(revid, rb.selected_revid)
 
398
            
 
399
        rb.destroy()
425
400
            
426
401
    def _set_revision_cb(self, w, revision_id):
427
402
        self.treeview.set_revision_id(revision_id)