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
27
25
class BranchWindow(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"""
391
start_revs = (self.branch.last_revision(),) #create touple with only last revision
392
graph = self.branch.repository.get_graph()
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...
397
for (revid, parent_revids) in graph.iter_ancestry(start_revs):
398
graph_parents[revid] = parent_revids
400
graph_parents["top:"] = start_revs
402
if len(graph_parents)>0:
403
merge_sorted_revisions = merge_sort(
408
merge_sorted_revisions = ()
410
response, revid2 = _chooserevison_dialog(merge_sorted_revisions) # show dialog passing revisions
412
if response == gtk.RESPONSE_OK and revid2 != '':
389
from bzrlib.plugins.gtk.revbrowser import RevisionBrowser
391
rb = RevisionBrowser(self.branch,self)
394
if ret == gtk.RESPONSE_OK:
413
395
(path, focus) = self.treeview.treeview.get_cursor()
414
396
revid = self.treeview.model[path][treemodel.REVID]
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)
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)
426
401
def _set_revision_cb(self, w, revision_id):
427
402
self.treeview.set_revision_id(revision_id)