Rev 2718: Checkout into existing trees works (Aaron Bentley) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Aug 16 17:38:41 BST 2007


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

------------------------------------------------------------
revno: 2718
revision-id: pqm at pqm.ubuntu.com-20070816163827-sbv5xkblg2uh7fh4
parent: pqm at pqm.ubuntu.com-20070816153342-vx6qu7u23qs035vy
parent: abentley at panoramicfeedback.com-20070815173112-dod4h1sgegz3n3av
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2007-08-16 17:38:27 +0100
message:
  Checkout into existing trees works (Aaron Bentley)
modified:
  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.77.1.3.1.3
    merged: abentley at panoramicfeedback.com-20070815173112-dod4h1sgegz3n3av
    parent: abentley at panoramicfeedback.com-20070815172653-x0z58pinff7t8n2c
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Wed 2007-08-15 13:31:12 -0400
    message:
      Actually, Branch.create_checkout will ensure the directory exists
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.2
    merged: abentley at panoramicfeedback.com-20070815172653-x0z58pinff7t8n2c
    parent: abentley at panoramicfeedback.com-20070815165914-4o8dobkptpu8sxu0
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Wed 2007-08-15 13:26:53 -0400
    message:
      Checkout into existing trees works
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.1
    merged: abentley at panoramicfeedback.com-20070815165914-4o8dobkptpu8sxu0
    parent: abentley at panoramicfeedback.com-20070807234458-nzhkoyza56lan7z5
    parent: pqm at pqm.ubuntu.com-20070815155635-7o7uhuh1ggjomeh4
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Wed 2007-08-15 12:59:14 -0400
    message:
      Merge bzr.dev
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2007-08-15 16:05:13 +0000
+++ b/bzrlib/builtins.py	2007-08-16 16:38:27 +0000
@@ -959,17 +959,6 @@
             except errors.NoWorkingTree:
                 source.bzrdir.create_workingtree(revision_id)
                 return
-        try:
-            os.mkdir(to_location)
-        except OSError, e:
-            if e.errno == errno.EEXIST:
-                raise errors.BzrCommandError('Target directory "%s" already'
-                                             ' exists.' % to_location)
-            if e.errno == errno.ENOENT:
-                raise errors.BzrCommandError('Parent of "%s" does not exist.'
-                                             % to_location)
-            else:
-                raise
         source.create_checkout(to_location, revision_id, lightweight)
 
 

=== modified file 'bzrlib/tests/blackbox/test_checkout.py'
--- a/bzrlib/tests/blackbox/test_checkout.py	2007-07-23 19:37:15 +0000
+++ b/bzrlib/tests/blackbox/test_checkout.py	2007-08-15 17:26:53 +0000
@@ -103,6 +103,30 @@
         # with no diff
         out, err = self.run_bzr('diff')
 
+    def _test_checkout_existing_dir(self, lightweight):
+        source = self.make_branch_and_tree('source')
+        self.build_tree_contents([('source/file1', 'content1'),
+                                  ('source/file2', 'content2'),])
+        source.add(['file1', 'file2'])
+        source.commit('added files')
+        self.build_tree_contents([('target/', ''),
+                                  ('target/file1', 'content1'),
+                                  ('target/file2', 'content3'),])
+        cmd = ['checkout', 'source', 'target']
+        if lightweight:
+            cmd.append('--lightweight')
+        self.run_bzr('checkout source target')
+        # files with unique content should be moved
+        self.failUnlessExists('target/file2.moved')
+        # files with content matching tree should not be moved
+        self.failIfExists('target/file1.moved')
+
+    def test_checkout_existing_dir_heavy(self):
+        self._test_checkout_existing_dir(False)
+
+    def test_checkout_existing_dir_lightweight(self):
+        self._test_checkout_existing_dir(True)
+
     def test_checkout_in_branch_with_r(self):
         branch = _mod_branch.Branch.open('branch')
         branch.bzrdir.destroy_workingtree()




More information about the bazaar-commits mailing list