~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Patch Queue Manager
  • Date: 2011-11-25 11:17:41 UTC
  • mfrom: (6290.1.3 tree-use-path2id)
  • Revision ID: pqm@pqm.ubuntu.com-20111125111741-sc39dofu8b2zx4zl
(jelmer) Deprecate Tree.get_file_by_path. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
148
148
        new = b.repository.revision_tree(b.get_rev_id(2))
149
149
        new.lock_read()
150
150
 
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')
 
151
        def get_text_by_path(tree, path):
 
152
            return tree.get_file_text(tree.path2id(path), path)
 
153
 
 
154
        self.assertEqual(get_text_by_path(new, 'b/two'), 'old contents')
 
155
        self.assertEqual(get_text_by_path(new, 'top'), 'old contents')
 
156
        self.assertEqual(get_text_by_path(new, 'a/one'), 'new contents')
154
157
        new.unlock()
155
158
 
156
159
        os.chdir('a')
158
161
        self.run_bzr(['commit', '.', '-m', 'commit subdir only', '--unchanged'])
159
162
        v3 = b.repository.revision_tree(b.get_rev_id(3))
160
163
        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')
 
164
        self.assertEqual(get_text_by_path(v3, 'b/two'), 'old contents')
 
165
        self.assertEqual(get_text_by_path(v3, 'top'), 'old contents')
 
166
        self.assertEqual(get_text_by_path(v3, 'a/one'), 'new contents')
164
167
        v3.unlock()
165
168
 
166
169
        # commit in subdirectory commits whole tree
167
170
        self.run_bzr(['commit', '-m', 'commit whole tree from subdir'])
168
171
        v4 = b.repository.revision_tree(b.get_rev_id(4))
169
172
        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')
 
173
        self.assertEqual(get_text_by_path(v4, 'b/two'), 'new contents')
 
174
        self.assertEqual(get_text_by_path(v4, 'top'), 'new contents')
172
175
        v4.unlock()
173
176
 
174
177
        # TODO: factor out some kind of assert_tree_state() method