[英]Detecting if gerrit patch needs a rebase, using gerrit/git command line?
[英]Git/Gerrit Jenkins Continous Integration: How to handle rebase needs
我有一個關於持續與Jenkins for Git / Gerrit集成的問題:在等待期間接受由於之前的更改導致Git更改需要rebase / merge時,有沒有辦法取消Jenkins作業執行?
最好的祝福,
經過調查,我發現了一種檢測潛在合並沖突的方法。 基於Windows的shell腳本如下所示:
git fetch
git merge-base HEAD origin/master > _base
set /p MERGEBASE=<_base
git merge-tree %MERGEBASE% HEAD origin/master | grep -E -A3 "changed in both">_tempDiff
cat _tempDiff
set /p VAR=<_tempDiff
if not "%VAR%"=="" (
echo "Your change needs rebase"
exit /b -1
)
exit /b 0
如果在Gerrit驗證構建的第一個時運行此腳本,則當前分支使用最新的主分支修改相同的文件時,構建將立即中斷,通常用戶必須在構建后在Gerrit中重新定義。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.