/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: Jelmer Vernooij
  • Date: 2011-11-25 17:54:52 UTC
  • mfrom: (6303 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6321.
  • Revision ID: jelmer@samba.org-20111125175452-v0uwwxqcp97tzuzv
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    trace,
25
25
    )
26
26
from bzrlib.i18n import gettext
27
 
from bzrlib.patches import (
28
 
    MalformedHunkHeader,
29
 
    MalformedLine,
30
 
    MalformedPatchHeader,
31
 
    PatchConflict,
32
 
    PatchSyntax,
33
 
    )
34
27
 
35
28
 
36
29
# TODO: is there any value in providing the .args field used by standard
1579
1572
            problem we can raise the original error (value from sys.exc_info())
1580
1573
        """
1581
1574
        BzrError.__init__(self)
 
1575
        self.context = context
1582
1576
        self.reload_occurred = reload_occurred
1583
1577
        self.exc_info = exc_info
1584
1578
        self.orig_error = exc_info[1]
1666
1660
 
1667
1661
    def __init__(self, exc_info):
1668
1662
        import traceback
 
1663
        # GZ 2010-08-10: Cycle with exc_tb/exc_info affects at least one test
1669
1664
        self.exc_type, self.exc_value, self.exc_tb = exc_info
1670
1665
        self.exc_info = exc_info
1671
1666
        traceback_strings = traceback.format_exception(
1984
1979
        self.prefix = prefix
1985
1980
 
1986
1981
 
1987
 
class MalformedTransform(BzrError):
 
1982
class MalformedTransform(InternalBzrError):
1988
1983
 
1989
1984
    _fmt = "Tree transform is malformed %(conflicts)r"
1990
1985
 
3354
3349
    def __init__(self, method, arguments):
3355
3350
        self.method = method
3356
3351
        self.arguments = arguments
 
3352
 
 
3353
 
 
3354
class UnsupportedKindChange(BzrError):
 
3355
 
 
3356
    _fmt = ("Kind change from %(from_kind)s to %(to_kind)s for "
 
3357
            "%(path)s not supported by format %(format)r")
 
3358
 
 
3359
    def __init__(self, path, from_kind, to_kind, format):
 
3360
        self.path = path
 
3361
        self.from_kind = from_kind
 
3362
        self.to_kind = to_kind
 
3363
        self.format = format
 
3364
 
 
3365
 
 
3366
class PatchSyntax(BzrError):
 
3367
    """Base class for patch syntax errors."""
 
3368
 
 
3369
 
 
3370
class BinaryFiles(BzrError):
 
3371
 
 
3372
    _fmt = 'Binary files section encountered.'
 
3373
 
 
3374
    def __init__(self, orig_name, mod_name):
 
3375
        self.orig_name = orig_name
 
3376
        self.mod_name = mod_name
 
3377
 
 
3378
 
 
3379
class MalformedPatchHeader(PatchSyntax):
 
3380
 
 
3381
    _fmt = "Malformed patch header.  %(desc)s\n%(line)r"
 
3382
 
 
3383
    def __init__(self, desc, line):
 
3384
        self.desc = desc
 
3385
        self.line = line
 
3386
 
 
3387
 
 
3388
class MalformedHunkHeader(PatchSyntax):
 
3389
 
 
3390
    _fmt = "Malformed hunk header.  %(desc)s\n%(line)r"
 
3391
 
 
3392
    def __init__(self, desc, line):
 
3393
        self.desc = desc
 
3394
        self.line = line
 
3395
 
 
3396
 
 
3397
class MalformedLine(PatchSyntax):
 
3398
 
 
3399
    _fmt = "Malformed line.  %(desc)s\n%(line)r"
 
3400
 
 
3401
    def __init__(self, desc, line):
 
3402
        self.desc = desc
 
3403
        self.line = line
 
3404
 
 
3405
 
 
3406
class PatchConflict(BzrError):
 
3407
 
 
3408
    _fmt = ('Text contents mismatch at line %(line_no)d.  Original has '
 
3409
            '"%(orig_line)s", but patch says it should be "%(patch_line)s"')
 
3410
 
 
3411
    def __init__(self, line_no, orig_line, patch_line):
 
3412
        self.line_no = line_no
 
3413
        self.orig_line = orig_line.rstrip('\n')
 
3414
        self.patch_line = patch_line.rstrip('\n')