bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
| 
0.200.19
by John Arbash Meinel
 More refactoring. Add some direct tests for GitModel.  | 
1  | 
# Copyright (C) 2007 Canonical Ltd
 | 
| 
0.358.2
by Jelmer Vernooij
 Refresh copyright headers, add my email.  | 
2  | 
# Copyright (C) 2018 Jelmer Vernooij <jelmer@jelmer.uk>
 | 
| 
0.200.19
by John Arbash Meinel
 More refactoring. Add some direct tests for GitModel.  | 
3  | 
#
 | 
4  | 
# This program is free software; you can redistribute it and/or modify
 | 
|
5  | 
# it under the terms of the GNU General Public License as published by
 | 
|
6  | 
# the Free Software Foundation; either version 2 of the License, or
 | 
|
7  | 
# (at your option) any later version.
 | 
|
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
 | 
|
| 
0.358.1
by Jelmer Vernooij
 Fix FSF address.  | 
16  | 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 | 
| 
0.200.19
by John Arbash Meinel
 More refactoring. Add some direct tests for GitModel.  | 
17  | 
|
| 
0.200.439
by Jelmer Vernooij
 Add exception for ghost revisions.  | 
18  | 
|
| 
0.200.19
by John Arbash Meinel
 More refactoring. Add some direct tests for GitModel.  | 
19  | 
"""A grouping of Exceptions for bzr-git"""
 | 
20  | 
||
| 
0.200.1594
by Jelmer Vernooij
 Use absolute_import everywhere.  | 
21  | 
from __future__ import absolute_import  | 
| 
0.200.439
by Jelmer Vernooij
 Add exception for ghost revisions.  | 
22  | 
|
| 
0.200.292
by Jelmer Vernooij
 Fix formatting.  | 
23  | 
from dulwich import errors as git_errors  | 
24  | 
||
| 
7143.7.1
by Jelmer Vernooij
 Simplify brz-git, drop imports.  | 
25  | 
from .. import errors as brz_errors  | 
26  | 
||
27  | 
||
28  | 
class BzrGitError(brz_errors.BzrError):  | 
|
| 
0.200.19
by John Arbash Meinel
 More refactoring. Add some direct tests for GitModel.  | 
29  | 
"""The base-level exception for bzr-git errors."""  | 
30  | 
||
31  | 
||
| 
0.200.165
by Jelmer Vernooij
 Give a proper error when the ref can not be found.  | 
32  | 
class NoSuchRef(BzrGitError):  | 
| 
0.200.695
by Jelmer Vernooij
 Clean up trailing whitespace.  | 
33  | 
"""Raised when a ref can not be found."""  | 
| 
0.200.165
by Jelmer Vernooij
 Give a proper error when the ref can not be found.  | 
34  | 
|
| 
0.200.1386
by Jelmer Vernooij
 Friendlier message if HEAD is not found.  | 
35  | 
_fmt = "The ref %(ref)s was not found in the repository at %(location)s."  | 
| 
0.200.695
by Jelmer Vernooij
 Clean up trailing whitespace.  | 
36  | 
|
| 
0.200.1386
by Jelmer Vernooij
 Friendlier message if HEAD is not found.  | 
37  | 
def __init__(self, ref, location, present_refs=None):  | 
| 
0.200.165
by Jelmer Vernooij
 Give a proper error when the ref can not be found.  | 
38  | 
self.ref = ref  | 
| 
0.200.1386
by Jelmer Vernooij
 Friendlier message if HEAD is not found.  | 
39  | 
self.location = location  | 
| 
0.200.277
by Jelmer Vernooij
 Allow passing in refs that *were* found in NoSuchRef.  | 
40  | 
self.present_refs = present_refs  | 
41  | 
||
| 
0.200.210
by Jelmer Vernooij
 properly error out about not support lightweight checkouts.  | 
42  | 
|
| 
0.200.242
by Jelmer Vernooij
 Add conversion function for dulwich errors.  | 
43  | 
def convert_dulwich_error(error):  | 
44  | 
"""Convert a Dulwich error to a Bazaar error."""  | 
|
45  | 
||
46  | 
if isinstance(error, git_errors.HangupException):  | 
|
| 
7143.7.1
by Jelmer Vernooij
 Simplify brz-git, drop imports.  | 
47  | 
raise brz_errors.ConnectionReset(error.msg, "")  | 
| 
0.200.242
by Jelmer Vernooij
 Add conversion function for dulwich errors.  | 
48  | 
raise error  | 
| 
0.200.291
by Jelmer Vernooij
 Print proper error about not supporting push.  | 
49  | 
|
50  | 
||
| 
7143.7.1
by Jelmer Vernooij
 Simplify brz-git, drop imports.  | 
51  | 
class NoPushSupport(brz_errors.BzrError):  | 
| 
7143.15.6
by Jelmer Vernooij
 Merge trunk.  | 
52  | 
_fmt = ("Push is not yet supported from %(source)r to %(target)r "  | 
53  | 
"using %(mapping)r for %(revision_id)r. Try dpush instead.")  | 
|
| 
0.200.1718
by Jelmer Vernooij
 Support AlreadyControlDirError.  | 
54  | 
|
| 
0.320.2
by Jelmer Vernooij
 Only complain about roundtripping if revisions being pushed didn't originally come from git.  | 
55  | 
def __init__(self, source, target, mapping, revision_id=None):  | 
| 
0.200.1718
by Jelmer Vernooij
 Support AlreadyControlDirError.  | 
56  | 
self.source = source  | 
57  | 
self.target = target  | 
|
58  | 
self.mapping = mapping  | 
|
| 
0.320.2
by Jelmer Vernooij
 Only complain about roundtripping if revisions being pushed didn't originally come from git.  | 
59  | 
self.revision_id = revision_id  | 
| 
0.200.319
by Jelmer Vernooij
 Print proper error when trying unsupported operations against a git server.  | 
60  | 
|
61  | 
||
| 
7143.7.1
by Jelmer Vernooij
 Simplify brz-git, drop imports.  | 
62  | 
class GitSmartRemoteNotSupported(brz_errors.UnsupportedOperation):  | 
| 
0.200.319
by Jelmer Vernooij
 Print proper error when trying unsupported operations against a git server.  | 
63  | 
_fmt = "This operation is not supported by the Git smart server protocol."  | 
| 
0.200.1598
by Jelmer Vernooij
 Print proper error when unknown fields are encountered.  | 
64  | 
|
65  | 
||
| 
7143.7.1
by Jelmer Vernooij
 Simplify brz-git, drop imports.  | 
66  | 
class UnknownCommitExtra(brz_errors.BzrError):  | 
| 
0.200.1598
by Jelmer Vernooij
 Print proper error when unknown fields are encountered.  | 
67  | 
_fmt = "Unknown extra fields in %(object)r: %(fields)r."  | 
68  | 
||
69  | 
def __init__(self, object, fields):  | 
|
| 
7143.7.1
by Jelmer Vernooij
 Simplify brz-git, drop imports.  | 
70  | 
brz_errors.BzrError.__init__(self)  | 
| 
0.200.1598
by Jelmer Vernooij
 Print proper error when unknown fields are encountered.  | 
71  | 
self.object = object  | 
| 
0.200.1637
by Jelmer Vernooij
 List all unknown extras.  | 
72  | 
self.fields = ",".join(fields)  | 
| 
0.200.1640
by Jelmer Vernooij
 Support HG extra 'amend_source'.  | 
73  | 
|
74  | 
||
| 
7143.7.1
by Jelmer Vernooij
 Simplify brz-git, drop imports.  | 
75  | 
class UnknownMercurialCommitExtra(brz_errors.BzrError):  | 
| 
0.200.1640
by Jelmer Vernooij
 Support HG extra 'amend_source'.  | 
76  | 
_fmt = "Unknown mercurial extra fields in %(object)r: %(fields)r."  | 
77  | 
||
78  | 
def __init__(self, object, fields):  | 
|
| 
7143.7.1
by Jelmer Vernooij
 Simplify brz-git, drop imports.  | 
79  | 
brz_errors.BzrError.__init__(self)  | 
| 
0.200.1640
by Jelmer Vernooij
 Support HG extra 'amend_source'.  | 
80  | 
self.object = object  | 
81  | 
self.fields = ",".join(fields)  |