Rev 4506: Use config.get_user_option_as_bool(). in file:///home/vila/src/bzr/experimental/bool-config-option/

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Jul 2 10:03:14 BST 2009


At file:///home/vila/src/bzr/experimental/bool-config-option/

------------------------------------------------------------
revno: 4506
revision-id: v.ladeuil+lp at free.fr-20090702090314-xzzq2108489y6l4g
parent: v.ladeuil+lp at free.fr-20090702085916-8mmk6twh14oeng5u
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: bool-config-option
timestamp: Thu 2009-07-02 11:03:14 +0200
message:
  Use config.get_user_option_as_bool().
-------------- next part --------------
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2009-07-01 19:06:14 +0000
+++ b/bzrlib/builtins.py	2009-07-02 09:03:14 +0000
@@ -1097,16 +1097,7 @@
         (tree, br_from,
          _unused) = bzrdir.BzrDir.open_containing_tree_or_branch(directory)
         if strict is None:
-            strict = br_from.get_config().get_user_option('push_strict')
-            if strict is not None:
-                # FIXME: This should be better supported by config
-                # -- vila 20090611
-                bools = dict(yes=True, no=False, on=True, off=False,
-                             true=True, false=False)
-                try:
-                    strict = bools[strict.lower()]
-                except KeyError:
-                    strict = None
+            strict = br_from.get_config().get_user_option_as_bool('push_strict')
         # Get the tip's revision_id
         revision = _get_one_revision('push', revision)
         if revision is not None:

=== modified file 'bzrlib/send.py'
--- a/bzrlib/send.py	2009-07-01 15:17:33 +0000
+++ b/bzrlib/send.py	2009-07-02 09:03:14 +0000
@@ -108,16 +108,8 @@
                 base_revision_id = revision[0].as_revision_id(branch)
         if revision_id is None:
             if strict is None:
-                strict = branch.get_config().get_user_option('send_strict')
-                if strict is not None:
-                    # FIXME: This should be better supported by config
-                    # -- vila 20090626
-                    bools = dict(yes=True, no=False, on=True, off=False,
-                                 true=True, false=False)
-                    try:
-                        strict = bools[strict.lower()]
-                    except KeyError:
-                        strict = None
+                strict = branch.get_config(
+                    ).get_user_option_as_bool('send_strict')
             if tree is not None and (strict is None or strict):
                 changes = tree.changes_from(tree.basis_tree())
                 if changes.has_changed() or len(tree.get_parent_ids()) > 1:



More information about the bazaar-commits mailing list