1
# Modified for use with Olive:
2
# Copyright (C) 2006 by Szilveszter Farkas (Phanatic) <szilveszter.farkas@gmail.com>
3
# Original copyright holder:
4
# Copyright (C) 2005 by Canonical Ltd. (Scott James Remnant <scott@ubuntu.com>)
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
"""Application object.
22
This module contains the application object that manages the windows
23
on screen, and can be used to create new windows of various types.
26
__copyright__ = "Copyright © 2005 Canonical Ltd."
27
__author__ = "Scott James Remnant <scott@ubuntu.com>"
35
from branchwin import BranchWindow
36
from diffwin import DiffWindow
39
class BzrkApp(object):
40
"""Application manager.
42
This object manages the bzrk application, creating and managing
43
individual branch windows and ensuring the application exits when
44
the last window is closed.
47
def show(self, branch, start, maxnum):
48
"""Open a new window to show the given branch."""
49
window = BranchWindow(self)
50
window.set_branch(branch, start, maxnum)
53
def show_diff(self, branch, revid, parentid):
54
"""Open a new window to show a diff between the given revisions."""
56
rev_tree = branch.repository.revision_tree(revid)
57
parent_tree = branch.repository.revision_tree(parentid)
58
description = revid + " - " + branch.nick
59
window.set_diff(description, rev_tree, parent_tree)