Initial attempt at git module
This commit is contained in:
parent
645d329321
commit
c4c696df5a
6 changed files with 269 additions and 6 deletions
|
@ -3,8 +3,11 @@ import sys
|
|||
from pathlib import Path
|
||||
from typing import List, Optional
|
||||
|
||||
from reviewllama.git_diff import analyze_git_repository
|
||||
|
||||
from .configs import OllamaConfig, ReviewConfig, create_config_from_vars
|
||||
from .logger import log_paths, log_review_start
|
||||
from .logger import (log_git_analysis_result, log_git_analysis_start,
|
||||
log_paths, log_review_start)
|
||||
|
||||
|
||||
def normalize_server_url(url: str) -> str:
|
||||
|
@ -62,6 +65,13 @@ Examples:
|
|||
help="Maximum number of retry attempts (default: %(default)s)",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--base-branch",
|
||||
dest="base_branch",
|
||||
default="master",
|
||||
help="Base branch to compare against (default: %(default)s)",
|
||||
)
|
||||
|
||||
return parser
|
||||
|
||||
|
||||
|
@ -81,6 +91,7 @@ def transform_namespace_to_config(namespace: argparse.Namespace) -> ReviewConfig
|
|||
server_url=normalize_server_url(namespace.server_url),
|
||||
timeout=namespace.timeout,
|
||||
max_retries=namespace.max_retries,
|
||||
base_branch=namespace.base_branch,
|
||||
)
|
||||
|
||||
|
||||
|
@ -97,6 +108,11 @@ def cli() -> None:
|
|||
# TODO: Pass config to review engine
|
||||
log_review_start(config)
|
||||
log_paths(config.paths)
|
||||
|
||||
for path in Paths:
|
||||
analysis = analyze_git_repository(path, config.base_branch)
|
||||
log_git_analysis_start(path, config.base_branch)
|
||||
log_git_analysis_result(analysis)
|
||||
except SystemExit:
|
||||
# argparse calls sys.exit on error, let it propagate
|
||||
raise
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue