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

  • Committer: Szilveszter Farkas (Phanatic)
  • Date: 2007-01-30 16:05:15 UTC
  • mto: (157.1.2 trunk) (170.1.3 trunk)
  • mto: This revision was merged to the branch mainline in revision 138.
  • Revision ID: szilveszter.farkas@gmail.com-20070130160515-1mh5hm2ppdmuq6l1
Added revert functionality to the context menu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
import bzrlib.errors as errors
18
 
from bzrlib.plugins.gtk import _i18n
 
18
 
19
19
from dialog import error_dialog
20
20
 
21
 
 
22
21
def show_bzr_error(unbound):
23
22
    """Decorator that shows bazaar exceptions. """
24
23
    def convert(*args, **kwargs):
25
24
        try:
26
25
            unbound(*args, **kwargs)
27
26
        except errors.NotBranchError:
28
 
            error_dialog(_i18n('Directory is not a branch'),
29
 
                         _i18n('You can perform this action only in a branch.'))
 
27
            error_dialog(_('Directory is not a branch'),
 
28
                         _('You can perform this action only in a branch.'))
30
29
        except errors.LocalRequiresBoundBranch:
31
 
            error_dialog(_i18n('Directory is not a checkout'),
32
 
                         _i18n('You can perform local commit only on checkouts.'))
 
30
            error_dialog(_('Directory is not a checkout'),
 
31
                         _('You can perform local commit only on checkouts.'))
33
32
        except errors.PointlessCommit:
34
 
            error_dialog(_i18n('No changes to commit'),
35
 
                         _i18n('Try force commit if you want to commit anyway.'))
 
33
            error_dialog(_('No changes to commit'),
 
34
                         _('Try force commit if you want to commit anyway.'))
36
35
        except errors.ConflictsInTree:
37
 
            error_dialog(_i18n('Conflicts in tree'),
38
 
                         _i18n('You need to resolve the conflicts before committing.'))
 
36
            error_dialog(_('Conflicts in tree'),
 
37
                         _('You need to resolve the conflicts before committing.'))
39
38
        except errors.StrictCommitFailed:
40
 
            error_dialog(_i18n('Strict commit failed'),
41
 
                         _i18n('There are unknown files in the working tree.\nPlease add or delete them.'))
 
39
            error_dialog(_('Strict commit failed'),
 
40
                         _('There are unknown files in the working tree.\nPlease add or delete them.'))
42
41
        except errors.BoundBranchOutOfDate, errmsg:
43
 
            error_dialog(_i18n('Bound branch is out of date'),
44
 
                         # FIXME: Really ? Internationalizing %s ?? --vila080505
45
 
                         _i18n('%s') % errmsg)
 
42
            error_dialog(_('Bound branch is out of date'),
 
43
                         _('%s') % errmsg)
46
44
        except errors.NotVersionedError:
47
 
            error_dialog(_i18n('File not versioned'),
48
 
                         _i18n('The selected file is not versioned.'))
 
45
            error_dialog(_('File not versioned'),
 
46
                         _('The selected file is not versioned.'))
49
47
        except errors.DivergedBranches:
50
 
            error_dialog(_i18n('Branches have been diverged'),
51
 
                         _i18n('You cannot push if branches have diverged. Use the\noverwrite option if you want to push anyway.'))
 
48
            error_dialog(_('Branches have been diverged'),
 
49
                         _('You cannot push if branches have diverged. Use the\noverwrite option if you want to push anyway.'))
52
50
        except errors.NoSuchFile:
53
 
            error_dialog(_i18n("No diff output"),
54
 
                         _i18n("The selected file hasn't changed."))
55
 
        except errors.NoSuchRevision:
56
 
                error_dialog(_i18n('No such revision'),
57
 
                             _i18n("The revision you specified doesn't exist."))
58
 
        except errors.FileExists:
59
 
                error_dialog(_i18n('Target already exists'),
60
 
                             _i18n("Target directory already exists. Please select another target."))
 
51
            error_dialog(_("No diff output"),
 
52
                         _("The selected file hasn't changed."))
61
53
        except errors.AlreadyBranchError, errmsg:
62
 
            error_dialog(_i18n('Directory is already a branch'),
63
 
                         _i18n('The current directory (%s) is already a branch.\nYou can start using it, or initialize another directory.') % errmsg)
 
54
            error_dialog(_('Directory is already a branch'),
 
55
                         _('The current directory (%s) is already a branch.\nYou can start using it, or initialize another directory.') % errmsg)
64
56
        except errors.BranchExistsWithoutWorkingTree, errmsg:
65
 
            error_dialog(_i18n('Branch without a working tree'),
66
 
                         _i18n('The current directory (%s)\nis a branch without a working tree.') % errmsg)
 
57
            error_dialog(_('Branch without a working tree'),
 
58
                         _('The current directory (%s)\nis a branch without a working tree.') % errmsg)
67
59
        except errors.BzrError, msg:
68
 
            error_dialog(_i18n('Unknown bzr error'), str(msg))
 
60
            error_dialog(_('Unknown bzr error'), str(msg))
69
61
        except errors.PermissionDenied:
70
 
            error_dialog(_i18n("Permission denied"), _i18n("permission denied."))
 
62
            error_dialog(_("Permission denied"), _("permission denied."))
71
63
        except Exception, msg:
72
 
            error_dialog(_i18n('Unknown error'), str(msg))
 
64
            error_dialog(_('Unknown error'), str(msg))
73
65
 
74
66
    convert.__doc__ = unbound.__doc__
75
67
    convert.__name__ = unbound.__name__