/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 errors.py

Fix typo in git-svn-id parser, return revnum as integer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""A grouping of Exceptions for bzr-git"""
19
19
 
20
 
from __future__ import absolute_import
21
20
 
22
21
from dulwich import errors as git_errors
23
22
 
24
 
from ... import errors as bzr_errors
 
23
from bzrlib import errors as bzr_errors
25
24
 
26
25
 
27
26
class BzrGitError(bzr_errors.BzrError):
28
27
    """The base-level exception for bzr-git errors."""
29
28
 
30
29
 
 
30
class GitCommandError(BzrGitError):
 
31
    """Raised when spawning 'git' does not return normally."""
 
32
 
 
33
    _fmt = 'Command failed (%(returncode)s): command %(command)s\n%(stderr)s'
 
34
 
 
35
    def __init__(self, command, returncode, stderr):
 
36
        self.command = command
 
37
        self.returncode = returncode
 
38
        self.stderr = stderr
 
39
 
 
40
 
31
41
class NoSuchRef(BzrGitError):
32
 
    """Raised when a ref can not be found."""
33
 
 
34
 
    _fmt = "The ref %(ref)s was not found in the repository at %(location)s."
35
 
 
36
 
    def __init__(self, ref, location, present_refs=None):
 
42
    """Raised when a ref can not be found.""" 
 
43
 
 
44
    _fmt = "The ref %(ref)s was not found."
 
45
    
 
46
    def __init__(self, ref, present_refs=None):
37
47
        self.ref = ref
38
 
        self.location = location
39
48
        self.present_refs = present_refs
40
49
 
41
50
 
51
60
    _fmt = "Push is not yet supported for bzr-git. Try dpush instead."
52
61
 
53
62
 
54
 
class GitSmartRemoteNotSupported(bzr_errors.UnsupportedOperation):
 
63
class GitSmartRemoteNotSupported(bzr_errors.BzrError):
55
64
    _fmt = "This operation is not supported by the Git smart server protocol."
56
 
 
57
 
 
58
 
class UnknownCommitExtra(bzr_errors.BzrError):
59
 
    _fmt = "Unknown extra fields in %(object)r: %(fields)r."
60
 
 
61
 
    def __init__(self, object, fields):
62
 
        bzr_errors.BzrError.__init__(self)
63
 
        self.object = object
64
 
        self.fields = ",".join(fields)
65
 
 
66
 
 
67
 
class UnknownMercurialCommitExtra(bzr_errors.BzrError):
68
 
    _fmt = "Unknown mercurial extra fields in %(object)r: %(fields)r."
69
 
 
70
 
    def __init__(self, object, fields):
71
 
        bzr_errors.BzrError.__init__(self)
72
 
        self.object = object
73
 
        self.fields = ",".join(fields)