14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18
"""A grouping of Exceptions for bzr-git"""
20
from __future__ import absolute_import
19
22
from dulwich import errors as git_errors
24
from dulwich.errors import NotCommitError
21
26
from bzrlib import errors as bzr_errors
23
29
class BzrGitError(bzr_errors.BzrError):
24
30
"""The base-level exception for bzr-git errors."""
27
class GitCommandError(BzrGitError):
28
"""Raised when spawning 'git' does not return normally."""
30
_fmt = 'Command failed (%(returncode)s): command %(command)s\n%(stderr)s'
32
def __init__(self, command, returncode, stderr):
33
self.command = command
34
self.returncode = returncode
38
33
class NoSuchRef(BzrGitError):
39
"""Raised when a ref can not be found."""
41
_fmt = "The ref %(ref)s was not found."
43
def __init__(self, ref, present_refs=None):
34
"""Raised when a ref can not be found."""
36
_fmt = "The ref %(ref)s was not found in the repository at %(location)s."
38
def __init__(self, ref, location, present_refs=None):
40
self.location = location
45
41
self.present_refs = present_refs
57
53
_fmt = "Push is not yet supported for bzr-git. Try dpush instead."
60
class GitSmartRemoteNotSupported(bzr_errors.BzrError):
56
class GitSmartRemoteNotSupported(bzr_errors.UnsupportedOperation):
61
57
_fmt = "This operation is not supported by the Git smart server protocol."
60
class UnknownCommitExtra(bzr_errors.BzrError):
61
_fmt = "Unknown extra fields in %(object)r: %(fields)r."
63
def __init__(self, object, fields):
64
bzr_errors.BzrError.__init__(self)