18
18
"""A grouping of Exceptions for bzr-git"""
20
from __future__ import absolute_import
22
21
from dulwich import errors as git_errors
24
from ... import errors as bzr_errors
23
from bzrlib import errors as bzr_errors
27
26
class BzrGitError(bzr_errors.BzrError):
28
27
"""The base-level exception for bzr-git errors."""
30
class GitCommandError(BzrGitError):
31
"""Raised when spawning 'git' does not return normally."""
33
_fmt = 'Command failed (%(returncode)s): command %(command)s\n%(stderr)s'
35
def __init__(self, command, returncode, stderr):
36
self.command = command
37
self.returncode = returncode
31
41
class NoSuchRef(BzrGitError):
32
"""Raised when a ref can not be found."""
34
_fmt = "The ref %(ref)s was not found in the repository at %(location)s."
36
def __init__(self, ref, location, present_refs=None):
42
"""Raised when a ref can not be found."""
44
_fmt = "The ref %(ref)s was not found."
46
def __init__(self, ref, present_refs=None):
38
self.location = location
39
48
self.present_refs = present_refs
51
60
_fmt = "Push is not yet supported for bzr-git. Try dpush instead."
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."
58
class UnknownCommitExtra(bzr_errors.BzrError):
59
_fmt = "Unknown extra fields in %(object)r: %(fields)r."
61
def __init__(self, object, fields):
62
bzr_errors.BzrError.__init__(self)
64
self.fields = ",".join(fields)
67
class UnknownMercurialCommitExtra(bzr_errors.BzrError):
68
_fmt = "Unknown mercurial extra fields in %(object)r: %(fields)r."
70
def __init__(self, object, fields):
71
bzr_errors.BzrError.__init__(self)
73
self.fields = ",".join(fields)