secretbase.log

.NET/C#/Pythonなど

Mercurialにてブランチの閉鎖と再開の方法

Mercurial にて、閉鎖したブランチのを再開するためには、単純にコミットすれば良いことがわかりましたのでメモ。

f:id:cointoss1973:20120711154439p:image

branch の閉鎖

branch の閉鎖は、閉鎖したいブランチに update し、--close-branch オプションにてコミットすることで閉鎖できます。
ここでは、 stable ブランチを閉鎖する手順です。

$ hg update stable
$ hg commit --close-branch
$ hg branches
default                      980:bdfa3837e371

ブランチの一覧には、閉鎖されたブランチは表示されません。

$ hg branches -c
default                      980:bdfa3837e371
stable                       981:449c1cd43027 (閉鎖済み)

オプション -c をつけると、閉鎖済みのブランチが表示されます。

branch の再開

閉鎖済みブランチ(この例では stable) に普通にコミットすれば再開します。

$ hg update stable
$ hg commit -m "test"
閉鎖済みブランチヘッド 981 の再開中

簡単ですね。

hg branches で stable ブランチが有効になっていることが確認できます。

$ hg branches
stable                       982:5444448a9110
default                      980:bdfa3837e371