/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: Andrew Bennetts
  • Date: 2008-04-29 08:17:01 UTC
  • mto: This revision was merged to the branch mainline in revision 476.
  • Revision ID: andrew@puzzling.org-20080429081701-2pu9uteic8o88nre
Simple hack to fix gannotate.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
 
38
38
import bzrlib
39
39
 
40
 
version_info = (0, 95, 0, 'dev', 1)
 
40
version_info = (0, 94, 0, 'dev', 0)
41
41
 
42
42
if version_info[3] == 'final':
43
43
    version_string = '%d.%d.%d' % version_info[:3]
193
193
            if revision is not None:
194
194
                if len(revision) == 1:
195
195
                    tree1 = wt
196
 
                    revision_id = revision[0].as_revision_id(tree1.branch)
 
196
                    revision_id = revision[0].in_history(branch).rev_id
197
197
                    tree2 = branch.repository.revision_tree(revision_id)
198
198
                elif len(revision) == 2:
199
 
                    revision_id_0 = revision[0].as_revision_id(branch)
 
199
                    revision_id_0 = revision[0].in_history(branch).rev_id
200
200
                    tree2 = branch.repository.revision_tree(revision_id_0)
201
 
                    revision_id_1 = revision[1].as_revision_id(branch)
 
201
                    revision_id_1 = revision[1].in_history(branch).rev_id
202
202
                    tree1 = branch.repository.revision_tree(revision_id_1)
203
203
            else:
204
204
                tree1 = wt
261
261
            if revision is None:
262
262
                revids.append(br.last_revision())
263
263
            else:
264
 
                revids.append(revision[0].as_revision_id(br))
 
264
                (revno, revid) = revision[0].in_history(br)
 
265
                revids.append(revid)
265
266
        import gtk
266
267
        pp = start_viz_window(br, revids, limit)
267
268
        pp.connect("destroy", lambda w: gtk.main_quit())
311
312
        if revision is not None:
312
313
            if len(revision) != 1:
313
314
                raise BzrCommandError("Only 1 revion may be specified.")
314
 
            revision_id = revision[0].as_revision_id(br)
 
315
            revision_id = revision[0].in_history(br).rev_id
315
316
            tree = br.repository.revision_tree(revision_id)
316
317
        else:
317
318
            revision_id = getattr(tree, 'get_revision_id', lambda: None)()
358
359
            br = wt.branch
359
360
        except NoWorkingTree, e:
360
361
            from dialog import error_dialog
361
 
            error_dialog(_i18n('Directory does not have a working tree'),
362
 
                         _i18n('Operation aborted.'))
 
362
            error_dialog(_('Directory does not have a working tree'),
 
363
                         _('Operation aborted.'))
363
364
            return 1 # should this be retval=3?
364
365
 
365
366
        # It is a good habit to keep things locked for the duration, but it
392
393
        
393
394
        if revision is not None:
394
395
            try:
395
 
                revision_id = revision[0].as_revision_id(wt.branch)
 
396
                revision_id = revision[0].in_history(wt.branch).rev_id
396
397
            except:
397
398
                from bzrlib.errors import BzrError
398
399
                raise BzrError('Revision %r doesn\'t exist' % revision[0].user_spec )
704
705
 
705
706
    def run(self, path):
706
707
        try:
707
 
            from bzrlib.plugins.gtk.diff import (DiffController,
708
 
                                                 MergeDirectiveController)
709
 
            if path == '-':
710
 
                lines = sys.stdin.readlines()
711
 
            else:
712
 
                lines = open(path, 'rb').readlines()
 
708
            from bzrlib.plugins.gtk.diff import (DiffWindow,
 
709
                                                 MergeDirectiveWindow)
 
710
            lines = open(path, 'rb').readlines()
713
711
            lines = [l.replace('\r\n', '\n') for l in lines]
714
712
            try:
715
713
                directive = merge_directive.MergeDirective.from_lines(lines)
716
714
            except errors.NotAMergeDirective:
717
 
                controller = DiffController(path, lines)
 
715
                window = DiffWindow()
 
716
                window.set_diff_text(path, lines)
718
717
            else:
719
 
                controller = MergeDirectiveController(path, directive)
720
 
            window = controller.window
 
718
                window = MergeDirectiveWindow(directive, path)
 
719
                window.set_diff_text(path, directive.patch.splitlines(True))
721
720
            window.show()
722
721
            gtk = self.open_display()
723
722
            window.connect("destroy", gtk.main_quit)
734
733
import gettext
735
734
gettext.install('olive-gtk')
736
735
 
737
 
# Let's create a specialized alias to protect '_' from being erased by other
738
 
# uses of '_' as an anonymous variable (think pdb for one).
739
 
_i18n = gettext.gettext
740
736
 
741
737
class NoDisplayError(BzrCommandError):
742
738
    """gtk could not find a proper display"""