diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2021-03-29 22:59:40 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2021-03-29 22:59:40 +0300 |
commit | 4ecbdf4eb51de238bb22a1b142213f701d4e1eef (patch) | |
tree | 4889e86a0471430e56755eb185604bae9530743e /cgitize | |
parent | move Config to config.py (diff) | |
download | cgitize-4ecbdf4eb51de238bb22a1b142213f701d4e1eef.tar.gz cgitize-4ecbdf4eb51de238bb22a1b142213f701d4e1eef.zip |
minor refactoring
Diffstat (limited to 'cgitize')
-rw-r--r-- | cgitize/cgit.py | 6 | ||||
-rw-r--r-- | cgitize/config.py | 4 | ||||
-rw-r--r-- | cgitize/main.py | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/cgitize/cgit.py b/cgitize/cgit.py index c0c979d..01713db 100644 --- a/cgitize/cgit.py +++ b/cgitize/cgit.py @@ -12,7 +12,7 @@ import shutil import stat from cgitize.git import Git -import cgitize.utils as utils +from cgitize.utils import chdir @contextmanager @@ -123,7 +123,7 @@ class Output: repo_dir = self.get_repo_dir(repo) if not os.path.isdir(repo_dir): return RepoVerdict.SHOULD_MIRROR - with utils.chdir(repo_dir): + with chdir(repo_dir): if not Git.check('rev-parse', '--is-inside-work-tree'): logging.warning('Not a repository, so going to mirror: %s', repo_dir) return RepoVerdict.SHOULD_MIRROR @@ -155,7 +155,7 @@ class Output: def update(self, repo): logging.info("Updating repository '%s'", repo.repo_id) repo_dir = self.get_repo_dir(repo) - with utils.chdir(repo_dir): + with chdir(repo_dir): with setup_git_auth(repo): if not Git.check('remote', 'update', '--prune'): return False diff --git a/cgitize/config.py b/cgitize/config.py index 1226382..84c7149 100644 --- a/cgitize/config.py +++ b/cgitize/config.py @@ -8,7 +8,7 @@ import importlib import os.path import sys -import cgitize.utils as utils +from cgitize.utils import chdir class Config: @@ -28,7 +28,7 @@ class Config: def _resolve_relative(self, path): if os.path.isabs(path): return path - with utils.chdir(os.path.dirname(self.path)): + with chdir(os.path.dirname(self.path)): path = os.path.abspath(path) return path diff --git a/cgitize/main.py b/cgitize/main.py index 02e11fb..c73fc6c 100644 --- a/cgitize/main.py +++ b/cgitize/main.py @@ -9,7 +9,7 @@ import sys from cgitize.config import Config from cgitize.cgit import CGit, Output -import cgitize.utils as utils +from cgitize.utils import setup_logging def parse_args(argv=None): @@ -26,7 +26,7 @@ def parse_args(argv=None): def main(args=None): - with utils.setup_logging(): + with setup_logging(): args = parse_args(args) config = Config.read(args.config) my_repos = config.import_my_repos() |