Merge lp:~vila/bzr/323111-orphan-non-versioned-files into lp:bzr
|Merged at revision:||5504|
|Diff against target:||
367 lines (+200/-12) (has conflicts)
7 files modified
Text conflict in doc/en/whats-new/whats-new-in-2.3.txt
|To merge this branch:||bzr merge lp:~vila/bzr/323111-orphan-non-versioned-files|
|Related bugs and blueprints:||
Description of the Change
When a bzr command remove a previously versioned directory, it
sometimes fails because the directory contains unversioned files.
This is a pain.
The idea to address this problem is to 'orphan' such unversioned
files. This is implemented by moving them out of the way into a
directory called 'bzr-orphans' at the root of the working tree
and name them <file>.~#~, <file> being the `basename` of the file
and # being an incremented number.
The initial idea discussed with lifeless on IRC long ago was to
have an even simpler policy for orphaning: keep the original file
name and if one is already present, just erase it.
I went a bit further using backup names since a single bzr
operation could produce several orphans with the same base name
otherwise and that would have meant losing all but the last
orphan with this name.
The implementation first check the children of the conflicting
parent dir. If all of them are unversioned files (leading to an
empty directory) the conflict is resolved by moving all the
children into the orphan directory. The directory can then be
deleted without conflicts.
This is implemented for DiskTreeTransform and forbidden for
TransformPreview where it's not supposed to occur anyway since
there should be no unversioned files in the input tree.
Not that since we rely on TreeTransform, I don't think the
'bzr-orphans' can be outside of the working tree (IMBW) but I
don't think it's a problem for a first implementation.
This triggers bug #634470 revealing a latent bug in subtree
support. Since this is an experimental format so far, poolie
suggested to turn the failing test into an expected failure
Given that this fixes a behaviour that wasn't exercised by the
test suite, I'd appreciate feedback on real life scenarios that
are fixed or additional test ideas.
Note that this is self-contained into new_orphan() so far.
Possible enhancements includes:
- making the 'bzr-orphans' directory be configurable (it's
clearly tight to the working tree though),
- allows various orphaning policies (always delete, delete junk
files (tbd), never orphan (the behaviour before this patch),
There is one more submission coming with more cleanups.
- 5422. By Vincent Ladeuil on 2010-09-10
Take jam's review comments into account.
whats-new/ whats-new- in-2.3. txt:
orm.new_ orphan) : Urgh, call a valid backup name
prediction function. Add a trace.warning call too.
tests/test_ transform. py:
issingParent) : Use make_ not get_ for helper.
test_new_ orphan) : Check that the orphan is moved in te