bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
|
5590.1.6
by John Arbash Meinel
Found another tuned_gzip use in weaverepo |
1 |
# Copyright (C) 2007-2011 Canonical Ltd
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
2 |
#
|
3 |
# This program is free software; you can redistribute it and/or modify
|
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU General Public License
|
|
14 |
# along with this program; if not, write to the Free Software
|
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
16 |
|
|
2803.2.1
by Robert Collins
* CommitBuilder now advertises itself as requiring the root entry to be |
17 |
"""Deprecated weave-based repository formats.
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
18 |
|
|
2803.2.1
by Robert Collins
* CommitBuilder now advertises itself as requiring the root entry to be |
19 |
Weave based formats scaled linearly with history size and could not represent
|
20 |
ghosts.
|
|
21 |
"""
|
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
22 |
|
|
6379.6.7
by Jelmer Vernooij
Move importing from future until after doc string, otherwise the doc string will disappear. |
23 |
from __future__ import absolute_import |
24 |
||
|
5590.1.6
by John Arbash Meinel
Found another tuned_gzip use in weaverepo |
25 |
import gzip |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
26 |
import os |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
27 |
|
|
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
28 |
from ...lazy_import import lazy_import |
|
3224.5.1
by Andrew Bennetts
Lots of assorted hackery to reduce the number of imports for common operations. Improves 'rocks', 'st' and 'help' times by ~50ms on my laptop. |
29 |
lazy_import(globals(), """ |
|
5852.1.8
by Jelmer Vernooij
Simplify revision limiting. |
30 |
import itertools
|
31 |
||
|
6622.1.34
by Jelmer Vernooij
Rename brzlib => breezy. |
32 |
from breezy import (
|
|
5582.10.44
by Jelmer Vernooij
Clean up patch. |
33 |
graph as _mod_graph,
|
34 |
ui,
|
|
35 |
)
|
|
|
6670.4.1
by Jelmer Vernooij
Update imports. |
36 |
from breezy.bzr import (
|
37 |
xml5,
|
|
38 |
)
|
|
|
5582.10.44
by Jelmer Vernooij
Clean up patch. |
39 |
""") |
|
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
40 |
from ... import ( |
|
5582.10.24
by Jelmer Vernooij
Fix imports. |
41 |
debug, |
|
5582.10.44
by Jelmer Vernooij
Clean up patch. |
42 |
errors, |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
43 |
lockable_files, |
44 |
lockdir, |
|
|
2803.2.1
by Robert Collins
* CommitBuilder now advertises itself as requiring the root entry to be |
45 |
osutils, |
|
5184.1.1
by Vincent Ladeuil
Random cleanups to catch up with copyright updates in trunk. |
46 |
trace, |
|
5590.1.6
by John Arbash Meinel
Found another tuned_gzip use in weaverepo |
47 |
tuned_gzip, |
|
3834.2.2
by Martin Pool
Deprecated LockableFiles._escape |
48 |
urlutils, |
|
6670.4.1
by Jelmer Vernooij
Update imports. |
49 |
)
|
50 |
from ...bzr import ( |
|
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
51 |
versionedfile, |
|
5582.10.24
by Jelmer Vernooij
Fix imports. |
52 |
weave, |
|
5582.10.44
by Jelmer Vernooij
Clean up patch. |
53 |
weavefile, |
54 |
)
|
|
|
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
55 |
from ...decorators import needs_read_lock, needs_write_lock |
56 |
from ...repository import ( |
|
|
5537.2.1
by Jelmer Vernooij
Move InterWeaveRepo and InterKnitRepo to related repository files. |
57 |
InterRepository, |
|
6653.2.1
by Jelmer Vernooij
Move bzr-specific repository code out of breezy.bzrrepository. |
58 |
)
|
|
6670.4.1
by Jelmer Vernooij
Update imports. |
59 |
from ...bzr.repository import ( |
|
6349.2.1
by Jelmer Vernooij
Add BzrDirMetaComponentFormat. |
60 |
RepositoryFormatMetaDir, |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
61 |
)
|
|
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
62 |
from ...sixish import ( |
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
63 |
BytesIO, |
|
6695.3.1
by Martin
Remove remaining uses of basestring from the codebase |
64 |
text_type, |
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
65 |
)
|
|
6686.2.1
by Jelmer Vernooij
Move breezy.store to breezy.plugins.weave_fmt, its only user. |
66 |
from .store.text import TextStore |
|
6670.4.1
by Jelmer Vernooij
Update imports. |
67 |
from ...bzr.versionedfile import ( |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
68 |
AbsentContentFactory, |
69 |
FulltextContentFactory, |
|
70 |
VersionedFiles, |
|
71 |
)
|
|
|
6670.4.1
by Jelmer Vernooij
Update imports. |
72 |
from ...bzr.vf_repository import ( |
|
5815.4.19
by Jelmer Vernooij
Fix test failures. |
73 |
InterSameDataRepository, |
|
5815.4.2
by Jelmer Vernooij
split out versionedfile-specific stuff from commitbuilder. |
74 |
VersionedFileCommitBuilder, |
|
5815.4.14
by Jelmer Vernooij
Fix imports. |
75 |
VersionedFileRepository, |
|
5815.4.5
by Jelmer Vernooij
Use MetaDirVersionedFileRepositoryFormat (a Soyuz worthy name). |
76 |
VersionedFileRepositoryFormat, |
77 |
MetaDirVersionedFileRepository, |
|
78 |
MetaDirVersionedFileRepositoryFormat, |
|
|
5815.4.2
by Jelmer Vernooij
split out versionedfile-specific stuff from commitbuilder. |
79 |
)
|
|
5582.10.23
by Jelmer Vernooij
Move bzrlib.weavefile. |
80 |
|
|
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
81 |
from . import bzrdir as weave_bzrdir |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
82 |
|
|
5582.10.23
by Jelmer Vernooij
Move bzrlib.weavefile. |
83 |
|
|
5815.4.14
by Jelmer Vernooij
Fix imports. |
84 |
class AllInOneRepository(VersionedFileRepository): |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
85 |
"""Legacy support - the repository behaviour for all-in-one branches.""" |
86 |
||
|
3224.5.1
by Andrew Bennetts
Lots of assorted hackery to reduce the number of imports for common operations. Improves 'rocks', 'st' and 'help' times by ~50ms on my laptop. |
87 |
@property
|
88 |
def _serializer(self): |
|
89 |
return xml5.serializer_v5 |
|
|
2241.1.8
by Martin Pool
Set the repository's serializer in the places it's needed, not in the base class |
90 |
|
|
3834.2.2
by Martin Pool
Deprecated LockableFiles._escape |
91 |
def _escape(self, file_or_path): |
|
6695.3.1
by Martin
Remove remaining uses of basestring from the codebase |
92 |
if not isinstance(file_or_path, (str, text_type)): |
|
3834.2.2
by Martin Pool
Deprecated LockableFiles._escape |
93 |
file_or_path = '/'.join(file_or_path) |
94 |
if file_or_path == '': |
|
95 |
return u'' |
|
96 |
return urlutils.escape(osutils.safe_unicode(file_or_path)) |
|
97 |
||
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
98 |
def __init__(self, _format, a_controldir): |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
99 |
# we reuse one control files instance.
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
100 |
dir_mode = a_controldir._get_dir_mode() |
101 |
file_mode = a_controldir._get_file_mode() |
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
102 |
|
103 |
def get_store(name, compressed=True, prefixed=False): |
|
104 |
# FIXME: This approach of assuming stores are all entirely compressed
|
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
105 |
# or entirely uncompressed is tidy, but breaks upgrade from
|
106 |
# some existing branches where there's a mixture; we probably
|
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
107 |
# still want the option to look for both.
|
|
3834.2.2
by Martin Pool
Deprecated LockableFiles._escape |
108 |
relpath = self._escape(name) |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
109 |
store = TextStore(a_controldir.transport.clone(relpath), |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
110 |
prefixed=prefixed, compressed=compressed, |
111 |
dir_mode=dir_mode, |
|
112 |
file_mode=file_mode) |
|
113 |
return store |
|
114 |
||
115 |
# not broken out yet because the controlweaves|inventory_store
|
|
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
116 |
# and texts bits are still different.
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
117 |
if isinstance(_format, RepositoryFormat4): |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
118 |
# cannot remove these - there is still no consistent api
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
119 |
# which allows access to this old info.
|
120 |
self.inventory_store = get_store('inventory-store') |
|
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
121 |
self._text_store = get_store('text-store') |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
122 |
super(AllInOneRepository, self).__init__(_format, a_controldir, a_controldir._control_files) |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
123 |
|
|
2850.3.1
by Robert Collins
Move various weave specific code out of the base Repository class to weaverepo.py. |
124 |
@needs_read_lock
|
125 |
def _all_possible_ids(self): |
|
126 |
"""Return all the possible revisions that we could find.""" |
|
127 |
if 'evil' in debug.debug_flags: |
|
|
5184.1.1
by Vincent Ladeuil
Random cleanups to catch up with copyright updates in trunk. |
128 |
trace.mutter_callsite( |
129 |
3, "_all_possible_ids scales with size of history.") |
|
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
130 |
return [key[-1] for key in self.inventories.keys()] |
|
2850.3.1
by Robert Collins
Move various weave specific code out of the base Repository class to weaverepo.py. |
131 |
|
132 |
@needs_read_lock
|
|
133 |
def _all_revision_ids(self): |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
134 |
"""Returns a list of all the revision ids in the repository. |
|
2850.3.1
by Robert Collins
Move various weave specific code out of the base Repository class to weaverepo.py. |
135 |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
136 |
These are in as much topological order as the underlying store can
|
|
2850.3.1
by Robert Collins
Move various weave specific code out of the base Repository class to weaverepo.py. |
137 |
present: for weaves ghosts may lead to a lack of correctness until
|
138 |
the reweave updates the parents list.
|
|
139 |
"""
|
|
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
140 |
return [key[-1] for key in self.revisions.keys()] |
141 |
||
142 |
def _activate_new_inventory(self): |
|
143 |
"""Put a replacement inventory.new into use as inventories.""" |
|
144 |
# Copy the content across
|
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
145 |
t = self.controldir._control_files._transport |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
146 |
t.copy('inventory.new.weave', 'inventory.weave') |
147 |
# delete the temp inventory
|
|
148 |
t.delete('inventory.new.weave') |
|
149 |
# Check we can parse the new weave properly as a sanity check
|
|
150 |
self.inventories.keys() |
|
151 |
||
152 |
def _backup_inventory(self): |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
153 |
t = self.controldir._control_files._transport |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
154 |
t.copy('inventory.weave', 'inventory.backup.weave') |
155 |
||
156 |
def _temp_inventories(self): |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
157 |
t = self.controldir._control_files._transport |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
158 |
return self._format._get_inventories(t, self, 'inventory.new') |
|
2850.3.1
by Robert Collins
Move various weave specific code out of the base Repository class to weaverepo.py. |
159 |
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
160 |
def get_commit_builder(self, branch, parents, config, timestamp=None, |
161 |
timezone=None, committer=None, revprops=None, |
|
|
5777.6.12
by Jelmer Vernooij
Fix get_commit_builder. |
162 |
revision_id=None, lossy=False): |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
163 |
self._check_ascii_revisionid(revision_id, self.get_commit_builder) |
|
5815.4.2
by Jelmer Vernooij
split out versionedfile-specific stuff from commitbuilder. |
164 |
result = VersionedFileCommitBuilder(self, parents, config, timestamp, |
165 |
timezone, committer, revprops, revision_id, lossy=lossy) |
|
|
2803.2.1
by Robert Collins
* CommitBuilder now advertises itself as requiring the root entry to be |
166 |
self.start_write_group() |
167 |
return result |
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
168 |
|
169 |
@needs_read_lock
|
|
|
2850.3.1
by Robert Collins
Move various weave specific code out of the base Repository class to weaverepo.py. |
170 |
def get_revisions(self, revision_ids): |
171 |
revs = self._get_revisions(revision_ids) |
|
172 |
return revs |
|
173 |
||
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
174 |
def _inventory_add_lines(self, revision_id, parents, lines, |
175 |
check_content=True): |
|
176 |
"""Store lines in inv_vf and return the sha1 of the inventory.""" |
|
177 |
present_parents = self.get_graph().get_parent_map(parents) |
|
178 |
final_parents = [] |
|
179 |
for parent in parents: |
|
180 |
if parent in present_parents: |
|
181 |
final_parents.append((parent,)) |
|
182 |
return self.inventories.add_lines((revision_id,), final_parents, lines, |
|
183 |
check_content=check_content)[0] |
|
|
3172.3.1
by Robert Collins
Repository has a new method ``has_revisions`` which signals the presence |
184 |
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
185 |
def is_shared(self): |
186 |
"""AllInOne repositories cannot be shared.""" |
|
187 |
return False |
|
188 |
||
189 |
@needs_write_lock
|
|
190 |
def set_make_working_trees(self, new_value): |
|
191 |
"""Set the policy flag for making working trees when creating branches. |
|
192 |
||
193 |
This only applies to branches that use this repository.
|
|
194 |
||
195 |
The default is 'True'.
|
|
196 |
:param new_value: True to restore the default, False to disable making
|
|
197 |
working trees.
|
|
198 |
"""
|
|
|
5158.6.10
by Martin Pool
Update more code to use user_transport when it should |
199 |
raise errors.RepositoryUpgradeRequired(self.user_url) |
|
3349.1.1
by Aaron Bentley
Enable setting and getting make_working_trees for all repositories |
200 |
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
201 |
def make_working_trees(self): |
202 |
"""Returns the policy for making working trees on new branches.""" |
|
203 |
return True |
|
204 |
||
205 |
||
|
3316.2.3
by Robert Collins
Remove manual notification of transaction finishing on versioned files. |
206 |
class WeaveMetaDirRepository(MetaDirVersionedFileRepository): |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
207 |
"""A subclass of MetaDirRepository to set weave specific policy.""" |
208 |
||
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
209 |
def __init__(self, _format, a_controldir, control_files): |
210 |
super(WeaveMetaDirRepository, self).__init__(_format, a_controldir, control_files) |
|
|
4022.1.1
by Robert Collins
Refactoring of fetch to have a sender and sink component enabling splitting the logic over a network stream. (Robert Collins, Andrew Bennetts) |
211 |
self._serializer = _format._serializer |
|
3565.3.1
by Robert Collins
* The generic fetch code now uses two attributes on Repository objects |
212 |
|
|
2850.3.1
by Robert Collins
Move various weave specific code out of the base Repository class to weaverepo.py. |
213 |
@needs_read_lock
|
214 |
def _all_possible_ids(self): |
|
215 |
"""Return all the possible revisions that we could find.""" |
|
216 |
if 'evil' in debug.debug_flags: |
|
|
5184.1.1
by Vincent Ladeuil
Random cleanups to catch up with copyright updates in trunk. |
217 |
trace.mutter_callsite( |
218 |
3, "_all_possible_ids scales with size of history.") |
|
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
219 |
return [key[-1] for key in self.inventories.keys()] |
|
2850.3.1
by Robert Collins
Move various weave specific code out of the base Repository class to weaverepo.py. |
220 |
|
221 |
@needs_read_lock
|
|
222 |
def _all_revision_ids(self): |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
223 |
"""Returns a list of all the revision ids in the repository. |
|
2850.3.1
by Robert Collins
Move various weave specific code out of the base Repository class to weaverepo.py. |
224 |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
225 |
These are in as much topological order as the underlying store can
|
|
2850.3.1
by Robert Collins
Move various weave specific code out of the base Repository class to weaverepo.py. |
226 |
present: for weaves ghosts may lead to a lack of correctness until
|
227 |
the reweave updates the parents list.
|
|
228 |
"""
|
|
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
229 |
return [key[-1] for key in self.revisions.keys()] |
230 |
||
231 |
def _activate_new_inventory(self): |
|
232 |
"""Put a replacement inventory.new into use as inventories.""" |
|
233 |
# Copy the content across
|
|
234 |
t = self._transport |
|
235 |
t.copy('inventory.new.weave', 'inventory.weave') |
|
236 |
# delete the temp inventory
|
|
237 |
t.delete('inventory.new.weave') |
|
238 |
# Check we can parse the new weave properly as a sanity check
|
|
239 |
self.inventories.keys() |
|
240 |
||
241 |
def _backup_inventory(self): |
|
242 |
t = self._transport |
|
243 |
t.copy('inventory.weave', 'inventory.backup.weave') |
|
244 |
||
245 |
def _temp_inventories(self): |
|
246 |
t = self._transport |
|
247 |
return self._format._get_inventories(t, self, 'inventory.new') |
|
|
2850.3.1
by Robert Collins
Move various weave specific code out of the base Repository class to weaverepo.py. |
248 |
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
249 |
def get_commit_builder(self, branch, parents, config, timestamp=None, |
250 |
timezone=None, committer=None, revprops=None, |
|
|
5777.6.13
by Jelmer Vernooij
Fix get_commit_builder for weaves. |
251 |
revision_id=None, lossy=False): |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
252 |
self._check_ascii_revisionid(revision_id, self.get_commit_builder) |
|
5815.4.2
by Jelmer Vernooij
split out versionedfile-specific stuff from commitbuilder. |
253 |
result = VersionedFileCommitBuilder(self, parents, config, timestamp, |
254 |
timezone, committer, revprops, revision_id, lossy=lossy) |
|
|
2803.2.1
by Robert Collins
* CommitBuilder now advertises itself as requiring the root entry to be |
255 |
self.start_write_group() |
256 |
return result |
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
257 |
|
|
2850.3.1
by Robert Collins
Move various weave specific code out of the base Repository class to weaverepo.py. |
258 |
@needs_read_lock
|
259 |
def get_revision(self, revision_id): |
|
260 |
"""Return the Revision object for a named revision""" |
|
261 |
r = self.get_revision_reconcile(revision_id) |
|
262 |
return r |
|
263 |
||
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
264 |
def _inventory_add_lines(self, revision_id, parents, lines, |
265 |
check_content=True): |
|
266 |
"""Store lines in inv_vf and return the sha1 of the inventory.""" |
|
267 |
present_parents = self.get_graph().get_parent_map(parents) |
|
268 |
final_parents = [] |
|
269 |
for parent in parents: |
|
270 |
if parent in present_parents: |
|
271 |
final_parents.append((parent,)) |
|
272 |
return self.inventories.add_lines((revision_id,), final_parents, lines, |
|
273 |
check_content=check_content)[0] |
|
|
3172.3.1
by Robert Collins
Repository has a new method ``has_revisions`` which signals the presence |
274 |
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
275 |
|
|
5815.4.5
by Jelmer Vernooij
Use MetaDirVersionedFileRepositoryFormat (a Soyuz worthy name). |
276 |
class PreSplitOutRepositoryFormat(VersionedFileRepositoryFormat): |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
277 |
"""Base class for the pre split out repository formats.""" |
278 |
||
279 |
rich_root_data = False |
|
|
2323.5.17
by Martin Pool
Add supports_tree_reference to all repo formats (robert) |
280 |
supports_tree_reference = False |
|
2949.1.2
by Robert Collins
* Fetch with pack repositories will no longer read the entire history graph. |
281 |
supports_ghosts = False |
|
3221.3.1
by Robert Collins
* Repository formats have a new supported-feature attribute |
282 |
supports_external_lookups = False |
|
4246.2.1
by Ian Clatworthy
supports_chks flag on repo formats & log tuning |
283 |
supports_chks = False |
|
6145.2.2
by Jelmer Vernooij
Set supports_nesting_repositories. |
284 |
supports_nesting_repositories = True |
|
4053.1.4
by Robert Collins
Move the fetch control attributes from Repository to RepositoryFormat. |
285 |
_fetch_order = 'topological' |
286 |
_fetch_reconcile = True |
|
|
4183.5.1
by Robert Collins
Add RepositoryFormat.fast_deltas to signal fast delta creation. |
287 |
fast_deltas = False |
|
5674.1.1
by Jelmer Vernooij
Add supports_leave_lock flag to BranchFormat and RepositoryFormat. |
288 |
supports_leaving_lock = False |
|
5766.1.1
by Jelmer Vernooij
Make revision-graph-can-have-wrong-parents a repository format attribute rather than a repository method. |
289 |
# XXX: This is an old format that we don't support full checking on, so
|
290 |
# just claim that checking for this inconsistency is not required.
|
|
291 |
revision_graph_can_have_wrong_parents = False |
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
292 |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
293 |
def initialize(self, a_controldir, shared=False, _internal=False): |
|
2949.1.2
by Robert Collins
* Fetch with pack repositories will no longer read the entire history graph. |
294 |
"""Create a weave repository.""" |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
295 |
if shared: |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
296 |
raise errors.IncompatibleFormat(self, a_controldir._format) |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
297 |
|
298 |
if not _internal: |
|
299 |
# always initialized when the bzrdir is.
|
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
300 |
return self.open(a_controldir, _found=True) |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
301 |
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
302 |
# Create an empty weave
|
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
303 |
sio = BytesIO() |
|
5582.10.44
by Jelmer Vernooij
Clean up patch. |
304 |
weavefile.write_weave_v5(weave.Weave(), sio) |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
305 |
empty_weave = sio.getvalue() |
306 |
||
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
307 |
trace.mutter('creating repository in %s.', a_controldir.transport.base) |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
308 |
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
309 |
# FIXME: RBC 20060125 don't peek under the covers
|
310 |
# NB: no need to escape relative paths that are url safe.
|
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
311 |
control_files = lockable_files.LockableFiles(a_controldir.transport, |
|
3407.2.4
by Martin Pool
Small cleanups to initial creation of repository files |
312 |
'branch-lock', lockable_files.TransportLock) |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
313 |
control_files.create_lock() |
314 |
control_files.lock_write() |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
315 |
transport = a_controldir.transport |
|
3407.2.4
by Martin Pool
Small cleanups to initial creation of repository files |
316 |
try: |
317 |
transport.mkdir_multi(['revision-store', 'weaves'], |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
318 |
mode=a_controldir._get_dir_mode()) |
|
3407.2.18
by Martin Pool
BzrDir takes responsibility for default file/dir modes |
319 |
transport.put_bytes_non_atomic('inventory.weave', empty_weave, |
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
320 |
mode=a_controldir._get_file_mode()) |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
321 |
finally: |
322 |
control_files.unlock() |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
323 |
repository = self.open(a_controldir, _found=True) |
324 |
self._run_post_repo_init_hooks(repository, a_controldir, shared) |
|
|
5107.3.1
by Marco Pantaleoni
Added the new hooks 'post_branch', 'post_switch' and 'post_repo_init', |
325 |
return repository |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
326 |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
327 |
def open(self, a_controldir, _found=False): |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
328 |
"""See RepositoryFormat.open().""" |
329 |
if not _found: |
|
330 |
# we are being called directly and must probe.
|
|
331 |
raise NotImplementedError |
|
332 |
||
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
333 |
repo_transport = a_controldir.get_repository_transport(None) |
334 |
result = AllInOneRepository(_format=self, a_controldir=a_controldir) |
|
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
335 |
result.revisions = self._get_revisions(repo_transport, result) |
336 |
result.signatures = self._get_signatures(repo_transport, result) |
|
337 |
result.inventories = self._get_inventories(repo_transport, result) |
|
338 |
result.texts = self._get_texts(repo_transport, result) |
|
|
4246.2.1
by Ian Clatworthy
supports_chks flag on repo formats & log tuning |
339 |
result.chk_bytes = None |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
340 |
return result |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
341 |
|
|
5675.2.1
by Jelmer Vernooij
Add RepositoryFormat.is_deprecated(). This removes the need for |
342 |
def is_deprecated(self): |
343 |
return True |
|
344 |
||
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
345 |
|
346 |
class RepositoryFormat4(PreSplitOutRepositoryFormat): |
|
347 |
"""Bzr repository format 4. |
|
348 |
||
349 |
This repository format has:
|
|
350 |
- flat stores
|
|
351 |
- TextStores for texts, inventories,revisions.
|
|
352 |
||
353 |
This format is deprecated: it indexes texts using a text id which is
|
|
354 |
removed in format 5; initialization and write support for this format
|
|
355 |
has been removed.
|
|
356 |
"""
|
|
357 |
||
|
5582.9.1
by Jelmer Vernooij
Add flag for 'supports_funky_characters'. |
358 |
supports_funky_characters = False |
359 |
||
|
5582.10.44
by Jelmer Vernooij
Clean up patch. |
360 |
_matchingbzrdir = weave_bzrdir.BzrDirFormat4() |
|
2241.1.11
by Martin Pool
Get rid of RepositoryFormat*_instance objects. Instead the format |
361 |
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
362 |
def get_format_description(self): |
363 |
"""See RepositoryFormat.get_format_description().""" |
|
364 |
return "Repository format 4" |
|
365 |
||
366 |
def initialize(self, url, shared=False, _internal=False): |
|
367 |
"""Format 4 branches cannot be created.""" |
|
368 |
raise errors.UninitializableFormat(self) |
|
369 |
||
370 |
def is_supported(self): |
|
371 |
"""Format 4 is not supported. |
|
372 |
||
373 |
It is not supported because the model changed from 4 to 5 and the
|
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
374 |
conversion logic is expensive - so doing it on the fly was not
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
375 |
feasible.
|
376 |
"""
|
|
377 |
return False |
|
378 |
||
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
379 |
def _get_inventories(self, repo_transport, repo, name='inventory'): |
380 |
# No inventories store written so far.
|
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
381 |
return None |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
382 |
|
383 |
def _get_revisions(self, repo_transport, repo): |
|
|
6624
by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes') |
384 |
from .xml4 import serializer_v4 |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
385 |
return RevisionTextStore(repo_transport.clone('revision-store'), |
386 |
serializer_v4, True, versionedfile.PrefixMapper(), |
|
387 |
repo.is_locked, repo.is_write_locked) |
|
388 |
||
389 |
def _get_signatures(self, repo_transport, repo): |
|
390 |
return SignatureTextStore(repo_transport.clone('revision-store'), |
|
391 |
False, versionedfile.PrefixMapper(), |
|
392 |
repo.is_locked, repo.is_write_locked) |
|
393 |
||
394 |
def _get_texts(self, repo_transport, repo): |
|
395 |
return None |
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
396 |
|
397 |
||
398 |
class RepositoryFormat5(PreSplitOutRepositoryFormat): |
|
399 |
"""Bzr control format 5. |
|
400 |
||
401 |
This repository format has:
|
|
402 |
- weaves for file texts and inventory
|
|
403 |
- flat stores
|
|
404 |
- TextStores for revisions and signatures.
|
|
405 |
"""
|
|
406 |
||
|
5582.10.42
by Jelmer Vernooij
Some weave fixes. |
407 |
_versionedfile_class = weave.WeaveFile |
|
5582.10.44
by Jelmer Vernooij
Clean up patch. |
408 |
_matchingbzrdir = weave_bzrdir.BzrDirFormat5() |
|
5582.9.1
by Jelmer Vernooij
Add flag for 'supports_funky_characters'. |
409 |
supports_funky_characters = False |
410 |
||
|
4022.1.1
by Robert Collins
Refactoring of fetch to have a sender and sink component enabling splitting the logic over a network stream. (Robert Collins, Andrew Bennetts) |
411 |
@property
|
412 |
def _serializer(self): |
|
413 |
return xml5.serializer_v5 |
|
|
2241.1.10
by Martin Pool
Remove more references to weaves from the repository.py file |
414 |
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
415 |
def get_format_description(self): |
416 |
"""See RepositoryFormat.get_format_description().""" |
|
417 |
return "Weave repository format 5" |
|
|
4032.1.2
by John Arbash Meinel
Track down a few more files that have trailing whitespace. |
418 |
|
|
3990.5.1
by Andrew Bennetts
Add network_name() to RepositoryFormat. |
419 |
def network_name(self): |
|
3990.5.3
by Robert Collins
Docs and polish on RepositoryFormat.network_name. |
420 |
"""The network name for this format is the control dirs disk label.""" |
|
3990.5.1
by Andrew Bennetts
Add network_name() to RepositoryFormat. |
421 |
return self._matchingbzrdir.get_format_string() |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
422 |
|
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
423 |
def _get_inventories(self, repo_transport, repo, name='inventory'): |
424 |
mapper = versionedfile.ConstantMapper(name) |
|
425 |
return versionedfile.ThunkedVersionedFiles(repo_transport, |
|
|
5582.10.42
by Jelmer Vernooij
Some weave fixes. |
426 |
weave.WeaveFile, mapper, repo.is_locked) |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
427 |
|
428 |
def _get_revisions(self, repo_transport, repo): |
|
429 |
return RevisionTextStore(repo_transport.clone('revision-store'), |
|
|
4022.1.1
by Robert Collins
Refactoring of fetch to have a sender and sink component enabling splitting the logic over a network stream. (Robert Collins, Andrew Bennetts) |
430 |
xml5.serializer_v5, False, versionedfile.PrefixMapper(), |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
431 |
repo.is_locked, repo.is_write_locked) |
432 |
||
433 |
def _get_signatures(self, repo_transport, repo): |
|
434 |
return SignatureTextStore(repo_transport.clone('revision-store'), |
|
435 |
False, versionedfile.PrefixMapper(), |
|
436 |
repo.is_locked, repo.is_write_locked) |
|
437 |
||
438 |
def _get_texts(self, repo_transport, repo): |
|
439 |
mapper = versionedfile.PrefixMapper() |
|
440 |
base_transport = repo_transport.clone('weaves') |
|
441 |
return versionedfile.ThunkedVersionedFiles(base_transport, |
|
|
5582.10.42
by Jelmer Vernooij
Some weave fixes. |
442 |
weave.WeaveFile, mapper, repo.is_locked) |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
443 |
|
444 |
||
445 |
class RepositoryFormat6(PreSplitOutRepositoryFormat): |
|
446 |
"""Bzr control format 6. |
|
447 |
||
448 |
This repository format has:
|
|
449 |
- weaves for file texts and inventory
|
|
450 |
- hash subdirectory based stores.
|
|
451 |
- TextStores for revisions and signatures.
|
|
452 |
"""
|
|
453 |
||
|
5582.10.42
by Jelmer Vernooij
Some weave fixes. |
454 |
_versionedfile_class = weave.WeaveFile |
|
5582.10.44
by Jelmer Vernooij
Clean up patch. |
455 |
_matchingbzrdir = weave_bzrdir.BzrDirFormat6() |
|
5582.9.1
by Jelmer Vernooij
Add flag for 'supports_funky_characters'. |
456 |
supports_funky_characters = False |
|
4022.1.1
by Robert Collins
Refactoring of fetch to have a sender and sink component enabling splitting the logic over a network stream. (Robert Collins, Andrew Bennetts) |
457 |
@property
|
458 |
def _serializer(self): |
|
459 |
return xml5.serializer_v5 |
|
|
2241.1.10
by Martin Pool
Remove more references to weaves from the repository.py file |
460 |
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
461 |
def get_format_description(self): |
462 |
"""See RepositoryFormat.get_format_description().""" |
|
463 |
return "Weave repository format 6" |
|
464 |
||
|
3990.5.1
by Andrew Bennetts
Add network_name() to RepositoryFormat. |
465 |
def network_name(self): |
|
3990.5.3
by Robert Collins
Docs and polish on RepositoryFormat.network_name. |
466 |
"""The network name for this format is the control dirs disk label.""" |
|
3990.5.1
by Andrew Bennetts
Add network_name() to RepositoryFormat. |
467 |
return self._matchingbzrdir.get_format_string() |
468 |
||
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
469 |
def _get_inventories(self, repo_transport, repo, name='inventory'): |
470 |
mapper = versionedfile.ConstantMapper(name) |
|
471 |
return versionedfile.ThunkedVersionedFiles(repo_transport, |
|
|
5582.10.42
by Jelmer Vernooij
Some weave fixes. |
472 |
weave.WeaveFile, mapper, repo.is_locked) |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
473 |
|
474 |
def _get_revisions(self, repo_transport, repo): |
|
475 |
return RevisionTextStore(repo_transport.clone('revision-store'), |
|
|
4022.1.1
by Robert Collins
Refactoring of fetch to have a sender and sink component enabling splitting the logic over a network stream. (Robert Collins, Andrew Bennetts) |
476 |
xml5.serializer_v5, False, versionedfile.HashPrefixMapper(), |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
477 |
repo.is_locked, repo.is_write_locked) |
478 |
||
479 |
def _get_signatures(self, repo_transport, repo): |
|
480 |
return SignatureTextStore(repo_transport.clone('revision-store'), |
|
481 |
False, versionedfile.HashPrefixMapper(), |
|
482 |
repo.is_locked, repo.is_write_locked) |
|
483 |
||
484 |
def _get_texts(self, repo_transport, repo): |
|
485 |
mapper = versionedfile.HashPrefixMapper() |
|
486 |
base_transport = repo_transport.clone('weaves') |
|
487 |
return versionedfile.ThunkedVersionedFiles(base_transport, |
|
|
5582.10.42
by Jelmer Vernooij
Some weave fixes. |
488 |
weave.WeaveFile, mapper, repo.is_locked) |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
489 |
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
490 |
|
|
5815.4.5
by Jelmer Vernooij
Use MetaDirVersionedFileRepositoryFormat (a Soyuz worthy name). |
491 |
class RepositoryFormat7(MetaDirVersionedFileRepositoryFormat): |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
492 |
"""Bzr repository 7. |
493 |
||
494 |
This repository format has:
|
|
495 |
- weaves for file texts and inventory
|
|
496 |
- hash subdirectory based stores.
|
|
497 |
- TextStores for revisions and signatures.
|
|
498 |
- a format marker of its own
|
|
499 |
- an optional 'shared-storage' flag
|
|
500 |
- an optional 'no-working-trees' flag
|
|
501 |
"""
|
|
502 |
||
|
5582.10.42
by Jelmer Vernooij
Some weave fixes. |
503 |
_versionedfile_class = weave.WeaveFile |
|
2949.1.2
by Robert Collins
* Fetch with pack repositories will no longer read the entire history graph. |
504 |
supports_ghosts = False |
|
4246.2.1
by Ian Clatworthy
supports_chks flag on repo formats & log tuning |
505 |
supports_chks = False |
|
5609.4.1
by Jelmer Vernooij
Mark RepositoryFormat7 as not supporting funky character file names. This should fix the tests on Windows. |
506 |
supports_funky_characters = False |
|
5766.1.4
by Jelmer Vernooij
Set revision_graph_can_have_wrong_parents on RepositoryFormat7. |
507 |
revision_graph_can_have_wrong_parents = False |
|
4246.2.1
by Ian Clatworthy
supports_chks flag on repo formats & log tuning |
508 |
|
|
4053.1.4
by Robert Collins
Move the fetch control attributes from Repository to RepositoryFormat. |
509 |
_fetch_order = 'topological' |
510 |
_fetch_reconcile = True |
|
|
4183.5.1
by Robert Collins
Add RepositoryFormat.fast_deltas to signal fast delta creation. |
511 |
fast_deltas = False |
|
4022.1.1
by Robert Collins
Refactoring of fetch to have a sender and sink component enabling splitting the logic over a network stream. (Robert Collins, Andrew Bennetts) |
512 |
@property
|
513 |
def _serializer(self): |
|
514 |
return xml5.serializer_v5 |
|
|
2241.1.10
by Martin Pool
Remove more references to weaves from the repository.py file |
515 |
|
|
6213.1.16
by Jelmer Vernooij
Feature support in repository. |
516 |
@classmethod
|
517 |
def get_format_string(cls): |
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
518 |
"""See RepositoryFormat.get_format_string().""" |
519 |
return "Bazaar-NG Repository format 7" |
|
520 |
||
521 |
def get_format_description(self): |
|
522 |
"""See RepositoryFormat.get_format_description().""" |
|
523 |
return "Weave repository format 7" |
|
524 |
||
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
525 |
def _get_inventories(self, repo_transport, repo, name='inventory'): |
526 |
mapper = versionedfile.ConstantMapper(name) |
|
527 |
return versionedfile.ThunkedVersionedFiles(repo_transport, |
|
|
5582.10.42
by Jelmer Vernooij
Some weave fixes. |
528 |
weave.WeaveFile, mapper, repo.is_locked) |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
529 |
|
530 |
def _get_revisions(self, repo_transport, repo): |
|
531 |
return RevisionTextStore(repo_transport.clone('revision-store'), |
|
|
4022.1.1
by Robert Collins
Refactoring of fetch to have a sender and sink component enabling splitting the logic over a network stream. (Robert Collins, Andrew Bennetts) |
532 |
xml5.serializer_v5, True, versionedfile.HashPrefixMapper(), |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
533 |
repo.is_locked, repo.is_write_locked) |
534 |
||
535 |
def _get_signatures(self, repo_transport, repo): |
|
536 |
return SignatureTextStore(repo_transport.clone('revision-store'), |
|
537 |
True, versionedfile.HashPrefixMapper(), |
|
538 |
repo.is_locked, repo.is_write_locked) |
|
539 |
||
540 |
def _get_texts(self, repo_transport, repo): |
|
541 |
mapper = versionedfile.HashPrefixMapper() |
|
542 |
base_transport = repo_transport.clone('weaves') |
|
543 |
return versionedfile.ThunkedVersionedFiles(base_transport, |
|
|
5582.10.42
by Jelmer Vernooij
Some weave fixes. |
544 |
weave.WeaveFile, mapper, repo.is_locked) |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
545 |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
546 |
def initialize(self, a_controldir, shared=False): |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
547 |
"""Create a weave repository. |
548 |
||
549 |
:param shared: If true the repository will be initialized as a shared
|
|
550 |
repository.
|
|
551 |
"""
|
|
552 |
# Create an empty weave
|
|
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
553 |
sio = BytesIO() |
|
5582.10.44
by Jelmer Vernooij
Clean up patch. |
554 |
weavefile.write_weave_v5(weave.Weave(), sio) |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
555 |
empty_weave = sio.getvalue() |
556 |
||
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
557 |
trace.mutter('creating repository in %s.', a_controldir.transport.base) |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
558 |
dirs = ['revision-store', 'weaves'] |
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
559 |
files = [('inventory.weave', BytesIO(empty_weave)), |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
560 |
]
|
561 |
utf8_files = [('format', self.get_format_string())] |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
562 |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
563 |
self._upload_blank_content(a_controldir, dirs, files, utf8_files, shared) |
564 |
return self.open(a_controldir=a_controldir, _found=True) |
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
565 |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
566 |
def open(self, a_controldir, _found=False, _override_transport=None): |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
567 |
"""See RepositoryFormat.open(). |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
568 |
|
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
569 |
:param _override_transport: INTERNAL USE ONLY. Allows opening the
|
570 |
repository at a slightly different url
|
|
571 |
than normal. I.e. during 'upgrade'.
|
|
572 |
"""
|
|
573 |
if not _found: |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
574 |
format = RepositoryFormatMetaDir.find_format(a_controldir) |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
575 |
if _override_transport is not None: |
576 |
repo_transport = _override_transport |
|
577 |
else: |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
578 |
repo_transport = a_controldir.get_repository_transport(None) |
|
2241.1.4
by Martin Pool
Moved old weave-based repository formats into bzrlib.repofmt.weaverepo. |
579 |
control_files = lockable_files.LockableFiles(repo_transport, |
580 |
'lock', lockdir.LockDir) |
|
|
6653.6.1
by Jelmer Vernooij
Rename a number of attributes from bzrdir to controldir. |
581 |
result = WeaveMetaDirRepository(_format=self, a_controldir=a_controldir, |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
582 |
control_files=control_files) |
583 |
result.revisions = self._get_revisions(repo_transport, result) |
|
584 |
result.signatures = self._get_signatures(repo_transport, result) |
|
585 |
result.inventories = self._get_inventories(repo_transport, result) |
|
586 |
result.texts = self._get_texts(repo_transport, result) |
|
|
4246.2.1
by Ian Clatworthy
supports_chks flag on repo formats & log tuning |
587 |
result.chk_bytes = None |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
588 |
result._transport = repo_transport |
589 |
return result |
|
590 |
||
|
5675.2.1
by Jelmer Vernooij
Add RepositoryFormat.is_deprecated(). This removes the need for |
591 |
def is_deprecated(self): |
592 |
return True |
|
593 |
||
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
594 |
|
595 |
class TextVersionedFiles(VersionedFiles): |
|
596 |
"""Just-a-bunch-of-files based VersionedFile stores.""" |
|
597 |
||
598 |
def __init__(self, transport, compressed, mapper, is_locked, can_write): |
|
599 |
self._compressed = compressed |
|
600 |
self._transport = transport |
|
601 |
self._mapper = mapper |
|
602 |
if self._compressed: |
|
603 |
self._ext = '.gz' |
|
604 |
else: |
|
605 |
self._ext = '' |
|
606 |
self._is_locked = is_locked |
|
607 |
self._can_write = can_write |
|
608 |
||
609 |
def add_lines(self, key, parents, lines): |
|
610 |
"""Add a revision to the store.""" |
|
611 |
if not self._is_locked(): |
|
612 |
raise errors.ObjectNotLocked(self) |
|
613 |
if not self._can_write(): |
|
614 |
raise errors.ReadOnlyError(self) |
|
615 |
if '/' in key[-1]: |
|
|
3350.6.10
by Martin Pool
VersionedFiles review cleanups |
616 |
raise ValueError('bad idea to put / in %r' % (key,)) |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
617 |
text = ''.join(lines) |
618 |
if self._compressed: |
|
|
5590.1.6
by John Arbash Meinel
Found another tuned_gzip use in weaverepo |
619 |
text = tuned_gzip.bytes_to_gzip(text) |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
620 |
path = self._map(key) |
621 |
self._transport.put_bytes_non_atomic(path, text, create_parent_dir=True) |
|
622 |
||
|
5195.3.26
by Parth Malwankar
reverted changes done to insert_record_stream API |
623 |
def insert_record_stream(self, stream): |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
624 |
adapters = {} |
625 |
for record in stream: |
|
626 |
# Raise an error when a record is missing.
|
|
627 |
if record.storage_kind == 'absent': |
|
628 |
raise errors.RevisionNotPresent([record.key[0]], self) |
|
629 |
# adapt to non-tuple interface
|
|
630 |
if record.storage_kind == 'fulltext': |
|
631 |
self.add_lines(record.key, None, |
|
632 |
osutils.split_lines(record.get_bytes_as('fulltext'))) |
|
633 |
else: |
|
634 |
adapter_key = record.storage_kind, 'fulltext' |
|
635 |
try: |
|
636 |
adapter = adapters[adapter_key] |
|
637 |
except KeyError: |
|
638 |
adapter_factory = adapter_registry.get(adapter_key) |
|
639 |
adapter = adapter_factory(self) |
|
640 |
adapters[adapter_key] = adapter |
|
641 |
lines = osutils.split_lines(adapter.get_bytes( |
|
642 |
record, record.get_bytes_as(record.storage_kind))) |
|
643 |
try: |
|
644 |
self.add_lines(record.key, None, lines) |
|
|
5815.4.17
by Jelmer Vernooij
Remove unused test method. |
645 |
except errors.RevisionAlreadyPresent: |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
646 |
pass
|
647 |
||
648 |
def _load_text(self, key): |
|
649 |
if not self._is_locked(): |
|
650 |
raise errors.ObjectNotLocked(self) |
|
651 |
path = self._map(key) |
|
652 |
try: |
|
653 |
text = self._transport.get_bytes(path) |
|
654 |
compressed = self._compressed |
|
655 |
except errors.NoSuchFile: |
|
656 |
if self._compressed: |
|
657 |
# try without the .gz
|
|
658 |
path = path[:-3] |
|
659 |
try: |
|
660 |
text = self._transport.get_bytes(path) |
|
661 |
compressed = False |
|
662 |
except errors.NoSuchFile: |
|
663 |
return None |
|
664 |
else: |
|
665 |
return None |
|
666 |
if compressed: |
|
|
6621.22.2
by Martin
Use BytesIO or StringIO from bzrlib.sixish |
667 |
text = gzip.GzipFile(mode='rb', fileobj=BytesIO(text)).read() |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
668 |
return text |
669 |
||
670 |
def _map(self, key): |
|
671 |
return self._mapper.map(key) + self._ext |
|
672 |
||
673 |
||
674 |
class RevisionTextStore(TextVersionedFiles): |
|
675 |
"""Legacy thunk for format 4 repositories.""" |
|
676 |
||
677 |
def __init__(self, transport, serializer, compressed, mapper, is_locked, |
|
678 |
can_write): |
|
679 |
"""Create a RevisionTextStore at transport with serializer.""" |
|
680 |
TextVersionedFiles.__init__(self, transport, compressed, mapper, |
|
681 |
is_locked, can_write) |
|
682 |
self._serializer = serializer |
|
683 |
||
684 |
def _load_text_parents(self, key): |
|
685 |
text = self._load_text(key) |
|
686 |
if text is None: |
|
687 |
return None, None |
|
688 |
parents = self._serializer.read_revision_from_string(text).parent_ids |
|
689 |
return text, tuple((parent,) for parent in parents) |
|
690 |
||
691 |
def get_parent_map(self, keys): |
|
692 |
result = {} |
|
693 |
for key in keys: |
|
694 |
parents = self._load_text_parents(key)[1] |
|
695 |
if parents is None: |
|
696 |
continue
|
|
697 |
result[key] = parents |
|
698 |
return result |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
699 |
|
|
4593.5.34
by John Arbash Meinel
Change the KnownGraph.merge_sort api. |
700 |
def get_known_graph_ancestry(self, keys): |
701 |
"""Get a KnownGraph instance with the ancestry of keys.""" |
|
702 |
keys = self.keys() |
|
703 |
parent_map = self.get_parent_map(keys) |
|
704 |
kg = _mod_graph.KnownGraph(parent_map) |
|
705 |
return kg |
|
706 |
||
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
707 |
def get_record_stream(self, keys, sort_order, include_delta_closure): |
708 |
for key in keys: |
|
709 |
text, parents = self._load_text_parents(key) |
|
710 |
if text is None: |
|
711 |
yield AbsentContentFactory(key) |
|
712 |
else: |
|
713 |
yield FulltextContentFactory(key, parents, None, text) |
|
714 |
||
715 |
def keys(self): |
|
716 |
if not self._is_locked(): |
|
717 |
raise errors.ObjectNotLocked(self) |
|
718 |
relpaths = set() |
|
719 |
for quoted_relpath in self._transport.iter_files_recursive(): |
|
|
6379.4.2
by Jelmer Vernooij
Add urlutils.quote / urlutils.unquote. |
720 |
relpath = urlutils.unquote(quoted_relpath) |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
721 |
path, ext = os.path.splitext(relpath) |
722 |
if ext == '.gz': |
|
723 |
relpath = path |
|
|
4695.2.1
by Vincent Ladeuil
Align RevisionTextStore and SignatureTextStore keys() definitions. |
724 |
if not relpath.endswith('.sig'): |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
725 |
relpaths.add(relpath) |
726 |
paths = list(relpaths) |
|
|
6619.3.12
by Jelmer Vernooij
Use 2to3 set_literal fixer. |
727 |
return {self._mapper.unmap(path) for path in paths} |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
728 |
|
729 |
||
730 |
class SignatureTextStore(TextVersionedFiles): |
|
731 |
"""Legacy thunk for format 4-7 repositories.""" |
|
732 |
||
733 |
def __init__(self, transport, compressed, mapper, is_locked, can_write): |
|
734 |
TextVersionedFiles.__init__(self, transport, compressed, mapper, |
|
735 |
is_locked, can_write) |
|
736 |
self._ext = '.sig' + self._ext |
|
737 |
||
738 |
def get_parent_map(self, keys): |
|
739 |
result = {} |
|
740 |
for key in keys: |
|
741 |
text = self._load_text(key) |
|
742 |
if text is None: |
|
743 |
continue
|
|
744 |
result[key] = None |
|
745 |
return result |
|
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
746 |
|
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
747 |
def get_record_stream(self, keys, sort_order, include_delta_closure): |
748 |
for key in keys: |
|
749 |
text = self._load_text(key) |
|
750 |
if text is None: |
|
751 |
yield AbsentContentFactory(key) |
|
752 |
else: |
|
753 |
yield FulltextContentFactory(key, None, None, text) |
|
754 |
||
755 |
def keys(self): |
|
756 |
if not self._is_locked(): |
|
757 |
raise errors.ObjectNotLocked(self) |
|
758 |
relpaths = set() |
|
759 |
for quoted_relpath in self._transport.iter_files_recursive(): |
|
|
6379.4.2
by Jelmer Vernooij
Add urlutils.quote / urlutils.unquote. |
760 |
relpath = urlutils.unquote(quoted_relpath) |
|
3350.6.4
by Robert Collins
First cut at pluralised VersionedFiles. Some rather massive API incompatabilities, primarily because of the difficulty of coherence among competing stores. |
761 |
path, ext = os.path.splitext(relpath) |
762 |
if ext == '.gz': |
|
763 |
relpath = path |
|
764 |
if not relpath.endswith('.sig'): |
|
765 |
continue
|
|
766 |
relpaths.add(relpath[:-4]) |
|
767 |
paths = list(relpaths) |
|
|
6619.3.12
by Jelmer Vernooij
Use 2to3 set_literal fixer. |
768 |
return {self._mapper.unmap(path) for path in paths} |
|
2803.2.1
by Robert Collins
* CommitBuilder now advertises itself as requiring the root entry to be |
769 |
|
|
5537.2.1
by Jelmer Vernooij
Move InterWeaveRepo and InterKnitRepo to related repository files. |
770 |
|
771 |
class InterWeaveRepo(InterSameDataRepository): |
|
772 |
"""Optimised code paths between Weave based repositories. |
|
773 |
"""
|
|
774 |
||
775 |
@classmethod
|
|
776 |
def _get_repo_format_to_test(self): |
|
777 |
return RepositoryFormat7() |
|
778 |
||
779 |
@staticmethod
|
|
780 |
def is_compatible(source, target): |
|
781 |
"""Be compatible with known Weave formats. |
|
782 |
||
783 |
We don't test for the stores being of specific types because that
|
|
784 |
could lead to confusing results, and there is no need to be
|
|
785 |
overly general.
|
|
786 |
"""
|
|
787 |
try: |
|
788 |
return (isinstance(source._format, (RepositoryFormat5, |
|
789 |
RepositoryFormat6, |
|
790 |
RepositoryFormat7)) and |
|
791 |
isinstance(target._format, (RepositoryFormat5, |
|
792 |
RepositoryFormat6, |
|
793 |
RepositoryFormat7))) |
|
794 |
except AttributeError: |
|
795 |
return False |
|
796 |
||
797 |
@needs_write_lock
|
|
798 |
def copy_content(self, revision_id=None): |
|
799 |
"""See InterRepository.copy_content().""" |
|
800 |
# weave specific optimised path:
|
|
801 |
try: |
|
802 |
self.target.set_make_working_trees(self.source.make_working_trees()) |
|
803 |
except (errors.RepositoryUpgradeRequired, NotImplemented): |
|
804 |
pass
|
|
805 |
# FIXME do not peek!
|
|
806 |
if self.source._transport.listable(): |
|
807 |
pb = ui.ui_factory.nested_progress_bar() |
|
808 |
try: |
|
809 |
self.target.texts.insert_record_stream( |
|
810 |
self.source.texts.get_record_stream( |
|
811 |
self.source.texts.keys(), 'topological', False)) |
|
812 |
pb.update('Copying inventory', 0, 1) |
|
813 |
self.target.inventories.insert_record_stream( |
|
814 |
self.source.inventories.get_record_stream( |
|
815 |
self.source.inventories.keys(), 'topological', False)) |
|
816 |
self.target.signatures.insert_record_stream( |
|
817 |
self.source.signatures.get_record_stream( |
|
818 |
self.source.signatures.keys(), |
|
819 |
'unordered', True)) |
|
820 |
self.target.revisions.insert_record_stream( |
|
821 |
self.source.revisions.get_record_stream( |
|
822 |
self.source.revisions.keys(), |
|
823 |
'topological', True)) |
|
824 |
finally: |
|
825 |
pb.finished() |
|
826 |
else: |
|
827 |
self.target.fetch(self.source, revision_id=revision_id) |
|
828 |
||
829 |
@needs_read_lock
|
|
|
5539.2.10
by Andrew Bennetts
s/NotInOtherForRev/NotInOtherForRevs/, and allow passing multiple revision_ids to search_missing_revision_ids. |
830 |
def search_missing_revision_ids(self, |
|
5852.1.6
by Jelmer Vernooij
Add extra test for Repository.search_missing_revision_ids. |
831 |
find_ghosts=True, revision_ids=None, if_present_ids=None, |
832 |
limit=None): |
|
|
5539.2.10
by Andrew Bennetts
s/NotInOtherForRev/NotInOtherForRevs/, and allow passing multiple revision_ids to search_missing_revision_ids. |
833 |
"""See InterRepository.search_missing_revision_ids().""" |
|
5537.2.1
by Jelmer Vernooij
Move InterWeaveRepo and InterKnitRepo to related repository files. |
834 |
# we want all revisions to satisfy revision_id in source.
|
835 |
# but we don't want to stat every file here and there.
|
|
836 |
# we want then, all revisions other needs to satisfy revision_id
|
|
837 |
# checked, but not those that we have locally.
|
|
838 |
# so the first thing is to get a subset of the revisions to
|
|
839 |
# satisfy revision_id in source, and then eliminate those that
|
|
840 |
# we do already have.
|
|
841 |
# this is slow on high latency connection to self, but as this
|
|
842 |
# disk format scales terribly for push anyway due to rewriting
|
|
843 |
# inventory.weave, this is considered acceptable.
|
|
844 |
# - RBC 20060209
|
|
|
5535.3.32
by Andrew Bennetts
Implement if_present_ids behaviour in all implementations and code paths of searching_missing_revision_ids |
845 |
source_ids_set = self._present_source_revisions_for( |
846 |
revision_ids, if_present_ids) |
|
|
5537.2.1
by Jelmer Vernooij
Move InterWeaveRepo and InterKnitRepo to related repository files. |
847 |
# source_ids is the worst possible case we may need to pull.
|
848 |
# now we want to filter source_ids against what we actually
|
|
849 |
# have in target, but don't try to check for existence where we know
|
|
850 |
# we do not have a revision as that would be pointless.
|
|
851 |
target_ids = set(self.target._all_possible_ids()) |
|
852 |
possibly_present_revisions = target_ids.intersection(source_ids_set) |
|
853 |
actually_present_revisions = set( |
|
854 |
self.target._eliminate_revisions_not_present(possibly_present_revisions)) |
|
855 |
required_revisions = source_ids_set.difference(actually_present_revisions) |
|
|
5539.2.10
by Andrew Bennetts
s/NotInOtherForRev/NotInOtherForRevs/, and allow passing multiple revision_ids to search_missing_revision_ids. |
856 |
if revision_ids is not None: |
|
5537.2.1
by Jelmer Vernooij
Move InterWeaveRepo and InterKnitRepo to related repository files. |
857 |
# we used get_ancestry to determine source_ids then we are assured all
|
858 |
# revisions referenced are present as they are installed in topological order.
|
|
859 |
# and the tip revision was validated by get_ancestry.
|
|
860 |
result_set = required_revisions |
|
861 |
else: |
|
862 |
# if we just grabbed the possibly available ids, then
|
|
863 |
# we only have an estimate of whats available and need to validate
|
|
864 |
# that against the revision records.
|
|
865 |
result_set = set( |
|
866 |
self.source._eliminate_revisions_not_present(required_revisions)) |
|
|
5852.1.6
by Jelmer Vernooij
Add extra test for Repository.search_missing_revision_ids. |
867 |
if limit is not None: |
|
5852.1.8
by Jelmer Vernooij
Simplify revision limiting. |
868 |
topo_ordered = self.get_graph().iter_topo_order(result_set) |
869 |
result_set = set(itertools.islice(topo_ordered, limit)) |
|
|
5537.2.1
by Jelmer Vernooij
Move InterWeaveRepo and InterKnitRepo to related repository files. |
870 |
return self.source.revision_ids_to_search_result(result_set) |
871 |
||
872 |
||
873 |
InterRepository.register_optimiser(InterWeaveRepo) |
|
|
5676.1.9
by Jelmer Vernooij
Fix existing implementation. |
874 |
|
875 |
||
876 |
def get_extra_interrepo_test_combinations(): |
|
|
6670.4.5
by Jelmer Vernooij
Move breezy.repofmt contents to breezy.bzr. |
877 |
from ...bzr import knitrepo |
|
5676.1.9
by Jelmer Vernooij
Fix existing implementation. |
878 |
return [(InterRepository, RepositoryFormat5(), |
879 |
knitrepo.RepositoryFormatKnit3())] |