Rev 2422: Change WorkingTree4.initialize to only get a random root id if not based on a revisiontree in http://sourcefrog.net/bzr/dirstate-plus-subtree

Martin Pool mbp at sourcefrog.net
Thu Mar 1 09:02:17 GMT 2007


At http://sourcefrog.net/bzr/dirstate-plus-subtree

------------------------------------------------------------
revno: 2422
revision-id: mbp at sourcefrog.net-20070301090216-vhh2444yosrvw6ll
parent: mbp at sourcefrog.net-20070301075656-srwqme1s2d721937
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: dirstate-plus-subtree
timestamp: Thu 2007-03-01 20:02:16 +1100
message:
  Change WorkingTree4.initialize to only get a random root id if not based on a revisiontree
modified:
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2007-03-01 07:56:56 +0000
+++ b/bzrlib/workingtree_4.py	2007-03-01 09:02:16 +0000
@@ -1116,22 +1116,23 @@
         wt._new_tree()
         wt.lock_tree_write()
         try:
-            wt.set_last_revision(revision_id)
-            wt.flush()
-            basis = wt.basis_tree()
-            basis.lock_read()
-            state = wt.current_dirstate()
-            # if the basis has a root id we have to use that; otherwise we use
-            # a new random one
-            basis_root_id = basis.get_root_id()
-            if basis_root_id is not None:
-                wt._set_root_id(basis_root_id)
-                wt.flush()
-            elif revision_id in (None, NULL_REVISION):
+            if revision_id in (None, NULL_REVISION):
                 wt._set_root_id(generate_ids.gen_root_id())
                 wt.flush()
-            transform.build_tree(basis, wt)
-            basis.unlock()
+            else:
+                wt.set_last_revision(revision_id)
+                wt.flush()
+                basis = wt.basis_tree()
+                basis.lock_read()
+                state = wt.current_dirstate()
+                # if the basis has a root id we have to use that; otherwise we use
+                # a new random one
+                basis_root_id = basis.get_root_id()
+                if basis_root_id is not None:
+                    wt._set_root_id(basis_root_id)
+                    wt.flush()
+                transform.build_tree(basis, wt)
+                basis.unlock()
         finally:
             control_files.unlock()
             wt.unlock()




More information about the bazaar-commits mailing list