Rev 5481: Merge lp:~nmb/bzr/484101-default-format fixing NEWS and removing useless code in test in http://bazaar.launchpad.net/~vila/bzr/integration/

Vincent Ladeuil v.ladeuil+lp at free.fr
Mon Oct 11 14:25:41 BST 2010


At http://bazaar.launchpad.net/~vila/bzr/integration/

------------------------------------------------------------
revno: 5481 [merge]
revision-id: v.ladeuil+lp at free.fr-20101011132540-2peqjb1om2be0qhi
parent: v.ladeuil+lp at free.fr-20101011121712-dzbqlqqd83cmxwc5
parent: nmb at wartburg.edu-20100929053526-wq1ts0f3m7vqua60
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: trunk
timestamp: Mon 2010-10-11 15:25:40 +0200
message:
  Merge lp:~nmb/bzr/484101-default-format fixing NEWS and removing useless code in test
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
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2010-10-11 12:17:12 +0000
+++ b/NEWS	2010-10-11 13:25:40 +0000
@@ -23,6 +23,10 @@
   for project ``foo`` in Debian Lenny.
   (Barry Warsaw, #609186)
 
+* Provide a configuration option "default_format" that controls the
+  default format for new branches created with ``bzr init``.
+  (Neil Martinsen-Burrell, #484101)
+
 Bug Fixes
 *********
 

=== 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 13:25:40 +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