Rev 2333: Really finish the prior commit. in file:///home/robertc/source/baz/dirstate/

Robert Collins robertc at robertcollins.net
Fri Feb 16 06:57:55 GMT 2007


At file:///home/robertc/source/baz/dirstate/

------------------------------------------------------------
revno: 2333
revision-id: robertc at robertcollins.net-20070216065753-svdi0okn46e24474
parent: robertc at robertcollins.net-20070216064426-tfdvexihpqq05csl
committer: Robert Collins <robertc at robertcollins.net>
branch nick: dirstate
timestamp: Fri 2007-02-16 17:57:53 +1100
message:
  Really finish the prior commit.
modified:
  bzrlib/tests/test_workingtree.py testworkingtree.py-20051004024258-b88d0fe8f101d468
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'bzrlib/tests/test_workingtree.py'
--- a/bzrlib/tests/test_workingtree.py	2007-02-16 06:44:26 +0000
+++ b/bzrlib/tests/test_workingtree.py	2007-02-16 06:57:53 +0000
@@ -302,6 +302,11 @@
         # work that merge would do.
 
         subtree = self.make_branch_and_tree('subdir')
+        # writelock the tree so its repository doesn't get readlocked by
+        # the revision tree locks. This works around the bug where we dont
+        # permit lock upgrading.
+        subtree.lock_write()
+        self.addCleanup(subtree.unlock)
         self.build_tree(['subdir/file-a',])
         subtree.add(['file-a'], ['id-a'])
         rev1 = subtree.commit('commit in subdir')
@@ -374,6 +379,11 @@
         tree = self.make_workingtree()
 
         subtree = self.make_branch_and_tree('subdir')
+        # writelock the tree so its repository doesn't get readlocked by
+        # the revision tree locks. This works around the bug where we dont
+        # permit lock upgrading.
+        subtree.lock_write()
+        self.addCleanup(subtree.unlock)
         rev1 = subtree.commit('commit in subdir')
         rev1_tree = subtree.basis_tree()
         rev1_tree.lock_read()

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2007-02-16 06:44:26 +0000
+++ b/bzrlib/workingtree_4.py	2007-02-16 06:57:53 +0000
@@ -803,6 +803,14 @@
     def _file_size(self, entry, stat_value):
         return entry.text_size
 
+    def filter_unversioned_files(self, paths):
+        """Filter out paths that are not versioned.
+
+        :return: set of paths.
+        """
+        pred = self.has_filename
+        return set((p for p in paths if not pred(p)))
+
     def _generate_inventory(self):
         """Create and set self.inventory from the dirstate object.
         
@@ -915,10 +923,9 @@
 
     def path2id(self, path):
         """Return the id for path in this tree."""
-        row = self._dirstate._get_row(path.encode('utf8'))
-        if row == (None, None):
-            return None
-        return row[0][3].decode('utf8')
+        # TODO: if there is no inventory, do an optimistic lookup in the
+        # dirstate by the path; commonly this will work.
+        return self.inventory.path2id(path)
 
     def unlock(self):
         """Unlock, freeing any cache memory used during the lock."""



More information about the bazaar-commits mailing list