~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Robert Collins
  • Date: 2005-10-17 11:41:07 UTC
  • mfrom: (1442.1.60)
  • Revision ID: robertc@robertcollins.net-20051017114107-f5586285d825c105
Merge in first part of GPG support.

This adds check_signatures config support, triams back the transport api
to be leaner and easier to hook in suffixes - non primary streams in the store
associated with the fileid that primary data is stored in, a gpg module which
will encapsulate all signing and checking operations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
email=Your Name <your@email.address>
27
27
check_signatures=require|ignore|check-available(default)
28
28
create_signatures=always|never|when-required(default)
 
29
gpg_signing_command=name-of-program
29
30
 
30
31
in branches.conf, you specify the url of a branch and options for it.
31
32
Wildcards may be used - * and ? as normal in shell completion. Options
75
76
    def _get_signature_checking(self):
76
77
        """Template method to override signature checking policy."""
77
78
 
 
79
    def gpg_signing_command(self):
 
80
        """What program should be used to sign signatures?"""
 
81
        result = self._gpg_signing_command()
 
82
        if result is None:
 
83
            result = "gpg"
 
84
        return result
 
85
 
 
86
    def _gpg_signing_command(self):
 
87
        """See gpg_signing_command()."""
 
88
        return None
 
89
 
78
90
    def __init__(self):
79
91
        super(Config, self).__init__()
80
92
 
167
179
            if self._get_parser().has_option(section, 'email'):
168
180
                return self._get_parser().get(section, 'email')
169
181
 
 
182
    def _gpg_signing_command(self):
 
183
        """See Config.gpg_signing_command."""
 
184
        section = self._get_section()
 
185
        if section is not None:
 
186
            if self._get_parser().has_option(section, 'gpg_signing_command'):
 
187
                return self._get_parser().get(section, 'gpg_signing_command')
 
188
 
170
189
    def __init__(self, get_filename):
171
190
        super(IniBasedConfig, self).__init__()
172
191
        self._get_filename = get_filename
247
266
        matches.sort(reverse=True)
248
267
        return matches[0][1]
249
268
 
 
269
    def _gpg_signing_command(self):
 
270
        """See Config.gpg_signing_command."""
 
271
        command = super(LocationConfig, self)._gpg_signing_command()
 
272
        if command is not None:
 
273
            return command
 
274
        return self._get_global_config()._gpg_signing_command()
 
275
 
250
276
    def _get_user_id(self):
251
277
        user_id = super(LocationConfig, self)._get_user_id()
252
278
        if user_id is not None:
289
315
        """See Config._get_signature_checking."""
290
316
        return self._get_location_config()._get_signature_checking()
291
317
 
 
318
    def _gpg_signing_command(self):
 
319
        """See Config.gpg_signing_command."""
 
320
        return self._get_location_config()._gpg_signing_command()
 
321
        
292
322
    def __init__(self, branch):
293
323
        super(BranchConfig, self).__init__()
294
324
        self._location_config = None