~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Robert Collins
  • Date: 2005-10-20 02:52:44 UTC
  • Revision ID: robertc@robertcollins.net-20051020025244-fa1017d19a0ef618
post commit hook, first pass implementation

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
    def __init__(self):
99
99
        super(Config, self).__init__()
100
100
 
 
101
    def post_commit(self):
 
102
        """An ordered list of python functions to call.
 
103
 
 
104
        Each function takes branch, rev_id as parameters.
 
105
        """
 
106
        return self._post_commit()
 
107
 
 
108
    def _post_commit(self):
 
109
        """See Config.post_commit."""
 
110
        return None
 
111
 
101
112
    def user_email(self):
102
113
        """Return just the email component of a username."""
103
114
        e = self.username()
196
207
 
197
208
    def _gpg_signing_command(self):
198
209
        """See Config.gpg_signing_command."""
199
 
        section = self._get_section()
200
 
        if section is not None:
201
 
            if self._get_parser().has_option(section, 'gpg_signing_command'):
202
 
                return self._get_parser().get(section, 'gpg_signing_command')
 
210
        return self._get_user_option('gpg_signing_command')
203
211
 
204
212
    def __init__(self, get_filename):
205
213
        super(IniBasedConfig, self).__init__()
206
214
        self._get_filename = get_filename
207
215
        self._parser = None
 
216
        
 
217
    def _post_commit(self):
 
218
        """See Config.post_commit."""
 
219
        return self._get_user_option('post_commit')
208
220
 
209
221
    def _string_to_signature_policy(self, signature_string):
210
222
        """Convert a string to a signing policy."""
309
321
            return check
310
322
        return self._get_global_config()._get_signature_checking()
311
323
 
 
324
    def _post_commit(self):
 
325
        """See Config.post_commit."""
 
326
        hook = self._get_user_option('post_commit')
 
327
        if hook is not None:
 
328
            return hook
 
329
        return self._get_global_config()._post_commit()
 
330
 
312
331
 
313
332
class BranchConfig(Config):
314
333
    """A configuration object giving the policy for a branch."""
351
370
        self._location_config = None
352
371
        self.branch = branch
353
372
 
 
373
    def _post_commit(self):
 
374
        """See Config.post_commit."""
 
375
        return self._get_location_config()._post_commit()
 
376
 
354
377
 
355
378
def config_dir():
356
379
    """Return per-user configuration directory.