/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 __init__.py

  • Committer: Aaron Bentley
  • Date: 2006-06-19 16:25:43 UTC
  • mto: This revision was merged to the branch mainline in revision 62.
  • Revision ID: abentley@panoramicfeedback.com-20060619162543-fe1bc8b1dffd56c0
Teach gdiff to accept a single file argument

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""GTK+ frontends to Bazaar commands """
18
18
from bzrlib.commands import Command, register_command, display_command
19
 
from bzrlib.errors import NotVersionedError, BzrCommandError
 
19
from bzrlib.errors import NotVersionedError, BzrCommandError, NoSuchFile
20
20
from bzrlib.commands import Command, register_command
21
21
from bzrlib.option import Option
22
22
from bzrlib.branch import Branch
51
51
    
52
52
    Otherwise, all changes for the tree are listed.
53
53
    """
54
 
    takes_args = []
 
54
    takes_args = ['filename?']
55
55
    takes_options = ['revision']
56
56
 
57
57
    @display_command
58
 
    def run(self, revision=None, file_list=None):
 
58
    def run(self, revision=None, filename=None):
59
59
        wt = WorkingTree.open_containing(".")[0]
60
60
        branch = wt.branch
61
61
        if revision is not None:
77
77
        window = DiffWindow()
78
78
        window.connect("destroy", lambda w: gtk.main_quit())
79
79
        window.set_diff("Working Tree", tree1, tree2)
 
80
        if filename is not None:
 
81
            tree_filename = tree1.relpath(filename)
 
82
            try:
 
83
                window.set_file(tree_filename)
 
84
            except NoSuchFile:
 
85
                if (tree1.inventory.path2id(tree_filename) is None and 
 
86
                    tree2.inventory.path2id(tree_filename) is None):
 
87
                    raise NotVersionedError(filename)
 
88
                raise BzrCommandError('No changes found for file "%s"' % 
 
89
                                      filename)
80
90
        window.show()
81
91
 
82
92
        gtk.main()