hg rebase が3-way mergeしてくれるという話
hg rebaseは3-way mergeします。 mercurialでhg graftは3-way mergeしてくれるのが売りだけど、hg rebaseはどうなんだっけ?という話がよく出るので。
以下、試したログ
% hg version | head -n1 Mercurial Distributed SCM (version 2.7.1) % hg init rebase-3-way-merge-test % cd rebase-3-way-merge-test % cat <<END > README heredoc> = README heredoc> heredoc> hogehoge heredoc> END % hg add README % hg ci -m "add README" % hg mv README README.md % hg ci -m "rename" % hg up 0 1 files updated, 0 files merged, 1 files removed, 0 files unresolved % cat <<END > LICENSE heredoc> public domain heredoc> END % hg add LICENSE % hg ci -m "add LICENSE" created new head % cat <<END > README heredoc> = README heredoc> heredoc> foobar heredoc> END % hg ci -m "fix README" % hg bookmark foo % hg log -G --style compact @ 3[tip][foo] e694dde31a4e 2013-09-27 11:37 +0900 trot | fix README | o 2:0 62de681e75d2 2013-09-27 11:36 +0900 trot | add LICENSE | | o 1 9268fbcaa618 2013-09-27 11:31 +0900 trot |/ rename | o 0 43847b1e4bc1 2013-09-27 11:31 +0900 trot add README % hg log -pr 3 changeset: 3:e694dde31a4e user: Takumi IINO <trot.thunder@gmail.com> date: Fri Sep 27 11:37:21 2013 +0900 summary: fix README diff --git a/README b/README --- a/README +++ b/README @@ -1,3 +1,3 @@ = README -hogehoge +foobar % hg rebase --source 3 --dest 1 --keep merging README.md and README to README.md % hg log -G --style compact @ 4[tip][foo]:1 5bdfb661c56c 2013-09-27 11:37 +0900 trot | fix README | | o 3 e694dde31a4e 2013-09-27 11:37 +0900 trot | | fix README | | | o 2:0 62de681e75d2 2013-09-27 11:36 +0900 trot | | add LICENSE | | o | 1 9268fbcaa618 2013-09-27 11:31 +0900 trot |/ rename | o 0 43847b1e4bc1 2013-09-27 11:31 +0900 trot add README % hg log -pr 4 changeset: 4:5bdfb661c56c bookmark: foo tag: tip parent: 1:9268fbcaa618 user: Takumi IINO <trot.thunder@gmail.com> date: Fri Sep 27 11:37:21 2013 +0900 summary: fix README diff --git a/README.md b/README.md --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ = README -hogehoge +foobar %
mercurialでgit new-workdir
ローカルのリポジトリをコピーするための専用のコマンドはmercurialには無い。*1 単にcloneすればよい。
hg clone <repository> <new_workdir_path>
追記: git new-workdirは.git以下のファイル郡をsymlinkで共有しているので、元のリポジトリのコミットがnew_workdirでも参照できるが、hg cloneの場合は完全に別リポジトリということに注意。
速度
git new-workdirはsymlinkを使うことによってcpより早いよ、という話。 mercurialの場合、ローカルリポジトリのクローン時には(unix系OSでもwindowsでも)hard linkが利用されるため、cpより早い。
% hg version | head -n1 Mercurial Distributed SCM (version 2.7) % time (hg clone rhodecode-enterprise rhodecode-enterprise-clone) updating to branch default 1852 files updated, 0 files merged, 0 files removed, 0 files unresolved ( hg clone rhodecode-enterprise rhodecode-enterprise-clone; ) 1.53s user 1.15s system 42% cpu 6.394 total % time (cp -R rhodecode-enterprise rhodecode-enterprise-cp) ( cp -i -R rhodecode-enterprise rhodecode-enterprise-cp; ) 0.13s user 2.46s system 16% cpu 15.331 total
この例では2.5倍くらいcloneの方が早い
ちなみに
hg clone だと作業領域が作られる(ファイルが展開される)ので、作りたくない場合は次のコマンドを利用しよう
% hg clone -U <src> <dest> # クローン時に作業領域を作らない % hg update null # リポジトリの作業領域を消す
参考
tmuxの設定ファイルを再読み込みする。もしくは複数のコマンドを実行するキーバインドを定義する。
tmux-1.8で確認しています。
ググったら、こういう設定たくさん出てくる。けど、この設定では(1.8では?)起動時に警告が表示される。
bind-key C-r source-file ~/.tmux.conf ; display-message "Reloaded."
正しくはこう。セミコロンをバックスラッシュでエスケープするのが正しいらしい。
bind-key C-r source-file ~/.tmux.conf \; display-message "Reloaded."
参考
TokyoMercurial#8 を開催しました。 #TokyoMercurial #mercurialjp
2013/06/23(日)にTokyoMercurial#8を開催しました。
やったこと
- 国際化されたマニュアル(Manpage, HTML)を生成するパッチの修正
- RhodeCodeのメッセージリソースをTransifexで翻訳
- 宝塚記念観戦
次回
次回は7,8月あたりの開催を考えています。
Mercurial-2.6でhgwebからイシュトラッカーにリンクを張る
前回のhgwebからイシュトラッカーにリンクを張るではInterhgExtensionを利用しました。が、InterhgExtensionはMercurial-2.6からobsoleteとなりました。
というのも、InterhgExtension相当の機能はwebsubテンプレートフィルターという形でhgwebに取り込まれたからです。
websubをつかう
公開しているリポジトリの.hg/hgrcに次の様な設定を追加します。
[websub] # backlogの場合の例 backlog = s!(DORA-\d+)!<a href="https://demo.backlog.jp/view/\1">\1</a>!
InterhgExtensionから移行する場合はセクションの部分をinterhgからwebsubに変更するだけでOKのようです。