Rev 6294: (jelmer) Deprecate Tree.get_file_by_path. (Jelmer Vernooij) in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/
Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Nov 25 11:17:42 UTC 2011
At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 6294 [merge]
revision-id: pqm at pqm.ubuntu.com-20111125111741-sc39dofu8b2zx4zl
parent: pqm at pqm.ubuntu.com-20111125105242-da32o819atgqlerb
parent: jelmer at samba.org-20111124173423-zap8i96deoarr19e
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2011-11-25 11:17:41 +0000
message:
(jelmer) Deprecate Tree.get_file_by_path. (Jelmer Vernooij)
modified:
bzrlib/tests/blackbox/test_versioning.py versioning.py-20050622071821-3ddf5e2e5e93c602
bzrlib/tests/per_branch/test_stacking.py test_stacking.py-20080214020755-msjlkb7urobwly0f-1
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
doc/developers/case-insensitive-file-systems.txt caseinsensitivefiles-20081117224243-p84xpmqnsa1p8k91-1
doc/en/release-notes/bzr-2.5.txt bzr2.5.txt-20110708125756-587p0hpw7oke4h05-1
=== modified file 'bzrlib/tests/blackbox/test_versioning.py'
--- a/bzrlib/tests/blackbox/test_versioning.py 2011-10-07 15:09:48 +0000
+++ b/bzrlib/tests/blackbox/test_versioning.py 2011-11-24 17:34:23 +0000
@@ -148,9 +148,12 @@
new = b.repository.revision_tree(b.get_rev_id(2))
new.lock_read()
- self.assertEqual(new.get_file_by_path('b/two').read(), 'old contents')
- self.assertEqual(new.get_file_by_path('top').read(), 'old contents')
- self.assertEqual(new.get_file_by_path('a/one').read(), 'new contents')
+ def get_text_by_path(tree, path):
+ return tree.get_file_text(tree.path2id(path), path)
+
+ self.assertEqual(get_text_by_path(new, 'b/two'), 'old contents')
+ self.assertEqual(get_text_by_path(new, 'top'), 'old contents')
+ self.assertEqual(get_text_by_path(new, 'a/one'), 'new contents')
new.unlock()
os.chdir('a')
@@ -158,17 +161,17 @@
self.run_bzr(['commit', '.', '-m', 'commit subdir only', '--unchanged'])
v3 = b.repository.revision_tree(b.get_rev_id(3))
v3.lock_read()
- self.assertEqual(v3.get_file_by_path('b/two').read(), 'old contents')
- self.assertEqual(v3.get_file_by_path('top').read(), 'old contents')
- self.assertEqual(v3.get_file_by_path('a/one').read(), 'new contents')
+ self.assertEqual(get_text_by_path(v3, 'b/two'), 'old contents')
+ self.assertEqual(get_text_by_path(v3, 'top'), 'old contents')
+ self.assertEqual(get_text_by_path(v3, 'a/one'), 'new contents')
v3.unlock()
# commit in subdirectory commits whole tree
self.run_bzr(['commit', '-m', 'commit whole tree from subdir'])
v4 = b.repository.revision_tree(b.get_rev_id(4))
v4.lock_read()
- self.assertEqual(v4.get_file_by_path('b/two').read(), 'new contents')
- self.assertEqual(v4.get_file_by_path('top').read(), 'new contents')
+ self.assertEqual(get_text_by_path(v4, 'b/two'), 'new contents')
+ self.assertEqual(get_text_by_path(v4, 'top'), 'new contents')
v4.unlock()
# TODO: factor out some kind of assert_tree_state() method
=== modified file 'bzrlib/tests/per_branch/test_stacking.py'
--- a/bzrlib/tests/per_branch/test_stacking.py 2011-10-14 13:56:45 +0000
+++ b/bzrlib/tests/per_branch/test_stacking.py 2011-11-24 17:24:21 +0000
@@ -484,7 +484,9 @@
rtree = target.repository.revision_tree('rev2')
rtree.lock_read()
self.addCleanup(rtree.unlock)
- self.assertEqual('new content', rtree.get_file_by_path('a').read())
+ self.assertEqual(
+ 'new content',
+ rtree.get_file_text(rtree.path2id('a'), 'a'))
self.check_lines_added_or_present(target, 'rev2')
def test_transform_fallback_location_hook(self):
=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py 2011-09-15 11:31:47 +0000
+++ b/bzrlib/tree.py 2011-11-24 17:26:25 +0000
@@ -355,9 +355,6 @@
"""
raise NotImplementedError(self.get_file_size)
- def get_file_by_path(self, path):
- raise NotImplementedError(self.get_file_by_path)
-
def is_executable(self, file_id, path=None):
"""Check if a file is executable.
@@ -827,8 +824,9 @@
return self.inventory.iter_entries_by_dir(
specific_file_ids=specific_file_ids, yield_parents=yield_parents)
+ @deprecated_method(deprecated_in((2, 5, 0)))
def get_file_by_path(self, path):
- return self.get_file(self._inventory.path2id(path), path)
+ return self.get_file(self.path2id(path), path)
def find_ids_across_trees(filenames, trees, require_versioned=True):
=== modified file 'doc/developers/case-insensitive-file-systems.txt'
--- a/doc/developers/case-insensitive-file-systems.txt 2010-08-13 19:08:57 +0000
+++ b/doc/developers/case-insensitive-file-systems.txt 2011-11-24 17:24:21 +0000
@@ -84,7 +84,7 @@
of the result to match any existing items.
* Tree.get_canonical_inventory_path - somewhat like Tree.get_symlink_target(),
- Tree.get_file_by_path() etc; returns a name with the case adjusted to match
+ Tree.get_file() etc; returns a name with the case adjusted to match
existing inventory items.
* osutils.canonical_relpaths() and Tree.get_canonical_inventory_paths() - like
=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt 2011-11-25 10:52:42 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt 2011-11-25 11:17:41 +0000
@@ -84,6 +84,9 @@
* ``Repository.verify_revision`` has been renamed to
``Repository.verify_revision_signature``. (Jelmer Vernooij)
+* ``Tree.get_file_by_path`` is now deprecated. Use ``Tree.get_file`` instead.
+ (Jelmer Vernooij, #666897)
+
* Some global options for use with commands have been removed, construct
an ``Option`` with the name instead. (Martin Packman)
More information about the bazaar-commits
mailing list