Mercurial / branch - merge,close,reopen

Mercurialのブランチのマージとか閉じたりとか閉じたブランチを再度開いたりとか。(Gitはどうした
環境:Windows XP SP3 / Mercurial 1.9

リポジトリ作るよ

$ hg init aaa
$ cd aaa

ファイルを追加してコミットするよ

$ touch aaa
$ hg add
adding aaa
$ hg ci -m "add aaa"
adding aaa
aaa
committed changeset 0:2f0a3a08406a
$ hg glog
@  changeset:   0:2f0a3a08406a
   tag:         tip
   user:        sasaplus1 <sasaplus1 [at] gmail.com>
   date:        Thu Feb 09 13:27:29 2012 +0900
   files:       aaa
   description:
   add aaa

developブランチ作るよ

$ hg branch develop
marked working directory as branch develop

developブランチにファイルを追加してコミットするよ

$ touch bbb
$ hg add
adding bbb
$ hg ci -m "add bbb"
bbb
committed changeset 1:b858b253d44f
$ hg glog
@  changeset:   1:b858b253d44f
|  branch:      develop
|  tag:         tip
|  user:        sasaplus1 <sasaplus1 [at] gmail.com>
|  date:        Thu Feb 09 13:29:24 2012 +0900
|  files:       bbb
|  description:
|  add bbb
|
|
o  changeset:   0:2f0a3a08406a
   user:        sasaplus1 <sasaplus1 [at] gmail.com>
   date:        Thu Feb 09 13:27:29 2012 +0900
   files:       aaa
   description:
   add aaa

defaultブランチに切り替えるよ

$ hg update default -C
resolving manifests
calling hook preupdate.eol: <function preupdate at 0x00C2FA30>
removing bbb
0 files updated, 0 files merged, 1 files removed, 0 files unresolved

developブランチをdefaultブランチにマージするよ

$ hg merge develop
resolving manifests
calling hook preupdate.eol: <function preupdate at 0x00C30A30>
getting bbb
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don\'t forget to commit)
$ hg ci -m "merge"
bbb
committed changeset 2:797ae4f41100
$ hg glog
@    changeset:   2:797ae4f41100
|\   tag:         tip
| |  parent:      0:2f0a3a08406a
| |  parent:      1:b858b253d44f
| |  user:        sasaplus1 <sasaplus1 [at] gmail.com>
| |  date:        Thu Feb 09 13:30:58 2012 +0900
| |  description:
| |  merge
| |
| |
| o  changeset:   1:b858b253d44f
|/   branch:      develop
|    user:        sasaplus1 <sasaplus1 [at] gmail.com>
|    date:        Thu Feb 09 13:29:24 2012 +0900
|    files:       bbb
|    description:
|    add bbb
|
|
o  changeset:   0:2f0a3a08406a
   user:        sasaplus1 <sasaplus1 [at] gmail.com>
   date:        Thu Feb 09 13:27:29 2012 +0900
   files:       aaa
   description:
   add aaa

developブランチを閉じるよ

$ hg update develop -C
resolving manifests
calling hook preupdate.eol: <function preupdate at 0x00C2FA30>
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg ci -m "close develop branch" --close-branch
committed changeset 3:5469b56401d3
$ hg glog
@  changeset:   3:5469b56401d3
|  branch:      develop
|  tag:         tip
|  parent:      1:b858b253d44f
|  user:        sasaplus1 <sasaplus1 [at] gmail.com>
|  date:        Thu Feb 09 13:31:54 2012 +0900
|  description:
|  close develop branch
|
|
| o  changeset:   2:797ae4f41100
|/|  parent:      0:2f0a3a08406a
| |  parent:      1:b858b253d44f
| |  user:        sasaplus1 <sasaplus1 [at] gmail.com>
| |  date:        Thu Feb 09 13:30:58 2012 +0900
| |  description:
| |  merge
| |
| |
o |  changeset:   1:b858b253d44f
|/   branch:      develop
|    user:        sasaplus1 <sasaplus1 [at] gmail.com>
|    date:        Thu Feb 09 13:29:24 2012 +0900
|    files:       bbb
|    description:
|    add bbb
|
|
o  changeset:   0:2f0a3a08406a
   user:        sasaplus1 <sasaplus1 [at] gmail.com>
   date:        Thu Feb 09 13:27:29 2012 +0900
   files:       aaa
   description:
   add aaa

developブランチが閉じられたよ

$ hg branches
default                        2:797ae4f41100
$ hg branches --close
default                        2:797ae4f41100
develop                        3:5469b56401d3 (closed)

defaultブランチにファイルを追加しておくよ

$ hg update default -C
resolving manifests
calling hook preupdate.eol: <function preupdate at 0x00C2FA30>
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ touch ccc
$ hg add
adding ccc
$ hg ci -m "add ccc"
ccc
committed changeset 4:7f1c995bbb84

閉じてあるdevelopブランチを再度開くよ

$ hg update develop -C
resolving manifests
calling hook preupdate.eol: <function preupdate at 0x00C2FA30>
removing ccc
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ touch ddd
$ hg add
adding ddd
$ hg glog
o  changeset:   4:7f1c995bbb84
|  tag:         tip
|  parent:      2:797ae4f41100
|  user:        sasaplus1 <sasaplus1 [at] gmail.com>
|  date:        Thu Feb 09 13:33:59 2012 +0900
|  files:       ccc
|  description:
|  add ccc
|
|
| @  changeset:   3:5469b56401d3
| |  branch:      develop
| |  parent:      1:b858b253d44f
| |  user:        sasaplus1 <sasaplus1 [at] gmail.com>
| |  date:        Thu Feb 09 13:31:54 2012 +0900
| |  description:
| |  close develop branch
| |
| |
o |  changeset:   2:797ae4f41100
|\|  parent:      0:2f0a3a08406a
| |  parent:      1:b858b253d44f
| |  user:        sasaplus1 <sasaplus1 [at] gmail.com>
| |  date:        Thu Feb 09 13:30:58 2012 +0900
| |  description:
| |  merge
| |
| |
| o  changeset:   1:b858b253d44f
|/   branch:      develop
|    user:        sasaplus1 <sasaplus1 [at] gmail.com>
|    date:        Thu Feb 09 13:29:24 2012 +0900
|    files:       bbb
|    description:
|    add bbb
|
|
o  changeset:   0:2f0a3a08406a
   user:        sasaplus1 <sasaplus1 [at] gmail.com>
   date:        Thu Feb 09 13:27:29 2012 +0900
   files:       aaa
   description:
   add aaa


$ hg ci -m "add ddd"
ddd
reopening closed branch head 3
committed changeset 5:05daeffc7897


$ hg glog
@  changeset:   5:05daeffc7897
|  branch:      develop
|  tag:         tip
|  parent:      3:5469b56401d3
|  user:        sasaplus1 <sasaplus1 [at] gmail.com>
|  date:        Thu Feb 09 13:35:03 2012 +0900
|  files:       ddd
|  description:
|  add ddd
|
|
| o  changeset:   4:7f1c995bbb84
| |  parent:      2:797ae4f41100
| |  user:        sasaplus1 <sasaplus1 [at] gmail.com>
| |  date:        Thu Feb 09 13:33:59 2012 +0900
| |  files:       ccc
| |  description:
| |  add ccc
| |
| |
o |  changeset:   3:5469b56401d3
| |  branch:      develop
| |  parent:      1:b858b253d44f
| |  user:        sasaplus1 <sasaplus1 [at] gmail.com>
| |  date:        Thu Feb 09 13:31:54 2012 +0900
| |  description:
| |  close develop branch
| |
| |
| o  changeset:   2:797ae4f41100
|/|  parent:      0:2f0a3a08406a
| |  parent:      1:b858b253d44f
| |  user:        sasaplus1 <sasaplus1 [at] gmail.com>
| |  date:        Thu Feb 09 13:30:58 2012 +0900
| |  description:
| |  merge
| |
| |
o |  changeset:   1:b858b253d44f
|/   branch:      develop
|    user:        sasaplus1 <sasaplus1 [at] gmail.com>
|    date:        Thu Feb 09 13:29:24 2012 +0900
|    files:       bbb
|    description:
|    add bbb
|
|
o  changeset:   0:2f0a3a08406a
   user:        sasaplus1 <sasaplus1 [at] gmail.com>
   date:        Thu Feb 09 13:27:29 2012 +0900
   files:       aaa
   description:
   add aaa


ブランチは閉じるというよりはbranchesで表示されなくする、という感じなのかな。
閉じた後も同名ブランチは作れないし、再度開けるわけだし。
なのでブランチ名がBTSのチケット名とかだと、再度修正が入れる時とかも開けば……
ってdefaultとかが大幅に進んでた場合どうすんだろ。普通にmergeするのかな。
その場合はdefaultから別ブランチ作った方が楽なのか。


奥が深いなー。