~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_versioning.py

(vila) Revise legal option names to be less drastic. (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2007, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007, 2009-2012 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
67
67
        self.run_bzr(['mkdir', 'dir'])
68
68
        self.assert_(os.path.isdir('dir'))
69
69
 
70
 
        os.chdir('dir')
71
70
        self.log('Run mkdir in subdir')
72
 
        self.run_bzr(['mkdir', 'subdir'])
73
 
        self.assert_(os.path.isdir('subdir'))
74
 
        os.chdir('..')
 
71
        self.run_bzr(['mkdir', 'subdir'], working_dir='dir')
 
72
        self.assert_(os.path.isdir('dir/subdir'))
75
73
 
76
74
        wt = WorkingTree.open('.')
77
75
 
148
146
        new = b.repository.revision_tree(b.get_rev_id(2))
149
147
        new.lock_read()
150
148
 
151
 
        self.assertEqual(new.get_file_by_path('b/two').read(), 'old contents')
152
 
        self.assertEqual(new.get_file_by_path('top').read(), 'old contents')
153
 
        self.assertEqual(new.get_file_by_path('a/one').read(), 'new contents')
 
149
        def get_text_by_path(tree, path):
 
150
            return tree.get_file_text(tree.path2id(path), path)
 
151
 
 
152
        self.assertEqual(get_text_by_path(new, 'b/two'), 'old contents')
 
153
        self.assertEqual(get_text_by_path(new, 'top'), 'old contents')
 
154
        self.assertEqual(get_text_by_path(new, 'a/one'), 'new contents')
154
155
        new.unlock()
155
156
 
156
 
        os.chdir('a')
157
157
        # commit from here should do nothing
158
 
        self.run_bzr(['commit', '.', '-m', 'commit subdir only', '--unchanged'])
 
158
        self.run_bzr(['commit', '.', '-m', 'commit subdir only', '--unchanged'],
 
159
                     working_dir='a')
159
160
        v3 = b.repository.revision_tree(b.get_rev_id(3))
160
161
        v3.lock_read()
161
 
        self.assertEqual(v3.get_file_by_path('b/two').read(), 'old contents')
162
 
        self.assertEqual(v3.get_file_by_path('top').read(), 'old contents')
163
 
        self.assertEqual(v3.get_file_by_path('a/one').read(), 'new contents')
 
162
        self.assertEqual(get_text_by_path(v3, 'b/two'), 'old contents')
 
163
        self.assertEqual(get_text_by_path(v3, 'top'), 'old contents')
 
164
        self.assertEqual(get_text_by_path(v3, 'a/one'), 'new contents')
164
165
        v3.unlock()
165
166
 
166
167
        # commit in subdirectory commits whole tree
167
 
        self.run_bzr(['commit', '-m', 'commit whole tree from subdir'])
 
168
        self.run_bzr(['commit', '-m', 'commit whole tree from subdir'],
 
169
                     working_dir='a')
168
170
        v4 = b.repository.revision_tree(b.get_rev_id(4))
169
171
        v4.lock_read()
170
 
        self.assertEqual(v4.get_file_by_path('b/two').read(), 'new contents')
171
 
        self.assertEqual(v4.get_file_by_path('top').read(), 'new contents')
 
172
        self.assertEqual(get_text_by_path(v4, 'b/two'), 'new contents')
 
173
        self.assertEqual(get_text_by_path(v4, 'top'), 'new contents')
172
174
        v4.unlock()
173
175
 
174
176
        # TODO: factor out some kind of assert_tree_state() method