Rev 2437: new formats are network-compatible with old clients (#107168) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Apr 20 13:19:58 BST 2007


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

------------------------------------------------------------
revno: 2437
revision-id: pqm at pqm.ubuntu.com-20070420121956-hbxbonnuyt92yy4u
parent: pqm at pqm.ubuntu.com-20070420090829-aqcwsbei88o2z1zf
parent: aaron.bentley at utoronto.ca-20070420114824-jd5kfyku8qeyv844
committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2007-04-20 13:19:56 +0100
message:
  new formats are network-compatible with old clients (#107168)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/test_workingtree_4.py test_workingtree_4.p-20070223025758-531n3tznl3zacv2o-1
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.7
    merged: aaron.bentley at utoronto.ca-20070420114824-jd5kfyku8qeyv844
    parent: aaron.bentley at utoronto.ca-20070420041955-2vybpetf1bv0vktb
    parent: pqm at pqm.ubuntu.com-20070420090829-aqcwsbei88o2z1zf
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: Aaron's mergeable stuff
    timestamp: Fri 2007-04-20 07:48:24 -0400
    message:
      Merge from bzr.dev
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.6
    merged: aaron.bentley at utoronto.ca-20070420041955-2vybpetf1bv0vktb
    parent: aaron.bentley at utoronto.ca-20070420032116-e1uvjjr2thrvcm8i
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: Aaron's mergeable stuff
    timestamp: Fri 2007-04-20 00:19:55 -0400
    message:
      Use ROOT_ID when the repository supports old clients (Bug #107168)
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.5
    merged: aaron.bentley at utoronto.ca-20070420032116-e1uvjjr2thrvcm8i
    parent: abentley at panoramicfeedback.com-20070416211229-xa9pdlxs721oxhyx
    parent: pqm at pqm.ubuntu.com-20070419224637-jvlshh6kibtj43a5
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: Aaron's mergeable stuff
    timestamp: Thu 2007-04-19 23:21:16 -0400
    message:
      Merge bzr.dev
=== modified file 'NEWS'
--- a/NEWS	2007-04-20 08:33:47 +0000
+++ b/NEWS	2007-04-20 11:48:24 +0000
@@ -114,6 +114,9 @@
 
     * Typo in the help for ``register-branch`` fixed. (Robert Collins, #96770)
 
+    * "dirstate" and "dirstate-tags" formats now produce branches compatible
+      with old versions of bzr. (Aaron Bentley, #107168))
+
   TESTING:
 
     * Added ``bzrlib.strace.strace`` which will strace a single callable and

=== modified file 'bzrlib/tests/test_workingtree_4.py'
--- a/bzrlib/tests/test_workingtree_4.py	2007-03-07 09:11:10 +0000
+++ b/bzrlib/tests/test_workingtree_4.py	2007-04-20 04:19:55 +0000
@@ -23,6 +23,7 @@
     bzrdir,
     dirstate,
     errors,
+    inventory,
     workingtree_4,
     )
 from bzrlib.lockdir import LockDir
@@ -464,6 +465,13 @@
         wt.commit('again')
         validate()
 
+    def test_default_root_id(self):
+        tree = self.make_branch_and_tree('tag', format='dirstate-tags')
+        self.assertEqual(inventory.ROOT_ID, tree.get_root_id())
+        tree = self.make_branch_and_tree('subtree',
+                                         format='dirstate-with-subtree')
+        self.assertNotEqual(inventory.ROOT_ID, tree.get_root_id())
+
     def test_non_subtree_with_nested_trees(self):
         # prior to dirstate, st/diff/commit ignored nested trees.
         # dirstate, as opposed to dirstate-with-subtree, should

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2007-04-14 12:18:42 +0000
+++ b/bzrlib/workingtree_4.py	2007-04-20 04:19:55 +0000
@@ -1246,7 +1246,8 @@
         :param revision_id: allows creating a working tree at a different
         revision than the branch is at.
 
-        These trees get an initial random root id.
+        These trees get an initial random root id, if their repository supports
+        rich root data, TREE_ROOT otherwise.
         """
         revision_id = osutils.safe_revision_id(revision_id)
         if not isinstance(a_bzrdir.transport, LocalTransport):
@@ -1274,7 +1275,10 @@
         wt.current_dirstate()._validate()
         try:
             if revision_id in (None, NULL_REVISION):
-                wt._set_root_id(generate_ids.gen_root_id())
+                if branch.repository.supports_rich_root():
+                    wt._set_root_id(generate_ids.gen_root_id())
+                else:
+                    wt._set_root_id(ROOT_ID)
                 wt.flush()
                 wt.current_dirstate()._validate()
             wt.set_last_revision(revision_id)




More information about the bazaar-commits mailing list