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

  • Committer: Jelmer Vernooij
  • Date: 2007-07-15 15:22:29 UTC
  • Revision ID: jelmer@samba.org-20070715152229-clmlen0vpd8d2pzx
Add docstrings, remove unused code.

Show diffs side-by-side

added added

removed removed

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