Rev 3006: (Daniel Watkins) bzrdir.clone() should respect a target repositories in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Sat Nov 17 18:07:45 GMT 2007


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

------------------------------------------------------------
revno: 3006
revision-id: pqm at pqm.ubuntu.com-20071117180742-59zhz30s7839y41j
parent: pqm at pqm.ubuntu.com-20071117014803-umq9bksvua0zmpts
parent: d.m.watkins at warwick.ac.uk-20071114181859-zalzomjc7eykpafo
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sat 2007-11-17 18:07:42 +0000
message:
  (Daniel Watkins) bzrdir.clone() should respect a target repositories
  	no-trees setting.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
  bzrlib/tests/bzrdir_implementations/test_bzrdir.py test_bzrdir.py-20060131065642-0ebeca5e30e30866
    ------------------------------------------------------------
    revno: 2991.1.4
    merged: d.m.watkins at warwick.ac.uk-20071114181859-zalzomjc7eykpafo
    parent: d.m.watkins at warwick.ac.uk-20071114125457-liy135cb0cy62kzw
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 50582
    timestamp: Wed 2007-11-14 18:18:59 +0000
    message:
      Modified tests as per comments on-list.
    ------------------------------------------------------------
    revno: 2991.1.3
    merged: d.m.watkins at warwick.ac.uk-20071114125457-liy135cb0cy62kzw
    parent: d.m.watkins at warwick.ac.uk-20071114125319-ihpb65qop0k5i68y
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 50582
    timestamp: Wed 2007-11-14 12:54:57 +0000
    message:
      Added NEWS entry.
    ------------------------------------------------------------
    revno: 2991.1.2
    merged: d.m.watkins at warwick.ac.uk-20071114125319-ihpb65qop0k5i68y
    parent: d.m.watkins at warwick.ac.uk-20071114125116-hqebv8946b53zqpu
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 50582
    timestamp: Wed 2007-11-14 12:53:19 +0000
    message:
      Working trees are no longer created by pushing into a local no-trees repo.
    ------------------------------------------------------------
    revno: 2991.1.1
    merged: d.m.watkins at warwick.ac.uk-20071114125116-hqebv8946b53zqpu
    parent: pqm at pqm.ubuntu.com-20071114092157-du5ikf6q4k64nseu
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: 50582
    timestamp: Wed 2007-11-14 12:51:16 +0000
    message:
      Added (failing) test to ensure that bzrdir.clone won't create a working tree in a no-trees repository.
=== modified file 'NEWS'
--- a/NEWS	2007-11-17 00:53:18 +0000
+++ b/NEWS	2007-11-17 18:07:42 +0000
@@ -106,6 +106,9 @@
    * Return error instead of a traceback for ``bzr log -r0``.
      (Kent Gibson, #133751)
 
+   * Working trees are no longer created when pushing into a local no-trees
+     repo. (Daniel Watkins, #50582)
+
   API BREAKS:
 
    * ``osutils.backup_file`` is deprecated. Actually it's not used in bzrlib

=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2007-11-01 21:02:36 +0000
+++ b/bzrlib/bzrdir.py	2007-11-14 12:53:19 +0000
@@ -209,9 +209,14 @@
         except errors.NotBranchError:
             pass
         try:
-            self.open_workingtree().clone(result)
-        except (errors.NoWorkingTree, errors.NotLocalUrl):
-            pass
+            result_repo = result.find_repository()
+        except errors.NoRepositoryPresent:
+            result_repo = None
+        if result_repo is None or result_repo.make_working_trees():
+            try:
+                self.open_workingtree().clone(result)
+            except (errors.NoWorkingTree, errors.NotLocalUrl):
+                pass
         return result
 
     # TODO: This should be given a Transport, and should chdir up; otherwise

=== modified file 'bzrlib/tests/bzrdir_implementations/test_bzrdir.py'
--- a/bzrlib/tests/bzrdir_implementations/test_bzrdir.py	2007-09-26 02:51:16 +0000
+++ b/bzrlib/tests/bzrdir_implementations/test_bzrdir.py	2007-11-14 18:18:59 +0000
@@ -525,6 +525,26 @@
         self.skipIfNoWorkingTree(target)
         self.assertEqual(['1'], target.open_workingtree().get_parent_ids())
 
+    def test_clone_bzrdir_into_notrees_repo(self):
+        """Cloning into a no-trees repo should not create a working tree"""
+        tree = self.make_branch_and_tree('source')
+        self.build_tree(['source/foo'])
+        tree.add('foo')
+        tree.commit('revision 1')
+
+        try:
+            repo = self.make_repository('repo', shared=True)
+        except errors.IncompatibleFormat:
+            raise TestNotApplicable('must support shared repositories')
+        if repo.make_working_trees():
+            repo.set_make_working_trees(False)
+            self.assertFalse(repo.make_working_trees())
+
+        dir = tree.bzrdir
+        a_dir = dir.clone(self.get_url('repo/a'))
+        a_dir.open_branch()
+        self.assertRaises(errors.NoWorkingTree, a_dir.open_workingtree)
+
     def test_get_branch_reference_on_reference(self):
         """get_branch_reference should return the right url."""
         referenced_branch = self.make_branch('referenced')




More information about the bazaar-commits mailing list