Rev 5422: Take jam's review comments into account. in file:///home/vila/src/bzr/bugs/323111-orphans/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Fri Sep 10 18:36:46 BST 2010
At file:///home/vila/src/bzr/bugs/323111-orphans/
------------------------------------------------------------
revno: 5422
revision-id: v.ladeuil+lp at free.fr-20100910173646-oxl2s7wy7nhu5psg
parent: v.ladeuil+lp at free.fr-20100910143650-5cupus4yoorb8xw5
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: orphan-non-versioned-files
timestamp: Fri 2010-09-10 19:36:46 +0200
message:
Take jam's review comments into account.
* doc/en/whats-new/whats-new-in-2.3.txt:
Add entry.
* bzrlib/transform.py:
(DiskTreeTransform.new_orphan): Urgh, call a valid backup name
prediction function. Add a trace.warning call too.
* bzrlib/tests/test_transform.py:
(TestTransformMissingParent): Use make_ not get_ for helper.
(TestOrphan.test_new_orphan): Check that the orphan is moved in te
right place.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_transform.py'
--- a/bzrlib/tests/test_transform.py 2010-09-10 08:23:31 +0000
+++ b/bzrlib/tests/test_transform.py 2010-09-10 17:36:46 +0000
@@ -2348,7 +2348,7 @@
class TestTransformMissingParent(tests.TestCaseWithTransport):
- def get_tree_transform_with_unversioned_dir(self):
+ def make_tt_with_versioned_dir(self):
wt = self.make_branch_and_tree('.')
self.build_tree(['dir/',])
wt.add(['dir'], ['dir-id'])
@@ -2358,7 +2358,7 @@
return wt, tt
def test_resolve_create_parent_for_versioned_file(self):
- wt, tt = self.get_tree_transform_with_unversioned_dir()
+ wt, tt = self.make_tt_with_versioned_dir()
dir_tid = tt.trans_id_tree_file_id('dir-id')
file_tid = tt.new_file('file', dir_tid, 'Contents', file_id='file-id')
tt.delete_contents(dir_tid)
@@ -2369,7 +2369,7 @@
self.assertLength(2, conflicts)
def test_resolve_orphan_non_versioned_file(self):
- wt, tt = self.get_tree_transform_with_unversioned_dir()
+ wt, tt = self.make_tt_with_versioned_dir()
dir_tid = tt.trans_id_tree_file_id('dir-id')
tt.new_file('file', dir_tid, 'Contents')
tt.delete_contents(dir_tid)
@@ -3292,4 +3292,6 @@
# Yeah for resolved conflicts !
self.assertLength(0, remaining_conflicts)
# We have a new orphan
- self.assertEndsWith('foo.~1~', tt.final_name(foo_tid))
+ self.assertEquals('foo.~1~', tt.final_name(foo_tid))
+ self.assertEquals('bzr-orphans',
+ tt.final_name(tt.final_parent(foo_tid)))
=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py 2010-09-09 14:13:34 +0000
+++ b/bzrlib/transform.py 2010-09-10 17:36:46 +0000
@@ -35,6 +35,7 @@
multiparent,
osutils,
revision as _mod_revision,
+ trace,
ui,
)
""")
@@ -1287,13 +1288,17 @@
def new_orphan(self, trans_id, parent_id):
"""See TreeTransformBase.new_orphan."""
# Add the orphan dir if it doesn't exist
- od_id = self.trans_id_tree_path('bzr-orphans')
+ orphan_dir = 'bzr-orphans'
+ od_id = self.trans_id_tree_path(orphan_dir)
if self.final_kind(od_id) is None:
self.create_directory(od_id)
+ parent_path = self._tree_id_paths[parent_id]
# Find a name that doesn't exist yet in the orphan dir
- new_name = osutils.available_backup_name(
- self.final_name(trans_id), lambda name: name in self._tree_path_ids)
+ actual_name = self.final_name(trans_id)
+ new_name = _get_backup_name(actual_name, self.by_parent(), od_id, self)
self.adjust_path(new_name, od_id, trans_id)
+ trace.warning('%s has been orphaned in %s'
+ % (joinpath(parent_path, actual_name), orphan_dir))
class TreeTransform(DiskTreeTransform):
=== modified file 'doc/en/whats-new/whats-new-in-2.3.txt'
--- a/doc/en/whats-new/whats-new-in-2.3.txt 2010-08-31 07:12:18 +0000
+++ b/doc/en/whats-new/whats-new-in-2.3.txt 2010-09-10 17:36:46 +0000
@@ -52,6 +52,15 @@
content faster than seeking and reading content from another tree,
especially in cold-cache situations. (John Arbash Meinel, #607298)
+
+Improved conflict handling
+**************************
+
+* Deleting a versioned directory containing unversioned files will no
+ longer create a conflict. Instead, the unversioned files will be moved
+ into a 'bzr-orphans' directory at the root of the working tree.
+ (Vincent Ladeuil, #323111)
+
Documentation
*************
* A beta version of the documentation is now available in GNU TexInfo
More information about the bazaar-commits
mailing list