~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-02-23 17:00:36 UTC
  • mfrom: (4032.1.4 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090223170036-3q1v68ewdt8i0to5
(Marius Kruger) Remove all trailing whitespace and add tests to
        enforce this.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
[/home/robertc/source]
38
38
recurse=False|True(default)
39
39
email= as above
40
 
check_signatures= as above 
 
40
check_signatures= as above
41
41
create_signatures= as above.
42
42
 
43
43
explanation of options
45
45
editor - this option sets the pop up editor to use during commits.
46
46
email - this option sets the user id bzr will use when committing.
47
47
check_signatures - this option controls whether bzr will require good gpg
48
 
                   signatures, ignore them, or check them if they are 
 
48
                   signatures, ignore them, or check them if they are
49
49
                   present.
50
 
create_signatures - this option controls whether bzr will always create 
 
50
create_signatures - this option controls whether bzr will always create
51
51
                    gpg signatures, never create them, or create them if the
52
52
                    branch is configured to require them.
53
53
log_format - this option sets the default log format.  Possible values are
216
216
 
217
217
    def username(self):
218
218
        """Return email-style username.
219
 
    
 
219
 
220
220
        Something similar to 'Martin Pool <mbp@sourcefrog.net>'
221
 
        
 
221
 
222
222
        $BZR_EMAIL can be set to override this (as well as the
223
223
        deprecated $BZREMAIL), then
224
224
        the concrete policy type is checked, and finally
225
225
        $EMAIL is examined.
226
226
        If none is found, a reasonable default is (hopefully)
227
227
        created.
228
 
    
 
228
 
229
229
        TODO: Check it's reasonably well-formed.
230
230
        """
231
231
        v = os.environ.get('BZR_EMAIL')
385
385
        super(IniBasedConfig, self).__init__()
386
386
        self._get_filename = get_filename
387
387
        self._parser = None
388
 
        
 
388
 
389
389
    def _post_commit(self):
390
390
        """See Config.post_commit."""
391
391
        return self._get_user_option('post_commit')
414
414
 
415
415
    def _get_alias(self, value):
416
416
        try:
417
 
            return self._get_parser().get_value("ALIASES", 
 
417
            return self._get_parser().get_value("ALIASES",
418
418
                                                value)
419
419
        except KeyError:
420
420
            pass
642
642
 
643
643
    def _get_safe_value(self, option_name):
644
644
        """This variant of get_best_value never returns untrusted values.
645
 
        
 
645
 
646
646
        It does not return values from the branch data, because the branch may
647
647
        not be controlled by the user.
648
648
 
657
657
 
658
658
    def _get_user_id(self):
659
659
        """Return the full user id for the branch.
660
 
    
 
660
 
661
661
        e.g. "John Hacker <jhacker@example.com>"
662
662
        This is looked up in the email controlfile for the branch.
663
663
        """
667
667
                    .rstrip("\r\n"))
668
668
        except errors.NoSuchFile, e:
669
669
            pass
670
 
        
 
670
 
671
671
        return self._get_best_value('_get_user_id')
672
672
 
673
673
    def _get_signature_checking(self):
713
713
    def _gpg_signing_command(self):
714
714
        """See Config.gpg_signing_command."""
715
715
        return self._get_safe_value('_gpg_signing_command')
716
 
        
 
716
 
717
717
    def __init__(self, branch):
718
718
        super(BranchConfig, self).__init__()
719
719
        self._location_config = None
720
720
        self._branch_data_config = None
721
721
        self._global_config = None
722
722
        self.branch = branch
723
 
        self.option_sources = (self._get_location_config, 
 
723
        self.option_sources = (self._get_location_config,
724
724
                               self._get_branch_data_config,
725
725
                               self._get_global_config)
726
726
 
768
768
    """Return per-user configuration directory.
769
769
 
770
770
    By default this is ~/.bazaar/
771
 
    
 
771
 
772
772
    TODO: Global option --config-dir to override this.
773
773
    """
774
774
    base = os.environ.get('BZR_HOME', None)
898
898
def extract_email_address(e):
899
899
    """Return just the address part of an email string.
900
900
 
901
 
    That is just the user@domain part, nothing else. 
 
901
    That is just the user@domain part, nothing else.
902
902
    This part is required to contain only ascii characters.
903
903
    If it can't be extracted, raises an error.
904
904
 
918
918
 
919
919
    def __init__(self, branch):
920
920
        # XXX: Really this should be asking the branch for its configuration
921
 
        # data, rather than relying on a Transport, so that it can work 
 
921
        # data, rather than relying on a Transport, so that it can work
922
922
        # more cleanly with a RemoteBranch that has no transport.
923
923
        self._config = TransportConfig(branch._transport, 'branch.conf')
924
924
        self.branch = branch