annotate software/hg.md @ 5:8f5664d57cfd

backup 2020-12-19
author autobackup
date Sat, 19 Dec 2020 00:10:03 +0900
parents b6c284fd5ae4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e12992dca4a0 init from Growi
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 # hg
e12992dca4a0 init from Growi
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
2
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
3 - クロスプラットフォームの分散型バージョン管理システム
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
4 - 全てのコマンドはhgから始まる
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
5 - mercuryが水銀を意味し、その元素記号がHgであることに由来する
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
6 - https://www.mercurial-scm.org/
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
7
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
8 # 研究室のmercurial web
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
9 - http://www.cr.ie.u-ryukyu.ac.jp/hg
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
10
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
11
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
12
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
13 ## 使い方(コマンドライン編)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
14
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
15 ### インストール
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
16 HomeBrewを使用する。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
17
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
18 brew install mercurial
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
19
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
20 でインストール出来る。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
21
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
22 ### hgwebの修正
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
23
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
24 brew upgrade mercurialでhgwebが動かなくなった時には、
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
25 /var/www/cgi-hg/index.cgi の以下の行を修正する。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
26
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
27 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
28 import sys
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
29 sys.path.insert(0, "/usr/local/Cellar/mercurial/5.0/lib/python2.7/site-packages")
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
30 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
31
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
32 一応修正スクリプトを生成しました
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
33
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
34 dateを絶対表示にするのは、
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
35 `/usr/local/Cellar/mercurial/4.4.2/lib/python2.7/site-packages/mercurial/templates/static/mercurial.js`
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
36 の function age をなおしてしまうのが良い。添付ファイルにあるので、それと入れ替える。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
37
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
38 ### リポジトリの初期化(init)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
39 管理したいディレクトリ内で以下のコマンドを実行する。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
40
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
41 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
42 hg init
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
43 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
44
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
45 ### ファイルをリポジトリに追加(add,commit)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
46 ファイルをリポジトリに追加する場合、以下のコマンドを実行する。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
47
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
48 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
49 hg add ファイル名
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
50 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
51
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
52 addで追加対象を設定し、commitでリポジトリに反映させる。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
53
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
54 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
55 hg commit
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
56 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
57
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
58 ### リポジトリを複製(clone)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
59 リポジトリを手元に複製し、作業をそこで行う。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
60
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
61 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
62 hg clone ssh://one@firefly.cr.ie.u-ryukyu.ac.jp/リポジトリ名 ローカル名
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
63 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
64
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
65 ### 履歴の閲覧(log)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
66 複製したディレクトリ内で実行する。リポジトリ に起きたすべての出来事の要約を、最新のものから時間を遡って表示する。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
67
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
68 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
69 hg log
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
70
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
71 changeset: 46:98c2bbeaecb4
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
72 tag: tip
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
73 user: convert-repo
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
74 date: Tue Nov 18 02:12:32 2008 +0000
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
75 summary: update tags
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
76 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
77
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
78 ### 変更の確認(diff)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
79 変更の内容を確認する時は、以下のコマンドを実行する。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
80
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
81 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
82 hg diff
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
83 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
84
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
85 ### ファイルの削除(remove)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
86 ファイルを削除する時は、以下のコマンドを実行する。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
87
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
88 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
89 hg remove ファイル名
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
90 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
91
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
92 このままでは削除されていないので、commitを行うとリポジトリに反映される。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
93
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
94 ### commit前の状態に戻す(revert)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
95 誤って削除してしまったり、変更してしまった場合も、commit前なら変更内容を無かった事に出来る。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
96
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
97 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
98 hg revert --all
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
99 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
100
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
101 ### タグを打つ(tag)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
102 チェンジセットに独自の識別子を付ける。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
103
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
104 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
105 hg tag タグ名
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
106 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
107
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
108 ### サーバーのリポジトリの変更内容を反映する。(pull)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
109 変更内容の同期をとるため、サーバーから変更内容を取得する。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
110
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
111 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
112 hg pull ssh://one@firefly.cr.ie.u-ryukyu.ac.jp/リポジトリ名
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
113 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
114
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
115 ### サーバーに変更内容を反映する。(push)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
116 手元にある変更したファイルをサーバー側に反映させる。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
117
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
118 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
119 hg push ssh://one@firefly.cr.ie.u-ryukyu.ac.jp/リポジトリ名
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
120 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
121
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
122 ## hgignoreに書いたファイルを削除したい時
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
123
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
124 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
125 $ hg forget "set:hgignore() and not ignored()"
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
126 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
127 cf. https://stackoverflow.com/questions/19820020/hg-remove-all-files-listed-in-hgignore
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
128
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
129 ## 基本的な使い方
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
130 ### はじめ
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
131
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
132 hg commit したら、
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
133
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
134 hg push する前に、
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
135
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
136 hg incoming
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
137
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
138 してみて、他の人が commit してないかどうかを見る。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
139
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
140 ### 衝突無し
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
141 なかったら、そのまま hg push する。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
142 そして、hg incoming して、自分のがtopだったら[終り]。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
143
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
144 そうではなかったら、やっぱり[衝突あり] (pushの瞬間に割り込まれた...)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
145
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
146 ### 衝突あり
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
147 何かあったら、
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
148
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
149 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
150 hg pull
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
151 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
152
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
153 する。すると、hg heads で、pull した version が出る。これを
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
154 merge してやれば良い。hg pull で取れたのが、例えば、(localで) 255だったら、
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
155
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
156 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
157 hg merge -r 255
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
158 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
159
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
160 とする。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
161
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
162 で、conflict をvi/emacs で修正して、
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
163
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
164 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
165 hg commit
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
166 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
167
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
168 で、[はじめ]に戻る。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
169
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
170
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
171
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
172 ### リポジトリからファイルを取り除く (convert)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
173 間違えて登録してしまったファイルを最初からなかったかのように跡形もなく消す方法。(forget等と異なり過去のバージョンからも消される)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
174 まず最初に、消したいファイルのファイルパスを適当なファイルに以下のようにして記述する。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
175 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
176 exclude "<file path>"
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
177 (例 : convert.txt)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
178
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
179 exclude "history/black.txt"
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
180 exclude "history/black2.txt"
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
181 exclude "aua" #ディレクトリ指定も可能。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
182 include "aua/auaua.txt" #指定したディレクトリ内のあるファイルのみ保持するときはincludeで指定。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
183 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
184
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
185 次に、hgrcに以下の記述を加えてconvertを利用出来るようにする。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
186 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
187 [extensions]
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
188 hgext.convert=
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
189 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
190
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
191 それから以下のようにコマンドを打ち、convertする。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
192 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
193 hg convert --filemap <削除ファイルのパスを書いたファイル> <対象リポジトリ> <新しく作られるリポジトリのパス>
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
194 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
195
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
196 convertが完了したら一度`hg update`を行う必要がある。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
197 updateしたらhg log等でリポジトリが正しく作成されているか確認し、find等を用いて指定したファイルが削除されているかも確認する。ファイルが消えてない場合大抵convert用のファイルの記述が正しいか、漏れがないか等を確認。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
198
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
199 うまくいっていたら、元のリポジトリの.hg/hgrcを新しいリポジトリにコピーする。そして元のリポジトリを削除して新しい方をrenameすれば完了。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
200
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
201 ### convert作業例(.svnを間違えて入れちゃったので消す場合)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
202
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
203
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
204 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
205 find ./ -name .svn > convert.txt #.svnの場所を探してconvert.txtに出力。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
206 sed -e "s/\.\/\//exclude \"/g" convert.txt #convert.txt内の .// を exclude " に、.svn を " に置換。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
207 sed -e "s/\.svn/\"/g" convert.txt
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
208 hg convert --filemap ./exclude.txt ../GCC_original ../GCC_original_rm_svn #convert(この前にhgrcでconvertを有効にしておく)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
209 cd ../GCC_original_rm_svn
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
210 hg update # updateしないとファイルが構成されない。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
211 hg log # 正しく作成されているかの確認。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
212 find ./ -name .svn #ちゃんと消えているかの確認。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
213 cp ../GCC_original/.hg/hgrc ./hg/hgrc #hgrcのコピー。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
214 cd ..
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
215 rm -r GCC_original #元の削除
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
216 mv GCC_original_rm_svn GCC_original #rename
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
217 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
218
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
219
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
220 ### メールでのpatch送信方法
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
221
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
222 メールで、最新のcommitをpatchとして送信する方法。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
223
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
224 メールを送信したいlocalの /.hgrc を送信元の名前やメールの設定を追加編集する。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
225
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
226 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
227 [email]
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
228 method = smtp
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
229 from = Name <mail-address>
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
230 [smtp]
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
231 host = smtp.gmail.com
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
232 port = 587
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
233 tls = starttls
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
234 username = mail-address
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
235 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
236
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
237
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
238 送信したいrepositoryの .hg/hgrc に、送信先のメールアドレスを設定する。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
239
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
240 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
241 [email]
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
242 to = mail-address
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
243 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
244
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
245
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
246 patchをメールで送信するコマンドは以下。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
247
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
248 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
249 $ hg email .
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
250 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
251
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
252 最初、abortが出る。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
253
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
254 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
255 abort: smtp.gmail.com certificate with fingerprint 9c:0a:cc:93:1d:e7:51:37:90:61:6b:a1:18:28:67:95:54:c5:69:a8 not verified
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
256 (check hostfingerprints or web.cacerts config setting)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
257 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
258
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
259 abortで出たfingerprintを、メールを送信したいlocalの /.hgrc に追加する。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
260
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
261 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
262 [hostfingerprints]
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
263 smtp.gmail.com = 9c:0a:cc:93:1d:e7:51:37:90:61:6b:a1:18:28:67:95:54:c5:69:a8
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
264 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
265
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
266 Gmailを使用する際、
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
267 「安全性の低いアプリがアカウントにアクセスするのを許可する」
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
268 設定が必要となる場合がありますので、もしエラーが出たら設定してください。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
269 https://support.google.com/accounts/answer/6010255
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
270
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
271 これらの設定で、patchをメールで送信することが出来るようになります。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
272
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
273
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
274 ## 使い方(Eclipse編)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
275
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
276 ### インストール
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
277 Eclipse3.3以上にて、
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
278 "Help"->"Software Updates"を選択し
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
279 "Add Site..."から以下のURLを入力する。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
280
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
281 Name: Vectrace (Mercurial Eclipse plugin)
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
282 URL: http://www.vectrace.com/eclipse-update/
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
283
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
284 その後、新しく現れた項目にチェックを入れて、"install..."でインストール完了。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
285
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
286 ### リポジトリの追加
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
287 "File" -> "New"-> "Project..."より、"Clone Repository using Mercurial"を選択し"Next"
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
288 URLにはコマンドラインと同じ様に
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
289
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
290 ssh://one@firefly.cr.ie.u-ryukyu.ac.jp/リポジトリ名 ローカル名
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
291
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
292 を入力し、ウィザードに従い必須項目を入力する。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
293 成功すれば、左のウィンドウにプロジェクトが追加される。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
294
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
295 ### その他の操作
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
296 ファイルを右クリックした時に現れる"Team"内にMercurialのコマンドが表示される。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
297 内容はコマンドラインと一緒なので説明は割愛する。
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
298
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
299 ## リンク
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
300 - Mercurial の使い方のチュートリアル
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
301 http://www.selenic.com/mercurial/wiki/index.cgi/JapaneseTutorial
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
302 - Mercurial Eclipse
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
303 http://www.vectrace.com/mercurialeclipse/
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
304
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
305
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
306 # おすすめ設定
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
307 - ホームディレクトリの.hgrcに書いておくとおすすめの設定
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
308
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
309 ## xcodeのdiffを開かないようにしたい
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
310 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
311 [ui]
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
312 merge=internal:merge
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
313 ```
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
314
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
315 - こう書いておくと `>>>>` `=====` `<<<<<` のgitっぽい感じでdiffが直接ファイルに書き出される
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
316 - xcodeのdiffとかvim diffは慣れてないと使いづらいので...
b6c284fd5ae4 backup 2020-12-16
autobackup
parents: 0
diff changeset
317