/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 olive/commit.py

  • Committer: Jelmer Vernooij
  • Date: 2007-01-29 23:27:09 UTC
  • Revision ID: jelmer@samba.org-20070129232709-0yygg83sh9is3xvw
Use decorator for catching and showing bzr-gtk errors graphically. Eventually, this should go away and should be handled by the ui factory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
from bzrlib import osutils
30
30
 
31
31
from dialog import error_dialog, question_dialog
 
32
from errors import show_bzr_error
32
33
from guifiles import GLADEFILENAME
33
34
 
34
35
 
465
466
                pass
466
467
            diff.show()
467
468
    
 
469
    @show_bzr_error
468
470
    def _on_commit_clicked(self, button):
469
471
        """ Commit button clicked handler. """
470
472
        textbuffer = self._textview_message.get_buffer()
491
493
        
492
494
        try:
493
495
            self.wt.commit(message,
494
 
                           allow_pointless=False,
495
 
                           strict=self._check_strict.get_active(),
496
 
                           local=local,
497
 
                           specific_files=specific_files)
498
 
        except errors.NotBranchError:
499
 
            error_dialog(_('Directory is not a branch'),
500
 
                         _('You can perform this action only in a branch.'))
501
 
            return
502
 
        except errors.LocalRequiresBoundBranch:
503
 
            error_dialog(_('Directory is not a checkout'),
504
 
                         _('You can perform local commit only on checkouts.'))
505
 
            return
506
 
        except errors.ConflictsInTree:
507
 
            error_dialog(_('Conflicts in tree'),
508
 
                         _('You need to resolve the conflicts before committing.'))
509
 
            return
510
 
        except errors.StrictCommitFailed:
511
 
            error_dialog(_('Strict commit failed'),
512
 
                         _('There are unknown files in the working tree.\nPlease add or delete them.'))
513
 
            return
514
 
        except errors.BoundBranchOutOfDate, errmsg:
515
 
            error_dialog(_('Bound branch is out of date'),
516
 
                         _('%s') % errmsg)
517
 
            return
 
496
                       allow_pointless=False,
 
497
                       strict=self._check_strict.get_active(),
 
498
                       local=local,
 
499
                       specific_files=specific_files)
518
500
        except errors.PointlessCommit:
519
501
            response = question_dialog(_('Commit with no changes?'),
520
502
                                       _('There are no changes in the working tree.'))
521
503
            if response == gtk.RESPONSE_YES:
522
 
                # Try to commit again
523
 
                try:
524
 
                    self.wt.commit(message,
525
 
                                   allow_pointless=True,
526
 
                                   strict=self._check_strict.get_active(),
527
 
                                   local=local,
528
 
                                   specific_files=specific_files)
529
 
                except errors.BzrError, msg:
530
 
                    error_dialog(_('Unknown bzr error'), str(msg))
531
 
                    return
532
 
                except Exception, msg:
533
 
                    error_dialog(_('Unknown error'), str(msg))
534
 
                    return
535
 
        except errors.BzrError, msg:
536
 
            error_dialog(_('Unknown bzr error'), str(msg))
537
 
            return
538
 
        except Exception, msg:
539
 
            error_dialog(_('Unknown error'), str(msg))
540
 
            return
541
 
        
 
504
                self.wt.commit(message,
 
505
                               allow_pointless=True,
 
506
                               strict=self._check_strict.get_active(),
 
507
                               local=local,
 
508
                               specific_files=specific_files)
542
509
        self.response(gtk.RESPONSE_OK)
543
510
 
544
511
    def _pending_merges(self, wt):