~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: John Arbash Meinel
  • Date: 2011-04-07 10:36:24 UTC
  • mfrom: (5764 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5766.
  • Revision ID: john@arbash-meinel.com-20110407103624-n76g6tjeqmznwdcd
Merge bzr.dev 5764 to resolve release-notes (aka NEWS) conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
713
713
       self.bzrdir = bzrdir
714
714
       PathError.__init__(self, path=path)
715
715
 
 
716
    def __repr__(self):
 
717
        return '<%s %r>' % (self.__class__.__name__, self.__dict__)
 
718
 
716
719
    def _format(self):
717
720
        # XXX: Ideally self.detail would be a property, but Exceptions in
718
721
        # Python 2.4 have to be old-style classes so properties don't work.
1137
1140
        BzrError.__init__(self, files=files, files_str=files_str)
1138
1141
 
1139
1142
 
 
1143
class ExcludesUnsupported(BzrError):
 
1144
 
 
1145
    _fmt = ('Excluding paths during commit is not supported by '
 
1146
            'repository at %(repository)r.')
 
1147
 
 
1148
    def __init__(self, repository):
 
1149
        BzrError.__init__(self, repository=repository)
 
1150
 
 
1151
 
1140
1152
class BadCommitMessageEncoding(BzrError):
1141
1153
 
1142
1154
    _fmt = 'The specified commit message contains characters unsupported by '\
1957
1969
 
1958
1970
class BzrMoveFailedError(BzrError):
1959
1971
 
1960
 
    _fmt = "Could not move %(from_path)s%(operator)s %(to_path)s%(extra)s"
 
1972
    _fmt = ("Could not move %(from_path)s%(operator)s %(to_path)s"
 
1973
        "%(_has_extra)s%(extra)s")
1961
1974
 
1962
1975
    def __init__(self, from_path='', to_path='', extra=None):
1963
1976
        from bzrlib.osutils import splitpath
1964
1977
        BzrError.__init__(self)
1965
1978
        if extra:
1966
 
            self.extra = ': ' + str(extra)
 
1979
            self.extra, self._has_extra = extra, ': '
1967
1980
        else:
1968
 
            self.extra = ''
 
1981
            self.extra = self._has_extra = ''
1969
1982
 
1970
1983
        has_from = len(from_path) > 0
1971
1984
        has_to = len(to_path) > 0
1992
2005
 
1993
2006
class BzrRenameFailedError(BzrMoveFailedError):
1994
2007
 
1995
 
    _fmt = "Could not rename %(from_path)s%(operator)s %(to_path)s%(extra)s"
 
2008
    _fmt = ("Could not rename %(from_path)s%(operator)s %(to_path)s"
 
2009
        "%(_has_extra)s%(extra)s")
1996
2010
 
1997
2011
    def __init__(self, from_path, to_path, extra=None):
1998
2012
        BzrMoveFailedError.__init__(self, from_path, to_path, extra)
1999
2013
 
 
2014
 
2000
2015
class BzrRemoveChangedFilesError(BzrError):
2001
2016
    """Used when user is trying to remove changed files."""
2002
2017
 
2020
2035
 
2021
2036
class BzrBadParameterMissing(BzrBadParameter):
2022
2037
 
2023
 
    _fmt = "Parameter $(param)s is required but not present."
 
2038
    _fmt = "Parameter %(param)s is required but not present."
2024
2039
 
2025
2040
 
2026
2041
class BzrBadParameterUnicode(BzrBadParameter):
3215
3230
    def __init__(self, branch_url):
3216
3231
        self.branch_url = branch_url
3217
3232
 
 
3233
 
 
3234
# FIXME: I would prefer to define the config related exception classes in
 
3235
# config.py but the lazy import mechanism proscribes this -- vila 20101222
 
3236
class OptionExpansionLoop(BzrError):
 
3237
 
 
3238
    _fmt = 'Loop involving %(refs)r while expanding "%(string)s".'
 
3239
 
 
3240
    def __init__(self, string, refs):
 
3241
        self.string = string
 
3242
        self.refs = '->'.join(refs)
 
3243
 
 
3244
 
 
3245
class ExpandingUnknownOption(BzrError):
 
3246
 
 
3247
    _fmt = 'Option %(name)s is not defined while expanding "%(string)s".'
 
3248
 
 
3249
    def __init__(self, name, string):
 
3250
        self.name = name
 
3251
        self.string = string