/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: Patch Queue Manager
  • Date: 2011-11-24 17:25:41 UTC
  • mfrom: (6289.2.1 move-patches-errors)
  • Revision ID: pqm@pqm.ubuntu.com-20111124172541-3y61o9wf6onqh84q
(jelmer) Move patches exceptions to bzrlib.errors. (Jelmer Vernooij)

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
3368
3361
        self.from_kind = from_kind
3369
3362
        self.to_kind = to_kind
3370
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')