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