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