Rev 5422: Merge orphan-non-versioned-files into deprecate-get-backup-name resolving conflicts in file:///home/vila/src/bzr/bugs/323111-orphans/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Sep 13 11:14:10 BST 2010


At file:///home/vila/src/bzr/bugs/323111-orphans/

------------------------------------------------------------
revno: 5422 [merge]
revision-id: v.ladeuil+lp at free.fr-20100913101409-tnv06tbqmne2cjis
parent: v.ladeuil+lp at free.fr-20100910143713-rwf44dzwpz1jinyh
parent: v.ladeuil+lp at free.fr-20100910173646-oxl2s7wy7nhu5psg
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: deprecate-get-backup-name
timestamp: Mon 2010-09-13 12:14:09 +0200
message:
  Merge orphan-non-versioned-files into deprecate-get-backup-name resolving conflicts
modified:
  bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
  bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
  doc/en/whats-new/whats-new-in-2.3.txt whatsnewin2.3.txt-20100818072501-x2h25r7jbnknvy30-1
-------------- next part --------------
=== modified file 'bzrlib/tests/test_transform.py'
--- a/bzrlib/tests/test_transform.py	2010-09-10 14:33:20 +0000
+++ b/bzrlib/tests/test_transform.py	2010-09-13 10:14:09 +0000
@@ -2341,7 +2341,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'])
@@ -2351,7 +2351,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)
@@ -2362,7 +2362,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)
@@ -3285,4 +3285,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-10 14:33:20 +0000
+++ b/bzrlib/transform.py	2010-09-13 10:14:09 +0000
@@ -35,6 +35,7 @@
     multiparent,
     osutils,
     revision as _mod_revision,
+    trace,
     ui,
     )
 """)
@@ -1311,12 +1312,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 = self._available_backup_name(self.final_name(trans_id), od_id)
+        actual_name = self.final_name(trans_id)
+        new_name = self._available_backup_name(actual_name, od_id)
         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