Rev 2650: bzr checkout -r always works, even with -r0 (#127708) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Jul 23 22:42:06 BST 2007


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

------------------------------------------------------------
revno: 2650
revision-id: pqm at pqm.ubuntu.com-20070723214204-jwd5cwzvq93wwlgs
parent: pqm at pqm.ubuntu.com-20070723155512-ckelzx8u6m5vxyja
parent: abentley at panoramicfeedback.com-20070723193715-2xkkwmr4l3bfb650
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2007-07-23 22:42:04 +0100
message:
  bzr checkout -r always works, even with -r0 (#127708)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_checkout.py test_checkout.py-20060211231752-a5cde67cf70af854
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.60
    merged: abentley at panoramicfeedback.com-20070723193715-2xkkwmr4l3bfb650
    parent: abentley at panoramicfeedback.com-20070723145148-5e1357oxg0ndevw4
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Mon 2007-07-23 15:37:15 -0400
    message:
      bzr checkout -r always works, even with -r0 (#127708)
=== modified file 'NEWS'
--- a/NEWS	2007-07-23 14:27:42 +0000
+++ b/NEWS	2007-07-23 19:37:15 +0000
@@ -29,6 +29,9 @@
     * ``bzr status`` now honours FILE parameters for conflict lists
       (Aaron Bentley, #127606)
 
+    * ``bzr checkout`` now honours -r when reconstituting a working tree.
+      It also honours -r 0.  (Aaron Bentley, #127708)
+
   IMPROVEMENTS:
 
     * Don't show "dots" progress indicators when run non-interactively, such

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2007-07-20 18:59:29 +0000
+++ b/bzrlib/builtins.py	2007-07-23 19:37:15 +0000
@@ -942,7 +942,8 @@
             to_location = branch_location
         source = Branch.open(branch_location)
         if len(revision) == 1 and revision[0] is not None:
-            revision_id = revision[0].in_history(source)[1]
+            revision_id = _mod_revision.ensure_null(
+                revision[0].in_history(source)[1])
         else:
             revision_id = None
         if to_location is None:
@@ -955,7 +956,7 @@
             try:
                 source.bzrdir.open_workingtree()
             except errors.NoWorkingTree:
-                source.bzrdir.create_workingtree()
+                source.bzrdir.create_workingtree(revision_id)
                 return
         try:
             os.mkdir(to_location)

=== modified file 'bzrlib/tests/blackbox/test_checkout.py'
--- a/bzrlib/tests/blackbox/test_checkout.py	2007-06-27 19:13:50 +0000
+++ b/bzrlib/tests/blackbox/test_checkout.py	2007-07-23 19:37:15 +0000
@@ -22,8 +22,12 @@
 import shutil
 import sys
 
-import bzrlib.bzrdir as bzrdir
-import bzrlib.errors as errors
+from bzrlib import (
+    branch as _mod_branch,
+    bzrdir,
+    errors,
+    workingtree,
+    )
 from bzrlib.tests.blackbox import ExternalBase
 
 
@@ -98,3 +102,14 @@
         branch.bzrdir.open_workingtree()
         # with no diff
         out, err = self.run_bzr('diff')
+
+    def test_checkout_in_branch_with_r(self):
+        branch = _mod_branch.Branch.open('branch')
+        branch.bzrdir.destroy_workingtree()
+        os.chdir('branch')
+        self.run_bzr('checkout -r 1')
+        tree = workingtree.WorkingTree.open('.')
+        self.assertEqual('1', tree.last_revision())
+        branch.bzrdir.destroy_workingtree()
+        self.run_bzr('checkout -r 0')
+        self.assertIs(None, tree.last_revision())




More information about the bazaar-commits mailing list