~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Gordon Tyler
  • Date: 2011-01-21 23:51:15 UTC
  • mto: This revision was merged to the branch mainline in revision 5632.
  • Revision ID: gordon@doxxx.net-20110121235115-9sdqamejot1h0481
Replace usage of format function from python 2.6 with our own very simple formatting function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1140
1140
        BzrError.__init__(self, files=files, files_str=files_str)
1141
1141
 
1142
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
 
 
1152
1143
class BadCommitMessageEncoding(BzrError):
1153
1144
 
1154
1145
    _fmt = 'The specified commit message contains characters unsupported by '\
1969
1960
 
1970
1961
class BzrMoveFailedError(BzrError):
1971
1962
 
1972
 
    _fmt = ("Could not move %(from_path)s%(operator)s %(to_path)s"
1973
 
        "%(_has_extra)s%(extra)s")
 
1963
    _fmt = "Could not move %(from_path)s%(operator)s %(to_path)s%(extra)s"
1974
1964
 
1975
1965
    def __init__(self, from_path='', to_path='', extra=None):
1976
1966
        from bzrlib.osutils import splitpath
1977
1967
        BzrError.__init__(self)
1978
1968
        if extra:
1979
 
            self.extra, self._has_extra = extra, ': '
 
1969
            self.extra = ': ' + str(extra)
1980
1970
        else:
1981
 
            self.extra = self._has_extra = ''
 
1971
            self.extra = ''
1982
1972
 
1983
1973
        has_from = len(from_path) > 0
1984
1974
        has_to = len(to_path) > 0
2005
1995
 
2006
1996
class BzrRenameFailedError(BzrMoveFailedError):
2007
1997
 
2008
 
    _fmt = ("Could not rename %(from_path)s%(operator)s %(to_path)s"
2009
 
        "%(_has_extra)s%(extra)s")
 
1998
    _fmt = "Could not rename %(from_path)s%(operator)s %(to_path)s%(extra)s"
2010
1999
 
2011
2000
    def __init__(self, from_path, to_path, extra=None):
2012
2001
        BzrMoveFailedError.__init__(self, from_path, to_path, extra)
2013
2002
 
2014
 
 
2015
2003
class BzrRemoveChangedFilesError(BzrError):
2016
2004
    """Used when user is trying to remove changed files."""
2017
2005
 
3230
3218
    def __init__(self, branch_url):
3231
3219
        self.branch_url = branch_url
3232
3220
 
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