From 425607160d742e2847ccf97d6c3922f4b654b0d9 Mon Sep 17 00:00:00 2001 From: ming Date: Wed, 8 Jan 2025 10:15:19 +0800 Subject: [PATCH] Update Makefile --- Makefile | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index b3b5517..afc4ada 100644 --- a/Makefile +++ b/Makefile @@ -17,9 +17,9 @@ branchname := $(shell git branch --show-current) reponame := $(shell basename $(shell git rev-parse --show-toplevel)) projtype := $(shell basename $(shell dirname $(shell git rev-parse --show-toplevel))) pubtype := $(if $(findstring PUB,$(branchname)),public,protected) -remotedir := drwater@serev:/home/www/drwater/$(projtype)/$(pubtype)/$(reponame)/@$(branchname) +remotedir := drwater.net:/home/www/drc/$(projtype)/$(pubtype)/$(reponame)/$(branchname) outputdir := $(shell awk -F': *' '/^ *output-dir:/ {print $$2 "/" }' ./_quarto.yml) -siteurl := https://drwater.rcees.ac.cn/$(projtype)/$(pubtype)/$(reponame)/@$(branchname) +siteurl := https://drc.drwater.net/$(projtype)/$(pubtype)/$(reponame)/$(branchname) branchnames := "TX\|FJ\|YF\|ZY\|WW\|JB\|YY\|YJ\|DYF" @@ -74,12 +74,17 @@ updrefbib: echo "更新本项目参考文献..."; \ cp "$$HOME/literature/Ref.bib" "./BB/"; \ echo "推送本地参考文献到远程服务器..."; \ - rsync -azvu --progress "$$HOME/literature/Ref.bib" "drwater@serev:/home/www/drwater/datapool/public/BB/Ref.bib"; \ + rsync -azvu --progress "$$HOME/literature/Ref.bib" "drwater.net:/home/www/drc/datapool/public/BB/Ref.bib"; \ echo "本项目参考文献更新完成."; \ else \ - echo "更新本项目参考文献..."; \ - wget -O BB/Ref.bib "https://drwater.rcees.ac.cn/datapool/public/BB/Ref.bib"; \ - echo "本项目参考文献更新完成."; \ + echo "检查网络连通性..."; \ + if ping -c 1 -W 1 drc.drwater.net > /dev/null 2>&1; then \ + echo "网络正常,更新本项目参考文献..."; \ + wget -O BB/Ref.bib "https://drc.drwater.net/datapool/public/BB/Ref.bib"; \ + echo "本项目参考文献更新完成."; \ + else \ + echo "网络不可用,跳过参考文献更新."; \ + fi; \ fi; \ git add BB/Ref.bib; \ if [ "$$(git diff --cached)" ]; then \ @@ -137,13 +142,13 @@ pull: remote_branch=$$(git branch --remote | grep -v 'main' | grep $(branchnames) | awk '{print $$1}' | sed 's/origin\///' | head -n 1); \ if [ -n "$$remote_branch" ]; then \ echo "尝试从远程分枝$$remote_branch 拉取更新..."; \ - git pull origin $$remote_branch; \ + git pull --rebase origin $$remote_branch; \ else \ echo "远程无可用分支$$remote_branch."; \ fi; \ else \ echo "尝试将远程main分枝合并至本地$$current_branch 分枝."; \ - git pull origin main; \ + git pull --rebase origin main; \ fi # Pull changes from the main branch @@ -151,7 +156,7 @@ pullmain: $(MAKE) check_git_status; \ @current_branch=$$(git rev-parse --abbrev-ref HEAD); \ @echo "尝试将远程main分枝合并至本地$$current_branch 分枝."; \ - git pull origin main; \ + git pull --rebase origin main; \ push: @echo "推送到远程..."; \ @@ -226,7 +231,10 @@ backupdocx: trackchange: - @echo "选择两个提交以比较文档..."; \ + @if [ "$(projtype)" != "manuscript" ]; then \ + exit 0; \ + fi; \ + echo "选择两个提交以比较文档..."; \ hashes=$$(git log --pretty=format:'%h: %s BY %an (%ar)' \ | grep -E "$$(ls TC/MS/*.docx | xargs -n1 basename | sed -E 's/MS.*_([0-9a-f]+)\.docx/\1/' | tr '\n' '|')SMT_】" \ | fzf --multi --reverse --preview="echo {}" ); \