Can't bzr rm a directory that contained a modified+emigrated file
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Fix Released
|
Medium
|
Marius Kruger |
Bug Description
"bzr rm" fails to remove a directory if, since the last commit, the only file in that directory was both (1) modified and (2) moved out of the directory using bzr mv.
------------
18:56:40@bzr-test> bzr init bug
18:56:48@bzr-test> cd bug/
18:56:50@bug> mkdir somedir
18:56:53@bug> echo "contents" > somedir/file
18:57:00@bug> bzr add
added somedir
added somedir/file
18:57:02@bug> bzr ci -m "1st"
added somedir
added somedir/file
Committed revision 1.
18:57:15@bug> echo "new" > somedir/file
18:57:21@bug> bzr mv somedir/file moved-file
somedir/file => moved-file
18:57:30@bug> bzr rm somedir
bzr: ERROR: Can't remove changed or unknown files:
renamed:
somedir/file => moved-file
modified:
moved-file
Use --keep to not delete them, or --force to delete them regardless.
------------
Problem occurs with: bzr 0.17, bzr 0.18, bzr.dev.
Workaround: Commit between doing the bzr mv and doing the bzr rm.
[Thanks to Andrew Bennetts for helping debug this problem.]
Related branches
- Gary van der Merwe: Approve
- Andrew Bennetts: Approve
- Robert Collins (community): Needs Fixing
-
Diff: 65 lines (+23/-4)3 files modifiedNEWS (+4/-0)
bzrlib/tests/per_workingtree/test_remove.py (+14/-0)
bzrlib/workingtree.py (+5/-4)
Changed in bzr: | |
status: | New → Confirmed |
tags: | added: performance |
tags: |
added: rm removed: performance |
Changed in bzr: | |
assignee: | nobody → Marius Kruger (amanica) |
status: | Confirmed → In Progress |
Changed in bzr: | |
status: | In Progress → Fix Released |
An alternative workaround is to use 'bzr rm --force somedir/'.
The problem seems to be in WorkingTree.remove as the file that has been moved from the directory still seems to be considered to be a file on which the deletability of the directory depends.[0] As it has been changed, the directory is considered changed.
[Footnote 0: Around lines 1828 to 1855 in bzr.dev.]