/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: 2008-02-27 05:23:50 UTC
  • Revision ID: aaron@aaronbentley.com-20080227052350-afzn8ielqy12vl22
Better errors, merge directive saving

Show diffs side-by-side

added added

removed removed

Lines of Context:
685
685
    takes_args = ['path']
686
686
 
687
687
    def run(self, path):
688
 
        from bzrlib.plugins.gtk.diff import DiffWindow, MergeDirectiveWindow
689
 
        lines = open(path, 'rb').readlines()
690
688
        try:
691
 
            directive = merge_directive.MergeDirective.from_lines(lines)
692
 
        except errors.NotAMergeDirective:
693
 
            window = DiffWindow()
694
 
            window.set_diff_text(path, lines)
695
 
        else:
696
 
            window = MergeDirectiveWindow(directive)
697
 
            window.set_diff_text(path, directive.patch.splitlines(True))
698
 
        window.show()
699
 
        gtk = self.open_display()
700
 
        window.connect("destroy", gtk.main_quit)
 
689
            from bzrlib.plugins.gtk.diff import (DiffWindow,
 
690
                                                 MergeDirectiveWindow)
 
691
            lines = open(path, 'rb').readlines()
 
692
            lines = [l.replace('\r\n', '\n') for l in lines]
 
693
            try:
 
694
                directive = merge_directive.MergeDirective.from_lines(lines)
 
695
            except errors.NotAMergeDirective:
 
696
                window = DiffWindow()
 
697
                window.set_diff_text(path, lines)
 
698
            else:
 
699
                window = MergeDirectiveWindow(directive, path)
 
700
                window.set_diff_text(path, directive.patch.splitlines(True))
 
701
            window.show()
 
702
            gtk = self.open_display()
 
703
            window.connect("destroy", gtk.main_quit)
 
704
        except Exception, e:
 
705
            from dialog import error_dialog
 
706
            error_dialog('Error', str(e))
 
707
            raise
701
708
        gtk.main()
702
709
 
703
710