Rev 4498: (igc) Improve paths are not versioned reporting (Benoît PIERRE) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Jul 1 10:30:24 BST 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4498 [merge]
revision-id: pqm at pqm.ubuntu.com-20090701093022-20c1efogz7l7clwm
parent: pqm at pqm.ubuntu.com-20090701083204-fzy3czqk0ifjyri2
parent: ian.clatworthy at canonical.com-20090701072630-qw5vq7rgfm5rwojn
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2009-07-01 10:30:22 +0100
message:
  (igc) Improve paths are not versioned reporting (Benoît PIERRE)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/test_workingtree_4.py test_workingtree_4.p-20070223025758-531n3tznl3zacv2o-1
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'NEWS'
--- a/NEWS	2009-06-30 17:00:26 +0000
+++ b/NEWS	2009-07-01 07:26:30 +0000
@@ -132,6 +132,9 @@
   to 1.1 seconds. The improvement for ``bzr ls -r-1`` is more
   substantial dropping from 54.3 to 1.1 seconds. (Ian Clatworthy)
 
+* Improve "Path(s) are not versioned" error reporting for some commands.
+  (Benoît PIERRE)
+
 * Initial commit performance in ``--2a`` repositories has been improved by
   making it cheaper to build the initial CHKMap. (John Arbash Meinel)
 

=== modified file 'bzrlib/tests/test_workingtree_4.py'
--- a/bzrlib/tests/test_workingtree_4.py	2009-04-11 16:06:53 +0000
+++ b/bzrlib/tests/test_workingtree_4.py	2009-07-01 07:26:30 +0000
@@ -579,6 +579,23 @@
         self.assertEqual([], changes)
         self.assertEqual(['', 'versioned', 'versioned2'], returned)
 
+    def test_iter_changes_unversioned_error(self):
+        """ Check if a PathsNotVersionedError is correctly raised and the
+            paths list contains all unversioned entries only.
+        """
+        tree = self.make_branch_and_tree('tree')
+        self.build_tree_contents([('tree/bar', '')])
+        tree.add(['bar'], ['bar-id'])
+        tree.lock_read()
+        self.addCleanup(tree.unlock)
+        tree_iter_changes = lambda files: [
+            c for c in tree.iter_changes(tree.basis_tree(), specific_files=files,
+                                         require_versioned=True)
+        ]
+        e = self.assertRaises(errors.PathsNotVersionedError,
+                              tree_iter_changes, ['bar', 'foo'])
+        self.assertEqual(e.paths, ['foo'])
+
     def get_tree_with_cachable_file_foo(self):
         tree = self.make_branch_and_tree('.')
         self.build_tree(['foo'])

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2009-06-22 12:52:39 +0000
+++ b/bzrlib/workingtree_4.py	2009-06-24 22:35:17 +0000
@@ -2049,13 +2049,13 @@
         state._read_dirblocks_if_needed()
         if require_versioned:
             # -- check all supplied paths are versioned in a search tree. --
-            all_versioned = True
+            not_versioned = []
             for path in specific_files:
                 path_entries = state._entries_for_path(path)
                 if not path_entries:
                     # this specified path is not present at all: error
-                    all_versioned = False
-                    break
+                    not_versioned.append(path)
+                    continue
                 found_versioned = False
                 # for each id at this path
                 for entry in path_entries:
@@ -2068,10 +2068,9 @@
                 if not found_versioned:
                     # none of the indexes was not 'absent' at all ids for this
                     # path.
-                    all_versioned = False
-                    break
-            if not all_versioned:
-                raise errors.PathsNotVersionedError(specific_files)
+                    not_versioned.append(path)
+            if len(not_versioned) > 0:
+                raise errors.PathsNotVersionedError(not_versioned)
         # -- remove redundancy in supplied specific_files to prevent over-scanning --
         search_specific_files = osutils.minimum_path_selection(specific_files)
 




More information about the bazaar-commits mailing list