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

  • Committer: Jelmer Vernooij
  • Date: 2008-12-08 23:24:15 UTC
  • mto: (0.215.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20081208232415-odeovndmt9vvsfik
remove silly build-inplace target.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# errors.py -- errors for dulwich
2
 
# Copyright (C) 2007 James Westby <jw+debian@jameswestby.net>
3
 
4
 
# This program is free software; you can redistribute it and/or
5
 
# modify it under the terms of the GNU General Public License
6
 
# as published by the Free Software Foundation; version 2
7
 
# of the License.
8
 
9
 
# This program is distributed in the hope that it will be useful,
10
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
# GNU General Public License for more details.
13
 
14
 
# You should have received a copy of the GNU General Public License
15
 
# along with this program; if not, write to the Free Software
16
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17
 
# MA  02110-1301, USA.
18
 
 
19
 
class WrongObjectException(Exception):
20
 
  """Baseclass for all the _ is not a _ exceptions on objects.
21
 
 
22
 
  Do not instantiate directly.
23
 
 
24
 
  Subclasses should define a _type attribute that indicates what
25
 
  was expected if they were raised.
26
 
  """
27
 
 
28
 
  def __init__(self, sha, *args, **kwargs):
29
 
    string = "%s is not a %s" % (sha, self._type)
30
 
    Exception.__init__(self, string)
31
 
 
32
 
class NotCommitError(WrongObjectException):
33
 
  """Indicates that the sha requested does not point to a commit."""
34
 
 
35
 
  _type = 'commit'
36
 
 
37
 
class NotTreeError(WrongObjectException):
38
 
  """Indicates that the sha requested does not point to a tree."""
39
 
 
40
 
  _type = 'tree'
41
 
 
42
 
class NotBlobError(WrongObjectException):
43
 
  """Indicates that the sha requested does not point to a blob."""
44
 
 
45
 
  _type = 'blob'
46
 
 
47
 
class MissingCommitError(Exception):
48
 
  """Indicates that a commit was not found in the repository"""
49
 
 
50
 
  def __init__(self, sha, *args, **kwargs):
51
 
    Exception.__init__(self, "%s is not in the revision store" % sha)
52
 
 
53
 
 
54
 
class ObjectMissing(Exception):
55
 
  """Indicates that a requested object is missing."""
56
 
 
57
 
  def __init__(self, sha, *args, **kwargs):
58
 
    Exception.__init__(self, "%s is not in the pack" % sha)
59
 
 
60
 
 
61
 
class ApplyDeltaError(Exception):
62
 
    """Indicates that applying a delta failed."""
63
 
    
64
 
    def __init__(self, *args, **kwargs):
65
 
        Exception.__init__(self, *args, **kwargs)
66
 
 
67
 
 
68
 
class NotGitRepository(Exception):
69
 
    """Indicates that no Git repository was found."""
70
 
 
71
 
    def __init__(self, *args, **kwargs):
72
 
        Exception.__init__(self, *args, **kwargs)
73
 
 
74
 
 
75
 
class GitProtocolError(Exception):
76
 
    """Git protocol exception."""
77
 
    
78
 
    def __init__(self, *args, **kwargs):
79
 
        Exception.__init__(self, *args, **kwargs)
80
 
 
81
 
 
82
 
class HangupException(GitProtocolError):
83
 
    """Hangup exception."""