Rev 5481: (vila) Add a ``default_format`` configuration option (Neil in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Oct 11 16:03:29 BST 2010


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

------------------------------------------------------------
revno: 5481 [merge]
revision-id: pqm at pqm.ubuntu.com-20101011150328-e7g3pohlyn9aoxvb
parent: pqm at pqm.ubuntu.com-20101011114147-eunz0zgx5yjftom0
parent: v.ladeuil+lp at free.fr-20101011142819-ou0b31itldrq5dmo
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2010-10-11 16:03:28 +0100
message:
  (vila) Add a ``default_format`` configuration option (Neil
  	Martinsen-Burrell)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
  bzrlib/help_topics/en/configuration.txt configuration.txt-20060314161707-868350809502af01
  bzrlib/tests/blackbox/test_init.py test_init.py-20060309032856-a292116204d86eb7
=== modified file 'NEWS'
--- a/NEWS	2010-10-11 10:27:23 +0000
+++ b/NEWS	2010-10-11 14:28:19 +0000
@@ -16,6 +16,10 @@
 New Features
 ************
 
+* Provide a configuration option "default_format" that controls the
+  default format for new branches created with ``bzr init``.
+  (Neil Martinsen-Burrell, #484101)
+
 Bug Fixes
 *********
 
@@ -91,8 +95,8 @@
   (Toshio Kuratomi, #612096)
 
 * Print junk rather than throwing a UnicodeDecodeError from ``bzr version-info``
-  when using the rio format (with non-ascii information) on a non-utf-8 terminal.
-  (Andrej A Antonov, #518609)
+  when using the rio format (with non-ascii information) on a non-utf-8
+  terminal.  (Andrej A Antonov, #518609)
 
 * Skip tests that needs a bzr source tree when there isn't one. This is
   needed to succesfully run the test suite for installed versions.

=== modified file 'bzrlib/bzrdir.py'
--- a/bzrlib/bzrdir.py	2010-09-10 09:46:15 +0000
+++ b/bzrlib/bzrdir.py	2010-09-29 05:35:26 +0000
@@ -3345,7 +3345,11 @@
     help='Same as 2a.')
 
 # The current format that is made on 'bzr init'.
-controldir.format_registry.set_default('2a')
+format_name = config.GlobalConfig().get_user_option('default_format')
+if format_name is None:
+    controldir.format_registry.set_default('2a')
+else:
+    controldir.format_registry.set_default(format_name)
 
 # XXX 2010-08-20 JRV: There is still a lot of code relying on
 # bzrlib.bzrdir.format_registry existing. When BzrDir.create/BzrDir.open/etc

=== modified file 'bzrlib/help_topics/en/configuration.txt'
--- a/bzrlib/help_topics/en/configuration.txt	2010-07-06 01:26:59 +0000
+++ b/bzrlib/help_topics/en/configuration.txt	2010-09-29 05:35:26 +0000
@@ -504,6 +504,12 @@
     whether the format deprecation warning is shown on repositories that are
     using deprecated formats.
 
+default_format
+~~~~~~~~~~~~~~
+
+A format name for the default format used when creating branches.  See ``bzr
+help formats`` for possible values.
+
 
 Unicode options
 ---------------

=== modified file 'bzrlib/tests/blackbox/test_init.py'
--- a/bzrlib/tests/blackbox/test_init.py	2010-06-11 07:32:12 +0000
+++ b/bzrlib/tests/blackbox/test_init.py	2010-10-11 14:28:19 +0000
@@ -22,6 +22,7 @@
 
 from bzrlib import (
     branch as _mod_branch,
+    config as _mod_config,
     osutils,
     urlutils,
     )
@@ -163,6 +164,15 @@
         self.run_bzr('init ../new/tree --create-prefix', working_dir='tree')
         self.failUnlessExists('new/tree/.bzr')
 
+    def test_init_default_format_option(self):
+        """bzr init should read default format from option default_format"""
+        conf = _mod_config.GlobalConfig.from_string('''
+[DEFAULT]
+default_format = 1.9
+''', save=True)
+        out, err = self.run_bzr_subprocess('init')
+        self.assertContainsRe(out, '1.9')
+
 
 class TestSFTPInit(TestCaseWithSFTPServer):
 




More information about the bazaar-commits mailing list