~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/weaverepo.py

  • Committer: John Arbash Meinel
  • Date: 2008-07-11 21:41:24 UTC
  • mto: This revision was merged to the branch mainline in revision 3543.
  • Revision ID: john@arbash-meinel.com-20080711214124-qi09irlj7pd5cuzg
Shortcut the case when one revision is in the ancestry of the other.

At the cost of a heads() check, when one parent supersedes, we don't have to extract
the text for the other. Changes merge time from 3m37s => 3m21s. Using a
CachingParentsProvider would drop the time down to 3m11s.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
from cStringIO import StringIO
25
25
import urllib
26
26
 
27
 
from bzrlib.lazy_import import lazy_import
28
 
lazy_import(globals(), """
29
 
from bzrlib import (
30
 
    xml5,
31
 
    )
32
 
""")
33
27
from bzrlib import (
34
28
    bzrdir,
35
29
    debug,
38
32
    lockdir,
39
33
    osutils,
40
34
    revision as _mod_revision,
41
 
    urlutils,
42
35
    versionedfile,
43
36
    weave,
44
37
    weavefile,
 
38
    xml5,
45
39
    )
46
40
from bzrlib.decorators import needs_read_lock, needs_write_lock
47
41
from bzrlib.repository import (
64
58
class AllInOneRepository(Repository):
65
59
    """Legacy support - the repository behaviour for all-in-one branches."""
66
60
 
67
 
    @property
68
 
    def _serializer(self):
69
 
        return xml5.serializer_v5
70
 
 
71
 
    def _escape(self, file_or_path):
72
 
        if not isinstance(file_or_path, basestring):
73
 
            file_or_path = '/'.join(file_or_path)
74
 
        if file_or_path == '':
75
 
            return u''
76
 
        return urlutils.escape(osutils.safe_unicode(file_or_path))
 
61
    _serializer = xml5.serializer_v5
77
62
 
78
63
    def __init__(self, _format, a_bzrdir):
79
64
        # we reuse one control files instance.
85
70
            # or entirely uncompressed is tidy, but breaks upgrade from 
86
71
            # some existing branches where there's a mixture; we probably 
87
72
            # still want the option to look for both.
88
 
            relpath = self._escape(name)
 
73
            relpath = a_bzrdir._control_files._escape(name)
89
74
            store = TextStore(a_bzrdir.transport.clone(relpath),
90
75
                              prefixed=prefixed, compressed=compressed,
91
76
                              dir_mode=dir_mode,
100
85
            self.inventory_store = get_store('inventory-store')
101
86
            self._text_store = get_store('text-store')
102
87
        super(AllInOneRepository, self).__init__(_format, a_bzrdir, a_bzrdir._control_files)
103
 
        self._fetch_order = 'topological'
104
 
        self._fetch_reconcile = True
105
88
 
106
89
    @needs_read_lock
107
90
    def _all_possible_ids(self):
163
146
        return self.inventories.add_lines((revision_id,), final_parents, lines,
164
147
            check_content=check_content)[0]
165
148
 
 
149
    @needs_read_lock
166
150
    def is_shared(self):
167
151
        """AllInOne repositories cannot be shared."""
168
152
        return False
192
176
class WeaveMetaDirRepository(MetaDirVersionedFileRepository):
193
177
    """A subclass of MetaDirRepository to set weave specific policy."""
194
178
 
195
 
    @property
196
 
    def _serializer(self):
197
 
        return xml5.serializer_v5
198
 
 
199
 
    def __init__(self, _format, a_bzrdir, control_files):
200
 
        super(WeaveMetaDirRepository, self).__init__(_format, a_bzrdir, control_files)
201
 
        self._fetch_order = 'topological'
202
 
        self._fetch_reconcile = True
 
179
    _serializer = xml5.serializer_v5
203
180
 
204
181
    @needs_read_lock
205
182
    def _all_possible_ids(self):
340
317
 
341
318
    def __init__(self):
342
319
        super(RepositoryFormat4, self).__init__()
343
 
        self._fetch_order = 'topological'
344
 
        self._fetch_reconcile = True
345
320
 
346
321
    def get_format_description(self):
347
322
        """See RepositoryFormat.get_format_description()."""
393
368
 
394
369
    def __init__(self):
395
370
        super(RepositoryFormat5, self).__init__()
396
 
        self._fetch_order = 'topological'
397
 
        self._fetch_reconcile = True
398
371
 
399
372
    def get_format_description(self):
400
373
        """See RepositoryFormat.get_format_description()."""
437
410
 
438
411
    def __init__(self):
439
412
        super(RepositoryFormat6, self).__init__()
440
 
        self._fetch_order = 'topological'
441
 
        self._fetch_reconcile = True
442
413
 
443
414
    def get_format_description(self):
444
415
        """See RepositoryFormat.get_format_description()."""