/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

Share more infrastructure between LocalGitDir and RemoteGitDir.

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
 
 
18
17
"""A grouping of Exceptions for bzr-git"""
19
18
 
20
 
 
21
 
from dulwich import errors as git_errors
22
 
 
23
19
from bzrlib import errors as bzr_errors
24
20
 
25
21
 
36
32
        self.command = command
37
33
        self.returncode = returncode
38
34
        self.stderr = stderr
39
 
 
40
 
 
41
 
class NoSuchRef(BzrGitError):
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):
47
 
        self.ref = ref
48
 
        self.present_refs = present_refs
49
 
 
50
 
 
51
 
def convert_dulwich_error(error):
52
 
    """Convert a Dulwich error to a Bazaar error."""
53
 
 
54
 
    if isinstance(error, git_errors.HangupException):
55
 
        raise bzr_errors.ConnectionReset(error.msg, "")
56
 
    raise error
57
 
 
58
 
 
59
 
class NoPushSupport(bzr_errors.BzrError):
60
 
    _fmt = "Push is not yet supported for bzr-git. Try dpush instead."
61
 
 
62
 
 
63
 
class GitSmartRemoteNotSupported(bzr_errors.BzrError):
64
 
    _fmt = "This operation is not supported by the Git smart server protocol."
65
 
 
66
 
 
67
 
class GhostRevision(bzr_errors.NoSuchRevision):
68
 
    _fmt = "Revision %(revision)s is a ghost; unable to represent in Git."""