Rev 3051: (Lukáš Lalinský) Fix bug #172598 by cleaning up the has_changed_files check. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Nov 29 18:07:03 GMT 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3051
revision-id:pqm at pqm.ubuntu.com-20071129180655-yv661adx0qb6a50z
parent: pqm at pqm.ubuntu.com-20071129173101-z6t1bk0o9uygo0xi
parent: john at arbash-meinel.com-20071129170859-774mao4xy652znc7
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2007-11-29 18:06:55 +0000
message:
(Lukáš Lalinský) Fix bug #172598 by cleaning up the has_changed_files check.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/blackbox/test_remove.py test_remove.py-20060530011439-fika5rm84lon0goe-1
bzrlib/tests/workingtree_implementations/test_remove.py test_remove.py-20070413183901-rvnp85rtc0q0sclp-1
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
------------------------------------------------------------
revno: 3042.2.2
revision-id:john at arbash-meinel.com-20071129170859-774mao4xy652znc7
parent: lalinsky at gmail.com-20071128170205-sp4hc41hxc1ep56u
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Thu 2007-11-29 11:08:59 -0600
message:
Minor comment cleanup.
modified:
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
------------------------------------------------------------
revno: 3042.2.1
revision-id:lalinsky at gmail.com-20071128170205-sp4hc41hxc1ep56u
parent: pqm at pqm.ubuntu.com-20071128053506-it05wgucjiw2chfq
committer: Lukáš Lalinský <lalinsky at gmail.com>
branch nick: keep-ignored-files
timestamp: Wed 2007-11-28 18:02:05 +0100
message:
Fix ``bzr rm`` to not delete modified and ignored files.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/blackbox/test_remove.py test_remove.py-20060530011439-fika5rm84lon0goe-1
bzrlib/tests/workingtree_implementations/test_remove.py test_remove.py-20070413183901-rvnp85rtc0q0sclp-1
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
=== modified file 'NEWS'
--- a/NEWS 2007-11-29 16:44:23 +0000
+++ b/NEWS 2007-11-29 18:06:55 +0000
@@ -97,6 +97,9 @@
retrying an http request or some programming errors may be masked.
(Vincent Ladeuil, #160012)
+ * Fix ``bzr rm`` to not delete modified and ignored files.
+ (Lukáš Lalinský, #172598)
+
* Fix exception when revisionspec contains merge revisons but log
formatter doesn't support merge revisions. (Kent Gibson, #148908)
=== modified file 'bzrlib/tests/blackbox/test_remove.py'
--- a/bzrlib/tests/blackbox/test_remove.py 2007-11-13 03:20:19 +0000
+++ b/bzrlib/tests/blackbox/test_remove.py 2007-11-28 17:02:05 +0000
@@ -123,6 +123,11 @@
self.changeFile(c)
self.run_bzr_remove_changed_files(['modified:[.\s]*a[.\s]*b/c'], files)
+ def test_remove_changed_ignored_files(self):
+ tree = self._make_add_and_assert_tree(['a'])
+ self.run_bzr(['ignore', 'a'])
+ self.run_bzr_remove_changed_files(['added:[.\s]*a'], ['a'])
+
def test_remove_changed_files_from_child_dir(self):
if sys.platform == 'win32':
raise TestSkipped("Windows unable to remove '.' directory")
=== modified file 'bzrlib/tests/workingtree_implementations/test_remove.py'
--- a/bzrlib/tests/workingtree_implementations/test_remove.py 2007-11-29 07:12:42 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_remove.py 2007-11-29 18:06:55 +0000
@@ -183,6 +183,20 @@
tree.remove('b', keep_files=False)
self.assertRemovedAndDeleted('b')
+ def test_remove_changed_ignored_files(self):
+ """Changed ignored files should not be deleted."""
+ files = ['an_ignored_file']
+ tree = self.get_tree(files)
+ tree.add(files)
+ ignores.add_runtime_ignores(["*ignored*"])
+ self.assertInWorkingTree(files)
+ self.assertNotEquals(None, tree.is_ignored(files[0]))
+ err = self.assertRaises(errors.BzrRemoveChangedFilesError, tree.remove,
+ files, keep_files=False)
+ self.assertContainsRe(err.changes_as_text,
+ '(?s)added:.*' + files[0])
+ self.assertInWorkingTree(files)
+
def test_dont_remove_directory_with_unknowns(self):
"""Directories with unknowns should not be deleted."""
directories = ['a/', 'b/', 'c/', 'c/c/']
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py 2007-11-28 02:25:27 +0000
+++ b/bzrlib/workingtree.py 2007-11-29 18:06:55 +0000
@@ -1903,11 +1903,14 @@
kind, executable) in self._iter_changes(self.basis_tree(),
include_unchanged=True, require_versioned=False,
want_unversioned=True, specific_files=files):
- # Check if it's an unknown (but not ignored) OR
- # changed (but not deleted) :
- if ((versioned == (False, False) or
- content_change and kind[1] != None)
- and not self.is_ignored(path[1])):
+ if versioned == (False, False):
+ # The record is unknown ...
+ if not self.is_ignored(path[1]):
+ # ... but not ignored
+ has_changed_files = True
+ break
+ elif content_change and (kind[1] != None):
+ # Versioned and changed, but not deleted
has_changed_files = True
break
More information about the bazaar-commits
mailing list