/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

Fix some bit of fetching.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""A grouping of Exceptions for bzr-git"""
18
18
 
19
 
from dulwich import errors as git_errors
20
 
 
21
19
from bzrlib import errors as bzr_errors
22
20
 
 
21
 
23
22
class BzrGitError(bzr_errors.BzrError):
24
23
    """The base-level exception for bzr-git errors."""
25
24
 
33
32
        self.command = command
34
33
        self.returncode = returncode
35
34
        self.stderr = stderr
36
 
 
37
 
 
38
 
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):
44
 
        self.ref = ref
45
 
        self.present_refs = present_refs
46
 
 
47
 
 
48
 
def convert_dulwich_error(error):
49
 
    """Convert a Dulwich error to a Bazaar error."""
50
 
 
51
 
    if isinstance(error, git_errors.HangupException):
52
 
        raise bzr_errors.ConnectionReset(error.msg, "")
53
 
    raise error
54
 
 
55
 
 
56
 
class NoPushSupport(bzr_errors.BzrError):
57
 
    _fmt = "Push is not yet supported for bzr-git. Try dpush instead."
58
 
 
59
 
 
60
 
class GitSmartRemoteNotSupported(bzr_errors.BzrError):
61
 
    _fmt = "This operation is not supported by the Git smart server protocol."