def show_diff(self, revid, parentid=NULL_REVISION): """Open a new window to show a diff between the given revisions.""" from bzrlib.plugins.gtk.diff import DiffWindow window = DiffWindow(parent=self) rev_tree = self.branch.repository.revision_tree(revid) parent_tree = self.branch.repository.revision_tree(parentid) description = revid + " - " + self.branch._get_nick(local=True) window.set_diff(description, rev_tree, parent_tree) window.show()
def show_diff(self, item): from bzrlib.plugins.gtk.diff import DiffWindow window = DiffWindow(parent=self._parent) parentids = self.repository.get_revision(self.revids[0]).parent_ids if len(parentids) == 0: parentid = NULL_REVISION else: parentid = parentids[0] rev_tree = self.repository.revision_tree(self.revids[0]) parent_tree = self.repository.revision_tree(parentid) window.set_diff(self.revids[0], rev_tree, parent_tree) window.show()
def diff_cb(self, menu, vfs_file): # We can only cope with local files if vfs_file.get_uri_scheme() != 'file': return file = vfs_file.get_uri() try: tree, path = WorkingTree.open_containing(file) except NotBranchError: return from bzrlib.plugins.gtk.diff import DiffWindow window = DiffWindow() window.set_diff(tree.branch._get_nick(local=True), tree, tree.branch.basis_tree()) window.show() return
def line_diff(self, tv, path, tvc): row = path[0] revision = self.annotations[row] repository = self.branch.repository if revision.revision_id == CURRENT_REVISION: tree1 = self.tree tree2 = self.tree.basis_tree() else: tree1 = repository.revision_tree(revision.revision_id) if len(revision.parent_ids) > 0: tree2 = repository.revision_tree(revision.parent_ids[0]) else: tree2 = repository.revision_tree(NULL_REVISION) from bzrlib.plugins.gtk.diff import DiffWindow window = DiffWindow(self) window.set_diff("Diff for line %d" % (row+1), tree1, tree2) window.set_file(tree1.id2path(self.file_id)) window.show()
def diff_cb(self, menu, tree, path=None): from bzrlib.plugins.gtk.diff import DiffWindow window = DiffWindow() window.set_diff(tree.branch._get_nick(local=True), tree, tree.branch.basis_tree()) window.show()