From 38352735c31f53e72c4d13e6a737a545ad9c571a Mon Sep 17 00:00:00 2001 From: "Trent Robbins (aider)" Date: Sun, 27 Apr 2025 12:23:15 -0700 Subject: [PATCH 1/5] 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, ) From 7b22f1d281add1561c779fb6bcedea3a4b39a3be Mon Sep 17 00:00:00 2001 From: "Trent Robbins (aider)" Date: Sun, 27 Apr 2025 12:46:18 -0700 Subject: [PATCH 2/5] feat: Allow installing from specific git branches via --install-branch --- aider/args.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/aider/args.py b/aider/args.py index 6df19778b..6182a6110 100644 --- a/aider/args.py +++ b/aider/args.py @@ -564,9 +564,15 @@ def get_parser(default_config_files, git_root): default=None, ) group.add_argument( - "--install-main-branch", - action="store_true", - help="Install the latest version from the main branch", + "--install-branch", + nargs="?", + const=True, + metavar="GIT_URL", + help=( + "Install the latest version from a git branch. If GIT_URL is provided, installs from" + " that URL (e.g., git+https://github.com/user/aider.git@my-branch). If no URL is" + " provided, installs from the Aider-AI main branch." + ), default=False, ) group.add_argument( From af53e8ce931397eec57ce6018a9a750b95cedcb4 Mon Sep 17 00:00:00 2001 From: "Trent Robbins (aider)" Date: Sun, 27 Apr 2025 12:53:22 -0700 Subject: [PATCH 3/5] refactor: rename install_main_branch to install_branch --- aider/main.py | 14 +++++++------- aider/versioncheck.py | 9 +++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/aider/main.py b/aider/main.py index 51a565b55..5290d8f94 100644 --- a/aider/main.py +++ b/aider/main.py @@ -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: diff --git a/aider/versioncheck.py b/aider/versioncheck.py index ad67a3d6a..b350614f9 100644 --- a/aider/versioncheck.py +++ b/aider/versioncheck.py @@ -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 From ade0f9f918ec73cd827a5e33a6558d79a4bc4e88 Mon Sep 17 00:00:00 2001 From: "Trent Robbins (aider)" Date: Sun, 27 Apr 2025 15:36:36 -0700 Subject: [PATCH 4/5] docs: Update documentation for --install-branch option --- aider/website/docs/config/aider_conf.md | 4 ++-- aider/website/docs/config/options.md | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/aider/website/docs/config/aider_conf.md b/aider/website/docs/config/aider_conf.md index 40483ae4b..a95c8a9d0 100644 --- a/aider/website/docs/config/aider_conf.md +++ b/aider/website/docs/config/aider_conf.md @@ -358,8 +358,8 @@ cog.outl("```") ## Show release notes on first run of new version (default: None, ask user) #show-release-notes: xxx -## Install the latest version from the main branch -#install-main-branch: false +## Install the latest version from a git branch. If GIT_URL is provided, installs from that URL (e.g., git+https://github.com/user/aider.git@my-branch). If no URL is provided, installs from the Aider-AI main branch. +#install-branch: false ## Upgrade aider to the latest version from PyPI #upgrade: false diff --git a/aider/website/docs/config/options.md b/aider/website/docs/config/options.md index d07234921..50e37991f 100644 --- a/aider/website/docs/config/options.md +++ b/aider/website/docs/config/options.md @@ -65,7 +65,7 @@ usage: aider [-h] [--model] [--openai-api-key] [--anthropic-api-key] [--analytics | --no-analytics] [--analytics-log] [--analytics-disable] [--just-check-update] [--check-update | --no-check-update] - [--show-release-notes | --no-show-release-notes] + [--show-release-notes | --no-show-release-notes] [--install-branch] [--install-main-branch] [--upgrade] [--version] [--message] [--message-file] [--gui | --no-gui | --browser | --no-browser] @@ -559,10 +559,10 @@ Aliases: - `--show-release-notes` - `--no-show-release-notes` -### `--install-main-branch` -Install the latest version from the main branch +### `--install-branch [GIT_URL]` +Install the latest version from a git branch. If GIT_URL is provided, installs from that URL (e.g., git+https://github.com/user/aider.git@my-branch). If no URL is provided, installs from the Aider-AI main branch. Default: False -Environment variable: `AIDER_INSTALL_MAIN_BRANCH` +Environment variable: `AIDER_INSTALL_BRANCH` ### `--upgrade` Upgrade aider to the latest version from PyPI From a319fe735e1657fd648f8a9fa47e888dc2106438 Mon Sep 17 00:00:00 2001 From: "Trent Robbins (aider)" Date: Sun, 27 Apr 2025 15:40:20 -0700 Subject: [PATCH 5/5] docs: remove deprecated --install-main-branch option --- aider/website/docs/config/options.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aider/website/docs/config/options.md b/aider/website/docs/config/options.md index 50e37991f..4b68da141 100644 --- a/aider/website/docs/config/options.md +++ b/aider/website/docs/config/options.md @@ -65,8 +65,7 @@ usage: aider [-h] [--model] [--openai-api-key] [--anthropic-api-key] [--analytics | --no-analytics] [--analytics-log] [--analytics-disable] [--just-check-update] [--check-update | --no-check-update] - [--show-release-notes | --no-show-release-notes] [--install-branch] - [--install-main-branch] [--upgrade] [--version] + [--show-release-notes | --no-show-release-notes] [--install-branch] [--upgrade] [--version] [--message] [--message-file] [--gui | --no-gui | --browser | --no-browser] [--copy-paste | --no-copy-paste] [--apply]