Rev 4386: (abentley) move get_file_with_stat from MutableTree to Tree. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu May 28 15:25:09 BST 2009
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 4386
revision-id: pqm at pqm.ubuntu.com-20090528142500-n7ki7gucmkxzx611
parent: pqm at pqm.ubuntu.com-20090528085340-bfw8729wfm9kmfmd
parent: aaron at aaronbentley.com-20090528112916-3zvkjx1zwudk8em7
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-05-28 15:25:00 +0100
message:
(abentley) move get_file_with_stat from MutableTree to Tree.
renamed:
bzrlib/tests/workingtree_implementations/test_get_file_with_stat.py => bzrlib/tests/tree_implementations/test_get_file_with_stat.py test_get_file_with_s-20080922035909-lhdovrr36jpxmu0v-1
modified:
bzrlib/mutabletree.py mutabletree.py-20060906023413-4wlkalbdpsxi2r4y-2
bzrlib/tests/tree_implementations/__init__.py __init__.py-20060717075546-420s7b0bj9hzeowi-2
bzrlib/tests/workingtree_implementations/__init__.py __init__.py-20060203003124-b2aa5aca21a8bfad
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
bzrlib/tests/tree_implementations/test_get_file_with_stat.py test_get_file_with_s-20080922035909-lhdovrr36jpxmu0v-1
------------------------------------------------------------
revno: 4354.4.9
revision-id: aaron at aaronbentley.com-20090528112916-3zvkjx1zwudk8em7
parent: aaron at aaronbentley.com-20090528075659-bb835aj2sr711emf
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: commit-preview
timestamp: Thu 2009-05-28 13:29:16 +0200
message:
Remove reference to workingtree_implementations.test_get_file_with_stat
modified:
bzrlib/tests/workingtree_implementations/__init__.py __init__.py-20060203003124-b2aa5aca21a8bfad
------------------------------------------------------------
revno: 4354.4.8
revision-id: aaron at aaronbentley.com-20090528075659-bb835aj2sr711emf
parent: aaron at aaronbentley.com-20090521121623-e5cld07a69n1o1gg
parent: pqm at pqm.ubuntu.com-20090527193433-rw9zh1l73zjc9knb
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: commit-preview
timestamp: Thu 2009-05-28 09:56:59 +0200
message:
Merge bzr.dev into commit-preview.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/foreign.py foreign.py-20081112170002-olsxmandkk8qyfuq-1
bzrlib/groupcompress.py groupcompress.py-20080705181503-ccbxd6xuy1bdnrpu-8
bzrlib/knit.py knit.py-20051212171256-f056ac8f0fbe1bd9
bzrlib/repofmt/groupcompress_repo.py repofmt.py-20080715094215-wp1qfvoo7093c8qr-1
bzrlib/revisiontree.py revisiontree.py-20060724012533-bg8xyryhxd0o0i0h-1
bzrlib/smart/server.py server.py-20061110062051-chzu10y32vx8gvur-1
bzrlib/tests/blackbox/test_dpush.py test_dpush.py-20090108125928-st1td6le59g0vyv2-1
bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
bzrlib/tests/blackbox/test_send.py test_bundle.py-20060616222707-c21c8b7ea5ef57b1
bzrlib/tests/blackbox/test_serve.py test_serve.py-20060913064329-8t2pvmsikl4s3xhl-1
bzrlib/tests/branch_implementations/test_push.py test_push.py-20070130153159-fhfap8uoifevg30j-1
bzrlib/tests/test_foreign.py test_foreign.py-20081125004048-ywb901edgp9lluxo-1
bzrlib/tests/test_http.py testhttp.py-20051018020158-b2eef6e867c514d9
bzrlib/transport/__init__.py transport.py-20050711165921-4978aa7ce1285ad5
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
------------------------------------------------------------
revno: 4354.4.7
revision-id: aaron at aaronbentley.com-20090521121623-e5cld07a69n1o1gg
parent: aaron at aaronbentley.com-20090521094725-q8sll7tjid3vriw9
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: commit-preview
timestamp: Thu 2009-05-21 14:16:23 +0200
message:
Move MutableTree.get_file_with_stat to Tree.get_file_with_stat.
renamed:
bzrlib/tests/workingtree_implementations/test_get_file_with_stat.py => bzrlib/tests/tree_implementations/test_get_file_with_stat.py test_get_file_with_s-20080922035909-lhdovrr36jpxmu0v-1
modified:
bzrlib/mutabletree.py mutabletree.py-20060906023413-4wlkalbdpsxi2r4y-2
bzrlib/tests/tree_implementations/__init__.py __init__.py-20060717075546-420s7b0bj9hzeowi-2
bzrlib/tests/tree_implementations/test_tree.py test_tree.py-20061215160206-usu7lwcj8aq2n3br-1
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
bzrlib/tests/tree_implementations/test_get_file_with_stat.py test_get_file_with_s-20080922035909-lhdovrr36jpxmu0v-1
------------------------------------------------------------
revno: 4354.4.6
revision-id: aaron at aaronbentley.com-20090521094725-q8sll7tjid3vriw9
parent: aaron at aaronbentley.com-20090521094300-jbjbkkpibebk3kj8
parent: pqm at pqm.ubuntu.com-20090520182253-iqt2y0uikaxswu56
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: commit-preview
timestamp: Thu 2009-05-21 11:47:25 +0200
message:
Merged bzr.dev into commit-preview.
------------------------------------------------------------
revno: 4354.4.5
revision-id: aaron at aaronbentley.com-20090521094300-jbjbkkpibebk3kj8
parent: aaron at aaronbentley.com-20090520172014-c3met75t69n8ilo9
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: commit-preview
timestamp: Thu 2009-05-21 11:43:00 +0200
message:
Ensure Tree.get_file_with_stat is provided.
modified:
bzrlib/tests/tree_implementations/test_tree.py test_tree.py-20061215160206-usu7lwcj8aq2n3br-1
bzrlib/transform.py transform.py-20060105172343-dd99e54394d91687
bzrlib/tree.py tree.py-20050309040759-9d5f2496be663e77
=== modified file 'bzrlib/mutabletree.py'
--- a/bzrlib/mutabletree.py 2009-04-09 20:23:07 +0000
+++ b/bzrlib/mutabletree.py 2009-05-21 12:16:23 +0000
@@ -232,20 +232,6 @@
"""Helper function for add - sets the entries of kinds."""
raise NotImplementedError(self._gather_kinds)
- def get_file_with_stat(self, file_id, path=None):
- """Get a file handle and stat object for file_id.
-
- The default implementation returns (self.get_file, None) for backwards
- compatibility.
-
- :param file_id: The file id to read.
- :param path: The path of the file, if it is known.
- :return: A tuple (file_handle, stat_value_or_None). If the tree has
- no stat facility, or need for a stat cache feedback during commit,
- it may return None for the second element of the tuple.
- """
- return (self.get_file(file_id, path), None)
-
@needs_read_lock
def last_revision(self):
"""Return the revision id of the last commit performed in this tree.
=== modified file 'bzrlib/tests/tree_implementations/__init__.py'
--- a/bzrlib/tests/tree_implementations/__init__.py 2009-04-11 16:06:53 +0000
+++ b/bzrlib/tests/tree_implementations/__init__.py 2009-05-21 12:16:23 +0000
@@ -365,6 +365,7 @@
submod_tests = loader.loadTestsFromModuleNames([
'bzrlib.tests.tree_implementations.test_annotate_iter',
'bzrlib.tests.tree_implementations.test_get_file_mtime',
+ 'bzrlib.tests.tree_implementations.test_get_file_with_stat',
'bzrlib.tests.tree_implementations.test_get_root_id',
'bzrlib.tests.tree_implementations.test_get_symlink_target',
'bzrlib.tests.tree_implementations.test_inv',
=== renamed file 'bzrlib/tests/workingtree_implementations/test_get_file_with_stat.py' => 'bzrlib/tests/tree_implementations/test_get_file_with_stat.py'
--- a/bzrlib/tests/workingtree_implementations/test_get_file_with_stat.py 2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/tree_implementations/test_get_file_with_stat.py 2009-05-21 12:16:23 +0000
@@ -18,15 +18,16 @@
import os
-from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
-
-
-class TestGetFileWithStat(TestCaseWithWorkingTree):
+from bzrlib.tests.tree_implementations import TestCaseWithTree
+
+
+class TestGetFileWithStat(TestCaseWithTree):
def test_get_file_with_stat_id_only(self):
- tree = self.make_branch_and_tree('.')
+ work_tree = self.make_branch_and_tree('.')
self.build_tree(['foo'])
- tree.add(['foo'], ['foo-id'])
+ work_tree.add(['foo'], ['foo-id'])
+ tree = self._convert_tree(work_tree)
tree.lock_read()
self.addCleanup(tree.unlock)
file_obj, statvalue = tree.get_file_with_stat('foo-id')
@@ -36,9 +37,10 @@
self.assertEqual(["contents of foo\n"], file_obj.readlines())
def test_get_file_with_stat_id_and_path(self):
- tree = self.make_branch_and_tree('.')
+ work_tree = self.make_branch_and_tree('.')
self.build_tree(['foo'])
- tree.add(['foo'], ['foo-id'])
+ work_tree.add(['foo'], ['foo-id'])
+ tree = self._convert_tree(work_tree)
tree.lock_read()
self.addCleanup(tree.unlock)
file_obj, statvalue = tree.get_file_with_stat('foo-id', 'foo')
=== modified file 'bzrlib/tests/workingtree_implementations/__init__.py'
--- a/bzrlib/tests/workingtree_implementations/__init__.py 2009-04-11 16:06:53 +0000
+++ b/bzrlib/tests/workingtree_implementations/__init__.py 2009-05-28 11:29:16 +0000
@@ -72,7 +72,6 @@
'bzrlib.tests.workingtree_implementations.test_eol_conversion',
'bzrlib.tests.workingtree_implementations.test_executable',
'bzrlib.tests.workingtree_implementations.test_flush',
- 'bzrlib.tests.workingtree_implementations.test_get_file_with_stat',
'bzrlib.tests.workingtree_implementations.test_get_file_mtime',
'bzrlib.tests.workingtree_implementations.test_get_parent_ids',
'bzrlib.tests.workingtree_implementations.test_inv',
=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py 2009-05-28 07:46:53 +0000
+++ b/bzrlib/transform.py 2009-05-28 14:25:00 +0000
@@ -1915,7 +1915,7 @@
name = self._transform._limbo_name(trans_id)
return open(name, 'rb')
- def get_file_with_stat(self, file_id, path):
+ def get_file_with_stat(self, file_id, path=None):
return self.get_file(file_id, path), None
def annotate_iter(self, file_id,
=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py 2009-05-23 04:55:52 +0000
+++ b/bzrlib/tree.py 2009-05-28 07:56:59 +0000
@@ -263,6 +263,20 @@
"""
raise NotImplementedError(self.get_file)
+ def get_file_with_stat(self, file_id, path=None):
+ """Get a file handle and stat object for file_id.
+
+ The default implementation returns (self.get_file, None) for backwards
+ compatibility.
+
+ :param file_id: The file id to read.
+ :param path: The path of the file, if it is known.
+ :return: A tuple (file_handle, stat_value_or_None). If the tree has
+ no stat facility, or need for a stat cache feedback during commit,
+ it may return None for the second element of the tuple.
+ """
+ return (self.get_file(file_id, path), None)
+
def get_file_text(self, file_id, path=None):
"""Return the byte content of a file.
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py 2009-05-13 17:16:28 +0000
+++ b/bzrlib/workingtree.py 2009-05-21 12:16:23 +0000
@@ -446,7 +446,7 @@
def get_file_with_stat(self, file_id, path=None, filtered=True,
_fstat=os.fstat):
- """See MutableTree.get_file_with_stat."""
+ """See Tree.get_file_with_stat."""
if path is None:
path = self.id2path(file_id)
file_obj = self.get_file_byname(path, filtered=False)
More information about the bazaar-commits
mailing list