Rev 3604: Review feedback : test for PointlessCommit and that the example given in the help (excluding a subtree of a specified tree) does in fact work. in http://people.ubuntu.com/~robertc/baz2.0/3117
Robert Collins
robertc at robertcollins.net
Mon Aug 4 23:07:45 BST 2008
At http://people.ubuntu.com/~robertc/baz2.0/3117
------------------------------------------------------------
revno: 3604
revision-id: robertc at robertcollins.net-20080804220734-xoo8j0kt3bdy26s9
parent: robertc at robertcollins.net-20080804072951-tdue3y4bp9893yx9
committer: Robert Collins <robertc at robertcollins.net>
branch nick: 3117
timestamp: Tue 2008-08-05 08:07:34 +1000
message:
Review feedback : test for PointlessCommit and that the example given in the help (excluding a subtree of a specified tree) does in fact work.
modified:
bzrlib/commit.py commit.py-20050511101309-79ec1a0168e0e825
bzrlib/tests/workingtree_implementations/test_commit.py test_commit.py-20060421013633-1610ec2331c8190f
=== modified file 'bzrlib/commit.py'
--- a/bzrlib/commit.py 2008-08-04 07:29:51 +0000
+++ b/bzrlib/commit.py 2008-08-04 22:07:34 +0000
@@ -661,7 +661,7 @@
# ADHB 11-07-2006
exclude = self.exclude
- specific_files = self.specific_files
+ specific_files = self.specific_files or []
mutter("Selecting files for commit with filter %s", specific_files)
# Build the new inventory
=== modified file 'bzrlib/tests/workingtree_implementations/test_commit.py'
--- a/bzrlib/tests/workingtree_implementations/test_commit.py 2008-08-04 07:29:51 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_commit.py 2008-08-04 22:07:34 +0000
@@ -207,6 +207,15 @@
self.assertRaises(errors.CannotCommitSelectedFileMerge,
wt.commit, 'test', exclude=['foo'])
+ def test_commit_exclude_exclude_changed_is_pointless(self):
+ tree = self.make_branch_and_tree('.')
+ self.build_tree(['a'])
+ tree.smart_add(['.'])
+ tree.commit('setup test')
+ self.build_tree_contents([('a', 'new contents for "a"\n')])
+ self.assertRaises(errors.PointlessCommit, tree.commit, 'test',
+ exclude=['a'], allow_pointless=False)
+
def test_commit_exclude_excludes_modified_files(self):
tree = self.make_branch_and_tree('.')
self.build_tree(['a', 'b', 'c'])
@@ -220,6 +229,18 @@
self.assertEqual((None, 'b'), changes[0][1])
self.assertEqual((None, 'c'), changes[1][1])
+ def test_commit_exclude_subtree_of_selected(self):
+ tree = self.make_branch_and_tree('.')
+ self.build_tree(['a/', 'a/b'])
+ tree.smart_add(['.'])
+ tree.commit('test', exclude=['a/b'])
+ # If a/b was ignored it will still be 'added' in status.
+ tree.lock_read()
+ self.addCleanup(tree.unlock)
+ changes = list(tree.iter_changes(tree.basis_tree()))
+ self.assertEqual(1, len(changes))
+ self.assertEqual((None, 'a/b'), changes[0][1])
+
def test_commit_sets_last_revision(self):
tree = self.make_branch_and_tree('tree')
committed_id = tree.commit('foo', rev_id='foo')
More information about the bazaar-commits
mailing list