Push secret changesets

前端 未结 6 1223
孤独总比滥情好
孤独总比滥情好 2021-02-13 18:52

That may look paradoxical, I know that secret changesets are meant to be private, but what if I want to backup those secret changesets?

I work with some branches in para

6条回答
  •  清酒与你
    2021-02-13 19:35

    @echo off
    rem hgfullpull_naive.cmd
    setlocal
    set SRC_REPO=%~f1
    set DST_REPO=%~f2
    set TMP_DIR=%TEMP%\%~n0.tmp
    set NODES_LIST=%TMP_DIR%\%~n0.%RANDOM%.tmp
    
    if "%SRC_REPO%"=="" exit /b 1
    if "%DST_REPO%"=="" exit /b 1
    if "%SRC_REPO%"=="%DST_REPO%" exit /b 1
    
    call :ALL
    del /Q "%NODES_LIST%"
    endlocal
    goto :eof
    
    :ALL
        md "%TMP_DIR%"
        hg log --rev "secret()" --template "{node}\n" --repository "%SRC_REPO%" >"%NODES_LIST%" || exit /b 1
        call :CHANGE_PHASE "%SRC_REPO%" --draft
        hg pull --repository "%DST_REPO%" "%SRC_REPO%"
        call :CHANGE_PHASE "%SRC_REPO%" --secret
        call :CHANGE_PHASE "%DST_REPO%" --secret
        goto :eof
    
    :CHANGE_PHASE 
        setlocal
        set REPO=%~1
        set PHASE=%~2
        for /F "eol=; delims= usebackq" %%i IN ("%NODES_LIST%") DO (hg phase %PHASE% --force --rev %%i --repository "%REPO%")
        endlocal
        goto :eof
    

提交回复
热议问题