bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.200.235
by Jelmer Vernooij
Depend on newer dulwich. |
1 |
# Copyright (C) 2006-2009 Canonical Ltd
|
|
0.200.201
by Jelmer Vernooij
Try to import nothing other than __init__ when not opening git repositories. |
2 |
|
|
0.200.1
by Robert Collins
Commit initial content. |
3 |
# Authors: Robert Collins <robert.collins@canonical.com>
|
|
0.200.184
by Jelmer Vernooij
Update authors: line. |
4 |
# Jelmer Vernooij <jelmer@samba.org>
|
5 |
# John Carr <john.carr@unrouted.co.uk>
|
|
|
0.200.1
by Robert Collins
Commit initial content. |
6 |
#
|
7 |
# This program is free software; you can redistribute it and/or modify
|
|
8 |
# it under the terms of the GNU General Public License as published by
|
|
9 |
# the Free Software Foundation; either version 2 of the License, or
|
|
10 |
# (at your option) any later version.
|
|
11 |
#
|
|
12 |
# This program is distributed in the hope that it will be useful,
|
|
13 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15 |
# GNU General Public License for more details.
|
|
16 |
#
|
|
17 |
# You should have received a copy of the GNU General Public License
|
|
18 |
# along with this program; if not, write to the Free Software
|
|
19 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
20 |
||
21 |
||
22 |
"""A GIT branch and repository format implementation for bzr."""
|
|
23 |
||
|
0.200.1528
by Jelmer Vernooij
Use absolute_import in __init__. |
24 |
from __future__ import absolute_import |
25 |
||
|
0.224.1
by Alexander Belchenko
bzr.exe support: allow import of dulwich from _lib subdirectory |
26 |
import os |
27 |
import sys |
|
28 |
||
|
0.200.1646
by Jelmer Vernooij
Rename bzrlib to breezy. |
29 |
import breezy |
|
0.200.519
by Jelmer Vernooij
Move imports down, might not be available in older bzr-git versions. |
30 |
|
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
31 |
from .info import ( |
|
0.200.583
by Jelmer Vernooij
Add plugin api info. |
32 |
bzr_compatible_versions, |
33 |
bzr_plugin_version as version_info, |
|
34 |
dulwich_minimum_version, |
|
35 |
)
|
|
|
0.200.519
by Jelmer Vernooij
Move imports down, might not be available in older bzr-git versions. |
36 |
|
37 |
if version_info[3] == 'final': |
|
38 |
version_string = '%d.%d.%d' % version_info[:3] |
|
39 |
else: |
|
40 |
version_string = '%d.%d.%d%s%d' % version_info |
|
41 |
__version__ = version_string |
|
42 |
||
|
0.200.1647
by Jelmer Vernooij
Drop api support. |
43 |
if breezy.version_info[:3] not in bzr_compatible_versions: |
44 |
from ...errors import IncompatibleVersion |
|
45 |
raise IncompatibleVersion(breezy, |
|
46 |
bzr_compatible_versions, breezy.version_info[:3]) |
|
|
0.200.519
by Jelmer Vernooij
Move imports down, might not be available in older bzr-git versions. |
47 |
|
|
0.200.1406
by Jelmer Vernooij
Import gettext. |
48 |
try: |
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
49 |
from ...i18n import load_plugin_translations |
|
0.200.1406
by Jelmer Vernooij
Import gettext. |
50 |
except ImportError: # No translations for bzr < 2.5 |
51 |
gettext = lambda x: x |
|
52 |
else: |
|
53 |
translation = load_plugin_translations("bzr-git") |
|
54 |
gettext = translation.gettext |
|
|
0.200.519
by Jelmer Vernooij
Move imports down, might not be available in older bzr-git versions. |
55 |
|
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
56 |
from ... import ( |
|
0.340.1
by Jelmer Vernooij
Include git/ in user agent when probing for Git. |
57 |
__version__ as breezy_version, |
|
0.200.292
by Jelmer Vernooij
Fix formatting. |
58 |
errors as bzr_errors, |
|
0.200.1384
by Jelmer Vernooij
Skip post commit hook when dulwich is not installed. |
59 |
trace, |
|
0.200.292
by Jelmer Vernooij
Fix formatting. |
60 |
)
|
|
0.200.1111
by Jelmer Vernooij
Drop support for Bazaar < 2.3. |
61 |
|
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
62 |
from ...controldir import ( |
|
0.200.1111
by Jelmer Vernooij
Drop support for Bazaar < 2.3. |
63 |
ControlDirFormat, |
64 |
Prober, |
|
65 |
format_registry, |
|
|
0.200.1137
by Jelmer Vernooij
Support BzrProber.known_formats(). |
66 |
network_format_registry as controldir_network_format_registry, |
|
0.200.1111
by Jelmer Vernooij
Drop support for Bazaar < 2.3. |
67 |
)
|
|
0.200.1012
by Jelmer Vernooij
Rename BzrDir to ControlDir. |
68 |
|
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
69 |
from ...transport import ( |
|
0.200.292
by Jelmer Vernooij
Fix formatting. |
70 |
register_lazy_transport, |
|
0.200.308
by Jelmer Vernooij
Register git protocols. |
71 |
register_transport_proto, |
|
0.276.1
by Jelmer Vernooij
Use register_lazy. |
72 |
transport_server_registry, |
|
0.200.292
by Jelmer Vernooij
Fix formatting. |
73 |
)
|
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
74 |
from ...commands import ( |
|
0.200.292
by Jelmer Vernooij
Fix formatting. |
75 |
plugin_cmds, |
76 |
)
|
|
|
0.200.341
by Jelmer Vernooij
Add stanza with git commit info in 'bzr version-info' |
77 |
|
|
0.200.192
by Jelmer Vernooij
use system-provided dulwich, remove own copy. |
78 |
|
|
0.224.1
by Alexander Belchenko
bzr.exe support: allow import of dulwich from _lib subdirectory |
79 |
if getattr(sys, "frozen", None): |
80 |
# allow import additional libs from ./_lib for bzr.exe only
|
|
|
0.200.926
by Jelmer Vernooij
Fix formatting, drop support for Bazaar < 2.0. |
81 |
sys.path.append(os.path.normpath( |
82 |
os.path.join(os.path.dirname(__file__), '_lib'))) |
|
|
0.224.1
by Alexander Belchenko
bzr.exe support: allow import of dulwich from _lib subdirectory |
83 |
|
|
0.200.987
by Jelmer Vernooij
Add DulwichFeature. |
84 |
|
85 |
def import_dulwich(): |
|
|
0.200.200
by Jelmer Vernooij
Register lazily where possible. |
86 |
try: |
87 |
from dulwich import __version__ as dulwich_version |
|
88 |
except ImportError: |
|
|
0.200.695
by Jelmer Vernooij
Clean up trailing whitespace. |
89 |
raise bzr_errors.DependencyNotPresent("dulwich", |
90 |
"bzr-git: Please install dulwich, https://launchpad.net/dulwich") |
|
|
0.200.200
by Jelmer Vernooij
Register lazily where possible. |
91 |
else: |
|
0.200.583
by Jelmer Vernooij
Add plugin api info. |
92 |
if dulwich_version < dulwich_minimum_version: |
|
0.200.926
by Jelmer Vernooij
Fix formatting, drop support for Bazaar < 2.0. |
93 |
raise bzr_errors.DependencyNotPresent("dulwich", |
94 |
"bzr-git: Dulwich is too old; at least %d.%d.%d is required" % |
|
95 |
dulwich_minimum_version) |
|
|
0.200.199
by Jelmer Vernooij
Check for bzrlib API version. |
96 |
|
|
0.200.987
by Jelmer Vernooij
Add DulwichFeature. |
97 |
|
98 |
_versions_checked = False |
|
99 |
def lazy_check_versions(): |
|
100 |
global _versions_checked |
|
101 |
if _versions_checked: |
|
102 |
return
|
|
103 |
import_dulwich() |
|
104 |
_versions_checked = True |
|
105 |
||
|
0.200.1012
by Jelmer Vernooij
Rename BzrDir to ControlDir. |
106 |
format_registry.register_lazy('git', |
|
0.200.1646
by Jelmer Vernooij
Rename bzrlib to breezy. |
107 |
__name__ + ".dir", "LocalGitControlDirFormat", |
|
0.200.1018
by Jelmer Vernooij
Fix use with new control dir API. |
108 |
help='GIT repository.', native=False, experimental=False, |
|
0.200.200
by Jelmer Vernooij
Register lazily where possible. |
109 |
)
|
|
0.200.204
by Jelmer Vernooij
Support bzr 1.11. |
110 |
|
|
0.200.1032
by Jelmer Vernooij
Support bare repositories. |
111 |
format_registry.register_lazy('git-bare', |
|
0.200.1646
by Jelmer Vernooij
Rename bzrlib to breezy. |
112 |
__name__ + ".dir", "BareLocalGitControlDirFormat", |
|
0.200.1032
by Jelmer Vernooij
Support bare repositories. |
113 |
help='Bare GIT repository (no working tree).', native=False, |
114 |
experimental=False, |
|
115 |
)
|
|
116 |
||
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
117 |
from ...revisionspec import (RevisionSpec_dwim, revspec_registry) |
|
0.200.1646
by Jelmer Vernooij
Rename bzrlib to breezy. |
118 |
revspec_registry.register_lazy("git:", __name__ + ".revspec", |
|
0.200.292
by Jelmer Vernooij
Fix formatting. |
119 |
"RevisionSpec_git") |
|
0.200.1559
by Jelmer Vernooij
Fix compatibility with bzr 2.5. |
120 |
RevisionSpec_dwim.append_possible_lazy_revspec( |
|
0.200.1649
by Jelmer Vernooij
Fix imports. |
121 |
__name__ + ".revspec", "RevisionSpec_git") |
|
0.200.645
by Jelmer Vernooij
Support DWIM git: revspecs. |
122 |
|
|
0.200.328
by Jelmer Vernooij
Support stacking, depend on bzr 1.15. |
123 |
|
|
0.200.1014
by Jelmer Vernooij
Fix tests. |
124 |
class LocalGitProber(Prober): |
125 |
||
126 |
def probe_transport(self, transport): |
|
|
0.200.720
by Jelmer Vernooij
Avoid loading bzr-git/dulwich when not necessary. |
127 |
try: |
|
0.268.1
by Jelmer Vernooij
Fix probing of http repositories when pycurl is used. |
128 |
external_url = transport.external_url() |
129 |
except bzr_errors.InProcessTransport: |
|
130 |
raise bzr_errors.NotBranchError(path=transport.base) |
|
131 |
if (external_url.startswith("http:") or |
|
132 |
external_url.startswith("https:")): |
|
133 |
# Already handled by RemoteGitProber
|
|
134 |
raise bzr_errors.NotBranchError(path=transport.base) |
|
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
135 |
from ... import urlutils |
|
0.200.730
by Jelmer Vernooij
Don't claim control directories can be accessed directly, always open the |
136 |
if urlutils.split(transport.base)[1] == ".git": |
137 |
raise bzr_errors.NotBranchError(path=transport.base) |
|
|
0.200.1387
by Jelmer Vernooij
Avoid using HEAD. |
138 |
if not transport.has_any(['objects', '.git/objects']): |
139 |
raise bzr_errors.NotBranchError(path=transport.base) |
|
|
0.239.13
by Jelmer Vernooij
Don't break "bzr info -v" when Dulwich is not installed. |
140 |
lazy_check_versions() |
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
141 |
from .dir import ( |
|
0.200.1387
by Jelmer Vernooij
Avoid using HEAD. |
142 |
BareLocalGitControlDirFormat, |
143 |
LocalGitControlDirFormat, |
|
144 |
)
|
|
145 |
if transport.has_any(['.git/objects']): |
|
146 |
return LocalGitControlDirFormat() |
|
147 |
if transport.has('info') and transport.has('objects'): |
|
148 |
return BareLocalGitControlDirFormat() |
|
|
0.200.1399
by Jelmer Vernooij
In prober, always return or raise NotBranchError. |
149 |
raise bzr_errors.NotBranchError(path=transport.base) |
|
0.200.201
by Jelmer Vernooij
Try to import nothing other than __init__ when not opening git repositories. |
150 |
|
|
0.200.1139
by Jelmer Vernooij
Prober.known_formats is a class method. |
151 |
@classmethod
|
152 |
def known_formats(cls): |
|
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
153 |
from .dir import ( |
|
0.200.1137
by Jelmer Vernooij
Support BzrProber.known_formats(). |
154 |
BareLocalGitControlDirFormat, |
155 |
LocalGitControlDirFormat, |
|
156 |
)
|
|
157 |
return set([BareLocalGitControlDirFormat(), LocalGitControlDirFormat()]) |
|
|
0.200.1032
by Jelmer Vernooij
Support bare repositories. |
158 |
|
159 |
||
|
0.200.1014
by Jelmer Vernooij
Fix tests. |
160 |
class RemoteGitProber(Prober): |
161 |
||
|
0.200.1334
by Jelmer Vernooij
Detect smart servers. |
162 |
def probe_http_transport(self, transport): |
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
163 |
from ... import urlutils |
|
0.200.1554
by Jelmer Vernooij
Fix probing over http with colocated branches. |
164 |
base_url, _ = urlutils.split_segment_parameters(transport.external_url()) |
165 |
url = urlutils.join(base_url, "info/refs") + "?service=git-upload-pack" |
|
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
166 |
from ...transport.http._urllib import HttpTransport_urllib, Request |
|
0.340.1
by Jelmer Vernooij
Include git/ in user agent when probing for Git. |
167 |
headers = {"Content-Type": "application/x-git-upload-pack-request"} |
168 |
if "github.com" in url: |
|
169 |
# GitHub requires we lie. https://github.com/dulwich/dulwich/issues/562
|
|
170 |
headers["User-agent"] = "git/Breezy/%s" % breezy_version |
|
|
0.200.1726
by Jelmer Vernooij
Use urllib exclusively. |
171 |
req = Request('GET', url, accepted_errors=[200, 403, 404, 405], |
|
0.340.1
by Jelmer Vernooij
Include git/ in user agent when probing for Git. |
172 |
headers=headers) |
|
0.200.1726
by Jelmer Vernooij
Use urllib exclusively. |
173 |
req.follow_redirections = True |
174 |
resp = transport._perform(req) |
|
175 |
if resp.code in (404, 405): |
|
176 |
raise bzr_errors.NotBranchError(transport.base) |
|
177 |
headers = resp.headers |
|
|
0.200.1334
by Jelmer Vernooij
Detect smart servers. |
178 |
ct = headers.getheader("Content-Type") |
|
0.200.1405
by Jelmer Vernooij
Add i18n support. |
179 |
if ct is None: |
180 |
raise bzr_errors.NotBranchError(transport.base) |
|
|
0.200.1334
by Jelmer Vernooij
Detect smart servers. |
181 |
if ct.startswith("application/x-git"): |
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
182 |
from .remote import RemoteGitControlDirFormat |
|
0.200.1334
by Jelmer Vernooij
Detect smart servers. |
183 |
return RemoteGitControlDirFormat() |
184 |
else: |
|
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
185 |
from .dir import ( |
|
0.200.1334
by Jelmer Vernooij
Detect smart servers. |
186 |
BareLocalGitControlDirFormat, |
187 |
)
|
|
|
0.200.1485
by Jelmer Vernooij
Keep track of refs text when opening bare repository. |
188 |
ret = BareLocalGitControlDirFormat() |
|
0.200.1726
by Jelmer Vernooij
Use urllib exclusively. |
189 |
ret._refs_text = resp.read() |
|
0.200.1485
by Jelmer Vernooij
Keep track of refs text when opening bare repository. |
190 |
return ret |
|
0.200.1334
by Jelmer Vernooij
Detect smart servers. |
191 |
|
|
0.200.1014
by Jelmer Vernooij
Fix tests. |
192 |
def probe_transport(self, transport): |
|
0.200.1334
by Jelmer Vernooij
Detect smart servers. |
193 |
try: |
194 |
external_url = transport.external_url() |
|
195 |
except bzr_errors.InProcessTransport: |
|
196 |
raise bzr_errors.NotBranchError(path=transport.base) |
|
197 |
||
198 |
if (external_url.startswith("http:") or |
|
199 |
external_url.startswith("https:")): |
|
200 |
return self.probe_http_transport(transport) |
|
201 |
||
202 |
if (not external_url.startswith("git://") and |
|
203 |
not external_url.startswith("git+")): |
|
|
0.200.1014
by Jelmer Vernooij
Fix tests. |
204 |
raise bzr_errors.NotBranchError(transport.base) |
|
0.200.1334
by Jelmer Vernooij
Detect smart servers. |
205 |
|
|
0.200.1014
by Jelmer Vernooij
Fix tests. |
206 |
# little ugly, but works
|
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
207 |
from .remote import ( |
|
0.200.1137
by Jelmer Vernooij
Support BzrProber.known_formats(). |
208 |
GitSmartTransport, |
209 |
RemoteGitControlDirFormat, |
|
210 |
)
|
|
|
0.200.1334
by Jelmer Vernooij
Detect smart servers. |
211 |
if isinstance(transport, GitSmartTransport): |
212 |
return RemoteGitControlDirFormat() |
|
213 |
raise bzr_errors.NotBranchError(path=transport.base) |
|
|
0.200.1014
by Jelmer Vernooij
Fix tests. |
214 |
|
|
0.200.201
by Jelmer Vernooij
Try to import nothing other than __init__ when not opening git repositories. |
215 |
@classmethod
|
|
0.200.1139
by Jelmer Vernooij
Prober.known_formats is a class method. |
216 |
def known_formats(cls): |
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
217 |
from .remote import RemoteGitControlDirFormat |
|
0.200.1012
by Jelmer Vernooij
Rename BzrDir to ControlDir. |
218 |
return set([RemoteGitControlDirFormat()]) |
|
0.200.201
by Jelmer Vernooij
Try to import nothing other than __init__ when not opening git repositories. |
219 |
|
|
0.200.1137
by Jelmer Vernooij
Support BzrProber.known_formats(). |
220 |
|
|
0.200.1111
by Jelmer Vernooij
Drop support for Bazaar < 2.3. |
221 |
ControlDirFormat.register_prober(LocalGitProber) |
|
0.200.1556
by Jelmer Vernooij
Add 'github:' directory service. |
222 |
ControlDirFormat._server_probers.append(RemoteGitProber) |
|
0.200.138
by Jelmer Vernooij
Add initial infrastructure for accessing remote git repositories. |
223 |
|
|
0.200.674
by Jelmer Vernooij
Fix formatting. |
224 |
register_transport_proto('git://', |
|
0.200.308
by Jelmer Vernooij
Register git protocols. |
225 |
help="Access using the Git smart server protocol.") |
|
0.200.674
by Jelmer Vernooij
Fix formatting. |
226 |
register_transport_proto('git+ssh://', |
|
0.200.308
by Jelmer Vernooij
Register git protocols. |
227 |
help="Access using the Git smart server protocol over SSH.") |
228 |
||
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
229 |
register_lazy_transport("git://", __name__ + '.remote', |
|
0.200.307
by Jelmer Vernooij
Support git+ssh. |
230 |
'TCPGitSmartTransport') |
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
231 |
register_lazy_transport("git+ssh://", __name__ + '.remote', |
|
0.200.307
by Jelmer Vernooij
Support git+ssh. |
232 |
'SSHGitSmartTransport') |
|
0.200.19
by John Arbash Meinel
More refactoring. Add some direct tests for GitModel. |
233 |
|
|
0.208.5
by Jelmer Vernooij
Add log show function for git. |
234 |
|
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
235 |
plugin_cmds.register_lazy("cmd_git_import", [], __name__ + ".commands") |
|
0.200.674
by Jelmer Vernooij
Fix formatting. |
236 |
plugin_cmds.register_lazy("cmd_git_object", ["git-objects", "git-cat"], |
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
237 |
__name__ + ".commands") |
238 |
plugin_cmds.register_lazy("cmd_git_refs", [], __name__ + ".commands") |
|
239 |
plugin_cmds.register_lazy("cmd_git_apply", [], __name__ + ".commands") |
|
|
0.277.6
by Jelmer Vernooij
Add 'bzr git-push-pristine-tar' command. |
240 |
plugin_cmds.register_lazy("cmd_git_push_pristine_tar_deltas", |
241 |
['git-push-pristine-tar', 'git-push-pristine'], |
|
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
242 |
__name__ + ".commands") |
|
0.200.177
by Jelmer Vernooij
Add git-import command. |
243 |
|
|
0.200.1262
by Jelmer Vernooij
Add extract git foreign revid. |
244 |
def extract_git_foreign_revid(rev): |
245 |
try: |
|
246 |
foreign_revid = rev.foreign_revid |
|
247 |
except AttributeError: |
|
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
248 |
from .mapping import mapping_registry |
|
0.200.1262
by Jelmer Vernooij
Add extract git foreign revid. |
249 |
foreign_revid, mapping = \ |
250 |
mapping_registry.parse_revision_id(rev.revision_id) |
|
251 |
return foreign_revid |
|
252 |
else: |
|
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
253 |
from .mapping import foreign_vcs_git |
|
0.200.1262
by Jelmer Vernooij
Add extract git foreign revid. |
254 |
if rev.mapping.vcs == foreign_vcs_git: |
255 |
return foreign_revid |
|
256 |
else: |
|
257 |
raise bzr_errors.InvalidRevisionId(rev.revision_id, None) |
|
258 |
||
259 |
||
|
0.200.341
by Jelmer Vernooij
Add stanza with git commit info in 'bzr version-info' |
260 |
def update_stanza(rev, stanza): |
261 |
mapping = getattr(rev, "mapping", None) |
|
|
0.200.1262
by Jelmer Vernooij
Add extract git foreign revid. |
262 |
try: |
263 |
git_commit = extract_git_foreign_revid(rev) |
|
264 |
except bzr_errors.InvalidRevisionId: |
|
265 |
pass
|
|
266 |
else: |
|
267 |
stanza.add("git-commit", git_commit) |
|
|
0.200.341
by Jelmer Vernooij
Add stanza with git commit info in 'bzr version-info' |
268 |
|
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
269 |
from ...hooks import install_lazy_named_hook |
|
0.200.1646
by Jelmer Vernooij
Rename bzrlib to breezy. |
270 |
install_lazy_named_hook("breezy.version_info_formats.format_rio", |
|
0.200.1559
by Jelmer Vernooij
Fix compatibility with bzr 2.5. |
271 |
"RioVersionInfoBuilder.hooks", "revision", update_stanza, |
272 |
"git commits") |
|
|
0.200.341
by Jelmer Vernooij
Add stanza with git commit info in 'bzr version-info' |
273 |
|
|
0.200.531
by Jelmer Vernooij
Support 'bzr serve --git'. |
274 |
|
|
0.239.6
by Jelmer Vernooij
Remove pre-1.15 incompatible code. |
275 |
transport_server_registry.register_lazy('git', |
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
276 |
__name__ + '.server', |
|
0.239.6
by Jelmer Vernooij
Remove pre-1.15 incompatible code. |
277 |
'serve_git', |
278 |
'Git Smart server protocol over TCP. (default port: 9418)') |
|
|
0.200.531
by Jelmer Vernooij
Support 'bzr serve --git'. |
279 |
|
|
0.200.1496
by Jelmer Vernooij
Provide --git-receive-pack and --git-upload-pack options for 'bzr serve'. |
280 |
transport_server_registry.register_lazy('git-receive-pack', |
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
281 |
__name__ + '.server', |
|
0.200.1496
by Jelmer Vernooij
Provide --git-receive-pack and --git-upload-pack options for 'bzr serve'. |
282 |
'serve_git_receive_pack', |
|
0.200.1595
by Jelmer Vernooij
Fix formatting of option names. |
283 |
help='Git Smart server receive pack command. (inetd mode only)') |
|
0.200.1496
by Jelmer Vernooij
Provide --git-receive-pack and --git-upload-pack options for 'bzr serve'. |
284 |
transport_server_registry.register_lazy('git-upload-pack', |
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
285 |
__name__ + 'git.server', |
|
0.200.1496
by Jelmer Vernooij
Provide --git-receive-pack and --git-upload-pack options for 'bzr serve'. |
286 |
'serve_git_upload_pack', |
|
0.200.1595
by Jelmer Vernooij
Fix formatting of option names. |
287 |
help='Git Smart server upload pack command. (inetd mode only)') |
|
0.200.531
by Jelmer Vernooij
Support 'bzr serve --git'. |
288 |
|
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
289 |
from ...repository import ( |
|
0.200.1083
by Jelmer Vernooij
Register repository format. |
290 |
format_registry as repository_format_registry, |
|
0.200.926
by Jelmer Vernooij
Fix formatting, drop support for Bazaar < 2.0. |
291 |
network_format_registry as repository_network_format_registry, |
292 |
)
|
|
|
0.200.674
by Jelmer Vernooij
Fix formatting. |
293 |
repository_network_format_registry.register_lazy('git', |
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
294 |
__name__ + '.repository', 'GitRepositoryFormat') |
|
0.200.536
by Jelmer Vernooij
Implement network name. |
295 |
|
|
0.200.1559
by Jelmer Vernooij
Fix compatibility with bzr 2.5. |
296 |
register_extra_lazy_repository_format = getattr(repository_format_registry, |
297 |
"register_extra_lazy") |
|
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
298 |
register_extra_lazy_repository_format(__name__ + '.repository', |
|
0.200.1559
by Jelmer Vernooij
Fix compatibility with bzr 2.5. |
299 |
'GitRepositoryFormat') |
|
0.200.1083
by Jelmer Vernooij
Register repository format. |
300 |
|
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
301 |
from ...branch import ( |
|
0.200.1127
by Jelmer Vernooij
Register branch format network name. |
302 |
network_format_registry as branch_network_format_registry, |
303 |
)
|
|
304 |
branch_network_format_registry.register_lazy('git', |
|
|
0.295.1
by Jelmer Vernooij
Split up branch formats. |
305 |
__name__ + '.branch', 'LocalGitBranchFormat') |
306 |
||
|
0.200.1127
by Jelmer Vernooij
Register branch format network name. |
307 |
|
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
308 |
from ...branch import ( |
|
0.200.1559
by Jelmer Vernooij
Fix compatibility with bzr 2.5. |
309 |
format_registry as branch_format_registry, |
310 |
)
|
|
311 |
branch_format_registry.register_extra_lazy( |
|
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
312 |
__name__ + '.branch', |
|
0.295.1
by Jelmer Vernooij
Split up branch formats. |
313 |
'LocalGitBranchFormat', |
314 |
)
|
|
315 |
branch_format_registry.register_extra_lazy( |
|
316 |
__name__ + '.remote', |
|
317 |
'RemoteGitBranchFormat', |
|
318 |
)
|
|
319 |
||
|
0.200.1090
by Jelmer Vernooij
Register branch format for testing. |
320 |
|
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
321 |
from ...workingtree import ( |
|
0.200.1559
by Jelmer Vernooij
Fix compatibility with bzr 2.5. |
322 |
format_registry as workingtree_format_registry, |
323 |
)
|
|
324 |
workingtree_format_registry.register_extra_lazy( |
|
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
325 |
__name__ + '.workingtree', |
|
0.200.1559
by Jelmer Vernooij
Fix compatibility with bzr 2.5. |
326 |
'GitWorkingTreeFormat', |
327 |
)
|
|
|
0.200.1093
by Jelmer Vernooij
Register working tree format for testing. |
328 |
|
|
0.200.1137
by Jelmer Vernooij
Support BzrProber.known_formats(). |
329 |
controldir_network_format_registry.register_lazy('git', |
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
330 |
__name__ + ".dir", "GitControlDirFormat") |
|
0.200.536
by Jelmer Vernooij
Implement network name. |
331 |
|
|
0.276.1
by Jelmer Vernooij
Use register_lazy. |
332 |
|
333 |
try: |
|
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
334 |
from ...registry import register_lazy |
|
0.276.1
by Jelmer Vernooij
Use register_lazy. |
335 |
except ImportError: |
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
336 |
from ...diff import format_registry as diff_format_registry |
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
337 |
diff_format_registry.register_lazy('git', __name__ + '.send', |
|
0.276.1
by Jelmer Vernooij
Use register_lazy. |
338 |
'GitDiffTree', 'Git am-style diff format') |
339 |
||
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
340 |
from ...send import ( |
|
0.276.1
by Jelmer Vernooij
Use register_lazy. |
341 |
format_registry as send_format_registry, |
342 |
)
|
|
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
343 |
send_format_registry.register_lazy('git', __name__ + '.send', |
|
0.276.1
by Jelmer Vernooij
Use register_lazy. |
344 |
'send_git', 'Git am-style diff format') |
345 |
||
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
346 |
from ...directory_service import directories |
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
347 |
directories.register_lazy('github:', __name__ + '.directory', |
|
0.276.1
by Jelmer Vernooij
Use register_lazy. |
348 |
'GitHubDirectory', |
349 |
'GitHub directory.') |
|
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
350 |
directories.register_lazy('git@github.com:', __name__ + '.directory', |
|
0.276.1
by Jelmer Vernooij
Use register_lazy. |
351 |
'GitHubDirectory', |
352 |
'GitHub directory.') |
|
353 |
||
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
354 |
from ...help_topics import ( |
|
0.276.1
by Jelmer Vernooij
Use register_lazy. |
355 |
topic_registry, |
356 |
)
|
|
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
357 |
topic_registry.register_lazy('git', __name__ + '.help', 'help_git', |
|
0.276.1
by Jelmer Vernooij
Use register_lazy. |
358 |
'Using Bazaar with Git') |
359 |
||
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
360 |
from ...foreign import ( |
|
0.276.1
by Jelmer Vernooij
Use register_lazy. |
361 |
foreign_vcs_registry, |
362 |
)
|
|
363 |
foreign_vcs_registry.register_lazy("git", |
|
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
364 |
__name__ + ".mapping", "foreign_vcs_git", "Stupid content tracker") |
|
0.276.1
by Jelmer Vernooij
Use register_lazy. |
365 |
else: |
|
0.200.1646
by Jelmer Vernooij
Rename bzrlib to breezy. |
366 |
register_lazy("breezy.diff", "format_registry", |
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
367 |
'git', __name__ + '.send', 'GitDiffTree', |
|
0.276.1
by Jelmer Vernooij
Use register_lazy. |
368 |
'Git am-style diff format') |
|
0.200.1646
by Jelmer Vernooij
Rename bzrlib to breezy. |
369 |
register_lazy("breezy.send", "format_registry", |
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
370 |
'git', __name__ + '.send', 'send_git', |
|
0.276.1
by Jelmer Vernooij
Use register_lazy. |
371 |
'Git am-style diff format') |
|
0.200.1646
by Jelmer Vernooij
Rename bzrlib to breezy. |
372 |
register_lazy('breezy.directory_service', 'directories', 'github:', |
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
373 |
__name__ + '.directory', 'GitHubDirectory', |
|
0.276.1
by Jelmer Vernooij
Use register_lazy. |
374 |
'GitHub directory.') |
|
0.200.1646
by Jelmer Vernooij
Rename bzrlib to breezy. |
375 |
register_lazy('breezy.directory_service', 'directories', |
|
0.200.1649
by Jelmer Vernooij
Fix imports. |
376 |
'git@github.com:', __name__ + '.directory', |
|
0.276.1
by Jelmer Vernooij
Use register_lazy. |
377 |
'GitHubDirectory', 'GitHub directory.') |
|
0.200.1646
by Jelmer Vernooij
Rename bzrlib to breezy. |
378 |
register_lazy('breezy.help_topics', 'topic_registry', |
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
379 |
'git', __name__ + '.help', 'help_git', |
|
0.276.1
by Jelmer Vernooij
Use register_lazy. |
380 |
'Using Bazaar with Git') |
|
0.200.1646
by Jelmer Vernooij
Rename bzrlib to breezy. |
381 |
register_lazy('breezy.foreign', 'foreign_vcs_registry', "git", |
|
0.200.1645
by Jelmer Vernooij
Use __name__. |
382 |
__name__ + ".mapping", "foreign_vcs_git", "Stupid content tracker") |
|
0.200.1291
by Jelmer Vernooij
add hook for updating to local git cache. |
383 |
|
384 |
def update_git_cache(repository, revid): |
|
385 |
"""Update the git cache after a local commit.""" |
|
386 |
if getattr(repository, "_git", None) is not None: |
|
387 |
return # No need to update cache for git repositories |
|
388 |
||
389 |
if not repository.control_transport.has("git"): |
|
390 |
return # No existing cache, don't bother updating |
|
|
0.200.1384
by Jelmer Vernooij
Skip post commit hook when dulwich is not installed. |
391 |
try: |
392 |
lazy_check_versions() |
|
393 |
except bzr_errors.DependencyNotPresent, e: |
|
394 |
# dulwich is probably missing. silently ignore
|
|
395 |
trace.mutter("not updating git map for %r: %s", |
|
396 |
repository, e) |
|
397 |
||
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
398 |
from .object_store import BazaarObjectStore |
|
0.200.1291
by Jelmer Vernooij
add hook for updating to local git cache. |
399 |
store = BazaarObjectStore(repository) |
|
0.200.1788
by Jelmer Vernooij
Use context managers. |
400 |
with store.lock_write(): |
|
0.200.1583
by Jelmer Vernooij
Use config stacks. |
401 |
try: |
402 |
parent_revisions = set(repository.get_parent_map([revid])[revid]) |
|
403 |
except KeyError: |
|
404 |
# Isn't this a bit odd - how can a revision that was just committed be missing?
|
|
405 |
return
|
|
|
0.200.1319
by Jelmer Vernooij
Only update git cache during post-commit if parents are already in the cache. |
406 |
missing_revisions = store._missing_revisions(parent_revisions) |
407 |
if not missing_revisions: |
|
408 |
# Only update if the cache was up to date previously
|
|
409 |
store._update_sha_map_revision(revid) |
|
|
0.200.1291
by Jelmer Vernooij
add hook for updating to local git cache. |
410 |
|
411 |
||
412 |
def post_commit_update_cache(local_branch, master_branch, old_revno, old_revid, |
|
413 |
new_revno, new_revid): |
|
414 |
if local_branch is not None: |
|
415 |
update_git_cache(local_branch.repository, new_revid) |
|
416 |
update_git_cache(master_branch.repository, new_revid) |
|
417 |
||
418 |
||
|
0.271.5
by Jelmer Vernooij
Hook into loggerhead. |
419 |
def loggerhead_git_hook(branch_app, environ): |
420 |
branch = branch_app.branch |
|
|
0.200.1583
by Jelmer Vernooij
Use config stacks. |
421 |
config_stack = branch.get_config_stack() |
422 |
if config_stack.get('http_git'): |
|
|
0.271.5
by Jelmer Vernooij
Hook into loggerhead. |
423 |
return None |
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
424 |
from .server import git_http_hook |
|
0.271.5
by Jelmer Vernooij
Hook into loggerhead. |
425 |
return git_http_hook(branch, environ['REQUEST_METHOD'], |
426 |
environ['PATH_INFO']) |
|
427 |
||
|
0.200.1646
by Jelmer Vernooij
Rename bzrlib to breezy. |
428 |
install_lazy_named_hook("breezy.branch", |
|
0.200.1559
by Jelmer Vernooij
Fix compatibility with bzr 2.5. |
429 |
"Branch.hooks", "post_commit", post_commit_update_cache, |
430 |
"git cache") |
|
|
0.200.1646
by Jelmer Vernooij
Rename bzrlib to breezy. |
431 |
install_lazy_named_hook("breezy.plugins.loggerhead.apps.branch", |
|
0.200.1559
by Jelmer Vernooij
Fix compatibility with bzr 2.5. |
432 |
"BranchWSGIApp.hooks", "controller", |
433 |
loggerhead_git_hook, "git support") |
|
|
0.200.1291
by Jelmer Vernooij
add hook for updating to local git cache. |
434 |
|
435 |
||
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
436 |
from ...config import ( |
|
0.200.1583
by Jelmer Vernooij
Use config stacks. |
437 |
option_registry, |
438 |
Option, |
|
439 |
bool_from_store, |
|
440 |
)
|
|
441 |
||
442 |
option_registry.register( |
|
443 |
Option('git.http', |
|
444 |
default=None, from_unicode=bool_from_store, invalid='warning', |
|
445 |
help='''\ |
|
446 |
Allow fetching of Git packs over HTTP.
|
|
447 |
||
448 |
This enables support for fetching Git packs over HTTP in Loggerhead.
|
|
449 |
''')) |
|
450 |
||
|
0.201.1
by Jelmer Vernooij
Add very small initial testsuite. |
451 |
def test_suite(): |
|
0.200.1641
by Jelmer Vernooij
Use relative imports where possible. |
452 |
from . import tests |
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
453 |
return tests.test_suite() |