/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

StartĀ onĀ 0.2.2

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
 
19
21
from bzrlib import errors as bzr_errors
20
 
from dulwich import errors as git_errors
21
 
 
22
22
 
23
23
class BzrGitError(bzr_errors.BzrError):
24
24
    """The base-level exception for bzr-git errors."""
40
40
 
41
41
    _fmt = "The ref %(ref)s was not found."
42
42
    
43
 
    def __init__(self, ref):
 
43
    def __init__(self, ref, present_refs=None):
44
44
        self.ref = ref
45
 
 
46
 
class LightWeightCheckoutsNotSupported(BzrGitError):
47
 
    _fmt = "bzr-git does not support creating lightweight checkouts at the moment."
 
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."