Rev 3567: Fix file -> directory handling (jwestby, #248448) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Jul 21 16:16:06 BST 2008


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

------------------------------------------------------------
revno: 3567
revision-id:pqm at pqm.ubuntu.com-20080721151553-11iasd1407hkznk1
parent: pqm at pqm.ubuntu.com-20080721092720-z0bvnt4ljysbqjis
parent: aaron at aaronbentley.com-20080721144641-g2j1i3bvqu92c49a
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2008-07-21 16:15:53 +0100
message:
  Fix file -> directory handling (jwestby, #248448)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
  bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
    ------------------------------------------------------------
    revno: 3566.1.2
    revision-id:aaron at aaronbentley.com-20080721144641-g2j1i3bvqu92c49a
    parent: aaron at aaronbentley.com-20080721144605-i51s20nw892vtoim
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: bzr.ab.integration
    timestamp: Mon 2008-07-21 10:46:41 -0400
    message:
      Fix copyright dates
    modified:
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
    ------------------------------------------------------------
    revno: 3566.1.1
    revision-id:aaron at aaronbentley.com-20080721144605-i51s20nw892vtoim
    parent: pqm at pqm.ubuntu.com-20080721092720-z0bvnt4ljysbqjis
    parent: jw+debian at jameswestby.net-20080718162747-2ttgkhazeymmoxm0
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: bzr.ab.integration
    timestamp: Mon 2008-07-21 10:46:05 -0400
    message:
      Merge fix from jwestby
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
    ------------------------------------------------------------
    revno: 3535.6.3
    revision-id:jw+debian at jameswestby.net-20080718162747-2ttgkhazeymmoxm0
    parent: jw+debian at jameswestby.net-20080717155609-bvwrtxv3uhnlqvs6
    committer: James Westby <jw+debian at jameswestby.net>
    branch nick: bzr.dev.stat
    timestamp: Fri 2008-07-18 17:27:47 +0100
    message:
      Fix the test to not create transform conflicts.
    modified:
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
    ------------------------------------------------------------
    revno: 3535.6.2
    revision-id:jw+debian at jameswestby.net-20080717155609-bvwrtxv3uhnlqvs6
    parent: jw+debian at jameswestby.net-20080716163855-dfc57i41ua7y5std
    committer: James Westby <jw+debian at jameswestby.net>
    branch nick: bzr.dev.stat
    timestamp: Thu 2008-07-17 16:56:09 +0100
    message:
      Fixes from review. Thanks Aaron and John.
    modified:
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
    ------------------------------------------------------------
    revno: 3535.6.1
    revision-id:jw+debian at jameswestby.net-20080716163855-dfc57i41ua7y5std
    parent: pqm at pqm.ubuntu.com-20080709135859-wq3r1d1fjcafelgw
    committer: James Westby <jw+debian at jameswestby.net>
    branch nick: bzr.dev.stat
    timestamp: Wed 2008-07-16 17:38:55 +0100
    message:
      Handle a file turning in to a directory in TreeTransform.
      
      If a file turns in to a directory, then when TreeTransform stats
      any children of the new directory when they are added it gets
      ENOTDIR. This tells us the file doesn't exist, and so we handle
      it in the same way as ENOENT.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
      bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
=== modified file 'NEWS'
--- a/NEWS	2008-07-18 08:40:57 +0000
+++ b/NEWS	2008-07-21 14:46:05 +0000
@@ -152,6 +152,9 @@
     * Set locale from environment for third party libs.
       (Martin von Gagern, #128496)
 
+    * Handle a file turning in to a directory in TreeTransform.
+      (James Westby, #248448)
+
   DOCUMENTATION:
 
     * Added *Using stacked branches* to the User Guide.

=== modified file 'bzrlib/tests/test_transform.py'
--- a/bzrlib/tests/test_transform.py	2008-07-02 19:18:03 +0000
+++ b/bzrlib/tests/test_transform.py	2008-07-21 14:46:41 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 Canonical Ltd
+# Copyright (C) 2006, 2007, 2008 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -1215,6 +1215,21 @@
         self.assertContainsRe(str(err),
             "^File exists: .+/foo")
 
+    def test_file_to_directory(self):
+        wt = self.make_branch_and_tree('.')
+        self.build_tree(['foo'])
+        wt.add(['foo'])
+        tt = TreeTransform(wt)
+        self.addCleanup(tt.finalize)
+        foo_trans_id = tt.trans_id_tree_path("foo")
+        tt.delete_contents(foo_trans_id)
+        tt.create_directory(foo_trans_id)
+        bar_trans_id = tt.trans_id_tree_path("foo/bar")
+        tt.create_file(["aa\n"], bar_trans_id)
+        tt.version_file("bar-1", bar_trans_id)
+        tt.apply()
+        self.failUnlessExists("foo/bar")
+
 
 class TransformGroup(object):
 

=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py	2008-07-02 19:18:03 +0000
+++ b/bzrlib/transform.py	2008-07-17 15:56:09 +0000
@@ -354,7 +354,11 @@
         try:
             mode = os.stat(self._tree.abspath(old_path)).st_mode
         except OSError, e:
-            if e.errno == errno.ENOENT:
+            if e.errno in (errno.ENOENT, errno.ENOTDIR):
+                # Either old_path doesn't exist, or the parent of the
+                # target is not a directory (but will be one eventually)
+                # Either way, we know it doesn't exist *right now*
+                # See also bug #248448
                 return
             else:
                 raise




More information about the bazaar-commits mailing list