/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

Upgraded to the latest bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
175
175
        self.message = message
176
176
 
177
177
 
 
178
class DisabledMethod(BzrError):
 
179
 
 
180
    _fmt = "The smart server method '%(class_name)s' is disabled."
 
181
 
 
182
    internal_error = True
 
183
 
 
184
    def __init__(self, class_name):
 
185
        BzrError.__init__(self)
 
186
        self.class_name = class_name
 
187
 
 
188
 
178
189
class InvalidEntryName(BzrError):
179
190
    
180
191
    _fmt = "Invalid entry name: %(name)s"
550
561
        self.bzrdir = bzrdir_format
551
562
 
552
563
 
 
564
class IncompatibleRepositories(BzrError):
 
565
 
 
566
    _fmt = "Repository %(target)s is not compatible with repository"\
 
567
        " %(source)s"
 
568
 
 
569
    def __init__(self, source, target):
 
570
        BzrError.__init__(self, target=target, source=source)
 
571
 
 
572
 
553
573
class IncompatibleRevision(BzrError):
554
574
    
555
575
    _fmt = "Revision is not compatible with %(repo_format)s"
789
809
        self.lock = lock
790
810
 
791
811
 
 
812
class TokenLockingNotSupported(LockError):
 
813
 
 
814
    _fmt = "The object %(obj)s does not support token specifying a token when locking."
 
815
 
 
816
    internal_error = True
 
817
 
 
818
    def __init__(self, obj):
 
819
        self.obj = obj
 
820
 
 
821
 
 
822
class TokenMismatch(LockBroken):
 
823
 
 
824
    _fmt = "The lock token %(given_token)r does not match lock token %(lock_token)r."
 
825
 
 
826
    internal_error = True
 
827
 
 
828
    def __init__(self, given_token, lock_token):
 
829
        self.given_token = given_token
 
830
        self.lock_token = lock_token
 
831
 
 
832
 
792
833
class PointlessCommit(BzrError):
793
834
 
794
835
    _fmt = "No changes to commit"
1196
1237
 
1197
1238
    _fmt = ("The medium '%(medium)s' has reached its concurrent request limit."
1198
1239
            " Be sure to finish_writing and finish_reading on the"
1199
 
            " current request that is open.")
 
1240
            " currently open request.")
1200
1241
 
1201
1242
    internal_error = True
1202
1243
 
1285
1326
        InvalidHttpResponse.__init__(self, path, msg)
1286
1327
 
1287
1328
 
 
1329
class RedirectRequested(TransportError):
 
1330
 
 
1331
    _fmt = '%(source)s is%(permanently)s redirected to %(target)s'
 
1332
 
 
1333
    def __init__(self, source, target, is_permament=False, qual_proto=None):
 
1334
        self.source = source
 
1335
        self.target = target
 
1336
        if is_permament:
 
1337
            self.permanently = ' permanently'
 
1338
        else:
 
1339
            self.permanently = ''
 
1340
        self.is_permament = is_permament
 
1341
        self._qualified_proto = qual_proto
 
1342
        TransportError.__init__(self)
 
1343
 
 
1344
    def _requalify_url(self, url):
 
1345
        """Restore the qualified proto in front of the url"""
 
1346
        # When this exception is raised, source and target are in
 
1347
        # user readable format. But some transports may use a
 
1348
        # different proto (http+urllib:// will present http:// to
 
1349
        # the user. If a qualified proto is specified, the code
 
1350
        # trapping the exception can get the qualified urls to
 
1351
        # properly handle the redirection themself (creating a
 
1352
        # new transport object from the target url for example).
 
1353
        # But checking that the scheme of the original and
 
1354
        # redirected urls are the same can be tricky. (see the
 
1355
        # FIXME in BzrDir.open_from_transport for the unique use
 
1356
        # case so far).
 
1357
        if self._qualified_proto is None:
 
1358
            return url
 
1359
 
 
1360
        # The TODO related to NotBranchError mention that doing
 
1361
        # that kind of manipulation on the urls may not be the
 
1362
        # exception object job. On the other hand, this object is
 
1363
        # the interface between the code and the user so
 
1364
        # presenting the urls in different ways is indeed its
 
1365
        # job...
 
1366
        import urlparse
 
1367
        proto, netloc, path, query, fragment = urlparse.urlsplit(url)
 
1368
        return urlparse.urlunsplit((self._qualified_proto, netloc, path,
 
1369
                                   query, fragment))
 
1370
 
 
1371
    def get_source_url(self):
 
1372
        return self._requalify_url(self.source)
 
1373
 
 
1374
    def get_target_url(self):
 
1375
        return self._requalify_url(self.target)
 
1376
 
 
1377
 
 
1378
class TooManyRedirections(TransportError):
 
1379
 
 
1380
    _fmt = "Too many redirections"
 
1381
 
1288
1382
class ConflictsInTree(BzrError):
1289
1383
 
1290
1384
    _fmt = "Working tree has conflicts."
1961
2055
class TagsNotSupported(BzrError):
1962
2056
 
1963
2057
    _fmt = ("Tags not supported by %(branch)s;"
1964
 
            " you may be able to use bzr upgrade.")
 
2058
            " you may be able to use bzr upgrade --dirstate-tags.")
1965
2059
 
1966
2060
    def __init__(self, branch):
1967
2061
        self.branch = branch
1973
2067
 
1974
2068
    def __init__(self, tag_name):
1975
2069
        self.tag_name = tag_name
 
2070
 
 
2071
 
 
2072
class UnexpectedSmartServerResponse(BzrError):
 
2073
 
 
2074
    _fmt = "Could not understand response from smart server: %(response_tuple)r"
 
2075
 
 
2076
    def __init__(self, response_tuple):
 
2077
        self.response_tuple = response_tuple
 
2078