Merge lp:~amanica/bzr/rm_dir_with_changed_emigrated_file-129880 into lp:bzr
Proposed by
Marius Kruger
Status: | Merged |
---|---|
Approved by: | Gary van der Merwe |
Approved revision: | no longer in the source branch. |
Merged at revision: | 5209 |
Proposed branch: | lp:~amanica/bzr/rm_dir_with_changed_emigrated_file-129880 |
Merge into: | lp:bzr |
Diff against target: |
65 lines (+23/-4) 3 files modified
NEWS (+4/-0) bzrlib/tests/per_workingtree/test_remove.py (+14/-0) bzrlib/workingtree.py (+5/-4) |
To merge this branch: | bzr merge lp:~amanica/bzr/rm_dir_with_changed_emigrated_file-129880 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gary van der Merwe | Approve | ||
Andrew Bennetts | Approve | ||
Robert Collins (community) | Needs Fixing | ||
Review via email: mp+23528@code.launchpad.net |
Commit message
Don't refuse to delete a directory with changed emigrated files. (Marius Kruger, Daniel Watkins, #129880)
Description of the change
When deleting a dir with a changed file that has been moved out of there;
check if the changed file is still in a dir to be removed before refusing to remove it.
(seems it was my oversight that caused this. sorry)
To post a comment you must log in.
The NEWS entry is confusing, I don't know what 'it' at the end of the sentence is, nor what you've changed, if I just read NEWS.
Your test should check that the file isn't deleted, given what we're changing.
58 + def isStillInDirToB eRemoved( new_path) : is_inside( f, path[1]):
59 + for f in files:
60 + if osutils.
61 + return True
62 + return False
This looks trivially buggy: new_path is not used at all. Perhaps you want is_inside_ any(files, path[1]) and no helper function?
Even so, I think this might be buggy; we'd normally just check if the parent_id is still in the inventory after iterating. Uhm, I need to think a bit more to really say either way - can you have a think about whether your curernt code could interact with mv'd directories in unexpected ways?
More broadly, perhaps we should stop erroring in this case, and instead just backup the files, in the same ay we want to for merges that delete directories containing unversioned/ modified/ ignored files. However, this would be a much larger change and is perhaps worth filing as a wishlist bug independent of this merge proposal.