/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: 2010-11-09 16:26:07 UTC
  • mto: This revision was merged to the branch mainline in revision 5544.
  • Revision ID: v.ladeuil+lp@free.fr-20101109162607-jzxc73qko3k6hwxe
``bzr config`` properly displays list values

Show diffs side-by-side

added added

removed removed

Lines of Context:
496
496
        config_id = self.config_id()
497
497
        for (section_name, section) in sections:
498
498
            for (name, value) in section.iteritems():
499
 
                yield (name, value, section_name, config_id)
 
499
                yield (name, parser._quote(value), section_name,
 
500
                       config_id, parser)
500
501
 
501
502
    def _get_option_policy(self, section, option_name):
502
503
        """Return the policy for the given (section, option_name) pair."""
1042
1043
        config_id = self.config_id()
1043
1044
        for (section_name, section) in sections:
1044
1045
            for (name, value) in section.iteritems():
1045
 
                yield (name, value, section_name, config_id)
 
1046
                yield (name, value, section_name,
 
1047
                       config_id, branch_config._get_parser())
1046
1048
        # Then the global options
1047
1049
        for option in self._get_global_config()._get_options():
1048
1050
            yield option
1862
1864
        for c in self._get_configs(directory, scope):
1863
1865
            if displayed:
1864
1866
                break
1865
 
            for (oname, value, section, conf_id) in c._get_options():
 
1867
            for (oname, value, section, conf_id, parser) in c._get_options():
1866
1868
                if name == oname:
1867
1869
                    # Display only the first value and exit (We need to use
1868
1870
                    # get_user_option to take policies into account and we need
1869
1871
                    # to make sure the option exists too :-/)
1870
 
                    self.outf.write('%s\n' % c.get_user_option(name))
 
1872
                    value = c.get_user_option(name)
 
1873
                    # Quote the value appropriately
 
1874
                    value = parser._quote(value)
 
1875
                    self.outf.write('%s\n' % (value,))
1871
1876
                    displayed = True
1872
1877
                    break
1873
1878
        if not displayed:
1881
1886
        cur_conf_id = None
1882
1887
        cur_section = None
1883
1888
        for c in self._get_configs(directory, scope):
1884
 
            for (oname, value, section, conf_id) in c._get_options():
 
1889
            for (oname, value, section, conf_id, parser) in c._get_options():
1885
1890
                if name.search(oname):
1886
1891
                    if cur_conf_id != conf_id:
1887
1892
                        # Explain where the options are defined
1892
1897
                        and cur_section != section):
1893
1898
                        # Display the section if it's not the default (or only)
1894
1899
                        # one.
1895
 
                        self.outf.write('  [%s]\n' % section)
 
1900
                        self.outf.write('  [%s]\n' % (section,))
1896
1901
                        cur_section = section
1897
1902
                    self.outf.write('  %s = %s\n' % (oname, value))
1898
1903