~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/repofmt/weaverepo.py

  • Committer: Andrew Bennetts
  • Date: 2009-04-02 05:53:12 UTC
  • mto: This revision was merged to the branch mainline in revision 4242.
  • Revision ID: andrew.bennetts@canonical.com-20090402055312-h7mvgumvm7e620mj
Fix nits in spelling and naming.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007, 2008 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
28
28
lazy_import(globals(), """
29
29
from bzrlib import (
30
30
    xml5,
31
 
    graph as _mod_graph,
32
31
    )
33
32
""")
34
33
from bzrlib import (
39
38
    lockdir,
40
39
    osutils,
41
40
    revision as _mod_revision,
42
 
    trace,
43
41
    urlutils,
44
42
    versionedfile,
45
43
    weave,
54
52
    RepositoryFormat,
55
53
    )
56
54
from bzrlib.store.text import TextStore
 
55
from bzrlib.trace import mutter
57
56
from bzrlib.tuned_gzip import GzipFile, bytes_to_gzip
58
57
from bzrlib.versionedfile import (
59
58
    AbsentContentFactory,
106
105
    def _all_possible_ids(self):
107
106
        """Return all the possible revisions that we could find."""
108
107
        if 'evil' in debug.debug_flags:
109
 
            trace.mutter_callsite(
110
 
                3, "_all_possible_ids scales with size of history.")
 
108
            mutter_callsite(3, "_all_possible_ids scales with size of history.")
111
109
        return [key[-1] for key in self.inventories.keys()]
112
110
 
113
111
    @needs_read_lock
177
175
        :param new_value: True to restore the default, False to disable making
178
176
                          working trees.
179
177
        """
180
 
        raise errors.RepositoryUpgradeRequired(self.user_url)
 
178
        raise errors.RepositoryUpgradeRequired(self.bzrdir.root_transport.base)
181
179
 
182
180
    def make_working_trees(self):
183
181
        """Returns the policy for making working trees on new branches."""
200
198
    def _all_possible_ids(self):
201
199
        """Return all the possible revisions that we could find."""
202
200
        if 'evil' in debug.debug_flags:
203
 
            trace.mutter_callsite(
204
 
                3, "_all_possible_ids scales with size of history.")
 
201
            mutter_callsite(3, "_all_possible_ids scales with size of history.")
205
202
        return [key[-1] for key in self.inventories.keys()]
206
203
 
207
204
    @needs_read_lock
269
266
    supports_tree_reference = False
270
267
    supports_ghosts = False
271
268
    supports_external_lookups = False
272
 
    supports_chks = False
273
269
    _fetch_order = 'topological'
274
270
    _fetch_reconcile = True
275
271
    fast_deltas = False
288
284
        weavefile.write_weave_v5(weave.Weave(), sio)
289
285
        empty_weave = sio.getvalue()
290
286
 
291
 
        trace.mutter('creating repository in %s.', a_bzrdir.transport.base)
 
287
        mutter('creating repository in %s.', a_bzrdir.transport.base)
292
288
 
293
289
        # FIXME: RBC 20060125 don't peek under the covers
294
290
        # NB: no need to escape relative paths that are url safe.
304
300
                mode=a_bzrdir._get_file_mode())
305
301
        finally:
306
302
            control_files.unlock()
307
 
        repository = self.open(a_bzrdir, _found=True)
308
 
        self._run_post_repo_init_hooks(repository, a_bzrdir, shared)
309
 
        return repository
 
303
        return self.open(a_bzrdir, _found=True)
310
304
 
311
305
    def open(self, a_bzrdir, _found=False):
312
306
        """See RepositoryFormat.open()."""
321
315
        result.signatures = self._get_signatures(repo_transport, result)
322
316
        result.inventories = self._get_inventories(repo_transport, result)
323
317
        result.texts = self._get_texts(repo_transport, result)
324
 
        result.chk_bytes = None
325
318
        return result
326
319
 
 
320
    def check_conversion_target(self, target_format):
 
321
        pass
 
322
 
327
323
 
328
324
class RepositoryFormat4(PreSplitOutRepositoryFormat):
329
325
    """Bzr repository format 4.
479
475
 
480
476
    _versionedfile_class = weave.WeaveFile
481
477
    supports_ghosts = False
482
 
    supports_chks = False
483
 
 
484
478
    _fetch_order = 'topological'
485
479
    _fetch_reconcile = True
486
480
    fast_deltas = False
496
490
        """See RepositoryFormat.get_format_description()."""
497
491
        return "Weave repository format 7"
498
492
 
 
493
    def check_conversion_target(self, target_format):
 
494
        pass
 
495
 
499
496
    def _get_inventories(self, repo_transport, repo, name='inventory'):
500
497
        mapper = versionedfile.ConstantMapper(name)
501
498
        return versionedfile.ThunkedVersionedFiles(repo_transport,
528
525
        weavefile.write_weave_v5(weave.Weave(), sio)
529
526
        empty_weave = sio.getvalue()
530
527
 
531
 
        trace.mutter('creating repository in %s.', a_bzrdir.transport.base)
 
528
        mutter('creating repository in %s.', a_bzrdir.transport.base)
532
529
        dirs = ['revision-store', 'weaves']
533
530
        files = [('inventory.weave', StringIO(empty_weave)),
534
531
                 ]
558
555
        result.signatures = self._get_signatures(repo_transport, result)
559
556
        result.inventories = self._get_inventories(repo_transport, result)
560
557
        result.texts = self._get_texts(repo_transport, result)
561
 
        result.chk_bytes = None
562
558
        result._transport = repo_transport
563
559
        return result
564
560
 
668
664
            result[key] = parents
669
665
        return result
670
666
 
671
 
    def get_known_graph_ancestry(self, keys):
672
 
        """Get a KnownGraph instance with the ancestry of keys."""
673
 
        keys = self.keys()
674
 
        parent_map = self.get_parent_map(keys)
675
 
        kg = _mod_graph.KnownGraph(parent_map)
676
 
        return kg
677
 
 
678
667
    def get_record_stream(self, keys, sort_order, include_delta_closure):
679
668
        for key in keys:
680
669
            text, parents = self._load_text_parents(key)
692
681
            path, ext = os.path.splitext(relpath)
693
682
            if ext == '.gz':
694
683
                relpath = path
695
 
            if not relpath.endswith('.sig'):
 
684
            if '.sig' not in relpath:
696
685
                relpaths.add(relpath)
697
686
        paths = list(relpaths)
698
687
        return set([self._mapper.unmap(path) for path in paths])