/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: John Arbash Meinel
  • Date: 2009-04-21 23:54:16 UTC
  • mto: (4300.1.7 groupcompress_info)
  • mto: This revision was merged to the branch mainline in revision 4301.
  • Revision ID: john@arbash-meinel.com-20090421235416-f0cz6ilf5cufbugi
Fix bug #364900, properly remove the 64kB that was just encoded in the copy.
Also, stop supporting None as a copy length in 'encode_copy_instruction'.
It was only used by the test suite, and it is good to pull that sort of thing out of
production code. (Besides, setting the copy to 64kB has the same effect.)

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
288
285
        weavefile.write_weave_v5(weave.Weave(), sio)
289
286
        empty_weave = sio.getvalue()
290
287
 
291
 
        trace.mutter('creating repository in %s.', a_bzrdir.transport.base)
 
288
        mutter('creating repository in %s.', a_bzrdir.transport.base)
292
289
 
293
290
        # FIXME: RBC 20060125 don't peek under the covers
294
291
        # NB: no need to escape relative paths that are url safe.
304
301
                mode=a_bzrdir._get_file_mode())
305
302
        finally:
306
303
            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
 
304
        return self.open(a_bzrdir, _found=True)
310
305
 
311
306
    def open(self, a_bzrdir, _found=False):
312
307
        """See RepositoryFormat.open()."""
324
319
        result.chk_bytes = None
325
320
        return result
326
321
 
 
322
    def check_conversion_target(self, target_format):
 
323
        pass
 
324
 
327
325
 
328
326
class RepositoryFormat4(PreSplitOutRepositoryFormat):
329
327
    """Bzr repository format 4.
496
494
        """See RepositoryFormat.get_format_description()."""
497
495
        return "Weave repository format 7"
498
496
 
 
497
    def check_conversion_target(self, target_format):
 
498
        pass
 
499
 
499
500
    def _get_inventories(self, repo_transport, repo, name='inventory'):
500
501
        mapper = versionedfile.ConstantMapper(name)
501
502
        return versionedfile.ThunkedVersionedFiles(repo_transport,
528
529
        weavefile.write_weave_v5(weave.Weave(), sio)
529
530
        empty_weave = sio.getvalue()
530
531
 
531
 
        trace.mutter('creating repository in %s.', a_bzrdir.transport.base)
 
532
        mutter('creating repository in %s.', a_bzrdir.transport.base)
532
533
        dirs = ['revision-store', 'weaves']
533
534
        files = [('inventory.weave', StringIO(empty_weave)),
534
535
                 ]
668
669
            result[key] = parents
669
670
        return result
670
671
 
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
672
    def get_record_stream(self, keys, sort_order, include_delta_closure):
679
673
        for key in keys:
680
674
            text, parents = self._load_text_parents(key)
692
686
            path, ext = os.path.splitext(relpath)
693
687
            if ext == '.gz':
694
688
                relpath = path
695
 
            if not relpath.endswith('.sig'):
 
689
            if '.sig' not in relpath:
696
690
                relpaths.add(relpath)
697
691
        paths = list(relpaths)
698
692
        return set([self._mapper.unmap(path) for path in paths])