~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/weaverepo.py

  • Committer: Matt Nordhoff
  • Date: 2009-04-04 02:50:01 UTC
  • mfrom: (4253 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4256.
  • Revision ID: mnordhoff@mattnordhoff.com-20090404025001-z1403k0tatmc8l91
Merge bzr.dev, fixing conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
"""Deprecated weave-based repository formats.
18
18
 
82
82
 
83
83
        def get_store(name, compressed=True, prefixed=False):
84
84
            # FIXME: This approach of assuming stores are all entirely compressed
85
 
            # or entirely uncompressed is tidy, but breaks upgrade from 
86
 
            # some existing branches where there's a mixture; we probably 
 
85
            # or entirely uncompressed is tidy, but breaks upgrade from
 
86
            # some existing branches where there's a mixture; we probably
87
87
            # still want the option to look for both.
88
88
            relpath = self._escape(name)
89
89
            store = TextStore(a_bzrdir.transport.clone(relpath),
95
95
        # not broken out yet because the controlweaves|inventory_store
96
96
        # and texts bits are still different.
97
97
        if isinstance(_format, RepositoryFormat4):
98
 
            # cannot remove these - there is still no consistent api 
 
98
            # cannot remove these - there is still no consistent api
99
99
            # which allows access to this old info.
100
100
            self.inventory_store = get_store('inventory-store')
101
101
            self._text_store = get_store('text-store')
102
102
        super(AllInOneRepository, self).__init__(_format, a_bzrdir, a_bzrdir._control_files)
103
 
        self._fetch_order = 'topological'
104
 
        self._fetch_reconcile = True
105
103
 
106
104
    @needs_read_lock
107
105
    def _all_possible_ids(self):
112
110
 
113
111
    @needs_read_lock
114
112
    def _all_revision_ids(self):
115
 
        """Returns a list of all the revision ids in the repository. 
 
113
        """Returns a list of all the revision ids in the repository.
116
114
 
117
 
        These are in as much topological order as the underlying store can 
 
115
        These are in as much topological order as the underlying store can
118
116
        present: for weaves ghosts may lead to a lack of correctness until
119
117
        the reweave updates the parents list.
120
118
        """
194
192
 
195
193
    def __init__(self, _format, a_bzrdir, control_files):
196
194
        super(WeaveMetaDirRepository, self).__init__(_format, a_bzrdir, control_files)
197
 
        self._fetch_order = 'topological'
198
 
        self._fetch_reconcile = True
199
195
        self._serializer = _format._serializer
200
196
 
201
197
    @needs_read_lock
207
203
 
208
204
    @needs_read_lock
209
205
    def _all_revision_ids(self):
210
 
        """Returns a list of all the revision ids in the repository. 
 
206
        """Returns a list of all the revision ids in the repository.
211
207
 
212
 
        These are in as much topological order as the underlying store can 
 
208
        These are in as much topological order as the underlying store can
213
209
        present: for weaves ghosts may lead to a lack of correctness until
214
210
        the reweave updates the parents list.
215
211
        """
270
266
    supports_tree_reference = False
271
267
    supports_ghosts = False
272
268
    supports_external_lookups = False
 
269
    supports_chks = False
 
270
    _fetch_order = 'topological'
 
271
    _fetch_reconcile = True
 
272
    fast_deltas = False
273
273
 
274
274
    def initialize(self, a_bzrdir, shared=False, _internal=False):
275
275
        """Create a weave repository."""
279
279
        if not _internal:
280
280
            # always initialized when the bzrdir is.
281
281
            return self.open(a_bzrdir, _found=True)
282
 
        
 
282
 
283
283
        # Create an empty weave
284
284
        sio = StringIO()
285
285
        weavefile.write_weave_v5(weave.Weave(), sio)
286
286
        empty_weave = sio.getvalue()
287
287
 
288
288
        mutter('creating repository in %s.', a_bzrdir.transport.base)
289
 
        
 
289
 
290
290
        # FIXME: RBC 20060125 don't peek under the covers
291
291
        # NB: no need to escape relative paths that are url safe.
292
292
        control_files = lockable_files.LockableFiles(a_bzrdir.transport,
297
297
        try:
298
298
            transport.mkdir_multi(['revision-store', 'weaves'],
299
299
                mode=a_bzrdir._get_dir_mode())
300
 
            transport.put_bytes_non_atomic('inventory.weave', empty_weave)
 
300
            transport.put_bytes_non_atomic('inventory.weave', empty_weave,
 
301
                mode=a_bzrdir._get_file_mode())
301
302
        finally:
302
303
            control_files.unlock()
303
304
        return self.open(a_bzrdir, _found=True)
315
316
        result.signatures = self._get_signatures(repo_transport, result)
316
317
        result.inventories = self._get_inventories(repo_transport, result)
317
318
        result.texts = self._get_texts(repo_transport, result)
 
319
        result.chk_bytes = None
318
320
        return result
319
321
 
320
322
    def check_conversion_target(self, target_format):
335
337
 
336
338
    _matchingbzrdir = bzrdir.BzrDirFormat4()
337
339
 
338
 
    def __init__(self):
339
 
        super(RepositoryFormat4, self).__init__()
340
 
        self._fetch_order = 'topological'
341
 
        self._fetch_reconcile = True
342
 
 
343
340
    def get_format_description(self):
344
341
        """See RepositoryFormat.get_format_description()."""
345
342
        return "Repository format 4"
352
349
        """Format 4 is not supported.
353
350
 
354
351
        It is not supported because the model changed from 4 to 5 and the
355
 
        conversion logic is expensive - so doing it on the fly was not 
 
352
        conversion logic is expensive - so doing it on the fly was not
356
353
        feasible.
357
354
        """
358
355
        return False
391
388
    def _serializer(self):
392
389
        return xml5.serializer_v5
393
390
 
394
 
    def __init__(self):
395
 
        super(RepositoryFormat5, self).__init__()
396
 
        self._fetch_order = 'topological'
397
 
        self._fetch_reconcile = True
398
 
 
399
391
    def get_format_description(self):
400
392
        """See RepositoryFormat.get_format_description()."""
401
393
        return "Weave repository format 5"
402
 
    
 
394
 
403
395
    def network_name(self):
404
396
        """The network name for this format is the control dirs disk label."""
405
397
        return self._matchingbzrdir.get_format_string()
441
433
    def _serializer(self):
442
434
        return xml5.serializer_v5
443
435
 
444
 
    def __init__(self):
445
 
        super(RepositoryFormat6, self).__init__()
446
 
        self._fetch_order = 'topological'
447
 
        self._fetch_reconcile = True
448
 
 
449
436
    def get_format_description(self):
450
437
        """See RepositoryFormat.get_format_description()."""
451
438
        return "Weave repository format 6"
490
477
 
491
478
    _versionedfile_class = weave.WeaveFile
492
479
    supports_ghosts = False
 
480
    supports_chks = False
 
481
 
 
482
    _fetch_order = 'topological'
 
483
    _fetch_reconcile = True
 
484
    fast_deltas = False
493
485
    @property
494
486
    def _serializer(self):
495
487
        return xml5.serializer_v5
539
531
 
540
532
        mutter('creating repository in %s.', a_bzrdir.transport.base)
541
533
        dirs = ['revision-store', 'weaves']
542
 
        files = [('inventory.weave', StringIO(empty_weave)), 
 
534
        files = [('inventory.weave', StringIO(empty_weave)),
543
535
                 ]
544
536
        utf8_files = [('format', self.get_format_string())]
545
 
 
 
537
 
546
538
        self._upload_blank_content(a_bzrdir, dirs, files, utf8_files, shared)
547
539
        return self.open(a_bzrdir=a_bzrdir, _found=True)
548
540
 
549
541
    def open(self, a_bzrdir, _found=False, _override_transport=None):
550
542
        """See RepositoryFormat.open().
551
 
        
 
543
 
552
544
        :param _override_transport: INTERNAL USE ONLY. Allows opening the
553
545
                                    repository at a slightly different url
554
546
                                    than normal. I.e. during 'upgrade'.
567
559
        result.signatures = self._get_signatures(repo_transport, result)
568
560
        result.inventories = self._get_inventories(repo_transport, result)
569
561
        result.texts = self._get_texts(repo_transport, result)
 
562
        result.chk_bytes = None
570
563
        result._transport = repo_transport
571
564
        return result
572
565
 
675
668
                continue
676
669
            result[key] = parents
677
670
        return result
678
 
    
 
671
 
679
672
    def get_record_stream(self, keys, sort_order, include_delta_closure):
680
673
        for key in keys:
681
674
            text, parents = self._load_text_parents(key)
715
708
                continue
716
709
            result[key] = None
717
710
        return result
718
 
    
 
711
 
719
712
    def get_record_stream(self, keys, sort_order, include_delta_closure):
720
713
        for key in keys:
721
714
            text = self._load_text(key)