Rev 6249: (jelmer) Support 'null:' revision for WorkingTree.clone(). (Jelmer Vernooij) in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Tue Nov 8 19:35:24 UTC 2011


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6249 [merge]
revision-id: pqm at pqm.ubuntu.com-20111108193523-3pn06vmmw2508tsj
parent: pqm at pqm.ubuntu.com-20111108181825-lle320gxuedqw4o5
parent: jelmer at samba.org-20111108190955-xspn5rb9kpgw78oy
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2011-11-08 19:35:23 +0000
message:
  (jelmer) Support 'null:' revision for WorkingTree.clone(). (Jelmer Vernooij)
modified:
  bzrlib/tests/per_workingtree/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
  bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
  doc/en/release-notes/bzr-2.5.txt bzr2.5.txt-20110708125756-587p0hpw7oke4h05-1
=== modified file 'bzrlib/tests/per_workingtree/test_workingtree.py'
--- a/bzrlib/tests/per_workingtree/test_workingtree.py	2011-11-08 12:49:00 +0000
+++ b/bzrlib/tests/per_workingtree/test_workingtree.py	2011-11-08 19:09:55 +0000
@@ -26,6 +26,7 @@
     config,
     errors,
     osutils,
+    revision as _mod_revision,
     symbol_versioning,
     tests,
     trace,
@@ -311,6 +312,12 @@
         cloned = cloned_dir.open_workingtree()
         self.assertEqual(cloned.get_parent_ids(), wt.get_parent_ids())
 
+    def test_clone_empty(self):
+        wt = self.make_branch_and_tree('source')
+        cloned_dir = wt.bzrdir.clone('target', revision_id=_mod_revision.NULL_REVISION)
+        cloned = cloned_dir.open_workingtree()
+        self.assertEqual(cloned.get_parent_ids(), wt.get_parent_ids())
+
     def test_last_revision(self):
         wt = self.make_branch_and_tree('source')
         self.assertEqual([], wt.get_parent_ids())

=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2011-11-08 12:49:00 +0000
+++ b/bzrlib/workingtree.py	2011-11-08 19:09:55 +0000
@@ -522,7 +522,11 @@
             # TODO now merge from tree.last_revision to revision (to preserve
             # user local changes)
             merge.transform_tree(tree, self)
-            tree.set_parent_ids([revision_id])
+            if revision_id == _mod_revision.NULL_REVISION:
+                new_parents = []
+            else:
+                new_parents = [revision_id]
+            tree.set_parent_ids(new_parents)
 
     def id2abspath(self, file_id):
         return self.abspath(self.id2path(file_id))

=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt	2011-11-08 18:18:25 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt	2011-11-08 19:09:55 +0000
@@ -86,6 +86,9 @@
 * Fix finding the CPU count when using Python >= 2.6 on BSD-based systems.
   (Jelmer Vernooij, #887151)
 
+* ``WorkingTree.clone()`` now supports its ``revision_id`` being set
+  to the null revision. (Jelmer Vernooij, #876423)
+
 Documentation
 *************
 




More information about the bazaar-commits mailing list