[merge] allow setting debug_flags in ~/.bazaar/bazaar.conf
John Arbash Meinel
john at arbash-meinel.com
Fri Mar 6 05:11:22 GMT 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Pool wrote:
> This lets you put lines like this in ~/.bazaar/bazaar.conf
>
> debug_flags = hpss
>
> and then you'll always get a trace of bzr+ network operations in ~/.bzr.log.
>
> It also removes the suggestion "(and try -Dhpss if further diagnosis
> is required)") which has caused some confusion when people's actual
> problem is that the server's unreachable or something.
>
>
BB:tweak
+ def try_debug_flags(self, conf_file, expected_flags):
+ t = get_transport(os.environ['HOME'])
+ t.put_bytes(".bazaar/bazaar.conf", conf_file)
+ saved_debug = set(debug.debug_flags)
+ try:
+ debug.set_debug_flags_from_config()
+ self.assertEqual(expected_flags,
+ debug.debug_flags)
+ finally:
+ # restore without rebinding the variable
+ debug.debug_flags.clear()
+ debug.debug_flags.update(saved_debug)
If you feel like you need to trap the 'saved_debug' that also means that
you need to clear the debug flags before calling
'debug.set_debug_flags_from_config()'.
So:
+ saved_debug = set(debug.debug_flags)
+ try:
debug.debug_flags.clear()
+ debug.set_debug_flags_from_config()
+ self.assertEqual(expected_flags,
+ debug.debug_flags)
+ finally:
+ # restore without rebinding the variable
+ debug.debug_flags.clear()
+ debug.debug_flags.update(saved_debug)
I also think this test might fail on Windows. It may be better to use
bzrlib.config.config_dir()
I'm pretty sure it does the right thing with the test suite.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkmwsHoACgkQJdeBCYSNAANN0ACeNDKp6UQNdnwNjPDaYzxQ8xIo
VpkAn0GY3lat7RcQc8KK/21QtPyXRDuZ
=tgJ8
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list