def __init__(self, repo): self.repo = repo self.user = None self.user_config_path = os.path.expanduser('~/.gitconfig') self.user_config = IniParser(self.user_config_path) try: self.user_config.read() if repo.is_in_repo(): self.repo_config_path = os.path.join(repo.get_git_dir(), 'config') self.repo_config = IniParser(self.repo_config_path) self.repo_config.read() except IniParseError, inst: raise SettingsError(inst)
class Settings(object): _not_under_repo_error = _("Not under a repository") _missing_config_arg = _("Category and Name must be supplied") def __init__(self, repo): self.repo = repo self.user = None self.user_config_path = os.path.expanduser('~/.gitconfig') self.user_config = IniParser(self.user_config_path) try: self.user_config.read() if repo.is_in_repo(): self.repo_config_path = os.path.join(repo.get_git_dir(), 'config') self.repo_config = IniParser(self.repo_config_path) self.repo_config.read() except IniParseError, inst: raise SettingsError(inst) repo.set_settings(self)