refactor: rename install_main_branch to install_branch

This commit is contained in:
Trent Robbins (aider) 2025-04-27 12:53:22 -07:00
parent 7b22f1d281
commit af53e8ce93
2 changed files with 12 additions and 11 deletions

View file

@ -33,7 +33,7 @@ from aider.models import ModelSettings
from aider.onboarding import offer_openrouter_oauth, select_default_model
from aider.repo import ANY_GIT_ERROR, GitRepo
from aider.report import report_uncaught_exceptions
from aider.versioncheck import check_version, install_from_main_branch, install_upgrade
from aider.versioncheck import check_version, install_from_git_branch, install_upgrade
from aider.watch import FileWatcher
from .dump import dump # noqa: F401
@ -712,13 +712,13 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
analytics.event("exit", reason="Just checking update")
return 0 if not update_available else 1
# Handle --install-main-branch [url]
if args.install_main_branch:
if isinstance(args.install_main_branch, str):
success = install_from_main_branch(io, remote_url=args.install_main_branch)
# Handle --install-branch [url]
if args.install_branch:
if isinstance(args.install_branch, str):
success = install_from_git_branch(io, remote_url=args.install_branch)
else: # True, meaning the flag was used without a URL
success = install_from_main_branch(io)
analytics.event("exit", reason="Installed main branch")
success = install_from_git_branch(io)
analytics.event("exit", reason="Installed git branch")
return 0 if success else 1
if args.upgrade:

View file

@ -12,14 +12,15 @@ from aider.dump import dump # noqa: F401
VERSION_CHECK_FNAME = Path.home() / ".aider" / "caches" / "versioncheck"
def install_from_main_branch(io, remote_url=None):
def install_from_git_branch(io, remote_url=None):
"""
Install the latest version of aider from the main branch of the GitHub repository.
Install the latest version of aider from the main branch of the GitHub repository
or a specified git remote URL.
"""
if remote_url is None:
remote_url = "git+https://github.com/Aider-AI/aider.git"
source_description = "the main branch"
remote_url = "git+https://github.com/Aider-AI/aider.git@main"
source_description = "the Aider-AI main branch"
else:
source_description = remote_url