~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

(jelmer) Switch the commit code over to use config stacks. (Bazaar
 Developers)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3711
3711
            if directory is None:
3712
3712
                # use branch if we're inside one; otherwise global config
3713
3713
                try:
3714
 
                    c = Branch.open_containing(u'.')[0].get_config()
 
3714
                    c = Branch.open_containing(u'.')[0].get_config_stack()
3715
3715
                except errors.NotBranchError:
3716
 
                    c = _mod_config.GlobalConfig()
 
3716
                    c = _mod_config.GlobalStack()
3717
3717
            else:
3718
 
                c = Branch.open(directory).get_config()
 
3718
                c = Branch.open(directory).get_config_stack()
 
3719
            identity = c.get('email')
3719
3720
            if email:
3720
 
                self.outf.write(c.user_email() + '\n')
 
3721
                self.outf.write(_mod_config.extract_email_address(identity)
 
3722
                                + '\n')
3721
3723
            else:
3722
 
                self.outf.write(c.username() + '\n')
 
3724
                self.outf.write(identity + '\n')
3723
3725
            return
3724
3726
 
3725
3727
        if email:
3736
3738
        # use global config unless --branch given
3737
3739
        if branch:
3738
3740
            if directory is None:
3739
 
                c = Branch.open_containing(u'.')[0].get_config()
 
3741
                c = Branch.open_containing(u'.')[0].get_config_stack()
3740
3742
            else:
3741
 
                c = Branch.open(directory).get_config()
 
3743
                c = Branch.open(directory).get_config_stack()
3742
3744
        else:
3743
 
            c = _mod_config.GlobalConfig()
3744
 
        c.set_user_option('email', name)
 
3745
            c = _mod_config.GlobalStack()
 
3746
        c.set('email', name)
3745
3747
 
3746
3748
 
3747
3749
class cmd_nick(Command):
5055
5057
 
5056
5058
    def _run(self, b, revision_id_list, revision):
5057
5059
        import bzrlib.gpg as gpg
5058
 
        gpg_strategy = gpg.GPGStrategy(b.get_config())
 
5060
        gpg_strategy = gpg.GPGStrategy(b.get_config_stack())
5059
5061
        if revision_id_list is not None:
5060
5062
            b.repository.start_write_group()
5061
5063
            try: