From fd70bd6fc68cf8ee37a36fbec6d741ceb9f01a4a Mon Sep 17 00:00:00 2001 From: bWFuanVzYWth Date: Fri, 25 Nov 2022 16:10:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=86=99=E8=87=AA=E5=8A=A8=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E8=84=9A=E6=9C=AC=EF=BC=8C=E5=8A=A0=E4=B8=8A=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ 双击更新蓝图仓库.bat | 53 ++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f5727ee..5793ec7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ MinGit/ +*.log + *.zip *.7z *.rar diff --git a/双击更新蓝图仓库.bat b/双击更新蓝图仓库.bat index 23e5a01..319b577 100644 --- a/双击更新蓝图仓库.bat +++ b/双击更新蓝图仓库.bat @@ -1,5 +1,54 @@ chcp 65001 -.\MinGit\cmd\git.exe pull origin main + set LOG_PATH=.\update.log -pause \ No newline at end of file + dir > %LOG_PATH% + + echo ---- >> %LOG_PATH% + + echo INF: %date% %time% Start >> %LOG_PATH% + + if exist ".\MinGit\cmd\git.exe" ( + set GIT_PATH=.\MinGit\cmd\git.exe + echo INF: %date% %time% GIT_PATH=MinGit >> %LOG_PATH% + ) else if exist "C:\Program Files\Git" ( + set GIT_PATH=git + echo INF: %date% %time% GIT_PATH=Git >> %LOG_PATH% + ) else ( + echo 错误:无法找到Git或MinGit + echo ERR: %date% %time% Git/MinGit no found >> %LOG_PATH% + goto err + ) + + if exist ".\.git" ( + echo INF: %date% %time% .git found >> %LOG_PATH% + goto git_init + ) else ( + echo 警告:没有找到.git文件夹 + echo WAR: %date% %time% .git no found >> %LOG_PATH% + goto git_no_init + ) + +:git_no_init + echo 正在尝试重建.git + echo INF: %date% %time% .git init start >> %LOG_PATH% + %GIT_PATH% init + %GIT_PATH% branch -M main + %GIT_PATH% remote add origin https://github.com/DSPBluePrints/FactoryBluePrints.git + echo INF: %date% %time% .git init end >> %LOG_PATH% + +:git_init + echo INF: %date% %time% .git pull start >> %LOG_PATH% + %GIT_PATH% pull origin main + echo INF: %date% %time% .git pull end >> %LOG_PATH% + +:end + echo INF: %date% %time% Exit >> %LOG_PATH% + pause + exit + +:err + echo 存在异常,无法更新 + echo INF: %date% %time% Exit with error >> %LOG_PATH% + pause + exit \ No newline at end of file