/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-12-20 20:56:41 UTC
  • mto: This revision was merged to the branch mainline in revision 126.
  • Revision ID: abentley@panoramicfeedback.com-20061220205641-d1d8esw86pl3xkla
Gannotate works with branches, not just trees

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
"""GTK+ frontends to Bazaar commands """
16
16
 
 
17
from bzrlib import errors
17
18
from bzrlib.commands import Command, register_command, display_command
18
19
from bzrlib.errors import NotVersionedError, BzrCommandError, NoSuchFile
19
20
from bzrlib.commands import Command, register_command
167
168
        from annotate.gannotate import GAnnotateWindow
168
169
        from annotate.config import GAnnotateConfig
169
170
 
170
 
        (wt, path) = WorkingTree.open_containing(filename)
171
 
        branch = wt.branch
 
171
        try:
 
172
            (tree, path) = WorkingTree.open_containing(filename)
 
173
            branch = tree.branch
 
174
        except errors.NoWorkingTree:
 
175
            (branch, path) = Branch.open_containing(filename)
 
176
            tree = branch.basis_tree()
172
177
 
173
 
        file_id = wt.path2id(path)
 
178
        file_id = tree.path2id(path)
174
179
 
175
180
        if file_id is None:
176
181
            raise NotVersionedError(filename)
180
185
            revision_id = revision[0].in_history(branch).rev_id
181
186
            tree = branch.repository.revision_tree(revision_id)
182
187
        else:
183
 
            revision_id = None
184
 
            tree = wt
 
188
            revision_id = getattr(tree, 'get_revision_id', lambda: None)()
185
189
 
186
190
        window = GAnnotateWindow(all, plain)
187
191
        window.connect("destroy", lambda w: gtk.main_quit())