[MERGE] Improve "Path(s) are not versioned" error reporting for some commands

Benoît PIERRE benoit.pierre at gmail.com
Fri Jun 26 19:45:42 BST 2009


Hi,

Excerpts from Martin Pool's message of Thu Jun 25 03:23:06 +0200 2009:
> Martin Pool has voted tweak.
> Status is now: Semi-approved
> Comment:
> The actual patch looks good, thanks.
> 
> It would be nice to have a blackbox test for this in 
> blackbox.test_revert.  It may be fairly easy to copy an existing test.

I don't understand. 'bzr revert' behaviour is right, the problem is
iter_changes in working_tree4, which impact all commands using it, so how about
something like this: 


=== modified file 'bzrlib/tests/test_workingtree_4.py'
--- bzrlib/tests/test_workingtree_4.py  2009-04-11 16:06:53 +0000
+++ bzrlib/tests/test_workingtree_4.py  2009-06-25 21:52:40 +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'])


Cheers,
-- 
A: Because it destroys the flow of conversation.
Q: Why is top posting dumb?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20090626/06740426/attachment.pgp 


More information about the bazaar mailing list