bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
1 |
# Copyright (C) 2007 Canonical Ltd
|
|
0.200.252
by Jelmer Vernooij
Clarify history, copyright. |
2 |
# Copyright (C) 2008-2009 Jelmer Vernooij <jelmer@samba.org>
|
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
3 |
#
|
4 |
# This program is free software; you can redistribute it and/or modify
|
|
5 |
# it under the terms of the GNU General Public License as published by
|
|
6 |
# the Free Software Foundation; either version 2 of the License, or
|
|
7 |
# (at your option) any later version.
|
|
8 |
#
|
|
9 |
# This program is distributed in the hope that it will be useful,
|
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 |
# GNU General Public License for more details.
|
|
13 |
#
|
|
14 |
# You should have received a copy of the GNU General Public License
|
|
15 |
# along with this program; if not, write to the Free Software
|
|
16 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
17 |
||
18 |
"""An adapter between a Git Repository and a Bazaar Branch"""
|
|
19 |
||
20 |
from bzrlib import ( |
|
|
0.200.43
by David Allouche
Ultra-experimental support for "bzr pull". No test. No sanity. |
21 |
errors, |
|
0.200.38
by David Allouche
Reimplement GitRepository.get_inventory, simpler and faster. |
22 |
inventory, |
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
23 |
repository, |
|
0.200.29
by David Allouche
Smoke test for GitRepository.get_revision, and corresponding fixes. |
24 |
revision, |
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
25 |
)
|
|
0.200.1186
by Jelmer Vernooij
Cope with InventoryRevisionTree. |
26 |
try: |
27 |
from bzrlib.revisiontree import InventoryRevisionTree |
|
28 |
except ImportError: # bzr < 2.4 |
|
29 |
from bzrlib.revisiontree import RevisionTree as InventoryRevisionTree |
|
|
0.200.115
by Jelmer Vernooij
Pass mapping object. |
30 |
from bzrlib.foreign import ( |
|
0.200.292
by Jelmer Vernooij
Fix formatting. |
31 |
ForeignRepository, |
32 |
)
|
|
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
33 |
|
|
0.200.387
by Jelmer Vernooij
Initial work on supporting commit in git trees. |
34 |
from bzrlib.plugins.git.commit import ( |
35 |
GitCommitBuilder, |
|
36 |
)
|
|
|
0.200.256
by Jelmer Vernooij
Add tests for import_revision_gist. |
37 |
from bzrlib.plugins.git.mapping import ( |
38 |
default_mapping, |
|
|
0.200.395
by Jelmer Vernooij
Set vcs attribute on GitRepository. |
39 |
foreign_git, |
|
0.200.256
by Jelmer Vernooij
Add tests for import_revision_gist. |
40 |
mapping_registry, |
41 |
)
|
|
|
0.200.617
by Jelmer Vernooij
Add custom InterTree for use between git revision trees. |
42 |
from bzrlib.plugins.git.tree import ( |
43 |
GitRevisionTree, |
|
44 |
)
|
|
|
0.200.292
by Jelmer Vernooij
Fix formatting. |
45 |
from bzrlib.plugins.git.versionedfiles import ( |
46 |
GitTexts, |
|
47 |
)
|
|
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
48 |
|
49 |
||
|
0.252.21
by Jelmer Vernooij
Fix GitRepository.all_revision_ids() to find all revisions. |
50 |
from dulwich.objects import ( |
51 |
Commit, |
|
|
0.200.1080
by Jelmer Vernooij
Fix handling of annotated tags when cloning from local repo. |
52 |
Tag, |
|
0.200.1153
by Jelmer Vernooij
Import ZERO_SHA from dulwich.objects. |
53 |
ZERO_SHA, |
|
0.252.21
by Jelmer Vernooij
Fix GitRepository.all_revision_ids() to find all revisions. |
54 |
)
|
|
0.200.1233
by Jelmer Vernooij
Implement Repository.iter_files_bytes. |
55 |
from dulwich.object_store import ( |
56 |
tree_lookup_path, |
|
57 |
)
|
|
|
0.252.21
by Jelmer Vernooij
Fix GitRepository.all_revision_ids() to find all revisions. |
58 |
|
59 |
||
|
0.200.115
by Jelmer Vernooij
Pass mapping object. |
60 |
class GitRepository(ForeignRepository): |
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
61 |
"""An adapter to git repositories for bzr.""" |
62 |
||
|
0.200.41
by David Allouche
Define _serializer = None in GitRepository. |
63 |
_serializer = None |
|
0.200.395
by Jelmer Vernooij
Set vcs attribute on GitRepository. |
64 |
vcs = foreign_git |
|
0.200.1086
by Jelmer Vernooij
Provide chk_bytes attribute. |
65 |
chk_bytes = None |
|
0.200.41
by David Allouche
Define _serializer = None in GitRepository. |
66 |
|
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
67 |
def __init__(self, gitdir, lockfiles): |
|
0.200.1120
by Jelmer Vernooij
Set fixed_components, properly write lock repository. |
68 |
ForeignRepository.__init__(self, GitRepositoryFormat(), gitdir, lockfiles) |
|
0.200.291
by Jelmer Vernooij
Print proper error about not supporting push. |
69 |
from bzrlib.plugins.git import fetch, push |
|
0.200.676
by Jelmer Vernooij
Avoid iterating over all keys in the tdb database. |
70 |
for optimiser in [fetch.InterRemoteGitNonGitRepository, |
|
0.200.306
by Jelmer Vernooij
Fix tests, split up InterGitNonGitRepository. |
71 |
fetch.InterLocalGitNonGitRepository, |
|
0.200.456
by Jelmer Vernooij
Fix git -> git fetching. |
72 |
fetch.InterGitGitRepository, |
|
0.200.425
by Jelmer Vernooij
Split out push to remote git repositories. |
73 |
push.InterToLocalGitRepository, |
74 |
push.InterToRemoteGitRepository]: |
|
|
0.200.276
by Jelmer Vernooij
Improve formatting. |
75 |
repository.InterRepository.register_optimiser(optimiser) |
|
0.200.139
by Jelmer Vernooij
Share more code between local and remote classes, support opening remote branches. |
76 |
|
|
0.200.1231
by Jelmer Vernooij
Implement GitRepository.add_fallback_repository. |
77 |
def add_fallback_repository(self, basis_url): |
|
0.200.1236
by Jelmer Vernooij
Fix add_fallback_repository. |
78 |
raise errors.UnstackableRepositoryFormat(self._format, self.root_transport.base) |
|
0.200.1231
by Jelmer Vernooij
Implement GitRepository.add_fallback_repository. |
79 |
|
|
0.200.139
by Jelmer Vernooij
Share more code between local and remote classes, support opening remote branches. |
80 |
def is_shared(self): |
|
0.200.886
by Jelmer Vernooij
Git repositories are not shared. |
81 |
return False |
|
0.200.139
by Jelmer Vernooij
Share more code between local and remote classes, support opening remote branches. |
82 |
|
83 |
def supports_rich_root(self): |
|
84 |
return True |
|
85 |
||
|
0.200.1111
by Jelmer Vernooij
Drop support for Bazaar < 2.3. |
86 |
def _warn_if_deprecated(self, branch=None): # for bzr < 2.4 |
|
0.200.139
by Jelmer Vernooij
Share more code between local and remote classes, support opening remote branches. |
87 |
# This class isn't deprecated
|
88 |
pass
|
|
89 |
||
90 |
def get_mapping(self): |
|
91 |
return default_mapping |
|
92 |
||
|
0.200.147
by Jelmer Vernooij
Merge new dulwich; fetching objects from local repository works now; they aren't converted yet though. |
93 |
def make_working_trees(self): |
|
0.200.1033
by Jelmer Vernooij
Don't claim to support working trees for bare repositories. |
94 |
return not self._git.bare |
|
0.200.139
by Jelmer Vernooij
Share more code between local and remote classes, support opening remote branches. |
95 |
|
|
0.200.557
by Jelmer Vernooij
Implement GitRepository.revision_graph_can_have_wrong_parents(). |
96 |
def revision_graph_can_have_wrong_parents(self): |
97 |
return False |
|
98 |
||
|
0.200.425
by Jelmer Vernooij
Split out push to remote git repositories. |
99 |
def dfetch(self, source, stop_revision): |
100 |
interrepo = repository.InterRepository.get(source, self) |
|
101 |
return interrepo.dfetch(stop_revision) |
|
102 |
||
|
0.200.1158
by Jelmer Vernooij
Implement stub Repositor.add_signature_text. |
103 |
def add_signature_text(self, revid, signature): |
104 |
raise errors.UnsupportedOperation(self.add_signature_text, self) |
|
105 |
||
|
0.200.139
by Jelmer Vernooij
Share more code between local and remote classes, support opening remote branches. |
106 |
|
107 |
class LocalGitRepository(GitRepository): |
|
|
0.200.276
by Jelmer Vernooij
Improve formatting. |
108 |
"""Git repository on the file system.""" |
|
0.200.139
by Jelmer Vernooij
Share more code between local and remote classes, support opening remote branches. |
109 |
|
110 |
def __init__(self, gitdir, lockfiles): |
|
111 |
GitRepository.__init__(self, gitdir, lockfiles) |
|
|
0.200.61
by Jelmer Vernooij
Fix tests. |
112 |
self.base = gitdir.root_transport.base |
|
0.200.90
by Jelmer Vernooij
Basic support for opening working trees. |
113 |
self._git = gitdir._git |
|
0.200.506
by Jelmer Vernooij
Remove bzr-foreign. |
114 |
self.signatures = None |
|
0.200.1232
by Jelmer Vernooij
Kill versionedfiles (GitTexts.get_parent_map isn't even implemented). |
115 |
self.revisions = None |
|
0.200.506
by Jelmer Vernooij
Remove bzr-foreign. |
116 |
self.inventories = None |
|
0.200.209
by Jelmer Vernooij
Pass repository object to versionedfiles. |
117 |
self.texts = GitTexts(self) |
|
0.200.45
by David Allouche
More performance hacking, introduce sqlite cache, escape characters in commits that break serializers. |
118 |
|
|
0.200.1224
by Jelmer Vernooij
provide explicit GitRepository.get_commit_builder. |
119 |
def get_commit_builder(self, branch, parents, config, timestamp=None, |
120 |
timezone=None, committer=None, revprops=None, |
|
121 |
revision_id=None, lossy=False): |
|
122 |
"""Obtain a CommitBuilder for this repository. |
|
123 |
||
124 |
:param branch: Branch to commit to.
|
|
125 |
:param parents: Revision ids of the parents of the new revision.
|
|
126 |
:param config: Configuration to use.
|
|
127 |
:param timestamp: Optional timestamp recorded for commit.
|
|
128 |
:param timezone: Optional timezone for timestamp.
|
|
129 |
:param committer: Optional committer to set for commit.
|
|
130 |
:param revprops: Optional dictionary of revision properties.
|
|
131 |
:param revision_id: Optional revision id.
|
|
132 |
:param lossy: Whether to discard data that can not be natively
|
|
133 |
represented, when pushing to a foreign VCS
|
|
134 |
"""
|
|
|
0.200.1229
by Jelmer Vernooij
Provide CommitBuilder.any_changes. |
135 |
self.start_write_group() |
|
0.200.1224
by Jelmer Vernooij
provide explicit GitRepository.get_commit_builder. |
136 |
return GitCommitBuilder(self, parents, config, |
137 |
timestamp, timezone, committer, revprops, revision_id, |
|
138 |
lossy) |
|
139 |
||
|
0.200.1233
by Jelmer Vernooij
Implement Repository.iter_files_bytes. |
140 |
def iter_files_bytes(self, desired_files): |
141 |
"""Iterate through file versions. |
|
142 |
||
143 |
Files will not necessarily be returned in the order they occur in
|
|
144 |
desired_files. No specific order is guaranteed.
|
|
145 |
||
146 |
Yields pairs of identifier, bytes_iterator. identifier is an opaque
|
|
147 |
value supplied by the caller as part of desired_files. It should
|
|
148 |
uniquely identify the file version in the caller's context. (Examples:
|
|
149 |
an index number or a TreeTransform trans_id.)
|
|
150 |
||
151 |
bytes_iterator is an iterable of bytestrings for the file. The
|
|
152 |
kind of iterable and length of the bytestrings are unspecified, but for
|
|
153 |
this implementation, it is a list of bytes produced by
|
|
154 |
VersionedFile.get_record_stream().
|
|
155 |
||
156 |
:param desired_files: a list of (file_id, revision_id, identifier)
|
|
157 |
triples
|
|
158 |
"""
|
|
159 |
per_revision = {} |
|
160 |
for (file_id, revision_id, identifier) in desired_files: |
|
161 |
per_revision.setdefault(revision_id, []).append((file_id, identifier)) |
|
162 |
for revid, files in per_revision.iteritems(): |
|
163 |
(commit_id, mapping) = self.lookup_bzr_revision_id(revid) |
|
164 |
try: |
|
165 |
commit = self._git.object_store[commit_id] |
|
166 |
except KeyError: |
|
167 |
raise errors.RevisionNotPresent(revid, self) |
|
168 |
root_tree = commit.tree |
|
169 |
for fileid, identifier in files: |
|
170 |
path = mapping.parse_file_id(fileid) |
|
171 |
try: |
|
172 |
obj = tree_lookup_path( |
|
173 |
self._git.object_store.__getitem__, root_tree, path) |
|
174 |
if isinstance(obj, tuple): |
|
175 |
(mode, item_id) = obj |
|
176 |
obj = self._git.object_store[item_id] |
|
177 |
except KeyError: |
|
178 |
raise errors.RevisionNotPresent((fileid, revid), self) |
|
179 |
else: |
|
180 |
if obj.type_name == "tree": |
|
181 |
yield (identifier, []) |
|
182 |
elif obj.type_name == "blob": |
|
183 |
yield (identifier, obj.chunked) |
|
184 |
else: |
|
185 |
raise AssertionError("file text resolved to %r" % obj) |
|
186 |
||
187 |
||
|
0.252.46
by Jelmer Vernooij
Generate refs/bzr/* if not set yet. |
188 |
def _iter_revision_ids(self): |
|
0.200.1021
by Jelmer Vernooij
Put testament sha1 in revisions. |
189 |
mapping = self.get_mapping() |
|
0.252.21
by Jelmer Vernooij
Fix GitRepository.all_revision_ids() to find all revisions. |
190 |
for sha in self._git.object_store: |
191 |
o = self._git.object_store[sha] |
|
192 |
if not isinstance(o, Commit): |
|
193 |
continue
|
|
|
0.200.1029
by Jelmer Vernooij
Use dictionary with verifiers rather than requiring testament3-sha1 everywhere. |
194 |
rev, roundtrip_revid, verifiers = mapping.import_commit(o, |
|
0.261.6
by Jelmer Vernooij
Use mapping.revision_id_foreign_to_bzr to find parents everywhere. |
195 |
mapping.revision_id_foreign_to_bzr) |
|
0.200.1021
by Jelmer Vernooij
Put testament sha1 in revisions. |
196 |
yield o.id, rev.revision_id, roundtrip_revid |
|
0.252.46
by Jelmer Vernooij
Generate refs/bzr/* if not set yet. |
197 |
|
198 |
def all_revision_ids(self): |
|
199 |
ret = set([]) |
|
|
0.200.1021
by Jelmer Vernooij
Put testament sha1 in revisions. |
200 |
for git_sha, revid, roundtrip_revid in self._iter_revision_ids(): |
|
0.252.46
by Jelmer Vernooij
Generate refs/bzr/* if not set yet. |
201 |
ret.add(revid) |
|
0.200.1021
by Jelmer Vernooij
Put testament sha1 in revisions. |
202 |
if roundtrip_revid: |
203 |
ret.add(roundtrip_revid) |
|
|
0.200.74
by Jelmer Vernooij
Implement Repository.all_revision_ids(). |
204 |
return ret |
205 |
||
|
0.200.131
by Jelmer Vernooij
Fix all tests but two, use rich roots by default. |
206 |
def get_parent_map(self, revids): |
207 |
parent_map = {} |
|
208 |
for revision_id in revids: |
|
209 |
assert isinstance(revision_id, str) |
|
210 |
if revision_id == revision.NULL_REVISION: |
|
211 |
parent_map[revision_id] = () |
|
212 |
continue
|
|
|
0.200.650
by Jelmer Vernooij
Use standard names for lookup functions. |
213 |
hexsha, mapping = self.lookup_bzr_revision_id(revision_id) |
|
0.200.612
by Jelmer Vernooij
Cope with Dulwich returning KeyError when a commit is not found. |
214 |
try: |
|
0.200.832
by Jelmer Vernooij
Update to newer version of Dulwich, saner branch names. |
215 |
commit = self._git[hexsha] |
|
0.200.612
by Jelmer Vernooij
Cope with Dulwich returning KeyError when a commit is not found. |
216 |
except KeyError: |
217 |
continue
|
|
|
0.200.1094
by Jelmer Vernooij
Fix test_get_no_parents. |
218 |
parents = [ |
|
0.200.1022
by Jelmer Vernooij
Fix formatting. |
219 |
self.lookup_foreign_revision_id(p, mapping) |
220 |
for p in commit.parents] |
|
|
0.200.1094
by Jelmer Vernooij
Fix test_get_no_parents. |
221 |
if parents == []: |
222 |
parents = [revision.NULL_REVISION] |
|
223 |
parent_map[revision_id] = tuple(parents) |
|
|
0.200.131
by Jelmer Vernooij
Fix all tests but two, use rich roots by default. |
224 |
return parent_map |
225 |
||
226 |
def get_ancestry(self, revision_id, topo_sorted=True): |
|
227 |
"""See Repository.get_ancestry(). |
|
228 |
"""
|
|
229 |
if revision_id is None: |
|
|
0.200.237
by Jelmer Vernooij
Fix get_ancestry() contents. |
230 |
return [None, revision.NULL_REVISION] + self._all_revision_ids() |
|
0.200.131
by Jelmer Vernooij
Fix all tests but two, use rich roots by default. |
231 |
assert isinstance(revision_id, str) |
232 |
ancestry = [] |
|
233 |
graph = self.get_graph() |
|
234 |
for rev, parents in graph.iter_ancestry([revision_id]): |
|
235 |
ancestry.append(rev) |
|
|
0.200.1109
by Jelmer Vernooij
Fix test. |
236 |
if revision.NULL_REVISION in ancestry: |
237 |
ancestry.remove(revision.NULL_REVISION) |
|
|
0.200.131
by Jelmer Vernooij
Fix all tests but two, use rich roots by default. |
238 |
ancestry.reverse() |
|
0.200.237
by Jelmer Vernooij
Fix get_ancestry() contents. |
239 |
return [None] + ancestry |
|
0.200.43
by David Allouche
Ultra-experimental support for "bzr pull". No test. No sanity. |
240 |
|
241 |
def get_signature_text(self, revision_id): |
|
242 |
raise errors.NoSuchRevision(self, revision_id) |
|
243 |
||
|
0.257.1
by Jelmer Vernooij
use transport repo objects even for local access. |
244 |
def pack(self, hint=None, clean_obsolete_packs=False): |
245 |
self._git.object_store.pack_loose_objects() |
|
246 |
||
|
0.200.650
by Jelmer Vernooij
Use standard names for lookup functions. |
247 |
def lookup_foreign_revision_id(self, foreign_revid, mapping=None): |
|
0.200.124
by Jelmer Vernooij
Add lookup_revision_id stub. |
248 |
"""Lookup a revision id. |
|
0.200.676
by Jelmer Vernooij
Avoid iterating over all keys in the tdb database. |
249 |
|
|
0.200.124
by Jelmer Vernooij
Add lookup_revision_id stub. |
250 |
"""
|
|
0.200.1033
by Jelmer Vernooij
Don't claim to support working trees for bare repositories. |
251 |
assert type(foreign_revid) is str |
|
0.200.649
by Jelmer Vernooij
Make GitRevisions VF implementation behave as the interface expects. |
252 |
if mapping is None: |
253 |
mapping = self.get_mapping() |
|
|
0.200.914
by Jelmer Vernooij
Fix tests. |
254 |
if foreign_revid == ZERO_SHA: |
255 |
return revision.NULL_REVISION |
|
|
0.252.45
by Jelmer Vernooij
Finish fetching roundtripped revisions back into bzr. |
256 |
commit = self._git[foreign_revid] |
|
0.200.1080
by Jelmer Vernooij
Fix handling of annotated tags when cloning from local repo. |
257 |
while isinstance(commit, Tag): |
258 |
commit = self._git[commit.object[1]] |
|
|
0.200.1029
by Jelmer Vernooij
Use dictionary with verifiers rather than requiring testament3-sha1 everywhere. |
259 |
rev, roundtrip_revid, verifiers = mapping.import_commit(commit, |
|
0.261.6
by Jelmer Vernooij
Use mapping.revision_id_foreign_to_bzr to find parents everywhere. |
260 |
mapping.revision_id_foreign_to_bzr) |
|
0.200.1021
by Jelmer Vernooij
Put testament sha1 in revisions. |
261 |
# FIXME: check testament before doing this?
|
262 |
if roundtrip_revid: |
|
263 |
return roundtrip_revid |
|
264 |
else: |
|
265 |
return rev.revision_id |
|
|
0.200.124
by Jelmer Vernooij
Add lookup_revision_id stub. |
266 |
|
|
0.200.60
by Jelmer Vernooij
Support signature functions. |
267 |
def has_signature_for_revision_id(self, revision_id): |
268 |
return False |
|
269 |
||
|
0.200.913
by Jelmer Vernooij
Fix tests. |
270 |
def lookup_bzr_revision_id(self, bzr_revid, mapping=None): |
|
0.200.105
by Jelmer Vernooij
Add common function for finding git commit by bzr revid. |
271 |
try: |
|
0.200.195
by Jelmer Vernooij
Return mapping in revision_id_bzr_to_foreign() as required by the interface. |
272 |
return mapping_registry.revision_id_bzr_to_foreign(bzr_revid) |
|
0.200.105
by Jelmer Vernooij
Add common function for finding git commit by bzr revid. |
273 |
except errors.InvalidRevisionId: |
|
0.200.913
by Jelmer Vernooij
Fix tests. |
274 |
if mapping is None: |
275 |
mapping = self.get_mapping() |
|
|
0.252.6
by Jelmer Vernooij
Roundtripping support for revision ids works. |
276 |
try: |
|
0.200.1117
by Jelmer Vernooij
Provide basic implementation of GitDir.clone_on_transport. |
277 |
return (self._git.refs[mapping.revid_as_refname(bzr_revid)], mapping) |
|
0.252.6
by Jelmer Vernooij
Roundtripping support for revision ids works. |
278 |
except KeyError: |
|
0.252.46
by Jelmer Vernooij
Generate refs/bzr/* if not set yet. |
279 |
# Update refs from Git commit objects
|
280 |
# FIXME: Hitting this a lot will be very inefficient...
|
|
|
0.200.1021
by Jelmer Vernooij
Put testament sha1 in revisions. |
281 |
for git_sha, revid, roundtrip_revid in self._iter_revision_ids(): |
282 |
if not roundtrip_revid: |
|
283 |
continue
|
|
|
0.200.1022
by Jelmer Vernooij
Fix formatting. |
284 |
refname = mapping.revid_as_refname(roundtrip_revid) |
285 |
self._git.refs[refname] = git_sha |
|
|
0.200.1021
by Jelmer Vernooij
Put testament sha1 in revisions. |
286 |
if roundtrip_revid == bzr_revid: |
|
0.200.913
by Jelmer Vernooij
Fix tests. |
287 |
return git_sha, mapping |
288 |
raise errors.NoSuchRevision(self, bzr_revid) |
|
|
0.200.105
by Jelmer Vernooij
Add common function for finding git commit by bzr revid. |
289 |
|
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
290 |
def get_revision(self, revision_id): |
|
0.200.1101
by Jelmer Vernooij
Raise InvalidRevisionId on invalid type being specified to Repository.get_revision. |
291 |
if not isinstance(revision_id, str): |
292 |
raise errors.InvalidRevisionId(revision_id, self) |
|
|
0.200.650
by Jelmer Vernooij
Use standard names for lookup functions. |
293 |
git_commit_id, mapping = self.lookup_bzr_revision_id(revision_id) |
|
0.200.147
by Jelmer Vernooij
Merge new dulwich; fetching objects from local repository works now; they aren't converted yet though. |
294 |
try: |
|
0.200.832
by Jelmer Vernooij
Update to newer version of Dulwich, saner branch names. |
295 |
commit = self._git[git_commit_id] |
|
0.200.147
by Jelmer Vernooij
Merge new dulwich; fetching objects from local repository works now; they aren't converted yet though. |
296 |
except KeyError: |
297 |
raise errors.NoSuchRevision(self, revision_id) |
|
|
0.200.1029
by Jelmer Vernooij
Use dictionary with verifiers rather than requiring testament3-sha1 everywhere. |
298 |
revision, roundtrip_revid, verifiers = mapping.import_commit( |
|
0.200.1021
by Jelmer Vernooij
Put testament sha1 in revisions. |
299 |
commit, self.lookup_foreign_revision_id) |
|
0.200.131
by Jelmer Vernooij
Fix all tests but two, use rich roots by default. |
300 |
assert revision is not None |
|
0.200.1029
by Jelmer Vernooij
Use dictionary with verifiers rather than requiring testament3-sha1 everywhere. |
301 |
# FIXME: check verifiers ?
|
|
0.200.1021
by Jelmer Vernooij
Put testament sha1 in revisions. |
302 |
if roundtrip_revid: |
303 |
revision.revision_id = roundtrip_revid |
|
|
0.200.43
by David Allouche
Ultra-experimental support for "bzr pull". No test. No sanity. |
304 |
return revision |
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
305 |
|
306 |
def has_revision(self, revision_id): |
|
|
0.200.1119
by Jelmer Vernooij
Refactor repository initialization. |
307 |
"""See Repository.has_revision.""" |
|
0.200.1122
by Jelmer Vernooij
has_revision(null:) should always return True. |
308 |
if revision_id == revision.NULL_REVISION: |
309 |
return True |
|
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
310 |
try: |
|
0.200.902
by Jelmer Vernooij
Fix Repository.has_revision{s,}. |
311 |
git_commit_id, mapping = self.lookup_bzr_revision_id(revision_id) |
|
0.200.130
by Jelmer Vernooij
Make most tree inspection tests succeed. |
312 |
except errors.NoSuchRevision: |
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
313 |
return False |
|
0.200.902
by Jelmer Vernooij
Fix Repository.has_revision{s,}. |
314 |
return (git_commit_id in self._git) |
315 |
||
316 |
def has_revisions(self, revision_ids): |
|
|
0.200.1119
by Jelmer Vernooij
Refactor repository initialization. |
317 |
"""See Repository.has_revisions.""" |
|
0.200.913
by Jelmer Vernooij
Fix tests. |
318 |
return set(filter(self.has_revision, revision_ids)) |
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
319 |
|
|
0.200.131
by Jelmer Vernooij
Fix all tests but two, use rich roots by default. |
320 |
def get_revisions(self, revids): |
|
0.200.1119
by Jelmer Vernooij
Refactor repository initialization. |
321 |
"""See Repository.get_revisions.""" |
|
0.200.134
by Jelmer Vernooij
Fix get_revisions(). |
322 |
return [self.get_revision(r) for r in revids] |
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
323 |
|
324 |
def revision_trees(self, revids): |
|
|
0.200.1119
by Jelmer Vernooij
Refactor repository initialization. |
325 |
"""See Repository.revision_trees.""" |
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
326 |
for revid in revids: |
327 |
yield self.revision_tree(revid) |
|
328 |
||
329 |
def revision_tree(self, revision_id): |
|
|
0.200.1119
by Jelmer Vernooij
Refactor repository initialization. |
330 |
"""See Repository.revision_tree.""" |
|
0.200.57
by Jelmer Vernooij
Fix more tests. |
331 |
revision_id = revision.ensure_null(revision_id) |
332 |
if revision_id == revision.NULL_REVISION: |
|
333 |
inv = inventory.Inventory(root_id=None) |
|
334 |
inv.revision_id = revision_id |
|
|
0.200.1186
by Jelmer Vernooij
Cope with InventoryRevisionTree. |
335 |
return InventoryRevisionTree(self, inv, revision_id) |
|
0.200.195
by Jelmer Vernooij
Return mapping in revision_id_bzr_to_foreign() as required by the interface. |
336 |
return GitRevisionTree(self, revision_id) |
|
0.200.18
by John Arbash Meinel
Start splitting up the Git{Branch,Dir,Repository} into separate modules, etc. |
337 |
|
338 |
def get_inventory(self, revision_id): |
|
|
0.264.4
by Jelmer Vernooij
No longer implement Repository.get_inventory. |
339 |
raise NotImplementedError(self.get_inventory) |
|
0.200.43
by David Allouche
Ultra-experimental support for "bzr pull". No test. No sanity. |
340 |
|
|
0.200.108
by Jelmer Vernooij
Support bzr init --git. |
341 |
def set_make_working_trees(self, trees): |
|
0.200.1216
by Jelmer Vernooij
Add note about set_make_working_trees. |
342 |
# TODO: Set bare= in the configuration bug=777065
|
|
0.200.1133
by Jelmer Vernooij
Don't support setting working trees flag. |
343 |
raise NotImplementedError(self.set_make_working_trees) |
|
0.200.108
by Jelmer Vernooij
Support bzr init --git. |
344 |
|
|
0.200.276
by Jelmer Vernooij
Improve formatting. |
345 |
def fetch_objects(self, determine_wants, graph_walker, resolve_ext_ref, |
346 |
progress=None): |
|
|
0.200.146
by Jelmer Vernooij
Merge dulwich. |
347 |
return self._git.fetch_objects(determine_wants, graph_walker, progress) |
|
0.200.138
by Jelmer Vernooij
Add initial infrastructure for accessing remote git repositories. |
348 |
|
|
0.200.43
by David Allouche
Ultra-experimental support for "bzr pull". No test. No sanity. |
349 |
|
|
0.200.289
by Jelmer Vernooij
Cope with new member variables in RepositoryFormat. |
350 |
class GitRepositoryFormat(repository.RepositoryFormat): |
|
0.200.429
by Jelmer Vernooij
get remote dpush to a point where we now what to send. |
351 |
"""Git repository format.""" |
|
0.203.1
by Aaron Bentley
Make checkouts work |
352 |
|
353 |
supports_tree_reference = False |
|
|
0.200.133
by Jelmer Vernooij
Unmark as deprecated. |
354 |
rich_root_data = True |
|
0.200.1105
by Jelmer Vernooij
Don't claim to support leaving locks. |
355 |
supports_leaving_lock = False |
|
0.200.1106
by Jelmer Vernooij
Claim to support fast deltas. |
356 |
fast_deltas = True |
|
0.200.1123
by Jelmer Vernooij
Set more repository format flags. |
357 |
supports_funky_characters = True |
|
0.200.1134
by Jelmer Vernooij
Set RepositoryFormat.supports_external_lookups. |
358 |
supports_external_lookups = False |
|
0.200.1135
by Jelmer Vernooij
Set supports_full_versioned_files=False. |
359 |
supports_full_versioned_files = False |
|
0.200.1162
by Jelmer Vernooij
Set RepositoryFormat.supports_revision_signatures. |
360 |
supports_revision_signatures = False |
|
0.200.1166
by Jelmer Vernooij
Set GitRepositoryFormat.revision_graph_can_have_wrong_parents. |
361 |
revision_graph_can_have_wrong_parents = False |
|
0.200.71
by Jelmer Vernooij
Implement GitRepositoryFormat.get_format_description. |
362 |
|
|
0.200.1083
by Jelmer Vernooij
Register repository format. |
363 |
@property
|
364 |
def _matchingbzrdir(self): |
|
365 |
from bzrlib.plugins.git.dir import LocalGitControlDirFormat |
|
366 |
return LocalGitControlDirFormat() |
|
367 |
||
|
0.200.71
by Jelmer Vernooij
Implement GitRepositoryFormat.get_format_description. |
368 |
def get_format_description(self): |
369 |
return "Git Repository" |
|
|
0.200.133
by Jelmer Vernooij
Unmark as deprecated. |
370 |
|
|
0.200.1084
by Jelmer Vernooij
Support 'initializing' repositories in control directories. |
371 |
def initialize(self, controldir, shared=False, _internal=False): |
372 |
from bzrlib.plugins.git.dir import GitDir |
|
373 |
if not isinstance(controldir, GitDir): |
|
374 |
raise errors.UninitializableFormat(self) |
|
375 |
return controldir.open_repository() |
|
|
0.200.133
by Jelmer Vernooij
Unmark as deprecated. |
376 |
|
377 |
def check_conversion_target(self, target_repo_format): |
|
378 |
return target_repo_format.rich_root_data |
|
|
0.200.536
by Jelmer Vernooij
Implement network name. |
379 |
|
|
0.200.658
by Jelmer Vernooij
Provide right infrastructure for foreign repository tests from bzrlib. |
380 |
def get_foreign_tests_repository_factory(self): |
|
0.200.713
by Jelmer Vernooij
Improve formatting. |
381 |
from bzrlib.plugins.git.tests.test_repository import ( |
382 |
ForeignTestsRepositoryFactory, |
|
383 |
)
|
|
|
0.200.658
by Jelmer Vernooij
Provide right infrastructure for foreign repository tests from bzrlib. |
384 |
return ForeignTestsRepositoryFactory() |
385 |
||
|
0.200.536
by Jelmer Vernooij
Implement network name. |
386 |
def network_name(self): |
387 |
return "git" |