/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Vincent Ladeuil
  • Date: 2007-10-18 10:33:11 UTC
  • mto: (2961.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 2962.
  • Revision ID: v.ladeuil+lp@free.fr-20071018103311-ysh1obz1wo75lzx0
Add -Dauth handling.

* doc/developers/authentication-ring.txt:
(Use Cases): Add sub-domains example.

* bzrlib/help_topics.py:
(_global_options): Add auth.

* bzrlib/debug.py: 
Add 'auth'. Fix alphabetical order.

* bzrlib/config.py: 
Fix imports.
(AuthenticationConfig.get_credentials): Report the matching
section if -Dauth is used.

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
 
75
75
import bzrlib
76
76
from bzrlib import (
 
77
    debug,
77
78
    errors,
78
79
    mail_client,
79
80
    osutils,
85
86
import bzrlib.util.configobj.configobj as configobj
86
87
""")
87
88
 
88
 
from bzrlib.trace import mutter, warning
89
 
 
90
89
 
91
90
CHECK_IF_POSSIBLE=0
92
91
CHECK_ALWAYS=1
238
237
            return v.decode(bzrlib.user_encoding)
239
238
        v = os.environ.get('BZREMAIL')
240
239
        if v:
241
 
            warning('BZREMAIL is deprecated in favor of BZR_EMAIL. Please update your configuration.')
 
240
            trace.warning('BZREMAIL is deprecated in favor of BZR_EMAIL.'
 
241
                          ' Please update your configuration.')
242
242
            return v.decode(bzrlib.user_encoding)
243
 
    
 
243
 
244
244
        v = self._get_user_id()
245
245
        if v:
246
246
            return v
247
 
        
 
247
 
248
248
        v = os.environ.get('EMAIL')
249
249
        if v:
250
250
            return v.decode(bzrlib.user_encoding)
275
275
        if policy is None:
276
276
            policy = self._get_signature_checking()
277
277
            if policy is not None:
278
 
                warning("Please use create_signatures, not check_signatures "
279
 
                        "to set signing policy.")
 
278
                trace.warning("Please use create_signatures,"
 
279
                              " not check_signatures to set signing policy.")
280
280
            if policy == CHECK_ALWAYS:
281
281
                return True
282
282
        elif policy == SIGN_ALWAYS:
463
463
        if (not os.path.exists(name_generator()) and 
464
464
                os.path.exists(branches_config_filename())):
465
465
            if sys.platform == 'win32':
466
 
                warning('Please rename %s to %s' 
467
 
                         % (branches_config_filename(),
468
 
                            locations_config_filename()))
 
466
                trace.warning('Please rename %s to %s' 
 
467
                              % (branches_config_filename(),
 
468
                                 locations_config_filename()))
469
469
            else:
470
 
                warning('Please rename ~/.bazaar/branches.conf'
471
 
                        ' to ~/.bazaar/locations.conf')
 
470
                trace.warning('Please rename ~/.bazaar/branches.conf'
 
471
                              ' to ~/.bazaar/locations.conf')
472
472
            name_generator = branches_config_filename
473
473
        super(LocationConfig, self).__init__(name_generator)
474
474
        # local file locations are looked up by local path, rather than
743
743
        if sys.platform == 'win32':
744
744
            parent_dir = os.path.dirname(path)
745
745
            if not os.path.isdir(parent_dir):
746
 
                mutter('creating config parent directory: %r', parent_dir)
 
746
                trace.mutter('creating config parent directory: %r', parent_dir)
747
747
            os.mkdir(parent_dir)
748
 
        mutter('creating config directory: %r', path)
 
748
        trace.mutter('creating config directory: %r', path)
749
749
        os.mkdir(path)
750
750
 
751
751
 
1036
1036
                continue
1037
1037
            if (a_user is not None and user is not None
1038
1038
                and a_user != user):
 
1039
                # Never contradict the caller about the user to be used
1039
1040
                continue
1040
1041
            user = a_user
1041
1042
            if user is None:
1048
1049
                           'user': user, 'password': password,
1049
1050
                           'verify_certificates': a_verify_certificates,
1050
1051
                           }
 
1052
            if 'auth' in debug.debug_flags:
 
1053
                trace.mutter("Using authentication section: %r", auth_def_name)
1051
1054
            break
1052
1055
 
1053
1056
        return credentials