/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/tests/test_merge.py

  • Committer: Robert Collins
  • Date: 2009-08-26 03:20:32 UTC
  • mfrom: (4637 +trunk)
  • mto: (4634.6.2 2.0)
  • mto: This revision was merged to the branch mainline in revision 4660.
  • Revision ID: robertc@robertcollins.net-20090826032032-mx5kiog3eihaoy13
Merge and cherrypick outstanding 2.0 relevant patches from bzr.dev: Up to rev
4637, then 4639,4641,4643,4646,4649,4650,4651. (Robert Collins)

Log messages of the incorporated fixes:

revno: 4651 [merge]
  (robertc) Enable commit via record_iter_changes for specific file
        comments. (Robert Collins)

revno: 4650 [merge]
  Fix shelve on windows. (Robert Collins, #305006)

revno: 4649 [merge]
  (robertc) Make iter_changes produce output that is always safe to
        generate inventory deltas of in the same direction as the
        changes. (Robert Collins, #347649)

revno: 4646 [merge]
  (mbp) developer documentation about content filtering

revno: 4643 [merge]
  (mbp) small tweaks to release documentation

revno: 4641 [merge]
  (abentley) Shelve will not remove tree root.

revno: 4639 [merge]
  (andrew) Fix 'Revision ... not present' errors when upgrading stacked
        branches.

revno: 4637 [merge]
  Fix upgrade of branches in repositories.

revno: 4636 [merge]
  (mbp) fix crash formatting CannotBindAddress

revno: 4635 [merge]
  (robertc) Fix many locking errors on windows due to a small bug in
        merge.transform_tree. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
117
117
 
118
118
    def test_create_rename(self):
119
119
        """Rename an inventory entry while creating the file"""
120
 
        self.thisFailsStrictLockCheck()
121
120
        tree =self.make_branch_and_tree('.')
122
121
        file('name1', 'wb').write('Hello')
123
122
        tree.add('name1')
128
127
 
129
128
    def test_layered_rename(self):
130
129
        """Rename both child and parent at same time"""
131
 
        self.thisFailsStrictLockCheck()
132
130
        tree =self.make_branch_and_tree('.')
133
131
        os.mkdir('dirname1')
134
132
        tree.add('dirname1')
215
213
        self.assertFileEqual('text2', 'tree/sub-tree/file')
216
214
 
217
215
    def test_merge_with_missing(self):
218
 
        self.thisFailsStrictLockCheck()
219
216
        tree_a = self.make_branch_and_tree('tree_a')
220
217
        self.build_tree_contents([('tree_a/file', 'content_1')])
221
218
        tree_a.add('file')
222
219
        tree_a.commit('commit base')
223
220
        # basis_tree() is only guaranteed to be valid as long as it is actually
224
 
        # the basis tree. This mutates the tree after grabbing basis, so go to
225
 
        # the repository.
 
221
        # the basis tree. This test commits to the tree after grabbing basis,
 
222
        # so we go to the repository.
226
223
        base_tree = tree_a.branch.repository.revision_tree(tree_a.last_revision())
227
224
        tree_b = tree_a.bzrdir.sprout('tree_b').open_workingtree()
228
225
        self.build_tree_contents([('tree_a/file', 'content_2')])
229
226
        tree_a.commit('commit other')
230
227
        other_tree = tree_a.basis_tree()
 
228
        # 'file' is now missing but isn't altered in any commit in b so no
 
229
        # change should be applied.
231
230
        os.unlink('tree_b/file')
232
231
        merge_inner(tree_b.branch, other_tree, base_tree, this_tree=tree_b)
233
232
 
1235
1234
 
1236
1235
class TestMergerInMemory(TestMergerBase):
1237
1236
 
 
1237
    def test_cache_trees_with_revision_ids_None(self):
 
1238
        merger = self.make_Merger(self.setup_simple_graph(), 'C-id')
 
1239
        original_cache = dict(merger._cached_trees)
 
1240
        merger.cache_trees_with_revision_ids([None])
 
1241
        self.assertEqual(original_cache, merger._cached_trees)
 
1242
 
 
1243
    def test_cache_trees_with_revision_ids_no_revision_id(self):
 
1244
        merger = self.make_Merger(self.setup_simple_graph(), 'C-id')
 
1245
        original_cache = dict(merger._cached_trees)
 
1246
        tree = self.make_branch_and_memory_tree('tree')
 
1247
        merger.cache_trees_with_revision_ids([tree])
 
1248
        self.assertEqual(original_cache, merger._cached_trees)
 
1249
 
 
1250
    def test_cache_trees_with_revision_ids_having_revision_id(self):
 
1251
        merger = self.make_Merger(self.setup_simple_graph(), 'C-id')
 
1252
        original_cache = dict(merger._cached_trees)
 
1253
        tree = merger.this_branch.repository.revision_tree('B-id')
 
1254
        original_cache['B-id'] = tree
 
1255
        merger.cache_trees_with_revision_ids([tree])
 
1256
        self.assertEqual(original_cache, merger._cached_trees)
 
1257
 
1238
1258
    def test_find_base(self):
1239
1259
        merger = self.make_Merger(self.setup_simple_graph(), 'C-id')
1240
1260
        self.assertEqual('A-id', merger.base_rev_id)