lllyasviel / stable-diffusion-webui-forge

GNU Affero General Public License v3.0
8.29k stars 808 forks source link

[feature] menu improvements [select specific version] #1216

Open Tom-Neverwinter opened 2 months ago

Tom-Neverwinter commented 2 months ago

I made a change to the run.bat in the one click installer so people can change versions and get around the latest update issues

just replace the contents of run.bat and you can then delete the update.bat file if you want.

@echo off
call environment.bat

:menu
cls
echo Current commit:
git -C "%~dp0webui" rev-parse --short HEAD
echo Last commit message:
git -C "%~dp0webui" log -1 --pretty=%%B

echo.
echo Choose an option:
echo 1. Run webui
echo 2. Update to latest version
echo 3. Checkout specific commit
echo 4. Apply pull request

set choice=
set /p choice=Enter your choice (1-4) or just hit enter for default (Run webui): 

if "%choice%"=="" set choice=1
if "%choice%"=="1" goto run_webui
if "%choice%"=="2" goto latest
if "%choice%"=="3" goto version
if "%choice%"=="4" goto pullrequest
echo Invalid choice. Please try again.
pause
goto menu

:latest
git -C "%~dp0webui" pull 2>NUL
if %ERRORLEVEL% == 0 (
    echo Update successful.
) else (
    git -C "%~dp0webui" reset --hard
    git -C "%~dp0webui" pull
    echo Update complete after reset.
)
pause
goto menu

:version
git -C "%~dp0webui" log --oneline -n 10
echo.
set /p commit=Enter the commit hash to checkout (or 'q' to cancel): 
if "%commit%"=="q" goto menu
git -C "%~dp0webui" checkout %commit%
if %ERRORLEVEL% == 0 (
    echo Checkout complete.
) else (
    echo Checkout failed. Please check the commit hash and try again.
)
pause
goto menu

:pullrequest
set /p pr=Enter the pull request number: 
git -C "%~dp0webui" fetch origin pull/%pr%/head:pr-%pr%
git -C "%~dp0webui" checkout pr-%pr%
if %ERRORLEVEL% == 0 (
    echo Pull request applied.
) else (
    echo Failed to apply pull request. Please check the PR number and try again.
)
pause
goto menu

:run_webui
cd "%~dp0webui"
call webui-user.bat
goto end

:end
pause

quick edit to change from tags to commits as tags are sparse in this project

could use more information like the silly tavern one has https://github.com/SillyTavern/SillyTavern-Launcher

queenofinvidia commented 2 months ago

this looks helpful, I'll try this out later, thank you for making this!

queenofinvidia commented 2 months ago

I really like this, but which one would I use if I want to go back to a version before all the Flux stuff came out?

sorry I'm not savvy with this kind of thing lol

these are the options i have:

Choose an option:
1. Run webui
2. Update to latest version
3. Checkout specific commit
4. Apply pull request
Enter your choice (1-4) or just hit enter for default (Run webui): 3
error: cannot spawn less: No such file or directory
93bfd7f8 (HEAD -> main, origin/main, origin/HEAD) invalidate cond cache if distilled CFG changed (#1240)
0f266c48 make clear_prompt_cache a function
4bb56139 remove space path after invoke
fcf71fd9 fix space logics
7df7ea3d fix birefnet commit
93b40f35 Forge Space and BiRefNet
8a042934 fix some gguf loras
ab4b0d5b fix some mem leak
3da7de41 fix layerdiffuse
9973d5dc better prints
Tom-Neverwinter commented 2 months ago

I really like this, but which one would I use if I want to go back to a version before all the Flux stuff came out?

sorry I'm not savvy with this kind of thing lol

these are the options i have:

Choose an option:
1. Run webui
2. Update to latest version
3. Checkout specific commit
4. Apply pull request
Enter your choice (1-4) or just hit enter for default (Run webui): 3
error: cannot spawn less: No such file or directory
93bfd7f8 (HEAD -> main, origin/main, origin/HEAD) invalidate cond cache if distilled CFG changed (#1240)
0f266c48 make clear_prompt_cache a function
4bb56139 remove space path after invoke
fcf71fd9 fix space logics
7df7ea3d fix birefnet commit
93b40f35 Forge Space and BiRefNet
8a042934 fix some gguf loras
ab4b0d5b fix some mem leak
3da7de41 fix layerdiffuse
9973d5dc better prints

option 3: 394da01959ae09acca361dc2be0e559ca26829d4