/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Vincent Ladeuil
  • Date: 2008-10-02 13:25:47 UTC
  • mfrom: (3759 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3760.
  • Revision ID: v.ladeuil+lp@free.fr-20081002132547-txs4fs006e9p0gt1
merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
        parameters.
82
82
 
83
83
        :param msg: If given, this is the literal complete text for the error,
84
 
        not subject to expansion.
 
84
           not subject to expansion. 'msg' is used instead of 'message' because
 
85
           python evolved and, in 2.6, forbids the use of 'message'.
85
86
        """
86
87
        StandardError.__init__(self)
87
88
        if msg is not None:
102
103
            fmt = self._get_format_string()
103
104
            if fmt:
104
105
                d = dict(self.__dict__)
105
 
                # special case: python2.5 puts the 'message' attribute in a
106
 
                # slot, so it isn't seen in __dict__
107
 
                d['message'] = getattr(self, 'message', 'no message')
108
106
                s = fmt % d
109
107
                # __str__() should always return a 'str' object
110
108
                # never a 'unicode' object.
126
124
            # return a unicode object.
127
125
            u = unicode(u)
128
126
        return u
129
 
    
 
127
 
130
128
    def __str__(self):
131
129
        s = self._format()
132
130
        if isinstance(s, unicode):
204
202
 
205
203
 
206
204
class AlreadyBuilding(BzrError):
207
 
    
 
205
 
208
206
    _fmt = "The tree builder is already building a tree."
209
207
 
210
208
 
216
214
 
217
215
 
218
216
class BzrCheckError(InternalBzrError):
219
 
    
220
 
    _fmt = "Internal check failed: %(message)s"
221
 
 
222
 
    def __init__(self, message):
 
217
 
 
218
    _fmt = "Internal check failed: %(msg)s"
 
219
 
 
220
    def __init__(self, msg):
223
221
        BzrError.__init__(self)
224
 
        self.message = message
 
222
        self.msg = msg
225
223
 
226
224
 
227
225
class DirstateCorrupt(BzrError):
1310
1308
 
1311
1309
class WeaveError(BzrError):
1312
1310
 
1313
 
    _fmt = "Error in processing weave: %(message)s"
 
1311
    _fmt = "Error in processing weave: %(msg)s"
1314
1312
 
1315
 
    def __init__(self, message=None):
 
1313
    def __init__(self, msg=None):
1316
1314
        BzrError.__init__(self)
1317
 
        self.message = message
 
1315
        self.msg = msg
1318
1316
 
1319
1317
 
1320
1318
class WeaveRevisionAlreadyPresent(WeaveError):
1673
1671
        if filename is None:
1674
1672
            filename = ""
1675
1673
        message = "Error(s) parsing config file %s:\n%s" % \
1676
 
            (filename, ('\n'.join(e.message for e in errors)))
 
1674
            (filename, ('\n'.join(e.msg for e in errors)))
1677
1675
        BzrError.__init__(self, message)
1678
1676
 
1679
1677
 
1864
1862
    _fmt = "Could not move %(from_path)s%(operator)s %(to_path)s%(extra)s"
1865
1863
 
1866
1864
    def __init__(self, from_path='', to_path='', extra=None):
 
1865
        from bzrlib.osutils import splitpath
1867
1866
        BzrError.__init__(self)
1868
1867
        if extra:
1869
1868
            self.extra = ': ' + str(extra)
1873
1872
        has_from = len(from_path) > 0
1874
1873
        has_to = len(to_path) > 0
1875
1874
        if has_from:
1876
 
            self.from_path = osutils.splitpath(from_path)[-1]
 
1875
            self.from_path = splitpath(from_path)[-1]
1877
1876
        else:
1878
1877
            self.from_path = ''
1879
1878
 
1880
1879
        if has_to:
1881
 
            self.to_path = osutils.splitpath(to_path)[-1]
 
1880
            self.to_path = splitpath(to_path)[-1]
1882
1881
        else:
1883
1882
            self.to_path = ''
1884
1883
 
2809
2808
            'user encoding %(user_encoding)s')
2810
2809
 
2811
2810
    def __init__(self, path, kind):
 
2811
        from bzrlib.osutils import get_user_encoding
2812
2812
        self.path = path
2813
2813
        self.kind = kind
2814
2814
        self.user_encoding = osutils.get_user_encoding()