Rev 4112: (abentley) Disable auto-detection of tree references. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Mar 11 07:22:44 GMT 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4112
revision-id: pqm at pqm.ubuntu.com-20090311072239-dm56af7pf1j4i1nq
parent: pqm at pqm.ubuntu.com-20090311062514-cuxe92b6jnavadru
parent: aaron at aaronbentley.com-20090311031303-ppkt6aexzth4yvg8
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2009-03-11 07:22:39 +0000
message:
  (abentley) Disable auto-detection of tree references.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/_dirstate_helpers_c.pyx dirstate_helpers.pyx-20070503201057-u425eni465q4idwn-3
  bzrlib/dirstate.py             dirstate.py-20060728012006-d6mvoihjb3je9peu-1
  bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
  bzrlib/tests/test__dirstate_helpers.py test_dirstate_helper-20070504035751-jsbn00xodv0y1eve-2
  bzrlib/tests/test_bzrdir.py    test_bzrdir.py-20060131065654-deba40eef51cf220
  bzrlib/tests/test_workingtree_4.py test_workingtree_4.p-20070223025758-531n3tznl3zacv2o-1
  bzrlib/tests/workingtree_implementations/test_mkdir.py test_mkdir.py-20060907214856-4omn6hf1u7fvrart-3
  bzrlib/tests/workingtree_implementations/test_nested_specifics.py test_nested_specific-20070306004443-qut978c488jr11sg-1
  bzrlib/tests/workingtree_implementations/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
    ------------------------------------------------------------
    revno: 4100.2.8
    revision-id: aaron at aaronbentley.com-20090311031303-ppkt6aexzth4yvg8
    parent: aaron at aaronbentley.com-20090311030802-1jba9nn0byxr87w0
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: no-auto-reference
    timestamp: Wed 2009-03-11 13:13:03 +1000
    message:
      Update NEWS
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
    ------------------------------------------------------------
    revno: 4100.2.7
    revision-id: aaron at aaronbentley.com-20090311030802-1jba9nn0byxr87w0
    parent: aaron at aaronbentley.com-20090311030731-b9bnnv0qzbxqjk4d
    parent: pqm at pqm.ubuntu.com-20090311015637-v73ocbv9bcexe4dm
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: no-auto-reference
    timestamp: Wed 2009-03-11 13:08:02 +1000
    message:
      Merge bzr.dev into no-auto-reference
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/__init__.py             __init__.py-20050309040759-33e65acf91bbcd5d
      bzrlib/bugtracker.py           bugtracker.py-20070410073305-vu1vu1qosjurg8kb-1
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/hooks.py                hooks.py-20070325015548-ix4np2q0kd8452au-1
      bzrlib/lsprof.py               lsprof.py-20051208071030-833790916798ceed
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/smart/medium.py         medium.py-20061103051856-rgu2huy59fkz902q-1
      bzrlib/tests/blackbox/test_commit.py test_commit.py-20060212094538-ae88fc861d969db0
      bzrlib/tests/branch_implementations/__init__.py __init__.py-20060123013057-b12a52c3f361daf4
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
      bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
      bzrlib/tests/test_hooks.py     test_hooks.py-20070628030849-89rtsbe5dmer5npz-1
      bzrlib/transport/http/__init__.py http_transport.py-20050711212304-506c5fd1059ace96
      bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
      bzrlib/transport/remote.py     ssh.py-20060608202016-c25gvf1ob7ypbus6-1
      tools/doc_generate/autodoc_man.py bzrman.py-20050601153041-0ff7f74de456d15e
    ------------------------------------------------------------
    revno: 4100.2.6
    revision-id: aaron at aaronbentley.com-20090311030731-b9bnnv0qzbxqjk4d
    parent: aaron at aaronbentley.com-20090311015316-r02ln95zzlimfdh2
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: no-auto-reference
    timestamp: Wed 2009-03-11 13:07:31 +1000
    message:
      Add tests for update_entry with tree references
    modified:
      bzrlib/tests/test__dirstate_helpers.py test_dirstate_helper-20070504035751-jsbn00xodv0y1eve-2
    ------------------------------------------------------------
    revno: 4100.2.5
    revision-id: aaron at aaronbentley.com-20090311015316-r02ln95zzlimfdh2
    parent: aaron at aaronbentley.com-20090310074116-ky77036dajc58bsi
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: no-auto-reference
    timestamp: Wed 2009-03-11 11:53:16 +1000
    message:
      Stop resetting minikind to 'd' when comparing.
    modified:
      bzrlib/_dirstate_helpers_c.pyx dirstate_helpers.pyx-20070503201057-u425eni465q4idwn-3
      bzrlib/dirstate.py             dirstate.py-20060728012006-d6mvoihjb3je9peu-1
    ------------------------------------------------------------
    revno: 4100.2.4
    revision-id: aaron at aaronbentley.com-20090310074116-ky77036dajc58bsi
    parent: aaron at aaronbentley.com-20090310052459-9r5w2vvnklb92x99
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: no-auto-reference
    timestamp: Tue 2009-03-10 17:41:16 +1000
    message:
      More support for not autodetecting tree refs
    modified:
      bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
      bzrlib/tests/test_bzrdir.py    test_bzrdir.py-20060131065654-deba40eef51cf220
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
    ------------------------------------------------------------
    revno: 4100.2.3
    revision-id: aaron at aaronbentley.com-20090310052459-9r5w2vvnklb92x99
    parent: aaron at aaronbentley.com-20090310045549-j5jmgq190872oem7
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: no-auto-reference
    timestamp: Tue 2009-03-10 15:24:59 +1000
    message:
      Avoid autodetecting tree references in _comparison_data.
    modified:
      bzrlib/tests/test_workingtree_4.py test_workingtree_4.p-20070223025758-531n3tznl3zacv2o-1
      bzrlib/tests/workingtree_implementations/test_nested_specifics.py test_nested_specific-20070306004443-qut978c488jr11sg-1
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
    ------------------------------------------------------------
    revno: 4100.2.2
    revision-id: aaron at aaronbentley.com-20090310045549-j5jmgq190872oem7
    parent: aaron at aaronbentley.com-20090310025416-l9kp0uruhu9trobf
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: no-auto-reference
    timestamp: Tue 2009-03-10 14:55:49 +1000
    message:
      Remove locking decorator
    modified:
      bzrlib/tests/workingtree_implementations/test_mkdir.py test_mkdir.py-20060907214856-4omn6hf1u7fvrart-3
      bzrlib/tests/workingtree_implementations/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
    ------------------------------------------------------------
    revno: 4100.2.1
    revision-id: aaron at aaronbentley.com-20090310025416-l9kp0uruhu9trobf
    parent: pqm at pqm.ubuntu.com-20090310012923-c8el0n6v75v4ycd1
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: no-auto-reference
    timestamp: Tue 2009-03-10 12:54:16 +1000
    message:
      Disable autodetection of tree references
    modified:
      bzrlib/tests/workingtree_implementations/test_nested_specifics.py test_nested_specific-20070306004443-qut978c488jr11sg-1
      bzrlib/tests/workingtree_implementations/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
      bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'NEWS'
--- a/NEWS	2009-03-10 09:55:11 +0000
+++ b/NEWS	2009-03-11 03:13:03 +0000
@@ -15,6 +15,10 @@
       command may need to be adjusted.
       (Neil Martinsen-Burrell)
 
+    * bzr no longer autodetects nested trees as 'tree-references'.  They
+      must now be explicitly added tree references.  At the commandline, use
+      join --reference instead of add.  (Aaron Bentley)
+
   NEW FEATURES:
 
     * ``bzr reconfigure`` now supports --with-trees and --with-no-trees

=== modified file 'bzrlib/_dirstate_helpers_c.pyx'
--- a/bzrlib/_dirstate_helpers_c.pyx	2009-02-12 18:55:16 +0000
+++ b/bzrlib/_dirstate_helpers_c.pyx	2009-03-11 01:53:16 +0000
@@ -841,6 +841,8 @@
     packed_stat = _pack_stat(stat_value)
     details = PyList_GetItem_void_void(PyTuple_GetItem_void_void(<void *>entry, 1), 0)
     saved_minikind = PyString_AsString_obj(<PyObject *>PyTuple_GetItem_void_void(details, 0))[0]
+    if minikind == c'd' and saved_minikind == c't':
+        minikind = c't'
     saved_link_or_sha1 = PyTuple_GetItem_void_object(details, 1)
     saved_file_size = PyTuple_GetItem_void_object(details, 2)
     saved_executable = PyTuple_GetItem_void_object(details, 3)

=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py	2009-02-23 15:29:35 +0000
+++ b/bzrlib/dirstate.py	2009-03-11 01:53:16 +0000
@@ -2807,6 +2807,8 @@
     (saved_minikind, saved_link_or_sha1, saved_file_size,
      saved_executable, saved_packed_stat) = entry[1][0]
 
+    if minikind == 'd' and saved_minikind == 't':
+        minikind = 't'
     if (minikind == saved_minikind
         and packed_stat == saved_packed_stat):
         # The stat hasn't changed since we saved, so we can re-use the

=== modified file 'bzrlib/tests/intertree_implementations/test_compare.py'
--- a/bzrlib/tests/intertree_implementations/test_compare.py	2009-01-17 01:30:58 +0000
+++ b/bzrlib/tests/intertree_implementations/test_compare.py	2009-03-10 07:41:16 +0000
@@ -799,7 +799,7 @@
         tree2.set_root_id('root-id')
         subtree2 = self.make_to_branch_and_tree('2/sub')
         subtree2.set_root_id('subtree-id')
-        tree2.add(['sub'], ['subtree-id'])
+        tree2.add_reference(subtree2)
         self.build_tree(['2/sub/file'])
         subtree2.add(['file'])
 

=== modified file 'bzrlib/tests/test__dirstate_helpers.py'
--- a/bzrlib/tests/test__dirstate_helpers.py	2008-09-25 01:54:42 +0000
+++ b/bzrlib/tests/test__dirstate_helpers.py	2009-03-11 03:07:31 +0000
@@ -1020,6 +1020,17 @@
         self.assertEqual(dirstate.DirState.IN_MEMORY_UNMODIFIED,
                          state._dirblock_state)
 
+    def test_update_entry_tree_reference(self):
+        self.set_update_entry()
+        state = test_dirstate.InstrumentedDirState.initialize('dirstate')
+        self.addCleanup(state.unlock)
+        state.add('r', 'r-id', 'tree-reference', None, '')
+        self.build_tree(['r/'])
+        entry = state._get_entry(0, path_utf8='r')
+        self.do_update_entry(state, entry, 'r')
+        entry = state._get_entry(0, path_utf8='r')
+        self.assertEqual('t', entry[1][0][0])
+
     def create_and_test_file(self, state, entry):
         """Create a file at 'a' and verify the state finds it during update.
 

=== modified file 'bzrlib/tests/test_bzrdir.py'
--- a/bzrlib/tests/test_bzrdir.py	2009-03-06 12:22:29 +0000
+++ b/bzrlib/tests/test_bzrdir.py	2009-03-10 07:41:16 +0000
@@ -740,15 +740,20 @@
                           transport)
 
     def test_sprout_recursive(self):
-        tree = self.make_branch_and_tree('tree1', format='dirstate-with-subtree')
+        tree = self.make_branch_and_tree('tree1',
+                                         format='dirstate-with-subtree')
         sub_tree = self.make_branch_and_tree('tree1/subtree',
             format='dirstate-with-subtree')
+        sub_tree.set_root_id('subtree-root')
         tree.add_reference(sub_tree)
         self.build_tree(['tree1/subtree/file'])
         sub_tree.add('file')
         tree.commit('Initial commit')
-        tree.bzrdir.sprout('tree2')
+        tree2 = tree.bzrdir.sprout('tree2').open_workingtree()
+        tree2.lock_read()
+        self.addCleanup(tree2.unlock)
         self.failUnlessExists('tree2/subtree/file')
+        self.assertEqual('tree-reference', tree2.kind('subtree-root'))
 
     def test_cloning_metadir(self):
         """Ensure that cloning metadir is suitable"""

=== modified file 'bzrlib/tests/test_workingtree_4.py'
--- a/bzrlib/tests/test_workingtree_4.py	2009-01-17 01:30:58 +0000
+++ b/bzrlib/tests/test_workingtree_4.py	2009-03-10 05:24:59 +0000
@@ -592,6 +592,7 @@
         revid = tree.commit('a commit')
         # tree's dirstate should now have a valid stat entry for foo.
         tree.lock_read()
+        self.addCleanup(tree.unlock)
         entry = tree._get_entry(path='foo')
         expected_sha1 = osutils.sha_file_by_name('foo')
         self.assertEqual(expected_sha1, entry[1][0][1])

=== modified file 'bzrlib/tests/workingtree_implementations/test_mkdir.py'
--- a/bzrlib/tests/workingtree_implementations/test_mkdir.py	2006-10-05 05:37:25 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_mkdir.py	2009-03-10 04:55:49 +0000
@@ -24,11 +24,15 @@
 
     def test_mkdir_no_id(self):
         t = self.make_branch_and_tree('t1')
+        t.lock_write()
+        self.addCleanup(t.unlock)
         file_id = t.mkdir('path')
         self.assertEqual('directory', t.kind(file_id))
 
     def test_mkdir_with_id(self):
         t = self.make_branch_and_tree('t1')
+        t.lock_write()
+        self.addCleanup(t.unlock)
         file_id = t.mkdir('path', 'my-id')
         self.assertEqual('my-id', file_id)
         self.assertEqual('directory', t.kind(file_id))

=== modified file 'bzrlib/tests/workingtree_implementations/test_nested_specifics.py'
--- a/bzrlib/tests/workingtree_implementations/test_nested_specifics.py	2007-03-07 23:15:35 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_nested_specifics.py	2009-03-10 05:24:59 +0000
@@ -16,17 +16,22 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 
+from bzrlib.tests import TestNotApplicable
 from bzrlib.transform import TreeTransform
 from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
 
 
 class TestNestedSupport(TestCaseWithWorkingTree):
 
+    def make_branch_and_tree(self, path):
+        tree = TestCaseWithWorkingTree.make_branch_and_tree(self, path)
+        if not tree.supports_tree_reference():
+            raise TestNotApplicable('Tree references not supported')
+        return tree
+
     def test_set_get_tree_reference(self):
         """This tests that setting a tree reference is persistent."""
         tree = self.make_branch_and_tree('.')
-        if not tree.supports_tree_reference():
-            return
         transform = TreeTransform(tree)
         trans_id = transform.new_directory('reference', transform.root,
             'subtree-id')
@@ -40,10 +45,26 @@
 
     def test_extract_while_locked(self):
         tree = self.make_branch_and_tree('.')
-        if not tree.supports_tree_reference():
-            return
         tree.lock_write()
         self.addCleanup(tree.unlock)
         self.build_tree(['subtree/'])
         tree.add(['subtree'], ['subtree-id'])
         subtree = tree.extract('subtree-id')
+
+    def prepare_with_subtree(self):
+        tree = self.make_branch_and_tree('.')
+        tree.lock_write()
+        self.addCleanup(tree.unlock)
+        subtree = self.make_branch_and_tree('subtree')
+        tree.add(['subtree'], ['subtree-id'])
+        return tree
+
+    def test_kind_does_not_autodetect_subtree(self):
+        tree = self.prepare_with_subtree()
+        self.assertEqual('directory', tree.kind('subtree-id'))
+
+    def test_comparison_data_does_not_autodetect_subtree(self):
+        tree = self.prepare_with_subtree()
+        entry = tree.iter_entries_by_dir(['subtree-id']).next()[1]
+        self.assertEqual('directory',
+                         tree._comparison_data(entry, 'subtree')[0])

=== modified file 'bzrlib/tests/workingtree_implementations/test_workingtree.py'
--- a/bzrlib/tests/workingtree_implementations/test_workingtree.py	2009-01-17 01:30:58 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_workingtree.py	2009-03-10 04:55:49 +0000
@@ -805,18 +805,14 @@
         # they had when they were first added
         # create one file of every interesting type
         tree = self.make_branch_and_tree('.')
+        tree.lock_write()
+        self.addCleanup(tree.unlock)
         self.build_tree(['file', 'directory/'])
         names = ['file', 'directory']
         if has_symlinks():
             os.symlink('target', 'symlink')
             names.append('symlink')
         tree.add(names, [n + '-id' for n in names])
-        if tree.supports_tree_reference():
-            sub_tree = self.make_branch_and_tree('tree-reference')
-            sub_tree.set_root_id('tree-reference-id')
-            sub_tree.commit('message')
-            names.append('tree-reference')
-            tree.add_reference(sub_tree)
         # now when we first look, we should see everything with the same kind
         # with which they were initially added
         for n in names:

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2009-02-23 15:29:35 +0000
+++ b/bzrlib/workingtree_4.py	2009-03-10 07:41:16 +0000
@@ -213,9 +213,8 @@
             WorkingTree3._comparison_data(self, entry, path)
         # it looks like a plain directory, but it's really a reference -- see
         # also kind()
-        if (self._repo_supports_tree_reference and
-            kind == 'directory' and
-            self._directory_is_tree_reference(path)):
+        if (self._repo_supports_tree_reference and kind == 'directory'
+            and entry is not None and entry.kind == 'tree-reference'):
             kind = 'tree-reference'
         return kind, executable, stat_value
 
@@ -564,10 +563,11 @@
     def _kind(self, relpath):
         abspath = self.abspath(relpath)
         kind = file_kind(abspath)
-        if (self._repo_supports_tree_reference and
-            kind == 'directory' and
-            self._directory_is_tree_reference(relpath)):
-            kind = 'tree-reference'
+        if (self._repo_supports_tree_reference and kind == 'directory'):
+            entry = self._get_entry(path=relpath)
+            if entry[1] is not None:
+                if entry[1][0][0] == 't':
+                    kind = 'tree-reference'
         return kind
 
     @needs_read_lock




More information about the bazaar-commits mailing list