Rev 5209: (garyvdm for amanica) Don't refuse to delete a directory with changed in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Wed May 5 11:49:22 BST 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5209 [merge]
revision-id: pqm at pqm.ubuntu.com-20100505104917-ou565uqipinv20y5
parent: pqm at pqm.ubuntu.com-20100505093050-3j0n650otceiauyj
parent: marius.kruger at enerweb.co.za-20100503150122-l5kbf542i07g3f0v
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2010-05-05 11:49:17 +0100
message:
(garyvdm for amanica) Don't refuse to delete a directory with changed
emigrated files. (Marius Kruger, Daniel Watkins, #129880)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/per_workingtree/test_remove.py test_remove.py-20070413183901-rvnp85rtc0q0sclp-1
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
=== modified file 'NEWS'
--- a/NEWS 2010-05-05 06:31:06 +0000
+++ b/NEWS 2010-05-05 10:49:17 +0000
@@ -52,6 +52,10 @@
difference).
(Vincent Ladeuil, #320119)
+* ``bzr rm`` should not refuse to delete directories which contained a file
+ which has been moved elsewhere in the tree after the previous commit.
+ (Marius Kruger, Daniel Watkins, #129880)
+
* ``bzr selftest --parallel=fork`` wait for its children avoiding zombies.
(Vincent Ladeuil, #566670)
=== modified file 'bzrlib/tests/per_workingtree/test_remove.py'
--- a/bzrlib/tests/per_workingtree/test_remove.py 2009-07-10 07:14:02 +0000
+++ b/bzrlib/tests/per_workingtree/test_remove.py 2010-04-30 10:28:36 +0000
@@ -278,6 +278,20 @@
self.assertRemovedAndDeleted(files)
tree._validate()
+ def test_remove_directory_with_changed_emigrated_file(self):
+ # As per bug #129880
+ tree = self.make_branch_and_tree('.')
+ self.build_tree_contents([('somedir/',), ('somedir/file', 'contents')])
+ tree.add(['somedir', 'somedir/file'])
+ tree.commit(message="first")
+ self.build_tree_contents([('somedir/file', 'changed')])
+ tree.rename_one('somedir/file', 'moved-file')
+ tree.remove('somedir', keep_files=False)
+ self.assertNotInWorkingTree('somedir')
+ self.failIfExists('somedir')
+ self.assertInWorkingTree('moved-file')
+ self.failUnlessExists('moved-file')
+
def test_remove_directory_with_renames(self):
"""Delete directory with renames in or out."""
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py 2010-04-30 11:35:43 +0000
+++ b/bzrlib/workingtree.py 2010-05-03 15:01:22 +0000
@@ -1956,8 +1956,7 @@
def recurse_directory_to_add_files(directory):
# Recurse directory and add all files
# so we can check if they have changed.
- for parent_info, file_infos in\
- self.walkdirs(directory):
+ for parent_info, file_infos in self.walkdirs(directory):
for relpath, basename, kind, lstat, fileid, kind in file_infos:
# Is it versioned or ignored?
if self.path2id(relpath) or self.is_ignored(relpath):
@@ -1998,8 +1997,10 @@
# ... but not ignored
has_changed_files = True
break
- elif content_change and (kind[1] is not None):
- # Versioned and changed, but not deleted
+ elif (content_change and (kind[1] is not None) and
+ osutils.is_inside_any(files, path[1])):
+ # Versioned and changed, but not deleted, and still
+ # in one of the dirs to be deleted.
has_changed_files = True
break
More information about the bazaar-commits
mailing list