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