99 lines
3.7 KiB
Batchfile
99 lines
3.7 KiB
Batchfile
@echo off
|
|
setlocal enabledelayedexpansion
|
|
|
|
REM Script to switch between Fideuram (fid) and Armundia (arm) Git environments
|
|
REM This script compresses the current .git folder and extracts the other one
|
|
|
|
echo Switching Git environment...
|
|
|
|
REM Check if .git folder exists
|
|
if exist ".git" (
|
|
REM Determine which environment to switch to
|
|
if exist "fid-git.zip" (
|
|
REM Current environment is Armundia, switch to Fideuram
|
|
echo Current environment: Armundia
|
|
echo Switching to Fideuram environment...
|
|
|
|
REM Compress Armundia .git folder
|
|
echo Compressing Armundia .git folder...
|
|
powershell -command "Compress-Archive -Path '.git' -DestinationPath 'arm-git.zip' -Force"
|
|
|
|
REM Remove current .git folder
|
|
echo Removing current .git folder...
|
|
rmdir /s /q .git
|
|
|
|
REM Extract Fideuram .git folder
|
|
echo Extracting Fideuram .git folder...
|
|
powershell -command "Expand-Archive -Path 'fid-git.zip' -DestinationPath '.' -Force"
|
|
|
|
REM Delete the zip file after extraction
|
|
echo Removing the Fideuram zip file...
|
|
del /f /q fid-git.zip
|
|
|
|
echo Successfully switched to Fideuram environment.
|
|
) else if exist "arm-git.zip" (
|
|
REM Current environment is Fideuram, switch to Armundia
|
|
echo Current environment: Fideuram
|
|
echo Switching to Armundia environment...
|
|
|
|
REM Compress Fideuram .git folder
|
|
echo Compressing Fideuram .git folder...
|
|
powershell -command "Compress-Archive -Path '.git' -DestinationPath 'fid-git.zip' -Force"
|
|
|
|
REM Remove current .git folder
|
|
echo Removing current .git folder...
|
|
rmdir /s /q .git
|
|
|
|
REM Extract Armundia .git folder
|
|
echo Extracting Armundia .git folder...
|
|
powershell -command "Expand-Archive -Path 'arm-git.zip' -DestinationPath '.' -Force"
|
|
|
|
REM Delete the zip file after extraction
|
|
echo Removing the Armundia zip file...
|
|
del /f /q arm-git.zip
|
|
|
|
echo Successfully switched to Armundia environment.
|
|
) else (
|
|
REM First run - no compressed Git folders exist yet
|
|
echo This appears to be the first run.
|
|
echo Current .git folder will be considered as Fideuram environment.
|
|
|
|
REM Compress current .git as Fideuram
|
|
echo Compressing current .git folder as Fideuram...
|
|
powershell -command "Compress-Archive -Path '.git' -DestinationPath 'fid-git.zip' -Force"
|
|
|
|
echo Please initialize the Armundia Git repository and run this script again.
|
|
echo You can initialize a new Git repository with: git init
|
|
)
|
|
) else (
|
|
REM No .git folder exists
|
|
if exist "fid-git.zip" (
|
|
REM Extract Fideuram .git folder
|
|
echo No .git folder found. Extracting Fideuram environment...
|
|
powershell -command "Expand-Archive -Path 'fid-git.zip' -DestinationPath '.' -Force"
|
|
|
|
REM Delete the zip file after extraction
|
|
echo Removing the Fideuram zip file...
|
|
del /f /q fid-git.zip
|
|
|
|
echo Successfully switched to Fideuram environment.
|
|
) else if exist "arm-git.zip" (
|
|
REM Extract Armundia .git folder
|
|
echo No .git folder found. Extracting Armundia environment...
|
|
powershell -command "Expand-Archive -Path 'arm-git.zip' -DestinationPath '.' -Force"
|
|
|
|
REM Delete the zip file after extraction
|
|
echo Removing the Armundia zip file...
|
|
del /f /q arm-git.zip
|
|
|
|
echo Successfully switched to Armundia environment.
|
|
) else (
|
|
REM No Git environments found
|
|
echo No Git environments found.
|
|
echo Please initialize a Git repository with: git init
|
|
)
|
|
)
|
|
|
|
echo.
|
|
echo Done!
|
|
pause |