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