Rev 2354: (Wouter van Heyst) switch 'bzr init-repo' to default to '--no-trees' in http://bzr.arbash-meinel.com/branches/bzr/jam-integration

John Arbash Meinel john at arbash-meinel.com
Tue Mar 13 18:11:57 GMT 2007


At http://bzr.arbash-meinel.com/branches/bzr/jam-integration

------------------------------------------------------------
revno: 2354
revision-id: john at arbash-meinel.com-20070313181145-k7jczddn8rnnlq5s
parent: pqm at pqm.ubuntu.com-20070313175755-809681c81472204a
parent: larstiq at larstiq.dyndns.org-20070202160551-t5szmmar7gb7zt6l
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Tue 2007-03-13 12:11:45 -0600
message:
  (Wouter van Heyst) switch 'bzr init-repo' to default to '--no-trees'
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/tests/blackbox/test_init.py test_init.py-20060309032856-a292116204d86eb7
  bzrlib/tests/blackbox/test_shared_repository.py test_shared_repository.py-20060317053531-ed30c0d79325e483
    ------------------------------------------------------------
    revno: 2257.2.2
    merged: larstiq at larstiq.dyndns.org-20070202160551-t5szmmar7gb7zt6l
    parent: larstiq at larstiq.dyndns.org-20070202122410-pvj8k5lqmdrwpazh
    committer: Wouter van Heyst <larstiq at larstiq.dyndns.org>
    branch nick: treeful-repositories
    timestamp: Fri 2007-02-02 17:05:51 +0100
    message:
      Actually test that `bzr init-repo --{no,}-trees` still works
    ------------------------------------------------------------
    revno: 2257.2.1
    merged: larstiq at larstiq.dyndns.org-20070202122410-pvj8k5lqmdrwpazh
    parent: pqm at pqm.ubuntu.com-20070202101652-5367171684fe2eec
    committer: Wouter van Heyst <larstiq at larstiq.dyndns.org>
    branch nick: treeful-repositories
    timestamp: Fri 2007-02-02 13:24:10 +0100
    message:
      Change the ui level default for init-repo to --trees.
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2007-03-13 16:45:23 +0000
+++ b/NEWS	2007-03-13 18:11:45 +0000
@@ -1,5 +1,11 @@
 IN DEVELOPMENT
 
+  NOTES WHEN UPGRADING:
+        
+    * Release 0.15rc2 of bzr changes the ``bzr init-repo`` command to
+      default to ``--trees`` instead of ``--no-trees``.
+      Existing shared repositories are not affected.
+
   IMPROVEMENTS:
 
     * New ``merge-directive`` command to generate machine- and human-readable
@@ -33,6 +39,9 @@
 
     * Fix commit of merges with symlinks in dirstate trees.
       (Marien Zwart)
+    
+    * Switch the ``bzr init-repo`` default from --no-trees to --trees. 
+      (Wouter van Heyst, #53483)
 
  
 bzr 0.15rc1  2007-03-07

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2007-03-13 12:01:34 +0000
+++ b/bzrlib/builtins.py	2007-03-13 18:11:45 +0000
@@ -1291,12 +1291,13 @@
     shared storage.
 
     example:
-        bzr init-repo repo
+        bzr init-repo --no-trees repo
         bzr init repo/trunk
         bzr checkout --lightweight repo/trunk trunk-checkout
         cd trunk-checkout
         (add files here)
     """
+
     takes_args = ["location"]
     takes_options = [RegistryOption('format',
                             help='Specify a format for this repository. See'
@@ -1304,11 +1305,13 @@
                             registry=bzrdir.format_registry,
                             converter=bzrdir.format_registry.make_bzrdir,
                             value_switches=True, title='Repository format'),
-                     Option('trees',
-                             help='Allows branches in repository to have'
-                             ' a working tree')]
+                     Option('no-trees',
+                             help='Branches in the repository will default to'
+                                  'not having a working tree'),
+                    ]
     aliases = ["init-repo"]
-    def run(self, location, format=None, trees=False):
+
+    def run(self, location, format=None, no_trees=False):
         if format is None:
             format = bzrdir.format_registry.make_bzrdir('default')
 
@@ -1323,7 +1326,7 @@
 
         newdir = format.initialize_on_transport(to_transport)
         repo = newdir.create_repository(shared=True)
-        repo.set_make_working_trees(trees)
+        repo.set_make_working_trees(not no_trees)
 
 
 class cmd_diff(Command):

=== modified file 'bzrlib/tests/blackbox/test_init.py'
--- a/bzrlib/tests/blackbox/test_init.py	2007-03-07 01:14:11 +0000
+++ b/bzrlib/tests/blackbox/test_init.py	2007-03-13 18:11:45 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006 Canonical Ltd
+# Copyright (C) 2006, 2007 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
@@ -97,7 +97,8 @@
 
     def test_init_existing_without_workingtree(self):
         # make a repository
-        self.run_bzr('init-repo', '.')
+        repo = self.make_repository('.', shared=True)
+        repo.set_make_working_trees(False)
         # make a branch; by default without a working tree
         self.run_bzr('init', 'subdir')
         # fail

=== modified file 'bzrlib/tests/blackbox/test_shared_repository.py'
--- a/bzrlib/tests/blackbox/test_shared_repository.py	2006-10-11 23:08:27 +0000
+++ b/bzrlib/tests/blackbox/test_shared_repository.py	2007-02-02 16:05:51 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2006 Canonical Ltd
+# Copyright (C) 2005, 2006, 2007 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
@@ -18,10 +18,9 @@
 
 import os
 
-from bzrlib.tests import TestCaseInTempDir
-import bzrlib.bzrdir
 from bzrlib.bzrdir import BzrDir
 import bzrlib.errors as errors
+from bzrlib.tests import TestCaseInTempDir
 
 class TestSharedRepo(TestCaseInTempDir):
 
@@ -29,7 +28,7 @@
         out, err = self.run_bzr("init-repository", "a")
         self.assertEqual(out, "")
         self.assertEqual(err, "")
-        dir = bzrlib.bzrdir.BzrDir.open('a')
+        dir = BzrDir.open('a')
         self.assertIs(dir.open_repository().is_shared(), True)
         self.assertRaises(errors.NotBranchError, dir.open_branch)
         self.assertRaises(errors.NoWorkingTree, dir.open_workingtree)        
@@ -46,23 +45,23 @@
     def test_init(self):
         self.run_bzr("init-repo", "a")
         self.run_bzr("init", "--format=default", "a/b")
-        dir = bzrlib.bzrdir.BzrDir.open('a')
+        dir = BzrDir.open('a')
         self.assertIs(dir.open_repository().is_shared(), True)
         self.assertRaises(errors.NotBranchError, dir.open_branch)
         self.assertRaises(errors.NoWorkingTree, dir.open_workingtree)
-        bdir = bzrlib.bzrdir.BzrDir.open('a/b')
+        bdir = BzrDir.open('a/b')
         bdir.open_branch()
         self.assertRaises(errors.NoRepositoryPresent, bdir.open_repository)
-        self.assertRaises(errors.NoWorkingTree, bdir.open_workingtree)
+        wt = bdir.open_workingtree()
 
     def test_branch(self):
         self.run_bzr("init-repo", "a")
         self.run_bzr("init", "--format=default", "a/b")
         self.run_bzr('branch', 'a/b', 'a/c')
-        cdir = bzrlib.bzrdir.BzrDir.open('a/c')
+        cdir = BzrDir.open('a/c')
         cdir.open_branch()
         self.assertRaises(errors.NoRepositoryPresent, cdir.open_repository)
-        self.assertRaises(errors.NoWorkingTree, cdir.open_workingtree)
+        cdir.open_workingtree()
 
     def test_branch_tree(self):
         self.run_bzr("init-repo", "--trees", "a")
@@ -72,9 +71,27 @@
         self.run_bzr("commit", "-m", "bar", "b/hello")
 
         self.run_bzr('branch', 'b', 'a/c')
-        cdir = bzrlib.bzrdir.BzrDir.open('a/c')
+        cdir = BzrDir.open('a/c')
         cdir.open_branch()
         self.assertRaises(errors.NoRepositoryPresent, cdir.open_repository)
         self.failUnlessExists('a/c/hello')
         cdir.open_workingtree()
 
+    def test_trees_default(self):
+        # 0.15 switched to trees by default
+        self.run_bzr("init-repo", "repo")
+        repo = BzrDir.open("repo").open_repository()
+        self.assertEqual(True, repo.make_working_trees())
+
+    def test_trees_argument(self):
+        # Supplying the --trees argument should be harmless,
+        # as it was previously non-default we need to get it right.
+        self.run_bzr("init-repo", "--trees", "trees")
+        repo = BzrDir.open("trees").open_repository()
+        self.assertEqual(True, repo.make_working_trees())
+
+    def test_no_trees_argument(self):
+        # --no-trees should make it so that there is no working tree
+        self.run_bzr("init-repo", "--no-trees", "notrees")
+        repo = BzrDir.open("notrees").open_repository()
+        self.assertEqual(False, repo.make_working_trees())



More information about the bazaar-commits mailing list