/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_revert.py

  • Committer: John Arbash Meinel
  • Date: 2008-07-09 21:42:24 UTC
  • mto: This revision was merged to the branch mainline in revision 3543.
  • Revision ID: john@arbash-meinel.com-20080709214224-r75k87r6a01pfc3h
Restore a real weave merge to 'bzr merge --weave'.

To do so efficiently, we only add the simple LCAs to the final weave
object, unless we run into complexities with the merge graph.
This gives the same effective result as adding all the texts,
with the advantage of not having to extract all of them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2006 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
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
import os
18
18
 
32
32
        source_tree.commit('added dir')
33
33
        target_tree.lock_write()
34
34
        self.addCleanup(target_tree.unlock)
35
 
        merge.merge_inner(target_tree.branch, source_tree.basis_tree(),
 
35
        merge.merge_inner(target_tree.branch, source_tree.basis_tree(), 
36
36
                          target_tree.basis_tree(), this_tree=target_tree)
37
37
        self.failUnlessExists('target/dir')
38
38
        self.failUnlessExists('target/dir/contents')
67
67
        tree.commit('add new_file')
68
68
        tree.revert(old_tree=basis_tree)
69
69
        self.failIfExists('tree/new_file')
70
 
 
 
70
        
71
71
        # files should be deleted if their changes came from merges
72
72
        merge_target.merge_from_branch(tree.branch)
73
73
        self.failUnlessExists('merge_target/new_file')
157
157
        self.failUnlessExists('dir/file1')
158
158
        self.failIfExists('dir/file2')
159
159
        self.assertEqual('dir-id', tree.path2id('dir'))
160
 
 
161
 
    def test_revert_root_id_change(self):
162
 
        tree = self.make_branch_and_tree('.')
163
 
        tree.set_root_id('initial-root-id')
164
 
        self.build_tree(['file1'])
165
 
        tree.add(['file1'])
166
 
        tree.commit('first')
167
 
        tree.set_root_id('temp-root-id')
168
 
        self.assertEqual('temp-root-id', tree.get_root_id())
169
 
        tree.revert()
170
 
        self.assertEqual('initial-root-id', tree.get_root_id())