[MERGE] Harmonize branch.conf with locations.conf and bazaar.conf

Aaron Bentley aaron.bentley at utoronto.ca
Wed Jun 21 18:05:26 BST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Arbash Meinel wrote:

> So, I've seen the pattern:
> 
> 	config = bzrlib.config.BranchConfig(self)
> and
> 	config = bzrlib.config.BranchConfig(branch)
> an awful lot.
> It seems like it would be better to refactor these calls into:
> 
> config = branch.get_config()

Okay.

> Is this the test where you are testing that if the signature rules are
> set in 'branch.conf' it doesn't get used?

When I referred to 'security-sensitive' options, I meant things that
could cause security holes on the user's machine, like
'gpg-signing-command' and 'post-commit'.

I actually think it's a good idea to allow signing policy to be set by
remote branches, so that e.g. bzr.dev can enable signing, causing
commits against it or branches of it to be signed by default.

>      def test_signatures_forced(self):
> -        branch = FakeBranch()
> -        my_config = config.BranchConfig(branch)
> -        config_file = StringIO(sample_always_signatures)
> -        (my_config._get_location_config().
> -            _get_global_config()._get_parser(config_file))
> +        my_config = self.get_branch_config(
> +            global_config=sample_always_signatures)
> +        self.assertEqual(config.CHECK_NEVER,
> my_config.signature_checking())
> +        self.assertEqual(config.SIGN_ALWAYS, my_config.signing_policy())
> +        self.assertTrue(my_config.signature_needed())

Here, I'm testing to make sure that a branch *can* set the signing policy.

> +    def test_signatures_forced_branch(self):
> +        my_config = self.get_branch_config(
> +            global_config=sample_ignore_signatures,
> +            branch_data_config=sample_always_signatures)
>          self.assertEqual(config.CHECK_NEVER,
> my_config.signature_checking())
>          self.assertEqual(config.SIGN_ALWAYS, my_config.signing_policy())
>          self.assertTrue(my_config.signature_needed())
> @@ -650,30 +706,30 @@
>          branch = FakeBranch()
>          my_config = config.BranchConfig(branch)
>          config_file = StringIO(sample_config_text.encode('utf-8'))
> -        (my_config._get_location_config().
> -            _get_global_config()._get_parser(config_file))
> +        my_config._get_global_config()._get_parser(config_file)
>          self.assertEqual('gnome-gpg', my_config.gpg_signing_command())
> 
> 
> I didn't see a clear test that makes sure about bazaar.conf vs
> branch.conf vs locations.conf, but in general things looked okay. The
> tests just seem a little bit difficult to read.

There's a bit here and there, but perhaps an explicit test of layering
wouldn't hurt.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEmXxW0F+nu1YWqI0RAgnlAJ0Tind3ZPIm1FFq0k4yVp8E1zkBCACfRMAX
K7zCPNC/5omqRGmBRw7vtow=
=SvxT
-----END PGP SIGNATURE-----




More information about the bazaar mailing list