/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/weaverepo.py

  • Committer: Jelmer Vernooij
  • Date: 2011-01-19 18:40:15 UTC
  • mfrom: (5622 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5624.
  • Revision ID: jelmer@samba.org-20110119184015-ahycpz0yduideif0
merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Canonical Ltd
 
1
# Copyright (C) 2007-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
20
20
ghosts.
21
21
"""
22
22
 
 
23
import gzip
23
24
import os
24
25
from cStringIO import StringIO
25
26
import urllib
39
40
    lockable_files,
40
41
    lockdir,
41
42
    osutils,
 
43
    symbol_versioning,
42
44
    trace,
 
45
    tuned_gzip,
43
46
    urlutils,
44
47
    versionedfile,
45
48
    weave,
56
59
    RepositoryFormat,
57
60
    )
58
61
from bzrlib.store.text import TextStore
59
 
from bzrlib.tuned_gzip import GzipFile, bytes_to_gzip
60
62
from bzrlib.versionedfile import (
61
63
    AbsentContentFactory,
62
64
    FulltextContentFactory,
339
341
    has been removed.
340
342
    """
341
343
 
 
344
    supports_funky_characters = False
 
345
 
342
346
    _matchingbzrdir = bzrdir.BzrDirFormat4()
343
347
 
344
348
    def get_format_description(self):
388
392
 
389
393
    _versionedfile_class = weave.WeaveFile
390
394
    _matchingbzrdir = bzrdir.BzrDirFormat5()
 
395
    supports_funky_characters = False
 
396
 
391
397
    @property
392
398
    def _serializer(self):
393
399
        return xml5.serializer_v5
433
439
 
434
440
    _versionedfile_class = weave.WeaveFile
435
441
    _matchingbzrdir = bzrdir.BzrDirFormat6()
 
442
    supports_funky_characters = False
436
443
    @property
437
444
    def _serializer(self):
438
445
        return xml5.serializer_v5
482
489
    _versionedfile_class = weave.WeaveFile
483
490
    supports_ghosts = False
484
491
    supports_chks = False
 
492
    supports_funky_characters = False
485
493
 
486
494
    _fetch_order = 'topological'
487
495
    _fetch_reconcile = True
589
597
            raise ValueError('bad idea to put / in %r' % (key,))
590
598
        text = ''.join(lines)
591
599
        if self._compressed:
592
 
            text = bytes_to_gzip(text)
 
600
            text = tuned_gzip.bytes_to_gzip(text)
593
601
        path = self._map(key)
594
602
        self._transport.put_bytes_non_atomic(path, text, create_parent_dir=True)
595
603
 
637
645
            else:
638
646
                return None
639
647
        if compressed:
640
 
            text = GzipFile(mode='rb', fileobj=StringIO(text)).read()
 
648
            text = gzip.GzipFile(mode='rb', fileobj=StringIO(text)).read()
641
649
        return text
642
650
 
643
651
    def _map(self, key):
743
751
 
744
752
class InterWeaveRepo(InterSameDataRepository):
745
753
    """Optimised code paths between Weave based repositories.
746
 
 
747
 
    This should be in bzrlib/repofmt/weaverepo.py but we have not yet
748
 
    implemented lazy inter-object optimisation.
749
754
    """
750
755
 
751
756
    @classmethod
803
808
            self.target.fetch(self.source, revision_id=revision_id)
804
809
 
805
810
    @needs_read_lock
806
 
    def search_missing_revision_ids(self, revision_id=None, find_ghosts=True):
807
 
        """See InterRepository.missing_revision_ids()."""
 
811
    def search_missing_revision_ids(self,
 
812
            revision_id=symbol_versioning.DEPRECATED_PARAMETER,
 
813
            find_ghosts=True, revision_ids=None, if_present_ids=None):
 
814
        """See InterRepository.search_missing_revision_ids()."""
808
815
        # we want all revisions to satisfy revision_id in source.
809
816
        # but we don't want to stat every file here and there.
810
817
        # we want then, all revisions other needs to satisfy revision_id
816
823
        # disk format scales terribly for push anyway due to rewriting
817
824
        # inventory.weave, this is considered acceptable.
818
825
        # - RBC 20060209
819
 
        if revision_id is not None:
820
 
            source_ids = self.source.get_ancestry(revision_id)
821
 
            if source_ids[0] is not None:
822
 
                raise AssertionError()
823
 
            source_ids.pop(0)
824
 
        else:
825
 
            source_ids = self.source._all_possible_ids()
826
 
        source_ids_set = set(source_ids)
 
826
        if symbol_versioning.deprecated_passed(revision_id):
 
827
            symbol_versioning.warn(
 
828
                'search_missing_revision_ids(revision_id=...) was '
 
829
                'deprecated in 2.3.  Use revision_ids=[...] instead.',
 
830
                DeprecationWarning, stacklevel=2)
 
831
            if revision_ids is not None:
 
832
                raise AssertionError(
 
833
                    'revision_ids is mutually exclusive with revision_id')
 
834
            if revision_id is not None:
 
835
                revision_ids = [revision_id]
 
836
        del revision_id
 
837
        source_ids_set = self._present_source_revisions_for(
 
838
            revision_ids, if_present_ids)
827
839
        # source_ids is the worst possible case we may need to pull.
828
840
        # now we want to filter source_ids against what we actually
829
841
        # have in target, but don't try to check for existence where we know
833
845
        actually_present_revisions = set(
834
846
            self.target._eliminate_revisions_not_present(possibly_present_revisions))
835
847
        required_revisions = source_ids_set.difference(actually_present_revisions)
836
 
        if revision_id is not None:
 
848
        if revision_ids is not None:
837
849
            # we used get_ancestry to determine source_ids then we are assured all
838
850
            # revisions referenced are present as they are installed in topological order.
839
851
            # and the tip revision was validated by get_ancestry.