14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
from binascii import hexlify
18
from copy import deepcopy
17
19
from cStringIO import StringIO
19
from bzrlib.lazy_import import lazy_import
20
lazy_import(globals(), """
22
from unittest import TestSuite
38
revision as _mod_revision,
43
from bzrlib.bundle import serializer
24
from bzrlib import bzrdir, check, delta, gpg, errors, xml5, ui, transactions, osutils
25
from bzrlib.decorators import needs_read_lock, needs_write_lock
26
from bzrlib.errors import InvalidRevisionId
27
from bzrlib.graph import Graph
28
from bzrlib.inter import InterObject
29
from bzrlib.inventory import Inventory
30
from bzrlib.knit import KnitVersionedFile, KnitPlainFactory
31
from bzrlib.lockable_files import LockableFiles, TransportLock
32
from bzrlib.lockdir import LockDir
33
from bzrlib.osutils import (safe_unicode, rand_bytes, compact_date,
35
from bzrlib.revision import NULL_REVISION, Revision
44
36
from bzrlib.revisiontree import RevisionTree
45
from bzrlib.store.versioned import VersionedFileStore
37
from bzrlib.store.versioned import VersionedFileStore, WeaveStore
46
38
from bzrlib.store.text import TextStore
39
from bzrlib.symbol_versioning import (deprecated_method,
47
42
from bzrlib.testament import Testament
51
from bzrlib.decorators import needs_read_lock, needs_write_lock
52
from bzrlib.inter import InterObject
53
from bzrlib.inventory import Inventory, InventoryDirectory, ROOT_ID
54
from bzrlib.symbol_versioning import (
58
from bzrlib.trace import mutter, note, warning
61
# Old formats display a warning, but only once
62
_deprecation_warning_done = False
65
######################################################################
43
from bzrlib.trace import mutter, note
44
from bzrlib.tsort import topo_sort
45
from bzrlib.weave import WeaveFile
68
48
class Repository(object):
69
49
"""Repository holding history for one or more branches.
80
_file_ids_altered_regex = lazy_regex.lazy_compile(
81
r'file_id="(?P<file_id>[^"]+)"'
82
r'.*revision="(?P<revision_id>[^"]+)"'
86
def add_inventory(self, revision_id, inv, parents):
87
"""Add the inventory inv to the repository as revision_id.
61
def add_inventory(self, revid, inv, parents):
62
"""Add the inventory inv to the repository as revid.
89
:param parents: The revision ids of the parents that revision_id
64
:param parents: The revision ids of the parents that revid
90
65
is known to have and are in the repository already.
92
67
returns the sha1 of the serialized inventory.
94
revision_id = osutils.safe_revision_id(revision_id)
95
_mod_revision.check_not_reserved_id(revision_id)
96
assert inv.revision_id is None or inv.revision_id == revision_id, \
69
assert inv.revision_id is None or inv.revision_id == revid, \
97
70
"Mismatch between inventory revision" \
98
" id and insertion revid (%r, %r)" % (inv.revision_id, revision_id)
99
assert inv.root is not None
100
inv_text = self.serialise_inventory(inv)
71
" id and insertion revid (%r, %r)" % (inv.revision_id, revid)
72
inv_text = xml5.serializer_v5.write_inventory_to_string(inv)
101
73
inv_sha1 = osutils.sha_string(inv_text)
102
74
inv_vf = self.control_weaves.get_weave('inventory',
103
75
self.get_transaction())
104
self._inventory_add_lines(inv_vf, revision_id, parents,
105
osutils.split_lines(inv_text))
76
self._inventory_add_lines(inv_vf, revid, parents, osutils.split_lines(inv_text))
108
def _inventory_add_lines(self, inv_vf, revision_id, parents, lines):
79
def _inventory_add_lines(self, inv_vf, revid, parents, lines):
109
80
final_parents = []
110
81
for parent in parents:
111
82
if parent in inv_vf:
112
83
final_parents.append(parent)
114
inv_vf.add_lines(revision_id, final_parents, lines)
85
inv_vf.add_lines(revid, final_parents, lines)
117
def add_revision(self, revision_id, rev, inv=None, config=None):
118
"""Add rev to the revision store as revision_id.
88
def add_revision(self, rev_id, rev, inv=None, config=None):
89
"""Add rev to the revision store as rev_id.
120
:param revision_id: the revision id to use.
91
:param rev_id: the revision id to use.
121
92
:param rev: The revision object.
122
93
:param inv: The inventory for the revision. if None, it will be looked
123
94
up in the inventory storer
264
205
def get_physical_lock_status(self):
265
206
return self.control_files.get_physical_lock_status()
267
def leave_lock_in_place(self):
268
"""Tell this repository not to release the physical lock when this
271
If lock_write doesn't return a token, then this method is not supported.
273
self.control_files.leave_in_place()
275
def dont_leave_lock_in_place(self):
276
"""Tell this repository to release the physical lock when this
277
object is unlocked, even if it didn't originally acquire it.
279
If lock_write doesn't return a token, then this method is not supported.
281
self.control_files.dont_leave_in_place()
284
def gather_stats(self, revid=None, committers=None):
285
"""Gather statistics from a revision id.
287
:param revid: The revision id to gather statistics from, if None, then
288
no revision specific statistics are gathered.
289
:param committers: Optional parameter controlling whether to grab
290
a count of committers from the revision specific statistics.
291
:return: A dictionary of statistics. Currently this contains:
292
committers: The number of committers if requested.
293
firstrev: A tuple with timestamp, timezone for the penultimate left
294
most ancestor of revid, if revid is not the NULL_REVISION.
295
latestrev: A tuple with timestamp, timezone for revid, if revid is
296
not the NULL_REVISION.
297
revisions: The total revision count in the repository.
298
size: An estimate disk size of the repository in bytes.
301
if revid and committers:
302
result['committers'] = 0
303
if revid and revid != _mod_revision.NULL_REVISION:
305
all_committers = set()
306
revisions = self.get_ancestry(revid)
307
# pop the leading None
309
first_revision = None
311
# ignore the revisions in the middle - just grab first and last
312
revisions = revisions[0], revisions[-1]
313
for revision in self.get_revisions(revisions):
314
if not first_revision:
315
first_revision = revision
317
all_committers.add(revision.committer)
318
last_revision = revision
320
result['committers'] = len(all_committers)
321
result['firstrev'] = (first_revision.timestamp,
322
first_revision.timezone)
323
result['latestrev'] = (last_revision.timestamp,
324
last_revision.timezone)
326
# now gather global repository information
327
if self.bzrdir.root_transport.listable():
328
c, t = self._revision_store.total_size(self.get_transaction())
329
result['revisions'] = c
334
209
def missing_revision_ids(self, other, revision_id=None):
335
210
"""Return the revision ids that other has that this does not.
351
225
control = bzrdir.BzrDir.open(base)
352
226
return control.open_repository()
354
def copy_content_into(self, destination, revision_id=None):
228
def copy_content_into(self, destination, revision_id=None, basis=None):
355
229
"""Make a complete copy of the content in self into destination.
357
231
This is a destructive operation! Do not use it on existing
360
revision_id = osutils.safe_revision_id(revision_id)
361
return InterRepository.get(self, destination).copy_content(revision_id)
234
return InterRepository.get(self, destination).copy_content(revision_id, basis)
363
236
def fetch(self, source, revision_id=None, pb=None):
364
237
"""Fetch the content required to construct revision_id from source.
366
239
If revision_id is None all content is copied.
368
revision_id = osutils.safe_revision_id(revision_id)
369
inter = InterRepository.get(source, self)
371
return inter.fetch(revision_id=revision_id, pb=pb)
372
except NotImplementedError:
373
raise errors.IncompatibleRepositories(source, self)
375
def create_bundle(self, target, base, fileobj, format=None):
376
return serializer.write_bundle(self, target, base, fileobj, format)
241
return InterRepository.get(source, self).fetch(revision_id=revision_id,
378
244
def get_commit_builder(self, branch, parents, config, timestamp=None,
379
245
timezone=None, committer=None, revprops=None,
389
255
:param revprops: Optional dictionary of revision properties.
390
256
:param revision_id: Optional revision id.
392
revision_id = osutils.safe_revision_id(revision_id)
393
return _CommitBuilder(self, parents, config, timestamp, timezone,
394
committer, revprops, revision_id)
258
return CommitBuilder(self, parents, config, timestamp, timezone,
259
committer, revprops, revision_id)
396
261
def unlock(self):
397
262
self.control_files.unlock()
400
def clone(self, a_bzrdir, revision_id=None):
265
def clone(self, a_bzrdir, revision_id=None, basis=None):
401
266
"""Clone this repository into a_bzrdir using the current format.
403
268
Currently no check is made that the format of this repository and
404
269
the bzrdir format are compatible. FIXME RBC 20060201.
406
:return: The newly created destination repository.
408
# TODO: deprecate after 0.16; cloning this with all its settings is
409
# probably not very useful -- mbp 20070423
410
dest_repo = self._create_sprouting_repo(a_bzrdir, shared=self.is_shared())
411
self.copy_content_into(dest_repo, revision_id)
415
def sprout(self, to_bzrdir, revision_id=None):
416
"""Create a descendent repository for new development.
418
Unlike clone, this does not copy the settings of the repository.
420
dest_repo = self._create_sprouting_repo(to_bzrdir, shared=False)
421
dest_repo.fetch(self, revision_id=revision_id)
424
def _create_sprouting_repo(self, a_bzrdir, shared):
425
271
if not isinstance(a_bzrdir._format, self.bzrdir._format.__class__):
426
272
# use target default format.
427
dest_repo = a_bzrdir.create_repository()
273
result = a_bzrdir.create_repository()
274
# FIXME RBC 20060209 split out the repository type to avoid this check ?
275
elif isinstance(a_bzrdir._format,
276
(bzrdir.BzrDirFormat4,
277
bzrdir.BzrDirFormat5,
278
bzrdir.BzrDirFormat6)):
279
result = a_bzrdir.open_repository()
429
# Most control formats need the repository to be specifically
430
# created, but on some old all-in-one formats it's not needed
432
dest_repo = self._format.initialize(a_bzrdir, shared=shared)
433
except errors.UninitializableFormat:
434
dest_repo = a_bzrdir.open_repository()
281
result = self._format.initialize(a_bzrdir, shared=self.is_shared())
282
self.copy_content_into(result, revision_id, basis)
438
286
def has_revision(self, revision_id):
439
287
"""True if this repository has a copy of the revision."""
440
revision_id = osutils.safe_revision_id(revision_id)
441
288
return self._revision_store.has_revision_id(revision_id,
442
289
self.get_transaction())
575
410
# revisions. We don't need to see all lines in the inventory because
576
411
# only those added in an inventory in rev X can contain a revision=X
578
unescape_revid_cache = {}
579
unescape_fileid_cache = {}
581
# jam 20061218 In a big fetch, this handles hundreds of thousands
582
# of lines, so it has had a lot of inlining and optimizing done.
583
# Sorry that it is a little bit messy.
584
# Move several functions to be local variables, since this is a long
586
search = self._file_ids_altered_regex.search
587
unescape = _unescape_xml
588
setdefault = result.setdefault
589
pb = ui.ui_factory.nested_progress_bar()
591
for line in w.iter_lines_added_or_present_in_versions(
592
selected_revision_ids, pb=pb):
596
# One call to match.group() returning multiple items is quite a
597
# bit faster than 2 calls to match.group() each returning 1
598
file_id, revision_id = match.group('file_id', 'revision_id')
600
# Inlining the cache lookups helps a lot when you make 170,000
601
# lines and 350k ids, versus 8.4 unique ids.
602
# Using a cache helps in 2 ways:
603
# 1) Avoids unnecessary decoding calls
604
# 2) Re-uses cached strings, which helps in future set and
606
# (2) is enough that removing encoding entirely along with
607
# the cache (so we are using plain strings) results in no
608
# performance improvement.
610
revision_id = unescape_revid_cache[revision_id]
612
unescaped = unescape(revision_id)
613
unescape_revid_cache[revision_id] = unescaped
614
revision_id = unescaped
616
if revision_id in selected_revision_ids:
618
file_id = unescape_fileid_cache[file_id]
620
unescaped = unescape(file_id)
621
unescape_fileid_cache[file_id] = unescaped
623
setdefault(file_id, set()).add(revision_id)
413
for line in w.iter_lines_added_or_present_in_versions(selected_revision_ids):
414
start = line.find('file_id="')+9
415
if start < 9: continue
416
end = line.find('"', start)
418
file_id = _unescape_xml(line[start:end])
420
start = line.find('revision="')+10
421
if start < 10: continue
422
end = line.find('"', start)
424
revision_id = _unescape_xml(line[start:end])
425
if revision_id in selected_revision_ids:
426
result.setdefault(file_id, set()).add(revision_id)
975
def _warn_if_deprecated(self):
976
global _deprecation_warning_done
977
if _deprecation_warning_done:
979
_deprecation_warning_done = True
980
warning("Format %s for %s is deprecated - please use 'bzr upgrade' to get better performance"
981
% (self._format, self.bzrdir.transport.base))
983
def supports_rich_root(self):
984
return self._format.rich_root_data
986
def _check_ascii_revisionid(self, revision_id, method):
987
"""Private helper for ascii-only repositories."""
988
# weave repositories refuse to store revisionids that are non-ascii.
989
if revision_id is not None:
990
# weaves require ascii revision ids.
991
if isinstance(revision_id, unicode):
993
revision_id.encode('ascii')
994
except UnicodeEncodeError:
995
raise errors.NonAsciiRevisionId(method, self)
998
revision_id.decode('ascii')
999
except UnicodeDecodeError:
1000
raise errors.NonAsciiRevisionId(method, self)
1004
# remove these delegates a while after bzr 0.15
1005
def __make_delegated(name, from_module):
1006
def _deprecated_repository_forwarder():
1007
symbol_versioning.warn('%s moved to %s in bzr 0.15'
1008
% (name, from_module),
1011
m = __import__(from_module, globals(), locals(), [name])
1013
return getattr(m, name)
1014
except AttributeError:
1015
raise AttributeError('module %s has no name %s'
1017
globals()[name] = _deprecated_repository_forwarder
1020
'AllInOneRepository',
1021
'WeaveMetaDirRepository',
1022
'PreSplitOutRepositoryFormat',
1023
'RepositoryFormat4',
1024
'RepositoryFormat5',
1025
'RepositoryFormat6',
1026
'RepositoryFormat7',
1028
__make_delegated(_name, 'bzrlib.repofmt.weaverepo')
1032
'RepositoryFormatKnit',
1033
'RepositoryFormatKnit1',
1035
__make_delegated(_name, 'bzrlib.repofmt.knitrepo')
684
class AllInOneRepository(Repository):
685
"""Legacy support - the repository behaviour for all-in-one branches."""
687
def __init__(self, _format, a_bzrdir, _revision_store, control_store, text_store):
688
# we reuse one control files instance.
689
dir_mode = a_bzrdir._control_files._dir_mode
690
file_mode = a_bzrdir._control_files._file_mode
692
def get_store(name, compressed=True, prefixed=False):
693
# FIXME: This approach of assuming stores are all entirely compressed
694
# or entirely uncompressed is tidy, but breaks upgrade from
695
# some existing branches where there's a mixture; we probably
696
# still want the option to look for both.
697
relpath = a_bzrdir._control_files._escape(name)
698
store = TextStore(a_bzrdir._control_files._transport.clone(relpath),
699
prefixed=prefixed, compressed=compressed,
702
#if self._transport.should_cache():
703
# cache_path = os.path.join(self.cache_root, name)
704
# os.mkdir(cache_path)
705
# store = bzrlib.store.CachedStore(store, cache_path)
708
# not broken out yet because the controlweaves|inventory_store
709
# and text_store | weave_store bits are still different.
710
if isinstance(_format, RepositoryFormat4):
711
# cannot remove these - there is still no consistent api
712
# which allows access to this old info.
713
self.inventory_store = get_store('inventory-store')
714
text_store = get_store('text-store')
715
super(AllInOneRepository, self).__init__(_format, a_bzrdir, a_bzrdir._control_files, _revision_store, control_store, text_store)
719
"""AllInOne repositories cannot be shared."""
723
def set_make_working_trees(self, new_value):
724
"""Set the policy flag for making working trees when creating branches.
726
This only applies to branches that use this repository.
728
The default is 'True'.
729
:param new_value: True to restore the default, False to disable making
732
raise NotImplementedError(self.set_make_working_trees)
734
def make_working_trees(self):
735
"""Returns the policy for making working trees on new branches."""
1038
739
def install_revision(repository, rev, revision_tree):
1124
824
return not self.control_files._transport.has('no-working-trees')
1127
class RepositoryFormatRegistry(registry.Registry):
1128
"""Registry of RepositoryFormats.
1131
def get(self, format_string):
1132
r = registry.Registry.get(self, format_string)
827
class KnitRepository(MetaDirRepository):
828
"""Knit format repository."""
830
def _inventory_add_lines(self, inv_vf, revid, parents, lines):
831
inv_vf.add_lines_with_ghosts(revid, parents, lines)
834
def _all_revision_ids(self):
835
"""See Repository.all_revision_ids()."""
836
# Knits get the revision graph from the index of the revision knit, so
837
# it's always possible even if they're on an unlistable transport.
838
return self._revision_store.all_revision_ids(self.get_transaction())
840
def fileid_involved_between_revs(self, from_revid, to_revid):
841
"""Find file_id(s) which are involved in the changes between revisions.
843
This determines the set of revisions which are involved, and then
844
finds all file ids affected by those revisions.
846
vf = self._get_revision_vf()
847
from_set = set(vf.get_ancestry(from_revid))
848
to_set = set(vf.get_ancestry(to_revid))
849
changed = to_set.difference(from_set)
850
return self._fileid_involved_by_set(changed)
852
def fileid_involved(self, last_revid=None):
853
"""Find all file_ids modified in the ancestry of last_revid.
855
:param last_revid: If None, last_revision() will be used.
858
changed = set(self.all_revision_ids())
860
changed = set(self.get_ancestry(last_revid))
863
return self._fileid_involved_by_set(changed)
866
def get_ancestry(self, revision_id):
867
"""Return a list of revision-ids integrated by a revision.
869
This is topologically sorted.
871
if revision_id is None:
873
vf = self._get_revision_vf()
875
return [None] + vf.get_ancestry(revision_id)
876
except errors.RevisionNotPresent:
877
raise errors.NoSuchRevision(self, revision_id)
880
def get_revision(self, revision_id):
881
"""Return the Revision object for a named revision"""
882
return self.get_revision_reconcile(revision_id)
885
def get_revision_graph(self, revision_id=None):
886
"""Return a dictionary containing the revision graph.
888
:param revision_id: The revision_id to get a graph from. If None, then
889
the entire revision graph is returned. This is a deprecated mode of
890
operation and will be removed in the future.
891
:return: a dictionary of revision_id->revision_parents_list.
893
# special case NULL_REVISION
894
if revision_id == NULL_REVISION:
896
weave = self._get_revision_vf()
897
entire_graph = weave.get_graph()
898
if revision_id is None:
899
return weave.get_graph()
900
elif revision_id not in weave:
901
raise errors.NoSuchRevision(self, revision_id)
903
# add what can be reached from revision_id
905
pending = set([revision_id])
906
while len(pending) > 0:
908
result[node] = weave.get_parents(node)
909
for revision_id in result[node]:
910
if revision_id not in result:
911
pending.add(revision_id)
915
def get_revision_graph_with_ghosts(self, revision_ids=None):
916
"""Return a graph of the revisions with ghosts marked as applicable.
918
:param revision_ids: an iterable of revisions to graph or None for all.
919
:return: a Graph object with the graph reachable from revision_ids.
922
vf = self._get_revision_vf()
923
versions = set(vf.versions())
925
pending = set(self.all_revision_ids())
928
pending = set(revision_ids)
929
# special case NULL_REVISION
930
if NULL_REVISION in pending:
931
pending.remove(NULL_REVISION)
932
required = set(pending)
935
revision_id = pending.pop()
936
if not revision_id in versions:
937
if revision_id in required:
938
raise errors.NoSuchRevision(self, revision_id)
940
result.add_ghost(revision_id)
941
# mark it as done so we don't try for it again.
942
done.add(revision_id)
944
parent_ids = vf.get_parents_with_ghosts(revision_id)
945
for parent_id in parent_ids:
946
# is this queued or done ?
947
if (parent_id not in pending and
948
parent_id not in done):
950
pending.add(parent_id)
951
result.add_node(revision_id, parent_ids)
952
done.add(revision_id)
955
def _get_revision_vf(self):
956
""":return: a versioned file containing the revisions."""
957
vf = self._revision_store.get_revision_file(self.get_transaction())
961
def reconcile(self, other=None, thorough=False):
962
"""Reconcile this repository."""
963
from bzrlib.reconcile import KnitReconciler
964
reconciler = KnitReconciler(self, thorough=thorough)
965
reconciler.reconcile()
1138
format_registry = RepositoryFormatRegistry()
1139
"""Registry of formats, indexed by their identifying format string.
1141
This can contain either format instances themselves, or classes/factories that
1142
can be called to obtain one.
1146
#####################################################################
1147
# Repository Formats
968
def revision_parents(self, revision_id):
969
return self._get_revision_vf().get_parents(revision_id)
1149
972
class RepositoryFormat(object):
1150
973
"""A repository format.
1170
993
parameterisation.
1174
return "<%s>" % self.__class__.__name__
1176
def __eq__(self, other):
1177
# format objects are generally stateless
1178
return isinstance(other, self.__class__)
1180
def __ne__(self, other):
1181
return not self == other
996
_default_format = None
997
"""The default format used for new repositories."""
1000
"""The known formats."""
1184
1003
def find_format(klass, a_bzrdir):
1185
"""Return the format for the repository object in a_bzrdir.
1187
This is used by bzr native formats that have a "format" file in
1188
the repository. Other methods may be used by different types of
1004
"""Return the format for the repository object in a_bzrdir."""
1192
1006
transport = a_bzrdir.get_repository_transport(None)
1193
1007
format_string = transport.get("format").read()
1194
return format_registry.get(format_string)
1008
return klass._formats[format_string]
1195
1009
except errors.NoSuchFile:
1196
1010
raise errors.NoRepositoryPresent(a_bzrdir)
1197
1011
except KeyError:
1198
1012
raise errors.UnknownFormatError(format=format_string)
1201
def register_format(klass, format):
1202
format_registry.register(format.get_format_string(), format)
1205
def unregister_format(klass, format):
1206
format_registry.remove(format.get_format_string())
1014
def _get_control_store(self, repo_transport, control_files):
1015
"""Return the control store for this repository."""
1016
raise NotImplementedError(self._get_control_store)
1209
1019
def get_default_format(klass):
1210
1020
"""Return the current default format."""
1211
from bzrlib import bzrdir
1212
return bzrdir.format_registry.make_bzrdir('default').repository_format
1214
def _get_control_store(self, repo_transport, control_files):
1215
"""Return the control store for this repository."""
1216
raise NotImplementedError(self._get_control_store)
1021
return klass._default_format
1218
1023
def get_format_string(self):
1219
1024
"""Return the ASCII format string that identifies this format.
1308
1102
raise NotImplementedError(self.open)
1105
def register_format(klass, format):
1106
klass._formats[format.get_format_string()] = format
1109
def set_default_format(klass, format):
1110
klass._default_format = format
1113
def unregister_format(klass, format):
1114
assert klass._formats[format.get_format_string()] is format
1115
del klass._formats[format.get_format_string()]
1118
class PreSplitOutRepositoryFormat(RepositoryFormat):
1119
"""Base class for the pre split out repository formats."""
1121
def initialize(self, a_bzrdir, shared=False, _internal=False):
1122
"""Create a weave repository.
1124
TODO: when creating split out bzr branch formats, move this to a common
1125
base for Format5, Format6. or something like that.
1127
from bzrlib.weavefile import write_weave_v5
1128
from bzrlib.weave import Weave
1131
raise errors.IncompatibleFormat(self, a_bzrdir._format)
1134
# always initialized when the bzrdir is.
1135
return self.open(a_bzrdir, _found=True)
1137
# Create an empty weave
1139
write_weave_v5(Weave(), sio)
1140
empty_weave = sio.getvalue()
1142
mutter('creating repository in %s.', a_bzrdir.transport.base)
1143
dirs = ['revision-store', 'weaves']
1144
files = [('inventory.weave', StringIO(empty_weave)),
1147
# FIXME: RBC 20060125 don't peek under the covers
1148
# NB: no need to escape relative paths that are url safe.
1149
control_files = LockableFiles(a_bzrdir.transport, 'branch-lock',
1151
control_files.create_lock()
1152
control_files.lock_write()
1153
control_files._transport.mkdir_multi(dirs,
1154
mode=control_files._dir_mode)
1156
for file, content in files:
1157
control_files.put(file, content)
1159
control_files.unlock()
1160
return self.open(a_bzrdir, _found=True)
1162
def _get_control_store(self, repo_transport, control_files):
1163
"""Return the control store for this repository."""
1164
return self._get_versioned_file_store('',
1169
def _get_text_store(self, transport, control_files):
1170
"""Get a store for file texts for this format."""
1171
raise NotImplementedError(self._get_text_store)
1173
def open(self, a_bzrdir, _found=False):
1174
"""See RepositoryFormat.open()."""
1176
# we are being called directly and must probe.
1177
raise NotImplementedError
1179
repo_transport = a_bzrdir.get_repository_transport(None)
1180
control_files = a_bzrdir._control_files
1181
text_store = self._get_text_store(repo_transport, control_files)
1182
control_store = self._get_control_store(repo_transport, control_files)
1183
_revision_store = self._get_revision_store(repo_transport, control_files)
1184
return AllInOneRepository(_format=self,
1186
_revision_store=_revision_store,
1187
control_store=control_store,
1188
text_store=text_store)
1191
class RepositoryFormat4(PreSplitOutRepositoryFormat):
1192
"""Bzr repository format 4.
1194
This repository format has:
1196
- TextStores for texts, inventories,revisions.
1198
This format is deprecated: it indexes texts using a text id which is
1199
removed in format 5; initialization and write support for this format
1204
super(RepositoryFormat4, self).__init__()
1205
self._matchingbzrdir = bzrdir.BzrDirFormat4()
1207
def get_format_description(self):
1208
"""See RepositoryFormat.get_format_description()."""
1209
return "Repository format 4"
1211
def initialize(self, url, shared=False, _internal=False):
1212
"""Format 4 branches cannot be created."""
1213
raise errors.UninitializableFormat(self)
1215
def is_supported(self):
1216
"""Format 4 is not supported.
1218
It is not supported because the model changed from 4 to 5 and the
1219
conversion logic is expensive - so doing it on the fly was not
1224
def _get_control_store(self, repo_transport, control_files):
1225
"""Format 4 repositories have no formal control store at this point.
1227
This will cause any control-file-needing apis to fail - this is desired.
1231
def _get_revision_store(self, repo_transport, control_files):
1232
"""See RepositoryFormat._get_revision_store()."""
1233
from bzrlib.xml4 import serializer_v4
1234
return self._get_text_rev_store(repo_transport,
1237
serializer=serializer_v4)
1239
def _get_text_store(self, transport, control_files):
1240
"""See RepositoryFormat._get_text_store()."""
1243
class RepositoryFormat5(PreSplitOutRepositoryFormat):
1244
"""Bzr control format 5.
1246
This repository format has:
1247
- weaves for file texts and inventory
1249
- TextStores for revisions and signatures.
1253
super(RepositoryFormat5, self).__init__()
1254
self._matchingbzrdir = bzrdir.BzrDirFormat5()
1256
def get_format_description(self):
1257
"""See RepositoryFormat.get_format_description()."""
1258
return "Weave repository format 5"
1260
def _get_revision_store(self, repo_transport, control_files):
1261
"""See RepositoryFormat._get_revision_store()."""
1262
"""Return the revision store object for this a_bzrdir."""
1263
return self._get_text_rev_store(repo_transport,
1268
def _get_text_store(self, transport, control_files):
1269
"""See RepositoryFormat._get_text_store()."""
1270
return self._get_versioned_file_store('weaves', transport, control_files, prefixed=False)
1273
class RepositoryFormat6(PreSplitOutRepositoryFormat):
1274
"""Bzr control format 6.
1276
This repository format has:
1277
- weaves for file texts and inventory
1278
- hash subdirectory based stores.
1279
- TextStores for revisions and signatures.
1283
super(RepositoryFormat6, self).__init__()
1284
self._matchingbzrdir = bzrdir.BzrDirFormat6()
1286
def get_format_description(self):
1287
"""See RepositoryFormat.get_format_description()."""
1288
return "Weave repository format 6"
1290
def _get_revision_store(self, repo_transport, control_files):
1291
"""See RepositoryFormat._get_revision_store()."""
1292
return self._get_text_rev_store(repo_transport,
1298
def _get_text_store(self, transport, control_files):
1299
"""See RepositoryFormat._get_text_store()."""
1300
return self._get_versioned_file_store('weaves', transport, control_files)
1311
1303
class MetaDirRepositoryFormat(RepositoryFormat):
1312
1304
"""Common base class for the new repositories using the metadir layout."""
1314
rich_root_data = False
1315
supports_tree_reference = False
1316
_matchingbzrdir = bzrdir.BzrDirMetaFormat1()
1318
1306
def __init__(self):
1319
1307
super(MetaDirRepositoryFormat, self).__init__()
1308
self._matchingbzrdir = bzrdir.BzrDirMetaFormat1()
1321
1310
def _create_control_files(self, a_bzrdir):
1322
1311
"""Create the required files and the initial control_files object."""
1323
1312
# FIXME: RBC 20060125 don't peek under the covers
1324
1313
# NB: no need to escape relative paths that are url safe.
1325
1314
repository_transport = a_bzrdir.get_repository_transport(self)
1326
control_files = lockable_files.LockableFiles(repository_transport,
1327
'lock', lockdir.LockDir)
1315
control_files = LockableFiles(repository_transport, 'lock', LockDir)
1328
1316
control_files.create_lock()
1329
1317
return control_files
1345
1333
control_files.unlock()
1336
class RepositoryFormat7(MetaDirRepositoryFormat):
1337
"""Bzr repository 7.
1339
This repository format has:
1340
- weaves for file texts and inventory
1341
- hash subdirectory based stores.
1342
- TextStores for revisions and signatures.
1343
- a format marker of its own
1344
- an optional 'shared-storage' flag
1345
- an optional 'no-working-trees' flag
1348
def _get_control_store(self, repo_transport, control_files):
1349
"""Return the control store for this repository."""
1350
return self._get_versioned_file_store('',
1355
def get_format_string(self):
1356
"""See RepositoryFormat.get_format_string()."""
1357
return "Bazaar-NG Repository format 7"
1359
def get_format_description(self):
1360
"""See RepositoryFormat.get_format_description()."""
1361
return "Weave repository format 7"
1363
def _get_revision_store(self, repo_transport, control_files):
1364
"""See RepositoryFormat._get_revision_store()."""
1365
return self._get_text_rev_store(repo_transport,
1372
def _get_text_store(self, transport, control_files):
1373
"""See RepositoryFormat._get_text_store()."""
1374
return self._get_versioned_file_store('weaves',
1378
def initialize(self, a_bzrdir, shared=False):
1379
"""Create a weave repository.
1381
:param shared: If true the repository will be initialized as a shared
1384
from bzrlib.weavefile import write_weave_v5
1385
from bzrlib.weave import Weave
1387
# Create an empty weave
1389
write_weave_v5(Weave(), sio)
1390
empty_weave = sio.getvalue()
1392
mutter('creating repository in %s.', a_bzrdir.transport.base)
1393
dirs = ['revision-store', 'weaves']
1394
files = [('inventory.weave', StringIO(empty_weave)),
1396
utf8_files = [('format', self.get_format_string())]
1398
self._upload_blank_content(a_bzrdir, dirs, files, utf8_files, shared)
1399
return self.open(a_bzrdir=a_bzrdir, _found=True)
1401
def open(self, a_bzrdir, _found=False, _override_transport=None):
1402
"""See RepositoryFormat.open().
1404
:param _override_transport: INTERNAL USE ONLY. Allows opening the
1405
repository at a slightly different url
1406
than normal. I.e. during 'upgrade'.
1409
format = RepositoryFormat.find_format(a_bzrdir)
1410
assert format.__class__ == self.__class__
1411
if _override_transport is not None:
1412
repo_transport = _override_transport
1414
repo_transport = a_bzrdir.get_repository_transport(None)
1415
control_files = LockableFiles(repo_transport, 'lock', LockDir)
1416
text_store = self._get_text_store(repo_transport, control_files)
1417
control_store = self._get_control_store(repo_transport, control_files)
1418
_revision_store = self._get_revision_store(repo_transport, control_files)
1419
return MetaDirRepository(_format=self,
1421
control_files=control_files,
1422
_revision_store=_revision_store,
1423
control_store=control_store,
1424
text_store=text_store)
1427
class RepositoryFormatKnit1(MetaDirRepositoryFormat):
1428
"""Bzr repository knit format 1.
1430
This repository format has:
1431
- knits for file texts and inventory
1432
- hash subdirectory based stores.
1433
- knits for revisions and signatures
1434
- TextStores for revisions and signatures.
1435
- a format marker of its own
1436
- an optional 'shared-storage' flag
1437
- an optional 'no-working-trees' flag
1440
This format was introduced in bzr 0.8.
1443
def _get_control_store(self, repo_transport, control_files):
1444
"""Return the control store for this repository."""
1445
return VersionedFileStore(
1448
file_mode=control_files._file_mode,
1449
versionedfile_class=KnitVersionedFile,
1450
versionedfile_kwargs={'factory':KnitPlainFactory()},
1453
def get_format_string(self):
1454
"""See RepositoryFormat.get_format_string()."""
1455
return "Bazaar-NG Knit Repository Format 1"
1457
def get_format_description(self):
1458
"""See RepositoryFormat.get_format_description()."""
1459
return "Knit repository format 1"
1461
def _get_revision_store(self, repo_transport, control_files):
1462
"""See RepositoryFormat._get_revision_store()."""
1463
from bzrlib.store.revision.knit import KnitRevisionStore
1464
versioned_file_store = VersionedFileStore(
1466
file_mode=control_files._file_mode,
1469
versionedfile_class=KnitVersionedFile,
1470
versionedfile_kwargs={'delta':False, 'factory':KnitPlainFactory()},
1473
return KnitRevisionStore(versioned_file_store)
1475
def _get_text_store(self, transport, control_files):
1476
"""See RepositoryFormat._get_text_store()."""
1477
return self._get_versioned_file_store('knits',
1480
versionedfile_class=KnitVersionedFile,
1483
def initialize(self, a_bzrdir, shared=False):
1484
"""Create a knit format 1 repository.
1486
:param a_bzrdir: bzrdir to contain the new repository; must already
1488
:param shared: If true the repository will be initialized as a shared
1491
mutter('creating repository in %s.', a_bzrdir.transport.base)
1492
dirs = ['revision-store', 'knits']
1494
utf8_files = [('format', self.get_format_string())]
1496
self._upload_blank_content(a_bzrdir, dirs, files, utf8_files, shared)
1497
repo_transport = a_bzrdir.get_repository_transport(None)
1498
control_files = LockableFiles(repo_transport, 'lock', LockDir)
1499
control_store = self._get_control_store(repo_transport, control_files)
1500
transaction = transactions.WriteTransaction()
1501
# trigger a write of the inventory store.
1502
control_store.get_weave_or_empty('inventory', transaction)
1503
_revision_store = self._get_revision_store(repo_transport, control_files)
1504
_revision_store.has_revision_id('A', transaction)
1505
_revision_store.get_signature_file(transaction)
1506
return self.open(a_bzrdir=a_bzrdir, _found=True)
1508
def open(self, a_bzrdir, _found=False, _override_transport=None):
1509
"""See RepositoryFormat.open().
1511
:param _override_transport: INTERNAL USE ONLY. Allows opening the
1512
repository at a slightly different url
1513
than normal. I.e. during 'upgrade'.
1516
format = RepositoryFormat.find_format(a_bzrdir)
1517
assert format.__class__ == self.__class__
1518
if _override_transport is not None:
1519
repo_transport = _override_transport
1521
repo_transport = a_bzrdir.get_repository_transport(None)
1522
control_files = LockableFiles(repo_transport, 'lock', LockDir)
1523
text_store = self._get_text_store(repo_transport, control_files)
1524
control_store = self._get_control_store(repo_transport, control_files)
1525
_revision_store = self._get_revision_store(repo_transport, control_files)
1526
return KnitRepository(_format=self,
1528
control_files=control_files,
1529
_revision_store=_revision_store,
1530
control_store=control_store,
1531
text_store=text_store)
1348
1534
# formats which have no format string are not discoverable
1349
# and not independently creatable, so are not registered. They're
1350
# all in bzrlib.repofmt.weaverepo now. When an instance of one of these is
1351
# needed, it's constructed directly by the BzrDir. Non-native formats where
1352
# the repository is not separately opened are similar.
1354
format_registry.register_lazy(
1355
'Bazaar-NG Repository format 7',
1356
'bzrlib.repofmt.weaverepo',
1359
# KEEP in sync with bzrdir.format_registry default, which controls the overall
1360
# default control directory format
1362
format_registry.register_lazy(
1363
'Bazaar-NG Knit Repository Format 1',
1364
'bzrlib.repofmt.knitrepo',
1365
'RepositoryFormatKnit1',
1367
format_registry.default_key = 'Bazaar-NG Knit Repository Format 1'
1369
format_registry.register_lazy(
1370
'Bazaar Knit Repository Format 3 (bzr 0.15)\n',
1371
'bzrlib.repofmt.knitrepo',
1372
'RepositoryFormatKnit3',
1535
# and not independently creatable, so are not registered.
1536
RepositoryFormat.register_format(RepositoryFormat7())
1537
_default_format = RepositoryFormatKnit1()
1538
RepositoryFormat.register_format(_default_format)
1539
RepositoryFormat.set_default_format(_default_format)
1540
_legacy_formats = [RepositoryFormat4(),
1541
RepositoryFormat5(),
1542
RepositoryFormat6()]
1376
1545
class InterRepository(InterObject):
1433
1628
return [rev_id for rev_id in source_ids if rev_id in result_set]
1436
class InterSameDataRepository(InterRepository):
1437
"""Code for converting between repositories that represent the same data.
1439
Data format and model must match for this to work.
1443
def _get_repo_format_to_test(self):
1444
"""Repository format for testing with."""
1445
return RepositoryFormat.get_default_format()
1448
def is_compatible(source, target):
1449
if source.supports_rich_root() != target.supports_rich_root():
1451
if source._serializer != target._serializer:
1456
def copy_content(self, revision_id=None):
1457
"""Make a complete copy of the content in self into destination.
1459
This copies both the repository's revision data, and configuration information
1460
such as the make_working_trees setting.
1462
This is a destructive operation! Do not use it on existing
1465
:param revision_id: Only copy the content needed to construct
1466
revision_id and its parents.
1469
self.target.set_make_working_trees(self.source.make_working_trees())
1470
except NotImplementedError:
1472
# TODO: jam 20070210 This is fairly internal, so we should probably
1473
# just assert that revision_id is not unicode.
1474
revision_id = osutils.safe_revision_id(revision_id)
1475
# but don't bother fetching if we have the needed data now.
1476
if (revision_id not in (None, _mod_revision.NULL_REVISION) and
1477
self.target.has_revision(revision_id)):
1479
self.target.fetch(self.source, revision_id=revision_id)
1482
def fetch(self, revision_id=None, pb=None):
1483
"""See InterRepository.fetch()."""
1484
from bzrlib.fetch import GenericRepoFetcher
1485
mutter("Using fetch logic to copy between %s(%s) and %s(%s)",
1486
self.source, self.source._format, self.target,
1487
self.target._format)
1488
# TODO: jam 20070210 This should be an assert, not a translate
1489
revision_id = osutils.safe_revision_id(revision_id)
1490
f = GenericRepoFetcher(to_repository=self.target,
1491
from_repository=self.source,
1492
last_revision=revision_id,
1494
return f.count_copied, f.failed_revisions
1497
class InterWeaveRepo(InterSameDataRepository):
1631
class InterWeaveRepo(InterRepository):
1498
1632
"""Optimised code paths between Weave based repositories."""
1501
def _get_repo_format_to_test(self):
1502
from bzrlib.repofmt import weaverepo
1503
return weaverepo.RepositoryFormat7()
1634
_matching_repo_format = RepositoryFormat7()
1635
"""Repository format for testing with."""
1506
1638
def is_compatible(source, target):
1528
1655
@needs_write_lock
1529
def copy_content(self, revision_id=None):
1656
def copy_content(self, revision_id=None, basis=None):
1530
1657
"""See InterRepository.copy_content()."""
1531
1658
# weave specific optimised path:
1532
# TODO: jam 20070210 Internal, should be an assert, not translate
1533
revision_id = osutils.safe_revision_id(revision_id)
1535
self.target.set_make_working_trees(self.source.make_working_trees())
1536
except NotImplementedError:
1538
# FIXME do not peek!
1539
if self.source.control_files._transport.listable():
1540
pb = ui.ui_factory.nested_progress_bar()
1659
if basis is not None:
1660
# copy the basis in, then fetch remaining data.
1661
basis.copy_content_into(self.target, revision_id)
1662
# the basis copy_content_into could miss-set this.
1542
self.target.weave_store.copy_all_ids(
1543
self.source.weave_store,
1545
from_transaction=self.source.get_transaction(),
1546
to_transaction=self.target.get_transaction())
1547
pb.update('copying inventory', 0, 1)
1548
self.target.control_weaves.copy_multi(
1549
self.source.control_weaves, ['inventory'],
1550
from_transaction=self.source.get_transaction(),
1551
to_transaction=self.target.get_transaction())
1552
self.target._revision_store.text_store.copy_all_ids(
1553
self.source._revision_store.text_store,
1664
self.target.set_make_working_trees(self.source.make_working_trees())
1665
except NotImplementedError:
1558
1667
self.target.fetch(self.source, revision_id=revision_id)
1670
self.target.set_make_working_trees(self.source.make_working_trees())
1671
except NotImplementedError:
1673
# FIXME do not peek!
1674
if self.source.control_files._transport.listable():
1675
pb = ui.ui_factory.nested_progress_bar()
1677
self.target.weave_store.copy_all_ids(
1678
self.source.weave_store,
1680
from_transaction=self.source.get_transaction(),
1681
to_transaction=self.target.get_transaction())
1682
pb.update('copying inventory', 0, 1)
1683
self.target.control_weaves.copy_multi(
1684
self.source.control_weaves, ['inventory'],
1685
from_transaction=self.source.get_transaction(),
1686
to_transaction=self.target.get_transaction())
1687
self.target._revision_store.text_store.copy_all_ids(
1688
self.source._revision_store.text_store,
1693
self.target.fetch(self.source, revision_id=revision_id)
1560
1695
@needs_write_lock
1561
1696
def fetch(self, revision_id=None, pb=None):
1680
1808
# that against the revision records.
1681
1809
return self.source._eliminate_revisions_not_present(required_topo_revisions)
1684
class InterModel1and2(InterRepository):
1687
def _get_repo_format_to_test(self):
1691
def is_compatible(source, target):
1692
if not source.supports_rich_root() and target.supports_rich_root():
1698
def fetch(self, revision_id=None, pb=None):
1699
"""See InterRepository.fetch()."""
1700
from bzrlib.fetch import Model1toKnit2Fetcher
1701
# TODO: jam 20070210 This should be an assert, not a translate
1702
revision_id = osutils.safe_revision_id(revision_id)
1703
f = Model1toKnit2Fetcher(to_repository=self.target,
1704
from_repository=self.source,
1705
last_revision=revision_id,
1707
return f.count_copied, f.failed_revisions
1710
def copy_content(self, revision_id=None):
1711
"""Make a complete copy of the content in self into destination.
1713
This is a destructive operation! Do not use it on existing
1716
:param revision_id: Only copy the content needed to construct
1717
revision_id and its parents.
1720
self.target.set_make_working_trees(self.source.make_working_trees())
1721
except NotImplementedError:
1723
# TODO: jam 20070210 Internal, assert, don't translate
1724
revision_id = osutils.safe_revision_id(revision_id)
1725
# but don't bother fetching if we have the needed data now.
1726
if (revision_id not in (None, _mod_revision.NULL_REVISION) and
1727
self.target.has_revision(revision_id)):
1729
self.target.fetch(self.source, revision_id=revision_id)
1732
class InterKnit1and2(InterKnitRepo):
1735
def _get_repo_format_to_test(self):
1739
def is_compatible(source, target):
1740
"""Be compatible with Knit1 source and Knit3 target"""
1741
from bzrlib.repofmt.knitrepo import RepositoryFormatKnit3
1743
from bzrlib.repofmt.knitrepo import RepositoryFormatKnit1, \
1744
RepositoryFormatKnit3
1745
return (isinstance(source._format, (RepositoryFormatKnit1)) and
1746
isinstance(target._format, (RepositoryFormatKnit3)))
1747
except AttributeError:
1751
def fetch(self, revision_id=None, pb=None):
1752
"""See InterRepository.fetch()."""
1753
from bzrlib.fetch import Knit1to2Fetcher
1754
mutter("Using fetch logic to copy between %s(%s) and %s(%s)",
1755
self.source, self.source._format, self.target,
1756
self.target._format)
1757
# TODO: jam 20070210 This should be an assert, not a translate
1758
revision_id = osutils.safe_revision_id(revision_id)
1759
f = Knit1to2Fetcher(to_repository=self.target,
1760
from_repository=self.source,
1761
last_revision=revision_id,
1763
return f.count_copied, f.failed_revisions
1766
class InterRemoteRepository(InterRepository):
1767
"""Code for converting between RemoteRepository objects.
1769
This just gets an non-remote repository from the RemoteRepository, and calls
1770
InterRepository.get again.
1773
def __init__(self, source, target):
1774
if isinstance(source, remote.RemoteRepository):
1775
source._ensure_real()
1776
real_source = source._real_repository
1778
real_source = source
1779
if isinstance(target, remote.RemoteRepository):
1780
target._ensure_real()
1781
real_target = target._real_repository
1783
real_target = target
1784
self.real_inter = InterRepository.get(real_source, real_target)
1787
def is_compatible(source, target):
1788
if isinstance(source, remote.RemoteRepository):
1790
if isinstance(target, remote.RemoteRepository):
1794
def copy_content(self, revision_id=None):
1795
self.real_inter.copy_content(revision_id=revision_id)
1797
def fetch(self, revision_id=None, pb=None):
1798
self.real_inter.fetch(revision_id=revision_id, pb=pb)
1801
def _get_repo_format_to_test(self):
1805
InterRepository.register_optimiser(InterSameDataRepository)
1806
1811
InterRepository.register_optimiser(InterWeaveRepo)
1807
1812
InterRepository.register_optimiser(InterKnitRepo)
1808
InterRepository.register_optimiser(InterModel1and2)
1809
InterRepository.register_optimiser(InterKnit1and2)
1810
InterRepository.register_optimiser(InterRemoteRepository)
1815
class RepositoryTestProviderAdapter(object):
1816
"""A tool to generate a suite testing multiple repository formats at once.
1818
This is done by copying the test once for each transport and injecting
1819
the transport_server, transport_readonly_server, and bzrdir_format and
1820
repository_format classes into each copy. Each copy is also given a new id()
1821
to make it easy to identify.
1824
def __init__(self, transport_server, transport_readonly_server, formats):
1825
self._transport_server = transport_server
1826
self._transport_readonly_server = transport_readonly_server
1827
self._formats = formats
1829
def adapt(self, test):
1830
result = TestSuite()
1831
for repository_format, bzrdir_format in self._formats:
1832
new_test = deepcopy(test)
1833
new_test.transport_server = self._transport_server
1834
new_test.transport_readonly_server = self._transport_readonly_server
1835
new_test.bzrdir_format = bzrdir_format
1836
new_test.repository_format = repository_format
1837
def make_new_test_id():
1838
new_id = "%s(%s)" % (new_test.id(), repository_format.__class__.__name__)
1839
return lambda: new_id
1840
new_test.id = make_new_test_id()
1841
result.addTest(new_test)
1845
class InterRepositoryTestProviderAdapter(object):
1846
"""A tool to generate a suite testing multiple inter repository formats.
1848
This is done by copying the test once for each interrepo provider and injecting
1849
the transport_server, transport_readonly_server, repository_format and
1850
repository_to_format classes into each copy.
1851
Each copy is also given a new id() to make it easy to identify.
1854
def __init__(self, transport_server, transport_readonly_server, formats):
1855
self._transport_server = transport_server
1856
self._transport_readonly_server = transport_readonly_server
1857
self._formats = formats
1859
def adapt(self, test):
1860
result = TestSuite()
1861
for interrepo_class, repository_format, repository_format_to in self._formats:
1862
new_test = deepcopy(test)
1863
new_test.transport_server = self._transport_server
1864
new_test.transport_readonly_server = self._transport_readonly_server
1865
new_test.interrepo_class = interrepo_class
1866
new_test.repository_format = repository_format
1867
new_test.repository_format_to = repository_format_to
1868
def make_new_test_id():
1869
new_id = "%s(%s)" % (new_test.id(), interrepo_class.__name__)
1870
return lambda: new_id
1871
new_test.id = make_new_test_id()
1872
result.addTest(new_test)
1876
def default_test_list():
1877
"""Generate the default list of interrepo permutations to test."""
1879
# test the default InterRepository between format 6 and the current
1881
# XXX: robertc 20060220 reinstate this when there are two supported
1882
# formats which do not have an optimal code path between them.
1883
result.append((InterRepository,
1884
RepositoryFormat6(),
1885
RepositoryFormatKnit1()))
1886
for optimiser in InterRepository._optimisers:
1887
result.append((optimiser,
1888
optimiser._matching_repo_format,
1889
optimiser._matching_repo_format
1891
# if there are specific combinations we want to use, we can add them
1813
1896
class CopyConverter(object):