Rev 3720: Fix bug #272648 in lp:~vila/bzr/272648-rm-dir-before-bzr
Vincent Ladeuil
v.ladeuil+lp at free.fr
Mon Sep 22 10:43:43 BST 2008
At lp:~vila/bzr/272648-rm-dir-before-bzr
------------------------------------------------------------
revno: 3720
revision-id: v.ladeuil+lp at free.fr-20080922094340-h8e6z4dlu429jnhr
parent: pqm at pqm.ubuntu.com-20080921012105-ote1u11mokjim9ir
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 272648-rm-dir-before-bzr
timestamp: Mon 2008-09-22 11:43:40 +0200
message:
Fix bug #272648
* bzrlib/tests/workingtree_implementations/test_remove.py:
(TestRemove.test_remove_file_and_containing_dir): Reproduce bug
#272648.
* bzrlib/workingtree.py:
(WorkingTree.walkdirs): Don't try to remove '.bzr' if it's not
there.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/workingtree_implementations/test_remove.py test_remove.py-20070413183901-rvnp85rtc0q0sclp-1
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2008-09-21 01:21:05 +0000
+++ b/NEWS 2008-09-22 09:43:40 +0000
@@ -31,6 +31,10 @@
* ``bzr missing`` now accepts an ``--include-merges`` option.
(Vincent Ladeuil, #233817)
+ * Don't try to filter (internally) '.bzr' from the files to be deleted if
+ it's not there.
+ (Vincent Ladeuil, #272648)
+
* Fix '_in_buffer' AttributeError when using the -Dhpss debug flag.
(Andrew Bennetts)
=== modified file 'bzrlib/tests/workingtree_implementations/test_remove.py'
--- a/bzrlib/tests/workingtree_implementations/test_remove.py 2008-07-30 07:52:22 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_remove.py 2008-09-22 09:43:40 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006, 2007 Canonical Ltd
+# Copyright (C) 2006, 2007, 2008 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -327,3 +327,12 @@
self.failIfExists('config/file')
self.failIfExists('config')
tree._validate()
+
+ def test_remove_dir_before_bzr(self):
+ # As per bug #272648. Note that a file must be present in the directory
+ # or the bug doesn't manifest itself.
+ tree = self.get_committed_tree(['.aaa/', '.aaa/file'])
+ tree.remove('.aaa/', keep_files=False)
+ self.failIfExists('.aaa/file')
+ self.failIfExists('.aaa')
+ tree._validate()
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py 2008-09-05 05:12:35 +0000
+++ b/bzrlib/workingtree.py 2008-09-22 09:43:40 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2006, 2007 Canonical Ltd
+# Copyright (C) 2005, 2006, 2007, 2008 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -2326,7 +2326,8 @@
# value.
bzrdir_loc = bisect_left(cur_disk_dir_content,
('.bzr', '.bzr'))
- if cur_disk_dir_content[bzrdir_loc][0] == '.bzr':
+ if (bzrdir_loc < len(cur_disk_dir_content)
+ and cur_disk_dir_content[bzrdir_loc][0] == '.bzr'):
# we dont yield the contents of, or, .bzr itself.
del cur_disk_dir_content[bzrdir_loc]
if inv_finished:
More information about the bazaar-commits
mailing list