@echo off rem Sincronizeaza romfast cu upstream. Fara /push: doar local. Cu /push: trimite pe Gitea. rem Se auto-copiaza in TEMP si ruleaza de acolo, ca sa nu dispara de pe disc rem cand scriptul face "git checkout master" (fisierul exista doar pe romfast). setlocal enabledelayedexpansion if not "%SYNC_ROMFAST_RELAUNCHED%"=="1" ( set "SYNC_ROMFAST_ORIGDIR=%~dp0" set "SYNC_ROMFAST_RELAUNCHED=1" set "SYNC_ROMFAST_TMPBAT=!TEMP!\sync_romfast_!RANDOM!.bat" copy /y "%~f0" "!SYNC_ROMFAST_TMPBAT!" >nul call "!SYNC_ROMFAST_TMPBAT!" %* set "SYNC_ROMFAST_EC=!ERRORLEVEL!" del "!SYNC_ROMFAST_TMPBAT!" >nul 2>&1 exit /b !SYNC_ROMFAST_EC! ) cd /d "%SYNC_ROMFAST_ORIGDIR%" for /f "delims=" %%u in ('git remote get-url origin') do set GITHUB=%%u for /f "delims=" %%u in ('git remote get-url romfast') do set GITEA=%%u set STASHED=0 set DIRTY= for /f "delims=" %%s in ('git status --porcelain') do set DIRTY=1 if defined DIRTY ( echo Ai modificari necomise: git status -s set /p ANSWER="Ce fac cu ele? (c = commit, s = stash, n = opresc) [c/s/n] " if /i "!ANSWER!"=="s" ( git stash push -u -m "sync_romfast auto-stash" -- . ":(exclude)sync_romfast.bat" ":(exclude)sync_romfast.ps1" || exit /b 1 set STASHED=1 ) else if /i "!ANSWER!"=="c" ( set /p MSG="Mesaj de commit (Enter = mesaj implicit): " if "!MSG!"=="" set MSG=Actualizari locale inainte de sincronizare git add -A git commit -m "!MSG!" ) else ( echo Oprit. Comite sau fa stash manual, apoi ruleaza din nou scriptul. exit /b 1 ) ) echo GitHub (origin) %GITHUB% --^> master echo Gitea (romfast) %GITEA% --^> romfast git fetch origin || exit /b 1 git checkout master || exit /b 1 git merge --ff-only origin/master || (echo master a divergat de origin/master, verifica manual. & exit /b 1) git checkout romfast || exit /b 1 git merge master || (echo Conflicte la merge master -^> romfast, rezolva manual ^(git status^). & exit /b 1) git log --oneline -5 if "%STASHED%"=="1" ( echo Restaurez modificarile din stash... git stash pop || (echo Conflicte la restaurarea stash-ului, rezolva manual ^(git stash list / git stash pop^). & exit /b 1) ) set DOPUSH=0 if /i "%~1"=="/push" set DOPUSH=1 if "%DOPUSH%"=="0" ( set /p ANSWER="Local la zi. Fac push acum catre Gitea (romfast)? (y/n) " if /i "!ANSWER!"=="y" set DOPUSH=1 ) if "%DOPUSH%"=="1" ( git push romfast master || exit /b 1 git push romfast romfast || exit /b 1 echo Push facut catre %GITEA% ) else ( echo Push sarit. Inainte de push: DO ReCreate_FoxBin2Prg.prg in VFP9, apoi ruleaza cu /push. )