~ubuntu-branches/debian/experimental/bzr-git/experimental

« back to all changes in this revision

Viewing changes to errors.py

  • Committer: Package Import Robot
  • Author(s): Jelmer Vernooij
  • Date: 2012-09-07 02:11:31 UTC
  • mfrom: (4.1.27 sid)
  • Revision ID: package-import@ubuntu.com-20120907021131-3wodhoeuphw57tgr
Tags: 0.6.9-2
* Orphan package.
* Add XS-Testsuite header. Closes: #692655

Show diffs side-by-side

added added

removed removed

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