From 38352735c31f53e72c4d13e6a737a545ad9c571a Mon Sep 17 00:00:00 2001 From: "Trent Robbins (aider)" Date: Sun, 27 Apr 2025 12:23:15 -0700 Subject: [PATCH] feat: Allow --install-main-branch to accept a git URL --- aider/main.py | 6 +++++- aider/versioncheck.py | 12 +++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/aider/main.py b/aider/main.py index 89286e1de..51a565b55 100644 --- a/aider/main.py +++ b/aider/main.py @@ -712,8 +712,12 @@ 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: - success = install_from_main_branch(io) + if isinstance(args.install_main_branch, str): + success = install_from_main_branch(io, remote_url=args.install_main_branch) + else: # True, meaning the flag was used without a URL + success = install_from_main_branch(io) analytics.event("exit", reason="Installed main branch") return 0 if success else 1 diff --git a/aider/versioncheck.py b/aider/versioncheck.py index ac511a022..ad67a3d6a 100644 --- a/aider/versioncheck.py +++ b/aider/versioncheck.py @@ -12,16 +12,22 @@ from aider.dump import dump # noqa: F401 VERSION_CHECK_FNAME = Path.home() / ".aider" / "caches" / "versioncheck" -def install_from_main_branch(io): +def install_from_main_branch(io, remote_url=None): """ Install the latest version of aider from the main branch of the GitHub repository. """ + if remote_url is None: + remote_url = "git+https://github.com/Aider-AI/aider.git" + source_description = "the main branch" + else: + source_description = remote_url + return utils.check_pip_install_extra( io, None, - "Install the development version of aider from the main branch?", - ["git+https://github.com/Aider-AI/aider.git"], + f"Install the development version of aider from {source_description}?", + [remote_url], self_update=True, )