/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

Clean up trailing whitespace.

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