秀丸マクロ・Perforceのチェックイン・チェックアウト

概要

バージョン管理ツール「Perforce(通称:P4)」への、 チェックアウト・チェックインをするための簡易マクロです。

ダウンロード

更新日 2017/04/03
HmPerforceCheckInOut.zip v1.001

ダウンロードファイルの内容

PerforceCheckOut.mac
                
#must_should_reopen = 0;
//上書き禁止を外しておこうか
if( readonly ) {
    #must_should_reopen = 1;
}

//-----------------------------------------------------------------------------
//このファイルをPerforceでチェックアウトする
//-----------------------------------------------------------------------------
// P4 更新
runex "p4 sync %f"
    , 1             //sync    0:async 1:sync
    , 0, ""         //stdin   0:none 1:auto 2:file 3:(reserve) 4:all 5:select
    , 8, ""         //stdout  0:none 1:auto 2:file 3:add file  4:new 5:insert 6:replace 7:output 8:add output
    , 8, ""         //stderr  0:none 1:=out/auto 2:file 3:add file  4:new 5:insert 6:replace 7:output 8:add output
    , 0, ""         //folder  0:none 1:current 2:specify 3:(reserve) 4:exe's folder
    , 0             //show    0:auto 1:show 2:hide
    , 0             //nodraw  0:draw 1:no draw
    , 0             //unicode 0:ansi 2:unicode
    ;

// P4 チェックアウトによるロック
runex "p4 edit %f"
    , 1             //sync    0:async 1:sync
    , 0, ""         //stdin   0:none 1:auto 2:file 3:(reserve) 4:all 5:select
    , 8, ""         //stdout  0:none 1:auto 2:file 3:add file  4:new 5:insert 6:replace 7:output 8:add output
    , 8, ""         //stderr  0:none 1:=out/auto 2:file 3:add file  4:new 5:insert 6:replace 7:output 8:add output
    , 0, ""         //folder  0:none 1:current 2:specify 3:(reserve) 4:exe's folder
    , 0             //show    0:auto 1:show 2:hide
    , 0             //nodraw  0:draw 1:no draw
    , 0             //unicode 0:ansi 2:unicode
    ;

if (filetype == ".lua") {
    setencode 6, 1, 2;
}

if (result==false) {

    message("チェックアウト失敗。");

} else {
    // チェックアウトする前、リードオンリーだったのだから、リオープンする。
    if( #must_should_reopen == 1 ) {
        reopen;
    }
}
PerforceCheckIn.mac
                
//-----------------------------------------------------------------------------
//このファイルをPerforceでチェックインする
//-----------------------------------------------------------------------------

$str = input("コメント","");

if( !$str ) endmacro;    // コメント必須
if( !result ) endmacro;  // キャンセルされた

runex "p4 submit -d \"" + $str + "\" %f"
    , 0             //sync    0:async 1:sync
    , 0, ""         //stdin   0:none 1:auto 2:file 3:(reserve) 4:all 5:select
    , 8, ""         //stdout  0:none 1:auto 2:file 3:add file  4:new 5:insert 6:replace 7:output 8:add output
    , 8, ""         //stderr  0:none 1:=out/auto 2:file 3:add file  4:new 5:insert 6:replace 7:output 8:add output
    , 0, ""         //folder  0:none 1:current 2:specify 3:(reserve) 4:exe's folder
    , 0             //show    0:auto 1:show 2:hide
    , 0             //nodraw  0:draw 1:no draw
    , 0             //unicode 0:ansi 2:unicode
    ;

endmacro;

ライセンス

パブリックドメインとなります。