~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bundle.py

  • Committer: Andrew Bennetts
  • Date: 2010-01-18 07:00:11 UTC
  • mto: (4973.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4975.
  • Revision ID: andrew.bennetts@canonical.com-20100118070011-zu374wvd0lcgai5a
Move news_merge plugin from contrib to bzrlib/plugins, change it to be enabled via a 'news_merge_files' config option, move more code out of the __init__ to minimise overhead, and add lots of docstrings, add NEWS entry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2004, 2005, 2006, 2007 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
114
114
            ie = InventoryDirectory(file_id, name, parent_id)
115
115
        elif kind == 'file':
116
116
            ie = InventoryFile(file_id, name, parent_id)
117
 
            ie.text_sha1 = text_sha_1
118
 
            ie.text_size = text_size
119
117
        elif kind == 'symlink':
120
118
            ie = InventoryLink(file_id, name, parent_id)
121
119
        else:
122
120
            raise errors.BzrError('unknown kind %r' % kind)
 
121
        ie.text_sha1 = text_sha_1
 
122
        ie.text_size = text_size
123
123
        return ie
124
124
 
125
125
    def add_dir(self, file_id, path):
1039
1039
        bundle = read_bundle(self.create_bundle_text('null:', 'rev2')[0])
1040
1040
        repo = self.make_repository('repo', format='dirstate-with-subtree')
1041
1041
        bundle.install_revisions(repo)
1042
 
        inv_text = repo._get_inventory_xml('rev2')
 
1042
        inv_text = repo.get_inventory_xml('rev2')
1043
1043
        self.assertNotContainsRe(inv_text, 'format="5"')
1044
1044
        self.assertContainsRe(inv_text, 'format="7"')
1045
1045
 
1065
1065
 
1066
1066
    def test_inv_hash_across_serializers(self):
1067
1067
        repo = self.make_repo_with_installed_revisions()
1068
 
        recorded_inv_sha1 = repo.get_revision('rev2').inventory_sha1
1069
 
        xml = repo._get_inventory_xml('rev2')
 
1068
        recorded_inv_sha1 = repo.get_inventory_sha1('rev2')
 
1069
        xml = repo.get_inventory_xml('rev2')
1070
1070
        self.assertEqual(osutils.sha_string(xml), recorded_inv_sha1)
1071
1071
 
1072
1072
    def test_across_models_incompatible(self):
1820
1820
            def look_up(self, name, url):
1821
1821
                return 'source'
1822
1822
        directories.register('foo:', FooService, 'Testing directory service')
1823
 
        self.addCleanup(directories.remove, 'foo:')
 
1823
        self.addCleanup(lambda: directories.remove('foo:'))
1824
1824
        self.build_tree_contents([('./foo:bar', out.getvalue())])
1825
1825
        self.assertRaises(errors.NotABundle, read_mergeable_from_url,
1826
1826
                          'foo:bar')