/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: Robert Collins
  • Date: 2006-03-03 02:09:49 UTC
  • mto: (1594.2.4 integration)
  • mto: This revision was merged to the branch mainline in revision 1596.
  • Revision ID: robertc@robertcollins.net-20060303020949-0ddc6f33d0a43943
Smoke test for RevisionStore factories creating revision stores.

Show diffs side-by-side

added added

removed removed

Lines of Context:
217
217
        else:
218
218
            input = file
219
219
        try:
220
 
            self._parser = ConfigObj(input, encoding='utf-8')
 
220
            self._parser = ConfigObj(input)
221
221
        except configobj.ConfigObjError, e:
222
222
            raise errors.ParseConfigError(e.errors, e.config.filename)
223
223
        return self._parser
334
334
            # if path is longer, and recurse is not true, no match
335
335
            if len(section_names) < len(location_names):
336
336
                try:
337
 
                    if not self._get_parser()[section].as_bool('recurse'):
 
337
                    if not self._get_parser().get_bool(section, 'recurse'):
338
338
                        continue
339
339
                except KeyError:
340
340
                    pass
401
401
        elif location + '/' in self._get_parser():
402
402
            location = location + '/'
403
403
        self._get_parser()[location][option]=value
404
 
        self._get_parser().write(file(self._get_filename(), 'wb'))
 
404
        self._get_parser().write()
405
405
 
406
406
 
407
407
class BranchConfig(Config):
524
524
        import pwd
525
525
        uid = os.getuid()
526
526
        w = pwd.getpwuid(uid)
527
 
 
528
 
        try:
529
 
            gecos = w.pw_gecos.decode(bzrlib.user_encoding)
530
 
            username = w.pw_name.decode(bzrlib.user_encoding)
531
 
        except UnicodeDecodeError:
532
 
            # We're using pwd, therefore we're on Unix, so /etc/passwd is ok.
533
 
            raise errors.BzrError("Can't decode username in " \
534
 
                    "/etc/passwd as %s." % bzrlib.user_encoding)
535
 
 
 
527
        gecos = w.pw_gecos.decode(bzrlib.user_encoding)
 
528
        username = w.pw_name.decode(bzrlib.user_encoding)
536
529
        comma = gecos.find(',')
537
530
        if comma == -1:
538
531
            realname = gecos
543
536
 
544
537
    except ImportError:
545
538
        import getpass
546
 
        try:
547
 
            realname = username = getpass.getuser().decode(bzrlib.user_encoding)
548
 
        except UnicodeDecodeError:
549
 
            raise errors.BzrError("Can't decode username as %s." % \
550
 
                    bzrlib.user_encoding)
 
539
        realname = username = getpass.getuser().decode(bzrlib.user_encoding)
551
540
 
552
541
    return realname, (username + '@' + socket.gethostname())
553
542