1
# Copyright (C) 2005 Dan Loda <danloda@gmail.com>
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
from bzrlib.branch import Branch
22
from bzrlib.commands import Command, register_command
23
from bzrlib.errors import NotVersionedError
24
from bzrlib.option import Option
27
class cmd_xannotate(Command):
30
Browse changes to FILENAME line by line in a GTK+ window.
33
takes_args = ["filename"]
34
takes_options = [Option("all", help="show annotations on all lines")]
35
aliases = ["xblame", "xpraise"]
37
def run(self, filename, all=False):
38
(branch, path) = Branch.open_containing(filename)
40
file_id = branch.working_tree().path2id(path)
43
raise NotVersionedError(filename)
45
from xannotate import XAnnotateWindow
47
window = XAnnotateWindow()
49
window.set_title(path + " - xannotate")
50
window.annotate(branch, file_id, all)
51
window.connect("destroy", lambda w: gtk.main_quit())
55
register_command(cmd_xannotate)