Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
はじめてのMercurial/Bitbucket その2
Search
kenjis
October 05, 2011
Programming
1
130
はじめてのMercurial/Bitbucket その2
「はじめてのMercurial/Bitbucket」の続編。
kenjis
October 05, 2011
Tweet
Share
More Decks by kenjis
See All by kenjis
10分でわかるFuelPHP @OSC2012 Nagoya
kenjis
3
4.3k
10分でわかるFuelPHP
kenjis
2
3k
はじめてのMercurial/Bitbucket
kenjis
1
150
Other Decks in Programming
See All in Programming
見た目から始める生産性向上
ikumatadokoro
7
830
FigmaとPHPで作る1ミリたりとも表示崩れしない最強の帳票印刷ソリューション
ttskch
43
19k
Snowflakeで眠ったデータを起こそう!
estie
0
120
#phpcon_odawara オープン・クローズドなテストフィクスチャを求めて / open closed test fixtures
77web
3
230
From Spring Boot 2 to Spring Boot 3 with Java 22 and Jakarta EE
ivargrimstad
0
1.1k
大規模UIKitベースアプリへのTCAの段階的導入/gradual-adoption-of-tca-in-a-large-scale-uikit-based-app
takehilo
1
100
Site Reliability Engineering for GMO
pyama86
8
1k
Milestoner
bkuhlmann
1
410
GraphQLサーバの構成要素を整理する #ハッカー鮨 #tsukijigraphql / graphql server technology selection
izumin5210
4
820
PHP8.3の機能を振り返る / Review of PHP 8.3 features
seike460
PRO
1
110
単体テストを書かない技術 #phpcon_odawara
o0h
PRO
26
8.2k
[技育CAMPアカデミア]アイディアを形に!【超入門】スマホアプリ開発〜リリースまでの流れをご紹介
teamlab
PRO
0
360
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
2
1.3k
How GitHub Uses GitHub to Build GitHub
holman
468
290k
Fashionably flexible responsive web design (full day workshop)
malarkey
398
65k
10 Git Anti Patterns You Should be Aware of
lemiorhan
648
58k
StorybookのUI Testing Handbookを読んだ
zakiyama
13
4.6k
GraphQLの誤解/rethinking-graphql
sonatard
50
9.2k
4 Signs Your Business is Dying
shpigford
175
21k
The Straight Up "How To Draw Better" Workshop
denniskardys
227
130k
Debugging Ruby Performance
tmm1
70
11k
How STYLIGHT went responsive
nonsquared
92
4.8k
VelocityConf: Rendering Performance Case Studies
addyosmani
320
23k
The Brand Is Dead. Long Live the Brand.
mthomps
49
28k
Transcript
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc はじめてのMercurial/Bitbucket その2 日本CodeIgniterユーザ会 Kenji Suzuki 2011/02/19
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc 目次 Part 1 Mercurialの使い方(3) ~ hgコマンドを使いこなす ~ Part 2 Mercurialの拡張機能
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc Part 1 Part 1 Mercurialの使い方(3) hgコマンドを使いこなす
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc 過去へ戻る方法 作業フォルダのファイルを戻す ➔hg update -C チェンジセット ➔過去のチェンジセットに戻る ➔過去のチェンジセットにupdateしたまま 変更をコミットするとヘッドが増える ➔-Cオプションを付けないと、変更されてい るファイルはマージされる ➔最新に戻るには、hg update $ hg update -C 1
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc 過去へ戻る方法 コミット前の変更を取り消す ➔直前のチェンジセットに戻る ➔全てのファイルの変更を取り消す ➔特定ファイルの変更を取り消す $ hg revert --all $ hg revert myfile.php
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc 過去へ戻る方法 コミットした変更を取り消す ➔直前の操作を取り消す • 取り消せるのは直前の1回だけ • redoできない • 作業フォルダは変更されない • pushしてしまった変更はrollbackしな い • pullも取り消せる $ hg rollback
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc 過去へ戻る方法 コミットした変更を取り消す ➔hg backout チェンジセット ➔指定したチェンジセットを打ち消す変更が コミットされる ➔tip以外をbackoutするとヘッドが増える のでマージする $ hg backout tip
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc ファイルの削除 hg remove ファイル名 ➔ファイルが作業フォルダから削除される ➔コミットすると管理対象から除外される ➔削除しても過去のチェンジセットのファイ ルはなくならない $ hg remove myfile.php
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc ファイル名の変更/移動 hg rename 変更前 変更後 ➔renameとmvは同じ。コマンドの別名 ➔コミットして完了 ➔hg log -f ファイル名 • -fオプションで変更前の履歴も遡る $ hg rename myfile.php file.php $ hg mv myfile.php dir/myfile.php
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc tagとは? チェンジセットの別名 ➔人が覚えやすいように タグの付け方 ➔hg tag -r チェンジセット -m “コミットメッ セージ” タグ名 ➔自動的にコミットされる タグの一覧表示 ➔hg tags $ hg tag -r 3 v1.7.3
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc ファイルのみの取り出し svn exportに相当するもの hg archive ➔アーカイブ形式を指定することもできる $ hg archive -r 3 ~/mywork.%h $ hg archive -t zip -r 3 ~/mywork.%r.zip %h チェンジセットのハッシュIDに置き換わる %r チェンジセットのリビジョン番号に置き換わる
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc branchとは? 枝分かれ、独立した開発ライン ➔ソースが分岐すること ➔Mercurialではいろいろなブランチがある • リポジトリのクローン(cloneコマンド) • 最もわかりやすい • 名前なしブランチ • 複数ヘッド(勝手に分岐) • 名前付きブランチ(branchコマンド)
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc 名前付きブランチとは? 名前を付けて意図的に分岐するもの ➔ブランチの一覧表示 ➔現在のブランチの表示 ➔名前のないブランチ→defaultブランチ $ hg branches $ hg branch
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc 名前付きブランチの使い方 名前付きブランチの作成方法 ➔作業フォルダを分岐元チェンジセットに hg updateする ➔ブランチ名を指定する • ブランチ名に数字のみは使わない ➔コミットする • コミットしないとブランチは 作成されない $ hg branch test
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc 名前付きブランチの使い方 名前付きブランチの変更 ➔hg update -C ブランチ名 • -Cオプションを付けないと、変更されて いるファイルはマージされる • -Cオプションは変更を破棄するので、 実行前に未コミットの変更はコミットし ておく $ hg update -C default
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc 名前付きブランチの使い方 hg update ➔現在のブランチの最新チェンジセットに hg log -b ブランチ名 ➔-bオプションでブランチ名を指定 hg heads ブランチ名 ➔該当ブランチのヘッドのみ表示される
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc push/pullされるチェンジセットの確認 pullされるチェンジセットの確認 pushされるチェンジセットの確認 $ hg incoming $ hg outgoing
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc パッチファイルの生成 hg export ➔hg export -o 出力ファイル チェンジセッ ト hg import ➔パッチを取り込むことができる ➔1つずつコミットされる ➔hg import パッチファイル $ hg export -o ../export.%h 1
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc Webサーバ機能 hg serve ➔http://localhost:8000/ でリポジトリを閲覧できる $ hg serve
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc コマンドの別名 コマンドが長くて困るという人には ➔commit = ci ➔status = st ➔diff = di ➔update = up ➔rename = mv ➔incoming = in ➔outgoing = out
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc Part 2 Part 2 Mercurialの拡張機能
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc 拡張機能 拡張機能(エクステンション)とは? ➔Mercurialに新しいコマンドを 追加する機能 ➔Mercurialに含まれている エクステンションも多い
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc 拡張機能 エクステンションを有効にする ➔設定ファイルの[extentions]セクション ➔例 [extensions] graphlog = color = transplant = rebase = bookmarks = mq =
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc エクステンション graphlog ASCIIアートのグラフログを表示 ➔ブランチを視覚的に確認できる ➔hg glog
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc エクステンション color log, diff, status の表示がカラーに ➔少し見やすくなる
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc エクステンション transplant 一部のチェンジセットだけをマージする ➔特定のチェンジセットのみマージ ➔チェンジセットの範囲指定 ➔特定のブランチからマージ • マージするチェンジセットにyと答える $ hg transplant 123 $ hg transplant 123:125 $ hg transplant -b test
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc エクステンション rebase rebaseとは? A B C L 本家 自分 M N A B C L 本家 自分 M N D E A B C L' 本家 自分 M' N' D E
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc エクステンション rebase 使い方 ➔pull時にrebaseする ➔衝突した場合 $ hg pull --rebase $ hg rebase --continue $ hg rebase --abort
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc エクステンション bookmarks ブランチの一種 ➔Gitのブランチに似ている ➔名前付きブランチと違い削除できる ➔デフォルトでは同じチェンジセットに付け られたbookmarkは同じように移動する のでGitライクにしたい場合は、設定ファイ ルに以下を追加 [bookmarks] track.current = True
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc エクステンション bookmarks bookmarkの一覧表示 bookmarkを付ける bookmarkの削除 $ hg bookmark test $ hg bookmark -d test $ hg bookmarks
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc エクステンション MQ Mercurial Queue ➔パッチを管理する仕組み ➔リポジトリにコミットせずにいろいろしたい • コミットすると履歴が永久に残る • 途中の汚い変更の履歴は必要ない • 環境依存の情報をコミットしたくない • サーバの設定情報など • リポジトリを操作したい • チェンジセットをまとめたい
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc エクステンション Hg-Git Hg-Git http://hg-git.github.com/ インストール ➔ sudo apt-get install mercurial-git 使い方 [extensions] bookmarks = git = $ hg clone git://github.com/philsturgeon/ codeigniter-reactor.git
CodeIgniter Users Group in Japan CodeIgniter and its logo are
property of EllisLab Inc 参考文献 『入門Mercurial』 藤原克則著, 秀和システム, 2009年 『Mercurial による分散リビジョン管理』 http://www.honeyplanet.jp/hgbook.pdf 「Mercurial Wiki」 http://mercurial.selenic.com/wiki/ Mercurial(hg) のコマンド一覧 http://d.hatena.ne.jp/Kenji_s/20110203/1296696735