rev |
line source |
dongsheng@627
|
1 #
|
dongsheng@627
|
2 # Simplified Chinese translation for hgbook
|
dongsheng@627
|
3 # This file is distributed under the same license as the hgbook.
|
dongsheng@627
|
4 #
|
dongsheng@627
|
5 # Authors:
|
dongsheng@627
|
6 # Dongsheng Song <dongsheng.song@gmail.com>, 2009
|
dongsheng@627
|
7 #
|
dongsheng@627
|
8 # Update to new pot:
|
dongsheng@636
|
9 # msgmerge --update zh.po hgbook.pot
|
dongsheng@627
|
10 #
|
dongsheng@627
|
11 # Check translation:
|
dongsheng@627
|
12 # msgfmt --statistics -c -o zh.mo zh.po
|
dongsheng@627
|
13 #
|
dongsheng@627
|
14 # Please format your translation before commit:
|
dongsheng@627
|
15 # msgcat --sort-by-file --width=80 -o zh_new.po zh.po
|
dongsheng@627
|
16 # mv -f zh_new.po zh.po
|
dongsheng@627
|
17 #
|
dongsheng@627
|
18 # Dictionary:
|
dongsheng@627
|
19 # blame 追溯
|
dongsheng@627
|
20 # branch 分支
|
dongsheng@627
|
21 # changes 修改
|
dongsheng@627
|
22 # changeset 修改集
|
dongsheng@627
|
23 # checkout 检出
|
dongsheng@627
|
24 # remove 移除(从版本库删除)
|
dongsheng@627
|
25 # delete 删除(只从文件系统删除)
|
dongsheng@627
|
26 # patchset 补丁集
|
dongsheng@627
|
27 # pushing to 推到
|
dongsheng@635
|
28 # pulling from 拉自,抓取
|
dongsheng@627
|
29 # rename 改名
|
dongsheng@627
|
30 # repository 版本库
|
dongsheng@627
|
31 # revert 恢复
|
dongsheng@627
|
32 # revision 版本
|
dongsheng@627
|
33 # tag 标签
|
dongsheng@627
|
34 # tip 顶点
|
dongsheng@627
|
35 # undo 撤销
|
dongsheng@627
|
36 # unversioned 未版本控制
|
dongsheng@627
|
37 # versioned 受版本控制
|
dongsheng@627
|
38 # working copy 工作副本
|
dongsheng@627
|
39 # ...
|
dongsheng@627
|
40 #
|
dongsheng@627
|
41 msgid ""
|
dongsheng@627
|
42 msgstr ""
|
dongsheng@627
|
43 "Project-Id-Version: hgbook 1.2\n"
|
dongsheng@641
|
44 "POT-Creation-Date: 2009-03-17 10:44+0800\n"
|
dongsheng@636
|
45 "PO-Revision-Date: 2009-03-16 18:32+0800\n"
|
dongsheng@627
|
46 "Last-Translator: \n"
|
dongsheng@627
|
47 "Language-Team: Simplified Chinese <i18n-zh@googlegroups.com >\n"
|
dongsheng@627
|
48 "MIME-Version: 1.0\n"
|
dongsheng@627
|
49 "Content-Type: text/plain; charset=UTF-8\n"
|
dongsheng@627
|
50 "Content-Transfer-Encoding: 8bit\n"
|
dongsheng@627
|
51 "X-Poedit-Language: Chinese\n"
|
dongsheng@627
|
52 "X-Poedit-Country: CHINA\n"
|
dongsheng@627
|
53 "X-Poedit-SourceCharset: utf-8\n"
|
dongsheng@627
|
54
|
dongsheng@627
|
55 #. type: Content of: <book><title>
|
dongsheng@627
|
56 #: ../en/00book.xml:41
|
dongsheng@627
|
57 msgid "Mercurial: The Definitive Guide"
|
dongsheng@627
|
58 msgstr "Mercurial 权威指南"
|
dongsheng@627
|
59
|
dongsheng@627
|
60 #. type: Content of: <book><subtitle>
|
dongsheng@627
|
61 #: ../en/00book.xml:46
|
dongsheng@627
|
62 msgid "Compiled from $rev_id$"
|
dongsheng@627
|
63 msgstr "编译自 $rev_id$"
|
dongsheng@627
|
64
|
dongsheng@627
|
65 #. type: Content of: <book><bookinfo><authorgroup><author><firstname>
|
dongsheng@627
|
66 #: ../en/00book.xml:50
|
dongsheng@627
|
67 msgid "Bryan"
|
dongsheng@627
|
68 msgstr ""
|
dongsheng@627
|
69
|
dongsheng@627
|
70 #. type: Content of: <book><bookinfo><authorgroup><author><surname>
|
dongsheng@627
|
71 #: ../en/00book.xml:51
|
dongsheng@627
|
72 msgid "O'Sullivan"
|
dongsheng@627
|
73 msgstr ""
|
dongsheng@627
|
74
|
dongsheng@627
|
75 #. type: Content of: <book><bookinfo>
|
dongsheng@627
|
76 #: ../en/00book.xml:55
|
dongsheng@627
|
77 msgid ""
|
dongsheng@627
|
78 "<editor> <firstname>Mike</firstname> <surname>Loukides</surname> </editor> "
|
dongsheng@627
|
79 "<copyright> <year>2006</year> <year>2007</year> <year>2008</year> <year>2009</"
|
dongsheng@627
|
80 "year> <holder>Bryan O'Sullivan</holder> </copyright>"
|
dongsheng@627
|
81 msgstr ""
|
dongsheng@627
|
82
|
dongsheng@627
|
83 #. type: Content of: <book><appendix><title>
|
dongsheng@627
|
84 #: ../en/appA-cmdref.xml:4
|
dongsheng@627
|
85 msgid "Command reference"
|
dongsheng@627
|
86 msgstr "命令参考"
|
dongsheng@627
|
87
|
dongsheng@627
|
88 #. type: Content of: <book><appendix><para>
|
dongsheng@627
|
89 #: ../en/appA-cmdref.xml:6
|
dongsheng@627
|
90 msgid ""
|
dongsheng@627
|
91 "\\cmdref{add}{add files at the next commit} \\optref{add}{I}{include} \\optref"
|
dongsheng@627
|
92 "{add}{X}{exclude} \\optref{add}{n}{dry-run}"
|
dongsheng@627
|
93 msgstr ""
|
dongsheng@627
|
94
|
dongsheng@627
|
95 #. type: Content of: <book><appendix><para>
|
dongsheng@627
|
96 #: ../en/appA-cmdref.xml:11
|
dongsheng@627
|
97 msgid "\\cmdref{diff}{print changes in history or working directory}"
|
dongsheng@627
|
98 msgstr ""
|
dongsheng@627
|
99
|
dongsheng@627
|
100 #. type: Content of: <book><appendix><para>
|
dongsheng@627
|
101 #: ../en/appA-cmdref.xml:13
|
dongsheng@627
|
102 msgid ""
|
dongsheng@627
|
103 "Show differences between revisions for the specified files or directories, "
|
dongsheng@627
|
104 "using the unified diff format. For a description of the unified diff format, "
|
dongsheng@627
|
105 "see section <xref linkend=\"sec.mq.patch\"/>."
|
dongsheng@627
|
106 msgstr ""
|
dongsheng@627
|
107
|
dongsheng@627
|
108 #. type: Content of: <book><appendix><para>
|
dongsheng@627
|
109 #: ../en/appA-cmdref.xml:17
|
dongsheng@627
|
110 msgid ""
|
dongsheng@627
|
111 "By default, this command does not print diffs for files that Mercurial "
|
dongsheng@627
|
112 "considers to contain binary data. To control this behaviour, see the <option "
|
dongsheng@627
|
113 "role=\"hg-opt-diff\">-a</option> and <option role=\"hg-opt-diff\">--git</"
|
dongsheng@627
|
114 "option> options."
|
dongsheng@627
|
115 msgstr ""
|
dongsheng@627
|
116
|
dongsheng@627
|
117 #. type: Content of: <book><appendix><sect2><title>
|
dongsheng@627
|
118 #: ../en/appA-cmdref.xml:22
|
dongsheng@627
|
119 msgid "Options"
|
dongsheng@627
|
120 msgstr "选项"
|
dongsheng@627
|
121
|
dongsheng@627
|
122 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
123 #: ../en/appA-cmdref.xml:24
|
dongsheng@627
|
124 msgid "\\loptref{diff}{nodates}"
|
dongsheng@627
|
125 msgstr ""
|
dongsheng@627
|
126
|
dongsheng@627
|
127 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
128 #: ../en/appA-cmdref.xml:26
|
dongsheng@627
|
129 msgid "Omit date and time information when printing diff headers."
|
dongsheng@627
|
130 msgstr ""
|
dongsheng@627
|
131
|
dongsheng@627
|
132 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
133 #: ../en/appA-cmdref.xml:28
|
dongsheng@627
|
134 msgid "\\optref{diff}{B}{ignore-blank-lines}"
|
dongsheng@627
|
135 msgstr ""
|
dongsheng@627
|
136
|
dongsheng@627
|
137 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
138 #: ../en/appA-cmdref.xml:30
|
dongsheng@627
|
139 msgid ""
|
dongsheng@627
|
140 "Do not print changes that only insert or delete blank lines. A line that "
|
dongsheng@627
|
141 "contains only whitespace is not considered blank."
|
dongsheng@627
|
142 msgstr ""
|
dongsheng@627
|
143
|
dongsheng@627
|
144 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
145 #: ../en/appA-cmdref.xml:34
|
dongsheng@627
|
146 msgid "\\optref{diff}{I}{include}"
|
dongsheng@627
|
147 msgstr ""
|
dongsheng@627
|
148
|
dongsheng@627
|
149 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
150 #: ../en/appA-cmdref.xml:37
|
dongsheng@627
|
151 msgid "Include files and directories whose names match the given patterns."
|
dongsheng@627
|
152 msgstr ""
|
dongsheng@627
|
153
|
dongsheng@627
|
154 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
155 #: ../en/appA-cmdref.xml:40
|
dongsheng@627
|
156 msgid "\\optref{diff}{X}{exclude}"
|
dongsheng@627
|
157 msgstr ""
|
dongsheng@627
|
158
|
dongsheng@627
|
159 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
160 #: ../en/appA-cmdref.xml:43
|
dongsheng@627
|
161 msgid "Exclude files and directories whose names match the given patterns."
|
dongsheng@627
|
162 msgstr ""
|
dongsheng@627
|
163
|
dongsheng@627
|
164 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
165 #: ../en/appA-cmdref.xml:46
|
dongsheng@627
|
166 msgid "\\optref{diff}{a}{text}"
|
dongsheng@627
|
167 msgstr ""
|
dongsheng@627
|
168
|
dongsheng@627
|
169 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
170 #: ../en/appA-cmdref.xml:49
|
dongsheng@627
|
171 msgid ""
|
dongsheng@627
|
172 "If this option is not specified, <command role=\"hg-cmd\">hg diff</command> "
|
dongsheng@627
|
173 "will refuse to print diffs for files that it detects as binary. Specifying "
|
dongsheng@627
|
174 "<option role=\"hg-opt-diff\">-a</option> forces <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
175 "diff</command> to treat all files as text, and generate diffs for all of them."
|
dongsheng@627
|
176 msgstr ""
|
dongsheng@627
|
177
|
dongsheng@627
|
178 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
179 #: ../en/appA-cmdref.xml:55
|
dongsheng@627
|
180 msgid ""
|
dongsheng@627
|
181 "This option is useful for files that are <quote>mostly text</quote> but have "
|
dongsheng@627
|
182 "a few embedded NUL characters. If you use it on files that contain a lot of "
|
dongsheng@627
|
183 "binary data, its output will be incomprehensible."
|
dongsheng@627
|
184 msgstr ""
|
dongsheng@627
|
185
|
dongsheng@627
|
186 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
187 #: ../en/appA-cmdref.xml:60
|
dongsheng@627
|
188 msgid "\\optref{diff}{b}{ignore-space-change}"
|
dongsheng@627
|
189 msgstr ""
|
dongsheng@627
|
190
|
dongsheng@627
|
191 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
192 #: ../en/appA-cmdref.xml:63
|
dongsheng@627
|
193 msgid ""
|
dongsheng@627
|
194 "Do not print a line if the only change to that line is in the amount of white "
|
dongsheng@627
|
195 "space it contains."
|
dongsheng@627
|
196 msgstr ""
|
dongsheng@627
|
197
|
dongsheng@627
|
198 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
199 #: ../en/appA-cmdref.xml:67
|
dongsheng@627
|
200 msgid "\\optref{diff}{g}{git}"
|
dongsheng@627
|
201 msgstr ""
|
dongsheng@627
|
202
|
dongsheng@627
|
203 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
204 #: ../en/appA-cmdref.xml:70
|
dongsheng@627
|
205 msgid ""
|
dongsheng@627
|
206 "Print <command>git</command>-compatible diffs. XXX reference a format "
|
dongsheng@627
|
207 "description."
|
dongsheng@627
|
208 msgstr ""
|
dongsheng@627
|
209
|
dongsheng@627
|
210 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
211 #: ../en/appA-cmdref.xml:74
|
dongsheng@627
|
212 msgid "\\optref{diff}{p}{show-function}"
|
dongsheng@627
|
213 msgstr ""
|
dongsheng@627
|
214
|
dongsheng@627
|
215 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
216 #: ../en/appA-cmdref.xml:77
|
dongsheng@627
|
217 msgid ""
|
dongsheng@627
|
218 "Display the name of the enclosing function in a hunk header, using a simple "
|
dongsheng@627
|
219 "heuristic. This functionality is enabled by default, so the <option role="
|
dongsheng@627
|
220 "\"hg-opt-diff\">-p</option> option has no effect unless you change the value "
|
dongsheng@627
|
221 "of the <envar role=\"rc-item-diff\">showfunc</envar> config item, as in the "
|
dongsheng@627
|
222 "following example."
|
dongsheng@627
|
223 msgstr ""
|
dongsheng@627
|
224
|
dongsheng@627
|
225 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
226 #: ../en/appA-cmdref.xml:84
|
dongsheng@627
|
227 msgid "\\optref{diff}{r}{rev}"
|
dongsheng@627
|
228 msgstr ""
|
dongsheng@627
|
229
|
dongsheng@627
|
230 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
231 #: ../en/appA-cmdref.xml:87
|
dongsheng@627
|
232 msgid ""
|
dongsheng@627
|
233 "Specify one or more revisions to compare. The <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
234 "diff</command> command accepts up to two <option role=\"hg-opt-diff\">-r</"
|
dongsheng@627
|
235 "option> options to specify the revisions to compare."
|
dongsheng@627
|
236 msgstr ""
|
dongsheng@627
|
237
|
dongsheng@627
|
238 #. type: Content of: <book><appendix><sect2><orderedlist><listitem><para>
|
dongsheng@627
|
239 #: ../en/appA-cmdref.xml:93
|
dongsheng@627
|
240 msgid ""
|
dongsheng@627
|
241 "Display the differences between the parent revision of the working directory "
|
dongsheng@627
|
242 "and the working directory."
|
dongsheng@627
|
243 msgstr ""
|
dongsheng@627
|
244
|
dongsheng@627
|
245 #. type: Content of: <book><appendix><sect2><orderedlist><listitem><para>
|
dongsheng@627
|
246 #: ../en/appA-cmdref.xml:97
|
dongsheng@627
|
247 msgid ""
|
dongsheng@627
|
248 "Display the differences between the specified changeset and the working "
|
dongsheng@627
|
249 "directory."
|
dongsheng@627
|
250 msgstr ""
|
dongsheng@627
|
251
|
dongsheng@627
|
252 #. type: Content of: <book><appendix><sect2><orderedlist><listitem><para>
|
dongsheng@627
|
253 #: ../en/appA-cmdref.xml:101
|
dongsheng@627
|
254 msgid "Display the differences between the two specified changesets."
|
dongsheng@627
|
255 msgstr ""
|
dongsheng@627
|
256
|
dongsheng@627
|
257 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
258 #: ../en/appA-cmdref.xml:105
|
dongsheng@627
|
259 msgid ""
|
dongsheng@627
|
260 "You can specify two revisions using either two <option role=\"hg-opt-diff\">-"
|
dongsheng@627
|
261 "r</option> options or revision range notation. For example, the two revision "
|
dongsheng@627
|
262 "specifications below are equivalent."
|
dongsheng@627
|
263 msgstr ""
|
dongsheng@627
|
264
|
dongsheng@627
|
265 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
266 #: ../en/appA-cmdref.xml:112
|
dongsheng@627
|
267 msgid ""
|
dongsheng@627
|
268 "When you provide two revisions, Mercurial treats the order of those revisions "
|
dongsheng@627
|
269 "as significant. Thus, <command role=\"hg-cmd\">hg diff -r10:20</command> "
|
dongsheng@627
|
270 "will produce a diff that will transform files from their contents as of "
|
dongsheng@627
|
271 "revision 10 to their contents as of revision 20, while <command role=\"hg-cmd"
|
dongsheng@627
|
272 "\">hg diff -r20:10</command> means the opposite: the diff that will transform "
|
dongsheng@627
|
273 "files from their revision 20 contents to their revision 10 contents. You "
|
dongsheng@627
|
274 "cannot reverse the ordering in this way if you are diffing against the "
|
dongsheng@627
|
275 "working directory."
|
dongsheng@627
|
276 msgstr ""
|
dongsheng@627
|
277
|
dongsheng@627
|
278 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
279 #: ../en/appA-cmdref.xml:122
|
dongsheng@627
|
280 msgid "\\optref{diff}{w}{ignore-all-space}"
|
dongsheng@627
|
281 msgstr ""
|
dongsheng@627
|
282
|
dongsheng@627
|
283 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
284 #: ../en/appA-cmdref.xml:125
|
dongsheng@627
|
285 msgid "\\cmdref{version}{print version and copyright information}"
|
dongsheng@627
|
286 msgstr ""
|
dongsheng@627
|
287
|
dongsheng@627
|
288 #. type: Content of: <book><appendix><sect2><para>
|
dongsheng@627
|
289 #: ../en/appA-cmdref.xml:128
|
dongsheng@627
|
290 msgid ""
|
dongsheng@627
|
291 "This command displays the version of Mercurial you are running, and its "
|
dongsheng@627
|
292 "copyright license. There are four kinds of version string that you may see."
|
dongsheng@627
|
293 msgstr ""
|
dongsheng@627
|
294
|
dongsheng@627
|
295 #. type: Content of: <book><appendix><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
296 #: ../en/appA-cmdref.xml:133
|
dongsheng@627
|
297 msgid ""
|
dongsheng@627
|
298 "The string <quote><literal>unknown</literal></quote>. This version of "
|
dongsheng@627
|
299 "Mercurial was not built in a Mercurial repository, and cannot determine its "
|
dongsheng@627
|
300 "own version."
|
dongsheng@627
|
301 msgstr ""
|
dongsheng@627
|
302
|
dongsheng@627
|
303 #. type: Content of: <book><appendix><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
304 #: ../en/appA-cmdref.xml:138
|
dongsheng@627
|
305 msgid ""
|
dongsheng@627
|
306 "A short numeric string, such as <quote><literal>1.1</literal></quote>. This "
|
dongsheng@627
|
307 "is a build of a revision of Mercurial that was identified by a specific tag "
|
dongsheng@627
|
308 "in the repository where it was built. (This doesn't necessarily mean that "
|
dongsheng@627
|
309 "you're running an official release; someone else could have added that tag to "
|
dongsheng@627
|
310 "any revision in the repository where they built Mercurial.)"
|
dongsheng@627
|
311 msgstr ""
|
dongsheng@627
|
312
|
dongsheng@627
|
313 #. type: Content of: <book><appendix><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
314 #: ../en/appA-cmdref.xml:146
|
dongsheng@627
|
315 msgid ""
|
dongsheng@627
|
316 "A hexadecimal string, such as <quote><literal>875489e31abe</literal></"
|
dongsheng@627
|
317 "quote>. This is a build of the given revision of Mercurial."
|
dongsheng@627
|
318 msgstr ""
|
dongsheng@627
|
319
|
dongsheng@627
|
320 #. type: Content of: <book><appendix><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
321 #: ../en/appA-cmdref.xml:150
|
dongsheng@627
|
322 msgid ""
|
dongsheng@627
|
323 "A hexadecimal string followed by a date, such as <quote><literal>875489e31abe"
|
dongsheng@627
|
324 "+20070205</literal></quote>. This is a build of the given revision of "
|
dongsheng@627
|
325 "Mercurial, where the build repository contained some local changes that had "
|
dongsheng@627
|
326 "not been committed."
|
dongsheng@627
|
327 msgstr ""
|
dongsheng@627
|
328
|
dongsheng@627
|
329 #. type: Content of: <book><appendix><sect2><title>
|
dongsheng@627
|
330 #: ../en/appA-cmdref.xml:159
|
dongsheng@627
|
331 msgid "Tips and tricks"
|
dongsheng@627
|
332 msgstr ""
|
dongsheng@627
|
333
|
dongsheng@627
|
334 #. type: Content of: <book><appendix><sect2><sect3><title>
|
dongsheng@627
|
335 #: ../en/appA-cmdref.xml:162
|
dongsheng@627
|
336 msgid ""
|
dongsheng@627
|
337 "Why do the results of <command role=\"hg-cmd\">hg diff</command> and <command "
|
dongsheng@627
|
338 "role=\"hg-cmd\">hg status</command> differ?"
|
dongsheng@627
|
339 msgstr ""
|
dongsheng@627
|
340 "为什么 <command role=\"hg-cmd\">hg diff</command> 与 <command role=\"hg-cmd"
|
dongsheng@627
|
341 "\">hg status</command> 的结果不同 ?"
|
dongsheng@627
|
342
|
dongsheng@627
|
343 #. type: Content of: <book><appendix><sect2><sect3><para>
|
dongsheng@627
|
344 #: ../en/appA-cmdref.xml:164
|
dongsheng@627
|
345 msgid ""
|
dongsheng@627
|
346 "When you run the <command role=\"hg-cmd\">hg status</command> command, you'll "
|
dongsheng@627
|
347 "see a list of files that Mercurial will record changes for the next time you "
|
dongsheng@627
|
348 "perform a commit. If you run the <command role=\"hg-cmd\">hg diff</command> "
|
dongsheng@627
|
349 "command, you may notice that it prints diffs for only a <emphasis>subset</"
|
dongsheng@627
|
350 "emphasis> of the files that <command role=\"hg-cmd\">hg status</command> "
|
dongsheng@627
|
351 "listed. There are two possible reasons for this."
|
dongsheng@627
|
352 msgstr ""
|
dongsheng@627
|
353
|
dongsheng@627
|
354 #. type: Content of: <book><appendix><sect2><sect3><para>
|
dongsheng@627
|
355 #: ../en/appA-cmdref.xml:171
|
dongsheng@627
|
356 msgid ""
|
dongsheng@627
|
357 "The first is that <command role=\"hg-cmd\">hg status</command> prints some "
|
dongsheng@627
|
358 "kinds of modifications that <command role=\"hg-cmd\">hg diff</command> "
|
dongsheng@627
|
359 "doesn't normally display. The <command role=\"hg-cmd\">hg diff</command> "
|
dongsheng@627
|
360 "command normally outputs unified diffs, which don't have the ability to "
|
dongsheng@627
|
361 "represent some changes that Mercurial can track. Most notably, traditional "
|
dongsheng@627
|
362 "diffs can't represent a change in whether or not a file is executable, but "
|
dongsheng@627
|
363 "Mercurial records this information."
|
dongsheng@627
|
364 msgstr ""
|
dongsheng@627
|
365
|
dongsheng@627
|
366 #. type: Content of: <book><appendix><sect2><sect3><para>
|
dongsheng@627
|
367 #: ../en/appA-cmdref.xml:179
|
dongsheng@627
|
368 msgid ""
|
dongsheng@627
|
369 "If you use the <option role=\"hg-opt-diff\">--git</option> option to <command "
|
dongsheng@627
|
370 "role=\"hg-cmd\">hg diff</command>, it will display <command>git</command>-"
|
dongsheng@627
|
371 "compatible diffs that <emphasis>can</emphasis> display this extra information."
|
dongsheng@627
|
372 msgstr ""
|
dongsheng@627
|
373
|
dongsheng@627
|
374 #. type: Content of: <book><appendix><sect2><sect3><para>
|
dongsheng@627
|
375 #: ../en/appA-cmdref.xml:184
|
dongsheng@627
|
376 msgid ""
|
dongsheng@627
|
377 "The second possible reason that <command role=\"hg-cmd\">hg diff</command> "
|
dongsheng@627
|
378 "might be printing diffs for a subset of the files displayed by <command role="
|
dongsheng@627
|
379 "\"hg-cmd\">hg status</command> is that if you invoke it without any "
|
dongsheng@627
|
380 "arguments, <command role=\"hg-cmd\">hg diff</command> prints diffs against "
|
dongsheng@627
|
381 "the first parent of the working directory. If you have run <command role="
|
dongsheng@627
|
382 "\"hg-cmd\">hg merge</command> to merge two changesets, but you haven't yet "
|
dongsheng@627
|
383 "committed the results of the merge, your working directory has two parents "
|
dongsheng@627
|
384 "(use <command role=\"hg-cmd\">hg parents</command> to see them). While "
|
dongsheng@627
|
385 "<command role=\"hg-cmd\">hg status</command> prints modifications relative to "
|
dongsheng@627
|
386 "<emphasis>both</emphasis> parents after an uncommitted merge, <command role="
|
dongsheng@627
|
387 "\"hg-cmd\">hg diff</command> still operates relative only to the first "
|
dongsheng@627
|
388 "parent. You can get it to print diffs relative to the second parent by "
|
dongsheng@627
|
389 "specifying that parent with the <option role=\"hg-opt-diff\">-r</option> "
|
dongsheng@627
|
390 "option. There is no way to print diffs relative to both parents."
|
dongsheng@627
|
391 msgstr ""
|
dongsheng@627
|
392
|
dongsheng@627
|
393 #. type: Content of: <book><appendix><sect2><sect3><title>
|
dongsheng@627
|
394 #: ../en/appA-cmdref.xml:200
|
dongsheng@627
|
395 msgid "Generating safe binary diffs"
|
dongsheng@627
|
396 msgstr "生成安全的二进制差异"
|
dongsheng@627
|
397
|
dongsheng@627
|
398 #. type: Content of: <book><appendix><sect2><sect3><para>
|
dongsheng@627
|
399 #: ../en/appA-cmdref.xml:202
|
dongsheng@627
|
400 msgid ""
|
dongsheng@627
|
401 "If you use the <option role=\"hg-opt-diff\">-a</option> option to force "
|
dongsheng@627
|
402 "Mercurial to print diffs of files that are either <quote>mostly text</quote> "
|
dongsheng@627
|
403 "or contain lots of binary data, those diffs cannot subsequently be applied by "
|
dongsheng@627
|
404 "either Mercurial's <command role=\"hg-cmd\">hg import</command> command or "
|
dongsheng@627
|
405 "the system's <command>patch</command> command."
|
dongsheng@627
|
406 msgstr ""
|
dongsheng@627
|
407
|
dongsheng@627
|
408 #. type: Content of: <book><appendix><sect2><sect3><para>
|
dongsheng@627
|
409 #: ../en/appA-cmdref.xml:209
|
dongsheng@627
|
410 msgid ""
|
dongsheng@627
|
411 "If you want to generate a diff of a binary file that is safe to use as input "
|
dongsheng@627
|
412 "for <command role=\"hg-cmd\">hg import</command>, use the <command role=\"hg-"
|
dongsheng@627
|
413 "cmd\">hg diff</command>{--git} option when you generate the patch. The "
|
dongsheng@627
|
414 "system <command>patch</command> command cannot handle binary patches at all."
|
dongsheng@627
|
415 msgstr ""
|
dongsheng@627
|
416
|
dongsheng@627
|
417 #. type: Content of: <book><appendix><title>
|
dongsheng@627
|
418 #: ../en/appB-mq-ref.xml:5
|
dongsheng@627
|
419 msgid "Mercurial Queues reference"
|
dongsheng@627
|
420 msgstr "Mercurial 队列参考"
|
dongsheng@627
|
421
|
dongsheng@627
|
422 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@627
|
423 #: ../en/appB-mq-ref.xml:8
|
dongsheng@627
|
424 msgid "MQ command reference"
|
dongsheng@627
|
425 msgstr "MQ 命令参考"
|
dongsheng@627
|
426
|
dongsheng@627
|
427 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
428 #: ../en/appB-mq-ref.xml:10
|
dongsheng@627
|
429 msgid ""
|
dongsheng@627
|
430 "For an overview of the commands provided by MQ, use the command <command role="
|
dongsheng@627
|
431 "\"hg-cmd\">hg help mq</command>."
|
dongsheng@627
|
432 msgstr ""
|
dongsheng@627
|
433
|
dongsheng@627
|
434 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
435 #: ../en/appB-mq-ref.xml:14
|
dongsheng@627
|
436 msgid ""
|
dongsheng@627
|
437 "<command role=\"hg-ext-mq\">qapplied</command>&emdash;print applied patches"
|
dongsheng@627
|
438 msgstr "<command role=\"hg-ext-mq\">qapplied</command>&emdash;显示已应用的补丁"
|
dongsheng@627
|
439
|
dongsheng@627
|
440 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
441 #: ../en/appB-mq-ref.xml:17
|
dongsheng@627
|
442 msgid ""
|
dongsheng@627
|
443 "The <command role=\"hg-ext-mq\">qapplied</command> command prints the current "
|
dongsheng@627
|
444 "stack of applied patches. Patches are printed in oldest-to-newest order, so "
|
dongsheng@627
|
445 "the last patch in the list is the <quote>top</quote> patch."
|
dongsheng@627
|
446 msgstr ""
|
dongsheng@627
|
447
|
dongsheng@627
|
448 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
449 #: ../en/appB-mq-ref.xml:24
|
dongsheng@627
|
450 msgid ""
|
dongsheng@627
|
451 "<command role=\"hg-ext-mq\">qcommit</command>&emdash;commit changes in the "
|
dongsheng@627
|
452 "queue repository"
|
dongsheng@627
|
453 msgstr "<command role=\"hg-ext-mq\">qcommit</command>&emdash;提交队列中的修改"
|
dongsheng@627
|
454
|
dongsheng@627
|
455 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
456 #: ../en/appB-mq-ref.xml:27
|
dongsheng@627
|
457 msgid ""
|
dongsheng@627
|
458 "The <command role=\"hg-ext-mq\">qcommit</command> command commits any "
|
dongsheng@627
|
459 "outstanding changes in the <filename role=\"special\" class=\"directory\">.hg/"
|
dongsheng@627
|
460 "patches</filename> repository. This command only works if the <filename role="
|
dongsheng@627
|
461 "\"special\" class=\"directory\">.hg/patches</filename> directory is a "
|
dongsheng@627
|
462 "repository, i.e. you created the directory using <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
463 "qinit <option role=\"hg-ext-mq-cmd-qinit-opt\">-c</option></command> or ran "
|
dongsheng@627
|
464 "<command role=\"hg-cmd\">hg init</command> in the directory after running "
|
dongsheng@627
|
465 "<command role=\"hg-ext-mq\">qinit</command>."
|
dongsheng@627
|
466 msgstr ""
|
dongsheng@627
|
467
|
dongsheng@627
|
468 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
469 #: ../en/appB-mq-ref.xml:39
|
dongsheng@627
|
470 msgid ""
|
dongsheng@627
|
471 "This command is shorthand for <command role=\"hg-cmd\">hg commit --cwd .hg/"
|
dongsheng@627
|
472 "patches</command>."
|
dongsheng@627
|
473 msgstr ""
|
dongsheng@627
|
474
|
dongsheng@627
|
475 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
476 #: ../en/appB-mq-ref.xml:42
|
dongsheng@627
|
477 msgid ""
|
dongsheng@627
|
478 "\\subsection{<command role=\"hg-ext-mq\">qdelete</command>&emdash;delete a "
|
dongsheng@627
|
479 "patch from the <filename role=\"special\">series</filename> file}"
|
dongsheng@627
|
480 msgstr ""
|
dongsheng@627
|
481
|
dongsheng@627
|
482 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
483 #: ../en/appB-mq-ref.xml:47
|
dongsheng@627
|
484 msgid ""
|
dongsheng@627
|
485 "The <command role=\"hg-ext-mq\">qdelete</command> command removes the entry "
|
dongsheng@627
|
486 "for a patch from the <filename role=\"special\">series</filename> file in the "
|
dongsheng@627
|
487 "<filename role=\"special\" class=\"directory\">.hg/patches</filename> "
|
dongsheng@627
|
488 "directory. It does not pop the patch if the patch is already applied. By "
|
dongsheng@627
|
489 "default, it does not delete the patch file; use the <option role=\"hg-ext-mq-"
|
dongsheng@627
|
490 "cmd-qdel-opt\">-f</option> option to do that."
|
dongsheng@627
|
491 msgstr ""
|
dongsheng@627
|
492
|
dongsheng@627
|
493 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
494 #: ../en/appB-mq-ref.xml:56 ../en/appB-mq-ref.xml:98 ../en/appB-mq-ref.xml:156
|
dongsheng@627
|
495 #: ../en/appB-mq-ref.xml:196 ../en/appB-mq-ref.xml:263
|
dongsheng@627
|
496 #: ../en/appB-mq-ref.xml:334 ../en/appB-mq-ref.xml:403
|
dongsheng@627
|
497 #: ../en/appB-mq-ref.xml:496
|
dongsheng@627
|
498 msgid "Options:"
|
dongsheng@627
|
499 msgstr ""
|
dongsheng@627
|
500
|
dongsheng@627
|
501 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
502 #: ../en/appB-mq-ref.xml:58
|
dongsheng@627
|
503 msgid ""
|
dongsheng@627
|
504 "<option role=\"hg-ext-mq-cmd-qdel-opt\">-f</option>: Delete the patch file."
|
dongsheng@627
|
505 msgstr ""
|
dongsheng@627
|
506
|
dongsheng@627
|
507 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
508 #: ../en/appB-mq-ref.xml:65
|
dongsheng@627
|
509 msgid ""
|
dongsheng@627
|
510 "<command role=\"hg-ext-mq\">qdiff</command>&emdash;print a diff of the "
|
dongsheng@627
|
511 "topmost applied patch"
|
dongsheng@627
|
512 msgstr ""
|
dongsheng@627
|
513 "<command role=\"hg-ext-mq\">qdiff</command>&emdash;显示最新应用补丁的差异"
|
dongsheng@627
|
514
|
dongsheng@627
|
515 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
516 #: ../en/appB-mq-ref.xml:68
|
dongsheng@627
|
517 msgid ""
|
dongsheng@627
|
518 "The <command role=\"hg-ext-mq\">qdiff</command> command prints a diff of the "
|
dongsheng@627
|
519 "topmost applied patch. It is equivalent to <command role=\"hg-cmd\">hg diff -"
|
dongsheng@627
|
520 "r-2:-1</command>."
|
dongsheng@627
|
521 msgstr ""
|
dongsheng@627
|
522
|
dongsheng@627
|
523 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
524 #: ../en/appB-mq-ref.xml:74
|
dongsheng@627
|
525 msgid ""
|
dongsheng@627
|
526 "<command role=\"hg-ext-mq\">qfold</command>&emdash;merge (<quote>fold</"
|
dongsheng@627
|
527 "quote>) several patches into one"
|
dongsheng@627
|
528 msgstr ""
|
dongsheng@627
|
529 "<command role=\"hg-ext-mq\">qfold</command>&emdash;将多个补丁合并(<quote>折叠"
|
dongsheng@627
|
530 "</quote>)成一个"
|
dongsheng@627
|
531
|
dongsheng@627
|
532 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
533 #: ../en/appB-mq-ref.xml:77
|
dongsheng@627
|
534 msgid ""
|
dongsheng@627
|
535 "The <command role=\"hg-ext-mq\">qfold</command> command merges multiple "
|
dongsheng@627
|
536 "patches into the topmost applied patch, so that the topmost applied patch "
|
dongsheng@627
|
537 "makes the union of all of the changes in the patches in question."
|
dongsheng@627
|
538 msgstr ""
|
dongsheng@627
|
539
|
dongsheng@627
|
540 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
541 #: ../en/appB-mq-ref.xml:82
|
dongsheng@627
|
542 msgid ""
|
dongsheng@627
|
543 "The patches to fold must not be applied; <command role=\"hg-ext-mq\">qfold</"
|
dongsheng@627
|
544 "command> will exit with an error if any is. The order in which patches are "
|
dongsheng@627
|
545 "folded is significant; <command role=\"hg-cmd\">hg qfold a b</command> means "
|
dongsheng@627
|
546 "<quote>apply the current topmost patch, followed by <literal>a</literal>, "
|
dongsheng@627
|
547 "followed by <literal>b</literal></quote>."
|
dongsheng@627
|
548 msgstr ""
|
dongsheng@627
|
549
|
dongsheng@627
|
550 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
551 #: ../en/appB-mq-ref.xml:90
|
dongsheng@627
|
552 msgid ""
|
dongsheng@627
|
553 "The comments from the folded patches are appended to the comments of the "
|
dongsheng@627
|
554 "destination patch, with each block of comments separated by three asterisk "
|
dongsheng@627
|
555 "(<quote><literal>*</literal></quote>) characters. Use the <option role=\"hg-"
|
dongsheng@627
|
556 "ext-mq-cmd-qfold-opt\">-e</option> option to edit the commit message for the "
|
dongsheng@627
|
557 "combined patch/changeset after the folding has completed."
|
dongsheng@627
|
558 msgstr ""
|
dongsheng@627
|
559
|
dongsheng@627
|
560 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
561 #: ../en/appB-mq-ref.xml:100
|
dongsheng@627
|
562 msgid ""
|
dongsheng@627
|
563 "<option role=\"hg-ext-mq-cmd-qfold-opt\">-e</option>: Edit the commit message "
|
dongsheng@627
|
564 "and patch description for the newly folded patch."
|
dongsheng@627
|
565 msgstr ""
|
dongsheng@627
|
566
|
dongsheng@627
|
567 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
568 #: ../en/appB-mq-ref.xml:105
|
dongsheng@627
|
569 msgid ""
|
dongsheng@627
|
570 "<option role=\"hg-ext-mq-cmd-qfold-opt\">-l</option>: Use the contents of the "
|
dongsheng@627
|
571 "given file as the new commit message and patch description for the folded "
|
dongsheng@627
|
572 "patch."
|
dongsheng@627
|
573 msgstr ""
|
dongsheng@627
|
574
|
dongsheng@627
|
575 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
576 #: ../en/appB-mq-ref.xml:110
|
dongsheng@627
|
577 msgid ""
|
dongsheng@627
|
578 "<option role=\"hg-ext-mq-cmd-qfold-opt\">-m</option>: Use the given text as "
|
dongsheng@627
|
579 "the new commit message and patch description for the folded patch."
|
dongsheng@627
|
580 msgstr ""
|
dongsheng@627
|
581
|
dongsheng@627
|
582 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
583 #: ../en/appB-mq-ref.xml:118
|
dongsheng@627
|
584 msgid ""
|
dongsheng@627
|
585 "<command role=\"hg-ext-mq\">qheader</command>&emdash;display the header/"
|
dongsheng@627
|
586 "description of a patch"
|
dongsheng@627
|
587 msgstr "<command role=\"hg-ext-mq\">qheader</command>&emdash;显示补丁头部描述"
|
dongsheng@627
|
588
|
dongsheng@627
|
589 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
590 #: ../en/appB-mq-ref.xml:122
|
dongsheng@627
|
591 msgid ""
|
dongsheng@627
|
592 "The <command role=\"hg-ext-mq\">qheader</command> command prints the header, "
|
dongsheng@627
|
593 "or description, of a patch. By default, it prints the header of the topmost "
|
dongsheng@627
|
594 "applied patch. Given an argument, it prints the header of the named patch."
|
dongsheng@627
|
595 msgstr ""
|
dongsheng@627
|
596
|
dongsheng@627
|
597 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
598 #: ../en/appB-mq-ref.xml:129
|
dongsheng@627
|
599 msgid ""
|
dongsheng@627
|
600 "<command role=\"hg-ext-mq\">qimport</command>&emdash;import a third-party "
|
dongsheng@627
|
601 "patch into the queue"
|
dongsheng@627
|
602 msgstr ""
|
dongsheng@627
|
603 "<command role=\"hg-ext-mq\">qimport</command>&emdash;将第三方补丁导入队列"
|
dongsheng@627
|
604
|
dongsheng@627
|
605 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
606 #: ../en/appB-mq-ref.xml:132
|
dongsheng@627
|
607 msgid ""
|
dongsheng@627
|
608 "The <command role=\"hg-ext-mq\">qimport</command> command adds an entry for "
|
dongsheng@627
|
609 "an external patch to the <filename role=\"special\">series</filename> file, "
|
dongsheng@627
|
610 "and copies the patch into the <filename role=\"special\" class=\"directory\">."
|
dongsheng@627
|
611 "hg/patches</filename> directory. It adds the entry immediately after the "
|
dongsheng@627
|
612 "topmost applied patch, but does not push the patch."
|
dongsheng@627
|
613 msgstr ""
|
dongsheng@627
|
614
|
dongsheng@627
|
615 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
616 #: ../en/appB-mq-ref.xml:140
|
dongsheng@627
|
617 msgid ""
|
dongsheng@627
|
618 "If the <filename role=\"special\" class=\"directory\">.hg/patches</filename> "
|
dongsheng@627
|
619 "directory is a repository, <command role=\"hg-ext-mq\">qimport</command> "
|
dongsheng@627
|
620 "automatically does an <command role=\"hg-cmd\">hg add</command> of the "
|
dongsheng@627
|
621 "imported patch."
|
dongsheng@627
|
622 msgstr ""
|
dongsheng@627
|
623
|
dongsheng@627
|
624 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
625 #: ../en/appB-mq-ref.xml:148
|
dongsheng@627
|
626 msgid ""
|
dongsheng@627
|
627 "<command role=\"hg-ext-mq\">qinit</command>&emdash;prepare a repository to "
|
dongsheng@627
|
628 "work with MQ"
|
dongsheng@627
|
629 msgstr "<command role=\"hg-ext-mq\">qinit</command>&emdash;为使用 MQ 配置版本库"
|
dongsheng@627
|
630
|
dongsheng@627
|
631 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
632 #: ../en/appB-mq-ref.xml:151
|
dongsheng@627
|
633 msgid ""
|
dongsheng@627
|
634 "The <command role=\"hg-ext-mq\">qinit</command> command prepares a repository "
|
dongsheng@627
|
635 "to work with MQ. It creates a directory called <filename role=\"special\" "
|
dongsheng@627
|
636 "class=\"directory\">.hg/patches</filename>."
|
dongsheng@627
|
637 msgstr ""
|
dongsheng@627
|
638
|
dongsheng@627
|
639 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
640 #: ../en/appB-mq-ref.xml:158
|
dongsheng@627
|
641 msgid ""
|
dongsheng@627
|
642 "<option role=\"hg-ext-mq-cmd-qinit-opt\">-c</option>: Create <filename role="
|
dongsheng@627
|
643 "\"special\" class=\"directory\">.hg/patches</filename> as a repository in its "
|
dongsheng@627
|
644 "own right. Also creates a <filename role=\"special\">.hgignore</filename> "
|
dongsheng@627
|
645 "file that will ignore the <filename role=\"special\">status</filename> file."
|
dongsheng@627
|
646 msgstr ""
|
dongsheng@627
|
647
|
dongsheng@627
|
648 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
649 #: ../en/appB-mq-ref.xml:168
|
dongsheng@627
|
650 msgid ""
|
dongsheng@627
|
651 "When the <filename role=\"special\" class=\"directory\">.hg/patches</"
|
dongsheng@627
|
652 "filename> directory is a repository, the <command role=\"hg-ext-mq\">qimport</"
|
dongsheng@627
|
653 "command> and <command role=\"hg-ext-mq\">qnew</command> commands "
|
dongsheng@627
|
654 "automatically <command role=\"hg-cmd\">hg add</command> new patches."
|
dongsheng@627
|
655 msgstr ""
|
dongsheng@627
|
656
|
dongsheng@627
|
657 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
658 #: ../en/appB-mq-ref.xml:177
|
dongsheng@627
|
659 msgid "<command role=\"hg-ext-mq\">qnew</command>&emdash;create a new patch"
|
dongsheng@627
|
660 msgstr "<command role=\"hg-ext-mq\">qnew</command>&emdash;创建新补丁"
|
dongsheng@627
|
661
|
dongsheng@627
|
662 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
663 #: ../en/appB-mq-ref.xml:180
|
dongsheng@627
|
664 msgid ""
|
dongsheng@627
|
665 "The <command role=\"hg-ext-mq\">qnew</command> command creates a new patch. "
|
dongsheng@627
|
666 "It takes one mandatory argument, the name to use for the patch file. The "
|
dongsheng@627
|
667 "newly created patch is created empty by default. It is added to the "
|
dongsheng@627
|
668 "<filename role=\"special\">series</filename> file after the current topmost "
|
dongsheng@627
|
669 "applied patch, and is immediately pushed on top of that patch."
|
dongsheng@627
|
670 msgstr ""
|
dongsheng@627
|
671
|
dongsheng@627
|
672 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
673 #: ../en/appB-mq-ref.xml:188
|
dongsheng@627
|
674 msgid ""
|
dongsheng@627
|
675 "If <command role=\"hg-ext-mq\">qnew</command> finds modified files in the "
|
dongsheng@627
|
676 "working directory, it will refuse to create a new patch unless the <option "
|
dongsheng@627
|
677 "role=\"hg-ext-mq-cmd-qnew-opt\">-f</option> option is used (see below). This "
|
dongsheng@627
|
678 "behaviour allows you to <command role=\"hg-ext-mq\">qrefresh</command> your "
|
dongsheng@627
|
679 "topmost applied patch before you apply a new patch on top of it."
|
dongsheng@627
|
680 msgstr ""
|
dongsheng@627
|
681
|
dongsheng@627
|
682 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
683 #: ../en/appB-mq-ref.xml:198
|
dongsheng@627
|
684 msgid ""
|
dongsheng@627
|
685 "<option role=\"hg-ext-mq-cmd-qnew-opt\">-f</option>: Create a new patch if "
|
dongsheng@627
|
686 "the contents of the working directory are modified. Any outstanding "
|
dongsheng@627
|
687 "modifications are added to the newly created patch, so after this command "
|
dongsheng@627
|
688 "completes, the working directory will no longer be modified."
|
dongsheng@627
|
689 msgstr ""
|
dongsheng@627
|
690
|
dongsheng@627
|
691 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
692 #: ../en/appB-mq-ref.xml:205
|
dongsheng@627
|
693 msgid ""
|
dongsheng@627
|
694 "<option role=\"hg-ext-mq-cmd-qnew-opt\">-m</option>: Use the given text as "
|
dongsheng@627
|
695 "the commit message. This text will be stored at the beginning of the patch "
|
dongsheng@627
|
696 "file, before the patch data."
|
dongsheng@627
|
697 msgstr ""
|
dongsheng@627
|
698
|
dongsheng@627
|
699 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
700 #: ../en/appB-mq-ref.xml:214
|
dongsheng@627
|
701 msgid ""
|
dongsheng@627
|
702 "<command role=\"hg-ext-mq\">qnext</command>&emdash;print the name of the next "
|
dongsheng@627
|
703 "patch"
|
dongsheng@627
|
704 msgstr "<command role=\"hg-ext-mq\">qnext</command>&emdash;显示下个补丁的名称"
|
dongsheng@627
|
705
|
dongsheng@627
|
706 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
707 #: ../en/appB-mq-ref.xml:217
|
dongsheng@627
|
708 msgid ""
|
dongsheng@627
|
709 "The <command role=\"hg-ext-mq\">qnext</command> command prints the name name "
|
dongsheng@627
|
710 "of the next patch in the <filename role=\"special\">series</filename> file "
|
dongsheng@627
|
711 "after the topmost applied patch. This patch will become the topmost applied "
|
dongsheng@627
|
712 "patch if you run <command role=\"hg-ext-mq\">qpush</command>."
|
dongsheng@627
|
713 msgstr ""
|
dongsheng@627
|
714
|
dongsheng@627
|
715 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
716 #: ../en/appB-mq-ref.xml:226
|
dongsheng@627
|
717 msgid ""
|
dongsheng@627
|
718 "<command role=\"hg-ext-mq\">qpop</command>&emdash;pop patches off the stack"
|
dongsheng@627
|
719 msgstr "<command role=\"hg-ext-mq\">qpop</command>&emdash;删除堆栈顶部的补丁"
|
dongsheng@627
|
720
|
dongsheng@627
|
721 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
722 #: ../en/appB-mq-ref.xml:229
|
dongsheng@627
|
723 msgid ""
|
dongsheng@627
|
724 "The <command role=\"hg-ext-mq\">qpop</command> command removes applied "
|
dongsheng@627
|
725 "patches from the top of the stack of applied patches. By default, it removes "
|
dongsheng@627
|
726 "only one patch."
|
dongsheng@627
|
727 msgstr ""
|
dongsheng@627
|
728
|
dongsheng@627
|
729 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
730 #: ../en/appB-mq-ref.xml:233
|
dongsheng@627
|
731 msgid ""
|
dongsheng@627
|
732 "This command removes the changesets that represent the popped patches from "
|
dongsheng@627
|
733 "the repository, and updates the working directory to undo the effects of the "
|
dongsheng@627
|
734 "patches."
|
dongsheng@627
|
735 msgstr ""
|
dongsheng@627
|
736
|
dongsheng@627
|
737 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
738 #: ../en/appB-mq-ref.xml:237
|
dongsheng@627
|
739 msgid ""
|
dongsheng@627
|
740 "This command takes an optional argument, which it uses as the name or index "
|
dongsheng@627
|
741 "of the patch to pop to. If given a name, it will pop patches until the named "
|
dongsheng@627
|
742 "patch is the topmost applied patch. If given a number, <command role=\"hg-"
|
dongsheng@627
|
743 "ext-mq\">qpop</command> treats the number as an index into the entries in the "
|
dongsheng@627
|
744 "series file, counting from zero (empty lines and lines containing only "
|
dongsheng@627
|
745 "comments do not count). It pops patches until the patch identified by the "
|
dongsheng@627
|
746 "given index is the topmost applied patch."
|
dongsheng@627
|
747 msgstr ""
|
dongsheng@627
|
748
|
dongsheng@627
|
749 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
750 #: ../en/appB-mq-ref.xml:247
|
dongsheng@627
|
751 msgid ""
|
dongsheng@627
|
752 "The <command role=\"hg-ext-mq\">qpop</command> command does not read or write "
|
dongsheng@627
|
753 "patches or the <filename role=\"special\">series</filename> file. It is thus "
|
dongsheng@627
|
754 "safe to <command role=\"hg-ext-mq\">qpop</command> a patch that you have "
|
dongsheng@627
|
755 "removed from the <filename role=\"special\">series</filename> file, or a "
|
dongsheng@627
|
756 "patch that you have renamed or deleted entirely. In the latter two cases, "
|
dongsheng@627
|
757 "use the name of the patch as it was when you applied it."
|
dongsheng@627
|
758 msgstr ""
|
dongsheng@627
|
759
|
dongsheng@627
|
760 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
761 #: ../en/appB-mq-ref.xml:256
|
dongsheng@627
|
762 msgid ""
|
dongsheng@627
|
763 "By default, the <command role=\"hg-ext-mq\">qpop</command> command will not "
|
dongsheng@627
|
764 "pop any patches if the working directory has been modified. You can override "
|
dongsheng@627
|
765 "this behaviour using the <option role=\"hg-ext-mq-cmd-qpop-opt\">-f</option> "
|
dongsheng@627
|
766 "option, which reverts all modifications in the working directory."
|
dongsheng@627
|
767 msgstr ""
|
dongsheng@627
|
768
|
dongsheng@627
|
769 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
770 #: ../en/appB-mq-ref.xml:265
|
dongsheng@627
|
771 msgid ""
|
dongsheng@627
|
772 "<option role=\"hg-ext-mq-cmd-qpop-opt\">-a</option>: Pop all applied "
|
dongsheng@627
|
773 "patches. This returns the repository to its state before you applied any "
|
dongsheng@627
|
774 "patches."
|
dongsheng@627
|
775 msgstr ""
|
dongsheng@627
|
776
|
dongsheng@627
|
777 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
778 #: ../en/appB-mq-ref.xml:270
|
dongsheng@627
|
779 msgid ""
|
dongsheng@627
|
780 "<option role=\"hg-ext-mq-cmd-qpop-opt\">-f</option>: Forcibly revert any "
|
dongsheng@627
|
781 "modifications to the working directory when popping."
|
dongsheng@627
|
782 msgstr ""
|
dongsheng@627
|
783
|
dongsheng@627
|
784 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
785 #: ../en/appB-mq-ref.xml:275
|
dongsheng@627
|
786 msgid ""
|
dongsheng@627
|
787 "<option role=\"hg-ext-mq-cmd-qpop-opt\">-n</option>: Pop a patch from the "
|
dongsheng@627
|
788 "named queue."
|
dongsheng@627
|
789 msgstr ""
|
dongsheng@627
|
790
|
dongsheng@627
|
791 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
792 #: ../en/appB-mq-ref.xml:280
|
dongsheng@627
|
793 msgid ""
|
dongsheng@627
|
794 "The <command role=\"hg-ext-mq\">qpop</command> command removes one line from "
|
dongsheng@627
|
795 "the end of the <filename role=\"special\">status</filename> file for each "
|
dongsheng@627
|
796 "patch that it pops."
|
dongsheng@627
|
797 msgstr ""
|
dongsheng@627
|
798
|
dongsheng@627
|
799 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
800 #: ../en/appB-mq-ref.xml:287
|
dongsheng@627
|
801 msgid ""
|
dongsheng@627
|
802 "<command role=\"hg-ext-mq\">qprev</command>&emdash;print the name of the "
|
dongsheng@627
|
803 "previous patch"
|
dongsheng@627
|
804 msgstr "<command role=\"hg-ext-mq\">qprev</command>&emdash;显示上个补丁的名称"
|
dongsheng@627
|
805
|
dongsheng@627
|
806 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
807 #: ../en/appB-mq-ref.xml:290
|
dongsheng@627
|
808 msgid ""
|
dongsheng@627
|
809 "The <command role=\"hg-ext-mq\">qprev</command> command prints the name of "
|
dongsheng@627
|
810 "the patch in the <filename role=\"special\">series</filename> file that comes "
|
dongsheng@627
|
811 "before the topmost applied patch. This will become the topmost applied patch "
|
dongsheng@627
|
812 "if you run <command role=\"hg-ext-mq\">qpop</command>."
|
dongsheng@627
|
813 msgstr ""
|
dongsheng@627
|
814
|
dongsheng@627
|
815 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
816 #: ../en/appB-mq-ref.xml:299
|
dongsheng@627
|
817 msgid ""
|
dongsheng@627
|
818 "<command role=\"hg-ext-mq\">qpush</command>&emdash;push patches onto the stack"
|
dongsheng@627
|
819 msgstr "<command role=\"hg-ext-mq\">qpush</command>&emdash;增加补丁到堆栈"
|
dongsheng@627
|
820
|
dongsheng@627
|
821 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
822 #: ../en/appB-mq-ref.xml:302
|
dongsheng@627
|
823 msgid ""
|
dongsheng@627
|
824 "The <command role=\"hg-ext-mq\">qpush</command> command adds patches onto the "
|
dongsheng@627
|
825 "applied stack. By default, it adds only one patch."
|
dongsheng@627
|
826 msgstr ""
|
dongsheng@627
|
827
|
dongsheng@627
|
828 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
829 #: ../en/appB-mq-ref.xml:306
|
dongsheng@627
|
830 msgid ""
|
dongsheng@627
|
831 "This command creates a new changeset to represent each applied patch, and "
|
dongsheng@627
|
832 "updates the working directory to apply the effects of the patches."
|
dongsheng@627
|
833 msgstr ""
|
dongsheng@627
|
834
|
dongsheng@627
|
835 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
836 #: ../en/appB-mq-ref.xml:310
|
dongsheng@627
|
837 msgid "The default data used when creating a changeset are as follows:"
|
dongsheng@627
|
838 msgstr ""
|
dongsheng@627
|
839
|
dongsheng@627
|
840 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
841 #: ../en/appB-mq-ref.xml:313
|
dongsheng@627
|
842 msgid ""
|
dongsheng@627
|
843 "The commit date and time zone are the current date and time zone. Because "
|
dongsheng@627
|
844 "these data are used to compute the identity of a changeset, this means that "
|
dongsheng@627
|
845 "if you <command role=\"hg-ext-mq\">qpop</command> a patch and <command role="
|
dongsheng@627
|
846 "\"hg-ext-mq\">qpush</command> it again, the changeset that you push will have "
|
dongsheng@627
|
847 "a different identity than the changeset you popped."
|
dongsheng@627
|
848 msgstr ""
|
dongsheng@627
|
849
|
dongsheng@627
|
850 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
851 #: ../en/appB-mq-ref.xml:321
|
dongsheng@627
|
852 msgid ""
|
dongsheng@627
|
853 "The author is the same as the default used by the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
854 "commit</command> command."
|
dongsheng@627
|
855 msgstr ""
|
dongsheng@627
|
856
|
dongsheng@627
|
857 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
858 #: ../en/appB-mq-ref.xml:325
|
dongsheng@627
|
859 msgid ""
|
dongsheng@627
|
860 "The commit message is any text from the patch file that comes before the "
|
dongsheng@627
|
861 "first diff header. If there is no such text, a default commit message is "
|
dongsheng@627
|
862 "used that identifies the name of the patch."
|
dongsheng@627
|
863 msgstr ""
|
dongsheng@627
|
864
|
dongsheng@627
|
865 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
866 #: ../en/appB-mq-ref.xml:330
|
dongsheng@627
|
867 msgid ""
|
dongsheng@627
|
868 "If a patch contains a Mercurial patch header (XXX add link), the information "
|
dongsheng@627
|
869 "in the patch header overrides these defaults."
|
dongsheng@627
|
870 msgstr ""
|
dongsheng@627
|
871
|
dongsheng@627
|
872 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
873 #: ../en/appB-mq-ref.xml:336
|
dongsheng@627
|
874 msgid ""
|
dongsheng@627
|
875 "<option role=\"hg-ext-mq-cmd-qpush-opt\">-a</option>: Push all unapplied "
|
dongsheng@627
|
876 "patches from the <filename role=\"special\">series</filename> file until "
|
dongsheng@627
|
877 "there are none left to push."
|
dongsheng@627
|
878 msgstr ""
|
dongsheng@627
|
879
|
dongsheng@627
|
880 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
881 #: ../en/appB-mq-ref.xml:342
|
dongsheng@627
|
882 msgid ""
|
dongsheng@627
|
883 "<option role=\"hg-ext-mq-cmd-qpush-opt\">-l</option>: Add the name of the "
|
dongsheng@627
|
884 "patch to the end of the commit message."
|
dongsheng@627
|
885 msgstr ""
|
dongsheng@627
|
886
|
dongsheng@627
|
887 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
888 #: ../en/appB-mq-ref.xml:346
|
dongsheng@627
|
889 msgid ""
|
dongsheng@627
|
890 "<option role=\"hg-ext-mq-cmd-qpush-opt\">-m</option>: If a patch fails to "
|
dongsheng@627
|
891 "apply cleanly, use the entry for the patch in another saved queue to compute "
|
dongsheng@627
|
892 "the parameters for a three-way merge, and perform a three-way merge using the "
|
dongsheng@627
|
893 "normal Mercurial merge machinery. Use the resolution of the merge as the new "
|
dongsheng@627
|
894 "patch content."
|
dongsheng@627
|
895 msgstr ""
|
dongsheng@627
|
896
|
dongsheng@627
|
897 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
898 #: ../en/appB-mq-ref.xml:354
|
dongsheng@627
|
899 msgid ""
|
dongsheng@627
|
900 "<option role=\"hg-ext-mq-cmd-qpush-opt\">-n</option>: Use the named queue if "
|
dongsheng@627
|
901 "merging while pushing."
|
dongsheng@627
|
902 msgstr ""
|
dongsheng@627
|
903
|
dongsheng@627
|
904 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
905 #: ../en/appB-mq-ref.xml:359
|
dongsheng@627
|
906 msgid ""
|
dongsheng@627
|
907 "The <command role=\"hg-ext-mq\">qpush</command> command reads, but does not "
|
dongsheng@627
|
908 "modify, the <filename role=\"special\">series</filename> file. It appends "
|
dongsheng@627
|
909 "one line to the <command role=\"hg-cmd\">hg status</command> file for each "
|
dongsheng@627
|
910 "patch that it pushes."
|
dongsheng@627
|
911 msgstr ""
|
dongsheng@627
|
912
|
dongsheng@627
|
913 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
914 #: ../en/appB-mq-ref.xml:367
|
dongsheng@627
|
915 msgid ""
|
dongsheng@627
|
916 "<command role=\"hg-ext-mq\">qrefresh</command>&emdash;update the topmost "
|
dongsheng@627
|
917 "applied patch"
|
dongsheng@627
|
918 msgstr "<command role=\"hg-ext-mq\">qrefresh</command>&emdash;更新最新的补丁"
|
dongsheng@627
|
919
|
dongsheng@627
|
920 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
921 #: ../en/appB-mq-ref.xml:371
|
dongsheng@627
|
922 msgid ""
|
dongsheng@627
|
923 "The <command role=\"hg-ext-mq\">qrefresh</command> command updates the "
|
dongsheng@627
|
924 "topmost applied patch. It modifies the patch, removes the old changeset that "
|
dongsheng@627
|
925 "represented the patch, and creates a new changeset to represent the modified "
|
dongsheng@627
|
926 "patch."
|
dongsheng@627
|
927 msgstr ""
|
dongsheng@627
|
928
|
dongsheng@627
|
929 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
930 #: ../en/appB-mq-ref.xml:377
|
dongsheng@627
|
931 msgid ""
|
dongsheng@627
|
932 "The <command role=\"hg-ext-mq\">qrefresh</command> command looks for the "
|
dongsheng@627
|
933 "following modifications:"
|
dongsheng@627
|
934 msgstr ""
|
dongsheng@627
|
935
|
dongsheng@627
|
936 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
937 #: ../en/appB-mq-ref.xml:380
|
dongsheng@627
|
938 msgid ""
|
dongsheng@627
|
939 "Changes to the commit message, i.e. the text before the first diff header in "
|
dongsheng@627
|
940 "the patch file, are reflected in the new changeset that represents the patch."
|
dongsheng@627
|
941 msgstr ""
|
dongsheng@627
|
942
|
dongsheng@627
|
943 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
944 #: ../en/appB-mq-ref.xml:385
|
dongsheng@627
|
945 msgid ""
|
dongsheng@627
|
946 "Modifications to tracked files in the working directory are added to the "
|
dongsheng@627
|
947 "patch."
|
dongsheng@627
|
948 msgstr ""
|
dongsheng@627
|
949
|
dongsheng@627
|
950 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
951 #: ../en/appB-mq-ref.xml:388
|
dongsheng@627
|
952 msgid ""
|
dongsheng@627
|
953 "Changes to the files tracked using <command role=\"hg-cmd\">hg add</command>, "
|
dongsheng@627
|
954 "<command role=\"hg-cmd\">hg copy</command>, <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
955 "remove</command>, or <command role=\"hg-cmd\">hg rename</command>. Added "
|
dongsheng@627
|
956 "files and copy and rename destinations are added to the patch, while removed "
|
dongsheng@627
|
957 "files and rename sources are removed."
|
dongsheng@627
|
958 msgstr ""
|
dongsheng@627
|
959
|
dongsheng@627
|
960 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
961 #: ../en/appB-mq-ref.xml:397
|
dongsheng@627
|
962 msgid ""
|
dongsheng@627
|
963 "Even if <command role=\"hg-ext-mq\">qrefresh</command> detects no changes, it "
|
dongsheng@627
|
964 "still recreates the changeset that represents the patch. This causes the "
|
dongsheng@627
|
965 "identity of the changeset to differ from the previous changeset that "
|
dongsheng@627
|
966 "identified the patch."
|
dongsheng@627
|
967 msgstr ""
|
dongsheng@627
|
968
|
dongsheng@627
|
969 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
970 #: ../en/appB-mq-ref.xml:405
|
dongsheng@627
|
971 msgid ""
|
dongsheng@627
|
972 "<option role=\"hg-ext-mq-cmd-qrefresh-opt\">-e</option>: Modify the commit "
|
dongsheng@627
|
973 "and patch description, using the preferred text editor."
|
dongsheng@627
|
974 msgstr ""
|
dongsheng@627
|
975
|
dongsheng@627
|
976 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
977 #: ../en/appB-mq-ref.xml:410
|
dongsheng@627
|
978 msgid ""
|
dongsheng@627
|
979 "<option role=\"hg-ext-mq-cmd-qrefresh-opt\">-m</option>: Modify the commit "
|
dongsheng@627
|
980 "message and patch description, using the given text."
|
dongsheng@627
|
981 msgstr ""
|
dongsheng@627
|
982
|
dongsheng@627
|
983 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
984 #: ../en/appB-mq-ref.xml:415
|
dongsheng@627
|
985 msgid ""
|
dongsheng@627
|
986 "<option role=\"hg-ext-mq-cmd-qrefresh-opt\">-l</option>: Modify the commit "
|
dongsheng@627
|
987 "message and patch description, using text from the given file."
|
dongsheng@627
|
988 msgstr ""
|
dongsheng@627
|
989
|
dongsheng@627
|
990 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
991 #: ../en/appB-mq-ref.xml:423
|
dongsheng@627
|
992 msgid "<command role=\"hg-ext-mq\">qrename</command>&emdash;rename a patch"
|
dongsheng@627
|
993 msgstr "<command role=\"hg-ext-mq\">qrename</command>&emdash;改名补丁"
|
dongsheng@627
|
994
|
dongsheng@627
|
995 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
996 #: ../en/appB-mq-ref.xml:426
|
dongsheng@627
|
997 msgid ""
|
dongsheng@627
|
998 "The <command role=\"hg-ext-mq\">qrename</command> command renames a patch, "
|
dongsheng@627
|
999 "and changes the entry for the patch in the <filename role=\"special\">series</"
|
dongsheng@627
|
1000 "filename> file."
|
dongsheng@627
|
1001 msgstr ""
|
dongsheng@627
|
1002
|
dongsheng@627
|
1003 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
1004 #: ../en/appB-mq-ref.xml:430
|
dongsheng@627
|
1005 msgid ""
|
dongsheng@627
|
1006 "With a single argument, <command role=\"hg-ext-mq\">qrename</command> renames "
|
dongsheng@627
|
1007 "the topmost applied patch. With two arguments, it renames its first argument "
|
dongsheng@627
|
1008 "to its second."
|
dongsheng@627
|
1009 msgstr ""
|
dongsheng@627
|
1010
|
dongsheng@627
|
1011 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
1012 #: ../en/appB-mq-ref.xml:437
|
dongsheng@627
|
1013 msgid ""
|
dongsheng@627
|
1014 "<command role=\"hg-ext-mq\">qrestore</command>&emdash;restore saved queue "
|
dongsheng@627
|
1015 "state"
|
dongsheng@627
|
1016 msgstr "<command role=\"hg-ext-mq\">qrestore</command>&emdash;恢复保存的队列"
|
dongsheng@627
|
1017
|
dongsheng@627
|
1018 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
1019 #: ../en/appB-mq-ref.xml:441
|
dongsheng@627
|
1020 msgid "XXX No idea what this does."
|
dongsheng@627
|
1021 msgstr ""
|
dongsheng@627
|
1022
|
dongsheng@627
|
1023 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
1024 #: ../en/appB-mq-ref.xml:445
|
dongsheng@627
|
1025 msgid ""
|
dongsheng@627
|
1026 "<command role=\"hg-ext-mq\">qsave</command>&emdash;save current queue state"
|
dongsheng@627
|
1027 msgstr "<command role=\"hg-ext-mq\">qsave</command>&emdash;保存当前的队列状态"
|
dongsheng@627
|
1028
|
dongsheng@627
|
1029 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
1030 #: ../en/appB-mq-ref.xml:448
|
dongsheng@627
|
1031 msgid "XXX Likewise."
|
dongsheng@627
|
1032 msgstr ""
|
dongsheng@627
|
1033
|
dongsheng@627
|
1034 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
1035 #: ../en/appB-mq-ref.xml:452
|
dongsheng@627
|
1036 msgid ""
|
dongsheng@627
|
1037 "<command role=\"hg-ext-mq\">qseries</command>&emdash;print the entire patch "
|
dongsheng@627
|
1038 "series"
|
dongsheng@627
|
1039 msgstr "<command role=\"hg-ext-mq\">qseries</command>&emdash;显示补丁序列"
|
dongsheng@627
|
1040
|
dongsheng@627
|
1041 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
1042 #: ../en/appB-mq-ref.xml:455
|
dongsheng@627
|
1043 msgid ""
|
dongsheng@627
|
1044 "The <command role=\"hg-ext-mq\">qseries</command> command prints the entire "
|
dongsheng@627
|
1045 "patch series from the <filename role=\"special\">series</filename> file. It "
|
dongsheng@627
|
1046 "prints only patch names, not empty lines or comments. It prints in order "
|
dongsheng@627
|
1047 "from first to be applied to last."
|
dongsheng@627
|
1048 msgstr ""
|
dongsheng@627
|
1049
|
dongsheng@627
|
1050 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
1051 #: ../en/appB-mq-ref.xml:463
|
dongsheng@627
|
1052 msgid ""
|
dongsheng@627
|
1053 "<command role=\"hg-ext-mq\">qtop</command>&emdash;print the name of the "
|
dongsheng@627
|
1054 "current patch"
|
dongsheng@627
|
1055 msgstr "<command role=\"hg-ext-mq\">qtop</command>&emdash;显示当前补丁的名称"
|
dongsheng@627
|
1056
|
dongsheng@627
|
1057 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
1058 #: ../en/appB-mq-ref.xml:466
|
dongsheng@627
|
1059 msgid ""
|
dongsheng@627
|
1060 "The <command role=\"hg-ext-mq\">qtop</command> prints the name of the topmost "
|
dongsheng@627
|
1061 "currently applied patch."
|
dongsheng@627
|
1062 msgstr ""
|
dongsheng@627
|
1063
|
dongsheng@627
|
1064 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
1065 #: ../en/appB-mq-ref.xml:471
|
dongsheng@627
|
1066 msgid ""
|
dongsheng@627
|
1067 "<command role=\"hg-ext-mq\">qunapplied</command>&emdash;print patches not yet "
|
dongsheng@627
|
1068 "applied"
|
dongsheng@627
|
1069 msgstr ""
|
dongsheng@627
|
1070 "<command role=\"hg-ext-mq\">qunapplied</command>&emdash;显示尚未应用的补丁"
|
dongsheng@627
|
1071
|
dongsheng@627
|
1072 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
1073 #: ../en/appB-mq-ref.xml:475
|
dongsheng@627
|
1074 msgid ""
|
dongsheng@627
|
1075 "The <command role=\"hg-ext-mq\">qunapplied</command> command prints the names "
|
dongsheng@627
|
1076 "of patches from the <filename role=\"special\">series</filename> file that "
|
dongsheng@627
|
1077 "are not yet applied. It prints them in order from the next patch that will "
|
dongsheng@627
|
1078 "be pushed to the last."
|
dongsheng@627
|
1079 msgstr ""
|
dongsheng@627
|
1080
|
dongsheng@627
|
1081 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
1082 #: ../en/appB-mq-ref.xml:483
|
dongsheng@627
|
1083 msgid ""
|
dongsheng@627
|
1084 "<command role=\"hg-cmd\">hg strip</command>&emdash;remove a revision and "
|
dongsheng@627
|
1085 "descendants"
|
dongsheng@627
|
1086 msgstr "<command role=\"hg-cmd\">hg strip</command>&emdash;删除一个版本及其后继"
|
dongsheng@627
|
1087
|
dongsheng@627
|
1088 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
1089 #: ../en/appB-mq-ref.xml:486
|
dongsheng@627
|
1090 msgid ""
|
dongsheng@627
|
1091 "The <command role=\"hg-cmd\">hg strip</command> command removes a revision, "
|
dongsheng@627
|
1092 "and all of its descendants, from the repository. It undoes the effects of "
|
dongsheng@627
|
1093 "the removed revisions from the repository, and updates the working directory "
|
dongsheng@627
|
1094 "to the first parent of the removed revision."
|
dongsheng@627
|
1095 msgstr ""
|
dongsheng@627
|
1096
|
dongsheng@627
|
1097 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
1098 #: ../en/appB-mq-ref.xml:492
|
dongsheng@627
|
1099 msgid ""
|
dongsheng@627
|
1100 "The <command role=\"hg-cmd\">hg strip</command> command saves a backup of the "
|
dongsheng@627
|
1101 "removed changesets in a bundle, so that they can be reapplied if removed in "
|
dongsheng@627
|
1102 "error."
|
dongsheng@627
|
1103 msgstr ""
|
dongsheng@627
|
1104
|
dongsheng@627
|
1105 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
1106 #: ../en/appB-mq-ref.xml:498
|
dongsheng@627
|
1107 msgid ""
|
dongsheng@627
|
1108 "<option role=\"hg-opt-strip\">-b</option>: Save unrelated changesets that are "
|
dongsheng@627
|
1109 "intermixed with the stripped changesets in the backup bundle."
|
dongsheng@627
|
1110 msgstr ""
|
dongsheng@627
|
1111
|
dongsheng@627
|
1112 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
1113 #: ../en/appB-mq-ref.xml:502
|
dongsheng@627
|
1114 msgid ""
|
dongsheng@627
|
1115 "<option role=\"hg-opt-strip\">-f</option>: If a branch has multiple heads, "
|
dongsheng@627
|
1116 "remove all heads. XXX This should be renamed, and use <literal>-f</literal> "
|
dongsheng@627
|
1117 "to strip revs when there are pending changes."
|
dongsheng@627
|
1118 msgstr ""
|
dongsheng@627
|
1119
|
dongsheng@627
|
1120 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
1121 #: ../en/appB-mq-ref.xml:507
|
dongsheng@627
|
1122 msgid "<option role=\"hg-opt-strip\">-n</option>: Do not save a backup bundle."
|
dongsheng@627
|
1123 msgstr ""
|
dongsheng@627
|
1124
|
dongsheng@627
|
1125 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@627
|
1126 #: ../en/appB-mq-ref.xml:514
|
dongsheng@627
|
1127 msgid "MQ file reference"
|
dongsheng@627
|
1128 msgstr "MQ 文件参考"
|
dongsheng@627
|
1129
|
dongsheng@627
|
1130 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
1131 #: ../en/appB-mq-ref.xml:517
|
dongsheng@627
|
1132 msgid "The <filename role=\"special\">series</filename> file"
|
dongsheng@627
|
1133 msgstr "<filename role=\"special\">序列</filename>文件"
|
dongsheng@627
|
1134
|
dongsheng@627
|
1135 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
1136 #: ../en/appB-mq-ref.xml:520
|
dongsheng@627
|
1137 msgid ""
|
dongsheng@627
|
1138 "The <filename role=\"special\">series</filename> file contains a list of the "
|
dongsheng@627
|
1139 "names of all patches that MQ can apply. It is represented as a list of "
|
dongsheng@627
|
1140 "names, with one name saved per line. Leading and trailing white space in "
|
dongsheng@627
|
1141 "each line are ignored."
|
dongsheng@627
|
1142 msgstr ""
|
dongsheng@627
|
1143
|
dongsheng@627
|
1144 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
1145 #: ../en/appB-mq-ref.xml:526
|
dongsheng@627
|
1146 msgid ""
|
dongsheng@627
|
1147 "Lines may contain comments. A comment begins with the <quote><literal>#</"
|
dongsheng@627
|
1148 "literal></quote> character, and extends to the end of the line. Empty lines, "
|
dongsheng@627
|
1149 "and lines that contain only comments, are ignored."
|
dongsheng@627
|
1150 msgstr ""
|
dongsheng@627
|
1151
|
dongsheng@627
|
1152 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
1153 #: ../en/appB-mq-ref.xml:531
|
dongsheng@627
|
1154 msgid ""
|
dongsheng@627
|
1155 "You will often need to edit the <filename role=\"special\">series</filename> "
|
dongsheng@627
|
1156 "file by hand, hence the support for comments and empty lines noted above. "
|
dongsheng@627
|
1157 "For example, you can comment out a patch temporarily, and <command role=\"hg-"
|
dongsheng@627
|
1158 "ext-mq\">qpush</command> will skip over that patch when applying patches. "
|
dongsheng@627
|
1159 "You can also change the order in which patches are applied by reordering "
|
dongsheng@627
|
1160 "their entries in the <filename role=\"special\">series</filename> file."
|
dongsheng@627
|
1161 msgstr ""
|
dongsheng@627
|
1162
|
dongsheng@627
|
1163 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
1164 #: ../en/appB-mq-ref.xml:540
|
dongsheng@627
|
1165 msgid ""
|
dongsheng@627
|
1166 "Placing the <filename role=\"special\">series</filename> file under revision "
|
dongsheng@627
|
1167 "control is also supported; it is a good idea to place all of the patches that "
|
dongsheng@627
|
1168 "it refers to under revision control, as well. If you create a patch "
|
dongsheng@627
|
1169 "directory using the <option role=\"hg-ext-mq-cmd-qinit-opt\">-c</option> "
|
dongsheng@627
|
1170 "option to <command role=\"hg-ext-mq\">qinit</command>, this will be done for "
|
dongsheng@627
|
1171 "you automatically."
|
dongsheng@627
|
1172 msgstr ""
|
dongsheng@627
|
1173
|
dongsheng@627
|
1174 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
1175 #: ../en/appB-mq-ref.xml:550
|
dongsheng@627
|
1176 msgid "The <filename role=\"special\">status</filename> file"
|
dongsheng@627
|
1177 msgstr "<filename role=\"special\">状态</filename>文件"
|
dongsheng@627
|
1178
|
dongsheng@627
|
1179 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
1180 #: ../en/appB-mq-ref.xml:553
|
dongsheng@627
|
1181 msgid ""
|
dongsheng@627
|
1182 "The <filename role=\"special\">status</filename> file contains the names and "
|
dongsheng@627
|
1183 "changeset hashes of all patches that MQ currently has applied. Unlike the "
|
dongsheng@627
|
1184 "<filename role=\"special\">series</filename> file, this file is not intended "
|
dongsheng@627
|
1185 "for editing. You should not place this file under revision control, or "
|
dongsheng@627
|
1186 "modify it in any way. It is used by MQ strictly for internal book-keeping."
|
dongsheng@627
|
1187 msgstr ""
|
dongsheng@627
|
1188
|
dongsheng@627
|
1189 #. type: Content of: <book><appendix><title>
|
dongsheng@627
|
1190 #: ../en/appC-srcinstall.xml:5
|
dongsheng@627
|
1191 msgid "Installing Mercurial from source"
|
dongsheng@627
|
1192 msgstr "从源代码安装 Mercurial"
|
dongsheng@627
|
1193
|
dongsheng@627
|
1194 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@627
|
1195 #: ../en/appC-srcinstall.xml:8
|
dongsheng@627
|
1196 msgid "On a Unix-like system"
|
dongsheng@627
|
1197 msgstr "类 Unix 系统"
|
dongsheng@627
|
1198
|
dongsheng@627
|
1199 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1200 #: ../en/appC-srcinstall.xml:10
|
dongsheng@627
|
1201 msgid ""
|
dongsheng@627
|
1202 "If you are using a Unix-like system that has a sufficiently recent version of "
|
dongsheng@627
|
1203 "Python (2.3 or newer) available, it is easy to install Mercurial from source."
|
dongsheng@627
|
1204 msgstr ""
|
dongsheng@627
|
1205
|
dongsheng@627
|
1206 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1207 #: ../en/appC-srcinstall.xml:14
|
dongsheng@627
|
1208 msgid ""
|
dongsheng@627
|
1209 "Download a recent source tarball from <ulink url=\"http://www.selenic.com/"
|
dongsheng@627
|
1210 "mercurial/download\">http://www.selenic.com/mercurial/download</ulink>."
|
dongsheng@627
|
1211 msgstr ""
|
dongsheng@627
|
1212
|
dongsheng@627
|
1213 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1214 #: ../en/appC-srcinstall.xml:17
|
dongsheng@627
|
1215 msgid "Unpack the tarball:"
|
dongsheng@627
|
1216 msgstr ""
|
dongsheng@627
|
1217
|
dongsheng@627
|
1218 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1219 #: ../en/appC-srcinstall.xml:20
|
dongsheng@627
|
1220 msgid ""
|
dongsheng@627
|
1221 "Go into the source directory and run the installer script. This will build "
|
dongsheng@627
|
1222 "Mercurial and install it in your home directory."
|
dongsheng@627
|
1223 msgstr ""
|
dongsheng@627
|
1224
|
dongsheng@627
|
1225 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1226 #: ../en/appC-srcinstall.xml:27
|
dongsheng@627
|
1227 msgid ""
|
dongsheng@627
|
1228 "Once the install finishes, Mercurial will be in the <literal>bin</literal> "
|
dongsheng@627
|
1229 "subdirectory of your home directory. Don't forget to make sure that this "
|
dongsheng@627
|
1230 "directory is present in your shell's search path."
|
dongsheng@627
|
1231 msgstr ""
|
dongsheng@627
|
1232
|
dongsheng@627
|
1233 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1234 #: ../en/appC-srcinstall.xml:32
|
dongsheng@627
|
1235 msgid ""
|
dongsheng@627
|
1236 "You will probably need to set the <envar>PYTHONPATH</envar> environment "
|
dongsheng@627
|
1237 "variable so that the Mercurial executable can find the rest of the Mercurial "
|
dongsheng@627
|
1238 "packages. For example, on my laptop, I have set it to <literal>/home/bos/lib/"
|
dongsheng@627
|
1239 "python</literal>. The exact path that you will need to use depends on how "
|
dongsheng@627
|
1240 "Python was built for your system, but should be easy to figure out. If "
|
dongsheng@627
|
1241 "you're uncertain, look through the output of the installer script above, and "
|
dongsheng@627
|
1242 "see where the contents of the <literal>mercurial</literal> directory were "
|
dongsheng@627
|
1243 "installed to."
|
dongsheng@627
|
1244 msgstr ""
|
dongsheng@627
|
1245
|
dongsheng@627
|
1246 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@627
|
1247 #: ../en/appC-srcinstall.xml:44
|
dongsheng@627
|
1248 msgid "On Windows"
|
dongsheng@627
|
1249 msgstr "Windows 系统"
|
dongsheng@627
|
1250
|
dongsheng@627
|
1251 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1252 #: ../en/appC-srcinstall.xml:46
|
dongsheng@627
|
1253 msgid ""
|
dongsheng@627
|
1254 "Building and installing Mercurial on Windows requires a variety of tools, a "
|
dongsheng@627
|
1255 "fair amount of technical knowledge, and considerable patience. I very much "
|
dongsheng@627
|
1256 "<emphasis>do not recommend</emphasis> this route if you are a <quote>casual "
|
dongsheng@627
|
1257 "user</quote>. Unless you intend to hack on Mercurial, I strongly suggest "
|
dongsheng@627
|
1258 "that you use a binary package instead."
|
dongsheng@627
|
1259 msgstr ""
|
dongsheng@627
|
1260
|
dongsheng@627
|
1261 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1262 #: ../en/appC-srcinstall.xml:53
|
dongsheng@627
|
1263 msgid ""
|
dongsheng@627
|
1264 "If you are intent on building Mercurial from source on Windows, follow the "
|
dongsheng@627
|
1265 "<quote>hard way</quote> directions on the Mercurial wiki at <ulink url="
|
dongsheng@627
|
1266 "\"http://www.selenic.com/mercurial/wiki/index.cgi/WindowsInstall\">http://www."
|
dongsheng@627
|
1267 "selenic.com/mercurial/wiki/index.cgi/WindowsInstall</ulink>, and expect the "
|
dongsheng@627
|
1268 "process to involve a lot of fiddly work."
|
dongsheng@627
|
1269 msgstr ""
|
dongsheng@627
|
1270
|
dongsheng@627
|
1271 #. type: Content of: <book><appendix><title>
|
dongsheng@627
|
1272 #: ../en/appD-license.xml:5
|
dongsheng@627
|
1273 msgid "Open Publication License"
|
dongsheng@627
|
1274 msgstr ""
|
dongsheng@627
|
1275
|
dongsheng@627
|
1276 #. type: Content of: <book><appendix><para>
|
dongsheng@627
|
1277 #: ../en/appD-license.xml:7
|
dongsheng@627
|
1278 msgid "Version 1.0, 8 June 1999"
|
dongsheng@627
|
1279 msgstr ""
|
dongsheng@627
|
1280
|
dongsheng@627
|
1281 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@627
|
1282 #: ../en/appD-license.xml:10
|
dongsheng@627
|
1283 msgid "Requirements on both unmodified and modified versions"
|
dongsheng@627
|
1284 msgstr ""
|
dongsheng@627
|
1285
|
dongsheng@627
|
1286 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1287 #: ../en/appD-license.xml:13
|
dongsheng@627
|
1288 msgid ""
|
dongsheng@627
|
1289 "The Open Publication works may be reproduced and distributed in whole or in "
|
dongsheng@627
|
1290 "part, in any medium physical or electronic, provided that the terms of this "
|
dongsheng@627
|
1291 "license are adhered to, and that this license or an incorporation of it by "
|
dongsheng@627
|
1292 "reference (with any options elected by the author(s) and/or publisher) is "
|
dongsheng@627
|
1293 "displayed in the reproduction."
|
dongsheng@627
|
1294 msgstr ""
|
dongsheng@627
|
1295
|
dongsheng@627
|
1296 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1297 #: ../en/appD-license.xml:20
|
dongsheng@627
|
1298 msgid "Proper form for an incorporation by reference is as follows:"
|
dongsheng@627
|
1299 msgstr ""
|
dongsheng@627
|
1300
|
dongsheng@627
|
1301 #. type: Content of: <book><appendix><sect1><blockquote><para>
|
dongsheng@627
|
1302 #: ../en/appD-license.xml:24
|
dongsheng@627
|
1303 msgid ""
|
dongsheng@627
|
1304 "Copyright (c) <emphasis>year</emphasis> by <emphasis>author's name or "
|
dongsheng@627
|
1305 "designee</emphasis>. This material may be distributed only subject to the "
|
dongsheng@627
|
1306 "terms and conditions set forth in the Open Publication License, v<emphasis>x."
|
dongsheng@627
|
1307 "y</emphasis> or later (the latest version is presently available at <ulink "
|
dongsheng@627
|
1308 "url=\"http://www.opencontent.org/openpub/\">http://www.opencontent.org/"
|
dongsheng@627
|
1309 "openpub/</ulink>)."
|
dongsheng@627
|
1310 msgstr ""
|
dongsheng@627
|
1311
|
dongsheng@627
|
1312 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1313 #: ../en/appD-license.xml:33
|
dongsheng@627
|
1314 msgid ""
|
dongsheng@627
|
1315 "The reference must be immediately followed with any options elected by the "
|
dongsheng@627
|
1316 "author(s) and/or publisher of the document (see section <xref linkend=\"sec."
|
dongsheng@627
|
1317 "opl.options\"/>)."
|
dongsheng@627
|
1318 msgstr ""
|
dongsheng@627
|
1319
|
dongsheng@627
|
1320 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1321 #: ../en/appD-license.xml:37
|
dongsheng@627
|
1322 msgid ""
|
dongsheng@627
|
1323 "Commercial redistribution of Open Publication-licensed material is permitted."
|
dongsheng@627
|
1324 msgstr ""
|
dongsheng@627
|
1325
|
dongsheng@627
|
1326 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1327 #: ../en/appD-license.xml:40
|
dongsheng@627
|
1328 msgid ""
|
dongsheng@627
|
1329 "Any publication in standard (paper) book form shall require the citation of "
|
dongsheng@627
|
1330 "the original publisher and author. The publisher and author's names shall "
|
dongsheng@627
|
1331 "appear on all outer surfaces of the book. On all outer surfaces of the book "
|
dongsheng@627
|
1332 "the original publisher's name shall be as large as the title of the work and "
|
dongsheng@627
|
1333 "cited as possessive with respect to the title."
|
dongsheng@627
|
1334 msgstr ""
|
dongsheng@627
|
1335
|
dongsheng@627
|
1336 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@627
|
1337 #: ../en/appD-license.xml:49
|
dongsheng@627
|
1338 msgid "Copyright"
|
dongsheng@627
|
1339 msgstr ""
|
dongsheng@627
|
1340
|
dongsheng@627
|
1341 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1342 #: ../en/appD-license.xml:51
|
dongsheng@627
|
1343 msgid ""
|
dongsheng@627
|
1344 "The copyright to each Open Publication is owned by its author(s) or designee."
|
dongsheng@627
|
1345 msgstr ""
|
dongsheng@627
|
1346
|
dongsheng@627
|
1347 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@627
|
1348 #: ../en/appD-license.xml:56
|
dongsheng@627
|
1349 msgid "Scope of license"
|
dongsheng@627
|
1350 msgstr ""
|
dongsheng@627
|
1351
|
dongsheng@627
|
1352 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1353 #: ../en/appD-license.xml:58
|
dongsheng@627
|
1354 msgid ""
|
dongsheng@627
|
1355 "The following license terms apply to all Open Publication works, unless "
|
dongsheng@627
|
1356 "otherwise explicitly stated in the document."
|
dongsheng@627
|
1357 msgstr ""
|
dongsheng@627
|
1358
|
dongsheng@627
|
1359 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1360 #: ../en/appD-license.xml:62
|
dongsheng@627
|
1361 msgid ""
|
dongsheng@627
|
1362 "Mere aggregation of Open Publication works or a portion of an Open "
|
dongsheng@627
|
1363 "Publication work with other works or programs on the same media shall not "
|
dongsheng@627
|
1364 "cause this license to apply to those other works. The aggregate work shall "
|
dongsheng@627
|
1365 "contain a notice specifying the inclusion of the Open Publication material "
|
dongsheng@627
|
1366 "and appropriate copyright notice."
|
dongsheng@627
|
1367 msgstr ""
|
dongsheng@627
|
1368
|
dongsheng@627
|
1369 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1370 #: ../en/appD-license.xml:69
|
dongsheng@627
|
1371 msgid ""
|
dongsheng@627
|
1372 "<emphasis role=\"bold\">Severability</emphasis>. If any part of this license "
|
dongsheng@627
|
1373 "is found to be unenforceable in any jurisdiction, the remaining portions of "
|
dongsheng@627
|
1374 "the license remain in force."
|
dongsheng@627
|
1375 msgstr ""
|
dongsheng@627
|
1376
|
dongsheng@627
|
1377 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1378 #: ../en/appD-license.xml:74
|
dongsheng@627
|
1379 msgid ""
|
dongsheng@627
|
1380 "<emphasis role=\"bold\">No warranty</emphasis>. Open Publication works are "
|
dongsheng@627
|
1381 "licensed and provided <quote>as is</quote> without warranty of any kind, "
|
dongsheng@627
|
1382 "express or implied, including, but not limited to, the implied warranties of "
|
dongsheng@627
|
1383 "merchantability and fitness for a particular purpose or a warranty of non-"
|
dongsheng@627
|
1384 "infringement."
|
dongsheng@627
|
1385 msgstr ""
|
dongsheng@627
|
1386
|
dongsheng@627
|
1387 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@627
|
1388 #: ../en/appD-license.xml:83
|
dongsheng@627
|
1389 msgid "Requirements on modified works"
|
dongsheng@627
|
1390 msgstr ""
|
dongsheng@627
|
1391
|
dongsheng@627
|
1392 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1393 #: ../en/appD-license.xml:85
|
dongsheng@627
|
1394 msgid ""
|
dongsheng@627
|
1395 "All modified versions of documents covered by this license, including "
|
dongsheng@627
|
1396 "translations, anthologies, compilations and partial documents, must meet the "
|
dongsheng@627
|
1397 "following requirements:"
|
dongsheng@627
|
1398 msgstr ""
|
dongsheng@627
|
1399
|
dongsheng@627
|
1400 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1401 #: ../en/appD-license.xml:90
|
dongsheng@627
|
1402 msgid "The modified version must be labeled as such."
|
dongsheng@627
|
1403 msgstr ""
|
dongsheng@627
|
1404
|
dongsheng@627
|
1405 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1406 #: ../en/appD-license.xml:93
|
dongsheng@627
|
1407 msgid ""
|
dongsheng@627
|
1408 "The person making the modifications must be identified and the modifications "
|
dongsheng@627
|
1409 "dated."
|
dongsheng@627
|
1410 msgstr ""
|
dongsheng@627
|
1411
|
dongsheng@627
|
1412 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1413 #: ../en/appD-license.xml:96
|
dongsheng@627
|
1414 msgid ""
|
dongsheng@627
|
1415 "Acknowledgement of the original author and publisher if applicable must be "
|
dongsheng@627
|
1416 "retained according to normal academic citation practices."
|
dongsheng@627
|
1417 msgstr ""
|
dongsheng@627
|
1418
|
dongsheng@627
|
1419 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1420 #: ../en/appD-license.xml:100
|
dongsheng@627
|
1421 msgid "The location of the original unmodified document must be identified."
|
dongsheng@627
|
1422 msgstr ""
|
dongsheng@627
|
1423
|
dongsheng@627
|
1424 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1425 #: ../en/appD-license.xml:103
|
dongsheng@627
|
1426 msgid ""
|
dongsheng@627
|
1427 "The original author's (or authors') name(s) may not be used to assert or "
|
dongsheng@627
|
1428 "imply endorsement of the resulting document without the original author's (or "
|
dongsheng@627
|
1429 "authors') permission."
|
dongsheng@627
|
1430 msgstr ""
|
dongsheng@627
|
1431
|
dongsheng@627
|
1432 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@627
|
1433 #: ../en/appD-license.xml:111
|
dongsheng@627
|
1434 msgid "Good-practice recommendations"
|
dongsheng@627
|
1435 msgstr ""
|
dongsheng@627
|
1436
|
dongsheng@627
|
1437 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1438 #: ../en/appD-license.xml:113
|
dongsheng@627
|
1439 msgid ""
|
dongsheng@627
|
1440 "In addition to the requirements of this license, it is requested from and "
|
dongsheng@627
|
1441 "strongly recommended of redistributors that:"
|
dongsheng@627
|
1442 msgstr ""
|
dongsheng@627
|
1443
|
dongsheng@627
|
1444 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1445 #: ../en/appD-license.xml:118
|
dongsheng@627
|
1446 msgid ""
|
dongsheng@627
|
1447 "If you are distributing Open Publication works on hardcopy or CD-ROM, you "
|
dongsheng@627
|
1448 "provide email notification to the authors of your intent to redistribute at "
|
dongsheng@627
|
1449 "least thirty days before your manuscript or media freeze, to give the authors "
|
dongsheng@627
|
1450 "time to provide updated documents. This notification should describe "
|
dongsheng@627
|
1451 "modifications, if any, made to the document."
|
dongsheng@627
|
1452 msgstr ""
|
dongsheng@627
|
1453
|
dongsheng@627
|
1454 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1455 #: ../en/appD-license.xml:125
|
dongsheng@627
|
1456 msgid ""
|
dongsheng@627
|
1457 "All substantive modifications (including deletions) be either clearly marked "
|
dongsheng@627
|
1458 "up in the document or else described in an attachment to the document."
|
dongsheng@627
|
1459 msgstr ""
|
dongsheng@627
|
1460
|
dongsheng@627
|
1461 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1462 #: ../en/appD-license.xml:129
|
dongsheng@627
|
1463 msgid ""
|
dongsheng@627
|
1464 "Finally, while it is not mandatory under this license, it is considered good "
|
dongsheng@627
|
1465 "form to offer a free copy of any hardcopy and CD-ROM expression of an Open "
|
dongsheng@627
|
1466 "Publication-licensed work to its author(s)."
|
dongsheng@627
|
1467 msgstr ""
|
dongsheng@627
|
1468
|
dongsheng@627
|
1469 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@627
|
1470 #: ../en/appD-license.xml:137
|
dongsheng@627
|
1471 msgid "License options"
|
dongsheng@627
|
1472 msgstr ""
|
dongsheng@627
|
1473
|
dongsheng@627
|
1474 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1475 #: ../en/appD-license.xml:139
|
dongsheng@627
|
1476 msgid ""
|
dongsheng@627
|
1477 "The author(s) and/or publisher of an Open Publication-licensed document may "
|
dongsheng@627
|
1478 "elect certain options by appending language to the reference to or copy of "
|
dongsheng@627
|
1479 "the license. These options are considered part of the license instance and "
|
dongsheng@627
|
1480 "must be included with the license (or its incorporation by reference) in "
|
dongsheng@627
|
1481 "derived works."
|
dongsheng@627
|
1482 msgstr ""
|
dongsheng@627
|
1483
|
dongsheng@627
|
1484 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1485 #: ../en/appD-license.xml:147
|
dongsheng@627
|
1486 msgid ""
|
dongsheng@627
|
1487 "To prohibit distribution of substantively modified versions without the "
|
dongsheng@627
|
1488 "explicit permission of the author(s). <quote>Substantive modification</quote> "
|
dongsheng@627
|
1489 "is defined as a change to the semantic content of the document, and excludes "
|
dongsheng@627
|
1490 "mere changes in format or typographical corrections."
|
dongsheng@627
|
1491 msgstr ""
|
dongsheng@627
|
1492
|
dongsheng@627
|
1493 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1494 #: ../en/appD-license.xml:154
|
dongsheng@627
|
1495 msgid ""
|
dongsheng@627
|
1496 "To accomplish this, add the phrase <quote>Distribution of substantively "
|
dongsheng@627
|
1497 "modified versions of this document is prohibited without the explicit "
|
dongsheng@627
|
1498 "permission of the copyright holder.</quote> to the license reference or copy."
|
dongsheng@627
|
1499 msgstr ""
|
dongsheng@627
|
1500
|
dongsheng@627
|
1501 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1502 #: ../en/appD-license.xml:160
|
dongsheng@627
|
1503 msgid ""
|
dongsheng@627
|
1504 "To prohibit any publication of this work or derivative works in whole or in "
|
dongsheng@627
|
1505 "part in standard (paper) book form for commercial purposes is prohibited "
|
dongsheng@627
|
1506 "unless prior permission is obtained from the copyright holder."
|
dongsheng@627
|
1507 msgstr ""
|
dongsheng@627
|
1508
|
dongsheng@627
|
1509 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1510 #: ../en/appD-license.xml:165
|
dongsheng@627
|
1511 msgid ""
|
dongsheng@627
|
1512 "To accomplish this, add the phrase <quote>Distribution of the work or "
|
dongsheng@627
|
1513 "derivative of the work in any standard (paper) book form is prohibited unless "
|
dongsheng@627
|
1514 "prior permission is obtained from the copyright holder.</quote> to the "
|
dongsheng@627
|
1515 "license reference or copy."
|
dongsheng@627
|
1516 msgstr ""
|
dongsheng@627
|
1517
|
dongsheng@627
|
1518 #. type: Content of: <book><chapter><title>
|
dongsheng@627
|
1519 #: ../en/ch01-intro.xml:5
|
dongsheng@627
|
1520 msgid "Introduction"
|
dongsheng@627
|
1521 msgstr "简介"
|
dongsheng@627
|
1522
|
dongsheng@627
|
1523 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
1524 #: ../en/ch01-intro.xml:8
|
dongsheng@627
|
1525 msgid "About revision control"
|
dongsheng@627
|
1526 msgstr "关于版本控制"
|
dongsheng@627
|
1527
|
dongsheng@627
|
1528 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
1529 #: ../en/ch01-intro.xml:10
|
dongsheng@627
|
1530 msgid ""
|
dongsheng@627
|
1531 "Revision control is the process of managing multiple versions of a piece of "
|
dongsheng@627
|
1532 "information. In its simplest form, this is something that many people do by "
|
dongsheng@627
|
1533 "hand: every time you modify a file, save it under a new name that contains a "
|
dongsheng@627
|
1534 "number, each one higher than the number of the preceding version."
|
dongsheng@627
|
1535 msgstr ""
|
dongsheng@627
|
1536
|
dongsheng@627
|
1537 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
1538 #: ../en/ch01-intro.xml:16
|
dongsheng@627
|
1539 msgid ""
|
dongsheng@627
|
1540 "Manually managing multiple versions of even a single file is an error-prone "
|
dongsheng@627
|
1541 "task, though, so software tools to help automate this process have long been "
|
dongsheng@627
|
1542 "available. The earliest automated revision control tools were intended to "
|
dongsheng@627
|
1543 "help a single user to manage revisions of a single file. Over the past few "
|
dongsheng@627
|
1544 "decades, the scope of revision control tools has expanded greatly; they now "
|
dongsheng@627
|
1545 "manage multiple files, and help multiple people to work together. The best "
|
dongsheng@627
|
1546 "modern revision control tools have no problem coping with thousands of people "
|
dongsheng@627
|
1547 "working together on projects that consist of hundreds of thousands of files."
|
dongsheng@627
|
1548 msgstr ""
|
dongsheng@627
|
1549
|
dongsheng@627
|
1550 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
1551 #: ../en/ch01-intro.xml:28
|
dongsheng@627
|
1552 msgid "Why use revision control?"
|
dongsheng@627
|
1553 msgstr "为什么使用版本控制?"
|
dongsheng@627
|
1554
|
dongsheng@627
|
1555 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
1556 #: ../en/ch01-intro.xml:30
|
dongsheng@627
|
1557 msgid ""
|
dongsheng@627
|
1558 "There are a number of reasons why you or your team might want to use an "
|
dongsheng@627
|
1559 "automated revision control tool for a project."
|
dongsheng@627
|
1560 msgstr ""
|
dongsheng@627
|
1561
|
dongsheng@627
|
1562 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
1563 #: ../en/ch01-intro.xml:34
|
dongsheng@627
|
1564 msgid ""
|
dongsheng@627
|
1565 "It will track the history and evolution of your project, so you don't have "
|
dongsheng@627
|
1566 "to. For every change, you'll have a log of <emphasis>who</emphasis> made it; "
|
dongsheng@627
|
1567 "<emphasis>why</emphasis> they made it; <emphasis>when</emphasis> they made "
|
dongsheng@627
|
1568 "it; and <emphasis>what</emphasis> the change was."
|
dongsheng@627
|
1569 msgstr ""
|
dongsheng@627
|
1570
|
dongsheng@627
|
1571 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
1572 #: ../en/ch01-intro.xml:41
|
dongsheng@627
|
1573 msgid ""
|
dongsheng@627
|
1574 "When you're working with other people, revision control software makes it "
|
dongsheng@627
|
1575 "easier for you to collaborate. For example, when people more or less "
|
dongsheng@627
|
1576 "simultaneously make potentially incompatible changes, the software will help "
|
dongsheng@627
|
1577 "you to identify and resolve those conflicts."
|
dongsheng@627
|
1578 msgstr ""
|
dongsheng@627
|
1579
|
dongsheng@627
|
1580 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
1581 #: ../en/ch01-intro.xml:47
|
dongsheng@627
|
1582 msgid ""
|
dongsheng@627
|
1583 "It can help you to recover from mistakes. If you make a change that later "
|
dongsheng@627
|
1584 "turns out to be in error, you can revert to an earlier version of one or more "
|
dongsheng@627
|
1585 "files. In fact, a <emphasis>really</emphasis> good revision control tool "
|
dongsheng@627
|
1586 "will even help you to efficiently figure out exactly when a problem was "
|
dongsheng@627
|
1587 "introduced (see section <xref linkend=\"sec.undo.bisect\"/> for details)."
|
dongsheng@627
|
1588 msgstr ""
|
dongsheng@627
|
1589
|
dongsheng@627
|
1590 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
1591 #: ../en/ch01-intro.xml:54
|
dongsheng@627
|
1592 msgid ""
|
dongsheng@627
|
1593 "It will help you to work simultaneously on, and manage the drift between, "
|
dongsheng@627
|
1594 "multiple versions of your project."
|
dongsheng@627
|
1595 msgstr ""
|
dongsheng@627
|
1596
|
dongsheng@627
|
1597 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
1598 #: ../en/ch01-intro.xml:57
|
dongsheng@627
|
1599 msgid ""
|
dongsheng@627
|
1600 "Most of these reasons are equally valid---at least in theory---whether you're "
|
dongsheng@627
|
1601 "working on a project by yourself, or with a hundred other people."
|
dongsheng@627
|
1602 msgstr ""
|
dongsheng@627
|
1603
|
dongsheng@627
|
1604 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
1605 #: ../en/ch01-intro.xml:61
|
dongsheng@627
|
1606 msgid ""
|
dongsheng@627
|
1607 "A key question about the practicality of revision control at these two "
|
dongsheng@627
|
1608 "different scales (<quote>lone hacker</quote> and <quote>huge team</quote>) is "
|
dongsheng@627
|
1609 "how its <emphasis>benefits</emphasis> compare to its <emphasis>costs</"
|
dongsheng@627
|
1610 "emphasis>. A revision control tool that's difficult to understand or use is "
|
dongsheng@627
|
1611 "going to impose a high cost."
|
dongsheng@627
|
1612 msgstr ""
|
dongsheng@627
|
1613
|
dongsheng@627
|
1614 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
1615 #: ../en/ch01-intro.xml:69
|
dongsheng@627
|
1616 msgid ""
|
dongsheng@627
|
1617 "A five-hundred-person project is likely to collapse under its own weight "
|
dongsheng@627
|
1618 "almost immediately without a revision control tool and process. In this case, "
|
dongsheng@627
|
1619 "the cost of using revision control might hardly seem worth considering, since "
|
dongsheng@627
|
1620 "<emphasis>without</emphasis> it, failure is almost guaranteed."
|
dongsheng@627
|
1621 msgstr ""
|
dongsheng@627
|
1622
|
dongsheng@627
|
1623 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
1624 #: ../en/ch01-intro.xml:76
|
dongsheng@627
|
1625 msgid ""
|
dongsheng@627
|
1626 "On the other hand, a one-person <quote>quick hack</quote> might seem like a "
|
dongsheng@627
|
1627 "poor place to use a revision control tool, because surely the cost of using "
|
dongsheng@627
|
1628 "one must be close to the overall cost of the project. Right?"
|
dongsheng@627
|
1629 msgstr ""
|
dongsheng@627
|
1630
|
dongsheng@627
|
1631 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
1632 #: ../en/ch01-intro.xml:81
|
dongsheng@627
|
1633 msgid ""
|
dongsheng@627
|
1634 "Mercurial uniquely supports <emphasis>both</emphasis> of these scales of "
|
dongsheng@627
|
1635 "development. You can learn the basics in just a few minutes, and due to its "
|
dongsheng@627
|
1636 "low overhead, you can apply revision control to the smallest of projects with "
|
dongsheng@627
|
1637 "ease. Its simplicity means you won't have a lot of abstruse concepts or "
|
dongsheng@627
|
1638 "command sequences competing for mental space with whatever you're "
|
dongsheng@627
|
1639 "<emphasis>really</emphasis> trying to do. At the same time, Mercurial's high "
|
dongsheng@627
|
1640 "performance and peer-to-peer nature let you scale painlessly to handle large "
|
dongsheng@627
|
1641 "projects."
|
dongsheng@627
|
1642 msgstr ""
|
dongsheng@627
|
1643
|
dongsheng@627
|
1644 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
1645 #: ../en/ch01-intro.xml:91
|
dongsheng@627
|
1646 msgid ""
|
dongsheng@627
|
1647 "No revision control tool can rescue a poorly run project, but a good choice "
|
dongsheng@627
|
1648 "of tools can make a huge difference to the fluidity with which you can work "
|
dongsheng@627
|
1649 "on a project."
|
dongsheng@627
|
1650 msgstr ""
|
dongsheng@627
|
1651
|
dongsheng@627
|
1652 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
1653 #: ../en/ch01-intro.xml:97
|
dongsheng@627
|
1654 msgid "The many names of revision control"
|
dongsheng@627
|
1655 msgstr "版本控制的别名"
|
dongsheng@627
|
1656
|
dongsheng@627
|
1657 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
1658 #: ../en/ch01-intro.xml:99
|
dongsheng@627
|
1659 msgid ""
|
dongsheng@627
|
1660 "Revision control is a diverse field, so much so that it doesn't actually have "
|
dongsheng@627
|
1661 "a single name or acronym. Here are a few of the more common names and "
|
dongsheng@627
|
1662 "acronyms you'll encounter:"
|
dongsheng@627
|
1663 msgstr ""
|
dongsheng@627
|
1664
|
dongsheng@627
|
1665 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
1666 #: ../en/ch01-intro.xml:104
|
dongsheng@627
|
1667 msgid "Revision control (RCS)"
|
dongsheng@627
|
1668 msgstr ""
|
dongsheng@627
|
1669
|
dongsheng@627
|
1670 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
1671 #: ../en/ch01-intro.xml:105
|
dongsheng@627
|
1672 msgid "Software configuration management (SCM), or configuration management"
|
dongsheng@627
|
1673 msgstr ""
|
dongsheng@627
|
1674
|
dongsheng@627
|
1675 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
1676 #: ../en/ch01-intro.xml:107
|
dongsheng@627
|
1677 msgid "Source code management"
|
dongsheng@627
|
1678 msgstr ""
|
dongsheng@627
|
1679
|
dongsheng@627
|
1680 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
1681 #: ../en/ch01-intro.xml:108
|
dongsheng@627
|
1682 msgid "Source code control, or source control"
|
dongsheng@627
|
1683 msgstr ""
|
dongsheng@627
|
1684
|
dongsheng@627
|
1685 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
1686 #: ../en/ch01-intro.xml:110
|
dongsheng@627
|
1687 msgid "Version control (VCS)"
|
dongsheng@627
|
1688 msgstr ""
|
dongsheng@627
|
1689
|
dongsheng@627
|
1690 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
1691 #: ../en/ch01-intro.xml:112
|
dongsheng@627
|
1692 msgid ""
|
dongsheng@627
|
1693 "Some people claim that these terms actually have different meanings, but in "
|
dongsheng@627
|
1694 "practice they overlap so much that there's no agreed or even useful way to "
|
dongsheng@627
|
1695 "tease them apart."
|
dongsheng@627
|
1696 msgstr ""
|
dongsheng@627
|
1697
|
dongsheng@627
|
1698 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
1699 #: ../en/ch01-intro.xml:119
|
dongsheng@627
|
1700 msgid "A short history of revision control"
|
dongsheng@627
|
1701 msgstr "版本控制简史"
|
dongsheng@627
|
1702
|
dongsheng@627
|
1703 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
1704 #: ../en/ch01-intro.xml:121
|
dongsheng@627
|
1705 msgid ""
|
dongsheng@627
|
1706 "The best known of the old-time revision control tools is SCCS (Source Code "
|
dongsheng@627
|
1707 "Control System), which Marc Rochkind wrote at Bell Labs, in the early 1970s. "
|
dongsheng@627
|
1708 "SCCS operated on individual files, and required every person working on a "
|
dongsheng@627
|
1709 "project to have access to a shared workspace on a single system. Only one "
|
dongsheng@627
|
1710 "person could modify a file at any time; arbitration for access to files was "
|
dongsheng@627
|
1711 "via locks. It was common for people to lock files, and later forget to "
|
dongsheng@627
|
1712 "unlock them, preventing anyone else from modifying those files without the "
|
dongsheng@627
|
1713 "help of an administrator."
|
dongsheng@627
|
1714 msgstr ""
|
dongsheng@627
|
1715
|
dongsheng@627
|
1716 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
1717 #: ../en/ch01-intro.xml:132
|
dongsheng@627
|
1718 msgid ""
|
dongsheng@627
|
1719 "Walter Tichy developed a free alternative to SCCS in the early 1980s; he "
|
dongsheng@627
|
1720 "called his program RCS (Revision Control System). Like SCCS, RCS required "
|
dongsheng@627
|
1721 "developers to work in a single shared workspace, and to lock files to prevent "
|
dongsheng@627
|
1722 "multiple people from modifying them simultaneously."
|
dongsheng@627
|
1723 msgstr ""
|
dongsheng@627
|
1724
|
dongsheng@627
|
1725 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
1726 #: ../en/ch01-intro.xml:138
|
dongsheng@627
|
1727 msgid ""
|
dongsheng@627
|
1728 "Later in the 1980s, Dick Grune used RCS as a building block for a set of "
|
dongsheng@627
|
1729 "shell scripts he initially called cmt, but then renamed to CVS (Concurrent "
|
dongsheng@627
|
1730 "Versions System). The big innovation of CVS was that it let developers work "
|
dongsheng@627
|
1731 "simultaneously and somewhat independently in their own personal workspaces. "
|
dongsheng@627
|
1732 "The personal workspaces prevented developers from stepping on each other's "
|
dongsheng@627
|
1733 "toes all the time, as was common with SCCS and RCS. Each developer had a copy "
|
dongsheng@627
|
1734 "of every project file, and could modify their copies independently. They had "
|
dongsheng@627
|
1735 "to merge their edits prior to committing changes to the central repository."
|
dongsheng@627
|
1736 msgstr ""
|
dongsheng@627
|
1737
|
dongsheng@627
|
1738 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
1739 #: ../en/ch01-intro.xml:149
|
dongsheng@627
|
1740 msgid ""
|
dongsheng@627
|
1741 "Brian Berliner took Grune's original scripts and rewrote them in C, releasing "
|
dongsheng@627
|
1742 "in 1989 the code that has since developed into the modern version of CVS. "
|
dongsheng@627
|
1743 "CVS subsequently acquired the ability to operate over a network connection, "
|
dongsheng@627
|
1744 "giving it a client/server architecture. CVS's architecture is centralised; "
|
dongsheng@627
|
1745 "only the server has a copy of the history of the project. Client workspaces "
|
dongsheng@627
|
1746 "just contain copies of recent versions of the project's files, and a little "
|
dongsheng@627
|
1747 "metadata to tell them where the server is. CVS has been enormously "
|
dongsheng@627
|
1748 "successful; it is probably the world's most widely used revision control "
|
dongsheng@627
|
1749 "system."
|
dongsheng@627
|
1750 msgstr ""
|
dongsheng@627
|
1751
|
dongsheng@627
|
1752 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
1753 #: ../en/ch01-intro.xml:160
|
dongsheng@627
|
1754 msgid ""
|
dongsheng@627
|
1755 "In the early 1990s, Sun Microsystems developed an early distributed revision "
|
dongsheng@627
|
1756 "control system, called TeamWare. A TeamWare workspace contains a complete "
|
dongsheng@627
|
1757 "copy of the project's history. TeamWare has no notion of a central "
|
dongsheng@627
|
1758 "repository. (CVS relied upon RCS for its history storage; TeamWare used "
|
dongsheng@627
|
1759 "SCCS.)"
|
dongsheng@627
|
1760 msgstr ""
|
dongsheng@627
|
1761
|
dongsheng@627
|
1762 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
1763 #: ../en/ch01-intro.xml:167
|
dongsheng@627
|
1764 msgid ""
|
dongsheng@627
|
1765 "As the 1990s progressed, awareness grew of a number of problems with CVS. It "
|
dongsheng@627
|
1766 "records simultaneous changes to multiple files individually, instead of "
|
dongsheng@627
|
1767 "grouping them together as a single logically atomic operation. It does not "
|
dongsheng@627
|
1768 "manage its file hierarchy well; it is easy to make a mess of a repository by "
|
dongsheng@627
|
1769 "renaming files and directories. Worse, its source code is difficult to read "
|
dongsheng@627
|
1770 "and maintain, which made the <quote>pain level</quote> of fixing these "
|
dongsheng@627
|
1771 "architectural problems prohibitive."
|
dongsheng@627
|
1772 msgstr ""
|
dongsheng@627
|
1773
|
dongsheng@627
|
1774 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
1775 #: ../en/ch01-intro.xml:177
|
dongsheng@627
|
1776 msgid ""
|
dongsheng@627
|
1777 "In 2001, Jim Blandy and Karl Fogel, two developers who had worked on CVS, "
|
dongsheng@627
|
1778 "started a project to replace it with a tool that would have a better "
|
dongsheng@627
|
1779 "architecture and cleaner code. The result, Subversion, does not stray from "
|
dongsheng@627
|
1780 "CVS's centralised client/server model, but it adds multi-file atomic commits, "
|
dongsheng@627
|
1781 "better namespace management, and a number of other features that make it a "
|
dongsheng@627
|
1782 "generally better tool than CVS. Since its initial release, it has rapidly "
|
dongsheng@627
|
1783 "grown in popularity."
|
dongsheng@627
|
1784 msgstr ""
|
dongsheng@627
|
1785
|
dongsheng@627
|
1786 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
1787 #: ../en/ch01-intro.xml:186
|
dongsheng@627
|
1788 msgid ""
|
dongsheng@627
|
1789 "More or less simultaneously, Graydon Hoare began working on an ambitious "
|
dongsheng@627
|
1790 "distributed revision control system that he named Monotone. While Monotone "
|
dongsheng@627
|
1791 "addresses many of CVS's design flaws and has a peer-to-peer architecture, it "
|
dongsheng@627
|
1792 "goes beyond earlier (and subsequent) revision control tools in a number of "
|
dongsheng@627
|
1793 "innovative ways. It uses cryptographic hashes as identifiers, and has an "
|
dongsheng@627
|
1794 "integral notion of <quote>trust</quote> for code from different sources."
|
dongsheng@627
|
1795 msgstr ""
|
dongsheng@627
|
1796
|
dongsheng@627
|
1797 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
1798 #: ../en/ch01-intro.xml:195
|
dongsheng@627
|
1799 msgid ""
|
dongsheng@627
|
1800 "Mercurial began life in 2005. While a few aspects of its design are "
|
dongsheng@627
|
1801 "influenced by Monotone, Mercurial focuses on ease of use, high performance, "
|
dongsheng@627
|
1802 "and scalability to very large projects."
|
dongsheng@627
|
1803 msgstr ""
|
dongsheng@627
|
1804
|
dongsheng@627
|
1805 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
1806 #: ../en/ch01-intro.xml:202
|
dongsheng@627
|
1807 msgid "Trends in revision control"
|
dongsheng@627
|
1808 msgstr "版本控制的发展趋势"
|
dongsheng@627
|
1809
|
dongsheng@627
|
1810 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
1811 #: ../en/ch01-intro.xml:204
|
dongsheng@627
|
1812 msgid ""
|
dongsheng@627
|
1813 "There has been an unmistakable trend in the development and use of revision "
|
dongsheng@627
|
1814 "control tools over the past four decades, as people have become familiar with "
|
dongsheng@627
|
1815 "the capabilities of their tools and constrained by their limitations."
|
dongsheng@627
|
1816 msgstr ""
|
dongsheng@627
|
1817
|
dongsheng@627
|
1818 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
1819 #: ../en/ch01-intro.xml:209
|
dongsheng@627
|
1820 msgid ""
|
dongsheng@627
|
1821 "The first generation began by managing single files on individual computers. "
|
dongsheng@627
|
1822 "Although these tools represented a huge advance over ad-hoc manual revision "
|
dongsheng@627
|
1823 "control, their locking model and reliance on a single computer limited them "
|
dongsheng@627
|
1824 "to small, tightly-knit teams."
|
dongsheng@627
|
1825 msgstr ""
|
dongsheng@627
|
1826
|
dongsheng@627
|
1827 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
1828 #: ../en/ch01-intro.xml:215
|
dongsheng@627
|
1829 msgid ""
|
dongsheng@627
|
1830 "The second generation loosened these constraints by moving to network-"
|
dongsheng@627
|
1831 "centered architectures, and managing entire projects at a time. As projects "
|
dongsheng@627
|
1832 "grew larger, they ran into new problems. With clients needing to talk to "
|
dongsheng@627
|
1833 "servers very frequently, server scaling became an issue for large projects. "
|
dongsheng@627
|
1834 "An unreliable network connection could prevent remote users from being able "
|
dongsheng@627
|
1835 "to talk to the server at all. As open source projects started making read-"
|
dongsheng@627
|
1836 "only access available anonymously to anyone, people without commit privileges "
|
dongsheng@627
|
1837 "found that they could not use the tools to interact with a project in a "
|
dongsheng@627
|
1838 "natural way, as they could not record their changes."
|
dongsheng@627
|
1839 msgstr ""
|
dongsheng@627
|
1840
|
dongsheng@627
|
1841 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
1842 #: ../en/ch01-intro.xml:227
|
dongsheng@627
|
1843 msgid ""
|
dongsheng@627
|
1844 "The current generation of revision control tools is peer-to-peer in nature. "
|
dongsheng@627
|
1845 "All of these systems have dropped the dependency on a single central server, "
|
dongsheng@627
|
1846 "and allow people to distribute their revision control data to where it's "
|
dongsheng@627
|
1847 "actually needed. Collaboration over the Internet has moved from constrained "
|
dongsheng@627
|
1848 "by technology to a matter of choice and consensus. Modern tools can operate "
|
dongsheng@627
|
1849 "offline indefinitely and autonomously, with a network connection only needed "
|
dongsheng@627
|
1850 "when syncing changes with another repository."
|
dongsheng@627
|
1851 msgstr ""
|
dongsheng@627
|
1852
|
dongsheng@627
|
1853 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
1854 #: ../en/ch01-intro.xml:239
|
dongsheng@627
|
1855 msgid "A few of the advantages of distributed revision control"
|
dongsheng@627
|
1856 msgstr "分布版本控制的优点"
|
dongsheng@627
|
1857
|
dongsheng@627
|
1858 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
1859 #: ../en/ch01-intro.xml:242
|
dongsheng@627
|
1860 msgid ""
|
dongsheng@627
|
1861 "Even though distributed revision control tools have for several years been as "
|
dongsheng@627
|
1862 "robust and usable as their previous-generation counterparts, people using "
|
dongsheng@627
|
1863 "older tools have not yet necessarily woken up to their advantages. There are "
|
dongsheng@627
|
1864 "a number of ways in which distributed tools shine relative to centralised "
|
dongsheng@627
|
1865 "ones."
|
dongsheng@627
|
1866 msgstr ""
|
dongsheng@627
|
1867
|
dongsheng@627
|
1868 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
1869 #: ../en/ch01-intro.xml:249
|
dongsheng@627
|
1870 msgid ""
|
dongsheng@627
|
1871 "For an individual developer, distributed tools are almost always much faster "
|
dongsheng@627
|
1872 "than centralised tools. This is for a simple reason: a centralised tool "
|
dongsheng@627
|
1873 "needs to talk over the network for many common operations, because most "
|
dongsheng@627
|
1874 "metadata is stored in a single copy on the central server. A distributed "
|
dongsheng@627
|
1875 "tool stores all of its metadata locally. All else being equal, talking over "
|
dongsheng@627
|
1876 "the network adds overhead to a centralised tool. Don't underestimate the "
|
dongsheng@627
|
1877 "value of a snappy, responsive tool: you're going to spend a lot of time "
|
dongsheng@627
|
1878 "interacting with your revision control software."
|
dongsheng@627
|
1879 msgstr ""
|
dongsheng@627
|
1880
|
dongsheng@627
|
1881 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
1882 #: ../en/ch01-intro.xml:260
|
dongsheng@627
|
1883 msgid ""
|
dongsheng@627
|
1884 "Distributed tools are indifferent to the vagaries of your server "
|
dongsheng@627
|
1885 "infrastructure, again because they replicate metadata to so many locations. "
|
dongsheng@627
|
1886 "If you use a centralised system and your server catches fire, you'd better "
|
dongsheng@627
|
1887 "hope that your backup media are reliable, and that your last backup was "
|
dongsheng@627
|
1888 "recent and actually worked. With a distributed tool, you have many backups "
|
dongsheng@627
|
1889 "available on every contributor's computer."
|
dongsheng@627
|
1890 msgstr ""
|
dongsheng@627
|
1891
|
dongsheng@627
|
1892 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
1893 #: ../en/ch01-intro.xml:268
|
dongsheng@627
|
1894 msgid ""
|
dongsheng@627
|
1895 "The reliability of your network will affect distributed tools far less than "
|
dongsheng@627
|
1896 "it will centralised tools. You can't even use a centralised tool without a "
|
dongsheng@627
|
1897 "network connection, except for a few highly constrained commands. With a "
|
dongsheng@627
|
1898 "distributed tool, if your network connection goes down while you're working, "
|
dongsheng@627
|
1899 "you may not even notice. The only thing you won't be able to do is talk to "
|
dongsheng@627
|
1900 "repositories on other computers, something that is relatively rare compared "
|
dongsheng@627
|
1901 "with local operations. If you have a far-flung team of collaborators, this "
|
dongsheng@627
|
1902 "may be significant."
|
dongsheng@627
|
1903 msgstr ""
|
dongsheng@627
|
1904
|
dongsheng@627
|
1905 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
1906 #: ../en/ch01-intro.xml:279
|
dongsheng@627
|
1907 msgid "Advantages for open source projects"
|
dongsheng@627
|
1908 msgstr "开源项目的优点"
|
dongsheng@627
|
1909
|
dongsheng@627
|
1910 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
1911 #: ../en/ch01-intro.xml:281
|
dongsheng@627
|
1912 msgid ""
|
dongsheng@627
|
1913 "If you take a shine to an open source project and decide that you would like "
|
dongsheng@627
|
1914 "to start hacking on it, and that project uses a distributed revision control "
|
dongsheng@627
|
1915 "tool, you are at once a peer with the people who consider themselves the "
|
dongsheng@627
|
1916 "<quote>core</quote> of that project. If they publish their repositories, you "
|
dongsheng@627
|
1917 "can immediately copy their project history, start making changes, and record "
|
dongsheng@627
|
1918 "your work, using the same tools in the same ways as insiders. By contrast, "
|
dongsheng@627
|
1919 "with a centralised tool, you must use the software in a <quote>read only</"
|
dongsheng@627
|
1920 "quote> mode unless someone grants you permission to commit changes to their "
|
dongsheng@627
|
1921 "central server. Until then, you won't be able to record changes, and your "
|
dongsheng@627
|
1922 "local modifications will be at risk of corruption any time you try to update "
|
dongsheng@627
|
1923 "your client's view of the repository."
|
dongsheng@627
|
1924 msgstr ""
|
dongsheng@627
|
1925
|
dongsheng@627
|
1926 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@627
|
1927 #: ../en/ch01-intro.xml:297
|
dongsheng@627
|
1928 msgid "The forking non-problem"
|
dongsheng@627
|
1929 msgstr ""
|
dongsheng@627
|
1930
|
dongsheng@627
|
1931 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
1932 #: ../en/ch01-intro.xml:299
|
dongsheng@627
|
1933 msgid ""
|
dongsheng@627
|
1934 "It has been suggested that distributed revision control tools pose some sort "
|
dongsheng@627
|
1935 "of risk to open source projects because they make it easy to <quote>fork</"
|
dongsheng@627
|
1936 "quote> the development of a project. A fork happens when there are "
|
dongsheng@627
|
1937 "differences in opinion or attitude between groups of developers that cause "
|
dongsheng@627
|
1938 "them to decide that they can't work together any longer. Each side takes a "
|
dongsheng@627
|
1939 "more or less complete copy of the project's source code, and goes off in its "
|
dongsheng@627
|
1940 "own direction."
|
dongsheng@627
|
1941 msgstr ""
|
dongsheng@627
|
1942
|
dongsheng@627
|
1943 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
1944 #: ../en/ch01-intro.xml:309
|
dongsheng@627
|
1945 msgid ""
|
dongsheng@627
|
1946 "Sometimes the camps in a fork decide to reconcile their differences. With a "
|
dongsheng@627
|
1947 "centralised revision control system, the <emphasis>technical</emphasis> "
|
dongsheng@627
|
1948 "process of reconciliation is painful, and has to be performed largely by "
|
dongsheng@627
|
1949 "hand. You have to decide whose revision history is going to <quote>win</"
|
dongsheng@627
|
1950 "quote>, and graft the other team's changes into the tree somehow. This "
|
dongsheng@627
|
1951 "usually loses some or all of one side's revision history."
|
dongsheng@627
|
1952 msgstr ""
|
dongsheng@627
|
1953
|
dongsheng@627
|
1954 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
1955 #: ../en/ch01-intro.xml:318
|
dongsheng@627
|
1956 msgid ""
|
dongsheng@627
|
1957 "What distributed tools do with respect to forking is they make forking the "
|
dongsheng@627
|
1958 "<emphasis>only</emphasis> way to develop a project. Every single change that "
|
dongsheng@627
|
1959 "you make is potentially a fork point. The great strength of this approach is "
|
dongsheng@627
|
1960 "that a distributed revision control tool has to be really good at "
|
dongsheng@627
|
1961 "<emphasis>merging</emphasis> forks, because forks are absolutely fundamental: "
|
dongsheng@627
|
1962 "they happen all the time."
|
dongsheng@627
|
1963 msgstr ""
|
dongsheng@627
|
1964
|
dongsheng@627
|
1965 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
1966 #: ../en/ch01-intro.xml:327
|
dongsheng@627
|
1967 msgid ""
|
dongsheng@627
|
1968 "If every piece of work that everybody does, all the time, is framed in terms "
|
dongsheng@627
|
1969 "of forking and merging, then what the open source world refers to as a "
|
dongsheng@627
|
1970 "<quote>fork</quote> becomes <emphasis>purely</emphasis> a social issue. If "
|
dongsheng@627
|
1971 "anything, distributed tools <emphasis>lower</emphasis> the likelihood of a "
|
dongsheng@627
|
1972 "fork:"
|
dongsheng@627
|
1973 msgstr ""
|
dongsheng@627
|
1974
|
dongsheng@627
|
1975 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
1976 #: ../en/ch01-intro.xml:334
|
dongsheng@627
|
1977 msgid ""
|
dongsheng@627
|
1978 "They eliminate the social distinction that centralised tools impose: that "
|
dongsheng@627
|
1979 "between insiders (people with commit access) and outsiders (people without)."
|
dongsheng@627
|
1980 msgstr ""
|
dongsheng@627
|
1981
|
dongsheng@627
|
1982 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
1983 #: ../en/ch01-intro.xml:338
|
dongsheng@627
|
1984 msgid ""
|
dongsheng@627
|
1985 "They make it easier to reconcile after a social fork, because all that's "
|
dongsheng@627
|
1986 "involved from the perspective of the revision control software is just "
|
dongsheng@627
|
1987 "another merge."
|
dongsheng@627
|
1988 msgstr ""
|
dongsheng@627
|
1989
|
dongsheng@627
|
1990 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
1991 #: ../en/ch01-intro.xml:343
|
dongsheng@627
|
1992 msgid ""
|
dongsheng@627
|
1993 "Some people resist distributed tools because they want to retain tight "
|
dongsheng@627
|
1994 "control over their projects, and they believe that centralised tools give "
|
dongsheng@627
|
1995 "them this control. However, if you're of this belief, and you publish your "
|
dongsheng@627
|
1996 "CVS or Subversion repositories publicly, there are plenty of tools available "
|
dongsheng@627
|
1997 "that can pull out your entire project's history (albeit slowly) and recreate "
|
dongsheng@627
|
1998 "it somewhere that you don't control. So while your control in this case is "
|
dongsheng@627
|
1999 "illusory, you are forgoing the ability to fluidly collaborate with whatever "
|
dongsheng@627
|
2000 "people feel compelled to mirror and fork your history."
|
dongsheng@627
|
2001 msgstr ""
|
dongsheng@627
|
2002
|
dongsheng@627
|
2003 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
2004 #: ../en/ch01-intro.xml:358
|
dongsheng@627
|
2005 msgid "Advantages for commercial projects"
|
dongsheng@627
|
2006 msgstr "商业项目的优点"
|
dongsheng@627
|
2007
|
dongsheng@627
|
2008 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2009 #: ../en/ch01-intro.xml:360
|
dongsheng@627
|
2010 msgid ""
|
dongsheng@627
|
2011 "Many commercial projects are undertaken by teams that are scattered across "
|
dongsheng@627
|
2012 "the globe. Contributors who are far from a central server will see slower "
|
dongsheng@627
|
2013 "command execution and perhaps less reliability. Commercial revision control "
|
dongsheng@627
|
2014 "systems attempt to ameliorate these problems with remote-site replication add-"
|
dongsheng@627
|
2015 "ons that are typically expensive to buy and cantankerous to administer. A "
|
dongsheng@627
|
2016 "distributed system doesn't suffer from these problems in the first place. "
|
dongsheng@627
|
2017 "Better yet, you can easily set up multiple authoritative servers, say one per "
|
dongsheng@627
|
2018 "site, so that there's no redundant communication between repositories over "
|
dongsheng@627
|
2019 "expensive long-haul network links."
|
dongsheng@627
|
2020 msgstr ""
|
dongsheng@627
|
2021
|
dongsheng@627
|
2022 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2023 #: ../en/ch01-intro.xml:372
|
dongsheng@627
|
2024 msgid ""
|
dongsheng@627
|
2025 "Centralised revision control systems tend to have relatively low "
|
dongsheng@627
|
2026 "scalability. It's not unusual for an expensive centralised system to fall "
|
dongsheng@627
|
2027 "over under the combined load of just a few dozen concurrent users. Once "
|
dongsheng@627
|
2028 "again, the typical response tends to be an expensive and clunky replication "
|
dongsheng@627
|
2029 "facility. Since the load on a central server---if you have one at all---is "
|
dongsheng@627
|
2030 "many times lower with a distributed tool (because all of the data is "
|
dongsheng@627
|
2031 "replicated everywhere), a single cheap server can handle the needs of a much "
|
dongsheng@627
|
2032 "larger team, and replication to balance load becomes a simple matter of "
|
dongsheng@627
|
2033 "scripting."
|
dongsheng@627
|
2034 msgstr ""
|
dongsheng@627
|
2035
|
dongsheng@627
|
2036 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2037 #: ../en/ch01-intro.xml:384
|
dongsheng@627
|
2038 msgid ""
|
dongsheng@627
|
2039 "If you have an employee in the field, troubleshooting a problem at a "
|
dongsheng@627
|
2040 "customer's site, they'll benefit from distributed revision control. The tool "
|
dongsheng@627
|
2041 "will let them generate custom builds, try different fixes in isolation from "
|
dongsheng@627
|
2042 "each other, and search efficiently through history for the sources of bugs "
|
dongsheng@627
|
2043 "and regressions in the customer's environment, all without needing to connect "
|
dongsheng@627
|
2044 "to your company's network."
|
dongsheng@627
|
2045 msgstr ""
|
dongsheng@627
|
2046
|
dongsheng@627
|
2047 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
2048 #: ../en/ch01-intro.xml:395
|
dongsheng@627
|
2049 msgid "Why choose Mercurial?"
|
dongsheng@627
|
2050 msgstr "为什么选择 Mercurial?"
|
dongsheng@627
|
2051
|
dongsheng@627
|
2052 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
2053 #: ../en/ch01-intro.xml:397
|
dongsheng@627
|
2054 msgid ""
|
dongsheng@627
|
2055 "Mercurial has a unique set of properties that make it a particularly good "
|
dongsheng@627
|
2056 "choice as a revision control system."
|
dongsheng@627
|
2057 msgstr ""
|
dongsheng@627
|
2058
|
dongsheng@627
|
2059 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
2060 #: ../en/ch01-intro.xml:400
|
dongsheng@627
|
2061 msgid "It is easy to learn and use."
|
dongsheng@627
|
2062 msgstr ""
|
dongsheng@627
|
2063
|
dongsheng@627
|
2064 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
2065 #: ../en/ch01-intro.xml:401
|
dongsheng@627
|
2066 msgid "It is lightweight."
|
dongsheng@627
|
2067 msgstr ""
|
dongsheng@627
|
2068
|
dongsheng@627
|
2069 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
2070 #: ../en/ch01-intro.xml:402
|
dongsheng@627
|
2071 msgid "It scales excellently."
|
dongsheng@627
|
2072 msgstr ""
|
dongsheng@627
|
2073
|
dongsheng@627
|
2074 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
2075 #: ../en/ch01-intro.xml:403
|
dongsheng@627
|
2076 msgid "It is easy to customise."
|
dongsheng@627
|
2077 msgstr ""
|
dongsheng@627
|
2078
|
dongsheng@627
|
2079 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
2080 #: ../en/ch01-intro.xml:406
|
dongsheng@627
|
2081 msgid ""
|
dongsheng@627
|
2082 "If you are at all familiar with revision control systems, you should be able "
|
dongsheng@627
|
2083 "to get up and running with Mercurial in less than five minutes. Even if not, "
|
dongsheng@627
|
2084 "it will take no more than a few minutes longer. Mercurial's command and "
|
dongsheng@627
|
2085 "feature sets are generally uniform and consistent, so you can keep track of a "
|
dongsheng@627
|
2086 "few general rules instead of a host of exceptions."
|
dongsheng@627
|
2087 msgstr ""
|
dongsheng@627
|
2088
|
dongsheng@627
|
2089 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
2090 #: ../en/ch01-intro.xml:413
|
dongsheng@627
|
2091 msgid ""
|
dongsheng@627
|
2092 "On a small project, you can start working with Mercurial in moments. Creating "
|
dongsheng@627
|
2093 "new changes and branches; transferring changes around (whether locally or "
|
dongsheng@627
|
2094 "over a network); and history and status operations are all fast. Mercurial "
|
dongsheng@627
|
2095 "attempts to stay nimble and largely out of your way by combining low "
|
dongsheng@627
|
2096 "cognitive overhead with blazingly fast operations."
|
dongsheng@627
|
2097 msgstr ""
|
dongsheng@627
|
2098
|
dongsheng@627
|
2099 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
2100 #: ../en/ch01-intro.xml:420
|
dongsheng@627
|
2101 msgid ""
|
dongsheng@627
|
2102 "The usefulness of Mercurial is not limited to small projects: it is used by "
|
dongsheng@627
|
2103 "projects with hundreds to thousands of contributors, each containing tens of "
|
dongsheng@627
|
2104 "thousands of files and hundreds of megabytes of source code."
|
dongsheng@627
|
2105 msgstr ""
|
dongsheng@627
|
2106
|
dongsheng@627
|
2107 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
2108 #: ../en/ch01-intro.xml:425
|
dongsheng@627
|
2109 msgid ""
|
dongsheng@627
|
2110 "If the core functionality of Mercurial is not enough for you, it's easy to "
|
dongsheng@627
|
2111 "build on. Mercurial is well suited to scripting tasks, and its clean "
|
dongsheng@627
|
2112 "internals and implementation in Python make it easy to add features in the "
|
dongsheng@627
|
2113 "form of extensions. There are a number of popular and useful extensions "
|
dongsheng@627
|
2114 "already available, ranging from helping to identify bugs to improving "
|
dongsheng@627
|
2115 "performance."
|
dongsheng@627
|
2116 msgstr ""
|
dongsheng@627
|
2117
|
dongsheng@627
|
2118 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
2119 #: ../en/ch01-intro.xml:435
|
dongsheng@627
|
2120 msgid "Mercurial compared with other tools"
|
dongsheng@627
|
2121 msgstr "Mercurial 与其它工具的比较"
|
dongsheng@627
|
2122
|
dongsheng@627
|
2123 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
2124 #: ../en/ch01-intro.xml:437
|
dongsheng@627
|
2125 msgid ""
|
dongsheng@627
|
2126 "Before you read on, please understand that this section necessarily reflects "
|
dongsheng@627
|
2127 "my own experiences, interests, and (dare I say it) biases. I have used every "
|
dongsheng@627
|
2128 "one of the revision control tools listed below, in most cases for several "
|
dongsheng@627
|
2129 "years at a time."
|
dongsheng@627
|
2130 msgstr ""
|
dongsheng@627
|
2131
|
dongsheng@627
|
2132 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
2133 #: ../en/ch01-intro.xml:445 ../en/ch01-intro.xml:656
|
dongsheng@627
|
2134 msgid "Subversion"
|
dongsheng@627
|
2135 msgstr ""
|
dongsheng@627
|
2136
|
dongsheng@627
|
2137 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2138 #: ../en/ch01-intro.xml:447
|
dongsheng@627
|
2139 msgid ""
|
dongsheng@627
|
2140 "Subversion is a popular revision control tool, developed to replace CVS. It "
|
dongsheng@627
|
2141 "has a centralised client/server architecture."
|
dongsheng@627
|
2142 msgstr ""
|
dongsheng@627
|
2143
|
dongsheng@627
|
2144 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2145 #: ../en/ch01-intro.xml:451
|
dongsheng@627
|
2146 msgid ""
|
dongsheng@627
|
2147 "Subversion and Mercurial have similarly named commands for performing the "
|
dongsheng@627
|
2148 "same operations, so if you're familiar with one, it is easy to learn to use "
|
dongsheng@627
|
2149 "the other. Both tools are portable to all popular operating systems."
|
dongsheng@627
|
2150 msgstr ""
|
dongsheng@627
|
2151
|
dongsheng@627
|
2152 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2153 #: ../en/ch01-intro.xml:456
|
dongsheng@627
|
2154 msgid ""
|
dongsheng@627
|
2155 "Prior to version 1.5, Subversion had no useful support for merges. At the "
|
dongsheng@627
|
2156 "time of writing, its merge tracking capability is new, and known to be <ulink "
|
dongsheng@627
|
2157 "url=\"http://svnbook.red-bean.com/nightly/en/svn.branchmerge.advanced."
|
dongsheng@627
|
2158 "html#svn.branchmerge.advanced.finalword\">complicated and buggy</ulink>."
|
dongsheng@627
|
2159 msgstr ""
|
dongsheng@627
|
2160
|
dongsheng@627
|
2161 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2162 #: ../en/ch01-intro.xml:462
|
dongsheng@627
|
2163 msgid ""
|
dongsheng@627
|
2164 "Mercurial has a substantial performance advantage over Subversion on every "
|
dongsheng@627
|
2165 "revision control operation I have benchmarked. I have measured its advantage "
|
dongsheng@627
|
2166 "as ranging from a factor of two to a factor of six when compared with "
|
dongsheng@627
|
2167 "Subversion 1.4.3's <emphasis>ra_local</emphasis> file store, which is the "
|
dongsheng@627
|
2168 "fastest access method available. In more realistic deployments involving a "
|
dongsheng@627
|
2169 "network-based store, Subversion will be at a substantially larger "
|
dongsheng@627
|
2170 "disadvantage. Because many Subversion commands must talk to the server and "
|
dongsheng@627
|
2171 "Subversion does not have useful replication facilities, server capacity and "
|
dongsheng@627
|
2172 "network bandwidth become bottlenecks for modestly large projects."
|
dongsheng@627
|
2173 msgstr ""
|
dongsheng@627
|
2174
|
dongsheng@627
|
2175 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2176 #: ../en/ch01-intro.xml:475
|
dongsheng@627
|
2177 msgid ""
|
dongsheng@627
|
2178 "Additionally, Subversion incurs substantial storage overhead to avoid network "
|
dongsheng@627
|
2179 "transactions for a few common operations, such as finding modified files "
|
dongsheng@627
|
2180 "(<literal>status</literal>) and displaying modifications against the current "
|
dongsheng@627
|
2181 "revision (<literal>diff</literal>). As a result, a Subversion working copy "
|
dongsheng@627
|
2182 "is often the same size as, or larger than, a Mercurial repository and working "
|
dongsheng@627
|
2183 "directory, even though the Mercurial repository contains a complete history "
|
dongsheng@627
|
2184 "of the project."
|
dongsheng@627
|
2185 msgstr ""
|
dongsheng@627
|
2186
|
dongsheng@627
|
2187 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2188 #: ../en/ch01-intro.xml:485
|
dongsheng@627
|
2189 msgid ""
|
dongsheng@627
|
2190 "Subversion is widely supported by third party tools. Mercurial currently "
|
dongsheng@627
|
2191 "lags considerably in this area. This gap is closing, however, and indeed "
|
dongsheng@627
|
2192 "some of Mercurial's GUI tools now outshine their Subversion equivalents. "
|
dongsheng@627
|
2193 "Like Mercurial, Subversion has an excellent user manual."
|
dongsheng@627
|
2194 msgstr ""
|
dongsheng@627
|
2195
|
dongsheng@627
|
2196 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2197 #: ../en/ch01-intro.xml:491
|
dongsheng@627
|
2198 msgid ""
|
dongsheng@627
|
2199 "Because Subversion doesn't store revision history on the client, it is well "
|
dongsheng@627
|
2200 "suited to managing projects that deal with lots of large, opaque binary "
|
dongsheng@627
|
2201 "files. If you check in fifty revisions to an incompressible 10MB file, "
|
dongsheng@627
|
2202 "Subversion's client-side space usage stays constant The space used by any "
|
dongsheng@627
|
2203 "distributed SCM will grow rapidly in proportion to the number of revisions, "
|
dongsheng@627
|
2204 "because the differences between each revision are large."
|
dongsheng@627
|
2205 msgstr ""
|
dongsheng@627
|
2206
|
dongsheng@627
|
2207 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2208 #: ../en/ch01-intro.xml:500
|
dongsheng@627
|
2209 msgid ""
|
dongsheng@627
|
2210 "In addition, it's often difficult or, more usually, impossible to merge "
|
dongsheng@627
|
2211 "different versions of a binary file. Subversion's ability to let a user lock "
|
dongsheng@627
|
2212 "a file, so that they temporarily have the exclusive right to commit changes "
|
dongsheng@627
|
2213 "to it, can be a significant advantage to a project where binary files are "
|
dongsheng@627
|
2214 "widely used."
|
dongsheng@627
|
2215 msgstr ""
|
dongsheng@627
|
2216
|
dongsheng@627
|
2217 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2218 #: ../en/ch01-intro.xml:507
|
dongsheng@627
|
2219 msgid ""
|
dongsheng@627
|
2220 "Mercurial can import revision history from a Subversion repository. It can "
|
dongsheng@627
|
2221 "also export revision history to a Subversion repository. This makes it easy "
|
dongsheng@627
|
2222 "to <quote>test the waters</quote> and use Mercurial and Subversion in "
|
dongsheng@627
|
2223 "parallel before deciding to switch. History conversion is incremental, so "
|
dongsheng@627
|
2224 "you can perform an initial conversion, then small additional conversions "
|
dongsheng@627
|
2225 "afterwards to bring in new changes."
|
dongsheng@627
|
2226 msgstr ""
|
dongsheng@627
|
2227
|
dongsheng@627
|
2228 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
2229 #: ../en/ch01-intro.xml:519 ../en/ch01-intro.xml:658
|
dongsheng@627
|
2230 msgid "Git"
|
dongsheng@627
|
2231 msgstr ""
|
dongsheng@627
|
2232
|
dongsheng@627
|
2233 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2234 #: ../en/ch01-intro.xml:521
|
dongsheng@627
|
2235 msgid ""
|
dongsheng@627
|
2236 "Git is a distributed revision control tool that was developed for managing "
|
dongsheng@627
|
2237 "the Linux kernel source tree. Like Mercurial, its early design was somewhat "
|
dongsheng@627
|
2238 "influenced by Monotone."
|
dongsheng@627
|
2239 msgstr ""
|
dongsheng@627
|
2240
|
dongsheng@627
|
2241 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2242 #: ../en/ch01-intro.xml:526
|
dongsheng@627
|
2243 msgid ""
|
dongsheng@627
|
2244 "Git has a very large command set, with version 1.5.0 providing 139 individual "
|
dongsheng@627
|
2245 "commands. It has something of a reputation for being difficult to learn. "
|
dongsheng@627
|
2246 "Compared to Git, Mercurial has a strong focus on simplicity."
|
dongsheng@627
|
2247 msgstr ""
|
dongsheng@627
|
2248
|
dongsheng@627
|
2249 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2250 #: ../en/ch01-intro.xml:531
|
dongsheng@627
|
2251 msgid ""
|
dongsheng@627
|
2252 "In terms of performance, Git is extremely fast. In several cases, it is "
|
dongsheng@627
|
2253 "faster than Mercurial, at least on Linux, while Mercurial performs better on "
|
dongsheng@627
|
2254 "other operations. However, on Windows, the performance and general level of "
|
dongsheng@627
|
2255 "support that Git provides is, at the time of writing, far behind that of "
|
dongsheng@627
|
2256 "Mercurial."
|
dongsheng@627
|
2257 msgstr ""
|
dongsheng@627
|
2258
|
dongsheng@627
|
2259 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2260 #: ../en/ch01-intro.xml:538
|
dongsheng@627
|
2261 msgid ""
|
dongsheng@627
|
2262 "While a Mercurial repository needs no maintenance, a Git repository requires "
|
dongsheng@627
|
2263 "frequent manual <quote>repacks</quote> of its metadata. Without these, "
|
dongsheng@627
|
2264 "performance degrades, while space usage grows rapidly. A server that "
|
dongsheng@627
|
2265 "contains many Git repositories that are not rigorously and frequently "
|
dongsheng@627
|
2266 "repacked will become heavily disk-bound during backups, and there have been "
|
dongsheng@627
|
2267 "instances of daily backups taking far longer than 24 hours as a result. A "
|
dongsheng@627
|
2268 "freshly packed Git repository is slightly smaller than a Mercurial "
|
dongsheng@627
|
2269 "repository, but an unpacked repository is several orders of magnitude larger."
|
dongsheng@627
|
2270 msgstr ""
|
dongsheng@627
|
2271
|
dongsheng@627
|
2272 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2273 #: ../en/ch01-intro.xml:549
|
dongsheng@627
|
2274 msgid ""
|
dongsheng@627
|
2275 "The core of Git is written in C. Many Git commands are implemented as shell "
|
dongsheng@627
|
2276 "or Perl scripts, and the quality of these scripts varies widely. I have "
|
dongsheng@627
|
2277 "encountered several instances where scripts charged along blindly in the "
|
dongsheng@627
|
2278 "presence of errors that should have been fatal."
|
dongsheng@627
|
2279 msgstr ""
|
dongsheng@627
|
2280
|
dongsheng@627
|
2281 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2282 #: ../en/ch01-intro.xml:555
|
dongsheng@627
|
2283 msgid "Mercurial can import revision history from a Git repository."
|
dongsheng@627
|
2284 msgstr ""
|
dongsheng@627
|
2285
|
dongsheng@627
|
2286 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
2287 #: ../en/ch01-intro.xml:561 ../en/ch01-intro.xml:657
|
dongsheng@627
|
2288 msgid "CVS"
|
dongsheng@627
|
2289 msgstr ""
|
dongsheng@627
|
2290
|
dongsheng@627
|
2291 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2292 #: ../en/ch01-intro.xml:563
|
dongsheng@627
|
2293 msgid ""
|
dongsheng@627
|
2294 "CVS is probably the most widely used revision control tool in the world. Due "
|
dongsheng@627
|
2295 "to its age and internal untidiness, it has been only lightly maintained for "
|
dongsheng@627
|
2296 "many years."
|
dongsheng@627
|
2297 msgstr ""
|
dongsheng@627
|
2298
|
dongsheng@627
|
2299 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2300 #: ../en/ch01-intro.xml:567
|
dongsheng@627
|
2301 msgid ""
|
dongsheng@627
|
2302 "It has a centralised client/server architecture. It does not group related "
|
dongsheng@627
|
2303 "file changes into atomic commits, making it easy for people to <quote>break "
|
dongsheng@627
|
2304 "the build</quote>: one person can successfully commit part of a change and "
|
dongsheng@627
|
2305 "then be blocked by the need for a merge, causing other people to see only a "
|
dongsheng@627
|
2306 "portion of the work they intended to do. This also affects how you work with "
|
dongsheng@627
|
2307 "project history. If you want to see all of the modifications someone made as "
|
dongsheng@627
|
2308 "part of a task, you will need to manually inspect the descriptions and "
|
dongsheng@627
|
2309 "timestamps of the changes made to each file involved (if you even know what "
|
dongsheng@627
|
2310 "those files were)."
|
dongsheng@627
|
2311 msgstr ""
|
dongsheng@627
|
2312
|
dongsheng@627
|
2313 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2314 #: ../en/ch01-intro.xml:579
|
dongsheng@627
|
2315 msgid ""
|
dongsheng@627
|
2316 "CVS has a muddled notion of tags and branches that I will not attempt to even "
|
dongsheng@627
|
2317 "describe. It does not support renaming of files or directories well, making "
|
dongsheng@627
|
2318 "it easy to corrupt a repository. It has almost no internal consistency "
|
dongsheng@627
|
2319 "checking capabilities, so it is usually not even possible to tell whether or "
|
dongsheng@627
|
2320 "how a repository is corrupt. I would not recommend CVS for any project, "
|
dongsheng@627
|
2321 "existing or new."
|
dongsheng@627
|
2322 msgstr ""
|
dongsheng@627
|
2323
|
dongsheng@627
|
2324 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2325 #: ../en/ch01-intro.xml:587
|
dongsheng@627
|
2326 msgid ""
|
dongsheng@627
|
2327 "Mercurial can import CVS revision history. However, there are a few caveats "
|
dongsheng@627
|
2328 "that apply; these are true of every other revision control tool's CVS "
|
dongsheng@627
|
2329 "importer, too. Due to CVS's lack of atomic changes and unversioned "
|
dongsheng@627
|
2330 "filesystem hierarchy, it is not possible to reconstruct CVS history "
|
dongsheng@627
|
2331 "completely accurately; some guesswork is involved, and renames will usually "
|
dongsheng@627
|
2332 "not show up. Because a lot of advanced CVS administration has to be done by "
|
dongsheng@627
|
2333 "hand and is hence error-prone, it's common for CVS importers to run into "
|
dongsheng@627
|
2334 "multiple problems with corrupted repositories (completely bogus revision "
|
dongsheng@627
|
2335 "timestamps and files that have remained locked for over a decade are just two "
|
dongsheng@627
|
2336 "of the less interesting problems I can recall from personal experience)."
|
dongsheng@627
|
2337 msgstr ""
|
dongsheng@627
|
2338
|
dongsheng@627
|
2339 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2340 #: ../en/ch01-intro.xml:601
|
dongsheng@627
|
2341 msgid "Mercurial can import revision history from a CVS repository."
|
dongsheng@627
|
2342 msgstr ""
|
dongsheng@627
|
2343
|
dongsheng@627
|
2344 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
2345 #: ../en/ch01-intro.xml:607
|
dongsheng@627
|
2346 msgid "Commercial tools"
|
dongsheng@627
|
2347 msgstr "商业工具"
|
dongsheng@627
|
2348
|
dongsheng@627
|
2349 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2350 #: ../en/ch01-intro.xml:609
|
dongsheng@627
|
2351 msgid ""
|
dongsheng@627
|
2352 "Perforce has a centralised client/server architecture, with no client-side "
|
dongsheng@627
|
2353 "caching of any data. Unlike modern revision control tools, Perforce requires "
|
dongsheng@627
|
2354 "that a user run a command to inform the server about every file they intend "
|
dongsheng@627
|
2355 "to edit."
|
dongsheng@627
|
2356 msgstr ""
|
dongsheng@627
|
2357
|
dongsheng@627
|
2358 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2359 #: ../en/ch01-intro.xml:615
|
dongsheng@627
|
2360 msgid ""
|
dongsheng@627
|
2361 "The performance of Perforce is quite good for small teams, but it falls off "
|
dongsheng@627
|
2362 "rapidly as the number of users grows beyond a few dozen. Modestly large "
|
dongsheng@627
|
2363 "Perforce installations require the deployment of proxies to cope with the "
|
dongsheng@627
|
2364 "load their users generate."
|
dongsheng@627
|
2365 msgstr ""
|
dongsheng@627
|
2366
|
dongsheng@627
|
2367 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
2368 #: ../en/ch01-intro.xml:624
|
dongsheng@627
|
2369 msgid "Choosing a revision control tool"
|
dongsheng@627
|
2370 msgstr "选择版本控制工具"
|
dongsheng@627
|
2371
|
dongsheng@627
|
2372 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2373 #: ../en/ch01-intro.xml:626
|
dongsheng@627
|
2374 msgid ""
|
dongsheng@627
|
2375 "With the exception of CVS, all of the tools listed above have unique "
|
dongsheng@627
|
2376 "strengths that suit them to particular styles of work. There is no single "
|
dongsheng@627
|
2377 "revision control tool that is best in all situations."
|
dongsheng@627
|
2378 msgstr ""
|
dongsheng@627
|
2379
|
dongsheng@627
|
2380 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2381 #: ../en/ch01-intro.xml:631
|
dongsheng@627
|
2382 msgid ""
|
dongsheng@627
|
2383 "As an example, Subversion is a good choice for working with frequently edited "
|
dongsheng@627
|
2384 "binary files, due to its centralised nature and support for file locking."
|
dongsheng@627
|
2385 msgstr ""
|
dongsheng@627
|
2386
|
dongsheng@627
|
2387 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2388 #: ../en/ch01-intro.xml:635
|
dongsheng@627
|
2389 msgid ""
|
dongsheng@627
|
2390 "I personally find Mercurial's properties of simplicity, performance, and good "
|
dongsheng@627
|
2391 "merge support to be a compelling combination that has served me well for "
|
dongsheng@627
|
2392 "several years."
|
dongsheng@627
|
2393 msgstr ""
|
dongsheng@627
|
2394
|
dongsheng@627
|
2395 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
2396 #: ../en/ch01-intro.xml:643
|
dongsheng@627
|
2397 msgid "Switching from another tool to Mercurial"
|
dongsheng@627
|
2398 msgstr "从其它工具切换到 Mercurial"
|
dongsheng@627
|
2399
|
dongsheng@627
|
2400 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
2401 #: ../en/ch01-intro.xml:645
|
dongsheng@627
|
2402 msgid ""
|
dongsheng@627
|
2403 "Mercurial is bundled with an extension named <literal role=\"hg-ext"
|
dongsheng@627
|
2404 "\">convert</literal>, which can incrementally import revision history from "
|
dongsheng@627
|
2405 "several other revision control tools. By <quote>incremental</quote>, I mean "
|
dongsheng@627
|
2406 "that you can convert all of a project's history to date in one go, then rerun "
|
dongsheng@627
|
2407 "the conversion later to obtain new changes that happened after the initial "
|
dongsheng@627
|
2408 "conversion."
|
dongsheng@627
|
2409 msgstr ""
|
dongsheng@627
|
2410
|
dongsheng@627
|
2411 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
2412 #: ../en/ch01-intro.xml:653
|
dongsheng@627
|
2413 msgid ""
|
dongsheng@627
|
2414 "The revision control tools supported by <literal role=\"hg-ext\">convert</"
|
dongsheng@627
|
2415 "literal> are as follows:"
|
dongsheng@627
|
2416 msgstr ""
|
dongsheng@627
|
2417
|
dongsheng@627
|
2418 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
2419 #: ../en/ch01-intro.xml:659
|
dongsheng@627
|
2420 msgid "Darcs"
|
dongsheng@627
|
2421 msgstr ""
|
dongsheng@627
|
2422
|
dongsheng@627
|
2423 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
2424 #: ../en/ch01-intro.xml:661
|
dongsheng@627
|
2425 msgid ""
|
dongsheng@627
|
2426 "In addition, <literal role=\"hg-ext\">convert</literal> can export changes "
|
dongsheng@627
|
2427 "from Mercurial to Subversion. This makes it possible to try Subversion and "
|
dongsheng@627
|
2428 "Mercurial in parallel before committing to a switchover, without risking the "
|
dongsheng@627
|
2429 "loss of any work."
|
dongsheng@627
|
2430 msgstr ""
|
dongsheng@627
|
2431
|
dongsheng@627
|
2432 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
2433 #: ../en/ch01-intro.xml:667
|
dongsheng@627
|
2434 msgid ""
|
dongsheng@627
|
2435 "The <command role=\"hg-ext-conver\">convert</command> command is easy to "
|
dongsheng@627
|
2436 "use. Simply point it at the path or URL of the source repository, optionally "
|
dongsheng@627
|
2437 "give it the name of the destination repository, and it will start working. "
|
dongsheng@627
|
2438 "After the initial conversion, just run the same command again to import new "
|
dongsheng@627
|
2439 "changes."
|
dongsheng@627
|
2440 msgstr ""
|
dongsheng@627
|
2441
|
dongsheng@627
|
2442 #. type: Content of: <book><chapter><title>
|
dongsheng@627
|
2443 #: ../en/ch02-tour-basic.xml:5
|
dongsheng@627
|
2444 msgid "A tour of Mercurial: the basics"
|
dongsheng@627
|
2445 msgstr "Mercurial 教程: 基础知识"
|
dongsheng@627
|
2446
|
dongsheng@627
|
2447 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
2448 #: ../en/ch02-tour-basic.xml:8
|
dongsheng@627
|
2449 msgid "Installing Mercurial on your system"
|
dongsheng@627
|
2450 msgstr "安装 Mercurial"
|
dongsheng@627
|
2451
|
dongsheng@627
|
2452 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
2453 #: ../en/ch02-tour-basic.xml:10
|
dongsheng@627
|
2454 msgid ""
|
dongsheng@627
|
2455 "Prebuilt binary packages of Mercurial are available for every popular "
|
dongsheng@627
|
2456 "operating system. These make it easy to start using Mercurial on your "
|
dongsheng@627
|
2457 "computer immediately."
|
dongsheng@627
|
2458 msgstr ""
|
dongsheng@627
|
2459
|
dongsheng@627
|
2460 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
2461 #: ../en/ch02-tour-basic.xml:15
|
dongsheng@627
|
2462 msgid "Linux"
|
dongsheng@627
|
2463 msgstr ""
|
dongsheng@627
|
2464
|
dongsheng@627
|
2465 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2466 #: ../en/ch02-tour-basic.xml:17
|
dongsheng@627
|
2467 msgid ""
|
dongsheng@627
|
2468 "Because each Linux distribution has its own packaging tools, policies, and "
|
dongsheng@627
|
2469 "rate of development, it's difficult to give a comprehensive set of "
|
dongsheng@627
|
2470 "instructions on how to install Mercurial binaries. The version of Mercurial "
|
dongsheng@627
|
2471 "that you will end up with can vary depending on how active the person is who "
|
dongsheng@627
|
2472 "maintains the package for your distribution."
|
dongsheng@627
|
2473 msgstr ""
|
dongsheng@627
|
2474
|
dongsheng@627
|
2475 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2476 #: ../en/ch02-tour-basic.xml:24
|
dongsheng@627
|
2477 msgid ""
|
dongsheng@627
|
2478 "To keep things simple, I will focus on installing Mercurial from the command "
|
dongsheng@627
|
2479 "line under the most popular Linux distributions. Most of these distributions "
|
dongsheng@627
|
2480 "provide graphical package managers that will let you install Mercurial with a "
|
dongsheng@627
|
2481 "single click; the package name to look for is <literal>mercurial</literal>."
|
dongsheng@627
|
2482 msgstr ""
|
dongsheng@627
|
2483
|
dongsheng@627
|
2484 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
2485 #: ../en/ch02-tour-basic.xml:32
|
dongsheng@627
|
2486 msgid "Debian:"
|
dongsheng@627
|
2487 msgstr ""
|
dongsheng@627
|
2488
|
dongsheng@627
|
2489 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
2490 #: ../en/ch02-tour-basic.xml:35
|
dongsheng@627
|
2491 msgid "Fedora Core:"
|
dongsheng@627
|
2492 msgstr ""
|
dongsheng@627
|
2493
|
dongsheng@627
|
2494 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
2495 #: ../en/ch02-tour-basic.xml:38
|
dongsheng@627
|
2496 msgid "Gentoo:"
|
dongsheng@627
|
2497 msgstr ""
|
dongsheng@627
|
2498
|
dongsheng@627
|
2499 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
2500 #: ../en/ch02-tour-basic.xml:40
|
dongsheng@627
|
2501 msgid "OpenSUSE:"
|
dongsheng@627
|
2502 msgstr ""
|
dongsheng@627
|
2503
|
dongsheng@627
|
2504 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
2505 #: ../en/ch02-tour-basic.xml:43
|
dongsheng@627
|
2506 msgid ""
|
dongsheng@627
|
2507 "Ubuntu: Ubuntu's Mercurial package is based on Debian's. To install it, run "
|
dongsheng@627
|
2508 "the following command."
|
dongsheng@627
|
2509 msgstr ""
|
dongsheng@627
|
2510
|
dongsheng@627
|
2511 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
2512 #: ../en/ch02-tour-basic.xml:52
|
dongsheng@627
|
2513 msgid "Solaris"
|
dongsheng@627
|
2514 msgstr ""
|
dongsheng@627
|
2515
|
dongsheng@627
|
2516 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2517 #: ../en/ch02-tour-basic.xml:54
|
dongsheng@627
|
2518 msgid ""
|
dongsheng@627
|
2519 "SunFreeWare, at <ulink url=\"http://www.sunfreeware.com\">http://www."
|
dongsheng@627
|
2520 "sunfreeware.com</ulink>, is a good source for a large number of pre-built "
|
dongsheng@627
|
2521 "Solaris packages for 32 and 64 bit Intel and Sparc architectures, including "
|
dongsheng@627
|
2522 "current versions of Mercurial."
|
dongsheng@627
|
2523 msgstr ""
|
dongsheng@627
|
2524
|
dongsheng@627
|
2525 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
2526 #: ../en/ch02-tour-basic.xml:62
|
dongsheng@627
|
2527 msgid "Mac OS X"
|
dongsheng@627
|
2528 msgstr ""
|
dongsheng@627
|
2529
|
dongsheng@627
|
2530 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2531 #: ../en/ch02-tour-basic.xml:64
|
dongsheng@627
|
2532 msgid ""
|
dongsheng@627
|
2533 "Lee Cantey publishes an installer of Mercurial for Mac OS X at <ulink url="
|
dongsheng@627
|
2534 "\"http://mercurial.berkwood.com\">http://mercurial.berkwood.com</ulink>. "
|
dongsheng@627
|
2535 "This package works on both Intel- and Power-based Macs. Before you can use "
|
dongsheng@627
|
2536 "it, you must install a compatible version of Universal MacPython "
|
dongsheng@627
|
2537 "<citation>web:macpython</citation>. This is easy to do; simply follow the "
|
dongsheng@627
|
2538 "instructions on Lee's site."
|
dongsheng@627
|
2539 msgstr ""
|
dongsheng@627
|
2540
|
dongsheng@627
|
2541 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2542 #: ../en/ch02-tour-basic.xml:73
|
dongsheng@627
|
2543 msgid ""
|
dongsheng@627
|
2544 "It's also possible to install Mercurial using Fink or MacPorts, two popular "
|
dongsheng@627
|
2545 "free package managers for Mac OS X. If you have Fink, use <command>sudo apt-"
|
dongsheng@627
|
2546 "get install mercurial-py25</command>. If MacPorts, <command>sudo port "
|
dongsheng@627
|
2547 "install mercurial</command>."
|
dongsheng@627
|
2548 msgstr ""
|
dongsheng@627
|
2549
|
dongsheng@627
|
2550 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
2551 #: ../en/ch02-tour-basic.xml:81
|
dongsheng@627
|
2552 msgid "Windows"
|
dongsheng@627
|
2553 msgstr ""
|
dongsheng@627
|
2554
|
dongsheng@627
|
2555 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2556 #: ../en/ch02-tour-basic.xml:83
|
dongsheng@627
|
2557 msgid ""
|
dongsheng@627
|
2558 "Lee Cantey publishes an installer of Mercurial for Windows at <ulink url="
|
dongsheng@627
|
2559 "\"http://mercurial.berkwood.com\">http://mercurial.berkwood.com</ulink>. "
|
dongsheng@627
|
2560 "This package has no external dependencies; it <quote>just works</quote>."
|
dongsheng@627
|
2561 msgstr ""
|
dongsheng@627
|
2562
|
dongsheng@627
|
2563 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@627
|
2564 #: ../en/ch02-tour-basic.xml:90
|
dongsheng@627
|
2565 msgid ""
|
dongsheng@627
|
2566 "The Windows version of Mercurial does not automatically convert line endings "
|
dongsheng@627
|
2567 "between Windows and Unix styles. If you want to share work with Unix users, "
|
dongsheng@627
|
2568 "you must do a little additional configuration work. XXX Flesh this out."
|
dongsheng@627
|
2569 msgstr ""
|
dongsheng@627
|
2570
|
dongsheng@627
|
2571 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
2572 #: ../en/ch02-tour-basic.xml:100
|
dongsheng@627
|
2573 msgid "Getting started"
|
dongsheng@627
|
2574 msgstr "开始"
|
dongsheng@627
|
2575
|
dongsheng@627
|
2576 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
2577 #: ../en/ch02-tour-basic.xml:102
|
dongsheng@627
|
2578 msgid ""
|
dongsheng@627
|
2579 "To begin, we'll use the <command role=\"hg-cmd\">hg version</command> command "
|
dongsheng@627
|
2580 "to find out whether Mercurial is actually installed properly. The actual "
|
dongsheng@627
|
2581 "version information that it prints isn't so important; it's whether it prints "
|
dongsheng@627
|
2582 "anything at all that we care about."
|
dongsheng@627
|
2583 msgstr ""
|
dongsheng@627
|
2584
|
dongsheng@627
|
2585 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
2586 #: ../en/ch02-tour-basic.xml:111
|
dongsheng@627
|
2587 msgid "Built-in help"
|
dongsheng@627
|
2588 msgstr "内置帮助"
|
dongsheng@627
|
2589
|
dongsheng@627
|
2590 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2591 #: ../en/ch02-tour-basic.xml:113
|
dongsheng@627
|
2592 msgid ""
|
dongsheng@627
|
2593 "Mercurial provides a built-in help system. This is invaluable for those "
|
dongsheng@627
|
2594 "times when you find yourself stuck trying to remember how to run a command. "
|
dongsheng@627
|
2595 "If you are completely stuck, simply run <command role=\"hg-cmd\">hg help</"
|
dongsheng@627
|
2596 "command>; it will print a brief list of commands, along with a description of "
|
dongsheng@627
|
2597 "what each does. If you ask for help on a specific command (as below), it "
|
dongsheng@627
|
2598 "prints more detailed information."
|
dongsheng@627
|
2599 msgstr ""
|
dongsheng@627
|
2600
|
dongsheng@627
|
2601 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2602 #: ../en/ch02-tour-basic.xml:124
|
dongsheng@627
|
2603 msgid ""
|
dongsheng@627
|
2604 "For a more impressive level of detail (which you won't usually need) run "
|
dongsheng@627
|
2605 "<command role=\"hg-cmd\">hg help <option role=\"hg-opt-global\">-v</option></"
|
dongsheng@627
|
2606 "command>. The <option role=\"hg-opt-global\">-v</option> option is short for "
|
dongsheng@627
|
2607 "<option role=\"hg-opt-global\">--verbose</option>, and tells Mercurial to "
|
dongsheng@627
|
2608 "print more information than it usually would."
|
dongsheng@627
|
2609 msgstr ""
|
dongsheng@627
|
2610
|
dongsheng@627
|
2611 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
2612 #: ../en/ch02-tour-basic.xml:135
|
dongsheng@627
|
2613 msgid "Working with a repository"
|
dongsheng@627
|
2614 msgstr "使用版本库"
|
dongsheng@627
|
2615
|
dongsheng@627
|
2616 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
2617 #: ../en/ch02-tour-basic.xml:137
|
dongsheng@627
|
2618 msgid ""
|
dongsheng@627
|
2619 "In Mercurial, everything happens inside a <emphasis>repository</emphasis>. "
|
dongsheng@627
|
2620 "The repository for a project contains all of the files that <quote>belong to</"
|
dongsheng@627
|
2621 "quote> that project, along with a historical record of the project's files."
|
dongsheng@627
|
2622 msgstr ""
|
dongsheng@627
|
2623
|
dongsheng@627
|
2624 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
2625 #: ../en/ch02-tour-basic.xml:143
|
dongsheng@627
|
2626 msgid ""
|
dongsheng@627
|
2627 "There's nothing particularly magical about a repository; it is simply a "
|
dongsheng@627
|
2628 "directory tree in your filesystem that Mercurial treats as special. You can "
|
dongsheng@627
|
2629 "rename or delete a repository any time you like, using either the command "
|
dongsheng@627
|
2630 "line or your file browser."
|
dongsheng@627
|
2631 msgstr ""
|
dongsheng@627
|
2632
|
dongsheng@627
|
2633 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
2634 #: ../en/ch02-tour-basic.xml:150
|
dongsheng@627
|
2635 msgid "Making a local copy of a repository"
|
dongsheng@627
|
2636 msgstr "创建版本库的工作副本"
|
dongsheng@627
|
2637
|
dongsheng@627
|
2638 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2639 #: ../en/ch02-tour-basic.xml:152
|
dongsheng@627
|
2640 msgid ""
|
dongsheng@627
|
2641 "<emphasis>Copying</emphasis> a repository is just a little bit special. "
|
dongsheng@627
|
2642 "While you could use a normal file copying command to make a copy of a "
|
dongsheng@627
|
2643 "repository, it's best to use a built-in command that Mercurial provides. "
|
dongsheng@627
|
2644 "This command is called <command role=\"hg-cmd\">hg clone</command>, because "
|
dongsheng@627
|
2645 "it creates an identical copy of an existing repository."
|
dongsheng@627
|
2646 msgstr ""
|
dongsheng@627
|
2647
|
dongsheng@627
|
2648 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2649 #: ../en/ch02-tour-basic.xml:161
|
dongsheng@627
|
2650 msgid ""
|
dongsheng@627
|
2651 "If our clone succeeded, we should now have a local directory called <filename "
|
dongsheng@627
|
2652 "class=\"directory\">hello</filename>. This directory will contain some files."
|
dongsheng@627
|
2653 msgstr ""
|
dongsheng@627
|
2654
|
dongsheng@627
|
2655 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2656 #: ../en/ch02-tour-basic.xml:167
|
dongsheng@627
|
2657 msgid ""
|
dongsheng@627
|
2658 "These files have the same contents and history in our repository as they do "
|
dongsheng@627
|
2659 "in the repository we cloned."
|
dongsheng@627
|
2660 msgstr ""
|
dongsheng@627
|
2661
|
dongsheng@627
|
2662 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2663 #: ../en/ch02-tour-basic.xml:170
|
dongsheng@627
|
2664 msgid ""
|
dongsheng@627
|
2665 "Every Mercurial repository is complete, self-contained, and independent. It "
|
dongsheng@627
|
2666 "contains its own private copy of a project's files and history. A cloned "
|
dongsheng@627
|
2667 "repository remembers the location of the repository it was cloned from, but "
|
dongsheng@627
|
2668 "it does not communicate with that repository, or any other, unless you tell "
|
dongsheng@627
|
2669 "it to."
|
dongsheng@627
|
2670 msgstr ""
|
dongsheng@627
|
2671
|
dongsheng@627
|
2672 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2673 #: ../en/ch02-tour-basic.xml:177
|
dongsheng@627
|
2674 msgid ""
|
dongsheng@627
|
2675 "What this means for now is that we're free to experiment with our repository, "
|
dongsheng@627
|
2676 "safe in the knowledge that it's a private <quote>sandbox</quote> that won't "
|
dongsheng@627
|
2677 "affect anyone else."
|
dongsheng@627
|
2678 msgstr ""
|
dongsheng@627
|
2679
|
dongsheng@627
|
2680 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
2681 #: ../en/ch02-tour-basic.xml:183
|
dongsheng@627
|
2682 msgid "What's in a repository?"
|
dongsheng@627
|
2683 msgstr "什么是版本库?"
|
dongsheng@627
|
2684
|
dongsheng@627
|
2685 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2686 #: ../en/ch02-tour-basic.xml:185
|
dongsheng@627
|
2687 msgid ""
|
dongsheng@627
|
2688 "When we take a more detailed look inside a repository, we can see that it "
|
dongsheng@627
|
2689 "contains a directory named <filename class=\"directory\">.hg</filename>. "
|
dongsheng@627
|
2690 "This is where Mercurial keeps all of its metadata for the repository."
|
dongsheng@627
|
2691 msgstr ""
|
dongsheng@627
|
2692
|
dongsheng@627
|
2693 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2694 #: ../en/ch02-tour-basic.xml:192
|
dongsheng@627
|
2695 msgid ""
|
dongsheng@627
|
2696 "The contents of the <filename class=\"directory\">.hg</filename> directory "
|
dongsheng@627
|
2697 "and its subdirectories are private to Mercurial. Every other file and "
|
dongsheng@627
|
2698 "directory in the repository is yours to do with as you please."
|
dongsheng@627
|
2699 msgstr ""
|
dongsheng@627
|
2700
|
dongsheng@627
|
2701 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
2702 #: ../en/ch02-tour-basic.xml:198
|
dongsheng@627
|
2703 msgid ""
|
dongsheng@627
|
2704 "To introduce a little terminology, the <filename class=\"directory\">.hg</"
|
dongsheng@627
|
2705 "filename> directory is the <quote>real</quote> repository, and all of the "
|
dongsheng@627
|
2706 "files and directories that coexist with it are said to live in the "
|
dongsheng@627
|
2707 "<emphasis>working directory</emphasis>. An easy way to remember the "
|
dongsheng@627
|
2708 "distinction is that the <emphasis>repository</emphasis> contains the "
|
dongsheng@627
|
2709 "<emphasis>history</emphasis> of your project, while the <emphasis>working "
|
dongsheng@627
|
2710 "directory</emphasis> contains a <emphasis>snapshot</emphasis> of your project "
|
dongsheng@627
|
2711 "at a particular point in history."
|
dongsheng@627
|
2712 msgstr ""
|
dongsheng@627
|
2713
|
dongsheng@627
|
2714 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
2715 #: ../en/ch02-tour-basic.xml:213
|
dongsheng@627
|
2716 msgid "A tour through history"
|
dongsheng@627
|
2717 msgstr "回溯历史"
|
dongsheng@627
|
2718
|
dongsheng@627
|
2719 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
2720 #: ../en/ch02-tour-basic.xml:215
|
dongsheng@627
|
2721 msgid ""
|
dongsheng@627
|
2722 "One of the first things we might want to do with a new, unfamiliar repository "
|
dongsheng@627
|
2723 "is understand its history. The <command role=\"hg-cmd\">hg log</command> "
|
dongsheng@627
|
2724 "command gives us a view of history."
|
dongsheng@627
|
2725 msgstr ""
|
dongsheng@627
|
2726
|
dongsheng@627
|
2727 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
2728 #: ../en/ch02-tour-basic.xml:222
|
dongsheng@627
|
2729 msgid ""
|
dongsheng@627
|
2730 "By default, this command prints a brief paragraph of output for each change "
|
dongsheng@627
|
2731 "to the project that was recorded. In Mercurial terminology, we call each of "
|
dongsheng@627
|
2732 "these recorded events a <emphasis>changeset</emphasis>, because it can "
|
dongsheng@627
|
2733 "contain a record of changes to several files."
|
dongsheng@627
|
2734 msgstr ""
|
dongsheng@627
|
2735
|
dongsheng@627
|
2736 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
2737 #: ../en/ch02-tour-basic.xml:228
|
dongsheng@627
|
2738 msgid ""
|
dongsheng@627
|
2739 "The fields in a record of output from <command role=\"hg-cmd\">hg log</"
|
dongsheng@627
|
2740 "command> are as follows."
|
dongsheng@627
|
2741 msgstr ""
|
dongsheng@627
|
2742
|
dongsheng@627
|
2743 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
2744 #: ../en/ch02-tour-basic.xml:231
|
dongsheng@627
|
2745 msgid ""
|
dongsheng@627
|
2746 "<literal>changeset</literal>: This field has the format of a number, followed "
|
dongsheng@627
|
2747 "by a colon, followed by a hexadecimal string. These are "
|
dongsheng@627
|
2748 "<emphasis>identifiers</emphasis> for the changeset. There are two "
|
dongsheng@627
|
2749 "identifiers because the number is shorter and easier to type than the hex "
|
dongsheng@627
|
2750 "string."
|
dongsheng@627
|
2751 msgstr ""
|
dongsheng@627
|
2752
|
dongsheng@627
|
2753 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
2754 #: ../en/ch02-tour-basic.xml:237
|
dongsheng@627
|
2755 msgid ""
|
dongsheng@627
|
2756 "<literal>user</literal>: The identity of the person who created the "
|
dongsheng@627
|
2757 "changeset. This is a free-form field, but it most often contains a person's "
|
dongsheng@627
|
2758 "name and email address."
|
dongsheng@627
|
2759 msgstr ""
|
dongsheng@627
|
2760
|
dongsheng@627
|
2761 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
2762 #: ../en/ch02-tour-basic.xml:241
|
dongsheng@627
|
2763 msgid ""
|
dongsheng@627
|
2764 "<literal>date</literal>: The date and time on which the changeset was "
|
dongsheng@627
|
2765 "created, and the timezone in which it was created. (The date and time are "
|
dongsheng@627
|
2766 "local to that timezone; they display what time and date it was for the person "
|
dongsheng@627
|
2767 "who created the changeset.)"
|
dongsheng@627
|
2768 msgstr ""
|
dongsheng@627
|
2769
|
dongsheng@627
|
2770 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
2771 #: ../en/ch02-tour-basic.xml:246
|
dongsheng@627
|
2772 msgid ""
|
dongsheng@627
|
2773 "<literal>summary</literal>: The first line of the text message that the "
|
dongsheng@627
|
2774 "creator of the changeset entered to describe the changeset."
|
dongsheng@627
|
2775 msgstr ""
|
dongsheng@627
|
2776
|
dongsheng@627
|
2777 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
2778 #: ../en/ch02-tour-basic.xml:249
|
dongsheng@627
|
2779 msgid ""
|
dongsheng@627
|
2780 "The default output printed by <command role=\"hg-cmd\">hg log</command> is "
|
dongsheng@627
|
2781 "purely a summary; it is missing a lot of detail."
|
dongsheng@627
|
2782 msgstr ""
|
dongsheng@627
|
2783
|
dongsheng@627
|
2784 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
2785 #: ../en/ch02-tour-basic.xml:253
|
dongsheng@627
|
2786 msgid ""
|
dongsheng@641
|
2787 "Figure <xref endterm=\"fig.tour-basic.history.caption\" linkend=\"fig.tour-"
|
dongsheng@641
|
2788 "basic.history\"/> provides a graphical representation of the history of the "
|
dongsheng@641
|
2789 "<filename class=\"directory\">hello</filename> repository, to make it a "
|
dongsheng@641
|
2790 "little easier to see which direction history is <quote>flowing</quote> in. "
|
dongsheng@641
|
2791 "We'll be returning to this figure several times in this chapter and the "
|
dongsheng@641
|
2792 "chapter that follows."
|
dongsheng@627
|
2793 msgstr ""
|
dongsheng@627
|
2794
|
dongsheng@627
|
2795 #. type: Content of: <book><chapter><sect1><informalfigure><mediaobject>
|
dongsheng@641
|
2796 #: ../en/ch02-tour-basic.xml:264
|
dongsheng@627
|
2797 msgid ""
|
dongsheng@627
|
2798 "<imageobject><imagedata fileref=\"images/tour-history.png\"/></imageobject>"
|
dongsheng@627
|
2799 msgstr ""
|
dongsheng@627
|
2800
|
dongsheng@627
|
2801 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><textobject><phrase>
|
dongsheng@641
|
2802 #: ../en/ch02-tour-basic.xml:265 ../en/ch03-tour-merge.xml:48
|
dongsheng@641
|
2803 #: ../en/ch03-tour-merge.xml:78 ../en/ch03-tour-merge.xml:126
|
dongsheng@641
|
2804 #: ../en/ch03-tour-merge.xml:182 ../en/ch03-tour-merge.xml:254
|
dongsheng@641
|
2805 #: ../en/ch04-concepts.xml:56 ../en/ch04-concepts.xml:108
|
dongsheng@641
|
2806 #: ../en/ch04-concepts.xml:194 ../en/ch04-concepts.xml:301
|
dongsheng@641
|
2807 #: ../en/ch04-concepts.xml:353 ../en/ch04-concepts.xml:370
|
dongsheng@641
|
2808 #: ../en/ch04-concepts.xml:414 ../en/ch04-concepts.xml:436
|
dongsheng@641
|
2809 #: ../en/ch04-concepts.xml:480 ../en/ch06-collab.xml:277
|
dongsheng@641
|
2810 #: ../en/ch09-undo.xml:366 ../en/ch09-undo.xml:417 ../en/ch09-undo.xml:485
|
dongsheng@641
|
2811 #: ../en/ch09-undo.xml:527 ../en/ch12-mq.xml:409
|
dongsheng@627
|
2812 msgid "XXX add text"
|
dongsheng@627
|
2813 msgstr ""
|
dongsheng@627
|
2814
|
dongsheng@627
|
2815 #. type: Content of: <book><chapter><sect1><informalfigure><mediaobject><caption><para>
|
dongsheng@641
|
2816 #: ../en/ch02-tour-basic.xml:266
|
dongsheng@627
|
2817 msgid ""
|
dongsheng@627
|
2818 "Graphical history of the <filename class=\"directory\">hello</filename> "
|
dongsheng@627
|
2819 "repository"
|
dongsheng@627
|
2820 msgstr ""
|
dongsheng@627
|
2821
|
dongsheng@627
|
2822 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
2823 #: ../en/ch02-tour-basic.xml:273
|
dongsheng@627
|
2824 msgid "Changesets, revisions, and talking to other people"
|
dongsheng@627
|
2825 msgstr "改变集,版本,与其它用户交互"
|
dongsheng@627
|
2826
|
dongsheng@627
|
2827 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
2828 #: ../en/ch02-tour-basic.xml:276
|
dongsheng@627
|
2829 msgid ""
|
dongsheng@627
|
2830 "As English is a notoriously sloppy language, and computer science has a "
|
dongsheng@627
|
2831 "hallowed history of terminological confusion (why use one term when four will "
|
dongsheng@627
|
2832 "do?), revision control has a variety of words and phrases that mean the same "
|
dongsheng@627
|
2833 "thing. If you are talking about Mercurial history with other people, you "
|
dongsheng@627
|
2834 "will find that the word <quote>changeset</quote> is often compressed to "
|
dongsheng@627
|
2835 "<quote>change</quote> or (when written) <quote>cset</quote>, and sometimes a "
|
dongsheng@627
|
2836 "changeset is referred to as a <quote>revision</quote> or a <quote>rev</quote>."
|
dongsheng@627
|
2837 msgstr ""
|
dongsheng@627
|
2838
|
dongsheng@627
|
2839 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
2840 #: ../en/ch02-tour-basic.xml:286
|
dongsheng@627
|
2841 msgid ""
|
dongsheng@627
|
2842 "While it doesn't matter what <emphasis>word</emphasis> you use to refer to "
|
dongsheng@627
|
2843 "the concept of <quote>a changeset</quote>, the <emphasis>identifier</"
|
dongsheng@627
|
2844 "emphasis> that you use to refer to <quote>a <emphasis>specific</emphasis> "
|
dongsheng@627
|
2845 "changeset</quote> is of great importance. Recall that the <literal>changeset</"
|
dongsheng@627
|
2846 "literal> field in the output from <command role=\"hg-cmd\">hg log</command> "
|
dongsheng@627
|
2847 "identifies a changeset using both a number and a hexadecimal string."
|
dongsheng@627
|
2848 msgstr ""
|
dongsheng@627
|
2849
|
dongsheng@627
|
2850 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
2851 #: ../en/ch02-tour-basic.xml:295
|
dongsheng@627
|
2852 msgid ""
|
dongsheng@627
|
2853 "The revision number is <emphasis>only valid in that repository</emphasis>,"
|
dongsheng@627
|
2854 msgstr ""
|
dongsheng@627
|
2855
|
dongsheng@627
|
2856 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
2857 #: ../en/ch02-tour-basic.xml:297
|
dongsheng@627
|
2858 msgid ""
|
dongsheng@627
|
2859 "while the hex string is the <emphasis>permanent, unchanging identifier</"
|
dongsheng@627
|
2860 "emphasis> that will always identify that exact changeset in <emphasis>every</"
|
dongsheng@627
|
2861 "emphasis> copy of the repository."
|
dongsheng@627
|
2862 msgstr ""
|
dongsheng@627
|
2863
|
dongsheng@627
|
2864 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
2865 #: ../en/ch02-tour-basic.xml:302
|
dongsheng@627
|
2866 msgid ""
|
dongsheng@627
|
2867 "This distinction is important. If you send someone an email talking about "
|
dongsheng@627
|
2868 "<quote>revision 33</quote>, there's a high likelihood that their revision 33 "
|
dongsheng@627
|
2869 "will <emphasis>not be the same</emphasis> as yours. The reason for this is "
|
dongsheng@627
|
2870 "that a revision number depends on the order in which changes arrived in a "
|
dongsheng@627
|
2871 "repository, and there is no guarantee that the same changes will happen in "
|
dongsheng@627
|
2872 "the same order in different repositories. Three changes $a,b,c$ can easily "
|
dongsheng@627
|
2873 "appear in one repository as $0,1,2$, while in another as $1,0,2$."
|
dongsheng@627
|
2874 msgstr ""
|
dongsheng@627
|
2875
|
dongsheng@627
|
2876 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
2877 #: ../en/ch02-tour-basic.xml:312
|
dongsheng@627
|
2878 msgid ""
|
dongsheng@627
|
2879 "Mercurial uses revision numbers purely as a convenient shorthand. If you "
|
dongsheng@627
|
2880 "need to discuss a changeset with someone, or make a record of a changeset for "
|
dongsheng@627
|
2881 "some other reason (for example, in a bug report), use the hexadecimal "
|
dongsheng@627
|
2882 "identifier."
|
dongsheng@627
|
2883 msgstr ""
|
dongsheng@627
|
2884
|
dongsheng@627
|
2885 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
2886 #: ../en/ch02-tour-basic.xml:320
|
dongsheng@627
|
2887 msgid "Viewing specific revisions"
|
dongsheng@627
|
2888 msgstr "察看指定版本"
|
dongsheng@627
|
2889
|
dongsheng@627
|
2890 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
2891 #: ../en/ch02-tour-basic.xml:322
|
dongsheng@627
|
2892 msgid ""
|
dongsheng@627
|
2893 "To narrow the output of <command role=\"hg-cmd\">hg log</command> down to a "
|
dongsheng@627
|
2894 "single revision, use the <option role=\"hg-opt-log\">-r</option> (or <option "
|
dongsheng@627
|
2895 "role=\"hg-opt-log\">--rev</option>) option. You can use either a revision "
|
dongsheng@627
|
2896 "number or a long-form changeset identifier, and you can provide as many "
|
dongsheng@627
|
2897 "revisions as you want."
|
dongsheng@627
|
2898 msgstr ""
|
dongsheng@627
|
2899
|
dongsheng@627
|
2900 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
2901 #: ../en/ch02-tour-basic.xml:331
|
dongsheng@627
|
2902 msgid ""
|
dongsheng@627
|
2903 "If you want to see the history of several revisions without having to list "
|
dongsheng@627
|
2904 "each one, you can use <emphasis>range notation</emphasis>; this lets you "
|
dongsheng@627
|
2905 "express the idea <quote>I want all revisions between <literal>abc</literal> "
|
dongsheng@627
|
2906 "and <literal>def</literal>, inclusive</quote>."
|
dongsheng@627
|
2907 msgstr ""
|
dongsheng@627
|
2908
|
dongsheng@627
|
2909 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
2910 #: ../en/ch02-tour-basic.xml:339
|
dongsheng@627
|
2911 msgid ""
|
dongsheng@627
|
2912 "Mercurial also honours the order in which you specify revisions, so <command "
|
dongsheng@627
|
2913 "role=\"hg-cmd\">hg log -r 2:4</command> prints 2, 3, and 4. while <command "
|
dongsheng@627
|
2914 "role=\"hg-cmd\">hg log -r 4:2</command> prints 4, 3, and 2."
|
dongsheng@627
|
2915 msgstr ""
|
dongsheng@627
|
2916
|
dongsheng@627
|
2917 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
2918 #: ../en/ch02-tour-basic.xml:346
|
dongsheng@627
|
2919 msgid "More detailed information"
|
dongsheng@627
|
2920 msgstr "更详细的信息"
|
dongsheng@627
|
2921
|
dongsheng@627
|
2922 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
2923 #: ../en/ch02-tour-basic.xml:348
|
dongsheng@627
|
2924 msgid ""
|
dongsheng@627
|
2925 "While the summary information printed by <command role=\"hg-cmd\">hg log</"
|
dongsheng@627
|
2926 "command> is useful if you already know what you're looking for, you may need "
|
dongsheng@627
|
2927 "to see a complete description of the change, or a list of the files changed, "
|
dongsheng@627
|
2928 "if you're trying to decide whether a changeset is the one you're looking for. "
|
dongsheng@627
|
2929 "The <command role=\"hg-cmd\">hg log</command> command's <option role=\"hg-opt-"
|
dongsheng@627
|
2930 "global\">-v</option> (or <option role=\"hg-opt-global\">--verbose</option>) "
|
dongsheng@627
|
2931 "option gives you this extra detail."
|
dongsheng@627
|
2932 msgstr ""
|
dongsheng@627
|
2933
|
dongsheng@627
|
2934 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
2935 #: ../en/ch02-tour-basic.xml:360
|
dongsheng@627
|
2936 msgid ""
|
dongsheng@627
|
2937 "If you want to see both the description and content of a change, add the "
|
dongsheng@627
|
2938 "<option role=\"hg-opt-log\">-p</option> (or <option role=\"hg-opt-log\">--"
|
dongsheng@627
|
2939 "patch</option>) option. This displays the content of a change as a "
|
dongsheng@627
|
2940 "<emphasis>unified diff</emphasis> (if you've never seen a unified diff "
|
dongsheng@627
|
2941 "before, see section <xref linkend=\"sec.mq.patch\"/> for an overview)."
|
dongsheng@627
|
2942 msgstr ""
|
dongsheng@627
|
2943
|
dongsheng@627
|
2944 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
2945 #: ../en/ch02-tour-basic.xml:373
|
dongsheng@627
|
2946 msgid "All about command options"
|
dongsheng@627
|
2947 msgstr "命令选项"
|
dongsheng@627
|
2948
|
dongsheng@627
|
2949 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
2950 #: ../en/ch02-tour-basic.xml:375
|
dongsheng@627
|
2951 msgid ""
|
dongsheng@627
|
2952 "Let's take a brief break from exploring Mercurial commands to discuss a "
|
dongsheng@627
|
2953 "pattern in the way that they work; you may find this useful to keep in mind "
|
dongsheng@627
|
2954 "as we continue our tour."
|
dongsheng@627
|
2955 msgstr ""
|
dongsheng@627
|
2956
|
dongsheng@627
|
2957 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
2958 #: ../en/ch02-tour-basic.xml:379
|
dongsheng@627
|
2959 msgid ""
|
dongsheng@627
|
2960 "Mercurial has a consistent and straightforward approach to dealing with the "
|
dongsheng@627
|
2961 "options that you can pass to commands. It follows the conventions for "
|
dongsheng@627
|
2962 "options that are common to modern Linux and Unix systems."
|
dongsheng@627
|
2963 msgstr ""
|
dongsheng@627
|
2964
|
dongsheng@627
|
2965 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@641
|
2966 #: ../en/ch02-tour-basic.xml:384
|
dongsheng@627
|
2967 msgid ""
|
dongsheng@627
|
2968 "Every option has a long name. For example, as we've already seen, the "
|
dongsheng@627
|
2969 "<command role=\"hg-cmd\">hg log</command> command accepts a <option role=\"hg-"
|
dongsheng@627
|
2970 "opt-log\">--rev</option> option."
|
dongsheng@627
|
2971 msgstr ""
|
dongsheng@627
|
2972
|
dongsheng@627
|
2973 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@641
|
2974 #: ../en/ch02-tour-basic.xml:388
|
dongsheng@627
|
2975 msgid ""
|
dongsheng@627
|
2976 "Most options have short names, too. Instead of <option role=\"hg-opt-log\">--"
|
dongsheng@627
|
2977 "rev</option>, we can use <option role=\"hg-opt-log\">-r</option>. (The "
|
dongsheng@627
|
2978 "reason that some options don't have short names is that the options in "
|
dongsheng@627
|
2979 "question are rarely used.)"
|
dongsheng@627
|
2980 msgstr ""
|
dongsheng@627
|
2981
|
dongsheng@627
|
2982 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@641
|
2983 #: ../en/ch02-tour-basic.xml:393
|
dongsheng@627
|
2984 msgid ""
|
dongsheng@627
|
2985 "Long options start with two dashes (e.g. <option role=\"hg-opt-log\">--rev</"
|
dongsheng@627
|
2986 "option>), while short options start with one (e.g. <option role=\"hg-opt-log"
|
dongsheng@627
|
2987 "\">-r</option>)."
|
dongsheng@627
|
2988 msgstr ""
|
dongsheng@627
|
2989
|
dongsheng@627
|
2990 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@641
|
2991 #: ../en/ch02-tour-basic.xml:397
|
dongsheng@627
|
2992 msgid ""
|
dongsheng@627
|
2993 "Option naming and usage is consistent across commands. For example, every "
|
dongsheng@627
|
2994 "command that lets you specify a changeset ID or revision number accepts both "
|
dongsheng@627
|
2995 "<option role=\"hg-opt-log\">-r</option> and <option role=\"hg-opt-log\">--"
|
dongsheng@627
|
2996 "rev</option> arguments."
|
dongsheng@627
|
2997 msgstr ""
|
dongsheng@627
|
2998
|
dongsheng@627
|
2999 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
3000 #: ../en/ch02-tour-basic.xml:403
|
dongsheng@627
|
3001 msgid ""
|
dongsheng@627
|
3002 "In the examples throughout this book, I use short options instead of long. "
|
dongsheng@627
|
3003 "This just reflects my own preference, so don't read anything significant into "
|
dongsheng@627
|
3004 "it."
|
dongsheng@627
|
3005 msgstr ""
|
dongsheng@627
|
3006
|
dongsheng@627
|
3007 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
3008 #: ../en/ch02-tour-basic.xml:407
|
dongsheng@627
|
3009 msgid ""
|
dongsheng@627
|
3010 "Most commands that print output of some kind will print more output when "
|
dongsheng@627
|
3011 "passed a <option role=\"hg-opt-global\">-v</option> (or <option role=\"hg-opt-"
|
dongsheng@627
|
3012 "global\">--verbose</option>) option, and less when passed <option role=\"hg-"
|
dongsheng@627
|
3013 "opt-global\">-q</option> (or <option role=\"hg-opt-global\">--quiet</option>)."
|
dongsheng@627
|
3014 msgstr ""
|
dongsheng@627
|
3015
|
dongsheng@627
|
3016 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
3017 #: ../en/ch02-tour-basic.xml:415
|
dongsheng@627
|
3018 msgid "Making and reviewing changes"
|
dongsheng@627
|
3019 msgstr "创建和复审修改"
|
dongsheng@627
|
3020
|
dongsheng@627
|
3021 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
3022 #: ../en/ch02-tour-basic.xml:417
|
dongsheng@627
|
3023 msgid ""
|
dongsheng@627
|
3024 "Now that we have a grasp of viewing history in Mercurial, let's take a look "
|
dongsheng@627
|
3025 "at making some changes and examining them."
|
dongsheng@627
|
3026 msgstr ""
|
dongsheng@627
|
3027
|
dongsheng@627
|
3028 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
3029 #: ../en/ch02-tour-basic.xml:421
|
dongsheng@627
|
3030 msgid ""
|
dongsheng@627
|
3031 "The first thing we'll do is isolate our experiment in a repository of its "
|
dongsheng@627
|
3032 "own. We use the <command role=\"hg-cmd\">hg clone</command> command, but we "
|
dongsheng@627
|
3033 "don't need to clone a copy of the remote repository. Since we already have a "
|
dongsheng@627
|
3034 "copy of it locally, we can just clone that instead. This is much faster than "
|
dongsheng@627
|
3035 "cloning over the network, and cloning a local repository uses less disk space "
|
dongsheng@627
|
3036 "in most cases, too."
|
dongsheng@627
|
3037 msgstr ""
|
dongsheng@627
|
3038
|
dongsheng@627
|
3039 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
3040 #: ../en/ch02-tour-basic.xml:431
|
dongsheng@627
|
3041 msgid ""
|
dongsheng@627
|
3042 "As an aside, it's often good practice to keep a <quote>pristine</quote> copy "
|
dongsheng@627
|
3043 "of a remote repository around, which you can then make temporary clones of to "
|
dongsheng@627
|
3044 "create sandboxes for each task you want to work on. This lets you work on "
|
dongsheng@627
|
3045 "multiple tasks in parallel, each isolated from the others until it's complete "
|
dongsheng@627
|
3046 "and you're ready to integrate it back. Because local clones are so cheap, "
|
dongsheng@627
|
3047 "there's almost no overhead to cloning and destroying repositories whenever "
|
dongsheng@627
|
3048 "you want."
|
dongsheng@627
|
3049 msgstr ""
|
dongsheng@627
|
3050
|
dongsheng@627
|
3051 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
3052 #: ../en/ch02-tour-basic.xml:440
|
dongsheng@627
|
3053 msgid ""
|
dongsheng@627
|
3054 "In our <filename class=\"directory\">my-hello</filename> repository, we have "
|
dongsheng@627
|
3055 "a file <filename>hello.c</filename> that contains the classic <quote>hello, "
|
dongsheng@627
|
3056 "world</quote> program. Let's use the ancient and venerable <command>sed</"
|
dongsheng@627
|
3057 "command> command to edit this file so that it prints a second line of "
|
dongsheng@627
|
3058 "output. (I'm only using <command>sed</command> to do this because it's easy "
|
dongsheng@627
|
3059 "to write a scripted example this way. Since you're not under the same "
|
dongsheng@627
|
3060 "constraint, you probably won't want to use <command>sed</command>; simply use "
|
dongsheng@627
|
3061 "your preferred text editor to do the same thing.)"
|
dongsheng@627
|
3062 msgstr ""
|
dongsheng@627
|
3063
|
dongsheng@627
|
3064 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
3065 #: ../en/ch02-tour-basic.xml:453
|
dongsheng@627
|
3066 msgid ""
|
dongsheng@627
|
3067 "Mercurial's <command role=\"hg-cmd\">hg status</command> command will tell us "
|
dongsheng@627
|
3068 "what Mercurial knows about the files in the repository."
|
dongsheng@627
|
3069 msgstr ""
|
dongsheng@627
|
3070
|
dongsheng@627
|
3071 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
3072 #: ../en/ch02-tour-basic.xml:459
|
dongsheng@627
|
3073 msgid ""
|
dongsheng@627
|
3074 "The <command role=\"hg-cmd\">hg status</command> command prints no output for "
|
dongsheng@627
|
3075 "some files, but a line starting with <quote><literal>M</literal></quote> for "
|
dongsheng@627
|
3076 "<filename>hello.c</filename>. Unless you tell it to, <command role=\"hg-cmd"
|
dongsheng@627
|
3077 "\">hg status</command> will not print any output for files that have not been "
|
dongsheng@627
|
3078 "modified."
|
dongsheng@627
|
3079 msgstr ""
|
dongsheng@627
|
3080
|
dongsheng@627
|
3081 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
3082 #: ../en/ch02-tour-basic.xml:466
|
dongsheng@627
|
3083 msgid ""
|
dongsheng@627
|
3084 "The <quote><literal>M</literal></quote> indicates that Mercurial has noticed "
|
dongsheng@627
|
3085 "that we modified <filename>hello.c</filename>. We didn't need to "
|
dongsheng@627
|
3086 "<emphasis>inform</emphasis> Mercurial that we were going to modify the file "
|
dongsheng@627
|
3087 "before we started, or that we had modified the file after we were done; it "
|
dongsheng@627
|
3088 "was able to figure this out itself."
|
dongsheng@627
|
3089 msgstr ""
|
dongsheng@627
|
3090
|
dongsheng@627
|
3091 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
3092 #: ../en/ch02-tour-basic.xml:474
|
dongsheng@627
|
3093 msgid ""
|
dongsheng@627
|
3094 "It's a little bit helpful to know that we've modified <filename>hello.c</"
|
dongsheng@627
|
3095 "filename>, but we might prefer to know exactly <emphasis>what</emphasis> "
|
dongsheng@627
|
3096 "changes we've made to it. To do this, we use the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
3097 "diff</command> command."
|
dongsheng@627
|
3098 msgstr ""
|
dongsheng@627
|
3099
|
dongsheng@627
|
3100 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
3101 #: ../en/ch02-tour-basic.xml:484
|
dongsheng@627
|
3102 msgid "Recording changes in a new changeset"
|
dongsheng@627
|
3103 msgstr "在新修改集中记录修改"
|
dongsheng@627
|
3104
|
dongsheng@627
|
3105 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
3106 #: ../en/ch02-tour-basic.xml:486
|
dongsheng@627
|
3107 msgid ""
|
dongsheng@627
|
3108 "We can modify files, build and test our changes, and use <command role=\"hg-"
|
dongsheng@627
|
3109 "cmd\">hg status</command> and <command role=\"hg-cmd\">hg diff</command> to "
|
dongsheng@627
|
3110 "review our changes, until we're satisfied with what we've done and arrive at "
|
dongsheng@627
|
3111 "a natural stopping point where we want to record our work in a new changeset."
|
dongsheng@627
|
3112 msgstr ""
|
dongsheng@627
|
3113
|
dongsheng@627
|
3114 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
3115 #: ../en/ch02-tour-basic.xml:493
|
dongsheng@627
|
3116 msgid ""
|
dongsheng@627
|
3117 "The <command role=\"hg-cmd\">hg commit</command> command lets us create a new "
|
dongsheng@627
|
3118 "changeset; we'll usually refer to this as <quote>making a commit</quote> or "
|
dongsheng@627
|
3119 "<quote>committing</quote>."
|
dongsheng@627
|
3120 msgstr ""
|
dongsheng@627
|
3121
|
dongsheng@627
|
3122 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
3123 #: ../en/ch02-tour-basic.xml:499
|
dongsheng@627
|
3124 msgid "Setting up a username"
|
dongsheng@627
|
3125 msgstr "配置用户名称"
|
dongsheng@627
|
3126
|
dongsheng@627
|
3127 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3128 #: ../en/ch02-tour-basic.xml:501
|
dongsheng@627
|
3129 msgid ""
|
dongsheng@627
|
3130 "When you try to run <command role=\"hg-cmd\">hg commit</command> for the "
|
dongsheng@627
|
3131 "first time, it is not guaranteed to succeed. Mercurial records your name and "
|
dongsheng@627
|
3132 "address with each change that you commit, so that you and others will later "
|
dongsheng@627
|
3133 "be able to tell who made each change. Mercurial tries to automatically "
|
dongsheng@627
|
3134 "figure out a sensible username to commit the change with. It will attempt "
|
dongsheng@627
|
3135 "each of the following methods, in order:"
|
dongsheng@627
|
3136 msgstr ""
|
dongsheng@627
|
3137
|
dongsheng@627
|
3138 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
3139 #: ../en/ch02-tour-basic.xml:510
|
dongsheng@627
|
3140 msgid ""
|
dongsheng@627
|
3141 "If you specify a <option role=\"hg-opt-commit\">-u</option> option to the "
|
dongsheng@627
|
3142 "<command role=\"hg-cmd\">hg commit</command> command on the command line, "
|
dongsheng@627
|
3143 "followed by a username, this is always given the highest precedence."
|
dongsheng@627
|
3144 msgstr ""
|
dongsheng@627
|
3145
|
dongsheng@627
|
3146 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
3147 #: ../en/ch02-tour-basic.xml:515
|
dongsheng@627
|
3148 msgid ""
|
dongsheng@627
|
3149 "If you have set the <envar>HGUSER</envar> environment variable, this is "
|
dongsheng@627
|
3150 "checked next."
|
dongsheng@627
|
3151 msgstr ""
|
dongsheng@627
|
3152
|
dongsheng@627
|
3153 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
3154 #: ../en/ch02-tour-basic.xml:518
|
dongsheng@627
|
3155 msgid ""
|
dongsheng@627
|
3156 "If you create a file in your home directory called <filename role=\"special"
|
dongsheng@627
|
3157 "\">.hgrc</filename>, with a <envar role=\"rc-item-ui\">username</envar> "
|
dongsheng@627
|
3158 "entry, that will be used next. To see what the contents of this file should "
|
dongsheng@627
|
3159 "look like, refer to section <xref linkend=\"sec.tour-basic.username\"/> below."
|
dongsheng@627
|
3160 msgstr ""
|
dongsheng@627
|
3161
|
dongsheng@627
|
3162 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
3163 #: ../en/ch02-tour-basic.xml:525
|
dongsheng@627
|
3164 msgid ""
|
dongsheng@627
|
3165 "If you have set the <envar>EMAIL</envar> environment variable, this will be "
|
dongsheng@627
|
3166 "used next."
|
dongsheng@627
|
3167 msgstr ""
|
dongsheng@627
|
3168
|
dongsheng@627
|
3169 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
3170 #: ../en/ch02-tour-basic.xml:528
|
dongsheng@627
|
3171 msgid ""
|
dongsheng@627
|
3172 "Mercurial will query your system to find out your local user name and host "
|
dongsheng@627
|
3173 "name, and construct a username from these components. Since this often "
|
dongsheng@627
|
3174 "results in a username that is not very useful, it will print a warning if it "
|
dongsheng@627
|
3175 "has to do this."
|
dongsheng@627
|
3176 msgstr ""
|
dongsheng@627
|
3177
|
dongsheng@627
|
3178 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3179 #: ../en/ch02-tour-basic.xml:535
|
dongsheng@627
|
3180 msgid ""
|
dongsheng@627
|
3181 "If all of these mechanisms fail, Mercurial will fail, printing an error "
|
dongsheng@627
|
3182 "message. In this case, it will not let you commit until you set up a "
|
dongsheng@627
|
3183 "username."
|
dongsheng@627
|
3184 msgstr ""
|
dongsheng@627
|
3185
|
dongsheng@627
|
3186 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3187 #: ../en/ch02-tour-basic.xml:539
|
dongsheng@627
|
3188 msgid ""
|
dongsheng@627
|
3189 "You should think of the <envar>HGUSER</envar> environment variable and the "
|
dongsheng@627
|
3190 "<option role=\"hg-opt-commit\">-u</option> option to the <command role=\"hg-"
|
dongsheng@627
|
3191 "cmd\">hg commit</command> command as ways to <emphasis>override</emphasis> "
|
dongsheng@627
|
3192 "Mercurial's default selection of username. For normal use, the simplest and "
|
dongsheng@627
|
3193 "most robust way to set a username for yourself is by creating a <filename "
|
dongsheng@627
|
3194 "role=\"special\">.hgrc</filename> file; see below for details."
|
dongsheng@627
|
3195 msgstr ""
|
dongsheng@627
|
3196
|
dongsheng@627
|
3197 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@641
|
3198 #: ../en/ch02-tour-basic.xml:548
|
dongsheng@627
|
3199 msgid "Creating a Mercurial configuration file"
|
dongsheng@627
|
3200 msgstr "创建 Mercurial 的配置文件"
|
dongsheng@627
|
3201
|
dongsheng@627
|
3202 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
3203 #: ../en/ch02-tour-basic.xml:550
|
dongsheng@627
|
3204 msgid ""
|
dongsheng@627
|
3205 "To set a user name, use your favourite editor to create a file called "
|
dongsheng@627
|
3206 "<filename role=\"special\">.hgrc</filename> in your home directory. "
|
dongsheng@627
|
3207 "Mercurial will use this file to look up your personalised configuration "
|
dongsheng@627
|
3208 "settings. The initial contents of your <filename role=\"special\">.hgrc</"
|
dongsheng@627
|
3209 "filename> should look like this."
|
dongsheng@627
|
3210 msgstr ""
|
dongsheng@627
|
3211
|
dongsheng@627
|
3212 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
3213 #: ../en/ch02-tour-basic.xml:561
|
dongsheng@627
|
3214 msgid ""
|
dongsheng@627
|
3215 "The <quote><literal>[ui]</literal></quote> line begins a <emphasis>section</"
|
dongsheng@627
|
3216 "emphasis> of the config file, so you can read the <quote><literal>username "
|
dongsheng@627
|
3217 "= ...</literal></quote> line as meaning <quote>set the value of the "
|
dongsheng@627
|
3218 "<literal>username</literal> item in the <literal>ui</literal> section</"
|
dongsheng@627
|
3219 "quote>. A section continues until a new section begins, or the end of the "
|
dongsheng@627
|
3220 "file. Mercurial ignores empty lines and treats any text from "
|
dongsheng@627
|
3221 "<quote><literal>#</literal></quote> to the end of a line as a comment."
|
dongsheng@627
|
3222 msgstr ""
|
dongsheng@627
|
3223
|
dongsheng@627
|
3224 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@641
|
3225 #: ../en/ch02-tour-basic.xml:574
|
dongsheng@627
|
3226 msgid "Choosing a user name"
|
dongsheng@627
|
3227 msgstr "选择用户名称"
|
dongsheng@627
|
3228
|
dongsheng@627
|
3229 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
3230 #: ../en/ch02-tour-basic.xml:576
|
dongsheng@627
|
3231 msgid ""
|
dongsheng@627
|
3232 "You can use any text you like as the value of the <literal>username</literal> "
|
dongsheng@627
|
3233 "config item, since this information is for reading by other people, but for "
|
dongsheng@627
|
3234 "interpreting by Mercurial. The convention that most people follow is to use "
|
dongsheng@627
|
3235 "their name and email address, as in the example above."
|
dongsheng@627
|
3236 msgstr ""
|
dongsheng@627
|
3237
|
dongsheng@627
|
3238 #. type: Content of: <book><chapter><sect1><sect2><sect3><note><para>
|
dongsheng@641
|
3239 #: ../en/ch02-tour-basic.xml:583
|
dongsheng@627
|
3240 msgid ""
|
dongsheng@627
|
3241 "Mercurial's built-in web server obfuscates email addresses, to make it more "
|
dongsheng@627
|
3242 "difficult for the email harvesting tools that spammers use. This reduces the "
|
dongsheng@627
|
3243 "likelihood that you'll start receiving more junk email if you publish a "
|
dongsheng@627
|
3244 "Mercurial repository on the web."
|
dongsheng@627
|
3245 msgstr ""
|
dongsheng@627
|
3246
|
dongsheng@627
|
3247 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
3248 #: ../en/ch02-tour-basic.xml:593
|
dongsheng@627
|
3249 msgid "Writing a commit message"
|
dongsheng@627
|
3250 msgstr "写提交日志"
|
dongsheng@627
|
3251
|
dongsheng@627
|
3252 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3253 #: ../en/ch02-tour-basic.xml:595
|
dongsheng@627
|
3254 msgid ""
|
dongsheng@627
|
3255 "When we commit a change, Mercurial drops us into a text editor, to enter a "
|
dongsheng@627
|
3256 "message that will describe the modifications we've made in this changeset. "
|
dongsheng@627
|
3257 "This is called the <emphasis>commit message</emphasis>. It will be a record "
|
dongsheng@627
|
3258 "for readers of what we did and why, and it will be printed by <command role="
|
dongsheng@627
|
3259 "\"hg-cmd\">hg log</command> after we've finished committing."
|
dongsheng@627
|
3260 msgstr ""
|
dongsheng@627
|
3261
|
dongsheng@627
|
3262 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3263 #: ../en/ch02-tour-basic.xml:605
|
dongsheng@627
|
3264 msgid ""
|
dongsheng@627
|
3265 "The editor that the <command role=\"hg-cmd\">hg commit</command> command "
|
dongsheng@627
|
3266 "drops us into will contain an empty line, followed by a number of lines "
|
dongsheng@627
|
3267 "starting with <quote><literal>HG:</literal></quote>."
|
dongsheng@627
|
3268 msgstr ""
|
dongsheng@627
|
3269
|
dongsheng@627
|
3270 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3271 #: ../en/ch02-tour-basic.xml:612
|
dongsheng@627
|
3272 msgid ""
|
dongsheng@627
|
3273 "Mercurial ignores the lines that start with <quote><literal>HG:</literal></"
|
dongsheng@627
|
3274 "quote>; it uses them only to tell us which files it's recording changes to. "
|
dongsheng@627
|
3275 "Modifying or deleting these lines has no effect."
|
dongsheng@627
|
3276 msgstr ""
|
dongsheng@627
|
3277
|
dongsheng@627
|
3278 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
3279 #: ../en/ch02-tour-basic.xml:618
|
dongsheng@627
|
3280 msgid "Writing a good commit message"
|
dongsheng@627
|
3281 msgstr "写好提交日志"
|
dongsheng@627
|
3282
|
dongsheng@627
|
3283 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3284 #: ../en/ch02-tour-basic.xml:620
|
dongsheng@627
|
3285 msgid ""
|
dongsheng@627
|
3286 "Since <command role=\"hg-cmd\">hg log</command> only prints the first line of "
|
dongsheng@627
|
3287 "a commit message by default, it's best to write a commit message whose first "
|
dongsheng@627
|
3288 "line stands alone. Here's a real example of a commit message that "
|
dongsheng@627
|
3289 "<emphasis>doesn't</emphasis> follow this guideline, and hence has a summary "
|
dongsheng@627
|
3290 "that is not readable."
|
dongsheng@627
|
3291 msgstr ""
|
dongsheng@627
|
3292
|
dongsheng@627
|
3293 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3294 #: ../en/ch02-tour-basic.xml:634
|
dongsheng@627
|
3295 msgid ""
|
dongsheng@627
|
3296 "As far as the remainder of the contents of the commit message are concerned, "
|
dongsheng@627
|
3297 "there are no hard-and-fast rules. Mercurial itself doesn't interpret or care "
|
dongsheng@627
|
3298 "about the contents of the commit message, though your project may have "
|
dongsheng@627
|
3299 "policies that dictate a certain kind of formatting."
|
dongsheng@627
|
3300 msgstr ""
|
dongsheng@627
|
3301
|
dongsheng@627
|
3302 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3303 #: ../en/ch02-tour-basic.xml:640
|
dongsheng@627
|
3304 msgid ""
|
dongsheng@627
|
3305 "My personal preference is for short, but informative, commit messages that "
|
dongsheng@627
|
3306 "tell me something that I can't figure out with a quick glance at the output "
|
dongsheng@627
|
3307 "of <command role=\"hg-cmd\">hg log --patch</command>."
|
dongsheng@627
|
3308 msgstr ""
|
dongsheng@627
|
3309
|
dongsheng@627
|
3310 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
3311 #: ../en/ch02-tour-basic.xml:647
|
dongsheng@627
|
3312 msgid "Aborting a commit"
|
dongsheng@627
|
3313 msgstr "终止提交"
|
dongsheng@627
|
3314
|
dongsheng@627
|
3315 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3316 #: ../en/ch02-tour-basic.xml:649
|
dongsheng@627
|
3317 msgid ""
|
dongsheng@627
|
3318 "If you decide that you don't want to commit while in the middle of editing a "
|
dongsheng@627
|
3319 "commit message, simply exit from your editor without saving the file that "
|
dongsheng@627
|
3320 "it's editing. This will cause nothing to happen to either the repository or "
|
dongsheng@627
|
3321 "the working directory."
|
dongsheng@627
|
3322 msgstr ""
|
dongsheng@627
|
3323
|
dongsheng@627
|
3324 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3325 #: ../en/ch02-tour-basic.xml:654
|
dongsheng@627
|
3326 msgid ""
|
dongsheng@627
|
3327 "If we run the <command role=\"hg-cmd\">hg commit</command> command without "
|
dongsheng@627
|
3328 "any arguments, it records all of the changes we've made, as reported by "
|
dongsheng@627
|
3329 "<command role=\"hg-cmd\">hg status</command> and <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
3330 "diff</command>."
|
dongsheng@627
|
3331 msgstr ""
|
dongsheng@627
|
3332
|
dongsheng@627
|
3333 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
3334 #: ../en/ch02-tour-basic.xml:661
|
dongsheng@627
|
3335 msgid "Admiring our new handiwork"
|
dongsheng@627
|
3336 msgstr "欣赏我们的新手艺"
|
dongsheng@627
|
3337
|
dongsheng@627
|
3338 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3339 #: ../en/ch02-tour-basic.xml:663
|
dongsheng@627
|
3340 msgid ""
|
dongsheng@627
|
3341 "Once we've finished the commit, we can use the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
3342 "tip</command> command to display the changeset we just created. This command "
|
dongsheng@627
|
3343 "produces output that is identical to <command role=\"hg-cmd\">hg log</"
|
dongsheng@627
|
3344 "command>, but it only displays the newest revision in the repository."
|
dongsheng@627
|
3345 msgstr ""
|
dongsheng@627
|
3346
|
dongsheng@627
|
3347 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3348 #: ../en/ch02-tour-basic.xml:672
|
dongsheng@627
|
3349 msgid ""
|
dongsheng@627
|
3350 "We refer to the newest revision in the repository as the tip revision, or "
|
dongsheng@627
|
3351 "simply the tip."
|
dongsheng@627
|
3352 msgstr ""
|
dongsheng@627
|
3353
|
dongsheng@627
|
3354 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
3355 #: ../en/ch02-tour-basic.xml:679
|
dongsheng@627
|
3356 msgid "Sharing changes"
|
dongsheng@627
|
3357 msgstr "共享修改"
|
dongsheng@627
|
3358
|
dongsheng@627
|
3359 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
3360 #: ../en/ch02-tour-basic.xml:681
|
dongsheng@627
|
3361 msgid ""
|
dongsheng@627
|
3362 "We mentioned earlier that repositories in Mercurial are self-contained. This "
|
dongsheng@627
|
3363 "means that the changeset we just created exists only in our <filename class="
|
dongsheng@627
|
3364 "\"directory\">my-hello</filename> repository. Let's look at a few ways that "
|
dongsheng@627
|
3365 "we can propagate this change into other repositories."
|
dongsheng@627
|
3366 msgstr ""
|
dongsheng@627
|
3367
|
dongsheng@627
|
3368 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
3369 #: ../en/ch02-tour-basic.xml:689
|
dongsheng@627
|
3370 msgid "Pulling changes from another repository"
|
dongsheng@627
|
3371 msgstr "从其它版本库取得修改"
|
dongsheng@627
|
3372
|
dongsheng@627
|
3373 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3374 #: ../en/ch02-tour-basic.xml:690
|
dongsheng@627
|
3375 msgid ""
|
dongsheng@627
|
3376 "To get started, let's clone our original <filename class=\"directory\">hello</"
|
dongsheng@627
|
3377 "filename> repository, which does not contain the change we just committed. "
|
dongsheng@627
|
3378 "We'll call our temporary repository <filename class=\"directory\">hello-pull</"
|
dongsheng@627
|
3379 "filename>."
|
dongsheng@627
|
3380 msgstr ""
|
dongsheng@627
|
3381
|
dongsheng@627
|
3382 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3383 #: ../en/ch02-tour-basic.xml:698
|
dongsheng@627
|
3384 msgid ""
|
dongsheng@627
|
3385 "We'll use the <command role=\"hg-cmd\">hg pull</command> command to bring "
|
dongsheng@627
|
3386 "changes from <filename class=\"directory\">my-hello</filename> into <filename "
|
dongsheng@627
|
3387 "class=\"directory\">hello-pull</filename>. However, blindly pulling unknown "
|
dongsheng@627
|
3388 "changes into a repository is a somewhat scary prospect. Mercurial provides "
|
dongsheng@627
|
3389 "the <command role=\"hg-cmd\">hg incoming</command> command to tell us what "
|
dongsheng@627
|
3390 "changes the <command role=\"hg-cmd\">hg pull</command> command "
|
dongsheng@627
|
3391 "<emphasis>would</emphasis> pull into the repository, without actually pulling "
|
dongsheng@627
|
3392 "the changes in."
|
dongsheng@627
|
3393 msgstr ""
|
dongsheng@627
|
3394
|
dongsheng@627
|
3395 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3396 #: ../en/ch02-tour-basic.xml:711
|
dongsheng@627
|
3397 msgid ""
|
dongsheng@627
|
3398 "(Of course, someone could cause more changesets to appear in the repository "
|
dongsheng@627
|
3399 "that we ran <command role=\"hg-cmd\">hg incoming</command> in, before we get "
|
dongsheng@627
|
3400 "a chance to <command role=\"hg-cmd\">hg pull</command> the changes, so that "
|
dongsheng@627
|
3401 "we could end up pulling changes that we didn't expect.)"
|
dongsheng@627
|
3402 msgstr ""
|
dongsheng@627
|
3403
|
dongsheng@627
|
3404 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3405 #: ../en/ch02-tour-basic.xml:718
|
dongsheng@627
|
3406 msgid ""
|
dongsheng@627
|
3407 "Bringing changes into a repository is a simple matter of running the <command "
|
dongsheng@627
|
3408 "role=\"hg-cmd\">hg pull</command> command, and telling it which repository to "
|
dongsheng@627
|
3409 "pull from."
|
dongsheng@627
|
3410 msgstr ""
|
dongsheng@627
|
3411
|
dongsheng@627
|
3412 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3413 #: ../en/ch02-tour-basic.xml:725
|
dongsheng@627
|
3414 msgid ""
|
dongsheng@627
|
3415 "As you can see from the before-and-after output of <command role=\"hg-cmd"
|
dongsheng@627
|
3416 "\">hg tip</command>, we have successfully pulled changes into our "
|
dongsheng@627
|
3417 "repository. There remains one step before we can see these changes in the "
|
dongsheng@627
|
3418 "working directory."
|
dongsheng@627
|
3419 msgstr ""
|
dongsheng@627
|
3420
|
dongsheng@627
|
3421 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
3422 #: ../en/ch02-tour-basic.xml:733
|
dongsheng@627
|
3423 msgid "Updating the working directory"
|
dongsheng@627
|
3424 msgstr "更新工作目录"
|
dongsheng@627
|
3425
|
dongsheng@627
|
3426 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3427 #: ../en/ch02-tour-basic.xml:735
|
dongsheng@627
|
3428 msgid ""
|
dongsheng@627
|
3429 "We have so far glossed over the relationship between a repository and its "
|
dongsheng@627
|
3430 "working directory. The <command role=\"hg-cmd\">hg pull</command> command "
|
dongsheng@627
|
3431 "that we ran in section <xref linkend=\"sec.tour.pull\"/> brought changes into "
|
dongsheng@627
|
3432 "the repository, but if we check, there's no sign of those changes in the "
|
dongsheng@627
|
3433 "working directory. This is because <command role=\"hg-cmd\">hg pull</"
|
dongsheng@627
|
3434 "command> does not (by default) touch the working directory. Instead, we use "
|
dongsheng@627
|
3435 "the <command role=\"hg-cmd\">hg update</command> command to do this."
|
dongsheng@627
|
3436 msgstr ""
|
dongsheng@627
|
3437
|
dongsheng@627
|
3438 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3439 #: ../en/ch02-tour-basic.xml:747
|
dongsheng@627
|
3440 msgid ""
|
dongsheng@627
|
3441 "It might seem a bit strange that <command role=\"hg-cmd\">hg pull</command> "
|
dongsheng@627
|
3442 "doesn't update the working directory automatically. There's actually a good "
|
dongsheng@627
|
3443 "reason for this: you can use <command role=\"hg-cmd\">hg update</command> to "
|
dongsheng@627
|
3444 "update the working directory to the state it was in at <emphasis>any "
|
dongsheng@627
|
3445 "revision</emphasis> in the history of the repository. If you had the working "
|
dongsheng@627
|
3446 "directory updated to an old revision---to hunt down the origin of a bug, "
|
dongsheng@627
|
3447 "say---and ran a <command role=\"hg-cmd\">hg pull</command> which "
|
dongsheng@627
|
3448 "automatically updated the working directory to a new revision, you might not "
|
dongsheng@627
|
3449 "be terribly happy."
|
dongsheng@627
|
3450 msgstr ""
|
dongsheng@627
|
3451
|
dongsheng@627
|
3452 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3453 #: ../en/ch02-tour-basic.xml:758
|
dongsheng@627
|
3454 msgid ""
|
dongsheng@627
|
3455 "However, since pull-then-update is such a common thing to do, Mercurial lets "
|
dongsheng@627
|
3456 "you combine the two by passing the <option role=\"hg-opt-pull\">-u</option> "
|
dongsheng@627
|
3457 "option to <command role=\"hg-cmd\">hg pull</command>."
|
dongsheng@627
|
3458 msgstr ""
|
dongsheng@627
|
3459
|
dongsheng@627
|
3460 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3461 #: ../en/ch02-tour-basic.xml:763
|
dongsheng@627
|
3462 msgid ""
|
dongsheng@627
|
3463 "If you look back at the output of <command role=\"hg-cmd\">hg pull</command> "
|
dongsheng@627
|
3464 "in section <xref linkend=\"sec.tour.pull\"/> when we ran it without <option "
|
dongsheng@627
|
3465 "role=\"hg-opt-pull\">-u</option>, you can see that it printed a helpful "
|
dongsheng@627
|
3466 "reminder that we'd have to take an explicit step to update the working "
|
dongsheng@627
|
3467 "directory:"
|
dongsheng@627
|
3468 msgstr ""
|
dongsheng@627
|
3469
|
dongsheng@627
|
3470 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3471 #: ../en/ch02-tour-basic.xml:772
|
dongsheng@627
|
3472 msgid ""
|
dongsheng@627
|
3473 "To find out what revision the working directory is at, use the <command role="
|
dongsheng@627
|
3474 "\"hg-cmd\">hg parents</command> command."
|
dongsheng@627
|
3475 msgstr ""
|
dongsheng@627
|
3476
|
dongsheng@627
|
3477 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3478 #: ../en/ch02-tour-basic.xml:778
|
dongsheng@641
|
3479 msgid ""
|
dongsheng@641
|
3480 "If you look back at figure <xref endterm=\"fig.tour-basic.history.caption\" "
|
dongsheng@641
|
3481 "linkend=\"fig.tour-basic.history\"/>, you'll see arrows connecting each "
|
dongsheng@641
|
3482 "changeset. The node that the arrow leads <emphasis>from</emphasis> in each "
|
dongsheng@641
|
3483 "case is a parent, and the node that the arrow leads <emphasis>to</emphasis> "
|
dongsheng@641
|
3484 "is its child. The working directory has a parent in just the same way; this "
|
dongsheng@641
|
3485 "is the changeset that the working directory currently contains."
|
dongsheng@641
|
3486 msgstr ""
|
dongsheng@641
|
3487
|
dongsheng@641
|
3488 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3489 #: ../en/ch02-tour-basic.xml:788
|
dongsheng@627
|
3490 msgid ""
|
dongsheng@627
|
3491 "To update the working directory to a particular revision, give a revision "
|
dongsheng@627
|
3492 "number or changeset ID to the <command role=\"hg-cmd\">hg update</command> "
|
dongsheng@627
|
3493 "command."
|
dongsheng@627
|
3494 msgstr ""
|
dongsheng@627
|
3495
|
dongsheng@627
|
3496 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3497 #: ../en/ch02-tour-basic.xml:795
|
dongsheng@627
|
3498 msgid ""
|
dongsheng@627
|
3499 "If you omit an explicit revision, <command role=\"hg-cmd\">hg update</"
|
dongsheng@627
|
3500 "command> will update to the tip revision, as shown by the second call to "
|
dongsheng@627
|
3501 "<command role=\"hg-cmd\">hg update</command> in the example above."
|
dongsheng@627
|
3502 msgstr ""
|
dongsheng@627
|
3503
|
dongsheng@627
|
3504 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
3505 #: ../en/ch02-tour-basic.xml:803
|
dongsheng@627
|
3506 msgid "Pushing changes to another repository"
|
dongsheng@627
|
3507 msgstr "发布修改到其它版本库"
|
dongsheng@627
|
3508
|
dongsheng@627
|
3509 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3510 #: ../en/ch02-tour-basic.xml:805
|
dongsheng@627
|
3511 msgid ""
|
dongsheng@627
|
3512 "Mercurial lets us push changes to another repository, from the repository "
|
dongsheng@627
|
3513 "we're currently visiting. As with the example of <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
3514 "pull</command> above, we'll create a temporary repository to push our changes "
|
dongsheng@627
|
3515 "into."
|
dongsheng@627
|
3516 msgstr ""
|
dongsheng@627
|
3517
|
dongsheng@627
|
3518 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3519 #: ../en/ch02-tour-basic.xml:813
|
dongsheng@627
|
3520 msgid ""
|
dongsheng@627
|
3521 "The <command role=\"hg-cmd\">hg outgoing</command> command tells us what "
|
dongsheng@627
|
3522 "changes would be pushed into another repository."
|
dongsheng@627
|
3523 msgstr ""
|
dongsheng@627
|
3524
|
dongsheng@627
|
3525 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3526 #: ../en/ch02-tour-basic.xml:819
|
dongsheng@627
|
3527 msgid ""
|
dongsheng@627
|
3528 "And the <command role=\"hg-cmd\">hg push</command> command does the actual "
|
dongsheng@627
|
3529 "push."
|
dongsheng@627
|
3530 msgstr ""
|
dongsheng@627
|
3531
|
dongsheng@627
|
3532 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3533 #: ../en/ch02-tour-basic.xml:825
|
dongsheng@627
|
3534 msgid ""
|
dongsheng@627
|
3535 "As with <command role=\"hg-cmd\">hg pull</command>, the <command role=\"hg-cmd"
|
dongsheng@627
|
3536 "\">hg push</command> command does not update the working directory in the "
|
dongsheng@627
|
3537 "repository that it's pushing changes into. (Unlike <command role=\"hg-cmd"
|
dongsheng@627
|
3538 "\">hg pull</command>, <command role=\"hg-cmd\">hg push</command> does not "
|
dongsheng@627
|
3539 "provide a <literal>-u</literal> option that updates the other repository's "
|
dongsheng@627
|
3540 "working directory.)"
|
dongsheng@627
|
3541 msgstr ""
|
dongsheng@627
|
3542
|
dongsheng@627
|
3543 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3544 #: ../en/ch02-tour-basic.xml:834
|
dongsheng@627
|
3545 msgid ""
|
dongsheng@627
|
3546 "What happens if we try to pull or push changes and the receiving repository "
|
dongsheng@627
|
3547 "already has those changes? Nothing too exciting."
|
dongsheng@627
|
3548 msgstr ""
|
dongsheng@627
|
3549
|
dongsheng@627
|
3550 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
3551 #: ../en/ch02-tour-basic.xml:841
|
dongsheng@627
|
3552 msgid "Sharing changes over a network"
|
dongsheng@627
|
3553 msgstr "通过网络共享修改"
|
dongsheng@627
|
3554
|
dongsheng@627
|
3555 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3556 #: ../en/ch02-tour-basic.xml:843
|
dongsheng@627
|
3557 msgid ""
|
dongsheng@627
|
3558 "The commands we have covered in the previous few sections are not limited to "
|
dongsheng@627
|
3559 "working with local repositories. Each works in exactly the same fashion over "
|
dongsheng@627
|
3560 "a network connection; simply pass in a URL instead of a local path."
|
dongsheng@627
|
3561 msgstr ""
|
dongsheng@627
|
3562
|
dongsheng@627
|
3563 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3564 #: ../en/ch02-tour-basic.xml:851
|
dongsheng@627
|
3565 msgid ""
|
dongsheng@627
|
3566 "In this example, we can see what changes we could push to the remote "
|
dongsheng@627
|
3567 "repository, but the repository is understandably not set up to let anonymous "
|
dongsheng@627
|
3568 "users push to it."
|
dongsheng@627
|
3569 msgstr ""
|
dongsheng@627
|
3570
|
dongsheng@627
|
3571 #. type: Content of: <book><chapter><title>
|
dongsheng@627
|
3572 #: ../en/ch03-tour-merge.xml:5
|
dongsheng@627
|
3573 msgid "A tour of Mercurial: merging work"
|
dongsheng@627
|
3574 msgstr "Mercurial 教程: 合并工作"
|
dongsheng@627
|
3575
|
dongsheng@627
|
3576 #. type: Content of: <book><chapter><para>
|
dongsheng@627
|
3577 #: ../en/ch03-tour-merge.xml:7
|
dongsheng@627
|
3578 msgid ""
|
dongsheng@627
|
3579 "We've now covered cloning a repository, making changes in a repository, and "
|
dongsheng@627
|
3580 "pulling or pushing changes from one repository into another. Our next step "
|
dongsheng@627
|
3581 "is <emphasis>merging</emphasis> changes from separate repositories."
|
dongsheng@627
|
3582 msgstr ""
|
dongsheng@627
|
3583
|
dongsheng@627
|
3584 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
3585 #: ../en/ch03-tour-merge.xml:13
|
dongsheng@627
|
3586 msgid "Merging streams of work"
|
dongsheng@627
|
3587 msgstr "合并的流程"
|
dongsheng@627
|
3588
|
dongsheng@627
|
3589 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
3590 #: ../en/ch03-tour-merge.xml:15
|
dongsheng@627
|
3591 msgid ""
|
dongsheng@627
|
3592 "Merging is a fundamental part of working with a distributed revision control "
|
dongsheng@627
|
3593 "tool."
|
dongsheng@627
|
3594 msgstr ""
|
dongsheng@627
|
3595
|
dongsheng@627
|
3596 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
3597 #: ../en/ch03-tour-merge.xml:18
|
dongsheng@627
|
3598 msgid ""
|
dongsheng@627
|
3599 "Alice and Bob each have a personal copy of a repository for a project they're "
|
dongsheng@627
|
3600 "collaborating on. Alice fixes a bug in her repository; Bob adds a new "
|
dongsheng@627
|
3601 "feature in his. They want the shared repository to contain both the bug fix "
|
dongsheng@627
|
3602 "and the new feature."
|
dongsheng@627
|
3603 msgstr ""
|
dongsheng@627
|
3604
|
dongsheng@627
|
3605 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
3606 #: ../en/ch03-tour-merge.xml:24
|
dongsheng@627
|
3607 msgid ""
|
dongsheng@627
|
3608 "I frequently work on several different tasks for a single project at once, "
|
dongsheng@627
|
3609 "each safely isolated in its own repository. Working this way means that I "
|
dongsheng@627
|
3610 "often need to merge one piece of my own work with another."
|
dongsheng@627
|
3611 msgstr ""
|
dongsheng@627
|
3612
|
dongsheng@627
|
3613 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
3614 #: ../en/ch03-tour-merge.xml:30
|
dongsheng@627
|
3615 msgid ""
|
dongsheng@627
|
3616 "Because merging is such a common thing to need to do, Mercurial makes it "
|
dongsheng@627
|
3617 "easy. Let's walk through the process. We'll begin by cloning yet another "
|
dongsheng@627
|
3618 "repository (see how often they spring up?) and making a change in it."
|
dongsheng@627
|
3619 msgstr ""
|
dongsheng@627
|
3620
|
dongsheng@627
|
3621 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
3622 #: ../en/ch03-tour-merge.xml:37
|
dongsheng@627
|
3623 msgid ""
|
dongsheng@627
|
3624 "We should now have two copies of <filename>hello.c</filename> with different "
|
dongsheng@627
|
3625 "contents. The histories of the two repositories have also diverged, as "
|
dongsheng@641
|
3626 "illustrated in figure <xref endterm=\"fig.tour-merge.sep-repos.caption\" "
|
dongsheng@641
|
3627 "linkend=\"fig.tour-merge.sep-repos\"/>."
|
dongsheng@627
|
3628 msgstr ""
|
dongsheng@627
|
3629
|
dongsheng@627
|
3630 #. type: Content of: <book><chapter><sect1><informalfigure><mediaobject>
|
dongsheng@627
|
3631 #: ../en/ch03-tour-merge.xml:47
|
dongsheng@627
|
3632 msgid ""
|
dongsheng@627
|
3633 "<imageobject><imagedata fileref=\"images/tour-merge-sep-repos.png\"/></"
|
dongsheng@627
|
3634 "imageobject>"
|
dongsheng@627
|
3635 msgstr ""
|
dongsheng@627
|
3636
|
dongsheng@627
|
3637 #. type: Content of: <book><chapter><sect1><informalfigure><mediaobject><caption><para>
|
dongsheng@627
|
3638 #: ../en/ch03-tour-merge.xml:49
|
dongsheng@627
|
3639 msgid ""
|
dongsheng@627
|
3640 "Divergent recent histories of the <filename class=\"directory\">my-hello</"
|
dongsheng@627
|
3641 "filename> and <filename class=\"directory\">my-new-hello</filename> "
|
dongsheng@627
|
3642 "repositories"
|
dongsheng@627
|
3643 msgstr ""
|
dongsheng@627
|
3644
|
dongsheng@627
|
3645 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
3646 #: ../en/ch03-tour-merge.xml:57
|
dongsheng@627
|
3647 msgid ""
|
dongsheng@627
|
3648 "We already know that pulling changes from our <filename class=\"directory"
|
dongsheng@627
|
3649 "\">my-hello</filename> repository will have no effect on the working "
|
dongsheng@627
|
3650 "directory."
|
dongsheng@627
|
3651 msgstr ""
|
dongsheng@627
|
3652
|
dongsheng@627
|
3653 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
3654 #: ../en/ch03-tour-merge.xml:63
|
dongsheng@627
|
3655 msgid ""
|
dongsheng@627
|
3656 "However, the <command role=\"hg-cmd\">hg pull</command> command says "
|
dongsheng@627
|
3657 "something about <quote>heads</quote>."
|
dongsheng@627
|
3658 msgstr ""
|
dongsheng@627
|
3659
|
dongsheng@627
|
3660 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
3661 #: ../en/ch03-tour-merge.xml:67
|
dongsheng@627
|
3662 msgid "Head changesets"
|
dongsheng@627
|
3663 msgstr "顶点改变集"
|
dongsheng@627
|
3664
|
dongsheng@627
|
3665 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3666 #: ../en/ch03-tour-merge.xml:69
|
dongsheng@627
|
3667 msgid ""
|
dongsheng@627
|
3668 "A head is a change that has no descendants, or children, as they're also "
|
dongsheng@627
|
3669 "known. The tip revision is thus a head, because the newest revision in a "
|
dongsheng@627
|
3670 "repository doesn't have any children, but a repository can contain more than "
|
dongsheng@627
|
3671 "one head."
|
dongsheng@627
|
3672 msgstr ""
|
dongsheng@627
|
3673
|
dongsheng@627
|
3674 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
|
dongsheng@641
|
3675 #: ../en/ch03-tour-merge.xml:77
|
dongsheng@627
|
3676 msgid ""
|
dongsheng@627
|
3677 "<imageobject><imagedata fileref=\"images/tour-merge-pull.png\"/></imageobject>"
|
dongsheng@627
|
3678 msgstr ""
|
dongsheng@627
|
3679
|
dongsheng@627
|
3680 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
|
dongsheng@641
|
3681 #: ../en/ch03-tour-merge.xml:79
|
dongsheng@627
|
3682 msgid ""
|
dongsheng@627
|
3683 "Repository contents after pulling from <filename class=\"directory\">my-"
|
dongsheng@627
|
3684 "hello</filename> into <filename class=\"directory\">my-new-hello</filename>"
|
dongsheng@627
|
3685 msgstr ""
|
dongsheng@627
|
3686
|
dongsheng@627
|
3687 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
3688 #: ../en/ch03-tour-merge.xml:85
|
dongsheng@627
|
3689 msgid ""
|
dongsheng@641
|
3690 "In figure <xref endterm=\"fig.tour-merge.pull.caption\" linkend=\"fig.tour-"
|
dongsheng@641
|
3691 "merge.pull\"/>, you can see the effect of the pull from <filename class="
|
dongsheng@641
|
3692 "\"directory\">my-hello</filename> into <filename class=\"directory\">my-new-"
|
dongsheng@641
|
3693 "hello</filename>. The history that was already present in <filename class="
|
dongsheng@641
|
3694 "\"directory\">my-new-hello</filename> is untouched, but a new revision has "
|
dongsheng@641
|
3695 "been added. By referring to figure <xref endterm=\"fig.tour-merge.sep-repos."
|
dongsheng@641
|
3696 "caption\" linkend=\"fig.tour-merge.sep-repos\"/>, we can see that the "
|
dongsheng@627
|
3697 "<emphasis>changeset ID</emphasis> remains the same in the new repository, but "
|
dongsheng@627
|
3698 "the <emphasis>revision number</emphasis> has changed. (This, incidentally, "
|
dongsheng@627
|
3699 "is a fine example of why it's not safe to use revision numbers when "
|
dongsheng@627
|
3700 "discussing changesets.) We can view the heads in a repository using the "
|
dongsheng@627
|
3701 "<command role=\"hg-cmd\">hg heads</command> command."
|
dongsheng@627
|
3702 msgstr ""
|
dongsheng@627
|
3703
|
dongsheng@627
|
3704 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
3705 #: ../en/ch03-tour-merge.xml:106
|
dongsheng@627
|
3706 msgid "Performing the merge"
|
dongsheng@627
|
3707 msgstr "执行合并"
|
dongsheng@627
|
3708
|
dongsheng@627
|
3709 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3710 #: ../en/ch03-tour-merge.xml:108
|
dongsheng@627
|
3711 msgid ""
|
dongsheng@627
|
3712 "What happens if we try to use the normal <command role=\"hg-cmd\">hg update</"
|
dongsheng@627
|
3713 "command> command to update to the new tip?"
|
dongsheng@627
|
3714 msgstr ""
|
dongsheng@627
|
3715
|
dongsheng@627
|
3716 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3717 #: ../en/ch03-tour-merge.xml:114
|
dongsheng@627
|
3718 msgid ""
|
dongsheng@627
|
3719 "Mercurial is telling us that the <command role=\"hg-cmd\">hg update</command> "
|
dongsheng@627
|
3720 "command won't do a merge; it won't update the working directory when it "
|
dongsheng@627
|
3721 "thinks we might be wanting to do a merge, unless we force it to do so. "
|
dongsheng@627
|
3722 "Instead, we use the <command role=\"hg-cmd\">hg merge</command> command to "
|
dongsheng@627
|
3723 "merge the two heads."
|
dongsheng@627
|
3724 msgstr ""
|
dongsheng@627
|
3725
|
dongsheng@627
|
3726 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
|
dongsheng@641
|
3727 #: ../en/ch03-tour-merge.xml:125
|
dongsheng@627
|
3728 msgid ""
|
dongsheng@627
|
3729 "<imageobject><imagedata fileref=\"images/tour-merge-merge.png\"/></"
|
dongsheng@627
|
3730 "imageobject>"
|
dongsheng@627
|
3731 msgstr ""
|
dongsheng@627
|
3732
|
dongsheng@627
|
3733 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
|
dongsheng@641
|
3734 #: ../en/ch03-tour-merge.xml:127
|
dongsheng@627
|
3735 msgid "Working directory and repository during merge, and following commit"
|
dongsheng@627
|
3736 msgstr ""
|
dongsheng@627
|
3737
|
dongsheng@627
|
3738 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3739 #: ../en/ch03-tour-merge.xml:132
|
dongsheng@627
|
3740 msgid ""
|
dongsheng@627
|
3741 "This updates the working directory so that it contains changes from "
|
dongsheng@627
|
3742 "<emphasis>both</emphasis> heads, which is reflected in both the output of "
|
dongsheng@627
|
3743 "<command role=\"hg-cmd\">hg parents</command> and the contents of "
|
dongsheng@627
|
3744 "<filename>hello.c</filename>."
|
dongsheng@627
|
3745 msgstr ""
|
dongsheng@627
|
3746
|
dongsheng@627
|
3747 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
3748 #: ../en/ch03-tour-merge.xml:142
|
dongsheng@627
|
3749 msgid "Committing the results of the merge"
|
dongsheng@627
|
3750 msgstr "提交合并结果"
|
dongsheng@627
|
3751
|
dongsheng@627
|
3752 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3753 #: ../en/ch03-tour-merge.xml:144
|
dongsheng@627
|
3754 msgid ""
|
dongsheng@627
|
3755 "Whenever we've done a merge, <command role=\"hg-cmd\">hg parents</command> "
|
dongsheng@627
|
3756 "will display two parents until we <command role=\"hg-cmd\">hg commit</"
|
dongsheng@627
|
3757 "command> the results of the merge."
|
dongsheng@627
|
3758 msgstr ""
|
dongsheng@627
|
3759
|
dongsheng@627
|
3760 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3761 #: ../en/ch03-tour-merge.xml:151
|
dongsheng@627
|
3762 msgid ""
|
dongsheng@627
|
3763 "We now have a new tip revision; notice that it has <emphasis>both</emphasis> "
|
dongsheng@627
|
3764 "of our former heads as its parents. These are the same revisions that were "
|
dongsheng@627
|
3765 "previously displayed by <command role=\"hg-cmd\">hg parents</command>."
|
dongsheng@627
|
3766 msgstr ""
|
dongsheng@627
|
3767
|
dongsheng@627
|
3768 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3769 #: ../en/ch03-tour-merge.xml:158
|
dongsheng@641
|
3770 msgid ""
|
dongsheng@641
|
3771 "In figure <xref endterm=\"fig.tour-merge.merge.caption\" linkend=\"fig.tour-"
|
dongsheng@641
|
3772 "merge.merge\"/>, you can see a representation of what happens to the working "
|
dongsheng@641
|
3773 "directory during the merge, and how this affects the repository when the "
|
dongsheng@641
|
3774 "commit happens. During the merge, the working directory has two parent "
|
dongsheng@641
|
3775 "changesets, and these become the parents of the new changeset."
|
dongsheng@627
|
3776 msgstr ""
|
dongsheng@627
|
3777
|
dongsheng@627
|
3778 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
3779 #: ../en/ch03-tour-merge.xml:169
|
dongsheng@627
|
3780 msgid "Merging conflicting changes"
|
dongsheng@627
|
3781 msgstr "合并有冲突的改变"
|
dongsheng@627
|
3782
|
dongsheng@627
|
3783 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
3784 #: ../en/ch03-tour-merge.xml:171
|
dongsheng@627
|
3785 msgid ""
|
dongsheng@627
|
3786 "Most merges are simple affairs, but sometimes you'll find yourself merging "
|
dongsheng@627
|
3787 "changes where each modifies the same portions of the same files. Unless both "
|
dongsheng@627
|
3788 "modifications are identical, this results in a <emphasis>conflict</emphasis>, "
|
dongsheng@627
|
3789 "where you have to decide how to reconcile the different changes into "
|
dongsheng@627
|
3790 "something coherent."
|
dongsheng@627
|
3791 msgstr ""
|
dongsheng@627
|
3792
|
dongsheng@627
|
3793 #. type: Content of: <book><chapter><sect1><informalfigure><mediaobject>
|
dongsheng@627
|
3794 #: ../en/ch03-tour-merge.xml:180
|
dongsheng@627
|
3795 msgid ""
|
dongsheng@641
|
3796 "<imageobject><imagedata fileref=\"images/tour-merge-conflict.png\"/> </"
|
dongsheng@627
|
3797 "imageobject>"
|
dongsheng@627
|
3798 msgstr ""
|
dongsheng@627
|
3799
|
dongsheng@627
|
3800 #. type: Content of: <book><chapter><sect1><informalfigure><mediaobject><caption><para>
|
dongsheng@641
|
3801 #: ../en/ch03-tour-merge.xml:183
|
dongsheng@627
|
3802 msgid "Conflicting changes to a document"
|
dongsheng@627
|
3803 msgstr ""
|
dongsheng@627
|
3804
|
dongsheng@627
|
3805 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
3806 #: ../en/ch03-tour-merge.xml:188
|
dongsheng@641
|
3807 msgid ""
|
dongsheng@641
|
3808 "Figure <xref endterm=\"fig.tour-merge.conflict.caption\" linkend=\"fig.tour-"
|
dongsheng@641
|
3809 "merge.conflict\"/> illustrates an instance of two conflicting changes to a "
|
dongsheng@641
|
3810 "document. We started with a single version of the file; then we made some "
|
dongsheng@641
|
3811 "changes; while someone else made different changes to the same text. Our "
|
dongsheng@641
|
3812 "task in resolving the conflicting changes is to decide what the file should "
|
dongsheng@641
|
3813 "look like."
|
dongsheng@641
|
3814 msgstr ""
|
dongsheng@641
|
3815
|
dongsheng@641
|
3816 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
3817 #: ../en/ch03-tour-merge.xml:196
|
dongsheng@627
|
3818 msgid ""
|
dongsheng@627
|
3819 "Mercurial doesn't have a built-in facility for handling conflicts. Instead, "
|
dongsheng@627
|
3820 "it runs an external program called <command>hgmerge</command>. This is a "
|
dongsheng@627
|
3821 "shell script that is bundled with Mercurial; you can change it to behave "
|
dongsheng@627
|
3822 "however you please. What it does by default is try to find one of several "
|
dongsheng@627
|
3823 "different merging tools that are likely to be installed on your system. It "
|
dongsheng@627
|
3824 "first tries a few fully automatic merging tools; if these don't succeed "
|
dongsheng@627
|
3825 "(because the resolution process requires human guidance) or aren't present, "
|
dongsheng@627
|
3826 "the script tries a few different graphical merging tools."
|
dongsheng@627
|
3827 msgstr ""
|
dongsheng@627
|
3828
|
dongsheng@627
|
3829 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
3830 #: ../en/ch03-tour-merge.xml:207
|
dongsheng@627
|
3831 msgid ""
|
dongsheng@627
|
3832 "It's also possible to get Mercurial to run another program or script instead "
|
dongsheng@627
|
3833 "of <command>hgmerge</command>, by setting the <envar>HGMERGE</envar> "
|
dongsheng@627
|
3834 "environment variable to the name of your preferred program."
|
dongsheng@627
|
3835 msgstr ""
|
dongsheng@627
|
3836
|
dongsheng@627
|
3837 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
3838 #: ../en/ch03-tour-merge.xml:213
|
dongsheng@627
|
3839 msgid "Using a graphical merge tool"
|
dongsheng@627
|
3840 msgstr "使用图形合并工具"
|
dongsheng@627
|
3841
|
dongsheng@627
|
3842 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3843 #: ../en/ch03-tour-merge.xml:215
|
dongsheng@627
|
3844 msgid ""
|
dongsheng@627
|
3845 "My preferred graphical merge tool is <command>kdiff3</command>, which I'll "
|
dongsheng@627
|
3846 "use to describe the features that are common to graphical file merging "
|
dongsheng@627
|
3847 "tools. You can see a screenshot of <command>kdiff3</command> in action in "
|
dongsheng@641
|
3848 "figure <xref endterm=\"fig.tour-merge.kdiff3.caption\" linkend=\"fig.tour-"
|
dongsheng@641
|
3849 "merge.kdiff3\"/>. The kind of merge it is performing is called a "
|
dongsheng@641
|
3850 "<emphasis>three-way merge</emphasis>, because there are three different "
|
dongsheng@641
|
3851 "versions of the file of interest to us. The tool thus splits the upper "
|
dongsheng@641
|
3852 "portion of the window into three panes:"
|
dongsheng@627
|
3853 msgstr ""
|
dongsheng@627
|
3854
|
dongsheng@627
|
3855 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
3856 #: ../en/ch03-tour-merge.xml:226
|
dongsheng@627
|
3857 msgid ""
|
dongsheng@627
|
3858 "At the left is the <emphasis>base</emphasis> version of the file, i.e. the "
|
dongsheng@627
|
3859 "most recent version from which the two versions we're trying to merge are "
|
dongsheng@627
|
3860 "descended."
|
dongsheng@627
|
3861 msgstr ""
|
dongsheng@627
|
3862
|
dongsheng@627
|
3863 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
3864 #: ../en/ch03-tour-merge.xml:231
|
dongsheng@627
|
3865 msgid ""
|
dongsheng@627
|
3866 "In the middle is <quote>our</quote> version of the file, with the contents "
|
dongsheng@627
|
3867 "that we modified."
|
dongsheng@627
|
3868 msgstr ""
|
dongsheng@627
|
3869
|
dongsheng@627
|
3870 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
3871 #: ../en/ch03-tour-merge.xml:234
|
dongsheng@627
|
3872 msgid ""
|
dongsheng@627
|
3873 "On the right is <quote>their</quote> version of the file, the one that from "
|
dongsheng@627
|
3874 "the changeset that we're trying to merge with."
|
dongsheng@627
|
3875 msgstr ""
|
dongsheng@627
|
3876
|
dongsheng@627
|
3877 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3878 #: ../en/ch03-tour-merge.xml:238
|
dongsheng@627
|
3879 msgid ""
|
dongsheng@627
|
3880 "In the pane below these is the current <emphasis>result</emphasis> of the "
|
dongsheng@627
|
3881 "merge. Our task is to replace all of the red text, which indicates unresolved "
|
dongsheng@627
|
3882 "conflicts, with some sensible merger of the <quote>ours</quote> and "
|
dongsheng@627
|
3883 "<quote>theirs</quote> versions of the file."
|
dongsheng@627
|
3884 msgstr ""
|
dongsheng@627
|
3885
|
dongsheng@627
|
3886 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3887 #: ../en/ch03-tour-merge.xml:245
|
dongsheng@627
|
3888 msgid ""
|
dongsheng@627
|
3889 "All four of these panes are <emphasis>locked together</emphasis>; if we "
|
dongsheng@627
|
3890 "scroll vertically or horizontally in any of them, the others are updated to "
|
dongsheng@627
|
3891 "display the corresponding sections of their respective files."
|
dongsheng@627
|
3892 msgstr ""
|
dongsheng@627
|
3893
|
dongsheng@627
|
3894 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
|
dongsheng@641
|
3895 #: ../en/ch03-tour-merge.xml:252
|
dongsheng@641
|
3896 msgid ""
|
dongsheng@641
|
3897 "<imageobject><imagedata width=\"100%\" fileref=\"images/kdiff3.png\"/> </"
|
dongsheng@630
|
3898 "imageobject>"
|
dongsheng@627
|
3899 msgstr ""
|
dongsheng@627
|
3900
|
dongsheng@627
|
3901 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
|
dongsheng@641
|
3902 #: ../en/ch03-tour-merge.xml:255
|
dongsheng@627
|
3903 msgid "Using <command>kdiff3</command> to merge versions of a file"
|
dongsheng@627
|
3904 msgstr ""
|
dongsheng@627
|
3905
|
dongsheng@627
|
3906 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3907 #: ../en/ch03-tour-merge.xml:261
|
dongsheng@627
|
3908 msgid ""
|
dongsheng@627
|
3909 "For each conflicting portion of the file, we can choose to resolve the "
|
dongsheng@627
|
3910 "conflict using some combination of text from the base version, ours, or "
|
dongsheng@627
|
3911 "theirs. We can also manually edit the merged file at any time, in case we "
|
dongsheng@627
|
3912 "need to make further modifications."
|
dongsheng@627
|
3913 msgstr ""
|
dongsheng@627
|
3914
|
dongsheng@627
|
3915 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3916 #: ../en/ch03-tour-merge.xml:267
|
dongsheng@627
|
3917 msgid ""
|
dongsheng@627
|
3918 "There are <emphasis>many</emphasis> file merging tools available, too many to "
|
dongsheng@627
|
3919 "cover here. They vary in which platforms they are available for, and in "
|
dongsheng@627
|
3920 "their particular strengths and weaknesses. Most are tuned for merging files "
|
dongsheng@627
|
3921 "containing plain text, while a few are aimed at specialised file formats "
|
dongsheng@627
|
3922 "(generally XML)."
|
dongsheng@627
|
3923 msgstr ""
|
dongsheng@627
|
3924
|
dongsheng@627
|
3925 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
3926 #: ../en/ch03-tour-merge.xml:276
|
dongsheng@627
|
3927 msgid "A worked example"
|
dongsheng@627
|
3928 msgstr "合并实例"
|
dongsheng@627
|
3929
|
dongsheng@627
|
3930 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3931 #: ../en/ch03-tour-merge.xml:278
|
dongsheng@627
|
3932 msgid ""
|
dongsheng@627
|
3933 "In this example, we will reproduce the file modification history of figure "
|
dongsheng@641
|
3934 "<xref endterm=\"fig.tour-merge.conflict.caption\" linkend=\"fig.tour-merge."
|
dongsheng@641
|
3935 "conflict\"/> above. Let's begin by creating a repository with a base version "
|
dongsheng@641
|
3936 "of our document."
|
dongsheng@641
|
3937 msgstr ""
|
dongsheng@641
|
3938
|
dongsheng@641
|
3939 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3940 #: ../en/ch03-tour-merge.xml:286
|
dongsheng@627
|
3941 msgid "We'll clone the repository and make a change to the file."
|
dongsheng@627
|
3942 msgstr ""
|
dongsheng@627
|
3943
|
dongsheng@627
|
3944 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3945 #: ../en/ch03-tour-merge.xml:291
|
dongsheng@627
|
3946 msgid ""
|
dongsheng@627
|
3947 "And another clone, to simulate someone else making a change to the file. "
|
dongsheng@627
|
3948 "(This hints at the idea that it's not all that unusual to merge with yourself "
|
dongsheng@627
|
3949 "when you isolate tasks in separate repositories, and indeed to find and "
|
dongsheng@627
|
3950 "resolve conflicts while doing so.)"
|
dongsheng@627
|
3951 msgstr ""
|
dongsheng@627
|
3952
|
dongsheng@627
|
3953 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3954 #: ../en/ch03-tour-merge.xml:299
|
dongsheng@627
|
3955 msgid ""
|
dongsheng@627
|
3956 "Having created two different versions of the file, we'll set up an "
|
dongsheng@627
|
3957 "environment suitable for running our merge."
|
dongsheng@627
|
3958 msgstr ""
|
dongsheng@627
|
3959
|
dongsheng@627
|
3960 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3961 #: ../en/ch03-tour-merge.xml:305
|
dongsheng@627
|
3962 msgid ""
|
dongsheng@627
|
3963 "In this example, I won't use Mercurial's normal <command>hgmerge</command> "
|
dongsheng@627
|
3964 "program to do the merge, because it would drop my nice automated example-"
|
dongsheng@627
|
3965 "running tool into a graphical user interface. Instead, I'll set "
|
dongsheng@627
|
3966 "<envar>HGMERGE</envar> to tell Mercurial to use the non-interactive "
|
dongsheng@627
|
3967 "<command>merge</command> command. This is bundled with many Unix-like "
|
dongsheng@627
|
3968 "systems. If you're following this example on your computer, don't bother "
|
dongsheng@627
|
3969 "setting <envar>HGMERGE</envar>."
|
dongsheng@627
|
3970 msgstr ""
|
dongsheng@627
|
3971
|
dongsheng@627
|
3972 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3973 #: ../en/ch03-tour-merge.xml:315
|
dongsheng@627
|
3974 msgid "<emphasis role=\"bold\">XXX FIX THIS EXAMPLE.</emphasis>"
|
dongsheng@627
|
3975 msgstr ""
|
dongsheng@627
|
3976
|
dongsheng@627
|
3977 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3978 #: ../en/ch03-tour-merge.xml:320
|
dongsheng@627
|
3979 msgid ""
|
dongsheng@627
|
3980 "Because <command>merge</command> can't resolve the conflicting changes, it "
|
dongsheng@627
|
3981 "leaves <emphasis>merge markers</emphasis> inside the file that has conflicts, "
|
dongsheng@627
|
3982 "indicating which lines have conflicts, and whether they came from our version "
|
dongsheng@627
|
3983 "of the file or theirs."
|
dongsheng@627
|
3984 msgstr ""
|
dongsheng@627
|
3985
|
dongsheng@627
|
3986 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3987 #: ../en/ch03-tour-merge.xml:326
|
dongsheng@627
|
3988 msgid ""
|
dongsheng@627
|
3989 "Mercurial can tell from the way <command>merge</command> exits that it wasn't "
|
dongsheng@627
|
3990 "able to merge successfully, so it tells us what commands we'll need to run if "
|
dongsheng@627
|
3991 "we want to redo the merging operation. This could be useful if, for example, "
|
dongsheng@627
|
3992 "we were running a graphical merge tool and quit because we were confused or "
|
dongsheng@627
|
3993 "realised we had made a mistake."
|
dongsheng@627
|
3994 msgstr ""
|
dongsheng@627
|
3995
|
dongsheng@627
|
3996 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
3997 #: ../en/ch03-tour-merge.xml:333
|
dongsheng@627
|
3998 msgid ""
|
dongsheng@627
|
3999 "If automatic or manual merges fail, there's nothing to prevent us from "
|
dongsheng@627
|
4000 "<quote>fixing up</quote> the affected files ourselves, and committing the "
|
dongsheng@627
|
4001 "results of our merge:"
|
dongsheng@627
|
4002 msgstr ""
|
dongsheng@627
|
4003
|
dongsheng@627
|
4004 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
4005 #: ../en/ch03-tour-merge.xml:342
|
dongsheng@627
|
4006 msgid "Simplifying the pull-merge-commit sequence"
|
dongsheng@627
|
4007 msgstr "简化拉-合并-提交程序"
|
dongsheng@627
|
4008
|
dongsheng@627
|
4009 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
4010 #: ../en/ch03-tour-merge.xml:344
|
dongsheng@627
|
4011 msgid ""
|
dongsheng@627
|
4012 "The process of merging changes as outlined above is straightforward, but "
|
dongsheng@627
|
4013 "requires running three commands in sequence."
|
dongsheng@627
|
4014 msgstr ""
|
dongsheng@627
|
4015
|
dongsheng@627
|
4016 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
4017 #: ../en/ch03-tour-merge.xml:350
|
dongsheng@627
|
4018 msgid ""
|
dongsheng@627
|
4019 "In the case of the final commit, you also need to enter a commit message, "
|
dongsheng@627
|
4020 "which is almost always going to be a piece of uninteresting "
|
dongsheng@627
|
4021 "<quote>boilerplate</quote> text."
|
dongsheng@627
|
4022 msgstr ""
|
dongsheng@627
|
4023
|
dongsheng@627
|
4024 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
4025 #: ../en/ch03-tour-merge.xml:354
|
dongsheng@627
|
4026 msgid ""
|
dongsheng@627
|
4027 "It would be nice to reduce the number of steps needed, if this were "
|
dongsheng@627
|
4028 "possible. Indeed, Mercurial is distributed with an extension called <literal "
|
dongsheng@627
|
4029 "role=\"hg-ext\">fetch</literal> that does just this."
|
dongsheng@627
|
4030 msgstr ""
|
dongsheng@627
|
4031
|
dongsheng@627
|
4032 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
4033 #: ../en/ch03-tour-merge.xml:359
|
dongsheng@627
|
4034 msgid ""
|
dongsheng@627
|
4035 "Mercurial provides a flexible extension mechanism that lets people extend its "
|
dongsheng@627
|
4036 "functionality, while keeping the core of Mercurial small and easy to deal "
|
dongsheng@627
|
4037 "with. Some extensions add new commands that you can use from the command "
|
dongsheng@627
|
4038 "line, while others work <quote>behind the scenes,</quote> for example adding "
|
dongsheng@627
|
4039 "capabilities to the server."
|
dongsheng@627
|
4040 msgstr ""
|
dongsheng@627
|
4041
|
dongsheng@627
|
4042 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
4043 #: ../en/ch03-tour-merge.xml:366
|
dongsheng@627
|
4044 msgid ""
|
dongsheng@627
|
4045 "The <literal role=\"hg-ext\">fetch</literal> extension adds a new command "
|
dongsheng@627
|
4046 "called, not surprisingly, <command role=\"hg-cmd\">hg fetch</command>. This "
|
dongsheng@627
|
4047 "extension acts as a combination of <command role=\"hg-cmd\">hg pull</"
|
dongsheng@627
|
4048 "command>, <command role=\"hg-cmd\">hg update</command> and <command role=\"hg-"
|
dongsheng@627
|
4049 "cmd\">hg merge</command>. It begins by pulling changes from another "
|
dongsheng@627
|
4050 "repository into the current repository. If it finds that the changes added a "
|
dongsheng@627
|
4051 "new head to the repository, it begins a merge, then commits the result of the "
|
dongsheng@627
|
4052 "merge with an automatically-generated commit message. If no new heads were "
|
dongsheng@627
|
4053 "added, it updates the working directory to the new tip changeset."
|
dongsheng@627
|
4054 msgstr ""
|
dongsheng@627
|
4055
|
dongsheng@627
|
4056 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
4057 #: ../en/ch03-tour-merge.xml:379
|
dongsheng@627
|
4058 msgid ""
|
dongsheng@627
|
4059 "Enabling the <literal role=\"hg-ext\">fetch</literal> extension is easy. "
|
dongsheng@627
|
4060 "Edit your <filename role=\"special\">.hgrc</filename>, and either go to the "
|
dongsheng@627
|
4061 "<literal role=\"rc-extensions\">extensions</literal> section or create an "
|
dongsheng@627
|
4062 "<literal role=\"rc-extensions\">extensions</literal> section. Then add a line "
|
dongsheng@627
|
4063 "that simply reads <quote><literal>fetch </literal></quote>."
|
dongsheng@627
|
4064 msgstr ""
|
dongsheng@627
|
4065
|
dongsheng@627
|
4066 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
4067 #: ../en/ch03-tour-merge.xml:389
|
dongsheng@627
|
4068 msgid ""
|
dongsheng@627
|
4069 "(Normally, on the right-hand side of the <quote><literal>=</literal></quote> "
|
dongsheng@627
|
4070 "would appear the location of the extension, but since the <literal role=\"hg-"
|
dongsheng@627
|
4071 "ext\">fetch</literal> extension is in the standard distribution, Mercurial "
|
dongsheng@627
|
4072 "knows where to search for it.)"
|
dongsheng@627
|
4073 msgstr ""
|
dongsheng@627
|
4074
|
dongsheng@627
|
4075 #. type: Content of: <book><chapter><title>
|
dongsheng@627
|
4076 #: ../en/ch04-concepts.xml:5
|
dongsheng@627
|
4077 msgid "Behind the scenes"
|
dongsheng@627
|
4078 msgstr "Mercurial 内幕"
|
dongsheng@627
|
4079
|
dongsheng@627
|
4080 #. type: Content of: <book><chapter><para>
|
dongsheng@627
|
4081 #: ../en/ch04-concepts.xml:7
|
dongsheng@627
|
4082 msgid ""
|
dongsheng@627
|
4083 "Unlike many revision control systems, the concepts upon which Mercurial is "
|
dongsheng@627
|
4084 "built are simple enough that it's easy to understand how the software really "
|
dongsheng@627
|
4085 "works. Knowing this certainly isn't necessary, but I find it useful to have "
|
dongsheng@627
|
4086 "a <quote>mental model</quote> of what's going on."
|
dongsheng@627
|
4087 msgstr ""
|
dongsheng@627
|
4088
|
dongsheng@627
|
4089 #. type: Content of: <book><chapter><para>
|
dongsheng@627
|
4090 #: ../en/ch04-concepts.xml:13
|
dongsheng@627
|
4091 msgid ""
|
dongsheng@627
|
4092 "This understanding gives me confidence that Mercurial has been carefully "
|
dongsheng@627
|
4093 "designed to be both <emphasis>safe</emphasis> and <emphasis>efficient</"
|
dongsheng@627
|
4094 "emphasis>. And just as importantly, if it's easy for me to retain a good "
|
dongsheng@627
|
4095 "idea of what the software is doing when I perform a revision control task, "
|
dongsheng@627
|
4096 "I'm less likely to be surprised by its behaviour."
|
dongsheng@627
|
4097 msgstr ""
|
dongsheng@627
|
4098
|
dongsheng@627
|
4099 #. type: Content of: <book><chapter><para>
|
dongsheng@627
|
4100 #: ../en/ch04-concepts.xml:20
|
dongsheng@627
|
4101 msgid ""
|
dongsheng@627
|
4102 "In this chapter, we'll initially cover the core concepts behind Mercurial's "
|
dongsheng@627
|
4103 "design, then continue to discuss some of the interesting details of its "
|
dongsheng@627
|
4104 "implementation."
|
dongsheng@627
|
4105 msgstr ""
|
dongsheng@627
|
4106
|
dongsheng@627
|
4107 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
4108 #: ../en/ch04-concepts.xml:25
|
dongsheng@627
|
4109 msgid "Mercurial's historical record"
|
dongsheng@627
|
4110 msgstr "Mercurial 的历史记录"
|
dongsheng@627
|
4111
|
dongsheng@627
|
4112 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
4113 #: ../en/ch04-concepts.xml:28
|
dongsheng@627
|
4114 msgid "Tracking the history of a single file"
|
dongsheng@627
|
4115 msgstr "跟踪单一文件的历史"
|
dongsheng@627
|
4116
|
dongsheng@627
|
4117 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
4118 #: ../en/ch04-concepts.xml:30
|
dongsheng@627
|
4119 msgid ""
|
dongsheng@627
|
4120 "When Mercurial tracks modifications to a file, it stores the history of that "
|
dongsheng@627
|
4121 "file in a metadata object called a <emphasis>filelog</emphasis>. Each entry "
|
dongsheng@627
|
4122 "in the filelog contains enough information to reconstruct one revision of the "
|
dongsheng@627
|
4123 "file that is being tracked. Filelogs are stored as files in the <filename "
|
dongsheng@627
|
4124 "role=\"special\" class=\"directory\">.hg/store/data</filename> directory. A "
|
dongsheng@627
|
4125 "filelog contains two kinds of information: revision data, and an index to "
|
dongsheng@627
|
4126 "help Mercurial to find a revision efficiently."
|
dongsheng@627
|
4127 msgstr ""
|
dongsheng@627
|
4128
|
dongsheng@627
|
4129 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
4130 #: ../en/ch04-concepts.xml:41
|
dongsheng@627
|
4131 msgid ""
|
dongsheng@627
|
4132 "A file that is large, or has a lot of history, has its filelog stored in "
|
dongsheng@627
|
4133 "separate data (<quote><literal>.d</literal></quote> suffix) and index "
|
dongsheng@627
|
4134 "(<quote><literal>.i</literal></quote> suffix) files. For small files without "
|
dongsheng@627
|
4135 "much history, the revision data and index are combined in a single "
|
dongsheng@627
|
4136 "<quote><literal>.i</literal></quote> file. The correspondence between a file "
|
dongsheng@627
|
4137 "in the working directory and the filelog that tracks its history in the "
|
dongsheng@641
|
4138 "repository is illustrated in figure <xref endterm=\"fig.concepts.filelog."
|
dongsheng@641
|
4139 "caption\" linkend=\"fig.concepts.filelog\"/>."
|
dongsheng@627
|
4140 msgstr ""
|
dongsheng@627
|
4141
|
dongsheng@627
|
4142 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
|
dongsheng@641
|
4143 #: ../en/ch04-concepts.xml:55
|
dongsheng@627
|
4144 msgid "<imageobject><imagedata fileref=\"images/filelog.png\"/></imageobject>"
|
dongsheng@627
|
4145 msgstr ""
|
dongsheng@627
|
4146
|
dongsheng@627
|
4147 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
|
dongsheng@641
|
4148 #: ../en/ch04-concepts.xml:57
|
dongsheng@627
|
4149 msgid ""
|
dongsheng@627
|
4150 "Relationships between files in working directory and filelogs in repository"
|
dongsheng@627
|
4151 msgstr ""
|
dongsheng@627
|
4152
|
dongsheng@627
|
4153 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
4154 #: ../en/ch04-concepts.xml:65
|
dongsheng@627
|
4155 msgid "Managing tracked files"
|
dongsheng@627
|
4156 msgstr "管理跟踪的文件"
|
dongsheng@627
|
4157
|
dongsheng@627
|
4158 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4159 #: ../en/ch04-concepts.xml:67
|
dongsheng@627
|
4160 msgid ""
|
dongsheng@627
|
4161 "Mercurial uses a structure called a <emphasis>manifest</emphasis> to collect "
|
dongsheng@627
|
4162 "together information about the files that it tracks. Each entry in the "
|
dongsheng@627
|
4163 "manifest contains information about the files present in a single changeset. "
|
dongsheng@627
|
4164 "An entry records which files are present in the changeset, the revision of "
|
dongsheng@627
|
4165 "each file, and a few other pieces of file metadata."
|
dongsheng@627
|
4166 msgstr ""
|
dongsheng@627
|
4167
|
dongsheng@627
|
4168 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
4169 #: ../en/ch04-concepts.xml:77
|
dongsheng@627
|
4170 msgid "Recording changeset information"
|
dongsheng@627
|
4171 msgstr "记录修改集信息"
|
dongsheng@627
|
4172
|
dongsheng@627
|
4173 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4174 #: ../en/ch04-concepts.xml:79
|
dongsheng@627
|
4175 msgid ""
|
dongsheng@627
|
4176 "The <emphasis>changelog</emphasis> contains information about each "
|
dongsheng@627
|
4177 "changeset. Each revision records who committed a change, the changeset "
|
dongsheng@627
|
4178 "comment, other pieces of changeset-related information, and the revision of "
|
dongsheng@627
|
4179 "the manifest to use."
|
dongsheng@627
|
4180 msgstr ""
|
dongsheng@627
|
4181
|
dongsheng@627
|
4182 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
4183 #: ../en/ch04-concepts.xml:87
|
dongsheng@627
|
4184 msgid "Relationships between revisions"
|
dongsheng@627
|
4185 msgstr "版本之间的关系"
|
dongsheng@627
|
4186
|
dongsheng@627
|
4187 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4188 #: ../en/ch04-concepts.xml:89
|
dongsheng@627
|
4189 msgid ""
|
dongsheng@627
|
4190 "Within a changelog, a manifest, or a filelog, each revision stores a pointer "
|
dongsheng@627
|
4191 "to its immediate parent (or to its two parents, if it's a merge revision). "
|
dongsheng@627
|
4192 "As I mentioned above, there are also relationships between revisions "
|
dongsheng@627
|
4193 "<emphasis>across</emphasis> these structures, and they are hierarchical in "
|
dongsheng@627
|
4194 "nature."
|
dongsheng@627
|
4195 msgstr ""
|
dongsheng@627
|
4196
|
dongsheng@627
|
4197 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4198 #: ../en/ch04-concepts.xml:96
|
dongsheng@627
|
4199 msgid ""
|
dongsheng@627
|
4200 "For every changeset in a repository, there is exactly one revision stored in "
|
dongsheng@627
|
4201 "the changelog. Each revision of the changelog contains a pointer to a single "
|
dongsheng@627
|
4202 "revision of the manifest. A revision of the manifest stores a pointer to a "
|
dongsheng@627
|
4203 "single revision of each filelog tracked when that changeset was created. "
|
dongsheng@641
|
4204 "These relationships are illustrated in figure <xref endterm=\"fig.concepts."
|
dongsheng@641
|
4205 "metadata.caption\" linkend=\"fig.concepts.metadata\"/>."
|
dongsheng@627
|
4206 msgstr ""
|
dongsheng@627
|
4207
|
dongsheng@627
|
4208 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
|
dongsheng@641
|
4209 #: ../en/ch04-concepts.xml:107
|
dongsheng@627
|
4210 msgid "<imageobject><imagedata fileref=\"images/metadata.png\"/></imageobject>"
|
dongsheng@627
|
4211 msgstr ""
|
dongsheng@627
|
4212
|
dongsheng@627
|
4213 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
|
dongsheng@641
|
4214 #: ../en/ch04-concepts.xml:109
|
dongsheng@627
|
4215 msgid "Metadata relationships"
|
dongsheng@627
|
4216 msgstr ""
|
dongsheng@627
|
4217
|
dongsheng@627
|
4218 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4219 #: ../en/ch04-concepts.xml:114
|
dongsheng@627
|
4220 msgid ""
|
dongsheng@627
|
4221 "As the illustration shows, there is <emphasis>not</emphasis> a <quote>one to "
|
dongsheng@627
|
4222 "one</quote> relationship between revisions in the changelog, manifest, or "
|
dongsheng@627
|
4223 "filelog. If the manifest hasn't changed between two changesets, the changelog "
|
dongsheng@627
|
4224 "entries for those changesets will point to the same revision of the "
|
dongsheng@627
|
4225 "manifest. If a file that Mercurial tracks hasn't changed between two "
|
dongsheng@627
|
4226 "changesets, the entry for that file in the two revisions of the manifest will "
|
dongsheng@627
|
4227 "point to the same revision of its filelog."
|
dongsheng@627
|
4228 msgstr ""
|
dongsheng@627
|
4229
|
dongsheng@627
|
4230 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
4231 #: ../en/ch04-concepts.xml:127
|
dongsheng@627
|
4232 msgid "Safe, efficient storage"
|
dongsheng@627
|
4233 msgstr "安全,高效的存储"
|
dongsheng@627
|
4234
|
dongsheng@627
|
4235 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
4236 #: ../en/ch04-concepts.xml:129
|
dongsheng@627
|
4237 msgid ""
|
dongsheng@627
|
4238 "The underpinnings of changelogs, manifests, and filelogs are provided by a "
|
dongsheng@627
|
4239 "single structure called the <emphasis>revlog</emphasis>."
|
dongsheng@627
|
4240 msgstr ""
|
dongsheng@627
|
4241
|
dongsheng@627
|
4242 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
4243 #: ../en/ch04-concepts.xml:134
|
dongsheng@627
|
4244 msgid "Efficient storage"
|
dongsheng@627
|
4245 msgstr "高效存储"
|
dongsheng@627
|
4246
|
dongsheng@627
|
4247 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4248 #: ../en/ch04-concepts.xml:136
|
dongsheng@627
|
4249 msgid ""
|
dongsheng@627
|
4250 "The revlog provides efficient storage of revisions using a <emphasis>delta</"
|
dongsheng@627
|
4251 "emphasis> mechanism. Instead of storing a complete copy of a file for each "
|
dongsheng@627
|
4252 "revision, it stores the changes needed to transform an older revision into "
|
dongsheng@627
|
4253 "the new revision. For many kinds of file data, these deltas are typically a "
|
dongsheng@627
|
4254 "fraction of a percent of the size of a full copy of a file."
|
dongsheng@627
|
4255 msgstr ""
|
dongsheng@627
|
4256
|
dongsheng@627
|
4257 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4258 #: ../en/ch04-concepts.xml:144
|
dongsheng@627
|
4259 msgid ""
|
dongsheng@627
|
4260 "Some obsolete revision control systems can only work with deltas of text "
|
dongsheng@627
|
4261 "files. They must either store binary files as complete snapshots or encoded "
|
dongsheng@627
|
4262 "into a text representation, both of which are wasteful approaches. Mercurial "
|
dongsheng@627
|
4263 "can efficiently handle deltas of files with arbitrary binary contents; it "
|
dongsheng@627
|
4264 "doesn't need to treat text as special."
|
dongsheng@627
|
4265 msgstr ""
|
dongsheng@627
|
4266
|
dongsheng@627
|
4267 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
4268 #: ../en/ch04-concepts.xml:153
|
dongsheng@627
|
4269 msgid "Safe operation"
|
dongsheng@627
|
4270 msgstr "安全操作"
|
dongsheng@627
|
4271
|
dongsheng@627
|
4272 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4273 #: ../en/ch04-concepts.xml:155
|
dongsheng@627
|
4274 msgid ""
|
dongsheng@627
|
4275 "Mercurial only ever <emphasis>appends</emphasis> data to the end of a revlog "
|
dongsheng@627
|
4276 "file. It never modifies a section of a file after it has written it. This is "
|
dongsheng@627
|
4277 "both more robust and efficient than schemes that need to modify or rewrite "
|
dongsheng@627
|
4278 "data."
|
dongsheng@627
|
4279 msgstr ""
|
dongsheng@627
|
4280
|
dongsheng@627
|
4281 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4282 #: ../en/ch04-concepts.xml:161
|
dongsheng@627
|
4283 msgid ""
|
dongsheng@627
|
4284 "In addition, Mercurial treats every write as part of a <emphasis>transaction</"
|
dongsheng@627
|
4285 "emphasis> that can span a number of files. A transaction is "
|
dongsheng@627
|
4286 "<emphasis>atomic</emphasis>: either the entire transaction succeeds and its "
|
dongsheng@627
|
4287 "effects are all visible to readers in one go, or the whole thing is undone. "
|
dongsheng@627
|
4288 "This guarantee of atomicity means that if you're running two copies of "
|
dongsheng@627
|
4289 "Mercurial, where one is reading data and one is writing it, the reader will "
|
dongsheng@627
|
4290 "never see a partially written result that might confuse it."
|
dongsheng@627
|
4291 msgstr ""
|
dongsheng@627
|
4292
|
dongsheng@627
|
4293 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4294 #: ../en/ch04-concepts.xml:171
|
dongsheng@627
|
4295 msgid ""
|
dongsheng@627
|
4296 "The fact that Mercurial only appends to files makes it easier to provide this "
|
dongsheng@627
|
4297 "transactional guarantee. The easier it is to do stuff like this, the more "
|
dongsheng@627
|
4298 "confident you should be that it's done correctly."
|
dongsheng@627
|
4299 msgstr ""
|
dongsheng@627
|
4300
|
dongsheng@627
|
4301 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
4302 #: ../en/ch04-concepts.xml:178
|
dongsheng@627
|
4303 msgid "Fast retrieval"
|
dongsheng@627
|
4304 msgstr "快速检索"
|
dongsheng@627
|
4305
|
dongsheng@627
|
4306 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4307 #: ../en/ch04-concepts.xml:180
|
dongsheng@627
|
4308 msgid ""
|
dongsheng@627
|
4309 "Mercurial cleverly avoids a pitfall common to all earlier revision control "
|
dongsheng@627
|
4310 "systems: the problem of <emphasis>inefficient retrieval</emphasis>. Most "
|
dongsheng@627
|
4311 "revision control systems store the contents of a revision as an incremental "
|
dongsheng@627
|
4312 "series of modifications against a <quote>snapshot</quote>. To reconstruct a "
|
dongsheng@627
|
4313 "specific revision, you must first read the snapshot, and then every one of "
|
dongsheng@627
|
4314 "the revisions between the snapshot and your target revision. The more "
|
dongsheng@627
|
4315 "history that a file accumulates, the more revisions you must read, hence the "
|
dongsheng@627
|
4316 "longer it takes to reconstruct a particular revision."
|
dongsheng@627
|
4317 msgstr ""
|
dongsheng@627
|
4318
|
dongsheng@627
|
4319 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
|
dongsheng@641
|
4320 #: ../en/ch04-concepts.xml:193
|
dongsheng@627
|
4321 msgid "<imageobject><imagedata fileref=\"images/snapshot.png\"/></imageobject>"
|
dongsheng@627
|
4322 msgstr ""
|
dongsheng@627
|
4323
|
dongsheng@627
|
4324 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
|
dongsheng@641
|
4325 #: ../en/ch04-concepts.xml:195
|
dongsheng@627
|
4326 msgid "Snapshot of a revlog, with incremental deltas"
|
dongsheng@627
|
4327 msgstr ""
|
dongsheng@627
|
4328
|
dongsheng@627
|
4329 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4330 #: ../en/ch04-concepts.xml:200
|
dongsheng@627
|
4331 msgid ""
|
dongsheng@627
|
4332 "The innovation that Mercurial applies to this problem is simple but "
|
dongsheng@627
|
4333 "effective. Once the cumulative amount of delta information stored since the "
|
dongsheng@627
|
4334 "last snapshot exceeds a fixed threshold, it stores a new snapshot "
|
dongsheng@627
|
4335 "(compressed, of course), instead of another delta. This makes it possible to "
|
dongsheng@627
|
4336 "reconstruct <emphasis>any</emphasis> revision of a file quickly. This "
|
dongsheng@627
|
4337 "approach works so well that it has since been copied by several other "
|
dongsheng@627
|
4338 "revision control systems."
|
dongsheng@627
|
4339 msgstr ""
|
dongsheng@627
|
4340
|
dongsheng@627
|
4341 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4342 #: ../en/ch04-concepts.xml:209
|
dongsheng@641
|
4343 msgid ""
|
dongsheng@641
|
4344 "Figure <xref endterm=\"fig.concepts.snapshot.caption\" linkend=\"fig.concepts."
|
dongsheng@641
|
4345 "snapshot\"/> illustrates the idea. In an entry in a revlog's index file, "
|
dongsheng@641
|
4346 "Mercurial stores the range of entries from the data file that it must read to "
|
dongsheng@641
|
4347 "reconstruct a particular revision."
|
dongsheng@627
|
4348 msgstr ""
|
dongsheng@627
|
4349
|
dongsheng@627
|
4350 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@641
|
4351 #: ../en/ch04-concepts.xml:216
|
dongsheng@627
|
4352 msgid "Aside: the influence of video compression"
|
dongsheng@627
|
4353 msgstr ""
|
dongsheng@627
|
4354
|
dongsheng@627
|
4355 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
4356 #: ../en/ch04-concepts.xml:218
|
dongsheng@627
|
4357 msgid ""
|
dongsheng@627
|
4358 "If you're familiar with video compression or have ever watched a TV feed "
|
dongsheng@627
|
4359 "through a digital cable or satellite service, you may know that most video "
|
dongsheng@627
|
4360 "compression schemes store each frame of video as a delta against its "
|
dongsheng@627
|
4361 "predecessor frame. In addition, these schemes use <quote>lossy</quote> "
|
dongsheng@627
|
4362 "compression techniques to increase the compression ratio, so visual errors "
|
dongsheng@627
|
4363 "accumulate over the course of a number of inter-frame deltas."
|
dongsheng@627
|
4364 msgstr ""
|
dongsheng@627
|
4365
|
dongsheng@627
|
4366 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
4367 #: ../en/ch04-concepts.xml:227
|
dongsheng@627
|
4368 msgid ""
|
dongsheng@627
|
4369 "Because it's possible for a video stream to <quote>drop out</quote> "
|
dongsheng@627
|
4370 "occasionally due to signal glitches, and to limit the accumulation of "
|
dongsheng@627
|
4371 "artefacts introduced by the lossy compression process, video encoders "
|
dongsheng@627
|
4372 "periodically insert a complete frame (called a <quote>key frame</quote>) into "
|
dongsheng@627
|
4373 "the video stream; the next delta is generated against that frame. This means "
|
dongsheng@627
|
4374 "that if the video signal gets interrupted, it will resume once the next key "
|
dongsheng@627
|
4375 "frame is received. Also, the accumulation of encoding errors restarts anew "
|
dongsheng@627
|
4376 "with each key frame."
|
dongsheng@627
|
4377 msgstr ""
|
dongsheng@627
|
4378
|
dongsheng@627
|
4379 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
4380 #: ../en/ch04-concepts.xml:241
|
dongsheng@627
|
4381 msgid "Identification and strong integrity"
|
dongsheng@627
|
4382 msgstr "鉴别和强完整性"
|
dongsheng@627
|
4383
|
dongsheng@627
|
4384 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4385 #: ../en/ch04-concepts.xml:243
|
dongsheng@627
|
4386 msgid ""
|
dongsheng@627
|
4387 "Along with delta or snapshot information, a revlog entry contains a "
|
dongsheng@627
|
4388 "cryptographic hash of the data that it represents. This makes it difficult "
|
dongsheng@627
|
4389 "to forge the contents of a revision, and easy to detect accidental corruption."
|
dongsheng@627
|
4390 msgstr ""
|
dongsheng@627
|
4391
|
dongsheng@627
|
4392 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4393 #: ../en/ch04-concepts.xml:248
|
dongsheng@627
|
4394 msgid ""
|
dongsheng@627
|
4395 "Hashes provide more than a mere check against corruption; they are used as "
|
dongsheng@627
|
4396 "the identifiers for revisions. The changeset identification hashes that you "
|
dongsheng@627
|
4397 "see as an end user are from revisions of the changelog. Although filelogs "
|
dongsheng@627
|
4398 "and the manifest also use hashes, Mercurial only uses these behind the scenes."
|
dongsheng@627
|
4399 msgstr ""
|
dongsheng@627
|
4400
|
dongsheng@627
|
4401 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4402 #: ../en/ch04-concepts.xml:255
|
dongsheng@627
|
4403 msgid ""
|
dongsheng@627
|
4404 "Mercurial verifies that hashes are correct when it retrieves file revisions "
|
dongsheng@627
|
4405 "and when it pulls changes from another repository. If it encounters an "
|
dongsheng@627
|
4406 "integrity problem, it will complain and stop whatever it's doing."
|
dongsheng@627
|
4407 msgstr ""
|
dongsheng@627
|
4408
|
dongsheng@627
|
4409 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4410 #: ../en/ch04-concepts.xml:260
|
dongsheng@627
|
4411 msgid ""
|
dongsheng@627
|
4412 "In addition to the effect it has on retrieval efficiency, Mercurial's use of "
|
dongsheng@627
|
4413 "periodic snapshots makes it more robust against partial data corruption. If "
|
dongsheng@627
|
4414 "a revlog becomes partly corrupted due to a hardware error or system bug, it's "
|
dongsheng@627
|
4415 "often possible to reconstruct some or most revisions from the uncorrupted "
|
dongsheng@627
|
4416 "sections of the revlog, both before and after the corrupted section. This "
|
dongsheng@627
|
4417 "would not be possible with a delta-only storage model."
|
dongsheng@627
|
4418 msgstr ""
|
dongsheng@627
|
4419
|
dongsheng@627
|
4420 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
4421 #: ../en/ch04-concepts.xml:272
|
dongsheng@627
|
4422 msgid "Revision history, branching, and merging"
|
dongsheng@627
|
4423 msgstr "修订历史,分支与合并"
|
dongsheng@627
|
4424
|
dongsheng@627
|
4425 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
4426 #: ../en/ch04-concepts.xml:274
|
dongsheng@627
|
4427 msgid ""
|
dongsheng@627
|
4428 "Every entry in a Mercurial revlog knows the identity of its immediate "
|
dongsheng@627
|
4429 "ancestor revision, usually referred to as its <emphasis>parent</emphasis>. "
|
dongsheng@627
|
4430 "In fact, a revision contains room for not one parent, but two. Mercurial "
|
dongsheng@627
|
4431 "uses a special hash, called the <quote>null ID</quote>, to represent the idea "
|
dongsheng@627
|
4432 "<quote>there is no parent here</quote>. This hash is simply a string of "
|
dongsheng@627
|
4433 "zeroes."
|
dongsheng@627
|
4434 msgstr ""
|
dongsheng@627
|
4435
|
dongsheng@627
|
4436 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
4437 #: ../en/ch04-concepts.xml:282
|
dongsheng@627
|
4438 msgid ""
|
dongsheng@641
|
4439 "In figure <xref endterm=\"fig.concepts.revlog.caption\" linkend=\"fig."
|
dongsheng@641
|
4440 "concepts.revlog\"/>, you can see an example of the conceptual structure of a "
|
dongsheng@641
|
4441 "revlog. Filelogs, manifests, and changelogs all have this same structure; "
|
dongsheng@641
|
4442 "they differ only in the kind of data stored in each delta or snapshot."
|
dongsheng@641
|
4443 msgstr ""
|
dongsheng@641
|
4444
|
dongsheng@641
|
4445 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
4446 #: ../en/ch04-concepts.xml:289
|
dongsheng@641
|
4447 msgid ""
|
dongsheng@627
|
4448 "The first revision in a revlog (at the bottom of the image) has the null ID "
|
dongsheng@627
|
4449 "in both of its parent slots. For a <quote>normal</quote> revision, its first "
|
dongsheng@627
|
4450 "parent slot contains the ID of its parent revision, and its second contains "
|
dongsheng@627
|
4451 "the null ID, indicating that the revision has only one real parent. Any two "
|
dongsheng@627
|
4452 "revisions that have the same parent ID are branches. A revision that "
|
dongsheng@627
|
4453 "represents a merge between branches has two normal revision IDs in its parent "
|
dongsheng@627
|
4454 "slots."
|
dongsheng@627
|
4455 msgstr ""
|
dongsheng@627
|
4456
|
dongsheng@627
|
4457 #. type: Content of: <book><chapter><sect1><informalfigure><mediaobject>
|
dongsheng@641
|
4458 #: ../en/ch04-concepts.xml:300
|
dongsheng@627
|
4459 msgid "<imageobject><imagedata fileref=\"images/revlog.png\"/></imageobject>"
|
dongsheng@627
|
4460 msgstr ""
|
dongsheng@627
|
4461
|
dongsheng@641
|
4462 #. type: Content of: <book><chapter><sect1><informalfigure><mediaobject><caption><para>
|
dongsheng@641
|
4463 #: ../en/ch04-concepts.xml:302
|
dongsheng@641
|
4464 msgid "Revision in revlog"
|
dongsheng@641
|
4465 msgstr ""
|
dongsheng@641
|
4466
|
dongsheng@627
|
4467 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
4468 #: ../en/ch04-concepts.xml:309
|
dongsheng@627
|
4469 msgid "The working directory"
|
dongsheng@627
|
4470 msgstr "工作目录"
|
dongsheng@627
|
4471
|
dongsheng@627
|
4472 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
4473 #: ../en/ch04-concepts.xml:311
|
dongsheng@627
|
4474 msgid ""
|
dongsheng@627
|
4475 "In the working directory, Mercurial stores a snapshot of the files from the "
|
dongsheng@627
|
4476 "repository as of a particular changeset."
|
dongsheng@627
|
4477 msgstr ""
|
dongsheng@627
|
4478
|
dongsheng@627
|
4479 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
4480 #: ../en/ch04-concepts.xml:314
|
dongsheng@627
|
4481 msgid ""
|
dongsheng@627
|
4482 "The working directory <quote>knows</quote> which changeset it contains. When "
|
dongsheng@627
|
4483 "you update the working directory to contain a particular changeset, Mercurial "
|
dongsheng@627
|
4484 "looks up the appropriate revision of the manifest to find out which files it "
|
dongsheng@627
|
4485 "was tracking at the time that changeset was committed, and which revision of "
|
dongsheng@627
|
4486 "each file was then current. It then recreates a copy of each of those files, "
|
dongsheng@627
|
4487 "with the same contents it had when the changeset was committed."
|
dongsheng@627
|
4488 msgstr ""
|
dongsheng@627
|
4489
|
dongsheng@627
|
4490 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
4491 #: ../en/ch04-concepts.xml:323
|
dongsheng@627
|
4492 msgid ""
|
dongsheng@627
|
4493 "The <emphasis>dirstate</emphasis> contains Mercurial's knowledge of the "
|
dongsheng@627
|
4494 "working directory. This details which changeset the working directory is "
|
dongsheng@627
|
4495 "updated to, and all of the files that Mercurial is tracking in the working "
|
dongsheng@627
|
4496 "directory."
|
dongsheng@627
|
4497 msgstr ""
|
dongsheng@627
|
4498
|
dongsheng@627
|
4499 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
4500 #: ../en/ch04-concepts.xml:329
|
dongsheng@627
|
4501 msgid ""
|
dongsheng@627
|
4502 "Just as a revision of a revlog has room for two parents, so that it can "
|
dongsheng@627
|
4503 "represent either a normal revision (with one parent) or a merge of two "
|
dongsheng@627
|
4504 "earlier revisions, the dirstate has slots for two parents. When you use the "
|
dongsheng@627
|
4505 "<command role=\"hg-cmd\">hg update</command> command, the changeset that you "
|
dongsheng@627
|
4506 "update to is stored in the <quote>first parent</quote> slot, and the null ID "
|
dongsheng@627
|
4507 "in the second. When you <command role=\"hg-cmd\">hg merge</command> with "
|
dongsheng@627
|
4508 "another changeset, the first parent remains unchanged, and the second parent "
|
dongsheng@627
|
4509 "is filled in with the changeset you're merging with. The <command role=\"hg-"
|
dongsheng@627
|
4510 "cmd\">hg parents</command> command tells you what the parents of the dirstate "
|
dongsheng@627
|
4511 "are."
|
dongsheng@627
|
4512 msgstr ""
|
dongsheng@627
|
4513
|
dongsheng@627
|
4514 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
4515 #: ../en/ch04-concepts.xml:343
|
dongsheng@627
|
4516 msgid "What happens when you commit"
|
dongsheng@627
|
4517 msgstr "当你提交时发生的事情"
|
dongsheng@627
|
4518
|
dongsheng@627
|
4519 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4520 #: ../en/ch04-concepts.xml:345
|
dongsheng@627
|
4521 msgid ""
|
dongsheng@627
|
4522 "The dirstate stores parent information for more than just book-keeping "
|
dongsheng@627
|
4523 "purposes. Mercurial uses the parents of the dirstate as <emphasis>the "
|
dongsheng@627
|
4524 "parents of a new changeset</emphasis> when you perform a commit."
|
dongsheng@627
|
4525 msgstr ""
|
dongsheng@627
|
4526
|
dongsheng@627
|
4527 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
|
dongsheng@641
|
4528 #: ../en/ch04-concepts.xml:352
|
dongsheng@627
|
4529 msgid "<imageobject><imagedata fileref=\"images/wdir.png\"/></imageobject>"
|
dongsheng@627
|
4530 msgstr ""
|
dongsheng@627
|
4531
|
dongsheng@627
|
4532 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
|
dongsheng@641
|
4533 #: ../en/ch04-concepts.xml:354
|
dongsheng@627
|
4534 msgid "The working directory can have two parents"
|
dongsheng@627
|
4535 msgstr ""
|
dongsheng@627
|
4536
|
dongsheng@627
|
4537 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4538 #: ../en/ch04-concepts.xml:359
|
dongsheng@641
|
4539 msgid ""
|
dongsheng@641
|
4540 "Figure <xref endterm=\"fig.concepts.wdir.caption\" linkend=\"fig.concepts.wdir"
|
dongsheng@641
|
4541 "\"/> shows the normal state of the working directory, where it has a single "
|
dongsheng@641
|
4542 "changeset as parent. That changeset is the <emphasis>tip</emphasis>, the "
|
dongsheng@641
|
4543 "newest changeset in the repository that has no children."
|
dongsheng@627
|
4544 msgstr ""
|
dongsheng@627
|
4545
|
dongsheng@627
|
4546 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
|
dongsheng@641
|
4547 #: ../en/ch04-concepts.xml:368
|
dongsheng@641
|
4548 msgid ""
|
dongsheng@641
|
4549 "<imageobject><imagedata fileref=\"images/wdir-after-commit.png\"/> </"
|
dongsheng@627
|
4550 "imageobject>"
|
dongsheng@627
|
4551 msgstr ""
|
dongsheng@627
|
4552
|
dongsheng@627
|
4553 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
|
dongsheng@641
|
4554 #: ../en/ch04-concepts.xml:371
|
dongsheng@627
|
4555 msgid "The working directory gains new parents after a commit"
|
dongsheng@627
|
4556 msgstr ""
|
dongsheng@627
|
4557
|
dongsheng@627
|
4558 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4559 #: ../en/ch04-concepts.xml:376
|
dongsheng@627
|
4560 msgid ""
|
dongsheng@627
|
4561 "It's useful to think of the working directory as <quote>the changeset I'm "
|
dongsheng@627
|
4562 "about to commit</quote>. Any files that you tell Mercurial that you've "
|
dongsheng@627
|
4563 "added, removed, renamed, or copied will be reflected in that changeset, as "
|
dongsheng@627
|
4564 "will modifications to any files that Mercurial is already tracking; the new "
|
dongsheng@627
|
4565 "changeset will have the parents of the working directory as its parents."
|
dongsheng@627
|
4566 msgstr ""
|
dongsheng@627
|
4567
|
dongsheng@627
|
4568 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4569 #: ../en/ch04-concepts.xml:384
|
dongsheng@627
|
4570 msgid ""
|
dongsheng@627
|
4571 "After a commit, Mercurial will update the parents of the working directory, "
|
dongsheng@627
|
4572 "so that the first parent is the ID of the new changeset, and the second is "
|
dongsheng@641
|
4573 "the null ID. This is shown in figure <xref endterm=\"fig.concepts.wdir-after-"
|
dongsheng@641
|
4574 "commit.caption\" linkend=\"fig.concepts.wdir-after-commit\"/>. Mercurial "
|
dongsheng@641
|
4575 "doesn't touch any of the files in the working directory when you commit; it "
|
dongsheng@641
|
4576 "just modifies the dirstate to note its new parents."
|
dongsheng@641
|
4577 msgstr ""
|
dongsheng@641
|
4578
|
dongsheng@641
|
4579 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
4580 #: ../en/ch04-concepts.xml:396
|
dongsheng@627
|
4581 msgid "Creating a new head"
|
dongsheng@627
|
4582 msgstr "创建新顶点"
|
dongsheng@627
|
4583
|
dongsheng@627
|
4584 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4585 #: ../en/ch04-concepts.xml:398
|
dongsheng@627
|
4586 msgid ""
|
dongsheng@627
|
4587 "It's perfectly normal to update the working directory to a changeset other "
|
dongsheng@627
|
4588 "than the current tip. For example, you might want to know what your project "
|
dongsheng@627
|
4589 "looked like last Tuesday, or you could be looking through changesets to see "
|
dongsheng@627
|
4590 "which one introduced a bug. In cases like this, the natural thing to do is "
|
dongsheng@627
|
4591 "update the working directory to the changeset you're interested in, and then "
|
dongsheng@627
|
4592 "examine the files in the working directory directly to see their contents as "
|
dongsheng@627
|
4593 "they were when you committed that changeset. The effect of this is shown in "
|
dongsheng@641
|
4594 "figure <xref endterm=\"fig.concepts.wdir-pre-branch.caption\" linkend=\"fig."
|
dongsheng@641
|
4595 "concepts.wdir-pre-branch\"/>."
|
dongsheng@627
|
4596 msgstr ""
|
dongsheng@627
|
4597
|
dongsheng@627
|
4598 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
|
dongsheng@641
|
4599 #: ../en/ch04-concepts.xml:412
|
dongsheng@641
|
4600 msgid ""
|
dongsheng@641
|
4601 "<imageobject><imagedata fileref=\"images/wdir-pre-branch.png\"/> </"
|
dongsheng@641
|
4602 "imageobject>"
|
dongsheng@627
|
4603 msgstr ""
|
dongsheng@627
|
4604
|
dongsheng@627
|
4605 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
|
dongsheng@641
|
4606 #: ../en/ch04-concepts.xml:415
|
dongsheng@627
|
4607 msgid "The working directory, updated to an older changeset"
|
dongsheng@627
|
4608 msgstr ""
|
dongsheng@627
|
4609
|
dongsheng@627
|
4610 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4611 #: ../en/ch04-concepts.xml:420
|
dongsheng@627
|
4612 msgid ""
|
dongsheng@627
|
4613 "Having updated the working directory to an older changeset, what happens if "
|
dongsheng@627
|
4614 "you make some changes, and then commit? Mercurial behaves in the same way as "
|
dongsheng@627
|
4615 "I outlined above. The parents of the working directory become the parents of "
|
dongsheng@627
|
4616 "the new changeset. This new changeset has no children, so it becomes the new "
|
dongsheng@627
|
4617 "tip. And the repository now contains two changesets that have no children; "
|
dongsheng@627
|
4618 "we call these <emphasis>heads</emphasis>. You can see the structure that "
|
dongsheng@641
|
4619 "this creates in figure <xref endterm=\"fig.concepts.wdir-branch.caption\" "
|
dongsheng@641
|
4620 "linkend=\"fig.concepts.wdir-branch\"/>."
|
dongsheng@627
|
4621 msgstr ""
|
dongsheng@627
|
4622
|
dongsheng@627
|
4623 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
|
dongsheng@641
|
4624 #: ../en/ch04-concepts.xml:434
|
dongsheng@641
|
4625 msgid ""
|
dongsheng@641
|
4626 "<imageobject><imagedata fileref=\"images/wdir-branch.png\"/> </imageobject>"
|
dongsheng@627
|
4627 msgstr ""
|
dongsheng@627
|
4628
|
dongsheng@627
|
4629 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
|
dongsheng@641
|
4630 #: ../en/ch04-concepts.xml:437
|
dongsheng@627
|
4631 msgid "After a commit made while synced to an older changeset"
|
dongsheng@627
|
4632 msgstr ""
|
dongsheng@627
|
4633
|
dongsheng@627
|
4634 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@641
|
4635 #: ../en/ch04-concepts.xml:443
|
dongsheng@627
|
4636 msgid ""
|
dongsheng@627
|
4637 "If you're new to Mercurial, you should keep in mind a common <quote>error</"
|
dongsheng@627
|
4638 "quote>, which is to use the <command role=\"hg-cmd\">hg pull</command> "
|
dongsheng@627
|
4639 "command without any options. By default, the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
4640 "pull</command> command <emphasis>does not</emphasis> update the working "
|
dongsheng@627
|
4641 "directory, so you'll bring new changesets into your repository, but the "
|
dongsheng@627
|
4642 "working directory will stay synced at the same changeset as before the pull. "
|
dongsheng@627
|
4643 "If you make some changes and commit afterwards, you'll thus create a new "
|
dongsheng@627
|
4644 "head, because your working directory isn't synced to whatever the current tip "
|
dongsheng@627
|
4645 "is."
|
dongsheng@627
|
4646 msgstr ""
|
dongsheng@627
|
4647
|
dongsheng@627
|
4648 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@641
|
4649 #: ../en/ch04-concepts.xml:455
|
dongsheng@627
|
4650 msgid ""
|
dongsheng@627
|
4651 "I put the word <quote>error</quote> in quotes because all that you need to do "
|
dongsheng@627
|
4652 "to rectify this situation is <command role=\"hg-cmd\">hg merge</command>, "
|
dongsheng@627
|
4653 "then <command role=\"hg-cmd\">hg commit</command>. In other words, this "
|
dongsheng@627
|
4654 "almost never has negative consequences; it just surprises people. I'll "
|
dongsheng@627
|
4655 "discuss other ways to avoid this behaviour, and why Mercurial behaves in this "
|
dongsheng@627
|
4656 "initially surprising way, later on."
|
dongsheng@627
|
4657 msgstr ""
|
dongsheng@627
|
4658
|
dongsheng@627
|
4659 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
4660 #: ../en/ch04-concepts.xml:467
|
dongsheng@627
|
4661 msgid "Merging heads"
|
dongsheng@627
|
4662 msgstr "合并顶点"
|
dongsheng@627
|
4663
|
dongsheng@627
|
4664 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4665 #: ../en/ch04-concepts.xml:469
|
dongsheng@627
|
4666 msgid ""
|
dongsheng@627
|
4667 "When you run the <command role=\"hg-cmd\">hg merge</command> command, "
|
dongsheng@627
|
4668 "Mercurial leaves the first parent of the working directory unchanged, and "
|
dongsheng@627
|
4669 "sets the second parent to the changeset you're merging with, as shown in "
|
dongsheng@641
|
4670 "figure <xref endterm=\"fig.concepts.wdir-merge.caption\" linkend=\"fig."
|
dongsheng@641
|
4671 "concepts.wdir-merge\"/>."
|
dongsheng@627
|
4672 msgstr ""
|
dongsheng@627
|
4673
|
dongsheng@627
|
4674 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
|
dongsheng@641
|
4675 #: ../en/ch04-concepts.xml:478
|
dongsheng@641
|
4676 msgid ""
|
dongsheng@641
|
4677 "<imageobject><imagedata fileref=\"images/wdir-merge.png\"/> </imageobject>"
|
dongsheng@627
|
4678 msgstr ""
|
dongsheng@627
|
4679
|
dongsheng@627
|
4680 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
|
dongsheng@641
|
4681 #: ../en/ch04-concepts.xml:481
|
dongsheng@627
|
4682 msgid "Merging two heads"
|
dongsheng@627
|
4683 msgstr ""
|
dongsheng@627
|
4684
|
dongsheng@627
|
4685 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4686 #: ../en/ch04-concepts.xml:486
|
dongsheng@627
|
4687 msgid ""
|
dongsheng@627
|
4688 "Mercurial also has to modify the working directory, to merge the files "
|
dongsheng@627
|
4689 "managed in the two changesets. Simplified a little, the merging process goes "
|
dongsheng@627
|
4690 "like this, for every file in the manifests of both changesets."
|
dongsheng@627
|
4691 msgstr ""
|
dongsheng@627
|
4692
|
dongsheng@627
|
4693 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
4694 #: ../en/ch04-concepts.xml:491
|
dongsheng@627
|
4695 msgid "If neither changeset has modified a file, do nothing with that file."
|
dongsheng@627
|
4696 msgstr ""
|
dongsheng@627
|
4697
|
dongsheng@627
|
4698 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
4699 #: ../en/ch04-concepts.xml:494
|
dongsheng@627
|
4700 msgid ""
|
dongsheng@627
|
4701 "If one changeset has modified a file, and the other hasn't, create the "
|
dongsheng@627
|
4702 "modified copy of the file in the working directory."
|
dongsheng@627
|
4703 msgstr ""
|
dongsheng@627
|
4704
|
dongsheng@627
|
4705 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
4706 #: ../en/ch04-concepts.xml:498
|
dongsheng@627
|
4707 msgid ""
|
dongsheng@627
|
4708 "If one changeset has removed a file, and the other hasn't (or has also "
|
dongsheng@627
|
4709 "deleted it), delete the file from the working directory."
|
dongsheng@627
|
4710 msgstr ""
|
dongsheng@627
|
4711
|
dongsheng@627
|
4712 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
4713 #: ../en/ch04-concepts.xml:502
|
dongsheng@627
|
4714 msgid ""
|
dongsheng@627
|
4715 "If one changeset has removed a file, but the other has modified the file, ask "
|
dongsheng@627
|
4716 "the user what to do: keep the modified file, or remove it?"
|
dongsheng@627
|
4717 msgstr ""
|
dongsheng@627
|
4718
|
dongsheng@627
|
4719 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
4720 #: ../en/ch04-concepts.xml:506
|
dongsheng@627
|
4721 msgid ""
|
dongsheng@627
|
4722 "If both changesets have modified a file, invoke an external merge program to "
|
dongsheng@627
|
4723 "choose the new contents for the merged file. This may require input from the "
|
dongsheng@627
|
4724 "user."
|
dongsheng@627
|
4725 msgstr ""
|
dongsheng@627
|
4726
|
dongsheng@627
|
4727 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
4728 #: ../en/ch04-concepts.xml:511
|
dongsheng@627
|
4729 msgid ""
|
dongsheng@627
|
4730 "If one changeset has modified a file, and the other has renamed or copied the "
|
dongsheng@627
|
4731 "file, make sure that the changes follow the new name of the file."
|
dongsheng@627
|
4732 msgstr ""
|
dongsheng@627
|
4733
|
dongsheng@627
|
4734 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4735 #: ../en/ch04-concepts.xml:515
|
dongsheng@627
|
4736 msgid ""
|
dongsheng@627
|
4737 "There are more details&emdash;merging has plenty of corner cases&emdash;but "
|
dongsheng@627
|
4738 "these are the most common choices that are involved in a merge. As you can "
|
dongsheng@627
|
4739 "see, most cases are completely automatic, and indeed most merges finish "
|
dongsheng@627
|
4740 "automatically, without requiring your input to resolve any conflicts."
|
dongsheng@627
|
4741 msgstr ""
|
dongsheng@627
|
4742
|
dongsheng@627
|
4743 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4744 #: ../en/ch04-concepts.xml:522
|
dongsheng@627
|
4745 msgid ""
|
dongsheng@627
|
4746 "When you're thinking about what happens when you commit after a merge, once "
|
dongsheng@627
|
4747 "again the working directory is <quote>the changeset I'm about to commit</"
|
dongsheng@627
|
4748 "quote>. After the <command role=\"hg-cmd\">hg merge</command> command "
|
dongsheng@627
|
4749 "completes, the working directory has two parents; these will become the "
|
dongsheng@627
|
4750 "parents of the new changeset."
|
dongsheng@627
|
4751 msgstr ""
|
dongsheng@627
|
4752
|
dongsheng@627
|
4753 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4754 #: ../en/ch04-concepts.xml:529
|
dongsheng@627
|
4755 msgid ""
|
dongsheng@627
|
4756 "Mercurial lets you perform multiple merges, but you must commit the results "
|
dongsheng@627
|
4757 "of each individual merge as you go. This is necessary because Mercurial only "
|
dongsheng@627
|
4758 "tracks two parents for both revisions and the working directory. While it "
|
dongsheng@627
|
4759 "would be technically possible to merge multiple changesets at once, the "
|
dongsheng@627
|
4760 "prospect of user confusion and making a terrible mess of a merge immediately "
|
dongsheng@627
|
4761 "becomes overwhelming."
|
dongsheng@627
|
4762 msgstr ""
|
dongsheng@627
|
4763
|
dongsheng@627
|
4764 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
4765 #: ../en/ch04-concepts.xml:540
|
dongsheng@627
|
4766 msgid "Other interesting design features"
|
dongsheng@627
|
4767 msgstr "其它有趣的设计特性"
|
dongsheng@627
|
4768
|
dongsheng@627
|
4769 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
4770 #: ../en/ch04-concepts.xml:542
|
dongsheng@627
|
4771 msgid ""
|
dongsheng@627
|
4772 "In the sections above, I've tried to highlight some of the most important "
|
dongsheng@627
|
4773 "aspects of Mercurial's design, to illustrate that it pays careful attention "
|
dongsheng@627
|
4774 "to reliability and performance. However, the attention to detail doesn't "
|
dongsheng@627
|
4775 "stop there. There are a number of other aspects of Mercurial's construction "
|
dongsheng@627
|
4776 "that I personally find interesting. I'll detail a few of them here, separate "
|
dongsheng@627
|
4777 "from the <quote>big ticket</quote> items above, so that if you're interested, "
|
dongsheng@627
|
4778 "you can gain a better idea of the amount of thinking that goes into a well-"
|
dongsheng@627
|
4779 "designed system."
|
dongsheng@627
|
4780 msgstr ""
|
dongsheng@627
|
4781
|
dongsheng@627
|
4782 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
4783 #: ../en/ch04-concepts.xml:553
|
dongsheng@627
|
4784 msgid "Clever compression"
|
dongsheng@627
|
4785 msgstr "智能压缩"
|
dongsheng@627
|
4786
|
dongsheng@627
|
4787 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4788 #: ../en/ch04-concepts.xml:555
|
dongsheng@627
|
4789 msgid ""
|
dongsheng@627
|
4790 "When appropriate, Mercurial will store both snapshots and deltas in "
|
dongsheng@627
|
4791 "compressed form. It does this by always <emphasis>trying to</emphasis> "
|
dongsheng@627
|
4792 "compress a snapshot or delta, but only storing the compressed version if it's "
|
dongsheng@627
|
4793 "smaller than the uncompressed version."
|
dongsheng@627
|
4794 msgstr ""
|
dongsheng@627
|
4795
|
dongsheng@627
|
4796 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4797 #: ../en/ch04-concepts.xml:561
|
dongsheng@627
|
4798 msgid ""
|
dongsheng@627
|
4799 "This means that Mercurial does <quote>the right thing</quote> when storing a "
|
dongsheng@627
|
4800 "file whose native form is compressed, such as a <literal>zip</literal> "
|
dongsheng@627
|
4801 "archive or a JPEG image. When these types of files are compressed a second "
|
dongsheng@627
|
4802 "time, the resulting file is usually bigger than the once-compressed form, and "
|
dongsheng@627
|
4803 "so Mercurial will store the plain <literal>zip</literal> or JPEG."
|
dongsheng@627
|
4804 msgstr ""
|
dongsheng@627
|
4805
|
dongsheng@627
|
4806 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4807 #: ../en/ch04-concepts.xml:569
|
dongsheng@627
|
4808 msgid ""
|
dongsheng@627
|
4809 "Deltas between revisions of a compressed file are usually larger than "
|
dongsheng@627
|
4810 "snapshots of the file, and Mercurial again does <quote>the right thing</"
|
dongsheng@627
|
4811 "quote> in these cases. It finds that such a delta exceeds the threshold at "
|
dongsheng@627
|
4812 "which it should store a complete snapshot of the file, so it stores the "
|
dongsheng@627
|
4813 "snapshot, again saving space compared to a naive delta-only approach."
|
dongsheng@627
|
4814 msgstr ""
|
dongsheng@627
|
4815
|
dongsheng@627
|
4816 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@641
|
4817 #: ../en/ch04-concepts.xml:578
|
dongsheng@627
|
4818 msgid "Network recompression"
|
dongsheng@627
|
4819 msgstr "网络重新压缩"
|
dongsheng@627
|
4820
|
dongsheng@627
|
4821 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
4822 #: ../en/ch04-concepts.xml:580
|
dongsheng@627
|
4823 msgid ""
|
dongsheng@627
|
4824 "When storing revisions on disk, Mercurial uses the <quote>deflate</quote> "
|
dongsheng@627
|
4825 "compression algorithm (the same one used by the popular <literal>zip</"
|
dongsheng@627
|
4826 "literal> archive format), which balances good speed with a respectable "
|
dongsheng@627
|
4827 "compression ratio. However, when transmitting revision data over a network "
|
dongsheng@627
|
4828 "connection, Mercurial uncompresses the compressed revision data."
|
dongsheng@627
|
4829 msgstr ""
|
dongsheng@627
|
4830
|
dongsheng@627
|
4831 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
4832 #: ../en/ch04-concepts.xml:588
|
dongsheng@627
|
4833 msgid ""
|
dongsheng@627
|
4834 "If the connection is over HTTP, Mercurial recompresses the entire stream of "
|
dongsheng@627
|
4835 "data using a compression algorithm that gives a better compression ratio (the "
|
dongsheng@627
|
4836 "Burrows-Wheeler algorithm from the widely used <literal>bzip2</literal> "
|
dongsheng@627
|
4837 "compression package). This combination of algorithm and compression of the "
|
dongsheng@627
|
4838 "entire stream (instead of a revision at a time) substantially reduces the "
|
dongsheng@627
|
4839 "number of bytes to be transferred, yielding better network performance over "
|
dongsheng@627
|
4840 "almost all kinds of network."
|
dongsheng@627
|
4841 msgstr ""
|
dongsheng@627
|
4842
|
dongsheng@627
|
4843 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
4844 #: ../en/ch04-concepts.xml:598
|
dongsheng@627
|
4845 msgid ""
|
dongsheng@627
|
4846 "(If the connection is over <command>ssh</command>, Mercurial "
|
dongsheng@627
|
4847 "<emphasis>doesn't</emphasis> recompress the stream, because <command>ssh</"
|
dongsheng@627
|
4848 "command> can already do this itself.)"
|
dongsheng@627
|
4849 msgstr ""
|
dongsheng@627
|
4850
|
dongsheng@627
|
4851 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
4852 #: ../en/ch04-concepts.xml:606
|
dongsheng@627
|
4853 msgid "Read/write ordering and atomicity"
|
dongsheng@627
|
4854 msgstr "读写顺序与原子性"
|
dongsheng@627
|
4855
|
dongsheng@627
|
4856 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4857 #: ../en/ch04-concepts.xml:608
|
dongsheng@627
|
4858 msgid ""
|
dongsheng@627
|
4859 "Appending to files isn't the whole story when it comes to guaranteeing that a "
|
dongsheng@641
|
4860 "reader won't see a partial write. If you recall figure <xref endterm=\"fig."
|
dongsheng@641
|
4861 "concepts.metadata.caption\" linkend=\"fig.concepts.metadata\"/>, revisions in "
|
dongsheng@641
|
4862 "the changelog point to revisions in the manifest, and revisions in the "
|
dongsheng@641
|
4863 "manifest point to revisions in filelogs. This hierarchy is deliberate."
|
dongsheng@641
|
4864 msgstr ""
|
dongsheng@641
|
4865
|
dongsheng@641
|
4866 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4867 #: ../en/ch04-concepts.xml:616
|
dongsheng@627
|
4868 msgid ""
|
dongsheng@627
|
4869 "A writer starts a transaction by writing filelog and manifest data, and "
|
dongsheng@627
|
4870 "doesn't write any changelog data until those are finished. A reader starts "
|
dongsheng@627
|
4871 "by reading changelog data, then manifest data, followed by filelog data."
|
dongsheng@627
|
4872 msgstr ""
|
dongsheng@627
|
4873
|
dongsheng@627
|
4874 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4875 #: ../en/ch04-concepts.xml:621
|
dongsheng@627
|
4876 msgid ""
|
dongsheng@627
|
4877 "Since the writer has always finished writing filelog and manifest data before "
|
dongsheng@627
|
4878 "it writes to the changelog, a reader will never read a pointer to a partially "
|
dongsheng@627
|
4879 "written manifest revision from the changelog, and it will never read a "
|
dongsheng@627
|
4880 "pointer to a partially written filelog revision from the manifest."
|
dongsheng@627
|
4881 msgstr ""
|
dongsheng@627
|
4882
|
dongsheng@627
|
4883 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
4884 #: ../en/ch04-concepts.xml:629
|
dongsheng@627
|
4885 msgid "Concurrent access"
|
dongsheng@627
|
4886 msgstr "并发访问"
|
dongsheng@627
|
4887
|
dongsheng@627
|
4888 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4889 #: ../en/ch04-concepts.xml:631
|
dongsheng@627
|
4890 msgid ""
|
dongsheng@627
|
4891 "The read/write ordering and atomicity guarantees mean that Mercurial never "
|
dongsheng@627
|
4892 "needs to <emphasis>lock</emphasis> a repository when it's reading data, even "
|
dongsheng@627
|
4893 "if the repository is being written to while the read is occurring. This has a "
|
dongsheng@627
|
4894 "big effect on scalability; you can have an arbitrary number of Mercurial "
|
dongsheng@627
|
4895 "processes safely reading data from a repository safely all at once, no matter "
|
dongsheng@627
|
4896 "whether it's being written to or not."
|
dongsheng@627
|
4897 msgstr ""
|
dongsheng@627
|
4898
|
dongsheng@627
|
4899 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4900 #: ../en/ch04-concepts.xml:640
|
dongsheng@627
|
4901 msgid ""
|
dongsheng@627
|
4902 "The lockless nature of reading means that if you're sharing a repository on a "
|
dongsheng@627
|
4903 "multi-user system, you don't need to grant other local users permission to "
|
dongsheng@627
|
4904 "<emphasis>write</emphasis> to your repository in order for them to be able to "
|
dongsheng@627
|
4905 "clone it or pull changes from it; they only need <emphasis>read</emphasis> "
|
dongsheng@627
|
4906 "permission. (This is <emphasis>not</emphasis> a common feature among "
|
dongsheng@627
|
4907 "revision control systems, so don't take it for granted! Most require readers "
|
dongsheng@627
|
4908 "to be able to lock a repository to access it safely, and this requires write "
|
dongsheng@627
|
4909 "permission on at least one directory, which of course makes for all kinds of "
|
dongsheng@627
|
4910 "nasty and annoying security and administrative problems.)"
|
dongsheng@627
|
4911 msgstr ""
|
dongsheng@627
|
4912
|
dongsheng@627
|
4913 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4914 #: ../en/ch04-concepts.xml:653
|
dongsheng@627
|
4915 msgid ""
|
dongsheng@627
|
4916 "Mercurial uses locks to ensure that only one process can write to a "
|
dongsheng@627
|
4917 "repository at a time (the locking mechanism is safe even over filesystems "
|
dongsheng@627
|
4918 "that are notoriously hostile to locking, such as NFS). If a repository is "
|
dongsheng@627
|
4919 "locked, a writer will wait for a while to retry if the repository becomes "
|
dongsheng@627
|
4920 "unlocked, but if the repository remains locked for too long, the process "
|
dongsheng@627
|
4921 "attempting to write will time out after a while. This means that your daily "
|
dongsheng@627
|
4922 "automated scripts won't get stuck forever and pile up if a system crashes "
|
dongsheng@627
|
4923 "unnoticed, for example. (Yes, the timeout is configurable, from zero to "
|
dongsheng@627
|
4924 "infinity.)"
|
dongsheng@627
|
4925 msgstr ""
|
dongsheng@627
|
4926
|
dongsheng@627
|
4927 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@641
|
4928 #: ../en/ch04-concepts.xml:665
|
dongsheng@627
|
4929 msgid "Safe dirstate access"
|
dongsheng@627
|
4930 msgstr "安全的目录状态访问"
|
dongsheng@627
|
4931
|
dongsheng@627
|
4932 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
4933 #: ../en/ch04-concepts.xml:667
|
dongsheng@627
|
4934 msgid ""
|
dongsheng@627
|
4935 "As with revision data, Mercurial doesn't take a lock to read the dirstate "
|
dongsheng@627
|
4936 "file; it does acquire a lock to write it. To avoid the possibility of "
|
dongsheng@627
|
4937 "reading a partially written copy of the dirstate file, Mercurial writes to a "
|
dongsheng@627
|
4938 "file with a unique name in the same directory as the dirstate file, then "
|
dongsheng@627
|
4939 "renames the temporary file atomically to <filename>dirstate</filename>. The "
|
dongsheng@627
|
4940 "file named <filename>dirstate</filename> is thus guaranteed to be complete, "
|
dongsheng@627
|
4941 "not partially written."
|
dongsheng@627
|
4942 msgstr ""
|
dongsheng@627
|
4943
|
dongsheng@627
|
4944 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
4945 #: ../en/ch04-concepts.xml:680
|
dongsheng@627
|
4946 msgid "Avoiding seeks"
|
dongsheng@627
|
4947 msgstr "避免查找"
|
dongsheng@627
|
4948
|
dongsheng@627
|
4949 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4950 #: ../en/ch04-concepts.xml:682
|
dongsheng@627
|
4951 msgid ""
|
dongsheng@627
|
4952 "Critical to Mercurial's performance is the avoidance of seeks of the disk "
|
dongsheng@627
|
4953 "head, since any seek is far more expensive than even a comparatively large "
|
dongsheng@627
|
4954 "read operation."
|
dongsheng@627
|
4955 msgstr ""
|
dongsheng@627
|
4956
|
dongsheng@627
|
4957 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4958 #: ../en/ch04-concepts.xml:686
|
dongsheng@627
|
4959 msgid ""
|
dongsheng@627
|
4960 "This is why, for example, the dirstate is stored in a single file. If there "
|
dongsheng@627
|
4961 "were a dirstate file per directory that Mercurial tracked, the disk would "
|
dongsheng@627
|
4962 "seek once per directory. Instead, Mercurial reads the entire single dirstate "
|
dongsheng@627
|
4963 "file in one step."
|
dongsheng@627
|
4964 msgstr ""
|
dongsheng@627
|
4965
|
dongsheng@627
|
4966 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4967 #: ../en/ch04-concepts.xml:692
|
dongsheng@627
|
4968 msgid ""
|
dongsheng@627
|
4969 "Mercurial also uses a <quote>copy on write</quote> scheme when cloning a "
|
dongsheng@627
|
4970 "repository on local storage. Instead of copying every revlog file from the "
|
dongsheng@627
|
4971 "old repository into the new repository, it makes a <quote>hard link</quote>, "
|
dongsheng@627
|
4972 "which is a shorthand way to say <quote>these two names point to the same "
|
dongsheng@627
|
4973 "file</quote>. When Mercurial is about to write to one of a revlog's files, "
|
dongsheng@627
|
4974 "it checks to see if the number of names pointing at the file is greater than "
|
dongsheng@627
|
4975 "one. If it is, more than one repository is using the file, so Mercurial "
|
dongsheng@627
|
4976 "makes a new copy of the file that is private to this repository."
|
dongsheng@627
|
4977 msgstr ""
|
dongsheng@627
|
4978
|
dongsheng@627
|
4979 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4980 #: ../en/ch04-concepts.xml:703
|
dongsheng@627
|
4981 msgid ""
|
dongsheng@627
|
4982 "A few revision control developers have pointed out that this idea of making a "
|
dongsheng@627
|
4983 "complete private copy of a file is not very efficient in its use of storage. "
|
dongsheng@627
|
4984 "While this is true, storage is cheap, and this method gives the highest "
|
dongsheng@627
|
4985 "performance while deferring most book-keeping to the operating system. An "
|
dongsheng@627
|
4986 "alternative scheme would most likely reduce performance and increase the "
|
dongsheng@627
|
4987 "complexity of the software, each of which is much more important to the "
|
dongsheng@627
|
4988 "<quote>feel</quote> of day-to-day use."
|
dongsheng@627
|
4989 msgstr ""
|
dongsheng@627
|
4990
|
dongsheng@627
|
4991 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
4992 #: ../en/ch04-concepts.xml:715
|
dongsheng@627
|
4993 msgid "Other contents of the dirstate"
|
dongsheng@627
|
4994 msgstr "目录状态的其它内容"
|
dongsheng@627
|
4995
|
dongsheng@627
|
4996 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
4997 #: ../en/ch04-concepts.xml:717
|
dongsheng@627
|
4998 msgid ""
|
dongsheng@627
|
4999 "Because Mercurial doesn't force you to tell it when you're modifying a file, "
|
dongsheng@627
|
5000 "it uses the dirstate to store some extra information so it can determine "
|
dongsheng@627
|
5001 "efficiently whether you have modified a file. For each file in the working "
|
dongsheng@627
|
5002 "directory, it stores the time that it last modified the file itself, and the "
|
dongsheng@627
|
5003 "size of the file at that time."
|
dongsheng@627
|
5004 msgstr ""
|
dongsheng@627
|
5005
|
dongsheng@627
|
5006 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
5007 #: ../en/ch04-concepts.xml:724
|
dongsheng@627
|
5008 msgid ""
|
dongsheng@627
|
5009 "When you explicitly <command role=\"hg-cmd\">hg add</command>, <command role="
|
dongsheng@627
|
5010 "\"hg-cmd\">hg remove</command>, <command role=\"hg-cmd\">hg rename</command> "
|
dongsheng@627
|
5011 "or <command role=\"hg-cmd\">hg copy</command> files, Mercurial updates the "
|
dongsheng@627
|
5012 "dirstate so that it knows what to do with those files when you commit."
|
dongsheng@627
|
5013 msgstr ""
|
dongsheng@627
|
5014
|
dongsheng@627
|
5015 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
5016 #: ../en/ch04-concepts.xml:731
|
dongsheng@627
|
5017 msgid ""
|
dongsheng@627
|
5018 "When Mercurial is checking the states of files in the working directory, it "
|
dongsheng@627
|
5019 "first checks a file's modification time. If that has not changed, the file "
|
dongsheng@627
|
5020 "must not have been modified. If the file's size has changed, the file must "
|
dongsheng@627
|
5021 "have been modified. If the modification time has changed, but the size has "
|
dongsheng@627
|
5022 "not, only then does Mercurial need to read the actual contents of the file to "
|
dongsheng@627
|
5023 "see if they've changed. Storing these few extra pieces of information "
|
dongsheng@627
|
5024 "dramatically reduces the amount of data that Mercurial needs to read, which "
|
dongsheng@627
|
5025 "yields large performance improvements compared to other revision control "
|
dongsheng@627
|
5026 "systems."
|
dongsheng@627
|
5027 msgstr ""
|
dongsheng@627
|
5028
|
dongsheng@627
|
5029 #. type: Content of: <book><chapter><title>
|
dongsheng@627
|
5030 #: ../en/ch05-daily.xml:5
|
dongsheng@627
|
5031 msgid "Mercurial in daily use"
|
dongsheng@627
|
5032 msgstr "Mercurial 的日常使用"
|
dongsheng@627
|
5033
|
dongsheng@627
|
5034 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
5035 #: ../en/ch05-daily.xml:8
|
dongsheng@627
|
5036 msgid "Telling Mercurial which files to track"
|
dongsheng@627
|
5037 msgstr "告诉 Mercurial 要跟踪哪些文件"
|
dongsheng@627
|
5038
|
dongsheng@627
|
5039 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5040 #: ../en/ch05-daily.xml:10
|
dongsheng@627
|
5041 msgid ""
|
dongsheng@627
|
5042 "Mercurial does not work with files in your repository unless you tell it to "
|
dongsheng@627
|
5043 "manage them. The <command role=\"hg-cmd\">hg status</command> command will "
|
dongsheng@627
|
5044 "tell you which files Mercurial doesn't know about; it uses a <quote><literal>?"
|
dongsheng@627
|
5045 "</literal></quote> to display such files."
|
dongsheng@627
|
5046 msgstr ""
|
dongsheng@627
|
5047
|
dongsheng@627
|
5048 #
|
dongsheng@627
|
5049 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5050 #: ../en/ch05-daily.xml:17
|
dongsheng@627
|
5051 msgid ""
|
dongsheng@627
|
5052 "To tell Mercurial to track a file, use the <command role=\"hg-cmd\">hg add</"
|
dongsheng@627
|
5053 "command> command. Once you have added a file, the entry in the output of "
|
dongsheng@627
|
5054 "<command role=\"hg-cmd\">hg status</command> for that file changes from "
|
dongsheng@627
|
5055 "<quote><literal>?</literal></quote> to <quote><literal>A</literal></quote>."
|
dongsheng@627
|
5056 msgstr ""
|
dongsheng@627
|
5057
|
dongsheng@627
|
5058 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5059 #: ../en/ch05-daily.xml:26
|
dongsheng@627
|
5060 msgid ""
|
dongsheng@627
|
5061 "After you run a <command role=\"hg-cmd\">hg commit</command>, the files that "
|
dongsheng@627
|
5062 "you added before the commit will no longer be listed in the output of "
|
dongsheng@627
|
5063 "<command role=\"hg-cmd\">hg status</command>. The reason for this is that "
|
dongsheng@627
|
5064 "<command role=\"hg-cmd\">hg status</command> only tells you about "
|
dongsheng@627
|
5065 "<quote>interesting</quote> files&emdash;those that you have modified or told "
|
dongsheng@627
|
5066 "Mercurial to do something with&emdash;by default. If you have a repository "
|
dongsheng@627
|
5067 "that contains thousands of files, you will rarely want to know about files "
|
dongsheng@627
|
5068 "that Mercurial is tracking, but that have not changed. (You can still get "
|
dongsheng@627
|
5069 "this information; we'll return to this later.)"
|
dongsheng@627
|
5070 msgstr ""
|
dongsheng@627
|
5071
|
dongsheng@627
|
5072 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5073 #: ../en/ch05-daily.xml:38
|
dongsheng@627
|
5074 msgid ""
|
dongsheng@627
|
5075 "Once you add a file, Mercurial doesn't do anything with it immediately. "
|
dongsheng@627
|
5076 "Instead, it will take a snapshot of the file's state the next time you "
|
dongsheng@627
|
5077 "perform a commit. It will then continue to track the changes you make to the "
|
dongsheng@627
|
5078 "file every time you commit, until you remove the file."
|
dongsheng@627
|
5079 msgstr ""
|
dongsheng@627
|
5080
|
dongsheng@627
|
5081 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
5082 #: ../en/ch05-daily.xml:45
|
dongsheng@627
|
5083 msgid "Explicit versus implicit file naming"
|
dongsheng@627
|
5084 msgstr "明确与隐含文件命名"
|
dongsheng@627
|
5085
|
dongsheng@627
|
5086 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5087 #: ../en/ch05-daily.xml:47
|
dongsheng@627
|
5088 msgid ""
|
dongsheng@627
|
5089 "A useful behaviour that Mercurial has is that if you pass the name of a "
|
dongsheng@627
|
5090 "directory to a command, every Mercurial command will treat this as <quote>I "
|
dongsheng@627
|
5091 "want to operate on every file in this directory and its subdirectories</"
|
dongsheng@627
|
5092 "quote>."
|
dongsheng@627
|
5093 msgstr ""
|
dongsheng@627
|
5094
|
dongsheng@627
|
5095 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5096 #: ../en/ch05-daily.xml:54
|
dongsheng@627
|
5097 msgid ""
|
dongsheng@627
|
5098 "Notice in this example that Mercurial printed the names of the files it "
|
dongsheng@627
|
5099 "added, whereas it didn't do so when we added the file named <filename>a</"
|
dongsheng@627
|
5100 "filename> in the earlier example."
|
dongsheng@627
|
5101 msgstr ""
|
dongsheng@627
|
5102
|
dongsheng@627
|
5103 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5104 #: ../en/ch05-daily.xml:59
|
dongsheng@627
|
5105 msgid ""
|
dongsheng@627
|
5106 "What's going on is that in the former case, we explicitly named the file to "
|
dongsheng@627
|
5107 "add on the command line, so the assumption that Mercurial makes in such cases "
|
dongsheng@627
|
5108 "is that you know what you were doing, and it doesn't print any output."
|
dongsheng@627
|
5109 msgstr ""
|
dongsheng@627
|
5110
|
dongsheng@627
|
5111 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5112 #: ../en/ch05-daily.xml:64
|
dongsheng@627
|
5113 msgid ""
|
dongsheng@627
|
5114 "However, when we <emphasis>imply</emphasis> the names of files by giving the "
|
dongsheng@627
|
5115 "name of a directory, Mercurial takes the extra step of printing the name of "
|
dongsheng@627
|
5116 "each file that it does something with. This makes it more clear what is "
|
dongsheng@627
|
5117 "happening, and reduces the likelihood of a silent and nasty surprise. This "
|
dongsheng@627
|
5118 "behaviour is common to most Mercurial commands."
|
dongsheng@627
|
5119 msgstr ""
|
dongsheng@627
|
5120
|
dongsheng@627
|
5121 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
5122 #: ../en/ch05-daily.xml:73
|
dongsheng@627
|
5123 msgid "Aside: Mercurial tracks files, not directories"
|
dongsheng@627
|
5124 msgstr "旁白: Mercurial 只跟踪文件,不跟踪目录"
|
dongsheng@627
|
5125
|
dongsheng@627
|
5126 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5127 #: ../en/ch05-daily.xml:75
|
dongsheng@627
|
5128 msgid ""
|
dongsheng@627
|
5129 "Mercurial does not track directory information. Instead, it tracks the path "
|
dongsheng@627
|
5130 "to a file. Before creating a file, it first creates any missing directory "
|
dongsheng@627
|
5131 "components of the path. After it deletes a file, it then deletes any empty "
|
dongsheng@627
|
5132 "directories that were in the deleted file's path. This sounds like a trivial "
|
dongsheng@627
|
5133 "distinction, but it has one minor practical consequence: it is not possible "
|
dongsheng@627
|
5134 "to represent a completely empty directory in Mercurial."
|
dongsheng@627
|
5135 msgstr ""
|
dongsheng@627
|
5136
|
dongsheng@627
|
5137 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5138 #: ../en/ch05-daily.xml:84
|
dongsheng@627
|
5139 msgid ""
|
dongsheng@627
|
5140 "Empty directories are rarely useful, and there are unintrusive workarounds "
|
dongsheng@627
|
5141 "that you can use to achieve an appropriate effect. The developers of "
|
dongsheng@627
|
5142 "Mercurial thus felt that the complexity that would be required to manage "
|
dongsheng@627
|
5143 "empty directories was not worth the limited benefit this feature would bring."
|
dongsheng@627
|
5144 msgstr ""
|
dongsheng@627
|
5145
|
dongsheng@627
|
5146 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5147 #: ../en/ch05-daily.xml:91
|
dongsheng@627
|
5148 msgid ""
|
dongsheng@627
|
5149 "If you need an empty directory in your repository, there are a few ways to "
|
dongsheng@627
|
5150 "achieve this. One is to create a directory, then <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
5151 "add</command> a <quote>hidden</quote> file to that directory. On Unix-like "
|
dongsheng@627
|
5152 "systems, any file name that begins with a period (<quote><literal>.</"
|
dongsheng@627
|
5153 "literal></quote>) is treated as hidden by most commands and GUI tools. This "
|
dongsheng@627
|
5154 "approach is illustrated below."
|
dongsheng@627
|
5155 msgstr ""
|
dongsheng@627
|
5156
|
dongsheng@627
|
5157 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5158 #: ../en/ch05-daily.xml:102
|
dongsheng@627
|
5159 msgid ""
|
dongsheng@627
|
5160 "Another way to tackle a need for an empty directory is to simply create one "
|
dongsheng@627
|
5161 "in your automated build scripts before they will need it."
|
dongsheng@627
|
5162 msgstr ""
|
dongsheng@627
|
5163
|
dongsheng@627
|
5164 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
5165 #: ../en/ch05-daily.xml:109
|
dongsheng@627
|
5166 msgid "How to stop tracking a file"
|
dongsheng@627
|
5167 msgstr "如何停止跟踪文件"
|
dongsheng@627
|
5168
|
dongsheng@627
|
5169 #
|
dongsheng@627
|
5170 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5171 #: ../en/ch05-daily.xml:111
|
dongsheng@627
|
5172 msgid ""
|
dongsheng@627
|
5173 "Once you decide that a file no longer belongs in your repository, use the "
|
dongsheng@627
|
5174 "<command role=\"hg-cmd\">hg remove</command> command; this deletes the file, "
|
dongsheng@627
|
5175 "and tells Mercurial to stop tracking it. A removed file is represented in "
|
dongsheng@627
|
5176 "the output of <command role=\"hg-cmd\">hg status</command> with a "
|
dongsheng@627
|
5177 "<quote><literal>R</literal></quote>."
|
dongsheng@627
|
5178 msgstr ""
|
dongsheng@627
|
5179
|
dongsheng@627
|
5180 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5181 #: ../en/ch05-daily.xml:120
|
dongsheng@627
|
5182 msgid ""
|
dongsheng@627
|
5183 "After you <command role=\"hg-cmd\">hg remove</command> a file, Mercurial will "
|
dongsheng@627
|
5184 "no longer track changes to that file, even if you recreate a file with the "
|
dongsheng@627
|
5185 "same name in your working directory. If you do recreate a file with the same "
|
dongsheng@627
|
5186 "name and want Mercurial to track the new file, simply <command role=\"hg-cmd"
|
dongsheng@627
|
5187 "\">hg add</command> it. Mercurial will know that the newly added file is not "
|
dongsheng@627
|
5188 "related to the old file of the same name."
|
dongsheng@627
|
5189 msgstr ""
|
dongsheng@627
|
5190
|
dongsheng@627
|
5191 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
5192 #: ../en/ch05-daily.xml:129
|
dongsheng@627
|
5193 msgid "Removing a file does not affect its history"
|
dongsheng@627
|
5194 msgstr "删除文件不影响历史"
|
dongsheng@627
|
5195
|
dongsheng@627
|
5196 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5197 #: ../en/ch05-daily.xml:131
|
dongsheng@627
|
5198 msgid "It is important to understand that removing a file has only two effects."
|
dongsheng@627
|
5199 msgstr ""
|
dongsheng@627
|
5200
|
dongsheng@627
|
5201 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
5202 #: ../en/ch05-daily.xml:134
|
dongsheng@627
|
5203 msgid "It removes the current version of the file from the working directory."
|
dongsheng@627
|
5204 msgstr ""
|
dongsheng@627
|
5205
|
dongsheng@627
|
5206 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
5207 #: ../en/ch05-daily.xml:137
|
dongsheng@627
|
5208 msgid ""
|
dongsheng@627
|
5209 "It stops Mercurial from tracking changes to the file, from the time of the "
|
dongsheng@627
|
5210 "next commit."
|
dongsheng@627
|
5211 msgstr ""
|
dongsheng@627
|
5212
|
dongsheng@627
|
5213 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5214 #: ../en/ch05-daily.xml:140
|
dongsheng@627
|
5215 msgid ""
|
dongsheng@627
|
5216 "Removing a file <emphasis>does not</emphasis> in any way alter the "
|
dongsheng@627
|
5217 "<emphasis>history</emphasis> of the file."
|
dongsheng@627
|
5218 msgstr ""
|
dongsheng@627
|
5219
|
dongsheng@627
|
5220 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5221 #: ../en/ch05-daily.xml:143
|
dongsheng@627
|
5222 msgid ""
|
dongsheng@627
|
5223 "If you update the working directory to a changeset in which a file that you "
|
dongsheng@627
|
5224 "have removed was still tracked, it will reappear in the working directory, "
|
dongsheng@627
|
5225 "with the contents it had when you committed that changeset. If you then "
|
dongsheng@627
|
5226 "update the working directory to a later changeset, in which the file had been "
|
dongsheng@627
|
5227 "removed, Mercurial will once again remove the file from the working directory."
|
dongsheng@627
|
5228 msgstr ""
|
dongsheng@627
|
5229
|
dongsheng@627
|
5230 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
5231 #: ../en/ch05-daily.xml:153
|
dongsheng@627
|
5232 msgid "Missing files"
|
dongsheng@627
|
5233 msgstr "丢失的文件"
|
dongsheng@627
|
5234
|
dongsheng@627
|
5235 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5236 #: ../en/ch05-daily.xml:155
|
dongsheng@627
|
5237 msgid ""
|
dongsheng@627
|
5238 "Mercurial considers a file that you have deleted, but not used <command role="
|
dongsheng@627
|
5239 "\"hg-cmd\">hg remove</command> to delete, to be <emphasis>missing</"
|
dongsheng@627
|
5240 "emphasis>. A missing file is represented with <quote><literal>!</literal></"
|
dongsheng@627
|
5241 "quote> in the output of <command role=\"hg-cmd\">hg status</command>. "
|
dongsheng@627
|
5242 "Mercurial commands will not generally do anything with missing files."
|
dongsheng@627
|
5243 msgstr ""
|
dongsheng@627
|
5244
|
dongsheng@627
|
5245 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5246 #: ../en/ch05-daily.xml:165
|
dongsheng@627
|
5247 msgid ""
|
dongsheng@627
|
5248 "If your repository contains a file that <command role=\"hg-cmd\">hg status</"
|
dongsheng@627
|
5249 "command> reports as missing, and you want the file to stay gone, you can run "
|
dongsheng@627
|
5250 "<command role=\"hg-cmd\">hg remove <option role=\"hg-opt-remove\">--after</"
|
dongsheng@627
|
5251 "option></command> at any time later on, to tell Mercurial that you really did "
|
dongsheng@627
|
5252 "mean to remove the file."
|
dongsheng@627
|
5253 msgstr ""
|
dongsheng@627
|
5254
|
dongsheng@627
|
5255 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5256 #: ../en/ch05-daily.xml:175
|
dongsheng@627
|
5257 msgid ""
|
dongsheng@627
|
5258 "On the other hand, if you deleted the missing file by accident, give <command "
|
dongsheng@627
|
5259 "role=\"hg-cmd\">hg revert</command> the name of the file to recover. It will "
|
dongsheng@627
|
5260 "reappear, in unmodified form."
|
dongsheng@627
|
5261 msgstr ""
|
dongsheng@627
|
5262
|
dongsheng@627
|
5263 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
5264 #: ../en/ch05-daily.xml:184
|
dongsheng@627
|
5265 msgid "Aside: why tell Mercurial explicitly to remove a file?"
|
dongsheng@627
|
5266 msgstr "旁白: 为什么要明确告诉 Mercurial 删除文件?"
|
dongsheng@627
|
5267
|
dongsheng@627
|
5268 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5269 #: ../en/ch05-daily.xml:187
|
dongsheng@627
|
5270 msgid ""
|
dongsheng@627
|
5271 "You might wonder why Mercurial requires you to explicitly tell it that you "
|
dongsheng@627
|
5272 "are deleting a file. Early during the development of Mercurial, it let you "
|
dongsheng@627
|
5273 "delete a file however you pleased; Mercurial would notice the absence of the "
|
dongsheng@627
|
5274 "file automatically when you next ran a <command role=\"hg-cmd\">hg commit</"
|
dongsheng@627
|
5275 "command>, and stop tracking the file. In practice, this made it too easy to "
|
dongsheng@627
|
5276 "accidentally remove a file without noticing."
|
dongsheng@627
|
5277 msgstr ""
|
dongsheng@627
|
5278
|
dongsheng@627
|
5279 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
5280 #: ../en/ch05-daily.xml:198
|
dongsheng@627
|
5281 msgid "Useful shorthand&emdash;adding and removing files in one step"
|
dongsheng@627
|
5282 msgstr "有用的速记&emdash;一个步骤添加和删除文件"
|
dongsheng@627
|
5283
|
dongsheng@627
|
5284 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5285 #: ../en/ch05-daily.xml:201
|
dongsheng@627
|
5286 msgid ""
|
dongsheng@627
|
5287 "Mercurial offers a combination command, <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
5288 "addremove</command>, that adds untracked files and marks missing files as "
|
dongsheng@627
|
5289 "removed."
|
dongsheng@627
|
5290 msgstr ""
|
dongsheng@627
|
5291
|
dongsheng@627
|
5292 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5293 #: ../en/ch05-daily.xml:207
|
dongsheng@627
|
5294 msgid ""
|
dongsheng@627
|
5295 "The <command role=\"hg-cmd\">hg commit</command> command also provides a "
|
dongsheng@627
|
5296 "<option role=\"hg-opt-commit\">-A</option> option that performs this same add-"
|
dongsheng@627
|
5297 "and-remove, immediately followed by a commit."
|
dongsheng@627
|
5298 msgstr ""
|
dongsheng@627
|
5299
|
dongsheng@627
|
5300 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
5301 #: ../en/ch05-daily.xml:217
|
dongsheng@627
|
5302 msgid "Copying files"
|
dongsheng@627
|
5303 msgstr "复制文件"
|
dongsheng@627
|
5304
|
dongsheng@627
|
5305 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5306 #: ../en/ch05-daily.xml:219
|
dongsheng@627
|
5307 msgid ""
|
dongsheng@627
|
5308 "Mercurial provides a <command role=\"hg-cmd\">hg copy</command> command that "
|
dongsheng@627
|
5309 "lets you make a new copy of a file. When you copy a file using this command, "
|
dongsheng@627
|
5310 "Mercurial makes a record of the fact that the new file is a copy of the "
|
dongsheng@627
|
5311 "original file. It treats these copied files specially when you merge your "
|
dongsheng@627
|
5312 "work with someone else's."
|
dongsheng@627
|
5313 msgstr ""
|
dongsheng@627
|
5314
|
dongsheng@627
|
5315 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
5316 #: ../en/ch05-daily.xml:227
|
dongsheng@627
|
5317 msgid "The results of copying during a merge"
|
dongsheng@627
|
5318 msgstr "合并期间的复制结果"
|
dongsheng@627
|
5319
|
dongsheng@627
|
5320 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5321 #: ../en/ch05-daily.xml:229
|
dongsheng@627
|
5322 msgid ""
|
dongsheng@627
|
5323 "What happens during a merge is that changes <quote>follow</quote> a copy. To "
|
dongsheng@627
|
5324 "best illustrate what this means, let's create an example. We'll start with "
|
dongsheng@627
|
5325 "the usual tiny repository that contains a single file."
|
dongsheng@627
|
5326 msgstr ""
|
dongsheng@627
|
5327
|
dongsheng@627
|
5328 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5329 #: ../en/ch05-daily.xml:236
|
dongsheng@627
|
5330 msgid ""
|
dongsheng@627
|
5331 "We need to do some work in parallel, so that we'll have something to merge. "
|
dongsheng@627
|
5332 "So let's clone our repository."
|
dongsheng@627
|
5333 msgstr ""
|
dongsheng@627
|
5334
|
dongsheng@627
|
5335 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5336 #: ../en/ch05-daily.xml:242
|
dongsheng@627
|
5337 msgid ""
|
dongsheng@627
|
5338 "Back in our initial repository, let's use the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
5339 "copy</command> command to make a copy of the first file we created."
|
dongsheng@627
|
5340 msgstr ""
|
dongsheng@627
|
5341
|
dongsheng@627
|
5342 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5343 #: ../en/ch05-daily.xml:248
|
dongsheng@627
|
5344 msgid ""
|
dongsheng@627
|
5345 "If we look at the output of the <command role=\"hg-cmd\">hg status</command> "
|
dongsheng@627
|
5346 "command afterwards, the copied file looks just like a normal added file."
|
dongsheng@627
|
5347 msgstr ""
|
dongsheng@627
|
5348
|
dongsheng@627
|
5349 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5350 #: ../en/ch05-daily.xml:254
|
dongsheng@627
|
5351 msgid ""
|
dongsheng@627
|
5352 "But if we pass the <option role=\"hg-opt-status\">-C</option> option to "
|
dongsheng@627
|
5353 "<command role=\"hg-cmd\">hg status</command>, it prints another line of "
|
dongsheng@627
|
5354 "output: this is the file that our newly-added file was copied <emphasis>from</"
|
dongsheng@627
|
5355 "emphasis>."
|
dongsheng@627
|
5356 msgstr ""
|
dongsheng@627
|
5357
|
dongsheng@627
|
5358 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5359 #: ../en/ch05-daily.xml:262
|
dongsheng@627
|
5360 msgid ""
|
dongsheng@627
|
5361 "Now, back in the repository we cloned, let's make a change in parallel. "
|
dongsheng@627
|
5362 "We'll add a line of content to the original file that we created."
|
dongsheng@627
|
5363 msgstr ""
|
dongsheng@627
|
5364
|
dongsheng@627
|
5365 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5366 #: ../en/ch05-daily.xml:268
|
dongsheng@627
|
5367 msgid ""
|
dongsheng@627
|
5368 "Now we have a modified <filename>file</filename> in this repository. When we "
|
dongsheng@627
|
5369 "pull the changes from the first repository, and merge the two heads, "
|
dongsheng@627
|
5370 "Mercurial will propagate the changes that we made locally to <filename>file</"
|
dongsheng@627
|
5371 "filename> into its copy, <filename>new-file</filename>."
|
dongsheng@627
|
5372 msgstr ""
|
dongsheng@627
|
5373
|
dongsheng@627
|
5374 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
5375 #: ../en/ch05-daily.xml:278
|
dongsheng@627
|
5376 msgid "Why should changes follow copies?"
|
dongsheng@627
|
5377 msgstr "为什么复制后需要后续修改?"
|
dongsheng@627
|
5378
|
dongsheng@627
|
5379 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5380 #: ../en/ch05-daily.xml:280
|
dongsheng@627
|
5381 msgid ""
|
dongsheng@627
|
5382 "This behaviour, of changes to a file propagating out to copies of the file, "
|
dongsheng@627
|
5383 "might seem esoteric, but in most cases it's highly desirable."
|
dongsheng@627
|
5384 msgstr ""
|
dongsheng@627
|
5385
|
dongsheng@627
|
5386 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5387 #: ../en/ch05-daily.xml:284
|
dongsheng@627
|
5388 msgid ""
|
dongsheng@627
|
5389 "First of all, remember that this propagation <emphasis>only</emphasis> "
|
dongsheng@627
|
5390 "happens when you merge. So if you <command role=\"hg-cmd\">hg copy</command> "
|
dongsheng@627
|
5391 "a file, and subsequently modify the original file during the normal course of "
|
dongsheng@627
|
5392 "your work, nothing will happen."
|
dongsheng@627
|
5393 msgstr ""
|
dongsheng@627
|
5394
|
dongsheng@627
|
5395 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5396 #: ../en/ch05-daily.xml:290
|
dongsheng@627
|
5397 msgid ""
|
dongsheng@627
|
5398 "The second thing to know is that modifications will only propagate across a "
|
dongsheng@627
|
5399 "copy as long as the repository that you're pulling changes from "
|
dongsheng@627
|
5400 "<emphasis>doesn't know</emphasis> about the copy."
|
dongsheng@627
|
5401 msgstr ""
|
dongsheng@627
|
5402
|
dongsheng@627
|
5403 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5404 #: ../en/ch05-daily.xml:295
|
dongsheng@627
|
5405 msgid ""
|
dongsheng@627
|
5406 "The reason that Mercurial does this is as follows. Let's say I make an "
|
dongsheng@627
|
5407 "important bug fix in a source file, and commit my changes. Meanwhile, you've "
|
dongsheng@627
|
5408 "decided to <command role=\"hg-cmd\">hg copy</command> the file in your "
|
dongsheng@627
|
5409 "repository, without knowing about the bug or having seen the fix, and you "
|
dongsheng@627
|
5410 "have started hacking on your copy of the file."
|
dongsheng@627
|
5411 msgstr ""
|
dongsheng@627
|
5412
|
dongsheng@627
|
5413 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5414 #: ../en/ch05-daily.xml:302
|
dongsheng@627
|
5415 msgid ""
|
dongsheng@627
|
5416 "If you pulled and merged my changes, and Mercurial <emphasis>didn't</"
|
dongsheng@627
|
5417 "emphasis> propagate changes across copies, your source file would now contain "
|
dongsheng@627
|
5418 "the bug, and unless you remembered to propagate the bug fix by hand, the bug "
|
dongsheng@627
|
5419 "would <emphasis>remain</emphasis> in your copy of the file."
|
dongsheng@627
|
5420 msgstr ""
|
dongsheng@627
|
5421
|
dongsheng@627
|
5422 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5423 #: ../en/ch05-daily.xml:308
|
dongsheng@627
|
5424 msgid ""
|
dongsheng@627
|
5425 "By automatically propagating the change that fixed the bug from the original "
|
dongsheng@627
|
5426 "file to the copy, Mercurial prevents this class of problem. To my knowledge, "
|
dongsheng@627
|
5427 "Mercurial is the <emphasis>only</emphasis> revision control system that "
|
dongsheng@627
|
5428 "propagates changes across copies like this."
|
dongsheng@627
|
5429 msgstr ""
|
dongsheng@627
|
5430
|
dongsheng@627
|
5431 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5432 #: ../en/ch05-daily.xml:314
|
dongsheng@627
|
5433 msgid ""
|
dongsheng@627
|
5434 "Once your change history has a record that the copy and subsequent merge "
|
dongsheng@627
|
5435 "occurred, there's usually no further need to propagate changes from the "
|
dongsheng@627
|
5436 "original file to the copied file, and that's why Mercurial only propagates "
|
dongsheng@627
|
5437 "changes across copies until this point, and no further."
|
dongsheng@627
|
5438 msgstr ""
|
dongsheng@627
|
5439
|
dongsheng@627
|
5440 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
5441 #: ../en/ch05-daily.xml:322
|
dongsheng@627
|
5442 msgid "How to make changes <emphasis>not</emphasis> follow a copy"
|
dongsheng@627
|
5443 msgstr "如何让复制后<emphasis>不</emphasis>修改?"
|
dongsheng@627
|
5444
|
dongsheng@627
|
5445 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5446 #: ../en/ch05-daily.xml:325
|
dongsheng@627
|
5447 msgid ""
|
dongsheng@627
|
5448 "If, for some reason, you decide that this business of automatically "
|
dongsheng@627
|
5449 "propagating changes across copies is not for you, simply use your system's "
|
dongsheng@627
|
5450 "normal file copy command (on Unix-like systems, that's <command>cp</command>) "
|
dongsheng@627
|
5451 "to make a copy of a file, then <command role=\"hg-cmd\">hg add</command> the "
|
dongsheng@627
|
5452 "new copy by hand. Before you do so, though, please do reread section <xref "
|
dongsheng@627
|
5453 "linkend=\"sec.daily.why-copy\"/>, and make an informed decision that this "
|
dongsheng@627
|
5454 "behaviour is not appropriate to your specific case."
|
dongsheng@627
|
5455 msgstr ""
|
dongsheng@627
|
5456
|
dongsheng@627
|
5457 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
5458 #: ../en/ch05-daily.xml:338
|
dongsheng@627
|
5459 msgid "Behaviour of the <command role=\"hg-cmd\">hg copy</command> command"
|
dongsheng@627
|
5460 msgstr "命令 <command role=\"hg-cmd\">hg copy</command> 的特性"
|
dongsheng@627
|
5461
|
dongsheng@627
|
5462 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5463 #: ../en/ch05-daily.xml:341
|
dongsheng@627
|
5464 msgid ""
|
dongsheng@627
|
5465 "When you use the <command role=\"hg-cmd\">hg copy</command> command, "
|
dongsheng@627
|
5466 "Mercurial makes a copy of each source file as it currently stands in the "
|
dongsheng@627
|
5467 "working directory. This means that if you make some modifications to a file, "
|
dongsheng@627
|
5468 "then <command role=\"hg-cmd\">hg copy</command> it without first having "
|
dongsheng@627
|
5469 "committed those changes, the new copy will also contain the modifications you "
|
dongsheng@627
|
5470 "have made up until that point. (I find this behaviour a little "
|
dongsheng@627
|
5471 "counterintuitive, which is why I mention it here.)"
|
dongsheng@627
|
5472 msgstr ""
|
dongsheng@627
|
5473
|
dongsheng@627
|
5474 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5475 #: ../en/ch05-daily.xml:351
|
dongsheng@627
|
5476 msgid ""
|
dongsheng@627
|
5477 "The <command role=\"hg-cmd\">hg copy</command> command acts similarly to the "
|
dongsheng@627
|
5478 "Unix <command>cp</command> command (you can use the <command role=\"hg-cmd"
|
dongsheng@627
|
5479 "\">hg cp</command> alias if you prefer). The last argument is the "
|
dongsheng@627
|
5480 "<emphasis>destination</emphasis>, and all prior arguments are "
|
dongsheng@627
|
5481 "<emphasis>sources</emphasis>. If you pass it a single file as the source, "
|
dongsheng@627
|
5482 "and the destination does not exist, it creates a new file with that name."
|
dongsheng@627
|
5483 msgstr ""
|
dongsheng@627
|
5484
|
dongsheng@627
|
5485 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5486 #: ../en/ch05-daily.xml:362
|
dongsheng@627
|
5487 msgid ""
|
dongsheng@627
|
5488 "If the destination is a directory, Mercurial copies its sources into that "
|
dongsheng@627
|
5489 "directory."
|
dongsheng@627
|
5490 msgstr ""
|
dongsheng@627
|
5491
|
dongsheng@627
|
5492 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5493 #: ../en/ch05-daily.xml:367
|
dongsheng@627
|
5494 msgid ""
|
dongsheng@627
|
5495 "Copying a directory is recursive, and preserves the directory structure of "
|
dongsheng@627
|
5496 "the source."
|
dongsheng@627
|
5497 msgstr ""
|
dongsheng@627
|
5498
|
dongsheng@627
|
5499 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5500 #: ../en/ch05-daily.xml:373
|
dongsheng@627
|
5501 msgid ""
|
dongsheng@627
|
5502 "If the source and destination are both directories, the source tree is "
|
dongsheng@627
|
5503 "recreated in the destination directory."
|
dongsheng@627
|
5504 msgstr ""
|
dongsheng@627
|
5505
|
dongsheng@627
|
5506 #
|
dongsheng@627
|
5507 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5508 #: ../en/ch05-daily.xml:378
|
dongsheng@627
|
5509 msgid ""
|
dongsheng@627
|
5510 "As with the <command role=\"hg-cmd\">hg rename</command> command, if you copy "
|
dongsheng@627
|
5511 "a file manually and then want Mercurial to know that you've copied the file, "
|
dongsheng@627
|
5512 "simply use the <option role=\"hg-opt-copy\">--after</option> option to "
|
dongsheng@627
|
5513 "<command role=\"hg-cmd\">hg copy</command>."
|
dongsheng@627
|
5514 msgstr ""
|
dongsheng@627
|
5515
|
dongsheng@627
|
5516 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
5517 #: ../en/ch05-daily.xml:389
|
dongsheng@627
|
5518 msgid "Renaming files"
|
dongsheng@627
|
5519 msgstr "改名文件"
|
dongsheng@627
|
5520
|
dongsheng@627
|
5521 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5522 #: ../en/ch05-daily.xml:391
|
dongsheng@627
|
5523 msgid ""
|
dongsheng@627
|
5524 "It's rather more common to need to rename a file than to make a copy of it. "
|
dongsheng@627
|
5525 "The reason I discussed the <command role=\"hg-cmd\">hg copy</command> command "
|
dongsheng@627
|
5526 "before talking about renaming files is that Mercurial treats a rename in "
|
dongsheng@627
|
5527 "essentially the same way as a copy. Therefore, knowing what Mercurial does "
|
dongsheng@627
|
5528 "when you copy a file tells you what to expect when you rename a file."
|
dongsheng@627
|
5529 msgstr ""
|
dongsheng@627
|
5530
|
dongsheng@627
|
5531 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5532 #: ../en/ch05-daily.xml:399
|
dongsheng@627
|
5533 msgid ""
|
dongsheng@627
|
5534 "When you use the <command role=\"hg-cmd\">hg rename</command> command, "
|
dongsheng@627
|
5535 "Mercurial makes a copy of each source file, then deletes it and marks the "
|
dongsheng@627
|
5536 "file as removed."
|
dongsheng@627
|
5537 msgstr ""
|
dongsheng@627
|
5538
|
dongsheng@627
|
5539 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5540 #: ../en/ch05-daily.xml:405
|
dongsheng@627
|
5541 msgid ""
|
dongsheng@627
|
5542 "The <command role=\"hg-cmd\">hg status</command> command shows the newly "
|
dongsheng@627
|
5543 "copied file as added, and the copied-from file as removed."
|
dongsheng@627
|
5544 msgstr ""
|
dongsheng@627
|
5545
|
dongsheng@627
|
5546 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5547 #: ../en/ch05-daily.xml:411
|
dongsheng@627
|
5548 msgid ""
|
dongsheng@627
|
5549 "As with the results of a <command role=\"hg-cmd\">hg copy</command>, we must "
|
dongsheng@627
|
5550 "use the <option role=\"hg-opt-status\">-C</option> option to <command role="
|
dongsheng@627
|
5551 "\"hg-cmd\">hg status</command> to see that the added file is really being "
|
dongsheng@627
|
5552 "tracked by Mercurial as a copy of the original, now removed, file."
|
dongsheng@627
|
5553 msgstr ""
|
dongsheng@627
|
5554
|
dongsheng@627
|
5555 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5556 #: ../en/ch05-daily.xml:420
|
dongsheng@627
|
5557 msgid ""
|
dongsheng@627
|
5558 "As with <command role=\"hg-cmd\">hg remove</command> and <command role=\"hg-"
|
dongsheng@627
|
5559 "cmd\">hg copy</command>, you can tell Mercurial about a rename after the fact "
|
dongsheng@627
|
5560 "using the <option role=\"hg-opt-rename\">--after</option> option. In most "
|
dongsheng@627
|
5561 "other respects, the behaviour of the <command role=\"hg-cmd\">hg rename</"
|
dongsheng@627
|
5562 "command> command, and the options it accepts, are similar to the <command "
|
dongsheng@627
|
5563 "role=\"hg-cmd\">hg copy</command> command."
|
dongsheng@627
|
5564 msgstr ""
|
dongsheng@627
|
5565
|
dongsheng@627
|
5566 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
5567 #: ../en/ch05-daily.xml:430
|
dongsheng@627
|
5568 msgid "Renaming files and merging changes"
|
dongsheng@627
|
5569 msgstr "改名文件与合并修改"
|
dongsheng@627
|
5570
|
dongsheng@627
|
5571 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5572 #: ../en/ch05-daily.xml:432
|
dongsheng@627
|
5573 msgid ""
|
dongsheng@627
|
5574 "Since Mercurial's rename is implemented as copy-and-remove, the same "
|
dongsheng@627
|
5575 "propagation of changes happens when you merge after a rename as after a copy."
|
dongsheng@627
|
5576 msgstr ""
|
dongsheng@627
|
5577
|
dongsheng@627
|
5578 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5579 #: ../en/ch05-daily.xml:436
|
dongsheng@627
|
5580 msgid ""
|
dongsheng@627
|
5581 "If I modify a file, and you rename it to a new name, and then we merge our "
|
dongsheng@627
|
5582 "respective changes, my modifications to the file under its original name will "
|
dongsheng@627
|
5583 "be propagated into the file under its new name. (This is something you might "
|
dongsheng@627
|
5584 "expect to <quote>simply work,</quote> but not all revision control systems "
|
dongsheng@627
|
5585 "actually do this.)"
|
dongsheng@627
|
5586 msgstr ""
|
dongsheng@627
|
5587
|
dongsheng@627
|
5588 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5589 #: ../en/ch05-daily.xml:443
|
dongsheng@627
|
5590 msgid ""
|
dongsheng@627
|
5591 "Whereas having changes follow a copy is a feature where you can perhaps nod "
|
dongsheng@627
|
5592 "and say <quote>yes, that might be useful,</quote> it should be clear that "
|
dongsheng@627
|
5593 "having them follow a rename is definitely important. Without this facility, "
|
dongsheng@627
|
5594 "it would simply be too easy for changes to become orphaned when files are "
|
dongsheng@627
|
5595 "renamed."
|
dongsheng@627
|
5596 msgstr ""
|
dongsheng@627
|
5597
|
dongsheng@627
|
5598 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
5599 #: ../en/ch05-daily.xml:452
|
dongsheng@627
|
5600 msgid "Divergent renames and merging"
|
dongsheng@627
|
5601 msgstr "改名与合并的分歧"
|
dongsheng@627
|
5602
|
dongsheng@627
|
5603 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5604 #: ../en/ch05-daily.xml:454
|
dongsheng@627
|
5605 msgid ""
|
dongsheng@627
|
5606 "The case of diverging names occurs when two developers start with a "
|
dongsheng@627
|
5607 "file&emdash;let's call it <filename>foo</filename>&emdash;in their respective "
|
dongsheng@627
|
5608 "repositories."
|
dongsheng@627
|
5609 msgstr ""
|
dongsheng@627
|
5610
|
dongsheng@627
|
5611 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5612 #: ../en/ch05-daily.xml:461
|
dongsheng@627
|
5613 msgid "Anne renames the file to <filename>bar</filename>."
|
dongsheng@627
|
5614 msgstr ""
|
dongsheng@627
|
5615
|
dongsheng@627
|
5616 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5617 #: ../en/ch05-daily.xml:465
|
dongsheng@627
|
5618 msgid "Meanwhile, Bob renames it to <filename>quux</filename>."
|
dongsheng@627
|
5619 msgstr ""
|
dongsheng@627
|
5620
|
dongsheng@627
|
5621 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5622 #: ../en/ch05-daily.xml:470
|
dongsheng@627
|
5623 msgid ""
|
dongsheng@627
|
5624 "I like to think of this as a conflict because each developer has expressed "
|
dongsheng@627
|
5625 "different intentions about what the file ought to be named."
|
dongsheng@627
|
5626 msgstr ""
|
dongsheng@627
|
5627
|
dongsheng@627
|
5628 #
|
dongsheng@627
|
5629 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5630 #: ../en/ch05-daily.xml:474
|
dongsheng@627
|
5631 msgid ""
|
dongsheng@627
|
5632 "What do you think should happen when they merge their work? Mercurial's "
|
dongsheng@627
|
5633 "actual behaviour is that it always preserves <emphasis>both</emphasis> names "
|
dongsheng@627
|
5634 "when it merges changesets that contain divergent renames."
|
dongsheng@627
|
5635 msgstr ""
|
dongsheng@627
|
5636
|
dongsheng@627
|
5637 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5638 #: ../en/ch05-daily.xml:481
|
dongsheng@627
|
5639 msgid ""
|
dongsheng@627
|
5640 "Notice that Mercurial does warn about the divergent renames, but it leaves it "
|
dongsheng@627
|
5641 "up to you to do something about the divergence after the merge."
|
dongsheng@627
|
5642 msgstr ""
|
dongsheng@627
|
5643
|
dongsheng@627
|
5644 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
5645 #: ../en/ch05-daily.xml:487
|
dongsheng@627
|
5646 msgid "Convergent renames and merging"
|
dongsheng@627
|
5647 msgstr "收敛改名与合并"
|
dongsheng@627
|
5648
|
dongsheng@627
|
5649 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5650 #: ../en/ch05-daily.xml:489
|
dongsheng@627
|
5651 msgid ""
|
dongsheng@627
|
5652 "Another kind of rename conflict occurs when two people choose to rename "
|
dongsheng@627
|
5653 "different <emphasis>source</emphasis> files to the same "
|
dongsheng@627
|
5654 "<emphasis>destination</emphasis>. In this case, Mercurial runs its normal "
|
dongsheng@627
|
5655 "merge machinery, and lets you guide it to a suitable resolution."
|
dongsheng@627
|
5656 msgstr ""
|
dongsheng@627
|
5657
|
dongsheng@627
|
5658 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
5659 #: ../en/ch05-daily.xml:497
|
dongsheng@627
|
5660 msgid "Other name-related corner cases"
|
dongsheng@627
|
5661 msgstr "其它名称相关的角落"
|
dongsheng@627
|
5662
|
dongsheng@627
|
5663 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5664 #: ../en/ch05-daily.xml:499
|
dongsheng@627
|
5665 msgid ""
|
dongsheng@627
|
5666 "Mercurial has a longstanding bug in which it fails to handle a merge where "
|
dongsheng@627
|
5667 "one side has a file with a given name, while another has a directory with the "
|
dongsheng@627
|
5668 "same name. This is documented as <ulink role=\"hg-bug\" url=\"http://www."
|
dongsheng@627
|
5669 "selenic.com/mercurial/bts/issue29\">issue 29</ulink>."
|
dongsheng@627
|
5670 msgstr ""
|
dongsheng@627
|
5671
|
dongsheng@627
|
5672 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
5673 #: ../en/ch05-daily.xml:511
|
dongsheng@627
|
5674 msgid "Recovering from mistakes"
|
dongsheng@627
|
5675 msgstr "从错误恢复"
|
dongsheng@627
|
5676
|
dongsheng@627
|
5677 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5678 #: ../en/ch05-daily.xml:513
|
dongsheng@627
|
5679 msgid ""
|
dongsheng@627
|
5680 "Mercurial has some useful commands that will help you to recover from some "
|
dongsheng@627
|
5681 "common mistakes."
|
dongsheng@627
|
5682 msgstr ""
|
dongsheng@627
|
5683
|
dongsheng@627
|
5684 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5685 #: ../en/ch05-daily.xml:516
|
dongsheng@627
|
5686 msgid ""
|
dongsheng@627
|
5687 "The <command role=\"hg-cmd\">hg revert</command> command lets you undo "
|
dongsheng@627
|
5688 "changes that you have made to your working directory. For example, if you "
|
dongsheng@627
|
5689 "<command role=\"hg-cmd\">hg add</command> a file by accident, just run "
|
dongsheng@627
|
5690 "<command role=\"hg-cmd\">hg revert</command> with the name of the file you "
|
dongsheng@627
|
5691 "added, and while the file won't be touched in any way, it won't be tracked "
|
dongsheng@627
|
5692 "for adding by Mercurial any longer, either. You can also use <command role="
|
dongsheng@627
|
5693 "\"hg-cmd\">hg revert</command> to get rid of erroneous changes to a file."
|
dongsheng@627
|
5694 msgstr ""
|
dongsheng@627
|
5695
|
dongsheng@627
|
5696 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5697 #: ../en/ch05-daily.xml:526
|
dongsheng@627
|
5698 msgid ""
|
dongsheng@627
|
5699 "It's useful to remember that the <command role=\"hg-cmd\">hg revert</command> "
|
dongsheng@627
|
5700 "command is useful for changes that you have not yet committed. Once you've "
|
dongsheng@627
|
5701 "committed a change, if you decide it was a mistake, you can still do "
|
dongsheng@627
|
5702 "something about it, though your options may be more limited."
|
dongsheng@627
|
5703 msgstr ""
|
dongsheng@627
|
5704
|
dongsheng@627
|
5705 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5706 #: ../en/ch05-daily.xml:532
|
dongsheng@627
|
5707 msgid ""
|
dongsheng@627
|
5708 "For more information about the <command role=\"hg-cmd\">hg revert</command> "
|
dongsheng@627
|
5709 "command, and details about how to deal with changes you have already "
|
dongsheng@627
|
5710 "committed, see chapter <xref linkend=\"chap.undo\"/>."
|
dongsheng@627
|
5711 msgstr ""
|
dongsheng@627
|
5712
|
dongsheng@627
|
5713 #. type: Content of: <book><chapter><title>
|
dongsheng@627
|
5714 #: ../en/ch06-collab.xml:5
|
dongsheng@627
|
5715 msgid "Collaborating with other people"
|
dongsheng@627
|
5716 msgstr "团体协作"
|
dongsheng@627
|
5717
|
dongsheng@627
|
5718 #. type: Content of: <book><chapter><para>
|
dongsheng@627
|
5719 #: ../en/ch06-collab.xml:7
|
dongsheng@627
|
5720 msgid ""
|
dongsheng@627
|
5721 "As a completely decentralised tool, Mercurial doesn't impose any policy on "
|
dongsheng@627
|
5722 "how people ought to work with each other. However, if you're new to "
|
dongsheng@627
|
5723 "distributed revision control, it helps to have some tools and examples in "
|
dongsheng@627
|
5724 "mind when you're thinking about possible workflow models."
|
dongsheng@627
|
5725 msgstr ""
|
dongsheng@627
|
5726
|
dongsheng@627
|
5727 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
5728 #: ../en/ch06-collab.xml:14
|
dongsheng@627
|
5729 msgid "Mercurial's web interface"
|
dongsheng@630
|
5730 msgstr "Mercurial 的 web 接口"
|
dongsheng@627
|
5731
|
dongsheng@627
|
5732 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5733 #: ../en/ch06-collab.xml:16
|
dongsheng@627
|
5734 msgid ""
|
dongsheng@627
|
5735 "Mercurial has a powerful web interface that provides several useful "
|
dongsheng@627
|
5736 "capabilities."
|
dongsheng@627
|
5737 msgstr ""
|
dongsheng@627
|
5738
|
dongsheng@627
|
5739 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5740 #: ../en/ch06-collab.xml:19
|
dongsheng@627
|
5741 msgid ""
|
dongsheng@627
|
5742 "For interactive use, the web interface lets you browse a single repository or "
|
dongsheng@627
|
5743 "a collection of repositories. You can view the history of a repository, "
|
dongsheng@627
|
5744 "examine each change (comments and diffs), and view the contents of each "
|
dongsheng@627
|
5745 "directory and file."
|
dongsheng@627
|
5746 msgstr ""
|
dongsheng@627
|
5747
|
dongsheng@627
|
5748 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5749 #: ../en/ch06-collab.xml:24
|
dongsheng@627
|
5750 msgid ""
|
dongsheng@627
|
5751 "Also for human consumption, the web interface provides an RSS feed of the "
|
dongsheng@627
|
5752 "changes in a repository. This lets you <quote>subscribe</quote> to a "
|
dongsheng@627
|
5753 "repository using your favourite feed reader, and be automatically notified of "
|
dongsheng@627
|
5754 "activity in that repository as soon as it happens. I find this capability "
|
dongsheng@627
|
5755 "much more convenient than the model of subscribing to a mailing list to which "
|
dongsheng@627
|
5756 "notifications are sent, as it requires no additional configuration on the "
|
dongsheng@627
|
5757 "part of whoever is serving the repository."
|
dongsheng@627
|
5758 msgstr ""
|
dongsheng@627
|
5759
|
dongsheng@627
|
5760 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5761 #: ../en/ch06-collab.xml:34
|
dongsheng@627
|
5762 msgid ""
|
dongsheng@627
|
5763 "The web interface also lets remote users clone a repository, pull changes "
|
dongsheng@627
|
5764 "from it, and (when the server is configured to permit it) push changes back "
|
dongsheng@627
|
5765 "to it. Mercurial's HTTP tunneling protocol aggressively compresses data, so "
|
dongsheng@627
|
5766 "that it works efficiently even over low-bandwidth network connections."
|
dongsheng@627
|
5767 msgstr ""
|
dongsheng@627
|
5768
|
dongsheng@627
|
5769 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5770 #: ../en/ch06-collab.xml:40
|
dongsheng@627
|
5771 msgid ""
|
dongsheng@627
|
5772 "The easiest way to get started with the web interface is to use your web "
|
dongsheng@627
|
5773 "browser to visit an existing repository, such as the master Mercurial "
|
dongsheng@627
|
5774 "repository at <ulink url=\"http://www.selenic.com/repo/hg?style=gitweb"
|
dongsheng@627
|
5775 "\">http://www.selenic.com/repo/hg?style=gitweb</ulink>."
|
dongsheng@627
|
5776 msgstr ""
|
dongsheng@627
|
5777
|
dongsheng@627
|
5778 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5779 #: ../en/ch06-collab.xml:45
|
dongsheng@627
|
5780 msgid ""
|
dongsheng@627
|
5781 "If you're interested in providing a web interface to your own repositories, "
|
dongsheng@627
|
5782 "Mercurial provides two ways to do this. The first is using the <command role="
|
dongsheng@627
|
5783 "\"hg-cmd\">hg serve</command> command, which is best suited to short-term "
|
dongsheng@627
|
5784 "<quote>lightweight</quote> serving. See section <xref linkend=\"sec.collab."
|
dongsheng@627
|
5785 "serve\"/> below for details of how to use this command. If you have a long-"
|
dongsheng@627
|
5786 "lived repository that you'd like to make permanently available, Mercurial has "
|
dongsheng@627
|
5787 "built-in support for the CGI (Common Gateway Interface) standard, which all "
|
dongsheng@627
|
5788 "common web servers support. See section <xref linkend=\"sec.collab.cgi\"/> "
|
dongsheng@627
|
5789 "for details of CGI configuration."
|
dongsheng@627
|
5790 msgstr ""
|
dongsheng@627
|
5791
|
dongsheng@627
|
5792 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
5793 #: ../en/ch06-collab.xml:60
|
dongsheng@627
|
5794 msgid "Collaboration models"
|
dongsheng@630
|
5795 msgstr "协作模型"
|
dongsheng@627
|
5796
|
dongsheng@627
|
5797 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
5798 #: ../en/ch06-collab.xml:62
|
dongsheng@627
|
5799 msgid ""
|
dongsheng@627
|
5800 "With a suitably flexible tool, making decisions about workflow is much more "
|
dongsheng@627
|
5801 "of a social engineering challenge than a technical one. Mercurial imposes few "
|
dongsheng@627
|
5802 "limitations on how you can structure the flow of work in a project, so it's "
|
dongsheng@627
|
5803 "up to you and your group to set up and live with a model that matches your "
|
dongsheng@627
|
5804 "own particular needs."
|
dongsheng@627
|
5805 msgstr ""
|
dongsheng@627
|
5806
|
dongsheng@627
|
5807 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
5808 #: ../en/ch06-collab.xml:70
|
dongsheng@627
|
5809 msgid "Factors to keep in mind"
|
dongsheng@630
|
5810 msgstr "要牢记的因素"
|
dongsheng@627
|
5811
|
dongsheng@627
|
5812 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5813 #: ../en/ch06-collab.xml:72
|
dongsheng@627
|
5814 msgid ""
|
dongsheng@627
|
5815 "The most important aspect of any model that you must keep in mind is how well "
|
dongsheng@627
|
5816 "it matches the needs and capabilities of the people who will be using it. "
|
dongsheng@627
|
5817 "This might seem self-evident; even so, you still can't afford to forget it "
|
dongsheng@627
|
5818 "for a moment."
|
dongsheng@627
|
5819 msgstr ""
|
dongsheng@627
|
5820
|
dongsheng@627
|
5821 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5822 #: ../en/ch06-collab.xml:78
|
dongsheng@627
|
5823 msgid ""
|
dongsheng@627
|
5824 "I once put together a workflow model that seemed to make perfect sense to me, "
|
dongsheng@627
|
5825 "but that caused a considerable amount of consternation and strife within my "
|
dongsheng@627
|
5826 "development team. In spite of my attempts to explain why we needed a complex "
|
dongsheng@627
|
5827 "set of branches, and how changes ought to flow between them, a few team "
|
dongsheng@627
|
5828 "members revolted. Even though they were smart people, they didn't want to "
|
dongsheng@627
|
5829 "pay attention to the constraints we were operating under, or face the "
|
dongsheng@627
|
5830 "consequences of those constraints in the details of the model that I was "
|
dongsheng@627
|
5831 "advocating."
|
dongsheng@627
|
5832 msgstr ""
|
dongsheng@627
|
5833
|
dongsheng@627
|
5834 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5835 #: ../en/ch06-collab.xml:88
|
dongsheng@627
|
5836 msgid ""
|
dongsheng@627
|
5837 "Don't sweep foreseeable social or technical problems under the rug. Whatever "
|
dongsheng@627
|
5838 "scheme you put into effect, you should plan for mistakes and problem "
|
dongsheng@627
|
5839 "scenarios. Consider adding automated machinery to prevent, or quickly "
|
dongsheng@627
|
5840 "recover from, trouble that you can anticipate. As an example, if you intend "
|
dongsheng@627
|
5841 "to have a branch with not-for-release changes in it, you'd do well to think "
|
dongsheng@627
|
5842 "early about the possibility that someone might accidentally merge those "
|
dongsheng@627
|
5843 "changes into a release branch. You could avoid this particular problem by "
|
dongsheng@627
|
5844 "writing a hook that prevents changes from being merged from an inappropriate "
|
dongsheng@627
|
5845 "branch."
|
dongsheng@627
|
5846 msgstr ""
|
dongsheng@627
|
5847
|
dongsheng@627
|
5848 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
5849 #: ../en/ch06-collab.xml:102
|
dongsheng@627
|
5850 msgid "Informal anarchy"
|
dongsheng@630
|
5851 msgstr "无政府状态"
|
dongsheng@627
|
5852
|
dongsheng@627
|
5853 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5854 #: ../en/ch06-collab.xml:104
|
dongsheng@627
|
5855 msgid ""
|
dongsheng@627
|
5856 "I wouldn't suggest an <quote>anything goes</quote> approach as something "
|
dongsheng@627
|
5857 "sustainable, but it's a model that's easy to grasp, and it works perfectly "
|
dongsheng@627
|
5858 "well in a few unusual situations."
|
dongsheng@627
|
5859 msgstr ""
|
dongsheng@627
|
5860
|
dongsheng@627
|
5861 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5862 #: ../en/ch06-collab.xml:109
|
dongsheng@627
|
5863 msgid ""
|
dongsheng@627
|
5864 "As one example, many projects have a loose-knit group of collaborators who "
|
dongsheng@627
|
5865 "rarely physically meet each other. Some groups like to overcome the "
|
dongsheng@627
|
5866 "isolation of working at a distance by organising occasional <quote>sprints</"
|
dongsheng@627
|
5867 "quote>. In a sprint, a number of people get together in a single location (a "
|
dongsheng@627
|
5868 "company's conference room, a hotel meeting room, that kind of place) and "
|
dongsheng@627
|
5869 "spend several days more or less locked in there, hacking intensely on a "
|
dongsheng@627
|
5870 "handful of projects."
|
dongsheng@627
|
5871 msgstr ""
|
dongsheng@627
|
5872
|
dongsheng@627
|
5873 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5874 #: ../en/ch06-collab.xml:118
|
dongsheng@627
|
5875 msgid ""
|
dongsheng@627
|
5876 "A sprint is the perfect place to use the <command role=\"hg-cmd\">hg serve</"
|
dongsheng@627
|
5877 "command> command, since <command role=\"hg-cmd\">hg serve</command> does not "
|
dongsheng@627
|
5878 "require any fancy server infrastructure. You can get started with <command "
|
dongsheng@627
|
5879 "role=\"hg-cmd\">hg serve</command> in moments, by reading section <xref "
|
dongsheng@627
|
5880 "linkend=\"sec.collab.serve\"/> below. Then simply tell the person next to "
|
dongsheng@627
|
5881 "you that you're running a server, send the URL to them in an instant message, "
|
dongsheng@627
|
5882 "and you immediately have a quick-turnaround way to work together. They can "
|
dongsheng@627
|
5883 "type your URL into their web browser and quickly review your changes; or they "
|
dongsheng@627
|
5884 "can pull a bugfix from you and verify it; or they can clone a branch "
|
dongsheng@627
|
5885 "containing a new feature and try it out."
|
dongsheng@627
|
5886 msgstr ""
|
dongsheng@627
|
5887
|
dongsheng@627
|
5888 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5889 #: ../en/ch06-collab.xml:132
|
dongsheng@627
|
5890 msgid ""
|
dongsheng@627
|
5891 "The charm, and the problem, with doing things in an ad hoc fashion like this "
|
dongsheng@627
|
5892 "is that only people who know about your changes, and where they are, can see "
|
dongsheng@627
|
5893 "them. Such an informal approach simply doesn't scale beyond a handful "
|
dongsheng@627
|
5894 "people, because each individual needs to know about $n$ different "
|
dongsheng@627
|
5895 "repositories to pull from."
|
dongsheng@627
|
5896 msgstr ""
|
dongsheng@627
|
5897
|
dongsheng@627
|
5898 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
5899 #: ../en/ch06-collab.xml:141
|
dongsheng@627
|
5900 msgid "A single central repository"
|
dongsheng@630
|
5901 msgstr "单一中央版本库"
|
dongsheng@627
|
5902
|
dongsheng@627
|
5903 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5904 #: ../en/ch06-collab.xml:143
|
dongsheng@627
|
5905 msgid ""
|
dongsheng@627
|
5906 "For smaller projects migrating from a centralised revision control tool, "
|
dongsheng@627
|
5907 "perhaps the easiest way to get started is to have changes flow through a "
|
dongsheng@627
|
5908 "single shared central repository. This is also the most common "
|
dongsheng@627
|
5909 "<quote>building block</quote> for more ambitious workflow schemes."
|
dongsheng@627
|
5910 msgstr ""
|
dongsheng@627
|
5911
|
dongsheng@627
|
5912 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5913 #: ../en/ch06-collab.xml:149
|
dongsheng@627
|
5914 msgid ""
|
dongsheng@627
|
5915 "Contributors start by cloning a copy of this repository. They can pull "
|
dongsheng@627
|
5916 "changes from it whenever they need to, and some (perhaps all) developers have "
|
dongsheng@627
|
5917 "permission to push a change back when they're ready for other people to see "
|
dongsheng@627
|
5918 "it."
|
dongsheng@627
|
5919 msgstr ""
|
dongsheng@627
|
5920
|
dongsheng@627
|
5921 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5922 #: ../en/ch06-collab.xml:154
|
dongsheng@627
|
5923 msgid ""
|
dongsheng@627
|
5924 "Under this model, it can still often make sense for people to pull changes "
|
dongsheng@627
|
5925 "directly from each other, without going through the central repository. "
|
dongsheng@627
|
5926 "Consider a case in which I have a tentative bug fix, but I am worried that if "
|
dongsheng@627
|
5927 "I were to publish it to the central repository, it might subsequently break "
|
dongsheng@627
|
5928 "everyone else's trees as they pull it. To reduce the potential for damage, I "
|
dongsheng@627
|
5929 "can ask you to clone my repository into a temporary repository of your own "
|
dongsheng@627
|
5930 "and test it. This lets us put off publishing the potentially unsafe change "
|
dongsheng@627
|
5931 "until it has had a little testing."
|
dongsheng@627
|
5932 msgstr ""
|
dongsheng@627
|
5933
|
dongsheng@627
|
5934 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5935 #: ../en/ch06-collab.xml:165
|
dongsheng@627
|
5936 msgid ""
|
dongsheng@627
|
5937 "In this kind of scenario, people usually use the <command>ssh</command> "
|
dongsheng@627
|
5938 "protocol to securely push changes to the central repository, as documented in "
|
dongsheng@627
|
5939 "section <xref linkend=\"sec.collab.ssh\"/>. It's also usual to publish a "
|
dongsheng@627
|
5940 "read-only copy of the repository over HTTP using CGI, as in section <xref "
|
dongsheng@627
|
5941 "linkend=\"sec.collab.cgi\"/>. Publishing over HTTP satisfies the needs of "
|
dongsheng@627
|
5942 "people who don't have push access, and those who want to use web browsers to "
|
dongsheng@627
|
5943 "browse the repository's history."
|
dongsheng@627
|
5944 msgstr ""
|
dongsheng@627
|
5945
|
dongsheng@627
|
5946 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
5947 #: ../en/ch06-collab.xml:178
|
dongsheng@627
|
5948 msgid "Working with multiple branches"
|
dongsheng@630
|
5949 msgstr "使用多个分支工作"
|
dongsheng@627
|
5950
|
dongsheng@627
|
5951 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5952 #: ../en/ch06-collab.xml:180
|
dongsheng@627
|
5953 msgid ""
|
dongsheng@627
|
5954 "Projects of any significant size naturally tend to make progress on several "
|
dongsheng@627
|
5955 "fronts simultaneously. In the case of software, it's common for a project to "
|
dongsheng@627
|
5956 "go through periodic official releases. A release might then go into "
|
dongsheng@627
|
5957 "<quote>maintenance mode</quote> for a while after its first publication; "
|
dongsheng@627
|
5958 "maintenance releases tend to contain only bug fixes, not new features. In "
|
dongsheng@627
|
5959 "parallel with these maintenance releases, one or more future releases may be "
|
dongsheng@627
|
5960 "under development. People normally use the word <quote>branch</quote> to "
|
dongsheng@627
|
5961 "refer to one of these many slightly different directions in which development "
|
dongsheng@627
|
5962 "is proceeding."
|
dongsheng@627
|
5963 msgstr ""
|
dongsheng@627
|
5964
|
dongsheng@627
|
5965 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5966 #: ../en/ch06-collab.xml:193
|
dongsheng@627
|
5967 msgid ""
|
dongsheng@627
|
5968 "Mercurial is particularly well suited to managing a number of simultaneous, "
|
dongsheng@627
|
5969 "but not identical, branches. Each <quote>development direction</quote> can "
|
dongsheng@627
|
5970 "live in its own central repository, and you can merge changes from one to "
|
dongsheng@627
|
5971 "another as the need arises. Because repositories are independent of each "
|
dongsheng@627
|
5972 "other, unstable changes in a development branch will never affect a stable "
|
dongsheng@627
|
5973 "branch unless someone explicitly merges those changes in."
|
dongsheng@627
|
5974 msgstr ""
|
dongsheng@627
|
5975
|
dongsheng@627
|
5976 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5977 #: ../en/ch06-collab.xml:202
|
dongsheng@627
|
5978 msgid ""
|
dongsheng@627
|
5979 "Here's an example of how this can work in practice. Let's say you have one "
|
dongsheng@627
|
5980 "<quote>main branch</quote> on a central server."
|
dongsheng@627
|
5981 msgstr ""
|
dongsheng@627
|
5982
|
dongsheng@627
|
5983 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5984 #: ../en/ch06-collab.xml:208
|
dongsheng@627
|
5985 msgid "People clone it, make changes locally, test them, and push them back."
|
dongsheng@627
|
5986 msgstr ""
|
dongsheng@627
|
5987
|
dongsheng@627
|
5988 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5989 #: ../en/ch06-collab.xml:211
|
dongsheng@627
|
5990 msgid ""
|
dongsheng@627
|
5991 "Once the main branch reaches a release milestone, you can use the <command "
|
dongsheng@627
|
5992 "role=\"hg-cmd\">hg tag</command> command to give a permanent name to the "
|
dongsheng@627
|
5993 "milestone revision."
|
dongsheng@627
|
5994 msgstr ""
|
dongsheng@627
|
5995
|
dongsheng@627
|
5996 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
5997 #: ../en/ch06-collab.xml:217
|
dongsheng@627
|
5998 msgid "Let's say some ongoing development occurs on the main branch."
|
dongsheng@627
|
5999 msgstr ""
|
dongsheng@627
|
6000
|
dongsheng@627
|
6001 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
6002 #: ../en/ch06-collab.xml:222
|
dongsheng@627
|
6003 msgid ""
|
dongsheng@627
|
6004 "Using the tag that was recorded at the milestone, people who clone that "
|
dongsheng@627
|
6005 "repository at any time in the future can use <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
6006 "update</command> to get a copy of the working directory exactly as it was "
|
dongsheng@627
|
6007 "when that tagged revision was committed."
|
dongsheng@627
|
6008 msgstr ""
|
dongsheng@627
|
6009
|
dongsheng@627
|
6010 #
|
dongsheng@627
|
6011 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
6012 #: ../en/ch06-collab.xml:230
|
dongsheng@627
|
6013 msgid ""
|
dongsheng@627
|
6014 "In addition, immediately after the main branch is tagged, someone can then "
|
dongsheng@627
|
6015 "clone the main branch on the server to a new <quote>stable</quote> branch, "
|
dongsheng@627
|
6016 "also on the server."
|
dongsheng@627
|
6017 msgstr ""
|
dongsheng@627
|
6018
|
dongsheng@627
|
6019 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
6020 #: ../en/ch06-collab.xml:236
|
dongsheng@627
|
6021 msgid ""
|
dongsheng@627
|
6022 "Someone who needs to make a change to the stable branch can then clone "
|
dongsheng@627
|
6023 "<emphasis>that</emphasis> repository, make their changes, commit, and push "
|
dongsheng@627
|
6024 "their changes back there."
|
dongsheng@627
|
6025 msgstr ""
|
dongsheng@627
|
6026
|
dongsheng@627
|
6027 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
6028 #: ../en/ch06-collab.xml:242
|
dongsheng@627
|
6029 msgid ""
|
dongsheng@627
|
6030 "Because Mercurial repositories are independent, and Mercurial doesn't move "
|
dongsheng@627
|
6031 "changes around automatically, the stable and main branches are "
|
dongsheng@627
|
6032 "<emphasis>isolated</emphasis> from each other. The changes that you made on "
|
dongsheng@627
|
6033 "the main branch don't <quote>leak</quote> to the stable branch, and vice "
|
dongsheng@627
|
6034 "versa."
|
dongsheng@627
|
6035 msgstr ""
|
dongsheng@627
|
6036
|
dongsheng@627
|
6037 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
6038 #: ../en/ch06-collab.xml:249
|
dongsheng@627
|
6039 msgid ""
|
dongsheng@627
|
6040 "You'll often want all of your bugfixes on the stable branch to show up on the "
|
dongsheng@627
|
6041 "main branch, too. Rather than rewrite a bugfix on the main branch, you can "
|
dongsheng@627
|
6042 "simply pull and merge changes from the stable to the main branch, and "
|
dongsheng@627
|
6043 "Mercurial will bring those bugfixes in for you."
|
dongsheng@627
|
6044 msgstr ""
|
dongsheng@627
|
6045
|
dongsheng@627
|
6046 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
6047 #: ../en/ch06-collab.xml:257
|
dongsheng@627
|
6048 msgid ""
|
dongsheng@627
|
6049 "The main branch will still contain changes that are not on the stable branch, "
|
dongsheng@627
|
6050 "but it will also contain all of the bugfixes from the stable branch. The "
|
dongsheng@627
|
6051 "stable branch remains unaffected by these changes."
|
dongsheng@627
|
6052 msgstr ""
|
dongsheng@627
|
6053
|
dongsheng@627
|
6054 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
|
dongsheng@641
|
6055 #: ../en/ch06-collab.xml:264 ../en/ch06-collab.xml:278
|
dongsheng@627
|
6056 msgid "Feature branches"
|
dongsheng@630
|
6057 msgstr "特性分支"
|
dongsheng@627
|
6058
|
dongsheng@627
|
6059 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
6060 #: ../en/ch06-collab.xml:266
|
dongsheng@627
|
6061 msgid ""
|
dongsheng@627
|
6062 "For larger projects, an effective way to manage change is to break up a team "
|
dongsheng@627
|
6063 "into smaller groups. Each group has a shared branch of its own, cloned from "
|
dongsheng@627
|
6064 "a single <quote>master</quote> branch used by the entire project. People "
|
dongsheng@627
|
6065 "working on an individual branch are typically quite isolated from "
|
dongsheng@627
|
6066 "developments on other branches."
|
dongsheng@627
|
6067 msgstr ""
|
dongsheng@627
|
6068
|
dongsheng@627
|
6069 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
|
dongsheng@641
|
6070 #: ../en/ch06-collab.xml:275
|
dongsheng@641
|
6071 msgid ""
|
dongsheng@641
|
6072 "<imageobject><imagedata fileref=\"images/feature-branches.png\"/> </"
|
dongsheng@627
|
6073 "imageobject>"
|
dongsheng@627
|
6074 msgstr ""
|
dongsheng@627
|
6075
|
dongsheng@627
|
6076 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6077 #: ../en/ch06-collab.xml:283
|
dongsheng@627
|
6078 msgid ""
|
dongsheng@627
|
6079 "When a particular feature is deemed to be in suitable shape, someone on that "
|
dongsheng@627
|
6080 "feature team pulls and merges from the master branch into the feature branch, "
|
dongsheng@627
|
6081 "then pushes back up to the master branch."
|
dongsheng@627
|
6082 msgstr ""
|
dongsheng@627
|
6083
|
dongsheng@627
|
6084 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
6085 #: ../en/ch06-collab.xml:290
|
dongsheng@627
|
6086 msgid "The release train"
|
dongsheng@630
|
6087 msgstr "发布列车"
|
dongsheng@627
|
6088
|
dongsheng@627
|
6089 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6090 #: ../en/ch06-collab.xml:292
|
dongsheng@627
|
6091 msgid ""
|
dongsheng@627
|
6092 "Some projects are organised on a <quote>train</quote> basis: a release is "
|
dongsheng@627
|
6093 "scheduled to happen every few months, and whatever features are ready when "
|
dongsheng@627
|
6094 "the <quote>train</quote> is ready to leave are allowed in."
|
dongsheng@627
|
6095 msgstr ""
|
dongsheng@627
|
6096
|
dongsheng@627
|
6097 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6098 #: ../en/ch06-collab.xml:297
|
dongsheng@627
|
6099 msgid ""
|
dongsheng@627
|
6100 "This model resembles working with feature branches. The difference is that "
|
dongsheng@627
|
6101 "when a feature branch misses a train, someone on the feature team pulls and "
|
dongsheng@627
|
6102 "merges the changes that went out on that train release into the feature "
|
dongsheng@627
|
6103 "branch, and the team continues its work on top of that release so that their "
|
dongsheng@627
|
6104 "feature can make the next release."
|
dongsheng@627
|
6105 msgstr ""
|
dongsheng@627
|
6106
|
dongsheng@627
|
6107 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
6108 #: ../en/ch06-collab.xml:306
|
dongsheng@627
|
6109 msgid "The Linux kernel model"
|
dongsheng@630
|
6110 msgstr "Linux 内核模型"
|
dongsheng@627
|
6111
|
dongsheng@627
|
6112 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6113 #: ../en/ch06-collab.xml:308
|
dongsheng@627
|
6114 msgid ""
|
dongsheng@627
|
6115 "The development of the Linux kernel has a shallow hierarchical structure, "
|
dongsheng@627
|
6116 "surrounded by a cloud of apparent chaos. Because most Linux developers use "
|
dongsheng@627
|
6117 "<command>git</command>, a distributed revision control tool with capabilities "
|
dongsheng@627
|
6118 "similar to Mercurial, it's useful to describe the way work flows in that "
|
dongsheng@627
|
6119 "environment; if you like the ideas, the approach translates well across tools."
|
dongsheng@627
|
6120 msgstr ""
|
dongsheng@627
|
6121
|
dongsheng@627
|
6122 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6123 #: ../en/ch06-collab.xml:316
|
dongsheng@627
|
6124 msgid ""
|
dongsheng@627
|
6125 "At the center of the community sits Linus Torvalds, the creator of Linux. He "
|
dongsheng@627
|
6126 "publishes a single source repository that is considered the "
|
dongsheng@627
|
6127 "<quote>authoritative</quote> current tree by the entire developer community. "
|
dongsheng@627
|
6128 "Anyone can clone Linus's tree, but he is very choosy about whose trees he "
|
dongsheng@627
|
6129 "pulls from."
|
dongsheng@627
|
6130 msgstr ""
|
dongsheng@627
|
6131
|
dongsheng@627
|
6132 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6133 #: ../en/ch06-collab.xml:323
|
dongsheng@627
|
6134 msgid ""
|
dongsheng@627
|
6135 "Linus has a number of <quote>trusted lieutenants</quote>. As a general rule, "
|
dongsheng@627
|
6136 "he pulls whatever changes they publish, in most cases without even reviewing "
|
dongsheng@627
|
6137 "those changes. Some of those lieutenants are generally agreed to be "
|
dongsheng@627
|
6138 "<quote>maintainers</quote>, responsible for specific subsystems within the "
|
dongsheng@627
|
6139 "kernel. If a random kernel hacker wants to make a change to a subsystem that "
|
dongsheng@627
|
6140 "they want to end up in Linus's tree, they must find out who the subsystem's "
|
dongsheng@627
|
6141 "maintainer is, and ask that maintainer to take their change. If the "
|
dongsheng@627
|
6142 "maintainer reviews their changes and agrees to take them, they'll pass them "
|
dongsheng@627
|
6143 "along to Linus in due course."
|
dongsheng@627
|
6144 msgstr ""
|
dongsheng@627
|
6145
|
dongsheng@627
|
6146 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6147 #: ../en/ch06-collab.xml:335
|
dongsheng@627
|
6148 msgid ""
|
dongsheng@627
|
6149 "Individual lieutenants have their own approaches to reviewing, accepting, and "
|
dongsheng@627
|
6150 "publishing changes; and for deciding when to feed them to Linus. In "
|
dongsheng@627
|
6151 "addition, there are several well known branches that people use for different "
|
dongsheng@627
|
6152 "purposes. For example, a few people maintain <quote>stable</quote> "
|
dongsheng@627
|
6153 "repositories of older versions of the kernel, to which they apply critical "
|
dongsheng@627
|
6154 "fixes as needed. Some maintainers publish multiple trees: one for "
|
dongsheng@627
|
6155 "experimental changes; one for changes that they are about to feed upstream; "
|
dongsheng@627
|
6156 "and so on. Others just publish a single tree."
|
dongsheng@627
|
6157 msgstr ""
|
dongsheng@627
|
6158
|
dongsheng@627
|
6159 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6160 #: ../en/ch06-collab.xml:346
|
dongsheng@627
|
6161 msgid ""
|
dongsheng@627
|
6162 "This model has two notable features. The first is that it's <quote>pull "
|
dongsheng@627
|
6163 "only</quote>. You have to ask, convince, or beg another developer to take a "
|
dongsheng@627
|
6164 "change from you, because there are almost no trees to which more than one "
|
dongsheng@627
|
6165 "person can push, and there's no way to push changes into a tree that someone "
|
dongsheng@627
|
6166 "else controls."
|
dongsheng@627
|
6167 msgstr ""
|
dongsheng@627
|
6168
|
dongsheng@627
|
6169 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6170 #: ../en/ch06-collab.xml:353
|
dongsheng@627
|
6171 msgid ""
|
dongsheng@627
|
6172 "The second is that it's based on reputation and acclaim. If you're an "
|
dongsheng@627
|
6173 "unknown, Linus will probably ignore changes from you without even "
|
dongsheng@627
|
6174 "responding. But a subsystem maintainer will probably review them, and will "
|
dongsheng@627
|
6175 "likely take them if they pass their criteria for suitability. The more "
|
dongsheng@627
|
6176 "<quote>good</quote> changes you contribute to a maintainer, the more likely "
|
dongsheng@627
|
6177 "they are to trust your judgment and accept your changes. If you're well-"
|
dongsheng@627
|
6178 "known and maintain a long-lived branch for something Linus hasn't yet "
|
dongsheng@627
|
6179 "accepted, people with similar interests may pull your changes regularly to "
|
dongsheng@627
|
6180 "keep up with your work."
|
dongsheng@627
|
6181 msgstr ""
|
dongsheng@627
|
6182
|
dongsheng@627
|
6183 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6184 #: ../en/ch06-collab.xml:364
|
dongsheng@627
|
6185 msgid ""
|
dongsheng@627
|
6186 "Reputation and acclaim don't necessarily cross subsystem or <quote>people</"
|
dongsheng@627
|
6187 "quote> boundaries. If you're a respected but specialised storage hacker, and "
|
dongsheng@627
|
6188 "you try to fix a networking bug, that change will receive a level of scrutiny "
|
dongsheng@627
|
6189 "from a network maintainer comparable to a change from a complete stranger."
|
dongsheng@627
|
6190 msgstr ""
|
dongsheng@627
|
6191
|
dongsheng@627
|
6192 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6193 #: ../en/ch06-collab.xml:371
|
dongsheng@627
|
6194 msgid ""
|
dongsheng@627
|
6195 "To people who come from more orderly project backgrounds, the comparatively "
|
dongsheng@627
|
6196 "chaotic Linux kernel development process often seems completely insane. It's "
|
dongsheng@627
|
6197 "subject to the whims of individuals; people make sweeping changes whenever "
|
dongsheng@627
|
6198 "they deem it appropriate; and the pace of development is astounding. And yet "
|
dongsheng@627
|
6199 "Linux is a highly successful, well-regarded piece of software."
|
dongsheng@627
|
6200 msgstr ""
|
dongsheng@627
|
6201
|
dongsheng@627
|
6202 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
6203 #: ../en/ch06-collab.xml:381
|
dongsheng@627
|
6204 msgid "Pull-only versus shared-push collaboration"
|
dongsheng@630
|
6205 msgstr "只读与共享写协作"
|
dongsheng@627
|
6206
|
dongsheng@627
|
6207 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6208 #: ../en/ch06-collab.xml:383
|
dongsheng@627
|
6209 msgid ""
|
dongsheng@627
|
6210 "A perpetual source of heat in the open source community is whether a "
|
dongsheng@627
|
6211 "development model in which people only ever pull changes from others is "
|
dongsheng@627
|
6212 "<quote>better than</quote> one in which multiple people can push changes to a "
|
dongsheng@627
|
6213 "shared repository."
|
dongsheng@627
|
6214 msgstr ""
|
dongsheng@627
|
6215
|
dongsheng@627
|
6216 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6217 #: ../en/ch06-collab.xml:389
|
dongsheng@627
|
6218 msgid ""
|
dongsheng@627
|
6219 "Typically, the backers of the shared-push model use tools that actively "
|
dongsheng@627
|
6220 "enforce this approach. If you're using a centralised revision control tool "
|
dongsheng@627
|
6221 "such as Subversion, there's no way to make a choice over which model you'll "
|
dongsheng@627
|
6222 "use: the tool gives you shared-push, and if you want to do anything else, "
|
dongsheng@627
|
6223 "you'll have to roll your own approach on top (such as applying a patch by "
|
dongsheng@627
|
6224 "hand)."
|
dongsheng@627
|
6225 msgstr ""
|
dongsheng@627
|
6226
|
dongsheng@627
|
6227 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6228 #: ../en/ch06-collab.xml:397
|
dongsheng@627
|
6229 msgid ""
|
dongsheng@627
|
6230 "A good distributed revision control tool, such as Mercurial, will support "
|
dongsheng@627
|
6231 "both models. You and your collaborators can then structure how you work "
|
dongsheng@627
|
6232 "together based on your own needs and preferences, not on what contortions "
|
dongsheng@627
|
6233 "your tools force you into."
|
dongsheng@627
|
6234 msgstr ""
|
dongsheng@627
|
6235
|
dongsheng@627
|
6236 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
6237 #: ../en/ch06-collab.xml:405
|
dongsheng@627
|
6238 msgid "Where collaboration meets branch management"
|
dongsheng@630
|
6239 msgstr "协作与分支管理"
|
dongsheng@627
|
6240
|
dongsheng@627
|
6241 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6242 #: ../en/ch06-collab.xml:407
|
dongsheng@627
|
6243 msgid ""
|
dongsheng@627
|
6244 "Once you and your team set up some shared repositories and start propagating "
|
dongsheng@627
|
6245 "changes back and forth between local and shared repos, you begin to face a "
|
dongsheng@627
|
6246 "related, but slightly different challenge: that of managing the multiple "
|
dongsheng@627
|
6247 "directions in which your team may be moving at once. Even though this "
|
dongsheng@627
|
6248 "subject is intimately related to how your team collaborates, it's dense "
|
dongsheng@627
|
6249 "enough to merit treatment of its own, in chapter <xref linkend=\"chap.branch"
|
dongsheng@627
|
6250 "\"/>."
|
dongsheng@627
|
6251 msgstr ""
|
dongsheng@627
|
6252
|
dongsheng@627
|
6253 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
6254 #: ../en/ch06-collab.xml:419
|
dongsheng@627
|
6255 msgid "The technical side of sharing"
|
dongsheng@630
|
6256 msgstr "共享的技术因素"
|
dongsheng@627
|
6257
|
dongsheng@627
|
6258 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
6259 #: ../en/ch06-collab.xml:421
|
dongsheng@627
|
6260 msgid ""
|
dongsheng@627
|
6261 "The remainder of this chapter is devoted to the question of serving data to "
|
dongsheng@627
|
6262 "your collaborators."
|
dongsheng@627
|
6263 msgstr ""
|
dongsheng@627
|
6264
|
dongsheng@627
|
6265 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
6266 #: ../en/ch06-collab.xml:426
|
dongsheng@627
|
6267 msgid "Informal sharing with <command role=\"hg-cmd\">hg serve</command>"
|
dongsheng@630
|
6268 msgstr "使用 <command role=\"hg-cmd\">hg serve</command> 进行非正式共享"
|
dongsheng@627
|
6269
|
dongsheng@627
|
6270 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
6271 #: ../en/ch06-collab.xml:429
|
dongsheng@627
|
6272 msgid ""
|
dongsheng@627
|
6273 "Mercurial's <command role=\"hg-cmd\">hg serve</command> command is "
|
dongsheng@627
|
6274 "wonderfully suited to small, tight-knit, and fast-paced group environments. "
|
dongsheng@627
|
6275 "It also provides a great way to get a feel for using Mercurial commands over "
|
dongsheng@627
|
6276 "a network."
|
dongsheng@627
|
6277 msgstr ""
|
dongsheng@627
|
6278
|
dongsheng@627
|
6279 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
6280 #: ../en/ch06-collab.xml:434
|
dongsheng@627
|
6281 msgid ""
|
dongsheng@627
|
6282 "Run <command role=\"hg-cmd\">hg serve</command> inside a repository, and in "
|
dongsheng@627
|
6283 "under a second it will bring up a specialised HTTP server; this will accept "
|
dongsheng@627
|
6284 "connections from any client, and serve up data for that repository until you "
|
dongsheng@627
|
6285 "terminate it. Anyone who knows the URL of the server you just started, and "
|
dongsheng@627
|
6286 "can talk to your computer over the network, can then use a web browser or "
|
dongsheng@627
|
6287 "Mercurial to read data from that repository. A URL for a <command role=\"hg-"
|
dongsheng@627
|
6288 "cmd\">hg serve</command> instance running on a laptop is likely to look "
|
dongsheng@627
|
6289 "something like <literal>http://my-laptop.local:8000/</literal>."
|
dongsheng@627
|
6290 msgstr ""
|
dongsheng@627
|
6291
|
dongsheng@627
|
6292 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
6293 #: ../en/ch06-collab.xml:445
|
dongsheng@627
|
6294 msgid ""
|
dongsheng@627
|
6295 "The <command role=\"hg-cmd\">hg serve</command> command is <emphasis>not</"
|
dongsheng@627
|
6296 "emphasis> a general-purpose web server. It can do only two things:"
|
dongsheng@627
|
6297 msgstr ""
|
dongsheng@627
|
6298
|
dongsheng@627
|
6299 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@641
|
6300 #: ../en/ch06-collab.xml:449
|
dongsheng@627
|
6301 msgid ""
|
dongsheng@627
|
6302 "Allow people to browse the history of the repository it's serving, from their "
|
dongsheng@627
|
6303 "normal web browsers."
|
dongsheng@627
|
6304 msgstr ""
|
dongsheng@627
|
6305
|
dongsheng@627
|
6306 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@641
|
6307 #: ../en/ch06-collab.xml:453
|
dongsheng@627
|
6308 msgid ""
|
dongsheng@627
|
6309 "Speak Mercurial's wire protocol, so that people can <command role=\"hg-cmd"
|
dongsheng@627
|
6310 "\">hg clone</command> or <command role=\"hg-cmd\">hg pull</command> changes "
|
dongsheng@627
|
6311 "from that repository."
|
dongsheng@627
|
6312 msgstr ""
|
dongsheng@627
|
6313
|
dongsheng@627
|
6314 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
6315 #: ../en/ch06-collab.xml:458
|
dongsheng@627
|
6316 msgid ""
|
dongsheng@627
|
6317 "In particular, <command role=\"hg-cmd\">hg serve</command> won't allow remote "
|
dongsheng@627
|
6318 "users to <emphasis>modify</emphasis> your repository. It's intended for read-"
|
dongsheng@627
|
6319 "only use."
|
dongsheng@627
|
6320 msgstr ""
|
dongsheng@627
|
6321
|
dongsheng@627
|
6322 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
6323 #: ../en/ch06-collab.xml:462
|
dongsheng@627
|
6324 msgid ""
|
dongsheng@627
|
6325 "If you're getting started with Mercurial, there's nothing to prevent you from "
|
dongsheng@627
|
6326 "using <command role=\"hg-cmd\">hg serve</command> to serve up a repository on "
|
dongsheng@627
|
6327 "your own computer, then use commands like <command role=\"hg-cmd\">hg clone</"
|
dongsheng@627
|
6328 "command>, <command role=\"hg-cmd\">hg incoming</command>, and so on to talk "
|
dongsheng@627
|
6329 "to that server as if the repository was hosted remotely. This can help you to "
|
dongsheng@627
|
6330 "quickly get acquainted with using commands on network-hosted repositories."
|
dongsheng@627
|
6331 msgstr ""
|
dongsheng@627
|
6332
|
dongsheng@627
|
6333 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
6334 #: ../en/ch06-collab.xml:472
|
dongsheng@627
|
6335 msgid "A few things to keep in mind"
|
dongsheng@630
|
6336 msgstr "要牢记的几件事"
|
dongsheng@627
|
6337
|
dongsheng@627
|
6338 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6339 #: ../en/ch06-collab.xml:474
|
dongsheng@627
|
6340 msgid ""
|
dongsheng@627
|
6341 "Because it provides unauthenticated read access to all clients, you should "
|
dongsheng@627
|
6342 "only use <command role=\"hg-cmd\">hg serve</command> in an environment where "
|
dongsheng@627
|
6343 "you either don't care, or have complete control over, who can access your "
|
dongsheng@627
|
6344 "network and pull data from your repository."
|
dongsheng@627
|
6345 msgstr ""
|
dongsheng@627
|
6346
|
dongsheng@627
|
6347 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6348 #: ../en/ch06-collab.xml:480
|
dongsheng@627
|
6349 msgid ""
|
dongsheng@627
|
6350 "The <command role=\"hg-cmd\">hg serve</command> command knows nothing about "
|
dongsheng@627
|
6351 "any firewall software you might have installed on your system or network. It "
|
dongsheng@627
|
6352 "cannot detect or control your firewall software. If other people are unable "
|
dongsheng@627
|
6353 "to talk to a running <command role=\"hg-cmd\">hg serve</command> instance, "
|
dongsheng@627
|
6354 "the second thing you should do (<emphasis>after</emphasis> you make sure that "
|
dongsheng@627
|
6355 "they're using the correct URL) is check your firewall configuration."
|
dongsheng@627
|
6356 msgstr ""
|
dongsheng@627
|
6357
|
dongsheng@627
|
6358 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6359 #: ../en/ch06-collab.xml:489
|
dongsheng@627
|
6360 msgid ""
|
dongsheng@627
|
6361 "By default, <command role=\"hg-cmd\">hg serve</command> listens for incoming "
|
dongsheng@627
|
6362 "connections on port 8000. If another process is already listening on the "
|
dongsheng@627
|
6363 "port you want to use, you can specify a different port to listen on using the "
|
dongsheng@627
|
6364 "<option role=\"hg-opt-serve\">-p</option> option."
|
dongsheng@627
|
6365 msgstr ""
|
dongsheng@627
|
6366
|
dongsheng@627
|
6367 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6368 #: ../en/ch06-collab.xml:495
|
dongsheng@627
|
6369 msgid ""
|
dongsheng@627
|
6370 "Normally, when <command role=\"hg-cmd\">hg serve</command> starts, it prints "
|
dongsheng@627
|
6371 "no output, which can be a bit unnerving. If you'd like to confirm that it is "
|
dongsheng@627
|
6372 "indeed running correctly, and find out what URL you should send to your "
|
dongsheng@627
|
6373 "collaborators, start it with the <option role=\"hg-opt-global\">-v</option> "
|
dongsheng@627
|
6374 "option."
|
dongsheng@627
|
6375 msgstr ""
|
dongsheng@627
|
6376
|
dongsheng@627
|
6377 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
6378 #: ../en/ch06-collab.xml:505
|
dongsheng@627
|
6379 msgid "Using the Secure Shell (ssh) protocol"
|
dongsheng@630
|
6380 msgstr "使用 ssh 协议"
|
dongsheng@627
|
6381
|
dongsheng@627
|
6382 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
6383 #: ../en/ch06-collab.xml:507
|
dongsheng@627
|
6384 msgid ""
|
dongsheng@627
|
6385 "You can pull and push changes securely over a network connection using the "
|
dongsheng@627
|
6386 "Secure Shell (<literal>ssh</literal>) protocol. To use this successfully, "
|
dongsheng@627
|
6387 "you may have to do a little bit of configuration on the client or server "
|
dongsheng@627
|
6388 "sides."
|
dongsheng@627
|
6389 msgstr ""
|
dongsheng@627
|
6390
|
dongsheng@627
|
6391 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
6392 #: ../en/ch06-collab.xml:512
|
dongsheng@627
|
6393 msgid ""
|
dongsheng@627
|
6394 "If you're not familiar with ssh, it's a network protocol that lets you "
|
dongsheng@627
|
6395 "securely communicate with another computer. To use it with Mercurial, you'll "
|
dongsheng@627
|
6396 "be setting up one or more user accounts on a server so that remote users can "
|
dongsheng@627
|
6397 "log in and execute commands."
|
dongsheng@627
|
6398 msgstr ""
|
dongsheng@627
|
6399
|
dongsheng@627
|
6400 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
6401 #: ../en/ch06-collab.xml:518
|
dongsheng@627
|
6402 msgid ""
|
dongsheng@627
|
6403 "(If you <emphasis>are</emphasis> familiar with ssh, you'll probably find some "
|
dongsheng@627
|
6404 "of the material that follows to be elementary in nature.)"
|
dongsheng@627
|
6405 msgstr ""
|
dongsheng@627
|
6406
|
dongsheng@627
|
6407 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
6408 #: ../en/ch06-collab.xml:523
|
dongsheng@627
|
6409 msgid "How to read and write ssh URLs"
|
dongsheng@630
|
6410 msgstr "如何读写 ssh 路径"
|
dongsheng@627
|
6411
|
dongsheng@627
|
6412 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6413 #: ../en/ch06-collab.xml:525
|
dongsheng@627
|
6414 msgid "An ssh URL tends to look like this:"
|
dongsheng@627
|
6415 msgstr ""
|
dongsheng@627
|
6416
|
dongsheng@627
|
6417 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
6418 #: ../en/ch06-collab.xml:528
|
dongsheng@627
|
6419 msgid ""
|
dongsheng@627
|
6420 "The <quote><literal>ssh://</literal></quote> part tells Mercurial to use the "
|
dongsheng@627
|
6421 "ssh protocol."
|
dongsheng@627
|
6422 msgstr ""
|
dongsheng@627
|
6423
|
dongsheng@627
|
6424 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
6425 #: ../en/ch06-collab.xml:531
|
dongsheng@627
|
6426 msgid ""
|
dongsheng@627
|
6427 "The <quote><literal>bos@</literal></quote> component indicates what username "
|
dongsheng@627
|
6428 "to log into the server as. You can leave this out if the remote username is "
|
dongsheng@627
|
6429 "the same as your local username."
|
dongsheng@627
|
6430 msgstr ""
|
dongsheng@627
|
6431
|
dongsheng@627
|
6432 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
6433 #: ../en/ch06-collab.xml:536
|
dongsheng@627
|
6434 msgid ""
|
dongsheng@627
|
6435 "The <quote><literal>hg.serpentine.com</literal></quote> gives the hostname of "
|
dongsheng@627
|
6436 "the server to log into."
|
dongsheng@627
|
6437 msgstr ""
|
dongsheng@627
|
6438
|
dongsheng@627
|
6439 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
6440 #: ../en/ch06-collab.xml:540
|
dongsheng@627
|
6441 msgid ""
|
dongsheng@627
|
6442 "The <quote>:22</quote> identifies the port number to connect to the server "
|
dongsheng@627
|
6443 "on. The default port is 22, so you only need to specify this part if you're "
|
dongsheng@627
|
6444 "<emphasis>not</emphasis> using port 22."
|
dongsheng@627
|
6445 msgstr ""
|
dongsheng@627
|
6446
|
dongsheng@627
|
6447 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
6448 #: ../en/ch06-collab.xml:545
|
dongsheng@627
|
6449 msgid ""
|
dongsheng@627
|
6450 "The remainder of the URL is the local path to the repository on the server."
|
dongsheng@627
|
6451 msgstr ""
|
dongsheng@627
|
6452
|
dongsheng@627
|
6453 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6454 #: ../en/ch06-collab.xml:549
|
dongsheng@627
|
6455 msgid ""
|
dongsheng@627
|
6456 "There's plenty of scope for confusion with the path component of ssh URLs, as "
|
dongsheng@627
|
6457 "there is no standard way for tools to interpret it. Some programs behave "
|
dongsheng@627
|
6458 "differently than others when dealing with these paths. This isn't an ideal "
|
dongsheng@627
|
6459 "situation, but it's unlikely to change. Please read the following paragraphs "
|
dongsheng@627
|
6460 "carefully."
|
dongsheng@627
|
6461 msgstr ""
|
dongsheng@627
|
6462
|
dongsheng@627
|
6463 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6464 #: ../en/ch06-collab.xml:556
|
dongsheng@627
|
6465 msgid ""
|
dongsheng@627
|
6466 "Mercurial treats the path to a repository on the server as relative to the "
|
dongsheng@627
|
6467 "remote user's home directory. For example, if user <literal>foo</literal> on "
|
dongsheng@627
|
6468 "the server has a home directory of <filename class=\"directory\">/home/foo</"
|
dongsheng@627
|
6469 "filename>, then an ssh URL that contains a path component of <filename class="
|
dongsheng@627
|
6470 "\"directory\">bar</filename> <emphasis>really</emphasis> refers to the "
|
dongsheng@627
|
6471 "directory <filename class=\"directory\">/home/foo/bar</filename>."
|
dongsheng@627
|
6472 msgstr ""
|
dongsheng@627
|
6473
|
dongsheng@627
|
6474 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6475 #: ../en/ch06-collab.xml:565
|
dongsheng@627
|
6476 msgid ""
|
dongsheng@627
|
6477 "If you want to specify a path relative to another user's home directory, you "
|
dongsheng@627
|
6478 "can use a path that starts with a tilde character followed by the user's name "
|
dongsheng@627
|
6479 "(let's call them <literal>otheruser</literal>), like this."
|
dongsheng@627
|
6480 msgstr ""
|
dongsheng@627
|
6481
|
dongsheng@627
|
6482 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6483 #: ../en/ch06-collab.xml:571
|
dongsheng@627
|
6484 msgid ""
|
dongsheng@627
|
6485 "And if you really want to specify an <emphasis>absolute</emphasis> path on "
|
dongsheng@627
|
6486 "the server, begin the path component with two slashes, as in this example."
|
dongsheng@627
|
6487 msgstr ""
|
dongsheng@627
|
6488
|
dongsheng@627
|
6489 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
6490 #: ../en/ch06-collab.xml:578
|
dongsheng@627
|
6491 msgid "Finding an ssh client for your system"
|
dongsheng@630
|
6492 msgstr "为你的系统寻找 ssh 客户端"
|
dongsheng@627
|
6493
|
dongsheng@627
|
6494 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6495 #: ../en/ch06-collab.xml:580
|
dongsheng@627
|
6496 msgid ""
|
dongsheng@627
|
6497 "Almost every Unix-like system comes with OpenSSH preinstalled. If you're "
|
dongsheng@627
|
6498 "using such a system, run <literal>which ssh</literal> to find out if the "
|
dongsheng@627
|
6499 "<command>ssh</command> command is installed (it's usually in <filename class="
|
dongsheng@627
|
6500 "\"directory\">/usr/bin</filename>). In the unlikely event that it isn't "
|
dongsheng@627
|
6501 "present, take a look at your system documentation to figure out how to "
|
dongsheng@627
|
6502 "install it."
|
dongsheng@627
|
6503 msgstr ""
|
dongsheng@627
|
6504
|
dongsheng@627
|
6505 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6506 #: ../en/ch06-collab.xml:588
|
dongsheng@627
|
6507 msgid ""
|
dongsheng@627
|
6508 "On Windows, you'll first need to download a suitable ssh client. There are "
|
dongsheng@627
|
6509 "two alternatives."
|
dongsheng@627
|
6510 msgstr ""
|
dongsheng@627
|
6511
|
dongsheng@627
|
6512 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
6513 #: ../en/ch06-collab.xml:591
|
dongsheng@627
|
6514 msgid ""
|
dongsheng@627
|
6515 "Simon Tatham's excellent PuTTY package <citation>web:putty</citation> "
|
dongsheng@627
|
6516 "provides a complete suite of ssh client commands."
|
dongsheng@627
|
6517 msgstr ""
|
dongsheng@627
|
6518
|
dongsheng@627
|
6519 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
6520 #: ../en/ch06-collab.xml:595
|
dongsheng@627
|
6521 msgid ""
|
dongsheng@627
|
6522 "If you have a high tolerance for pain, you can use the Cygwin port of OpenSSH."
|
dongsheng@627
|
6523 msgstr ""
|
dongsheng@627
|
6524
|
dongsheng@627
|
6525 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6526 #: ../en/ch06-collab.xml:598
|
dongsheng@627
|
6527 msgid ""
|
dongsheng@627
|
6528 "In either case, you'll need to edit your \\hgini\\ file to tell Mercurial "
|
dongsheng@627
|
6529 "where to find the actual client command. For example, if you're using PuTTY, "
|
dongsheng@627
|
6530 "you'll need to use the <command>plink</command> command as a command-line ssh "
|
dongsheng@627
|
6531 "client."
|
dongsheng@627
|
6532 msgstr ""
|
dongsheng@627
|
6533
|
dongsheng@627
|
6534 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@641
|
6535 #: ../en/ch06-collab.xml:607
|
dongsheng@627
|
6536 msgid ""
|
dongsheng@627
|
6537 "The path to <command>plink</command> shouldn't contain any whitespace "
|
dongsheng@627
|
6538 "characters, or Mercurial may not be able to run it correctly (so putting it "
|
dongsheng@627
|
6539 "in <filename class=\"directory\">C:\\\\Program Files</filename> is probably "
|
dongsheng@627
|
6540 "not a good idea)."
|
dongsheng@627
|
6541 msgstr ""
|
dongsheng@627
|
6542
|
dongsheng@627
|
6543 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
6544 #: ../en/ch06-collab.xml:616
|
dongsheng@627
|
6545 msgid "Generating a key pair"
|
dongsheng@630
|
6546 msgstr "产生密钥对"
|
dongsheng@627
|
6547
|
dongsheng@627
|
6548 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6549 #: ../en/ch06-collab.xml:618
|
dongsheng@627
|
6550 msgid ""
|
dongsheng@627
|
6551 "To avoid the need to repetitively type a password every time you need to use "
|
dongsheng@627
|
6552 "your ssh client, I recommend generating a key pair. On a Unix-like system, "
|
dongsheng@627
|
6553 "the <command>ssh-keygen</command> command will do the trick. On Windows, if "
|
dongsheng@627
|
6554 "you're using PuTTY, the <command>puttygen</command> command is what you'll "
|
dongsheng@627
|
6555 "need."
|
dongsheng@627
|
6556 msgstr ""
|
dongsheng@627
|
6557
|
dongsheng@627
|
6558 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6559 #: ../en/ch06-collab.xml:626
|
dongsheng@627
|
6560 msgid ""
|
dongsheng@627
|
6561 "When you generate a key pair, it's usually <emphasis>highly</emphasis> "
|
dongsheng@627
|
6562 "advisable to protect it with a passphrase. (The only time that you might not "
|
dongsheng@627
|
6563 "want to do this is when you're using the ssh protocol for automated tasks on "
|
dongsheng@627
|
6564 "a secure network.)"
|
dongsheng@627
|
6565 msgstr ""
|
dongsheng@627
|
6566
|
dongsheng@627
|
6567 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6568 #: ../en/ch06-collab.xml:632
|
dongsheng@627
|
6569 msgid ""
|
dongsheng@627
|
6570 "Simply generating a key pair isn't enough, however. You'll need to add the "
|
dongsheng@627
|
6571 "public key to the set of authorised keys for whatever user you're logging in "
|
dongsheng@627
|
6572 "remotely as. For servers using OpenSSH (the vast majority), this will mean "
|
dongsheng@627
|
6573 "adding the public key to a list in a file called <filename role=\"special"
|
dongsheng@627
|
6574 "\">authorized_keys</filename> in their <filename role=\"special\" class="
|
dongsheng@627
|
6575 "\"directory\">.ssh</filename> directory."
|
dongsheng@627
|
6576 msgstr ""
|
dongsheng@627
|
6577
|
dongsheng@627
|
6578 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6579 #: ../en/ch06-collab.xml:641
|
dongsheng@627
|
6580 msgid ""
|
dongsheng@627
|
6581 "On a Unix-like system, your public key will have a <filename>.pub</filename> "
|
dongsheng@627
|
6582 "extension. If you're using <command>puttygen</command> on Windows, you can "
|
dongsheng@627
|
6583 "save the public key to a file of your choosing, or paste it from the window "
|
dongsheng@627
|
6584 "it's displayed in straight into the <filename role=\"special"
|
dongsheng@627
|
6585 "\">authorized_keys</filename> file."
|
dongsheng@627
|
6586 msgstr ""
|
dongsheng@627
|
6587
|
dongsheng@627
|
6588 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
6589 #: ../en/ch06-collab.xml:650
|
dongsheng@627
|
6590 msgid "Using an authentication agent"
|
dongsheng@630
|
6591 msgstr "使用认证代理"
|
dongsheng@627
|
6592
|
dongsheng@627
|
6593 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6594 #: ../en/ch06-collab.xml:652
|
dongsheng@627
|
6595 msgid ""
|
dongsheng@627
|
6596 "An authentication agent is a daemon that stores passphrases in memory (so it "
|
dongsheng@627
|
6597 "will forget passphrases if you log out and log back in again). An ssh client "
|
dongsheng@627
|
6598 "will notice if it's running, and query it for a passphrase. If there's no "
|
dongsheng@627
|
6599 "authentication agent running, or the agent doesn't store the necessary "
|
dongsheng@627
|
6600 "passphrase, you'll have to type your passphrase every time Mercurial tries to "
|
dongsheng@627
|
6601 "communicate with a server on your behalf (e.g. whenever you pull or push "
|
dongsheng@627
|
6602 "changes)."
|
dongsheng@627
|
6603 msgstr ""
|
dongsheng@627
|
6604
|
dongsheng@627
|
6605 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6606 #: ../en/ch06-collab.xml:661
|
dongsheng@627
|
6607 msgid ""
|
dongsheng@627
|
6608 "The downside of storing passphrases in an agent is that it's possible for a "
|
dongsheng@627
|
6609 "well-prepared attacker to recover the plain text of your passphrases, in some "
|
dongsheng@627
|
6610 "cases even if your system has been power-cycled. You should make your own "
|
dongsheng@627
|
6611 "judgment as to whether this is an acceptable risk. It certainly saves a lot "
|
dongsheng@627
|
6612 "of repeated typing."
|
dongsheng@627
|
6613 msgstr ""
|
dongsheng@627
|
6614
|
dongsheng@627
|
6615 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6616 #: ../en/ch06-collab.xml:668
|
dongsheng@627
|
6617 msgid ""
|
dongsheng@627
|
6618 "On Unix-like systems, the agent is called <command>ssh-agent</command>, and "
|
dongsheng@627
|
6619 "it's often run automatically for you when you log in. You'll need to use the "
|
dongsheng@627
|
6620 "<command>ssh-add</command> command to add passphrases to the agent's store. "
|
dongsheng@627
|
6621 "On Windows, if you're using PuTTY, the <command>pageant</command> command "
|
dongsheng@627
|
6622 "acts as the agent. It adds an icon to your system tray that will let you "
|
dongsheng@627
|
6623 "manage stored passphrases."
|
dongsheng@627
|
6624 msgstr ""
|
dongsheng@627
|
6625
|
dongsheng@627
|
6626 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
6627 #: ../en/ch06-collab.xml:679
|
dongsheng@627
|
6628 msgid "Configuring the server side properly"
|
dongsheng@630
|
6629 msgstr "正确配置服务器端"
|
dongsheng@627
|
6630
|
dongsheng@627
|
6631 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6632 #: ../en/ch06-collab.xml:681
|
dongsheng@627
|
6633 msgid ""
|
dongsheng@627
|
6634 "Because ssh can be fiddly to set up if you're new to it, there's a variety of "
|
dongsheng@627
|
6635 "things that can go wrong. Add Mercurial on top, and there's plenty more "
|
dongsheng@627
|
6636 "scope for head-scratching. Most of these potential problems occur on the "
|
dongsheng@627
|
6637 "server side, not the client side. The good news is that once you've gotten a "
|
dongsheng@627
|
6638 "configuration working, it will usually continue to work indefinitely."
|
dongsheng@627
|
6639 msgstr ""
|
dongsheng@627
|
6640
|
dongsheng@627
|
6641 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6642 #: ../en/ch06-collab.xml:689
|
dongsheng@627
|
6643 msgid ""
|
dongsheng@627
|
6644 "Before you try using Mercurial to talk to an ssh server, it's best to make "
|
dongsheng@627
|
6645 "sure that you can use the normal <command>ssh</command> or <command>putty</"
|
dongsheng@627
|
6646 "command> command to talk to the server first. If you run into problems with "
|
dongsheng@627
|
6647 "using these commands directly, Mercurial surely won't work. Worse, it will "
|
dongsheng@627
|
6648 "obscure the underlying problem. Any time you want to debug ssh-related "
|
dongsheng@627
|
6649 "Mercurial problems, you should drop back to making sure that plain ssh client "
|
dongsheng@627
|
6650 "commands work first, <emphasis>before</emphasis> you worry about whether "
|
dongsheng@627
|
6651 "there's a problem with Mercurial."
|
dongsheng@627
|
6652 msgstr ""
|
dongsheng@627
|
6653
|
dongsheng@627
|
6654 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6655 #: ../en/ch06-collab.xml:700
|
dongsheng@627
|
6656 msgid ""
|
dongsheng@627
|
6657 "The first thing to be sure of on the server side is that you can actually log "
|
dongsheng@627
|
6658 "in from another machine at all. If you can't use <command>ssh</command> or "
|
dongsheng@627
|
6659 "<command>putty</command> to log in, the error message you get may give you a "
|
dongsheng@627
|
6660 "few hints as to what's wrong. The most common problems are as follows."
|
dongsheng@627
|
6661 msgstr ""
|
dongsheng@627
|
6662
|
dongsheng@627
|
6663 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
6664 #: ../en/ch06-collab.xml:707
|
dongsheng@627
|
6665 msgid ""
|
dongsheng@627
|
6666 "If you get a <quote>connection refused</quote> error, either there isn't an "
|
dongsheng@627
|
6667 "SSH daemon running on the server at all, or it's inaccessible due to firewall "
|
dongsheng@627
|
6668 "configuration."
|
dongsheng@627
|
6669 msgstr ""
|
dongsheng@627
|
6670
|
dongsheng@627
|
6671 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
6672 #: ../en/ch06-collab.xml:712
|
dongsheng@627
|
6673 msgid ""
|
dongsheng@627
|
6674 "If you get a <quote>no route to host</quote> error, you either have an "
|
dongsheng@627
|
6675 "incorrect address for the server or a seriously locked down firewall that "
|
dongsheng@627
|
6676 "won't admit its existence at all."
|
dongsheng@627
|
6677 msgstr ""
|
dongsheng@627
|
6678
|
dongsheng@627
|
6679 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
6680 #: ../en/ch06-collab.xml:717
|
dongsheng@627
|
6681 msgid ""
|
dongsheng@627
|
6682 "If you get a <quote>permission denied</quote> error, you may have mistyped "
|
dongsheng@627
|
6683 "the username on the server, or you could have mistyped your key's passphrase "
|
dongsheng@627
|
6684 "or the remote user's password."
|
dongsheng@627
|
6685 msgstr ""
|
dongsheng@627
|
6686
|
dongsheng@627
|
6687 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6688 #: ../en/ch06-collab.xml:722
|
dongsheng@627
|
6689 msgid ""
|
dongsheng@627
|
6690 "In summary, if you're having trouble talking to the server's ssh daemon, "
|
dongsheng@627
|
6691 "first make sure that one is running at all. On many systems it will be "
|
dongsheng@627
|
6692 "installed, but disabled, by default. Once you're done with this step, you "
|
dongsheng@627
|
6693 "should then check that the server's firewall is configured to allow incoming "
|
dongsheng@627
|
6694 "connections on the port the ssh daemon is listening on (usually 22). Don't "
|
dongsheng@627
|
6695 "worry about more exotic possibilities for misconfiguration until you've "
|
dongsheng@627
|
6696 "checked these two first."
|
dongsheng@627
|
6697 msgstr ""
|
dongsheng@627
|
6698
|
dongsheng@627
|
6699 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6700 #: ../en/ch06-collab.xml:732
|
dongsheng@627
|
6701 msgid ""
|
dongsheng@627
|
6702 "If you're using an authentication agent on the client side to store "
|
dongsheng@627
|
6703 "passphrases for your keys, you ought to be able to log into the server "
|
dongsheng@627
|
6704 "without being prompted for a passphrase or a password. If you're prompted "
|
dongsheng@627
|
6705 "for a passphrase, there are a few possible culprits."
|
dongsheng@627
|
6706 msgstr ""
|
dongsheng@627
|
6707
|
dongsheng@627
|
6708 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
6709 #: ../en/ch06-collab.xml:738
|
dongsheng@627
|
6710 msgid ""
|
dongsheng@627
|
6711 "You might have forgotten to use <command>ssh-add</command> or "
|
dongsheng@627
|
6712 "<command>pageant</command> to store the passphrase."
|
dongsheng@627
|
6713 msgstr ""
|
dongsheng@627
|
6714
|
dongsheng@627
|
6715 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
6716 #: ../en/ch06-collab.xml:742
|
dongsheng@627
|
6717 msgid "You might have stored the passphrase for the wrong key."
|
dongsheng@627
|
6718 msgstr ""
|
dongsheng@627
|
6719
|
dongsheng@627
|
6720 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6721 #: ../en/ch06-collab.xml:745
|
dongsheng@627
|
6722 msgid ""
|
dongsheng@627
|
6723 "If you're being prompted for the remote user's password, there are another "
|
dongsheng@627
|
6724 "few possible problems to check."
|
dongsheng@627
|
6725 msgstr ""
|
dongsheng@627
|
6726
|
dongsheng@627
|
6727 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
6728 #: ../en/ch06-collab.xml:748
|
dongsheng@627
|
6729 msgid ""
|
dongsheng@627
|
6730 "Either the user's home directory or their <filename role=\"special\" class="
|
dongsheng@627
|
6731 "\"directory\">.ssh</filename> directory might have excessively liberal "
|
dongsheng@627
|
6732 "permissions. As a result, the ssh daemon will not trust or read their "
|
dongsheng@627
|
6733 "<filename role=\"special\">authorized_keys</filename> file. For example, a "
|
dongsheng@627
|
6734 "group-writable home or <filename role=\"special\" class=\"directory\">.ssh</"
|
dongsheng@627
|
6735 "filename> directory will often cause this symptom."
|
dongsheng@627
|
6736 msgstr ""
|
dongsheng@627
|
6737
|
dongsheng@627
|
6738 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
6739 #: ../en/ch06-collab.xml:757
|
dongsheng@627
|
6740 msgid ""
|
dongsheng@627
|
6741 "The user's <filename role=\"special\">authorized_keys</filename> file may "
|
dongsheng@627
|
6742 "have a problem. If anyone other than the user owns or can write to that file, "
|
dongsheng@627
|
6743 "the ssh daemon will not trust or read it."
|
dongsheng@627
|
6744 msgstr ""
|
dongsheng@627
|
6745
|
dongsheng@627
|
6746 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6747 #: ../en/ch06-collab.xml:764
|
dongsheng@627
|
6748 msgid ""
|
dongsheng@627
|
6749 "In the ideal world, you should be able to run the following command "
|
dongsheng@627
|
6750 "successfully, and it should print exactly one line of output, the current "
|
dongsheng@627
|
6751 "date and time."
|
dongsheng@627
|
6752 msgstr ""
|
dongsheng@627
|
6753
|
dongsheng@627
|
6754 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6755 #: ../en/ch06-collab.xml:769
|
dongsheng@627
|
6756 msgid ""
|
dongsheng@627
|
6757 "If, on your server, you have login scripts that print banners or other junk "
|
dongsheng@627
|
6758 "even when running non-interactive commands like this, you should fix them "
|
dongsheng@627
|
6759 "before you continue, so that they only print output if they're run "
|
dongsheng@627
|
6760 "interactively. Otherwise these banners will at least clutter up Mercurial's "
|
dongsheng@627
|
6761 "output. Worse, they could potentially cause problems with running Mercurial "
|
dongsheng@627
|
6762 "commands remotely. Mercurial makes tries to detect and ignore banners in non-"
|
dongsheng@627
|
6763 "interactive <command>ssh</command> sessions, but it is not foolproof. (If "
|
dongsheng@627
|
6764 "you're editing your login scripts on your server, the usual way to see if a "
|
dongsheng@627
|
6765 "login script is running in an interactive shell is to check the return code "
|
dongsheng@627
|
6766 "from the command <literal>tty -s</literal>.)"
|
dongsheng@627
|
6767 msgstr ""
|
dongsheng@627
|
6768
|
dongsheng@627
|
6769 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6770 #: ../en/ch06-collab.xml:783
|
dongsheng@627
|
6771 msgid ""
|
dongsheng@627
|
6772 "Once you've verified that plain old ssh is working with your server, the next "
|
dongsheng@627
|
6773 "step is to ensure that Mercurial runs on the server. The following command "
|
dongsheng@627
|
6774 "should run successfully:"
|
dongsheng@627
|
6775 msgstr ""
|
dongsheng@627
|
6776
|
dongsheng@627
|
6777 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6778 #: ../en/ch06-collab.xml:788
|
dongsheng@627
|
6779 msgid ""
|
dongsheng@627
|
6780 "If you see an error message instead of normal <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
6781 "version</command> output, this is usually because you haven't installed "
|
dongsheng@627
|
6782 "Mercurial to <filename class=\"directory\">/usr/bin</filename>. Don't worry "
|
dongsheng@627
|
6783 "if this is the case; you don't need to do that. But you should check for a "
|
dongsheng@627
|
6784 "few possible problems."
|
dongsheng@627
|
6785 msgstr ""
|
dongsheng@627
|
6786
|
dongsheng@627
|
6787 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
6788 #: ../en/ch06-collab.xml:795
|
dongsheng@627
|
6789 msgid ""
|
dongsheng@627
|
6790 "Is Mercurial really installed on the server at all? I know this sounds "
|
dongsheng@627
|
6791 "trivial, but it's worth checking!"
|
dongsheng@627
|
6792 msgstr ""
|
dongsheng@627
|
6793
|
dongsheng@627
|
6794 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
6795 #: ../en/ch06-collab.xml:799
|
dongsheng@627
|
6796 msgid ""
|
dongsheng@627
|
6797 "Maybe your shell's search path (usually set via the <envar>PATH</envar> "
|
dongsheng@627
|
6798 "environment variable) is simply misconfigured."
|
dongsheng@627
|
6799 msgstr ""
|
dongsheng@627
|
6800
|
dongsheng@627
|
6801 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
6802 #: ../en/ch06-collab.xml:803
|
dongsheng@627
|
6803 msgid ""
|
dongsheng@627
|
6804 "Perhaps your <envar>PATH</envar> environment variable is only being set to "
|
dongsheng@627
|
6805 "point to the location of the <command>hg</command> executable if the login "
|
dongsheng@627
|
6806 "session is interactive. This can happen if you're setting the path in the "
|
dongsheng@627
|
6807 "wrong shell login script. See your shell's documentation for details."
|
dongsheng@627
|
6808 msgstr ""
|
dongsheng@627
|
6809
|
dongsheng@627
|
6810 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
6811 #: ../en/ch06-collab.xml:810
|
dongsheng@627
|
6812 msgid ""
|
dongsheng@627
|
6813 "The <envar>PYTHONPATH</envar> environment variable may need to contain the "
|
dongsheng@627
|
6814 "path to the Mercurial Python modules. It might not be set at all; it could "
|
dongsheng@627
|
6815 "be incorrect; or it may be set only if the login is interactive."
|
dongsheng@627
|
6816 msgstr ""
|
dongsheng@627
|
6817
|
dongsheng@627
|
6818 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6819 #: ../en/ch06-collab.xml:817
|
dongsheng@627
|
6820 msgid ""
|
dongsheng@627
|
6821 "If you can run <command role=\"hg-cmd\">hg version</command> over an ssh "
|
dongsheng@627
|
6822 "connection, well done! You've got the server and client sorted out. You "
|
dongsheng@627
|
6823 "should now be able to use Mercurial to access repositories hosted by that "
|
dongsheng@627
|
6824 "username on that server. If you run into problems with Mercurial and ssh at "
|
dongsheng@627
|
6825 "this point, try using the <option role=\"hg-opt-global\">--debug</option> "
|
dongsheng@627
|
6826 "option to get a clearer picture of what's going on."
|
dongsheng@627
|
6827 msgstr ""
|
dongsheng@627
|
6828
|
dongsheng@627
|
6829 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
6830 #: ../en/ch06-collab.xml:827
|
dongsheng@627
|
6831 msgid "Using compression with ssh"
|
dongsheng@630
|
6832 msgstr "通过 ssh 使用压缩"
|
dongsheng@627
|
6833
|
dongsheng@627
|
6834 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6835 #: ../en/ch06-collab.xml:829
|
dongsheng@627
|
6836 msgid ""
|
dongsheng@627
|
6837 "Mercurial does not compress data when it uses the ssh protocol, because the "
|
dongsheng@627
|
6838 "ssh protocol can transparently compress data. However, the default behaviour "
|
dongsheng@627
|
6839 "of ssh clients is <emphasis>not</emphasis> to request compression."
|
dongsheng@627
|
6840 msgstr ""
|
dongsheng@627
|
6841
|
dongsheng@627
|
6842 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6843 #: ../en/ch06-collab.xml:834
|
dongsheng@627
|
6844 msgid ""
|
dongsheng@627
|
6845 "Over any network other than a fast LAN (even a wireless network), using "
|
dongsheng@627
|
6846 "compression is likely to significantly speed up Mercurial's network "
|
dongsheng@627
|
6847 "operations. For example, over a WAN, someone measured compression as "
|
dongsheng@627
|
6848 "reducing the amount of time required to clone a particularly large repository "
|
dongsheng@627
|
6849 "from 51 minutes to 17 minutes."
|
dongsheng@627
|
6850 msgstr ""
|
dongsheng@627
|
6851
|
dongsheng@627
|
6852 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6853 #: ../en/ch06-collab.xml:841
|
dongsheng@627
|
6854 msgid ""
|
dongsheng@627
|
6855 "Both <command>ssh</command> and <command>plink</command> accept a <option "
|
dongsheng@627
|
6856 "role=\"cmd-opt-ssh\">-C</option> option which turns on compression. You can "
|
dongsheng@627
|
6857 "easily edit your <filename role=\"special\"> /.hgrc</filename>\\ to enable "
|
dongsheng@627
|
6858 "compression for all of Mercurial's uses of the ssh protocol."
|
dongsheng@627
|
6859 msgstr ""
|
dongsheng@627
|
6860
|
dongsheng@627
|
6861 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6862 #: ../en/ch06-collab.xml:848
|
dongsheng@627
|
6863 msgid ""
|
dongsheng@627
|
6864 "If you use <command>ssh</command>, you can configure it to always use "
|
dongsheng@627
|
6865 "compression when talking to your server. To do this, edit your <filename "
|
dongsheng@627
|
6866 "role=\"special\">.ssh/config</filename> file (which may not yet exist), as "
|
dongsheng@627
|
6867 "follows."
|
dongsheng@627
|
6868 msgstr ""
|
dongsheng@627
|
6869
|
dongsheng@627
|
6870 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6871 #: ../en/ch06-collab.xml:855
|
dongsheng@627
|
6872 msgid ""
|
dongsheng@627
|
6873 "This defines an alias, <literal>hg</literal>. When you use it on the "
|
dongsheng@627
|
6874 "<command>ssh</command> command line or in a Mercurial <literal>ssh</literal>-"
|
dongsheng@627
|
6875 "protocol URL, it will cause <command>ssh</command> to connect to <literal>hg."
|
dongsheng@627
|
6876 "example.com</literal> and use compression. This gives you both a shorter "
|
dongsheng@627
|
6877 "name to type and compression, each of which is a good thing in its own right."
|
dongsheng@627
|
6878 msgstr ""
|
dongsheng@627
|
6879
|
dongsheng@627
|
6880 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
6881 #: ../en/ch06-collab.xml:866
|
dongsheng@627
|
6882 msgid "Serving over HTTP using CGI"
|
dongsheng@630
|
6883 msgstr "使用 CGI 通过 HTTP 提供服务"
|
dongsheng@627
|
6884
|
dongsheng@627
|
6885 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
6886 #: ../en/ch06-collab.xml:868
|
dongsheng@627
|
6887 msgid ""
|
dongsheng@627
|
6888 "Depending on how ambitious you are, configuring Mercurial's CGI interface can "
|
dongsheng@627
|
6889 "take anything from a few moments to several hours."
|
dongsheng@627
|
6890 msgstr ""
|
dongsheng@627
|
6891
|
dongsheng@627
|
6892 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
6893 #: ../en/ch06-collab.xml:872
|
dongsheng@627
|
6894 msgid ""
|
dongsheng@627
|
6895 "We'll begin with the simplest of examples, and work our way towards a more "
|
dongsheng@627
|
6896 "complex configuration. Even for the most basic case, you're almost certainly "
|
dongsheng@627
|
6897 "going to need to read and modify your web server's configuration."
|
dongsheng@627
|
6898 msgstr ""
|
dongsheng@627
|
6899
|
dongsheng@627
|
6900 #. type: Content of: <book><chapter><sect1><note><para>
|
dongsheng@641
|
6901 #: ../en/ch06-collab.xml:878
|
dongsheng@627
|
6902 msgid ""
|
dongsheng@627
|
6903 "Configuring a web server is a complex, fiddly, and highly system-dependent "
|
dongsheng@627
|
6904 "activity. I can't possibly give you instructions that will cover anything "
|
dongsheng@627
|
6905 "like all of the cases you will encounter. Please use your discretion and "
|
dongsheng@627
|
6906 "judgment in following the sections below. Be prepared to make plenty of "
|
dongsheng@627
|
6907 "mistakes, and to spend a lot of time reading your server's error logs."
|
dongsheng@627
|
6908 msgstr ""
|
dongsheng@627
|
6909
|
dongsheng@627
|
6910 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
6911 #: ../en/ch06-collab.xml:888
|
dongsheng@627
|
6912 msgid "Web server configuration checklist"
|
dongsheng@630
|
6913 msgstr "Web 服务器配置检查表"
|
dongsheng@627
|
6914
|
dongsheng@627
|
6915 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6916 #: ../en/ch06-collab.xml:890
|
dongsheng@627
|
6917 msgid ""
|
dongsheng@627
|
6918 "Before you continue, do take a few moments to check a few aspects of your "
|
dongsheng@627
|
6919 "system's setup."
|
dongsheng@627
|
6920 msgstr ""
|
dongsheng@627
|
6921
|
dongsheng@627
|
6922 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
6923 #: ../en/ch06-collab.xml:894
|
dongsheng@627
|
6924 msgid ""
|
dongsheng@627
|
6925 "Do you have a web server installed at all? Mac OS X ships with Apache, but "
|
dongsheng@627
|
6926 "many other systems may not have a web server installed."
|
dongsheng@627
|
6927 msgstr ""
|
dongsheng@627
|
6928
|
dongsheng@627
|
6929 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
6930 #: ../en/ch06-collab.xml:898
|
dongsheng@627
|
6931 msgid ""
|
dongsheng@627
|
6932 "If you have a web server installed, is it actually running? On most systems, "
|
dongsheng@627
|
6933 "even if one is present, it will be disabled by default."
|
dongsheng@627
|
6934 msgstr ""
|
dongsheng@627
|
6935
|
dongsheng@627
|
6936 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
6937 #: ../en/ch06-collab.xml:902
|
dongsheng@627
|
6938 msgid ""
|
dongsheng@627
|
6939 "Is your server configured to allow you to run CGI programs in the directory "
|
dongsheng@627
|
6940 "where you plan to do so? Most servers default to explicitly disabling the "
|
dongsheng@627
|
6941 "ability to run CGI programs."
|
dongsheng@627
|
6942 msgstr ""
|
dongsheng@627
|
6943
|
dongsheng@627
|
6944 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6945 #: ../en/ch06-collab.xml:908
|
dongsheng@627
|
6946 msgid ""
|
dongsheng@627
|
6947 "If you don't have a web server installed, and don't have substantial "
|
dongsheng@627
|
6948 "experience configuring Apache, you should consider using the "
|
dongsheng@627
|
6949 "<literal>lighttpd</literal> web server instead of Apache. Apache has a well-"
|
dongsheng@627
|
6950 "deserved reputation for baroque and confusing configuration. While "
|
dongsheng@627
|
6951 "<literal>lighttpd</literal> is less capable in some ways than Apache, most of "
|
dongsheng@627
|
6952 "these capabilities are not relevant to serving Mercurial repositories. And "
|
dongsheng@627
|
6953 "<literal>lighttpd</literal> is undeniably <emphasis>much</emphasis> easier to "
|
dongsheng@627
|
6954 "get started with than Apache."
|
dongsheng@627
|
6955 msgstr ""
|
dongsheng@627
|
6956
|
dongsheng@627
|
6957 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
6958 #: ../en/ch06-collab.xml:921
|
dongsheng@627
|
6959 msgid "Basic CGI configuration"
|
dongsheng@630
|
6960 msgstr "基本 CGI 配置"
|
dongsheng@627
|
6961
|
dongsheng@627
|
6962 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6963 #: ../en/ch06-collab.xml:923
|
dongsheng@627
|
6964 msgid ""
|
dongsheng@627
|
6965 "On Unix-like systems, it's common for users to have a subdirectory named "
|
dongsheng@627
|
6966 "something like <filename class=\"directory\">public_html</filename> in their "
|
dongsheng@627
|
6967 "home directory, from which they can serve up web pages. A file named "
|
dongsheng@627
|
6968 "<filename>foo</filename> in this directory will be accessible at a URL of the "
|
dongsheng@627
|
6969 "form <literal>http://www.example.com/\\ {</literal>username/foo}."
|
dongsheng@627
|
6970 msgstr ""
|
dongsheng@627
|
6971
|
dongsheng@627
|
6972 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6973 #: ../en/ch06-collab.xml:932
|
dongsheng@627
|
6974 msgid ""
|
dongsheng@627
|
6975 "To get started, find the <filename role=\"special\">hgweb.cgi</filename> "
|
dongsheng@627
|
6976 "script that should be present in your Mercurial installation. If you can't "
|
dongsheng@627
|
6977 "quickly find a local copy on your system, simply download one from the master "
|
dongsheng@627
|
6978 "Mercurial repository at <ulink url=\"http://www.selenic.com/repo/hg/raw-file/"
|
dongsheng@627
|
6979 "tip/hgweb.cgi\">http://www.selenic.com/repo/hg/raw-file/tip/hgweb.cgi</ulink>."
|
dongsheng@627
|
6980 msgstr ""
|
dongsheng@627
|
6981
|
dongsheng@627
|
6982 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6983 #: ../en/ch06-collab.xml:939 ../en/ch06-collab.xml:1112
|
dongsheng@627
|
6984 msgid ""
|
dongsheng@627
|
6985 "You'll need to copy this script into your <filename class=\"directory"
|
dongsheng@627
|
6986 "\">public_html</filename> directory, and ensure that it's executable."
|
dongsheng@627
|
6987 msgstr ""
|
dongsheng@627
|
6988
|
dongsheng@627
|
6989 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
6990 #: ../en/ch06-collab.xml:944
|
dongsheng@627
|
6991 msgid ""
|
dongsheng@627
|
6992 "The <literal>755</literal> argument to <command>chmod</command> is a little "
|
dongsheng@627
|
6993 "more general than just making the script executable: it ensures that the "
|
dongsheng@627
|
6994 "script is executable by anyone, and that <quote>group</quote> and "
|
dongsheng@627
|
6995 "<quote>other</quote> write permissions are <emphasis>not</emphasis> set. If "
|
dongsheng@627
|
6996 "you were to leave those write permissions enabled, Apache's <literal>suexec</"
|
dongsheng@627
|
6997 "literal> subsystem would likely refuse to execute the script. In fact, "
|
dongsheng@627
|
6998 "<literal>suexec</literal> also insists that the <emphasis>directory</"
|
dongsheng@627
|
6999 "emphasis> in which the script resides must not be writable by others."
|
dongsheng@627
|
7000 msgstr ""
|
dongsheng@627
|
7001
|
dongsheng@627
|
7002 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@641
|
7003 #: ../en/ch06-collab.xml:958
|
dongsheng@627
|
7004 msgid "What could <emphasis>possibly</emphasis> go wrong?"
|
dongsheng@630
|
7005 msgstr "什么<emphasis>可能</emphasis>会出错?"
|
dongsheng@627
|
7006
|
dongsheng@627
|
7007 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
7008 #: ../en/ch06-collab.xml:961
|
dongsheng@627
|
7009 msgid ""
|
dongsheng@627
|
7010 "Once you've copied the CGI script into place, go into a web browser, and try "
|
dongsheng@627
|
7011 "to open the URL <ulink url=\"http://myhostname/ myuser/hgweb.cgi\">http://"
|
dongsheng@627
|
7012 "myhostname/ myuser/hgweb.cgi</ulink>, <emphasis>but</emphasis> brace yourself "
|
dongsheng@627
|
7013 "for instant failure. There's a high probability that trying to visit this "
|
dongsheng@627
|
7014 "URL will fail, and there are many possible reasons for this. In fact, you're "
|
dongsheng@627
|
7015 "likely to stumble over almost every one of the possible errors below, so "
|
dongsheng@627
|
7016 "please read carefully. The following are all of the problems I ran into on a "
|
dongsheng@627
|
7017 "system running Fedora 7, with a fresh installation of Apache, and a user "
|
dongsheng@627
|
7018 "account that I created specially to perform this exercise."
|
dongsheng@627
|
7019 msgstr ""
|
dongsheng@627
|
7020
|
dongsheng@627
|
7021 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
7022 #: ../en/ch06-collab.xml:975
|
dongsheng@627
|
7023 msgid ""
|
dongsheng@627
|
7024 "Your web server may have per-user directories disabled. If you're using "
|
dongsheng@627
|
7025 "Apache, search your config file for a <literal>UserDir</literal> directive. "
|
dongsheng@627
|
7026 "If there's none present, per-user directories will be disabled. If one "
|
dongsheng@627
|
7027 "exists, but its value is <literal>disabled</literal>, then per-user "
|
dongsheng@627
|
7028 "directories will be disabled. Otherwise, the string after <literal>UserDir</"
|
dongsheng@627
|
7029 "literal> gives the name of the subdirectory that Apache will look in under "
|
dongsheng@627
|
7030 "your home directory, for example <filename class=\"directory\">public_html</"
|
dongsheng@627
|
7031 "filename>."
|
dongsheng@627
|
7032 msgstr ""
|
dongsheng@627
|
7033
|
dongsheng@627
|
7034 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
7035 #: ../en/ch06-collab.xml:986
|
dongsheng@627
|
7036 msgid ""
|
dongsheng@627
|
7037 "Your file access permissions may be too restrictive. The web server must be "
|
dongsheng@627
|
7038 "able to traverse your home directory and directories under your <filename "
|
dongsheng@627
|
7039 "class=\"directory\">public_html</filename> directory, and read files under "
|
dongsheng@627
|
7040 "the latter too. Here's a quick recipe to help you to make your permissions "
|
dongsheng@627
|
7041 "more appropriate."
|
dongsheng@627
|
7042 msgstr ""
|
dongsheng@627
|
7043
|
dongsheng@627
|
7044 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
7045 #: ../en/ch06-collab.xml:996
|
dongsheng@627
|
7046 msgid ""
|
dongsheng@627
|
7047 "The other possibility with permissions is that you might get a completely "
|
dongsheng@627
|
7048 "empty window when you try to load the script. In this case, it's likely that "
|
dongsheng@627
|
7049 "your access permissions are <emphasis>too permissive</emphasis>. Apache's "
|
dongsheng@627
|
7050 "<literal>suexec</literal> subsystem won't execute a script that's group- or "
|
dongsheng@627
|
7051 "world-writable, for example."
|
dongsheng@627
|
7052 msgstr ""
|
dongsheng@627
|
7053
|
dongsheng@627
|
7054 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
7055 #: ../en/ch06-collab.xml:1003
|
dongsheng@627
|
7056 msgid ""
|
dongsheng@627
|
7057 "Your web server may be configured to disallow execution of CGI programs in "
|
dongsheng@627
|
7058 "your per-user web directory. Here's Apache's default per-user configuration "
|
dongsheng@627
|
7059 "from my Fedora system."
|
dongsheng@627
|
7060 msgstr ""
|
dongsheng@627
|
7061
|
dongsheng@627
|
7062 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
7063 #: ../en/ch06-collab.xml:1014
|
dongsheng@627
|
7064 msgid ""
|
dongsheng@627
|
7065 "If you find a similar-looking <literal>Directory</literal> group in your "
|
dongsheng@627
|
7066 "Apache configuration, the directive to look at inside it is <literal>Options</"
|
dongsheng@627
|
7067 "literal>. Add <literal>ExecCGI</literal> to the end of this list if it's "
|
dongsheng@627
|
7068 "missing, and restart the web server."
|
dongsheng@627
|
7069 msgstr ""
|
dongsheng@627
|
7070
|
dongsheng@627
|
7071 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
7072 #: ../en/ch06-collab.xml:1021
|
dongsheng@627
|
7073 msgid ""
|
dongsheng@627
|
7074 "If you find that Apache serves you the text of the CGI script instead of "
|
dongsheng@627
|
7075 "executing it, you may need to either uncomment (if already present) or add a "
|
dongsheng@627
|
7076 "directive like this."
|
dongsheng@627
|
7077 msgstr ""
|
dongsheng@627
|
7078
|
dongsheng@627
|
7079 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
7080 #: ../en/ch06-collab.xml:1027
|
dongsheng@627
|
7081 msgid ""
|
dongsheng@627
|
7082 "The next possibility is that you might be served with a colourful Python "
|
dongsheng@627
|
7083 "backtrace claiming that it can't import a <literal>mercurial</literal>-"
|
dongsheng@627
|
7084 "related module. This is actually progress! The server is now capable of "
|
dongsheng@627
|
7085 "executing your CGI script. This error is only likely to occur if you're "
|
dongsheng@627
|
7086 "running a private installation of Mercurial, instead of a system-wide "
|
dongsheng@627
|
7087 "version. Remember that the web server runs the CGI program without any of "
|
dongsheng@627
|
7088 "the environment variables that you take for granted in an interactive "
|
dongsheng@627
|
7089 "session. If this error happens to you, edit your copy of <filename role="
|
dongsheng@627
|
7090 "\"special\">hgweb.cgi</filename> and follow the directions inside it to "
|
dongsheng@627
|
7091 "correctly set your <envar>PYTHONPATH</envar> environment variable."
|
dongsheng@627
|
7092 msgstr ""
|
dongsheng@627
|
7093
|
dongsheng@627
|
7094 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
7095 #: ../en/ch06-collab.xml:1041
|
dongsheng@627
|
7096 msgid ""
|
dongsheng@627
|
7097 "Finally, you are <emphasis>certain</emphasis> to by served with another "
|
dongsheng@627
|
7098 "colourful Python backtrace: this one will complain that it can't find "
|
dongsheng@627
|
7099 "<filename class=\"directory\">/path/to/repository</filename>. Edit your "
|
dongsheng@627
|
7100 "<filename role=\"special\">hgweb.cgi</filename> script and replace the "
|
dongsheng@627
|
7101 "<filename class=\"directory\">/path/to/repository</filename> string with the "
|
dongsheng@627
|
7102 "complete path to the repository you want to serve up."
|
dongsheng@627
|
7103 msgstr ""
|
dongsheng@627
|
7104
|
dongsheng@627
|
7105 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
7106 #: ../en/ch06-collab.xml:1051
|
dongsheng@627
|
7107 msgid ""
|
dongsheng@627
|
7108 "At this point, when you try to reload the page, you should be presented with "
|
dongsheng@627
|
7109 "a nice HTML view of your repository's history. Whew!"
|
dongsheng@627
|
7110 msgstr ""
|
dongsheng@627
|
7111
|
dongsheng@627
|
7112 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@641
|
7113 #: ../en/ch06-collab.xml:1057
|
dongsheng@627
|
7114 msgid "Configuring lighttpd"
|
dongsheng@630
|
7115 msgstr "配置 lighttpd"
|
dongsheng@627
|
7116
|
dongsheng@627
|
7117 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
7118 #: ../en/ch06-collab.xml:1059
|
dongsheng@627
|
7119 msgid ""
|
dongsheng@627
|
7120 "To be exhaustive in my experiments, I tried configuring the increasingly "
|
dongsheng@627
|
7121 "popular <literal>lighttpd</literal> web server to serve the same repository "
|
dongsheng@627
|
7122 "as I described with Apache above. I had already overcome all of the problems "
|
dongsheng@627
|
7123 "I outlined with Apache, many of which are not server-specific. As a result, "
|
dongsheng@627
|
7124 "I was fairly sure that my file and directory permissions were good, and that "
|
dongsheng@627
|
7125 "my <filename role=\"special\">hgweb.cgi</filename> script was properly edited."
|
dongsheng@627
|
7126 msgstr ""
|
dongsheng@627
|
7127
|
dongsheng@627
|
7128 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
7129 #: ../en/ch06-collab.xml:1069
|
dongsheng@627
|
7130 msgid ""
|
dongsheng@627
|
7131 "Once I had Apache running, getting <literal>lighttpd</literal> to serve the "
|
dongsheng@627
|
7132 "repository was a snap (in other words, even if you're trying to use "
|
dongsheng@627
|
7133 "<literal>lighttpd</literal>, you should read the Apache section). I first "
|
dongsheng@627
|
7134 "had to edit the <literal>mod_access</literal> section of its config file to "
|
dongsheng@627
|
7135 "enable <literal>mod_cgi</literal> and <literal>mod_userdir</literal>, both of "
|
dongsheng@627
|
7136 "which were disabled by default on my system. I then added a few lines to the "
|
dongsheng@627
|
7137 "end of the config file, to configure these modules."
|
dongsheng@627
|
7138 msgstr ""
|
dongsheng@627
|
7139
|
dongsheng@627
|
7140 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
7141 #: ../en/ch06-collab.xml:1081
|
dongsheng@627
|
7142 msgid ""
|
dongsheng@627
|
7143 "With this done, <literal>lighttpd</literal> ran immediately for me. If I had "
|
dongsheng@627
|
7144 "configured <literal>lighttpd</literal> before Apache, I'd almost certainly "
|
dongsheng@627
|
7145 "have run into many of the same system-level configuration problems as I did "
|
dongsheng@627
|
7146 "with Apache. However, I found <literal>lighttpd</literal> to be noticeably "
|
dongsheng@627
|
7147 "easier to configure than Apache, even though I've used Apache for over a "
|
dongsheng@627
|
7148 "decade, and this was my first exposure to <literal>lighttpd</literal>."
|
dongsheng@627
|
7149 msgstr ""
|
dongsheng@627
|
7150
|
dongsheng@627
|
7151 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
7152 #: ../en/ch06-collab.xml:1094
|
dongsheng@627
|
7153 msgid "Sharing multiple repositories with one CGI script"
|
dongsheng@630
|
7154 msgstr "使用一个 CGI 脚本共享多个版本库"
|
dongsheng@627
|
7155
|
dongsheng@627
|
7156 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
7157 #: ../en/ch06-collab.xml:1096
|
dongsheng@627
|
7158 msgid ""
|
dongsheng@627
|
7159 "The <filename role=\"special\">hgweb.cgi</filename> script only lets you "
|
dongsheng@627
|
7160 "publish a single repository, which is an annoying restriction. If you want "
|
dongsheng@627
|
7161 "to publish more than one without wracking yourself with multiple copies of "
|
dongsheng@627
|
7162 "the same script, each with different names, a better choice is to use the "
|
dongsheng@627
|
7163 "<filename role=\"special\">hgwebdir.cgi</filename> script."
|
dongsheng@627
|
7164 msgstr ""
|
dongsheng@627
|
7165
|
dongsheng@627
|
7166 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
7167 #: ../en/ch06-collab.xml:1104
|
dongsheng@627
|
7168 msgid ""
|
dongsheng@627
|
7169 "The procedure to configure <filename role=\"special\">hgwebdir.cgi</filename> "
|
dongsheng@627
|
7170 "is only a little more involved than for <filename role=\"special\">hgweb.cgi</"
|
dongsheng@627
|
7171 "filename>. First, you must obtain a copy of the script. If you don't have "
|
dongsheng@627
|
7172 "one handy, you can download a copy from the master Mercurial repository at "
|
dongsheng@627
|
7173 "<ulink url=\"http://www.selenic.com/repo/hg/raw-file/tip/hgwebdir.cgi"
|
dongsheng@627
|
7174 "\">http://www.selenic.com/repo/hg/raw-file/tip/hgwebdir.cgi</ulink>."
|
dongsheng@627
|
7175 msgstr ""
|
dongsheng@627
|
7176
|
dongsheng@627
|
7177 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
7178 #: ../en/ch06-collab.xml:1117
|
dongsheng@627
|
7179 msgid ""
|
dongsheng@627
|
7180 "With basic configuration out of the way, try to visit <ulink url=\"http://"
|
dongsheng@627
|
7181 "myhostname/ myuser/hgwebdir.cgi\">http://myhostname/ myuser/hgwebdir.cgi</"
|
dongsheng@627
|
7182 "ulink> in your browser. It should display an empty list of repositories. If "
|
dongsheng@627
|
7183 "you get a blank window or error message, try walking through the list of "
|
dongsheng@627
|
7184 "potential problems in section <xref linkend=\"sec.collab.wtf\"/>."
|
dongsheng@627
|
7185 msgstr ""
|
dongsheng@627
|
7186
|
dongsheng@627
|
7187 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
7188 #: ../en/ch06-collab.xml:1126
|
dongsheng@627
|
7189 msgid ""
|
dongsheng@627
|
7190 "The <filename role=\"special\">hgwebdir.cgi</filename> script relies on an "
|
dongsheng@627
|
7191 "external configuration file. By default, it searches for a file named "
|
dongsheng@627
|
7192 "<filename role=\"special\">hgweb.config</filename> in the same directory as "
|
dongsheng@627
|
7193 "itself. You'll need to create this file, and make it world-readable. The "
|
dongsheng@627
|
7194 "format of the file is similar to a Windows <quote>ini</quote> file, as "
|
dongsheng@627
|
7195 "understood by Python's <literal>ConfigParser</literal> <citation>web:"
|
dongsheng@627
|
7196 "configparser</citation> module."
|
dongsheng@627
|
7197 msgstr ""
|
dongsheng@627
|
7198
|
dongsheng@627
|
7199 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
7200 #: ../en/ch06-collab.xml:1136
|
dongsheng@627
|
7201 msgid ""
|
dongsheng@627
|
7202 "The easiest way to configure <filename role=\"special\">hgwebdir.cgi</"
|
dongsheng@627
|
7203 "filename> is with a section named <literal>collections</literal>. This will "
|
dongsheng@627
|
7204 "automatically publish <emphasis>every</emphasis> repository under the "
|
dongsheng@627
|
7205 "directories you name. The section should look like this:"
|
dongsheng@627
|
7206 msgstr ""
|
dongsheng@627
|
7207
|
dongsheng@627
|
7208 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
7209 #: ../en/ch06-collab.xml:1144
|
dongsheng@627
|
7210 msgid ""
|
dongsheng@627
|
7211 "Mercurial interprets this by looking at the directory name on the "
|
dongsheng@627
|
7212 "<emphasis>right</emphasis> hand side of the <quote><literal>=</literal></"
|
dongsheng@627
|
7213 "quote> sign; finding repositories in that directory hierarchy; and using the "
|
dongsheng@627
|
7214 "text on the <emphasis>left</emphasis> to strip off matching text from the "
|
dongsheng@627
|
7215 "names it will actually list in the web interface. The remaining component of "
|
dongsheng@627
|
7216 "a path after this stripping has occurred is called a <quote>virtual path</"
|
dongsheng@627
|
7217 "quote>."
|
dongsheng@627
|
7218 msgstr ""
|
dongsheng@627
|
7219
|
dongsheng@627
|
7220 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
7221 #: ../en/ch06-collab.xml:1153
|
dongsheng@627
|
7222 msgid ""
|
dongsheng@627
|
7223 "Given the example above, if we have a repository whose local path is "
|
dongsheng@627
|
7224 "<filename class=\"directory\">/my/root/this/repo</filename>, the CGI script "
|
dongsheng@627
|
7225 "will strip the leading <filename class=\"directory\">/my/root</filename> from "
|
dongsheng@627
|
7226 "the name, and publish the repository with a virtual path of <filename class="
|
dongsheng@627
|
7227 "\"directory\">this/repo</filename>. If the base URL for our CGI script is "
|
dongsheng@627
|
7228 "<ulink url=\"http://myhostname/ myuser/hgwebdir.cgi\">http://myhostname/ "
|
dongsheng@627
|
7229 "myuser/hgwebdir.cgi</ulink>, the complete URL for that repository will be "
|
dongsheng@627
|
7230 "<ulink url=\"http://myhostname/ myuser/hgwebdir.cgi/this/repo\">http://"
|
dongsheng@627
|
7231 "myhostname/ myuser/hgwebdir.cgi/this/repo</ulink>."
|
dongsheng@627
|
7232 msgstr ""
|
dongsheng@627
|
7233
|
dongsheng@627
|
7234 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
7235 #: ../en/ch06-collab.xml:1167
|
dongsheng@627
|
7236 msgid ""
|
dongsheng@627
|
7237 "If we replace <filename class=\"directory\">/my/root</filename> on the left "
|
dongsheng@627
|
7238 "hand side of this example with <filename class=\"directory\">/my</filename>, "
|
dongsheng@627
|
7239 "then <filename role=\"special\">hgwebdir.cgi</filename> will only strip off "
|
dongsheng@627
|
7240 "<filename class=\"directory\">/my</filename> from the repository name, and "
|
dongsheng@627
|
7241 "will give us a virtual path of <filename class=\"directory\">root/this/repo</"
|
dongsheng@627
|
7242 "filename> instead of <filename class=\"directory\">this/repo</filename>."
|
dongsheng@627
|
7243 msgstr ""
|
dongsheng@627
|
7244
|
dongsheng@627
|
7245 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
7246 #: ../en/ch06-collab.xml:1177
|
dongsheng@627
|
7247 msgid ""
|
dongsheng@627
|
7248 "The <filename role=\"special\">hgwebdir.cgi</filename> script will "
|
dongsheng@627
|
7249 "recursively search each directory listed in the <literal>collections</"
|
dongsheng@627
|
7250 "literal> section of its configuration file, but it will <literal>not</"
|
dongsheng@627
|
7251 "literal> recurse into the repositories it finds."
|
dongsheng@627
|
7252 msgstr ""
|
dongsheng@627
|
7253
|
dongsheng@627
|
7254 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
7255 #: ../en/ch06-collab.xml:1183
|
dongsheng@627
|
7256 msgid ""
|
dongsheng@627
|
7257 "The <literal>collections</literal> mechanism makes it easy to publish many "
|
dongsheng@627
|
7258 "repositories in a <quote>fire and forget</quote> manner. You only need to "
|
dongsheng@627
|
7259 "set up the CGI script and configuration file one time. Afterwards, you can "
|
dongsheng@627
|
7260 "publish or unpublish a repository at any time by simply moving it into, or "
|
dongsheng@627
|
7261 "out of, the directory hierarchy in which you've configured <filename role="
|
dongsheng@627
|
7262 "\"special\">hgwebdir.cgi</filename> to look."
|
dongsheng@627
|
7263 msgstr ""
|
dongsheng@627
|
7264
|
dongsheng@627
|
7265 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@641
|
7266 #: ../en/ch06-collab.xml:1193
|
dongsheng@627
|
7267 msgid "Explicitly specifying which repositories to publish"
|
dongsheng@630
|
7268 msgstr "明确指出要发布的版本库"
|
dongsheng@627
|
7269
|
dongsheng@627
|
7270 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
7271 #: ../en/ch06-collab.xml:1196
|
dongsheng@627
|
7272 msgid ""
|
dongsheng@627
|
7273 "In addition to the <literal>collections</literal> mechanism, the <filename "
|
dongsheng@627
|
7274 "role=\"special\">hgwebdir.cgi</filename> script allows you to publish a "
|
dongsheng@627
|
7275 "specific list of repositories. To do so, create a <literal>paths</literal> "
|
dongsheng@627
|
7276 "section, with contents of the following form."
|
dongsheng@627
|
7277 msgstr ""
|
dongsheng@627
|
7278
|
dongsheng@627
|
7279 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
7280 #: ../en/ch06-collab.xml:1204
|
dongsheng@627
|
7281 msgid ""
|
dongsheng@627
|
7282 "In this case, the virtual path (the component that will appear in a URL) is "
|
dongsheng@627
|
7283 "on the left hand side of each definition, while the path to the repository is "
|
dongsheng@627
|
7284 "on the right. Notice that there does not need to be any relationship between "
|
dongsheng@627
|
7285 "the virtual path you choose and the location of a repository in your "
|
dongsheng@627
|
7286 "filesystem."
|
dongsheng@627
|
7287 msgstr ""
|
dongsheng@627
|
7288
|
dongsheng@627
|
7289 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
7290 #: ../en/ch06-collab.xml:1211
|
dongsheng@627
|
7291 msgid ""
|
dongsheng@627
|
7292 "If you wish, you can use both the <literal>collections</literal> and "
|
dongsheng@627
|
7293 "<literal>paths</literal> mechanisms simultaneously in a single configuration "
|
dongsheng@627
|
7294 "file."
|
dongsheng@627
|
7295 msgstr ""
|
dongsheng@627
|
7296
|
dongsheng@627
|
7297 #. type: Content of: <book><chapter><sect1><sect2><sect3><note><para>
|
dongsheng@641
|
7298 #: ../en/ch06-collab.xml:1217
|
dongsheng@627
|
7299 msgid ""
|
dongsheng@627
|
7300 "If multiple repositories have the same virtual path, <filename role=\"special"
|
dongsheng@627
|
7301 "\">hgwebdir.cgi</filename> will not report an error. Instead, it will behave "
|
dongsheng@627
|
7302 "unpredictably."
|
dongsheng@627
|
7303 msgstr ""
|
dongsheng@627
|
7304
|
dongsheng@627
|
7305 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
7306 #: ../en/ch06-collab.xml:1226
|
dongsheng@627
|
7307 msgid "Downloading source archives"
|
dongsheng@630
|
7308 msgstr "下载源代码档案包"
|
dongsheng@627
|
7309
|
dongsheng@627
|
7310 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
7311 #: ../en/ch06-collab.xml:1228
|
dongsheng@627
|
7312 msgid ""
|
dongsheng@627
|
7313 "Mercurial's web interface lets users download an archive of any revision. "
|
dongsheng@627
|
7314 "This archive will contain a snapshot of the working directory as of that "
|
dongsheng@627
|
7315 "revision, but it will not contain a copy of the repository data."
|
dongsheng@627
|
7316 msgstr ""
|
dongsheng@627
|
7317
|
dongsheng@627
|
7318 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
7319 #: ../en/ch06-collab.xml:1233
|
dongsheng@627
|
7320 msgid ""
|
dongsheng@627
|
7321 "By default, this feature is not enabled. To enable it, you'll need to add an "
|
dongsheng@627
|
7322 "<envar role=\"rc-item-web\">allow_archive</envar> item to the <literal role="
|
dongsheng@627
|
7323 "\"rc-web\">web</literal> section of your <filename role=\"special\"> /.hgrc</"
|
dongsheng@627
|
7324 "filename>."
|
dongsheng@627
|
7325 msgstr ""
|
dongsheng@627
|
7326
|
dongsheng@627
|
7327 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
7328 #: ../en/ch06-collab.xml:1241
|
dongsheng@627
|
7329 msgid "Web configuration options"
|
dongsheng@630
|
7330 msgstr "Web 配置选项"
|
dongsheng@627
|
7331
|
dongsheng@627
|
7332 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
7333 #: ../en/ch06-collab.xml:1243
|
dongsheng@627
|
7334 msgid ""
|
dongsheng@627
|
7335 "Mercurial's web interfaces (the <command role=\"hg-cmd\">hg serve</command> "
|
dongsheng@627
|
7336 "command, and the <filename role=\"special\">hgweb.cgi</filename> and "
|
dongsheng@627
|
7337 "<filename role=\"special\">hgwebdir.cgi</filename> scripts) have a number of "
|
dongsheng@627
|
7338 "configuration options that you can set. These belong in a section named "
|
dongsheng@627
|
7339 "<literal role=\"rc-web\">web</literal>."
|
dongsheng@627
|
7340 msgstr ""
|
dongsheng@627
|
7341
|
dongsheng@627
|
7342 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
7343 #: ../en/ch06-collab.xml:1251
|
dongsheng@627
|
7344 msgid ""
|
dongsheng@627
|
7345 "<envar role=\"rc-item-web\">allow_archive</envar>: Determines which (if any) "
|
dongsheng@627
|
7346 "archive download mechanisms Mercurial supports. If you enable this feature, "
|
dongsheng@627
|
7347 "users of the web interface will be able to download an archive of whatever "
|
dongsheng@627
|
7348 "revision of a repository they are viewing. To enable the archive feature, "
|
dongsheng@627
|
7349 "this item must take the form of a sequence of words drawn from the list below."
|
dongsheng@627
|
7350 msgstr ""
|
dongsheng@627
|
7351
|
dongsheng@627
|
7352 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
|
dongsheng@641
|
7353 #: ../en/ch06-collab.xml:1260
|
dongsheng@627
|
7354 msgid ""
|
dongsheng@627
|
7355 "<literal>bz2</literal>: A <command>tar</command> archive, compressed using "
|
dongsheng@627
|
7356 "<literal>bzip2</literal> compression. This has the best compression ratio, "
|
dongsheng@627
|
7357 "but uses the most CPU time on the server."
|
dongsheng@627
|
7358 msgstr ""
|
dongsheng@627
|
7359
|
dongsheng@627
|
7360 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
|
dongsheng@641
|
7361 #: ../en/ch06-collab.xml:1266
|
dongsheng@627
|
7362 msgid ""
|
dongsheng@627
|
7363 "<literal>gz</literal>: A <command>tar</command> archive, compressed using "
|
dongsheng@627
|
7364 "<literal>gzip</literal> compression."
|
dongsheng@627
|
7365 msgstr ""
|
dongsheng@627
|
7366
|
dongsheng@627
|
7367 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
|
dongsheng@641
|
7368 #: ../en/ch06-collab.xml:1270
|
dongsheng@627
|
7369 msgid ""
|
dongsheng@627
|
7370 "<literal>zip</literal>: A <command>zip</command> archive, compressed using "
|
dongsheng@627
|
7371 "LZW compression. This format has the worst compression ratio, but is widely "
|
dongsheng@627
|
7372 "used in the Windows world."
|
dongsheng@627
|
7373 msgstr ""
|
dongsheng@627
|
7374
|
dongsheng@627
|
7375 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
7376 #: ../en/ch06-collab.xml:1276
|
dongsheng@627
|
7377 msgid ""
|
dongsheng@627
|
7378 "If you provide an empty list, or don't have an <envar role=\"rc-item-web"
|
dongsheng@627
|
7379 "\">allow_archive</envar> entry at all, this feature will be disabled. Here "
|
dongsheng@627
|
7380 "is an example of how to enable all three supported formats."
|
dongsheng@627
|
7381 msgstr ""
|
dongsheng@627
|
7382
|
dongsheng@627
|
7383 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
7384 #: ../en/ch06-collab.xml:1283
|
dongsheng@627
|
7385 msgid ""
|
dongsheng@627
|
7386 "<envar role=\"rc-item-web\">allowpull</envar>: Boolean. Determines whether "
|
dongsheng@627
|
7387 "the web interface allows remote users to <command role=\"hg-cmd\">hg pull</"
|
dongsheng@627
|
7388 "command> and <command role=\"hg-cmd\">hg clone</command> this repository over "
|
dongsheng@627
|
7389 "HTTP. If set to <literal>no</literal> or <literal>false</literal>, only the "
|
dongsheng@627
|
7390 "<quote>human-oriented</quote> portion of the web interface is available."
|
dongsheng@627
|
7391 msgstr ""
|
dongsheng@627
|
7392
|
dongsheng@627
|
7393 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
7394 #: ../en/ch06-collab.xml:1292
|
dongsheng@627
|
7395 msgid ""
|
dongsheng@627
|
7396 "<envar role=\"rc-item-web\">contact</envar>: String. A free-form (but "
|
dongsheng@627
|
7397 "preferably brief) string identifying the person or group in charge of the "
|
dongsheng@627
|
7398 "repository. This often contains the name and email address of a person or "
|
dongsheng@627
|
7399 "mailing list. It often makes sense to place this entry in a repository's own "
|
dongsheng@627
|
7400 "<filename role=\"special\">.hg/hgrc</filename> file, but it can make sense to "
|
dongsheng@627
|
7401 "use in a global <filename role=\"special\"> /.hgrc</filename>\\ if every "
|
dongsheng@627
|
7402 "repository has a single maintainer."
|
dongsheng@627
|
7403 msgstr ""
|
dongsheng@627
|
7404
|
dongsheng@627
|
7405 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
7406 #: ../en/ch06-collab.xml:1303
|
dongsheng@627
|
7407 msgid ""
|
dongsheng@627
|
7408 "<envar role=\"rc-item-web\">maxchanges</envar>: Integer. The default maximum "
|
dongsheng@627
|
7409 "number of changesets to display in a single page of output."
|
dongsheng@627
|
7410 msgstr ""
|
dongsheng@627
|
7411
|
dongsheng@627
|
7412 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
7413 #: ../en/ch06-collab.xml:1307
|
dongsheng@627
|
7414 msgid ""
|
dongsheng@627
|
7415 "<envar role=\"rc-item-web\">maxfiles</envar>: Integer. The default maximum "
|
dongsheng@627
|
7416 "number of modified files to display in a single page of output."
|
dongsheng@627
|
7417 msgstr ""
|
dongsheng@627
|
7418
|
dongsheng@627
|
7419 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
7420 #: ../en/ch06-collab.xml:1311
|
dongsheng@627
|
7421 msgid ""
|
dongsheng@627
|
7422 "<envar role=\"rc-item-web\">stripes</envar>: Integer. If the web interface "
|
dongsheng@627
|
7423 "displays alternating <quote>stripes</quote> to make it easier to visually "
|
dongsheng@627
|
7424 "align rows when you are looking at a table, this number controls the number "
|
dongsheng@627
|
7425 "of rows in each stripe."
|
dongsheng@627
|
7426 msgstr ""
|
dongsheng@627
|
7427
|
dongsheng@627
|
7428 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
7429 #: ../en/ch06-collab.xml:1317
|
dongsheng@627
|
7430 msgid ""
|
dongsheng@627
|
7431 "<envar role=\"rc-item-web\">style</envar>: Controls the template Mercurial "
|
dongsheng@627
|
7432 "uses to display the web interface. Mercurial ships with two web templates, "
|
dongsheng@627
|
7433 "named <literal>default</literal> and <literal>gitweb</literal> (the latter is "
|
dongsheng@627
|
7434 "much more visually attractive). You can also specify a custom template of "
|
dongsheng@627
|
7435 "your own; see chapter <xref linkend=\"chap.template\"/> for details. Here, "
|
dongsheng@627
|
7436 "you can see how to enable the <literal>gitweb</literal> style."
|
dongsheng@627
|
7437 msgstr ""
|
dongsheng@627
|
7438
|
dongsheng@627
|
7439 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
7440 #: ../en/ch06-collab.xml:1328
|
dongsheng@627
|
7441 msgid ""
|
dongsheng@627
|
7442 "<envar role=\"rc-item-web\">templates</envar>: Path. The directory in which "
|
dongsheng@627
|
7443 "to search for template files. By default, Mercurial searches in the "
|
dongsheng@627
|
7444 "directory in which it was installed."
|
dongsheng@627
|
7445 msgstr ""
|
dongsheng@627
|
7446
|
dongsheng@627
|
7447 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
7448 #: ../en/ch06-collab.xml:1333
|
dongsheng@627
|
7449 msgid ""
|
dongsheng@627
|
7450 "If you are using <filename role=\"special\">hgwebdir.cgi</filename>, you can "
|
dongsheng@627
|
7451 "place a few configuration items in a <literal role=\"rc-web\">web</literal> "
|
dongsheng@627
|
7452 "section of the <filename role=\"special\">hgweb.config</filename> file "
|
dongsheng@627
|
7453 "instead of a <filename role=\"special\"> /.hgrc</filename>\\ file, for "
|
dongsheng@627
|
7454 "convenience. These items are <envar role=\"rc-item-web\">motd</envar> and "
|
dongsheng@627
|
7455 "<envar role=\"rc-item-web\">style</envar>."
|
dongsheng@627
|
7456 msgstr ""
|
dongsheng@627
|
7457
|
dongsheng@627
|
7458 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@641
|
7459 #: ../en/ch06-collab.xml:1344
|
dongsheng@627
|
7460 msgid "Options specific to an individual repository"
|
dongsheng@630
|
7461 msgstr "针对单个版本库的选项"
|
dongsheng@627
|
7462
|
dongsheng@627
|
7463 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
7464 #: ../en/ch06-collab.xml:1346
|
dongsheng@627
|
7465 msgid ""
|
dongsheng@627
|
7466 "A few <literal role=\"rc-web\">web</literal> configuration items ought to be "
|
dongsheng@627
|
7467 "placed in a repository's local <filename role=\"special\">.hg/hgrc</"
|
dongsheng@627
|
7468 "filename>, rather than a user's or global <filename role=\"special\"> /.hgrc</"
|
dongsheng@627
|
7469 "filename>."
|
dongsheng@627
|
7470 msgstr ""
|
dongsheng@627
|
7471
|
dongsheng@627
|
7472 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@641
|
7473 #: ../en/ch06-collab.xml:1352
|
dongsheng@627
|
7474 msgid ""
|
dongsheng@627
|
7475 "<envar role=\"rc-item-web\">description</envar>: String. A free-form (but "
|
dongsheng@627
|
7476 "preferably brief) string that describes the contents or purpose of the "
|
dongsheng@627
|
7477 "repository."
|
dongsheng@627
|
7478 msgstr ""
|
dongsheng@627
|
7479
|
dongsheng@627
|
7480 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@641
|
7481 #: ../en/ch06-collab.xml:1357
|
dongsheng@627
|
7482 msgid ""
|
dongsheng@627
|
7483 "<envar role=\"rc-item-web\">name</envar>: String. The name to use for the "
|
dongsheng@627
|
7484 "repository in the web interface. This overrides the default name, which is "
|
dongsheng@627
|
7485 "the last component of the repository's path."
|
dongsheng@627
|
7486 msgstr ""
|
dongsheng@627
|
7487
|
dongsheng@627
|
7488 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@641
|
7489 #: ../en/ch06-collab.xml:1365
|
dongsheng@627
|
7490 msgid ""
|
dongsheng@627
|
7491 "Options specific to the <command role=\"hg-cmd\">hg serve</command> command"
|
dongsheng@630
|
7492 msgstr "命令 <command role=\"hg-cmd\">hg serve</command> 的选项"
|
dongsheng@627
|
7493
|
dongsheng@627
|
7494 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
7495 #: ../en/ch06-collab.xml:1368
|
dongsheng@627
|
7496 msgid ""
|
dongsheng@627
|
7497 "Some of the items in the <literal role=\"rc-web\">web</literal> section of a "
|
dongsheng@627
|
7498 "<filename role=\"special\"> /.hgrc</filename>\\ file are only for use with "
|
dongsheng@627
|
7499 "the <command role=\"hg-cmd\">hg serve</command> command."
|
dongsheng@627
|
7500 msgstr ""
|
dongsheng@627
|
7501
|
dongsheng@627
|
7502 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@641
|
7503 #: ../en/ch06-collab.xml:1374
|
dongsheng@627
|
7504 msgid ""
|
dongsheng@627
|
7505 "<envar role=\"rc-item-web\">accesslog</envar>: Path. The name of a file into "
|
dongsheng@627
|
7506 "which to write an access log. By default, the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
7507 "serve</command> command writes this information to standard output, not to a "
|
dongsheng@627
|
7508 "file. Log entries are written in the standard <quote>combined</quote> file "
|
dongsheng@627
|
7509 "format used by almost all web servers."
|
dongsheng@627
|
7510 msgstr ""
|
dongsheng@627
|
7511
|
dongsheng@627
|
7512 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@641
|
7513 #: ../en/ch06-collab.xml:1382
|
dongsheng@627
|
7514 msgid ""
|
dongsheng@627
|
7515 "<envar role=\"rc-item-web\">address</envar>: String. The local address on "
|
dongsheng@627
|
7516 "which the server should listen for incoming connections. By default, the "
|
dongsheng@627
|
7517 "server listens on all addresses."
|
dongsheng@627
|
7518 msgstr ""
|
dongsheng@627
|
7519
|
dongsheng@627
|
7520 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@641
|
7521 #: ../en/ch06-collab.xml:1387
|
dongsheng@627
|
7522 msgid ""
|
dongsheng@627
|
7523 "<envar role=\"rc-item-web\">errorlog</envar>: Path. The name of a file into "
|
dongsheng@627
|
7524 "which to write an error log. By default, the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
7525 "serve</command> command writes this information to standard error, not to a "
|
dongsheng@627
|
7526 "file."
|
dongsheng@627
|
7527 msgstr ""
|
dongsheng@627
|
7528
|
dongsheng@627
|
7529 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@641
|
7530 #: ../en/ch06-collab.xml:1393
|
dongsheng@627
|
7531 msgid ""
|
dongsheng@627
|
7532 "<envar role=\"rc-item-web\">ipv6</envar>: Boolean. Whether to use the IPv6 "
|
dongsheng@627
|
7533 "protocol. By default, IPv6 is not used."
|
dongsheng@627
|
7534 msgstr ""
|
dongsheng@627
|
7535
|
dongsheng@627
|
7536 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@641
|
7537 #: ../en/ch06-collab.xml:1397
|
dongsheng@627
|
7538 msgid ""
|
dongsheng@627
|
7539 "<envar role=\"rc-item-web\">port</envar>: Integer. The TCP port number on "
|
dongsheng@627
|
7540 "which the server should listen. The default port number used is 8000."
|
dongsheng@627
|
7541 msgstr ""
|
dongsheng@627
|
7542
|
dongsheng@627
|
7543 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@641
|
7544 #: ../en/ch06-collab.xml:1404
|
dongsheng@627
|
7545 msgid ""
|
dongsheng@627
|
7546 "Choosing the right <filename role=\"special\"> /.hgrc</filename>\\ file to "
|
dongsheng@627
|
7547 "add <literal role=\"rc-web\">web</literal> items to"
|
dongsheng@627
|
7548 msgstr ""
|
dongsheng@630
|
7549 "选择正确的 <filename role=\"special\"> /.hgrc</filename> 文件增加到 <literal "
|
dongsheng@630
|
7550 "role=\"rc-web\">web</literal> 条目"
|
dongsheng@627
|
7551
|
dongsheng@627
|
7552 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
7553 #: ../en/ch06-collab.xml:1408
|
dongsheng@627
|
7554 msgid ""
|
dongsheng@627
|
7555 "It is important to remember that a web server like Apache or "
|
dongsheng@627
|
7556 "<literal>lighttpd</literal> will run under a user ID that is different to "
|
dongsheng@627
|
7557 "yours. CGI scripts run by your server, such as <filename role=\"special"
|
dongsheng@627
|
7558 "\">hgweb.cgi</filename>, will usually also run under that user ID."
|
dongsheng@627
|
7559 msgstr ""
|
dongsheng@627
|
7560
|
dongsheng@627
|
7561 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
7562 #: ../en/ch06-collab.xml:1415
|
dongsheng@627
|
7563 msgid ""
|
dongsheng@627
|
7564 "If you add <literal role=\"rc-web\">web</literal> items to your own personal "
|
dongsheng@627
|
7565 "<filename role=\"special\"> /.hgrc</filename>\\ file, CGI scripts won't read "
|
dongsheng@627
|
7566 "that <filename role=\"special\"> /.hgrc</filename>\\ file. Those settings "
|
dongsheng@627
|
7567 "will thus only affect the behaviour of the <command role=\"hg-cmd\">hg serve</"
|
dongsheng@627
|
7568 "command> command when you run it. To cause CGI scripts to see your settings, "
|
dongsheng@627
|
7569 "either create a <filename role=\"special\"> /.hgrc</filename>\\ file in the "
|
dongsheng@627
|
7570 "home directory of the user ID that runs your web server, or add those "
|
dongsheng@627
|
7571 "settings to a system-wide <filename role=\"special\"> /.hgrc</filename>\\ "
|
dongsheng@627
|
7572 "file."
|
dongsheng@627
|
7573 msgstr ""
|
dongsheng@627
|
7574
|
dongsheng@627
|
7575 #. type: Content of: <book><chapter><title>
|
dongsheng@627
|
7576 #: ../en/ch07-filenames.xml:5
|
dongsheng@627
|
7577 msgid "File names and pattern matching"
|
dongsheng@627
|
7578 msgstr "文件名称与模式匹配"
|
dongsheng@627
|
7579
|
dongsheng@627
|
7580 #. type: Content of: <book><chapter><para>
|
dongsheng@627
|
7581 #: ../en/ch07-filenames.xml:7
|
dongsheng@627
|
7582 msgid ""
|
dongsheng@627
|
7583 "Mercurial provides mechanisms that let you work with file names in a "
|
dongsheng@627
|
7584 "consistent and expressive way."
|
dongsheng@627
|
7585 msgstr ""
|
dongsheng@627
|
7586
|
dongsheng@627
|
7587 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
7588 #: ../en/ch07-filenames.xml:11
|
dongsheng@627
|
7589 msgid "Simple file naming"
|
dongsheng@630
|
7590 msgstr "简单文件名称"
|
dongsheng@627
|
7591
|
dongsheng@627
|
7592 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7593 #: ../en/ch07-filenames.xml:13
|
dongsheng@627
|
7594 msgid ""
|
dongsheng@627
|
7595 "Mercurial uses a unified piece of machinery <quote>under the hood</quote> to "
|
dongsheng@627
|
7596 "handle file names. Every command behaves uniformly with respect to file "
|
dongsheng@627
|
7597 "names. The way in which commands work with file names is as follows."
|
dongsheng@627
|
7598 msgstr ""
|
dongsheng@627
|
7599
|
dongsheng@627
|
7600 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7601 #: ../en/ch07-filenames.xml:18
|
dongsheng@627
|
7602 msgid ""
|
dongsheng@627
|
7603 "If you explicitly name real files on the command line, Mercurial works with "
|
dongsheng@627
|
7604 "exactly those files, as you would expect. &interaction.filenames.files;"
|
dongsheng@627
|
7605 msgstr ""
|
dongsheng@627
|
7606
|
dongsheng@627
|
7607 #
|
dongsheng@627
|
7608 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7609 #: ../en/ch07-filenames.xml:22
|
dongsheng@627
|
7610 msgid ""
|
dongsheng@627
|
7611 "When you provide a directory name, Mercurial will interpret this as "
|
dongsheng@627
|
7612 "<quote>operate on every file in this directory and its subdirectories</"
|
dongsheng@627
|
7613 "quote>. Mercurial traverses the files and subdirectories in a directory in "
|
dongsheng@627
|
7614 "alphabetical order. When it encounters a subdirectory, it will traverse that "
|
dongsheng@627
|
7615 "subdirectory before continuing with the current directory."
|
dongsheng@627
|
7616 msgstr ""
|
dongsheng@627
|
7617
|
dongsheng@627
|
7618 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
7619 #: ../en/ch07-filenames.xml:33
|
dongsheng@627
|
7620 msgid "Running commands without any file names"
|
dongsheng@630
|
7621 msgstr "不提供文件名称的执行命令"
|
dongsheng@627
|
7622
|
dongsheng@627
|
7623 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7624 #: ../en/ch07-filenames.xml:35
|
dongsheng@627
|
7625 msgid ""
|
dongsheng@627
|
7626 "Mercurial's commands that work with file names have useful default behaviours "
|
dongsheng@627
|
7627 "when you invoke them without providing any file names or patterns. What kind "
|
dongsheng@627
|
7628 "of behaviour you should expect depends on what the command does. Here are a "
|
dongsheng@627
|
7629 "few rules of thumb you can use to predict what a command is likely to do if "
|
dongsheng@627
|
7630 "you don't give it any names to work with."
|
dongsheng@627
|
7631 msgstr ""
|
dongsheng@627
|
7632
|
dongsheng@627
|
7633 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
7634 #: ../en/ch07-filenames.xml:42
|
dongsheng@627
|
7635 msgid ""
|
dongsheng@627
|
7636 "Most commands will operate on the entire working directory. This is what the "
|
dongsheng@627
|
7637 "<command role=\"hg-cmd\">hg add</command> command does, for example."
|
dongsheng@627
|
7638 msgstr ""
|
dongsheng@627
|
7639
|
dongsheng@627
|
7640 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
7641 #: ../en/ch07-filenames.xml:46
|
dongsheng@627
|
7642 msgid ""
|
dongsheng@627
|
7643 "If the command has effects that are difficult or impossible to reverse, it "
|
dongsheng@627
|
7644 "will force you to explicitly provide at least one name or pattern (see "
|
dongsheng@627
|
7645 "below). This protects you from accidentally deleting files by running "
|
dongsheng@627
|
7646 "<command role=\"hg-cmd\">hg remove</command> with no arguments, for example."
|
dongsheng@627
|
7647 msgstr ""
|
dongsheng@627
|
7648
|
dongsheng@627
|
7649 #
|
dongsheng@627
|
7650 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7651 #: ../en/ch07-filenames.xml:54
|
dongsheng@627
|
7652 msgid ""
|
dongsheng@627
|
7653 "It's easy to work around these default behaviours if they don't suit you. If "
|
dongsheng@627
|
7654 "a command normally operates on the whole working directory, you can invoke it "
|
dongsheng@627
|
7655 "on just the current directory and its subdirectories by giving it the name "
|
dongsheng@627
|
7656 "<quote><filename class=\"directory\">.</filename></quote>."
|
dongsheng@627
|
7657 msgstr ""
|
dongsheng@627
|
7658
|
dongsheng@627
|
7659 #
|
dongsheng@627
|
7660 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7661 #: ../en/ch07-filenames.xml:62
|
dongsheng@627
|
7662 msgid ""
|
dongsheng@627
|
7663 "Along the same lines, some commands normally print file names relative to the "
|
dongsheng@627
|
7664 "root of the repository, even if you're invoking them from a subdirectory. "
|
dongsheng@627
|
7665 "Such a command will print file names relative to your subdirectory if you "
|
dongsheng@627
|
7666 "give it explicit names. Here, we're going to run <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
7667 "status</command> from a subdirectory, and get it to operate on the entire "
|
dongsheng@627
|
7668 "working directory while printing file names relative to our subdirectory, by "
|
dongsheng@627
|
7669 "passing it the output of the <command role=\"hg-cmd\">hg root</command> "
|
dongsheng@627
|
7670 "command."
|
dongsheng@627
|
7671 msgstr ""
|
dongsheng@627
|
7672
|
dongsheng@627
|
7673 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
7674 #: ../en/ch07-filenames.xml:76
|
dongsheng@627
|
7675 msgid "Telling you what's going on"
|
dongsheng@630
|
7676 msgstr "告诉你正在做什么"
|
dongsheng@627
|
7677
|
dongsheng@627
|
7678 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7679 #: ../en/ch07-filenames.xml:78
|
dongsheng@627
|
7680 msgid ""
|
dongsheng@627
|
7681 "The <command role=\"hg-cmd\">hg add</command> example in the preceding "
|
dongsheng@627
|
7682 "section illustrates something else that's helpful about Mercurial commands. "
|
dongsheng@627
|
7683 "If a command operates on a file that you didn't name explicitly on the "
|
dongsheng@627
|
7684 "command line, it will usually print the name of the file, so that you will "
|
dongsheng@627
|
7685 "not be surprised what's going on."
|
dongsheng@627
|
7686 msgstr ""
|
dongsheng@627
|
7687
|
dongsheng@627
|
7688 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7689 #: ../en/ch07-filenames.xml:85
|
dongsheng@627
|
7690 msgid ""
|
dongsheng@627
|
7691 "The principle here is of <emphasis>least surprise</emphasis>. If you've "
|
dongsheng@627
|
7692 "exactly named a file on the command line, there's no point in repeating it "
|
dongsheng@627
|
7693 "back at you. If Mercurial is acting on a file <emphasis>implicitly</"
|
dongsheng@627
|
7694 "emphasis>, because you provided no names, or a directory, or a pattern (see "
|
dongsheng@627
|
7695 "below), it's safest to tell you what it's doing."
|
dongsheng@627
|
7696 msgstr ""
|
dongsheng@627
|
7697
|
dongsheng@627
|
7698 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7699 #: ../en/ch07-filenames.xml:92
|
dongsheng@627
|
7700 msgid ""
|
dongsheng@627
|
7701 "For commands that behave this way, you can silence them using the <option "
|
dongsheng@627
|
7702 "role=\"hg-opt-global\">-q</option> option. You can also get them to print "
|
dongsheng@627
|
7703 "the name of every file, even those you've named explicitly, using the <option "
|
dongsheng@627
|
7704 "role=\"hg-opt-global\">-v</option> option."
|
dongsheng@627
|
7705 msgstr ""
|
dongsheng@627
|
7706
|
dongsheng@627
|
7707 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
7708 #: ../en/ch07-filenames.xml:100
|
dongsheng@627
|
7709 msgid "Using patterns to identify files"
|
dongsheng@630
|
7710 msgstr "使用模式标识文件"
|
dongsheng@627
|
7711
|
dongsheng@627
|
7712 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7713 #: ../en/ch07-filenames.xml:102
|
dongsheng@627
|
7714 msgid ""
|
dongsheng@627
|
7715 "In addition to working with file and directory names, Mercurial lets you use "
|
dongsheng@627
|
7716 "<emphasis>patterns</emphasis> to identify files. Mercurial's pattern "
|
dongsheng@627
|
7717 "handling is expressive."
|
dongsheng@627
|
7718 msgstr ""
|
dongsheng@627
|
7719
|
dongsheng@627
|
7720 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7721 #: ../en/ch07-filenames.xml:106
|
dongsheng@627
|
7722 msgid ""
|
dongsheng@627
|
7723 "On Unix-like systems (Linux, MacOS, etc.), the job of matching file names to "
|
dongsheng@627
|
7724 "patterns normally falls to the shell. On these systems, you must explicitly "
|
dongsheng@627
|
7725 "tell Mercurial that a name is a pattern. On Windows, the shell does not "
|
dongsheng@627
|
7726 "expand patterns, so Mercurial will automatically identify names that are "
|
dongsheng@627
|
7727 "patterns, and expand them for you."
|
dongsheng@627
|
7728 msgstr ""
|
dongsheng@627
|
7729
|
dongsheng@627
|
7730 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7731 #: ../en/ch07-filenames.xml:113
|
dongsheng@627
|
7732 msgid ""
|
dongsheng@627
|
7733 "To provide a pattern in place of a regular name on the command line, the "
|
dongsheng@627
|
7734 "mechanism is simple:"
|
dongsheng@627
|
7735 msgstr ""
|
dongsheng@627
|
7736
|
dongsheng@627
|
7737 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7738 #: ../en/ch07-filenames.xml:116
|
dongsheng@627
|
7739 msgid ""
|
dongsheng@627
|
7740 "That is, a pattern is identified by a short text string that says what kind "
|
dongsheng@627
|
7741 "of pattern this is, followed by a colon, followed by the actual pattern."
|
dongsheng@627
|
7742 msgstr ""
|
dongsheng@627
|
7743
|
dongsheng@627
|
7744 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7745 #: ../en/ch07-filenames.xml:120
|
dongsheng@627
|
7746 msgid ""
|
dongsheng@627
|
7747 "Mercurial supports two kinds of pattern syntax. The most frequently used is "
|
dongsheng@627
|
7748 "called <literal>glob</literal>; this is the same kind of pattern matching "
|
dongsheng@627
|
7749 "used by the Unix shell, and should be familiar to Windows command prompt "
|
dongsheng@627
|
7750 "users, too."
|
dongsheng@627
|
7751 msgstr ""
|
dongsheng@627
|
7752
|
dongsheng@627
|
7753 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7754 #: ../en/ch07-filenames.xml:125
|
dongsheng@627
|
7755 msgid ""
|
dongsheng@627
|
7756 "When Mercurial does automatic pattern matching on Windows, it uses "
|
dongsheng@627
|
7757 "<literal>glob</literal> syntax. You can thus omit the <quote><literal>glob:</"
|
dongsheng@627
|
7758 "literal></quote> prefix on Windows, but it's safe to use it, too."
|
dongsheng@627
|
7759 msgstr ""
|
dongsheng@627
|
7760
|
dongsheng@627
|
7761 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7762 #: ../en/ch07-filenames.xml:130
|
dongsheng@627
|
7763 msgid ""
|
dongsheng@627
|
7764 "The <literal>re</literal> syntax is more powerful; it lets you specify "
|
dongsheng@627
|
7765 "patterns using regular expressions, also known as regexps."
|
dongsheng@627
|
7766 msgstr ""
|
dongsheng@627
|
7767
|
dongsheng@627
|
7768 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7769 #: ../en/ch07-filenames.xml:134
|
dongsheng@627
|
7770 msgid ""
|
dongsheng@627
|
7771 "By the way, in the examples that follow, notice that I'm careful to wrap all "
|
dongsheng@627
|
7772 "of my patterns in quote characters, so that they won't get expanded by the "
|
dongsheng@627
|
7773 "shell before Mercurial sees them."
|
dongsheng@627
|
7774 msgstr ""
|
dongsheng@627
|
7775
|
dongsheng@627
|
7776 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
7777 #: ../en/ch07-filenames.xml:140
|
dongsheng@627
|
7778 msgid "Shell-style <literal>glob</literal> patterns"
|
dongsheng@630
|
7779 msgstr "外壳风格的 <literal>glob</literal> 模式"
|
dongsheng@627
|
7780
|
dongsheng@627
|
7781 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
7782 #: ../en/ch07-filenames.xml:142
|
dongsheng@627
|
7783 msgid ""
|
dongsheng@627
|
7784 "This is an overview of the kinds of patterns you can use when you're matching "
|
dongsheng@627
|
7785 "on glob patterns."
|
dongsheng@627
|
7786 msgstr ""
|
dongsheng@627
|
7787
|
dongsheng@627
|
7788 #
|
dongsheng@627
|
7789 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
7790 #: ../en/ch07-filenames.xml:145
|
dongsheng@627
|
7791 msgid ""
|
dongsheng@627
|
7792 "The <quote><literal>*</literal></quote> character matches any string, within "
|
dongsheng@627
|
7793 "a single directory."
|
dongsheng@627
|
7794 msgstr ""
|
dongsheng@627
|
7795
|
dongsheng@627
|
7796 #
|
dongsheng@627
|
7797 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
7798 #: ../en/ch07-filenames.xml:150
|
dongsheng@627
|
7799 msgid ""
|
dongsheng@627
|
7800 "The <quote><literal>**</literal></quote> pattern matches any string, and "
|
dongsheng@627
|
7801 "crosses directory boundaries. It's not a standard Unix glob token, but it's "
|
dongsheng@627
|
7802 "accepted by several popular Unix shells, and is very useful."
|
dongsheng@627
|
7803 msgstr ""
|
dongsheng@627
|
7804
|
dongsheng@627
|
7805 #
|
dongsheng@627
|
7806 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
7807 #: ../en/ch07-filenames.xml:157
|
dongsheng@627
|
7808 msgid ""
|
dongsheng@627
|
7809 "The <quote><literal>?</literal></quote> pattern matches any single character."
|
dongsheng@627
|
7810 msgstr ""
|
dongsheng@627
|
7811
|
dongsheng@627
|
7812 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
7813 #: ../en/ch07-filenames.xml:162
|
dongsheng@627
|
7814 msgid ""
|
dongsheng@627
|
7815 "The <quote><literal>[</literal></quote> character begins a "
|
dongsheng@627
|
7816 "<emphasis>character class</emphasis>. This matches any single character "
|
dongsheng@627
|
7817 "within the class. The class ends with a <quote><literal>]</literal></quote> "
|
dongsheng@627
|
7818 "character. A class may contain multiple <emphasis>range</emphasis>s of the "
|
dongsheng@627
|
7819 "form <quote><literal>a-f</literal></quote>, which is shorthand for "
|
dongsheng@627
|
7820 "<quote><literal>abcdef</literal></quote>."
|
dongsheng@627
|
7821 msgstr ""
|
dongsheng@627
|
7822
|
dongsheng@627
|
7823 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
7824 #: ../en/ch07-filenames.xml:172
|
dongsheng@627
|
7825 msgid ""
|
dongsheng@627
|
7826 "If the first character after the <quote><literal>[</literal></quote> in a "
|
dongsheng@627
|
7827 "character class is a <quote><literal>!</literal></quote>, it "
|
dongsheng@627
|
7828 "<emphasis>negates</emphasis> the class, making it match any single character "
|
dongsheng@627
|
7829 "not in the class."
|
dongsheng@627
|
7830 msgstr ""
|
dongsheng@627
|
7831
|
dongsheng@627
|
7832 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
7833 #: ../en/ch07-filenames.xml:178
|
dongsheng@627
|
7834 msgid ""
|
dongsheng@627
|
7835 "A <quote><literal>{</literal></quote> begins a group of subpatterns, where "
|
dongsheng@627
|
7836 "the whole group matches if any subpattern in the group matches. The "
|
dongsheng@627
|
7837 "<quote><literal>,</literal></quote> character separates subpatterns, and "
|
dongsheng@627
|
7838 "<quote><literal>}</literal></quote> ends the group."
|
dongsheng@627
|
7839 msgstr ""
|
dongsheng@627
|
7840
|
dongsheng@627
|
7841 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@627
|
7842 #: ../en/ch07-filenames.xml:187
|
dongsheng@627
|
7843 msgid "Watch out!"
|
dongsheng@630
|
7844 msgstr "千万小心!"
|
dongsheng@627
|
7845
|
dongsheng@627
|
7846 #
|
dongsheng@627
|
7847 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
7848 #: ../en/ch07-filenames.xml:189
|
dongsheng@627
|
7849 msgid ""
|
dongsheng@627
|
7850 "Don't forget that if you want to match a pattern in any directory, you should "
|
dongsheng@627
|
7851 "not be using the <quote><literal>*</literal></quote> match-any token, as this "
|
dongsheng@627
|
7852 "will only match within one directory. Instead, use the <quote><literal>**</"
|
dongsheng@627
|
7853 "literal></quote> token. This small example illustrates the difference "
|
dongsheng@627
|
7854 "between the two."
|
dongsheng@627
|
7855 msgstr ""
|
dongsheng@627
|
7856
|
dongsheng@627
|
7857 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
7858 #: ../en/ch07-filenames.xml:201
|
dongsheng@627
|
7859 msgid "Regular expression matching with <literal>re</literal> patterns"
|
dongsheng@630
|
7860 msgstr "使用 <literal>re</literal> 模式的正则表达式匹配"
|
dongsheng@627
|
7861
|
dongsheng@627
|
7862 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
7863 #: ../en/ch07-filenames.xml:204
|
dongsheng@627
|
7864 msgid ""
|
dongsheng@627
|
7865 "Mercurial accepts the same regular expression syntax as the Python "
|
dongsheng@627
|
7866 "programming language (it uses Python's regexp engine internally). This is "
|
dongsheng@627
|
7867 "based on the Perl language's regexp syntax, which is the most popular dialect "
|
dongsheng@627
|
7868 "in use (it's also used in Java, for example)."
|
dongsheng@627
|
7869 msgstr ""
|
dongsheng@627
|
7870
|
dongsheng@627
|
7871 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
7872 #: ../en/ch07-filenames.xml:210
|
dongsheng@627
|
7873 msgid ""
|
dongsheng@627
|
7874 "I won't discuss Mercurial's regexp dialect in any detail here, as regexps are "
|
dongsheng@627
|
7875 "not often used. Perl-style regexps are in any case already exhaustively "
|
dongsheng@627
|
7876 "documented on a multitude of web sites, and in many books. Instead, I will "
|
dongsheng@627
|
7877 "focus here on a few things you should know if you find yourself needing to "
|
dongsheng@627
|
7878 "use regexps with Mercurial."
|
dongsheng@627
|
7879 msgstr ""
|
dongsheng@627
|
7880
|
dongsheng@627
|
7881 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
7882 #: ../en/ch07-filenames.xml:217
|
dongsheng@627
|
7883 msgid ""
|
dongsheng@627
|
7884 "A regexp is matched against an entire file name, relative to the root of the "
|
dongsheng@627
|
7885 "repository. In other words, even if you're already in subbdirectory "
|
dongsheng@627
|
7886 "<filename class=\"directory\">foo</filename>, if you want to match files "
|
dongsheng@627
|
7887 "under this directory, your pattern must start with <quote><literal>foo/</"
|
dongsheng@627
|
7888 "literal></quote>."
|
dongsheng@627
|
7889 msgstr ""
|
dongsheng@627
|
7890
|
dongsheng@627
|
7891 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
7892 #: ../en/ch07-filenames.xml:224
|
dongsheng@627
|
7893 msgid ""
|
dongsheng@627
|
7894 "One thing to note, if you're familiar with Perl-style regexps, is that "
|
dongsheng@627
|
7895 "Mercurial's are <emphasis>rooted</emphasis>. That is, a regexp starts "
|
dongsheng@627
|
7896 "matching against the beginning of a string; it doesn't look for a match "
|
dongsheng@627
|
7897 "anywhere within the string. To match anywhere in a string, start your "
|
dongsheng@627
|
7898 "pattern with <quote><literal>.*</literal></quote>."
|
dongsheng@627
|
7899 msgstr ""
|
dongsheng@627
|
7900
|
dongsheng@627
|
7901 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
7902 #: ../en/ch07-filenames.xml:234
|
dongsheng@627
|
7903 msgid "Filtering files"
|
dongsheng@630
|
7904 msgstr "过滤文件"
|
dongsheng@627
|
7905
|
dongsheng@627
|
7906 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7907 #: ../en/ch07-filenames.xml:236
|
dongsheng@627
|
7908 msgid ""
|
dongsheng@627
|
7909 "Not only does Mercurial give you a variety of ways to specify files; it lets "
|
dongsheng@627
|
7910 "you further winnow those files using <emphasis>filters</emphasis>. Commands "
|
dongsheng@627
|
7911 "that work with file names accept two filtering options."
|
dongsheng@627
|
7912 msgstr ""
|
dongsheng@627
|
7913
|
dongsheng@627
|
7914 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
7915 #: ../en/ch07-filenames.xml:241
|
dongsheng@627
|
7916 msgid ""
|
dongsheng@627
|
7917 "<option role=\"hg-opt-global\">-I</option>, or <option role=\"hg-opt-global"
|
dongsheng@627
|
7918 "\">--include</option>, lets you specify a pattern that file names must match "
|
dongsheng@627
|
7919 "in order to be processed."
|
dongsheng@627
|
7920 msgstr ""
|
dongsheng@627
|
7921
|
dongsheng@627
|
7922 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
7923 #: ../en/ch07-filenames.xml:246
|
dongsheng@627
|
7924 msgid ""
|
dongsheng@627
|
7925 "<option role=\"hg-opt-global\">-X</option>, or <option role=\"hg-opt-global"
|
dongsheng@627
|
7926 "\">--exclude</option>, gives you a way to <emphasis>avoid</emphasis> "
|
dongsheng@627
|
7927 "processing files, if they match this pattern."
|
dongsheng@627
|
7928 msgstr ""
|
dongsheng@627
|
7929
|
dongsheng@627
|
7930 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7931 #: ../en/ch07-filenames.xml:251
|
dongsheng@627
|
7932 msgid ""
|
dongsheng@627
|
7933 "You can provide multiple <option role=\"hg-opt-global\">-I</option> and "
|
dongsheng@627
|
7934 "<option role=\"hg-opt-global\">-X</option> options on the command line, and "
|
dongsheng@627
|
7935 "intermix them as you please. Mercurial interprets the patterns you provide "
|
dongsheng@627
|
7936 "using glob syntax by default (but you can use regexps if you need to)."
|
dongsheng@627
|
7937 msgstr ""
|
dongsheng@627
|
7938
|
dongsheng@627
|
7939 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7940 #: ../en/ch07-filenames.xml:258
|
dongsheng@627
|
7941 msgid ""
|
dongsheng@627
|
7942 "You can read a <option role=\"hg-opt-global\">-I</option> filter as "
|
dongsheng@627
|
7943 "<quote>process only the files that match this filter</quote>."
|
dongsheng@627
|
7944 msgstr ""
|
dongsheng@627
|
7945
|
dongsheng@627
|
7946 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7947 #: ../en/ch07-filenames.xml:264
|
dongsheng@627
|
7948 msgid ""
|
dongsheng@627
|
7949 "The <option role=\"hg-opt-global\">-X</option> filter is best read as "
|
dongsheng@627
|
7950 "<quote>process only the files that don't match this pattern</quote>."
|
dongsheng@627
|
7951 msgstr ""
|
dongsheng@627
|
7952
|
dongsheng@627
|
7953 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
7954 #: ../en/ch07-filenames.xml:272
|
dongsheng@627
|
7955 msgid "Ignoring unwanted files and directories"
|
dongsheng@630
|
7956 msgstr "忽略不需要的文件和目录"
|
dongsheng@627
|
7957
|
dongsheng@627
|
7958 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7959 #: ../en/ch07-filenames.xml:274
|
dongsheng@627
|
7960 msgid "XXX."
|
dongsheng@627
|
7961 msgstr ""
|
dongsheng@627
|
7962
|
dongsheng@627
|
7963 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
7964 #: ../en/ch07-filenames.xml:278
|
dongsheng@627
|
7965 msgid "Case sensitivity"
|
dongsheng@630
|
7966 msgstr "大小写敏感性"
|
dongsheng@627
|
7967
|
dongsheng@627
|
7968 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7969 #: ../en/ch07-filenames.xml:280
|
dongsheng@627
|
7970 msgid ""
|
dongsheng@627
|
7971 "If you're working in a mixed development environment that contains both Linux "
|
dongsheng@627
|
7972 "(or other Unix) systems and Macs or Windows systems, you should keep in the "
|
dongsheng@627
|
7973 "back of your mind the knowledge that they treat the case (<quote>N</quote> "
|
dongsheng@627
|
7974 "versus <quote>n</quote>) of file names in incompatible ways. This is not "
|
dongsheng@627
|
7975 "very likely to affect you, and it's easy to deal with if it does, but it "
|
dongsheng@627
|
7976 "could surprise you if you don't know about it."
|
dongsheng@627
|
7977 msgstr ""
|
dongsheng@627
|
7978
|
dongsheng@627
|
7979 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
7980 #: ../en/ch07-filenames.xml:289
|
dongsheng@627
|
7981 msgid ""
|
dongsheng@627
|
7982 "Operating systems and filesystems differ in the way they handle the "
|
dongsheng@627
|
7983 "<emphasis>case</emphasis> of characters in file and directory names. There "
|
dongsheng@627
|
7984 "are three common ways to handle case in names."
|
dongsheng@627
|
7985 msgstr ""
|
dongsheng@627
|
7986
|
dongsheng@627
|
7987 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
7988 #: ../en/ch07-filenames.xml:294
|
dongsheng@627
|
7989 msgid ""
|
dongsheng@627
|
7990 "Completely case insensitive. Uppercase and lowercase versions of a letter "
|
dongsheng@627
|
7991 "are treated as identical, both when creating a file and during subsequent "
|
dongsheng@627
|
7992 "accesses. This is common on older DOS-based systems."
|
dongsheng@627
|
7993 msgstr ""
|
dongsheng@627
|
7994
|
dongsheng@627
|
7995 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
7996 #: ../en/ch07-filenames.xml:299
|
dongsheng@627
|
7997 msgid ""
|
dongsheng@627
|
7998 "Case preserving, but insensitive. When a file or directory is created, the "
|
dongsheng@627
|
7999 "case of its name is stored, and can be retrieved and displayed by the "
|
dongsheng@627
|
8000 "operating system. When an existing file is being looked up, its case is "
|
dongsheng@627
|
8001 "ignored. This is the standard arrangement on Windows and MacOS. The names "
|
dongsheng@627
|
8002 "<filename>foo</filename> and <filename>FoO</filename> identify the same "
|
dongsheng@627
|
8003 "file. This treatment of uppercase and lowercase letters as interchangeable "
|
dongsheng@627
|
8004 "is also referred to as <emphasis>case folding</emphasis>."
|
dongsheng@627
|
8005 msgstr ""
|
dongsheng@627
|
8006
|
dongsheng@627
|
8007 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
8008 #: ../en/ch07-filenames.xml:310
|
dongsheng@627
|
8009 msgid ""
|
dongsheng@627
|
8010 "Case sensitive. The case of a name is significant at all times. The names "
|
dongsheng@627
|
8011 "<filename>foo</filename> and {FoO} identify different files. This is the way "
|
dongsheng@627
|
8012 "Linux and Unix systems normally work."
|
dongsheng@627
|
8013 msgstr ""
|
dongsheng@627
|
8014
|
dongsheng@627
|
8015 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8016 #: ../en/ch07-filenames.xml:316
|
dongsheng@627
|
8017 msgid ""
|
dongsheng@627
|
8018 "On Unix-like systems, it is possible to have any or all of the above ways of "
|
dongsheng@627
|
8019 "handling case in action at once. For example, if you use a USB thumb drive "
|
dongsheng@627
|
8020 "formatted with a FAT32 filesystem on a Linux system, Linux will handle names "
|
dongsheng@627
|
8021 "on that filesystem in a case preserving, but insensitive, way."
|
dongsheng@627
|
8022 msgstr ""
|
dongsheng@627
|
8023
|
dongsheng@627
|
8024 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
8025 #: ../en/ch07-filenames.xml:323
|
dongsheng@627
|
8026 msgid "Safe, portable repository storage"
|
dongsheng@630
|
8027 msgstr "安全,可移植的版本库存储"
|
dongsheng@627
|
8028
|
dongsheng@627
|
8029 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8030 #: ../en/ch07-filenames.xml:325
|
dongsheng@627
|
8031 msgid ""
|
dongsheng@627
|
8032 "Mercurial's repository storage mechanism is <emphasis>case safe</emphasis>. "
|
dongsheng@627
|
8033 "It translates file names so that they can be safely stored on both case "
|
dongsheng@627
|
8034 "sensitive and case insensitive filesystems. This means that you can use "
|
dongsheng@627
|
8035 "normal file copying tools to transfer a Mercurial repository onto, for "
|
dongsheng@627
|
8036 "example, a USB thumb drive, and safely move that drive and repository back "
|
dongsheng@627
|
8037 "and forth between a Mac, a PC running Windows, and a Linux box."
|
dongsheng@627
|
8038 msgstr ""
|
dongsheng@627
|
8039
|
dongsheng@627
|
8040 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
8041 #: ../en/ch07-filenames.xml:336
|
dongsheng@627
|
8042 msgid "Detecting case conflicts"
|
dongsheng@630
|
8043 msgstr "检测大小写冲突"
|
dongsheng@627
|
8044
|
dongsheng@627
|
8045 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8046 #: ../en/ch07-filenames.xml:338
|
dongsheng@627
|
8047 msgid ""
|
dongsheng@627
|
8048 "When operating in the working directory, Mercurial honours the naming policy "
|
dongsheng@627
|
8049 "of the filesystem where the working directory is located. If the filesystem "
|
dongsheng@627
|
8050 "is case preserving, but insensitive, Mercurial will treat names that differ "
|
dongsheng@627
|
8051 "only in case as the same."
|
dongsheng@627
|
8052 msgstr ""
|
dongsheng@627
|
8053
|
dongsheng@627
|
8054 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8055 #: ../en/ch07-filenames.xml:344
|
dongsheng@627
|
8056 msgid ""
|
dongsheng@627
|
8057 "An important aspect of this approach is that it is possible to commit a "
|
dongsheng@627
|
8058 "changeset on a case sensitive (typically Linux or Unix) filesystem that will "
|
dongsheng@627
|
8059 "cause trouble for users on case insensitive (usually Windows and MacOS) "
|
dongsheng@627
|
8060 "users. If a Linux user commits changes to two files, one named "
|
dongsheng@627
|
8061 "<filename>myfile.c</filename> and the other named <filename>MyFile.C</"
|
dongsheng@627
|
8062 "filename>, they will be stored correctly in the repository. And in the "
|
dongsheng@627
|
8063 "working directories of other Linux users, they will be correctly represented "
|
dongsheng@627
|
8064 "as separate files."
|
dongsheng@627
|
8065 msgstr ""
|
dongsheng@627
|
8066
|
dongsheng@627
|
8067 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8068 #: ../en/ch07-filenames.xml:355
|
dongsheng@627
|
8069 msgid ""
|
dongsheng@627
|
8070 "If a Windows or Mac user pulls this change, they will not initially have a "
|
dongsheng@627
|
8071 "problem, because Mercurial's repository storage mechanism is case safe. "
|
dongsheng@627
|
8072 "However, once they try to <command role=\"hg-cmd\">hg update</command> the "
|
dongsheng@627
|
8073 "working directory to that changeset, or <command role=\"hg-cmd\">hg merge</"
|
dongsheng@627
|
8074 "command> with that changeset, Mercurial will spot the conflict between the "
|
dongsheng@627
|
8075 "two file names that the filesystem would treat as the same, and forbid the "
|
dongsheng@627
|
8076 "update or merge from occurring."
|
dongsheng@627
|
8077 msgstr ""
|
dongsheng@627
|
8078
|
dongsheng@627
|
8079 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
8080 #: ../en/ch07-filenames.xml:367
|
dongsheng@627
|
8081 msgid "Fixing a case conflict"
|
dongsheng@630
|
8082 msgstr "修正大小写冲突"
|
dongsheng@627
|
8083
|
dongsheng@627
|
8084 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8085 #: ../en/ch07-filenames.xml:369
|
dongsheng@627
|
8086 msgid ""
|
dongsheng@627
|
8087 "If you are using Windows or a Mac in a mixed environment where some of your "
|
dongsheng@627
|
8088 "collaborators are using Linux or Unix, and Mercurial reports a case folding "
|
dongsheng@627
|
8089 "conflict when you try to <command role=\"hg-cmd\">hg update</command> or "
|
dongsheng@627
|
8090 "<command role=\"hg-cmd\">hg merge</command>, the procedure to fix the problem "
|
dongsheng@627
|
8091 "is simple."
|
dongsheng@627
|
8092 msgstr ""
|
dongsheng@627
|
8093
|
dongsheng@627
|
8094 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8095 #: ../en/ch07-filenames.xml:376
|
dongsheng@627
|
8096 msgid ""
|
dongsheng@627
|
8097 "Just find a nearby Linux or Unix box, clone the problem repository onto it, "
|
dongsheng@627
|
8098 "and use Mercurial's <command role=\"hg-cmd\">hg rename</command> command to "
|
dongsheng@627
|
8099 "change the names of any offending files or directories so that they will no "
|
dongsheng@627
|
8100 "longer cause case folding conflicts. Commit this change, <command role=\"hg-"
|
dongsheng@627
|
8101 "cmd\">hg pull</command> or <command role=\"hg-cmd\">hg push</command> it "
|
dongsheng@627
|
8102 "across to your Windows or MacOS system, and <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
8103 "update</command> to the revision with the non-conflicting names."
|
dongsheng@627
|
8104 msgstr ""
|
dongsheng@627
|
8105
|
dongsheng@627
|
8106 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8107 #: ../en/ch07-filenames.xml:386
|
dongsheng@627
|
8108 msgid ""
|
dongsheng@627
|
8109 "The changeset with case-conflicting names will remain in your project's "
|
dongsheng@627
|
8110 "history, and you still won't be able to <command role=\"hg-cmd\">hg update</"
|
dongsheng@627
|
8111 "command> your working directory to that changeset on a Windows or MacOS "
|
dongsheng@627
|
8112 "system, but you can continue development unimpeded."
|
dongsheng@627
|
8113 msgstr ""
|
dongsheng@627
|
8114
|
dongsheng@627
|
8115 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@627
|
8116 #: ../en/ch07-filenames.xml:393
|
dongsheng@627
|
8117 msgid ""
|
dongsheng@627
|
8118 "Prior to version 0.9.3, Mercurial did not use a case safe repository storage "
|
dongsheng@627
|
8119 "mechanism, and did not detect case folding conflicts. If you are using an "
|
dongsheng@627
|
8120 "older version of Mercurial on Windows or MacOS, I strongly recommend that you "
|
dongsheng@627
|
8121 "upgrade."
|
dongsheng@627
|
8122 msgstr ""
|
dongsheng@627
|
8123
|
dongsheng@627
|
8124 #. type: Content of: <book><chapter><title>
|
dongsheng@627
|
8125 #: ../en/ch08-branch.xml:5
|
dongsheng@627
|
8126 msgid "Managing releases and branchy development"
|
dongsheng@627
|
8127 msgstr "发布管理与分支开发"
|
dongsheng@627
|
8128
|
dongsheng@627
|
8129 #. type: Content of: <book><chapter><para>
|
dongsheng@627
|
8130 #: ../en/ch08-branch.xml:7
|
dongsheng@627
|
8131 msgid ""
|
dongsheng@627
|
8132 "Mercurial provides several mechanisms for you to manage a project that is "
|
dongsheng@627
|
8133 "making progress on multiple fronts at once. To understand these mechanisms, "
|
dongsheng@627
|
8134 "let's first take a brief look at a fairly normal software project structure."
|
dongsheng@627
|
8135 msgstr ""
|
dongsheng@627
|
8136
|
dongsheng@627
|
8137 #. type: Content of: <book><chapter><para>
|
dongsheng@627
|
8138 #: ../en/ch08-branch.xml:12
|
dongsheng@627
|
8139 msgid ""
|
dongsheng@627
|
8140 "Many software projects issue periodic <quote>major</quote> releases that "
|
dongsheng@627
|
8141 "contain substantial new features. In parallel, they may issue <quote>minor</"
|
dongsheng@627
|
8142 "quote> releases. These are usually identical to the major releases off which "
|
dongsheng@627
|
8143 "they're based, but with a few bugs fixed."
|
dongsheng@627
|
8144 msgstr ""
|
dongsheng@627
|
8145
|
dongsheng@627
|
8146 #. type: Content of: <book><chapter><para>
|
dongsheng@627
|
8147 #: ../en/ch08-branch.xml:18
|
dongsheng@627
|
8148 msgid ""
|
dongsheng@627
|
8149 "In this chapter, we'll start by talking about how to keep records of project "
|
dongsheng@627
|
8150 "milestones such as releases. We'll then continue on to talk about the flow "
|
dongsheng@627
|
8151 "of work between different phases of a project, and how Mercurial can help you "
|
dongsheng@627
|
8152 "to isolate and manage this work."
|
dongsheng@627
|
8153 msgstr ""
|
dongsheng@627
|
8154
|
dongsheng@627
|
8155 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
8156 #: ../en/ch08-branch.xml:25
|
dongsheng@627
|
8157 msgid "Giving a persistent name to a revision"
|
dongsheng@635
|
8158 msgstr "给版本指定一个永久的名称"
|
dongsheng@627
|
8159
|
dongsheng@627
|
8160 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8161 #: ../en/ch08-branch.xml:27
|
dongsheng@627
|
8162 msgid ""
|
dongsheng@627
|
8163 "Once you decide that you'd like to call a particular revision a "
|
dongsheng@627
|
8164 "<quote>release</quote>, it's a good idea to record the identity of that "
|
dongsheng@627
|
8165 "revision. This will let you reproduce that release at a later date, for "
|
dongsheng@627
|
8166 "whatever purpose you might need at the time (reproducing a bug, porting to a "
|
dongsheng@627
|
8167 "new platform, etc). &interaction.tag.init;"
|
dongsheng@627
|
8168 msgstr ""
|
dongsheng@627
|
8169
|
dongsheng@627
|
8170 #
|
dongsheng@627
|
8171 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8172 #: ../en/ch08-branch.xml:34
|
dongsheng@627
|
8173 msgid ""
|
dongsheng@627
|
8174 "Mercurial lets you give a permanent name to any revision using the <command "
|
dongsheng@627
|
8175 "role=\"hg-cmd\">hg tag</command> command. Not surprisingly, these names are "
|
dongsheng@627
|
8176 "called <quote>tags</quote>."
|
dongsheng@627
|
8177 msgstr ""
|
dongsheng@627
|
8178
|
dongsheng@627
|
8179 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8180 #: ../en/ch08-branch.xml:40
|
dongsheng@627
|
8181 msgid ""
|
dongsheng@627
|
8182 "A tag is nothing more than a <quote>symbolic name</quote> for a revision. "
|
dongsheng@627
|
8183 "Tags exist purely for your convenience, so that you have a handy permanent "
|
dongsheng@627
|
8184 "way to refer to a revision; Mercurial doesn't interpret the tag names you use "
|
dongsheng@627
|
8185 "in any way. Neither does Mercurial place any restrictions on the name of a "
|
dongsheng@627
|
8186 "tag, beyond a few that are necessary to ensure that a tag can be parsed "
|
dongsheng@627
|
8187 "unambiguously. A tag name cannot contain any of the following characters:"
|
dongsheng@627
|
8188 msgstr ""
|
dongsheng@627
|
8189
|
dongsheng@627
|
8190 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
8191 #: ../en/ch08-branch.xml:49
|
dongsheng@627
|
8192 msgid "Colon (ASCII 58, <quote><literal>:</literal></quote>)"
|
dongsheng@627
|
8193 msgstr ""
|
dongsheng@627
|
8194
|
dongsheng@627
|
8195 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
8196 #: ../en/ch08-branch.xml:52
|
dongsheng@627
|
8197 msgid "Carriage return (ASCII 13, <quote><literal>\\r</literal></quote>)"
|
dongsheng@627
|
8198 msgstr ""
|
dongsheng@627
|
8199
|
dongsheng@627
|
8200 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
8201 #: ../en/ch08-branch.xml:55
|
dongsheng@627
|
8202 msgid "Newline (ASCII 10, <quote><literal>\\n</literal></quote>)"
|
dongsheng@627
|
8203 msgstr ""
|
dongsheng@627
|
8204
|
dongsheng@627
|
8205 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8206 #: ../en/ch08-branch.xml:59
|
dongsheng@627
|
8207 msgid ""
|
dongsheng@627
|
8208 "You can use the <command role=\"hg-cmd\">hg tags</command> command to display "
|
dongsheng@627
|
8209 "the tags present in your repository. In the output, each tagged revision is "
|
dongsheng@627
|
8210 "identified first by its name, then by revision number, and finally by the "
|
dongsheng@627
|
8211 "unique hash of the revision."
|
dongsheng@627
|
8212 msgstr ""
|
dongsheng@627
|
8213
|
dongsheng@627
|
8214 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8215 #: ../en/ch08-branch.xml:67
|
dongsheng@627
|
8216 msgid ""
|
dongsheng@627
|
8217 "Notice that <literal>tip</literal> is listed in the output of <command role="
|
dongsheng@627
|
8218 "\"hg-cmd\">hg tags</command>. The <literal>tip</literal> tag is a special "
|
dongsheng@627
|
8219 "<quote>floating</quote> tag, which always identifies the newest revision in "
|
dongsheng@627
|
8220 "the repository."
|
dongsheng@627
|
8221 msgstr ""
|
dongsheng@627
|
8222
|
dongsheng@627
|
8223 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8224 #: ../en/ch08-branch.xml:73
|
dongsheng@627
|
8225 msgid ""
|
dongsheng@627
|
8226 "In the output of the <command role=\"hg-cmd\">hg tags</command> command, tags "
|
dongsheng@627
|
8227 "are listed in reverse order, by revision number. This usually means that "
|
dongsheng@627
|
8228 "recent tags are listed before older tags. It also means that <literal>tip</"
|
dongsheng@627
|
8229 "literal> is always going to be the first tag listed in the output of <command "
|
dongsheng@627
|
8230 "role=\"hg-cmd\">hg tags</command>."
|
dongsheng@627
|
8231 msgstr ""
|
dongsheng@627
|
8232
|
dongsheng@627
|
8233 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8234 #: ../en/ch08-branch.xml:80
|
dongsheng@627
|
8235 msgid ""
|
dongsheng@627
|
8236 "When you run <command role=\"hg-cmd\">hg log</command>, if it displays a "
|
dongsheng@627
|
8237 "revision that has tags associated with it, it will print those tags."
|
dongsheng@627
|
8238 msgstr ""
|
dongsheng@627
|
8239
|
dongsheng@627
|
8240 #
|
dongsheng@627
|
8241 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8242 #: ../en/ch08-branch.xml:86
|
dongsheng@627
|
8243 msgid ""
|
dongsheng@627
|
8244 "Any time you need to provide a revision ID to a Mercurial command, the "
|
dongsheng@627
|
8245 "command will accept a tag name in its place. Internally, Mercurial will "
|
dongsheng@627
|
8246 "translate your tag name into the corresponding revision ID, then use that."
|
dongsheng@627
|
8247 msgstr ""
|
dongsheng@627
|
8248
|
dongsheng@627
|
8249 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8250 #: ../en/ch08-branch.xml:93
|
dongsheng@627
|
8251 msgid ""
|
dongsheng@627
|
8252 "There's no limit on the number of tags you can have in a repository, or on "
|
dongsheng@627
|
8253 "the number of tags that a single revision can have. As a practical matter, "
|
dongsheng@627
|
8254 "it's not a great idea to have <quote>too many</quote> (a number which will "
|
dongsheng@627
|
8255 "vary from project to project), simply because tags are supposed to help you "
|
dongsheng@627
|
8256 "to find revisions. If you have lots of tags, the ease of using them to "
|
dongsheng@627
|
8257 "identify revisions diminishes rapidly."
|
dongsheng@627
|
8258 msgstr ""
|
dongsheng@627
|
8259
|
dongsheng@627
|
8260 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8261 #: ../en/ch08-branch.xml:101
|
dongsheng@627
|
8262 msgid ""
|
dongsheng@627
|
8263 "For example, if your project has milestones as frequent as every few days, "
|
dongsheng@627
|
8264 "it's perfectly reasonable to tag each one of those. But if you have a "
|
dongsheng@627
|
8265 "continuous build system that makes sure every revision can be built cleanly, "
|
dongsheng@627
|
8266 "you'd be introducing a lot of noise if you were to tag every clean build. "
|
dongsheng@627
|
8267 "Instead, you could tag failed builds (on the assumption that they're rare!), "
|
dongsheng@627
|
8268 "or simply not use tags to track buildability."
|
dongsheng@627
|
8269 msgstr ""
|
dongsheng@627
|
8270
|
dongsheng@627
|
8271 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8272 #: ../en/ch08-branch.xml:109
|
dongsheng@627
|
8273 msgid ""
|
dongsheng@627
|
8274 "If you want to remove a tag that you no longer want, use <command role=\"hg-"
|
dongsheng@627
|
8275 "cmd\">hg tag --remove</command>."
|
dongsheng@627
|
8276 msgstr ""
|
dongsheng@627
|
8277
|
dongsheng@627
|
8278 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8279 #: ../en/ch08-branch.xml:114
|
dongsheng@627
|
8280 msgid ""
|
dongsheng@627
|
8281 "You can also modify a tag at any time, so that it identifies a different "
|
dongsheng@627
|
8282 "revision, by simply issuing a new <command role=\"hg-cmd\">hg tag</command> "
|
dongsheng@627
|
8283 "command. You'll have to use the <option role=\"hg-opt-tag\">-f</option> "
|
dongsheng@627
|
8284 "option to tell Mercurial that you <emphasis>really</emphasis> want to update "
|
dongsheng@627
|
8285 "the tag."
|
dongsheng@627
|
8286 msgstr ""
|
dongsheng@627
|
8287
|
dongsheng@627
|
8288 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8289 #: ../en/ch08-branch.xml:123
|
dongsheng@627
|
8290 msgid ""
|
dongsheng@627
|
8291 "There will still be a permanent record of the previous identity of the tag, "
|
dongsheng@627
|
8292 "but Mercurial will no longer use it. There's thus no penalty to tagging the "
|
dongsheng@627
|
8293 "wrong revision; all you have to do is turn around and tag the correct "
|
dongsheng@627
|
8294 "revision once you discover your error."
|
dongsheng@627
|
8295 msgstr ""
|
dongsheng@627
|
8296
|
dongsheng@627
|
8297 #
|
dongsheng@627
|
8298 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8299 #: ../en/ch08-branch.xml:129
|
dongsheng@627
|
8300 msgid ""
|
dongsheng@627
|
8301 "Mercurial stores tags in a normal revision-controlled file in your "
|
dongsheng@627
|
8302 "repository. If you've created any tags, you'll find them in a file named "
|
dongsheng@627
|
8303 "<filename role=\"special\">.hgtags</filename>. When you run the <command "
|
dongsheng@627
|
8304 "role=\"hg-cmd\">hg tag</command> command, Mercurial modifies this file, then "
|
dongsheng@627
|
8305 "automatically commits the change to it. This means that every time you run "
|
dongsheng@627
|
8306 "<command role=\"hg-cmd\">hg tag</command>, you'll see a corresponding "
|
dongsheng@627
|
8307 "changeset in the output of <command role=\"hg-cmd\">hg log</command>."
|
dongsheng@627
|
8308 msgstr ""
|
dongsheng@627
|
8309
|
dongsheng@627
|
8310 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
8311 #: ../en/ch08-branch.xml:142
|
dongsheng@627
|
8312 msgid "Handling tag conflicts during a merge"
|
dongsheng@635
|
8313 msgstr "在合并期间处理标签冲突"
|
dongsheng@627
|
8314
|
dongsheng@627
|
8315 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8316 #: ../en/ch08-branch.xml:144
|
dongsheng@627
|
8317 msgid ""
|
dongsheng@627
|
8318 "You won't often need to care about the <filename role=\"special\">.hgtags</"
|
dongsheng@627
|
8319 "filename> file, but it sometimes makes its presence known during a merge. "
|
dongsheng@627
|
8320 "The format of the file is simple: it consists of a series of lines. Each "
|
dongsheng@627
|
8321 "line starts with a changeset hash, followed by a space, followed by the name "
|
dongsheng@627
|
8322 "of a tag."
|
dongsheng@627
|
8323 msgstr ""
|
dongsheng@627
|
8324
|
dongsheng@627
|
8325 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8326 #: ../en/ch08-branch.xml:151
|
dongsheng@627
|
8327 msgid ""
|
dongsheng@627
|
8328 "If you're resolving a conflict in the <filename role=\"special\">.hgtags</"
|
dongsheng@627
|
8329 "filename> file during a merge, there's one twist to modifying the <filename "
|
dongsheng@627
|
8330 "role=\"special\">.hgtags</filename> file: when Mercurial is parsing the tags "
|
dongsheng@627
|
8331 "in a repository, it <emphasis>never</emphasis> reads the working copy of the "
|
dongsheng@627
|
8332 "<filename role=\"special\">.hgtags</filename> file. Instead, it reads the "
|
dongsheng@627
|
8333 "<emphasis>most recently committed</emphasis> revision of the file."
|
dongsheng@627
|
8334 msgstr ""
|
dongsheng@627
|
8335
|
dongsheng@627
|
8336 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8337 #: ../en/ch08-branch.xml:161
|
dongsheng@627
|
8338 msgid ""
|
dongsheng@627
|
8339 "An unfortunate consequence of this design is that you can't actually verify "
|
dongsheng@627
|
8340 "that your merged <filename role=\"special\">.hgtags</filename> file is "
|
dongsheng@627
|
8341 "correct until <emphasis>after</emphasis> you've committed a change. So if "
|
dongsheng@627
|
8342 "you find yourself resolving a conflict on <filename role=\"special\">.hgtags</"
|
dongsheng@627
|
8343 "filename> during a merge, be sure to run <command role=\"hg-cmd\">hg tags</"
|
dongsheng@627
|
8344 "command> after you commit. If it finds an error in the <filename role="
|
dongsheng@627
|
8345 "\"special\">.hgtags</filename> file, it will report the location of the "
|
dongsheng@627
|
8346 "error, which you can then fix and commit. You should then run <command role="
|
dongsheng@627
|
8347 "\"hg-cmd\">hg tags</command> again, just to be sure that your fix is correct."
|
dongsheng@627
|
8348 msgstr ""
|
dongsheng@627
|
8349
|
dongsheng@627
|
8350 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
8351 #: ../en/ch08-branch.xml:176
|
dongsheng@627
|
8352 msgid "Tags and cloning"
|
dongsheng@635
|
8353 msgstr "标签与克隆"
|
dongsheng@627
|
8354
|
dongsheng@627
|
8355 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8356 #: ../en/ch08-branch.xml:178
|
dongsheng@627
|
8357 msgid ""
|
dongsheng@627
|
8358 "You may have noticed that the <command role=\"hg-cmd\">hg clone</command> "
|
dongsheng@627
|
8359 "command has a <option role=\"hg-opt-clone\">-r</option> option that lets you "
|
dongsheng@627
|
8360 "clone an exact copy of the repository as of a particular changeset. The new "
|
dongsheng@627
|
8361 "clone will not contain any project history that comes after the revision you "
|
dongsheng@627
|
8362 "specified. This has an interaction with tags that can surprise the unwary."
|
dongsheng@627
|
8363 msgstr ""
|
dongsheng@627
|
8364
|
dongsheng@627
|
8365 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8366 #: ../en/ch08-branch.xml:186
|
dongsheng@627
|
8367 msgid ""
|
dongsheng@627
|
8368 "Recall that a tag is stored as a revision to the <filename role=\"special\">."
|
dongsheng@627
|
8369 "hgtags</filename> file, so that when you create a tag, the changeset in which "
|
dongsheng@627
|
8370 "it's recorded necessarily refers to an older changeset. When you run "
|
dongsheng@627
|
8371 "<command role=\"hg-cmd\">hg clone -r foo</command> to clone a repository as "
|
dongsheng@627
|
8372 "of tag <literal>foo</literal>, the new clone <emphasis>will not contain the "
|
dongsheng@627
|
8373 "history that created the tag</emphasis> that you used to clone the "
|
dongsheng@627
|
8374 "repository. The result is that you'll get exactly the right subset of the "
|
dongsheng@627
|
8375 "project's history in the new repository, but <emphasis>not</emphasis> the tag "
|
dongsheng@627
|
8376 "you might have expected."
|
dongsheng@627
|
8377 msgstr ""
|
dongsheng@627
|
8378
|
dongsheng@627
|
8379 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
8380 #: ../en/ch08-branch.xml:201
|
dongsheng@627
|
8381 msgid "When permanent tags are too much"
|
dongsheng@635
|
8382 msgstr "当永久标签太多的时候"
|
dongsheng@627
|
8383
|
dongsheng@627
|
8384 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8385 #: ../en/ch08-branch.xml:203
|
dongsheng@627
|
8386 msgid ""
|
dongsheng@627
|
8387 "Since Mercurial's tags are revision controlled and carried around with a "
|
dongsheng@627
|
8388 "project's history, everyone you work with will see the tags you create. But "
|
dongsheng@627
|
8389 "giving names to revisions has uses beyond simply noting that revision "
|
dongsheng@627
|
8390 "<literal>4237e45506ee</literal> is really <literal>v2.0.2</literal>. If "
|
dongsheng@627
|
8391 "you're trying to track down a subtle bug, you might want a tag to remind you "
|
dongsheng@627
|
8392 "of something like <quote>Anne saw the symptoms with this revision</quote>."
|
dongsheng@627
|
8393 msgstr ""
|
dongsheng@627
|
8394
|
dongsheng@627
|
8395 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8396 #: ../en/ch08-branch.xml:213
|
dongsheng@627
|
8397 msgid ""
|
dongsheng@627
|
8398 "For cases like this, what you might want to use are <emphasis>local</"
|
dongsheng@627
|
8399 "emphasis> tags. You can create a local tag with the <option role=\"hg-opt-tag"
|
dongsheng@627
|
8400 "\">-l</option> option to the <command role=\"hg-cmd\">hg tag</command> "
|
dongsheng@627
|
8401 "command. This will store the tag in a file called <filename role=\"special"
|
dongsheng@627
|
8402 "\">.hg/localtags</filename>. Unlike <filename role=\"special\">.hgtags</"
|
dongsheng@627
|
8403 "filename>, <filename role=\"special\">.hg/localtags</filename> is not "
|
dongsheng@627
|
8404 "revision controlled. Any tags you create using <option role=\"hg-opt-tag\">-"
|
dongsheng@627
|
8405 "l</option> remain strictly local to the repository you're currently working "
|
dongsheng@627
|
8406 "in."
|
dongsheng@627
|
8407 msgstr ""
|
dongsheng@627
|
8408
|
dongsheng@627
|
8409 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
8410 #: ../en/ch08-branch.xml:228
|
dongsheng@627
|
8411 msgid "The flow of changes&emdash;big picture vs. little"
|
dongsheng@635
|
8412 msgstr "修改流程&emdash;宏观与微观"
|
dongsheng@627
|
8413
|
dongsheng@627
|
8414 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8415 #: ../en/ch08-branch.xml:230
|
dongsheng@627
|
8416 msgid ""
|
dongsheng@627
|
8417 "To return to the outline I sketched at the beginning of a chapter, let's "
|
dongsheng@627
|
8418 "think about a project that has multiple concurrent pieces of work under "
|
dongsheng@627
|
8419 "development at once."
|
dongsheng@627
|
8420 msgstr ""
|
dongsheng@627
|
8421
|
dongsheng@627
|
8422 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8423 #: ../en/ch08-branch.xml:234
|
dongsheng@627
|
8424 msgid ""
|
dongsheng@627
|
8425 "There might be a push for a new <quote>main</quote> release; a new minor "
|
dongsheng@627
|
8426 "bugfix release to the last main release; and an unexpected <quote>hot fix</"
|
dongsheng@627
|
8427 "quote> to an old release that is now in maintenance mode."
|
dongsheng@627
|
8428 msgstr ""
|
dongsheng@627
|
8429
|
dongsheng@627
|
8430 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8431 #: ../en/ch08-branch.xml:239
|
dongsheng@627
|
8432 msgid ""
|
dongsheng@627
|
8433 "The usual way people refer to these different concurrent directions of "
|
dongsheng@627
|
8434 "development is as <quote>branches</quote>. However, we've already seen "
|
dongsheng@627
|
8435 "numerous times that Mercurial treats <emphasis>all of history</emphasis> as a "
|
dongsheng@627
|
8436 "series of branches and merges. Really, what we have here is two ideas that "
|
dongsheng@627
|
8437 "are peripherally related, but which happen to share a name."
|
dongsheng@627
|
8438 msgstr ""
|
dongsheng@627
|
8439
|
dongsheng@627
|
8440 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
8441 #: ../en/ch08-branch.xml:246
|
dongsheng@627
|
8442 msgid ""
|
dongsheng@627
|
8443 "<quote>Big picture</quote> branches represent the sweep of a project's "
|
dongsheng@627
|
8444 "evolution; people give them names, and talk about them in conversation."
|
dongsheng@627
|
8445 msgstr ""
|
dongsheng@627
|
8446
|
dongsheng@627
|
8447 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
8448 #: ../en/ch08-branch.xml:250
|
dongsheng@627
|
8449 msgid ""
|
dongsheng@627
|
8450 "<quote>Little picture</quote> branches are artefacts of the day-to-day "
|
dongsheng@627
|
8451 "activity of developing and merging changes. They expose the narrative of how "
|
dongsheng@627
|
8452 "the code was developed."
|
dongsheng@627
|
8453 msgstr ""
|
dongsheng@627
|
8454
|
dongsheng@627
|
8455 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
8456 #: ../en/ch08-branch.xml:258
|
dongsheng@627
|
8457 msgid "Managing big-picture branches in repositories"
|
dongsheng@635
|
8458 msgstr "在版本库中管理分支"
|
dongsheng@627
|
8459
|
dongsheng@627
|
8460 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8461 #: ../en/ch08-branch.xml:260
|
dongsheng@627
|
8462 msgid ""
|
dongsheng@627
|
8463 "The easiest way to isolate a <quote>big picture</quote> branch in Mercurial "
|
dongsheng@627
|
8464 "is in a dedicated repository. If you have an existing shared "
|
dongsheng@627
|
8465 "repository&emdash;let's call it <literal>myproject</literal>&emdash;that "
|
dongsheng@627
|
8466 "reaches a <quote>1.0</quote> milestone, you can start to prepare for future "
|
dongsheng@627
|
8467 "maintenance releases on top of version 1.0 by tagging the revision from which "
|
dongsheng@627
|
8468 "you prepared the 1.0 release."
|
dongsheng@627
|
8469 msgstr ""
|
dongsheng@627
|
8470
|
dongsheng@627
|
8471 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8472 #: ../en/ch08-branch.xml:270
|
dongsheng@627
|
8473 msgid ""
|
dongsheng@627
|
8474 "You can then clone a new shared <literal>myproject-1.0.1</literal> repository "
|
dongsheng@627
|
8475 "as of that tag."
|
dongsheng@627
|
8476 msgstr ""
|
dongsheng@627
|
8477
|
dongsheng@627
|
8478 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8479 #: ../en/ch08-branch.xml:276
|
dongsheng@627
|
8480 msgid ""
|
dongsheng@627
|
8481 "Afterwards, if someone needs to work on a bug fix that ought to go into an "
|
dongsheng@627
|
8482 "upcoming 1.0.1 minor release, they clone the <literal>myproject-1.0.1</"
|
dongsheng@627
|
8483 "literal> repository, make their changes, and push them back."
|
dongsheng@627
|
8484 msgstr ""
|
dongsheng@627
|
8485
|
dongsheng@627
|
8486 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8487 #: ../en/ch08-branch.xml:283
|
dongsheng@627
|
8488 msgid ""
|
dongsheng@627
|
8489 "Meanwhile, development for the next major release can continue, isolated and "
|
dongsheng@627
|
8490 "unabated, in the <literal>myproject</literal> repository."
|
dongsheng@627
|
8491 msgstr ""
|
dongsheng@627
|
8492
|
dongsheng@627
|
8493 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
8494 #: ../en/ch08-branch.xml:291
|
dongsheng@627
|
8495 msgid "Don't repeat yourself: merging across branches"
|
dongsheng@635
|
8496 msgstr "不要重复劳动:在分支间合并"
|
dongsheng@627
|
8497
|
dongsheng@627
|
8498 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8499 #: ../en/ch08-branch.xml:293
|
dongsheng@627
|
8500 msgid ""
|
dongsheng@627
|
8501 "In many cases, if you have a bug to fix on a maintenance branch, the chances "
|
dongsheng@627
|
8502 "are good that the bug exists on your project's main branch (and possibly "
|
dongsheng@627
|
8503 "other maintenance branches, too). It's a rare developer who wants to fix the "
|
dongsheng@627
|
8504 "same bug multiple times, so let's look at a few ways that Mercurial can help "
|
dongsheng@627
|
8505 "you to manage these bugfixes without duplicating your work."
|
dongsheng@627
|
8506 msgstr ""
|
dongsheng@627
|
8507
|
dongsheng@627
|
8508 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8509 #: ../en/ch08-branch.xml:301
|
dongsheng@627
|
8510 msgid ""
|
dongsheng@627
|
8511 "In the simplest instance, all you need to do is pull changes from your "
|
dongsheng@627
|
8512 "maintenance branch into your local clone of the target branch."
|
dongsheng@627
|
8513 msgstr ""
|
dongsheng@627
|
8514
|
dongsheng@627
|
8515 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8516 #: ../en/ch08-branch.xml:307
|
dongsheng@627
|
8517 msgid ""
|
dongsheng@627
|
8518 "You'll then need to merge the heads of the two branches, and push back to the "
|
dongsheng@627
|
8519 "main branch."
|
dongsheng@627
|
8520 msgstr ""
|
dongsheng@627
|
8521
|
dongsheng@627
|
8522 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
8523 #: ../en/ch08-branch.xml:314
|
dongsheng@627
|
8524 msgid "Naming branches within one repository"
|
dongsheng@635
|
8525 msgstr "版本库中的命名分支"
|
dongsheng@627
|
8526
|
dongsheng@627
|
8527 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8528 #: ../en/ch08-branch.xml:316
|
dongsheng@627
|
8529 msgid ""
|
dongsheng@627
|
8530 "In most instances, isolating branches in repositories is the right approach. "
|
dongsheng@627
|
8531 "Its simplicity makes it easy to understand; and so it's hard to make "
|
dongsheng@627
|
8532 "mistakes. There's a one-to-one relationship between branches you're working "
|
dongsheng@627
|
8533 "in and directories on your system. This lets you use normal (non-Mercurial-"
|
dongsheng@627
|
8534 "aware) tools to work on files within a branch/repository."
|
dongsheng@627
|
8535 msgstr ""
|
dongsheng@627
|
8536
|
dongsheng@627
|
8537 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8538 #: ../en/ch08-branch.xml:323
|
dongsheng@627
|
8539 msgid ""
|
dongsheng@627
|
8540 "If you're more in the <quote>power user</quote> category (<emphasis>and</"
|
dongsheng@627
|
8541 "emphasis> your collaborators are too), there is an alternative way of "
|
dongsheng@627
|
8542 "handling branches that you can consider. I've already mentioned the human-"
|
dongsheng@627
|
8543 "level distinction between <quote>small picture</quote> and <quote>big "
|
dongsheng@627
|
8544 "picture</quote> branches. While Mercurial works with multiple <quote>small "
|
dongsheng@627
|
8545 "picture</quote> branches in a repository all the time (for example after you "
|
dongsheng@627
|
8546 "pull changes in, but before you merge them), it can <emphasis>also</emphasis> "
|
dongsheng@627
|
8547 "work with multiple <quote>big picture</quote> branches."
|
dongsheng@627
|
8548 msgstr ""
|
dongsheng@627
|
8549
|
dongsheng@627
|
8550 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8551 #: ../en/ch08-branch.xml:334
|
dongsheng@627
|
8552 msgid ""
|
dongsheng@627
|
8553 "The key to working this way is that Mercurial lets you assign a persistent "
|
dongsheng@627
|
8554 "<emphasis>name</emphasis> to a branch. There always exists a branch named "
|
dongsheng@627
|
8555 "<literal>default</literal>. Even before you start naming branches yourself, "
|
dongsheng@627
|
8556 "you can find traces of the <literal>default</literal> branch if you look for "
|
dongsheng@627
|
8557 "them."
|
dongsheng@627
|
8558 msgstr ""
|
dongsheng@627
|
8559
|
dongsheng@627
|
8560 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8561 #: ../en/ch08-branch.xml:341
|
dongsheng@627
|
8562 msgid ""
|
dongsheng@627
|
8563 "As an example, when you run the <command role=\"hg-cmd\">hg commit</command> "
|
dongsheng@627
|
8564 "command, and it pops up your editor so that you can enter a commit message, "
|
dongsheng@627
|
8565 "look for a line that contains the text <quote><literal>HG: branch default</"
|
dongsheng@627
|
8566 "literal></quote> at the bottom. This is telling you that your commit will "
|
dongsheng@627
|
8567 "occur on the branch named <literal>default</literal>."
|
dongsheng@627
|
8568 msgstr ""
|
dongsheng@627
|
8569
|
dongsheng@627
|
8570 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8571 #: ../en/ch08-branch.xml:348
|
dongsheng@627
|
8572 msgid ""
|
dongsheng@627
|
8573 "To start working with named branches, use the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
8574 "branches</command> command. This command lists the named branches already "
|
dongsheng@627
|
8575 "present in your repository, telling you which changeset is the tip of each."
|
dongsheng@627
|
8576 msgstr ""
|
dongsheng@627
|
8577
|
dongsheng@627
|
8578 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8579 #: ../en/ch08-branch.xml:355
|
dongsheng@627
|
8580 msgid ""
|
dongsheng@627
|
8581 "Since you haven't created any named branches yet, the only one that exists is "
|
dongsheng@627
|
8582 "<literal>default</literal>."
|
dongsheng@627
|
8583 msgstr ""
|
dongsheng@627
|
8584
|
dongsheng@627
|
8585 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8586 #: ../en/ch08-branch.xml:358
|
dongsheng@627
|
8587 msgid ""
|
dongsheng@627
|
8588 "To find out what the <quote>current</quote> branch is, run the <command role="
|
dongsheng@627
|
8589 "\"hg-cmd\">hg branch</command> command, giving it no arguments. This tells "
|
dongsheng@627
|
8590 "you what branch the parent of the current changeset is on."
|
dongsheng@627
|
8591 msgstr ""
|
dongsheng@627
|
8592
|
dongsheng@627
|
8593 #
|
dongsheng@627
|
8594 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8595 #: ../en/ch08-branch.xml:365
|
dongsheng@627
|
8596 msgid ""
|
dongsheng@627
|
8597 "To create a new branch, run the <command role=\"hg-cmd\">hg branch</command> "
|
dongsheng@627
|
8598 "command again. This time, give it one argument: the name of the branch you "
|
dongsheng@627
|
8599 "want to create."
|
dongsheng@627
|
8600 msgstr ""
|
dongsheng@627
|
8601
|
dongsheng@627
|
8602 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8603 #: ../en/ch08-branch.xml:371
|
dongsheng@627
|
8604 msgid ""
|
dongsheng@627
|
8605 "After you've created a branch, you might wonder what effect the <command role="
|
dongsheng@627
|
8606 "\"hg-cmd\">hg branch</command> command has had. What do the <command role="
|
dongsheng@627
|
8607 "\"hg-cmd\">hg status</command> and <command role=\"hg-cmd\">hg tip</command> "
|
dongsheng@627
|
8608 "commands report?"
|
dongsheng@627
|
8609 msgstr ""
|
dongsheng@627
|
8610
|
dongsheng@627
|
8611 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8612 #: ../en/ch08-branch.xml:378
|
dongsheng@627
|
8613 msgid ""
|
dongsheng@627
|
8614 "Nothing has changed in the working directory, and there's been no new history "
|
dongsheng@627
|
8615 "created. As this suggests, running the <command role=\"hg-cmd\">hg branch</"
|
dongsheng@627
|
8616 "command> command has no permanent effect; it only tells Mercurial what branch "
|
dongsheng@627
|
8617 "name to use the <emphasis>next</emphasis> time you commit a changeset."
|
dongsheng@627
|
8618 msgstr ""
|
dongsheng@627
|
8619
|
dongsheng@627
|
8620 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8621 #: ../en/ch08-branch.xml:385
|
dongsheng@627
|
8622 msgid ""
|
dongsheng@627
|
8623 "When you commit a change, Mercurial records the name of the branch on which "
|
dongsheng@627
|
8624 "you committed. Once you've switched from the <literal>default</literal> "
|
dongsheng@627
|
8625 "branch to another and committed, you'll see the name of the new branch show "
|
dongsheng@627
|
8626 "up in the output of <command role=\"hg-cmd\">hg log</command>, <command role="
|
dongsheng@627
|
8627 "\"hg-cmd\">hg tip</command>, and other commands that display the same kind of "
|
dongsheng@627
|
8628 "output."
|
dongsheng@627
|
8629 msgstr ""
|
dongsheng@627
|
8630
|
dongsheng@627
|
8631 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8632 #: ../en/ch08-branch.xml:395
|
dongsheng@627
|
8633 msgid ""
|
dongsheng@627
|
8634 "The <command role=\"hg-cmd\">hg log</command>-like commands will print the "
|
dongsheng@627
|
8635 "branch name of every changeset that's not on the <literal>default</literal> "
|
dongsheng@627
|
8636 "branch. As a result, if you never use named branches, you'll never see this "
|
dongsheng@627
|
8637 "information."
|
dongsheng@627
|
8638 msgstr ""
|
dongsheng@627
|
8639
|
dongsheng@627
|
8640 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8641 #: ../en/ch08-branch.xml:400
|
dongsheng@627
|
8642 msgid ""
|
dongsheng@627
|
8643 "Once you've named a branch and committed a change with that name, every "
|
dongsheng@627
|
8644 "subsequent commit that descends from that change will inherit the same branch "
|
dongsheng@627
|
8645 "name. You can change the name of a branch at any time, using the <command "
|
dongsheng@627
|
8646 "role=\"hg-cmd\">hg branch</command> command."
|
dongsheng@627
|
8647 msgstr ""
|
dongsheng@627
|
8648
|
dongsheng@627
|
8649 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8650 #: ../en/ch08-branch.xml:408
|
dongsheng@627
|
8651 msgid ""
|
dongsheng@627
|
8652 "In practice, this is something you won't do very often, as branch names tend "
|
dongsheng@627
|
8653 "to have fairly long lifetimes. (This isn't a rule, just an observation.)"
|
dongsheng@627
|
8654 msgstr ""
|
dongsheng@627
|
8655
|
dongsheng@627
|
8656 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
8657 #: ../en/ch08-branch.xml:414
|
dongsheng@627
|
8658 msgid "Dealing with multiple named branches in a repository"
|
dongsheng@635
|
8659 msgstr "在版本库中处理多个命名分支"
|
dongsheng@627
|
8660
|
dongsheng@627
|
8661 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8662 #: ../en/ch08-branch.xml:417
|
dongsheng@627
|
8663 msgid ""
|
dongsheng@627
|
8664 "If you have more than one named branch in a repository, Mercurial will "
|
dongsheng@627
|
8665 "remember the branch that your working directory on when you start a command "
|
dongsheng@627
|
8666 "like <command role=\"hg-cmd\">hg update</command> or <command role=\"hg-cmd"
|
dongsheng@627
|
8667 "\">hg pull -u</command>. It will update the working directory to the tip of "
|
dongsheng@627
|
8668 "this branch, no matter what the <quote>repo-wide</quote> tip is. To update "
|
dongsheng@627
|
8669 "to a revision that's on a different named branch, you may need to use the "
|
dongsheng@627
|
8670 "<option role=\"hg-opt-update\">-C</option> option to <command role=\"hg-cmd"
|
dongsheng@627
|
8671 "\">hg update</command>."
|
dongsheng@627
|
8672 msgstr ""
|
dongsheng@627
|
8673
|
dongsheng@627
|
8674 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8675 #: ../en/ch08-branch.xml:427
|
dongsheng@627
|
8676 msgid ""
|
dongsheng@627
|
8677 "This behaviour is a little subtle, so let's see it in action. First, let's "
|
dongsheng@627
|
8678 "remind ourselves what branch we're currently on, and what branches are in our "
|
dongsheng@627
|
8679 "repository."
|
dongsheng@627
|
8680 msgstr ""
|
dongsheng@627
|
8681
|
dongsheng@627
|
8682 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8683 #: ../en/ch08-branch.xml:433
|
dongsheng@627
|
8684 msgid ""
|
dongsheng@627
|
8685 "We're on the <literal>bar</literal> branch, but there also exists an older "
|
dongsheng@627
|
8686 "<command role=\"hg-cmd\">hg foo</command> branch."
|
dongsheng@627
|
8687 msgstr ""
|
dongsheng@627
|
8688
|
dongsheng@627
|
8689 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8690 #: ../en/ch08-branch.xml:437
|
dongsheng@627
|
8691 msgid ""
|
dongsheng@627
|
8692 "We can <command role=\"hg-cmd\">hg update</command> back and forth between "
|
dongsheng@627
|
8693 "the tips of the <literal>foo</literal> and <literal>bar</literal> branches "
|
dongsheng@627
|
8694 "without needing to use the <option role=\"hg-opt-update\">-C</option> option, "
|
dongsheng@627
|
8695 "because this only involves going backwards and forwards linearly through our "
|
dongsheng@627
|
8696 "change history."
|
dongsheng@627
|
8697 msgstr ""
|
dongsheng@627
|
8698
|
dongsheng@627
|
8699 #
|
dongsheng@627
|
8700 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8701 #: ../en/ch08-branch.xml:446
|
dongsheng@627
|
8702 msgid ""
|
dongsheng@627
|
8703 "If we go back to the <literal>foo</literal> branch and then run <command role="
|
dongsheng@627
|
8704 "\"hg-cmd\">hg update</command>, it will keep us on <literal>foo</literal>, "
|
dongsheng@627
|
8705 "not move us to the tip of <literal>bar</literal>."
|
dongsheng@627
|
8706 msgstr ""
|
dongsheng@627
|
8707
|
dongsheng@627
|
8708 #
|
dongsheng@627
|
8709 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8710 #: ../en/ch08-branch.xml:453
|
dongsheng@627
|
8711 msgid ""
|
dongsheng@627
|
8712 "Committing a new change on the <literal>foo</literal> branch introduces a new "
|
dongsheng@627
|
8713 "head."
|
dongsheng@627
|
8714 msgstr ""
|
dongsheng@627
|
8715
|
dongsheng@627
|
8716 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
8717 #: ../en/ch08-branch.xml:460
|
dongsheng@627
|
8718 msgid "Branch names and merging"
|
dongsheng@635
|
8719 msgstr "分支名称与合并"
|
dongsheng@627
|
8720
|
dongsheng@627
|
8721 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8722 #: ../en/ch08-branch.xml:462
|
dongsheng@627
|
8723 msgid ""
|
dongsheng@627
|
8724 "As you've probably noticed, merges in Mercurial are not symmetrical. Let's "
|
dongsheng@627
|
8725 "say our repository has two heads, 17 and 23. If I <command role=\"hg-cmd"
|
dongsheng@627
|
8726 "\">hg update</command> to 17 and then <command role=\"hg-cmd\">hg merge</"
|
dongsheng@627
|
8727 "command> with 23, Mercurial records 17 as the first parent of the merge, and "
|
dongsheng@627
|
8728 "23 as the second. Whereas if I <command role=\"hg-cmd\">hg update</command> "
|
dongsheng@627
|
8729 "to 23 and then <command role=\"hg-cmd\">hg merge</command> with 17, it "
|
dongsheng@627
|
8730 "records 23 as the first parent, and 17 as the second."
|
dongsheng@627
|
8731 msgstr ""
|
dongsheng@627
|
8732
|
dongsheng@627
|
8733 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8734 #: ../en/ch08-branch.xml:472
|
dongsheng@627
|
8735 msgid ""
|
dongsheng@627
|
8736 "This affects Mercurial's choice of branch name when you merge. After a "
|
dongsheng@627
|
8737 "merge, Mercurial will retain the branch name of the first parent when you "
|
dongsheng@627
|
8738 "commit the result of the merge. If your first parent's branch name is "
|
dongsheng@627
|
8739 "<literal>foo</literal>, and you merge with <literal>bar</literal>, the branch "
|
dongsheng@627
|
8740 "name will still be <literal>foo</literal> after you merge."
|
dongsheng@627
|
8741 msgstr ""
|
dongsheng@627
|
8742
|
dongsheng@627
|
8743 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8744 #: ../en/ch08-branch.xml:479
|
dongsheng@627
|
8745 msgid ""
|
dongsheng@627
|
8746 "It's not unusual for a repository to contain multiple heads, each with the "
|
dongsheng@627
|
8747 "same branch name. Let's say I'm working on the <literal>foo</literal> "
|
dongsheng@627
|
8748 "branch, and so are you. We commit different changes; I pull your changes; I "
|
dongsheng@627
|
8749 "now have two heads, each claiming to be on the <literal>foo</literal> "
|
dongsheng@627
|
8750 "branch. The result of a merge will be a single head on the <literal>foo</"
|
dongsheng@627
|
8751 "literal> branch, as you might hope."
|
dongsheng@627
|
8752 msgstr ""
|
dongsheng@627
|
8753
|
dongsheng@627
|
8754 #
|
dongsheng@627
|
8755 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8756 #: ../en/ch08-branch.xml:487
|
dongsheng@627
|
8757 msgid ""
|
dongsheng@627
|
8758 "But if I'm working on the <literal>bar</literal> branch, and I merge work "
|
dongsheng@627
|
8759 "from the <literal>foo</literal> branch, the result will remain on the "
|
dongsheng@627
|
8760 "<literal>bar</literal> branch."
|
dongsheng@627
|
8761 msgstr ""
|
dongsheng@627
|
8762
|
dongsheng@627
|
8763 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8764 #: ../en/ch08-branch.xml:493
|
dongsheng@627
|
8765 msgid ""
|
dongsheng@627
|
8766 "To give a more concrete example, if I'm working on the <literal>bleeding-"
|
dongsheng@627
|
8767 "edge</literal> branch, and I want to bring in the latest fixes from the "
|
dongsheng@627
|
8768 "<literal>stable</literal> branch, Mercurial will choose the <quote>right</"
|
dongsheng@627
|
8769 "quote> (<literal>bleeding-edge</literal>) branch name when I pull and merge "
|
dongsheng@627
|
8770 "from <literal>stable</literal>."
|
dongsheng@627
|
8771 msgstr ""
|
dongsheng@627
|
8772
|
dongsheng@627
|
8773 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
8774 #: ../en/ch08-branch.xml:502
|
dongsheng@627
|
8775 msgid "Branch naming is generally useful"
|
dongsheng@635
|
8776 msgstr "分支名称通常都很有用"
|
dongsheng@627
|
8777
|
dongsheng@627
|
8778 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8779 #: ../en/ch08-branch.xml:504
|
dongsheng@627
|
8780 msgid ""
|
dongsheng@627
|
8781 "You shouldn't think of named branches as applicable only to situations where "
|
dongsheng@627
|
8782 "you have multiple long-lived branches cohabiting in a single repository. "
|
dongsheng@627
|
8783 "They're very useful even in the one-branch-per-repository case."
|
dongsheng@627
|
8784 msgstr ""
|
dongsheng@627
|
8785
|
dongsheng@627
|
8786 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8787 #: ../en/ch08-branch.xml:509
|
dongsheng@627
|
8788 msgid ""
|
dongsheng@627
|
8789 "In the simplest case, giving a name to each branch gives you a permanent "
|
dongsheng@627
|
8790 "record of which branch a changeset originated on. This gives you more "
|
dongsheng@627
|
8791 "context when you're trying to follow the history of a long-lived branchy "
|
dongsheng@627
|
8792 "project."
|
dongsheng@627
|
8793 msgstr ""
|
dongsheng@627
|
8794
|
dongsheng@627
|
8795 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
8796 #: ../en/ch08-branch.xml:514
|
dongsheng@627
|
8797 msgid ""
|
dongsheng@627
|
8798 "If you're working with shared repositories, you can set up a <literal role="
|
dongsheng@627
|
8799 "\"hook\">pretxnchangegroup</literal> hook on each that will block incoming "
|
dongsheng@627
|
8800 "changes that have the <quote>wrong</quote> branch name. This provides a "
|
dongsheng@627
|
8801 "simple, but effective, defence against people accidentally pushing changes "
|
dongsheng@627
|
8802 "from a <quote>bleeding edge</quote> branch to a <quote>stable</quote> "
|
dongsheng@627
|
8803 "branch. Such a hook might look like this inside the shared repo's <filename "
|
dongsheng@627
|
8804 "role=\"special\"> /.hgrc</filename>."
|
dongsheng@627
|
8805 msgstr ""
|
dongsheng@627
|
8806
|
dongsheng@627
|
8807 #. type: Content of: <book><chapter><title>
|
dongsheng@627
|
8808 #: ../en/ch09-undo.xml:5
|
dongsheng@627
|
8809 msgid "Finding and fixing mistakes"
|
dongsheng@627
|
8810 msgstr "查找和修改错误"
|
dongsheng@627
|
8811
|
dongsheng@627
|
8812 #. type: Content of: <book><chapter><para>
|
dongsheng@627
|
8813 #: ../en/ch09-undo.xml:7
|
dongsheng@627
|
8814 msgid ""
|
dongsheng@627
|
8815 "To err might be human, but to really handle the consequences well takes a top-"
|
dongsheng@627
|
8816 "notch revision control system. In this chapter, we'll discuss some of the "
|
dongsheng@627
|
8817 "techniques you can use when you find that a problem has crept into your "
|
dongsheng@627
|
8818 "project. Mercurial has some highly capable features that will help you to "
|
dongsheng@627
|
8819 "isolate the sources of problems, and to handle them appropriately."
|
dongsheng@627
|
8820 msgstr ""
|
dongsheng@627
|
8821
|
dongsheng@627
|
8822 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
8823 #: ../en/ch09-undo.xml:15
|
dongsheng@627
|
8824 msgid "Erasing local history"
|
dongsheng@635
|
8825 msgstr "销毁本地历史"
|
dongsheng@627
|
8826
|
dongsheng@627
|
8827 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
8828 #: ../en/ch09-undo.xml:18
|
dongsheng@627
|
8829 msgid "The accidental commit"
|
dongsheng@635
|
8830 msgstr "意外的提交"
|
dongsheng@627
|
8831
|
dongsheng@627
|
8832 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8833 #: ../en/ch09-undo.xml:20
|
dongsheng@627
|
8834 msgid ""
|
dongsheng@627
|
8835 "I have the occasional but persistent problem of typing rather more quickly "
|
dongsheng@627
|
8836 "than I can think, which sometimes results in me committing a changeset that "
|
dongsheng@627
|
8837 "is either incomplete or plain wrong. In my case, the usual kind of "
|
dongsheng@627
|
8838 "incomplete changeset is one in which I've created a new source file, but "
|
dongsheng@627
|
8839 "forgotten to <command role=\"hg-cmd\">hg add</command> it. A <quote>plain "
|
dongsheng@627
|
8840 "wrong</quote> changeset is not as common, but no less annoying."
|
dongsheng@627
|
8841 msgstr ""
|
dongsheng@627
|
8842
|
dongsheng@627
|
8843 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
8844 #: ../en/ch09-undo.xml:31
|
dongsheng@627
|
8845 msgid "Rolling back a transaction"
|
dongsheng@635
|
8846 msgstr "回滚一个事务"
|
dongsheng@627
|
8847
|
dongsheng@627
|
8848 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8849 #: ../en/ch09-undo.xml:33
|
dongsheng@627
|
8850 msgid ""
|
dongsheng@627
|
8851 "In section <xref linkend=\"sec.concepts.txn\"/>, I mentioned that Mercurial "
|
dongsheng@627
|
8852 "treats each modification of a repository as a <emphasis>transaction</"
|
dongsheng@627
|
8853 "emphasis>. Every time you commit a changeset or pull changes from another "
|
dongsheng@627
|
8854 "repository, Mercurial remembers what you did. You can undo, or "
|
dongsheng@627
|
8855 "<emphasis>roll back</emphasis>, exactly one of these actions using the "
|
dongsheng@627
|
8856 "<command role=\"hg-cmd\">hg rollback</command> command. (See section <xref "
|
dongsheng@627
|
8857 "linkend=\"sec.undo.rollback-after-push\"/> for an important caveat about the "
|
dongsheng@627
|
8858 "use of this command.)"
|
dongsheng@627
|
8859 msgstr ""
|
dongsheng@627
|
8860
|
dongsheng@627
|
8861 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8862 #: ../en/ch09-undo.xml:43
|
dongsheng@627
|
8863 msgid ""
|
dongsheng@627
|
8864 "Here's a mistake that I often find myself making: committing a change in "
|
dongsheng@627
|
8865 "which I've created a new file, but forgotten to <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
8866 "add</command> it."
|
dongsheng@627
|
8867 msgstr ""
|
dongsheng@627
|
8868
|
dongsheng@627
|
8869 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8870 #: ../en/ch09-undo.xml:50
|
dongsheng@627
|
8871 msgid ""
|
dongsheng@627
|
8872 "Looking at the output of <command role=\"hg-cmd\">hg status</command> after "
|
dongsheng@627
|
8873 "the commit immediately confirms the error."
|
dongsheng@627
|
8874 msgstr ""
|
dongsheng@627
|
8875
|
dongsheng@627
|
8876 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8877 #: ../en/ch09-undo.xml:56
|
dongsheng@627
|
8878 msgid ""
|
dongsheng@627
|
8879 "The commit captured the changes to the file <filename>a</filename>, but not "
|
dongsheng@627
|
8880 "the new file <filename>b</filename>. If I were to push this changeset to a "
|
dongsheng@627
|
8881 "repository that I shared with a colleague, the chances are high that "
|
dongsheng@627
|
8882 "something in <filename>a</filename> would refer to <filename>b</filename>, "
|
dongsheng@627
|
8883 "which would not be present in their repository when they pulled my changes. "
|
dongsheng@627
|
8884 "I would thus become the object of some indignation."
|
dongsheng@627
|
8885 msgstr ""
|
dongsheng@627
|
8886
|
dongsheng@627
|
8887 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8888 #: ../en/ch09-undo.xml:65
|
dongsheng@627
|
8889 msgid ""
|
dongsheng@627
|
8890 "However, luck is with me&emdash;I've caught my error before I pushed the "
|
dongsheng@627
|
8891 "changeset. I use the <command role=\"hg-cmd\">hg rollback</command> command, "
|
dongsheng@627
|
8892 "and Mercurial makes that last changeset vanish."
|
dongsheng@627
|
8893 msgstr ""
|
dongsheng@627
|
8894
|
dongsheng@627
|
8895 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8896 #: ../en/ch09-undo.xml:72
|
dongsheng@627
|
8897 msgid ""
|
dongsheng@627
|
8898 "Notice that the changeset is no longer present in the repository's history, "
|
dongsheng@627
|
8899 "and the working directory once again thinks that the file <filename>a</"
|
dongsheng@627
|
8900 "filename> is modified. The commit and rollback have left the working "
|
dongsheng@627
|
8901 "directory exactly as it was prior to the commit; the changeset has been "
|
dongsheng@627
|
8902 "completely erased. I can now safely <command role=\"hg-cmd\">hg add</"
|
dongsheng@627
|
8903 "command> the file <filename>b</filename>, and rerun my commit."
|
dongsheng@627
|
8904 msgstr ""
|
dongsheng@627
|
8905
|
dongsheng@627
|
8906 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
8907 #: ../en/ch09-undo.xml:85
|
dongsheng@627
|
8908 msgid "The erroneous pull"
|
dongsheng@635
|
8909 msgstr "错误的抓取"
|
dongsheng@627
|
8910
|
dongsheng@627
|
8911 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8912 #: ../en/ch09-undo.xml:87
|
dongsheng@627
|
8913 msgid ""
|
dongsheng@627
|
8914 "It's common practice with Mercurial to maintain separate development branches "
|
dongsheng@627
|
8915 "of a project in different repositories. Your development team might have one "
|
dongsheng@627
|
8916 "shared repository for your project's <quote>0.9</quote> release, and another, "
|
dongsheng@627
|
8917 "containing different changes, for the <quote>1.0</quote> release."
|
dongsheng@627
|
8918 msgstr ""
|
dongsheng@627
|
8919
|
dongsheng@627
|
8920 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8921 #: ../en/ch09-undo.xml:94
|
dongsheng@627
|
8922 msgid ""
|
dongsheng@627
|
8923 "Given this, you can imagine that the consequences could be messy if you had a "
|
dongsheng@627
|
8924 "local <quote>0.9</quote> repository, and accidentally pulled changes from the "
|
dongsheng@627
|
8925 "shared <quote>1.0</quote> repository into it. At worst, you could be paying "
|
dongsheng@627
|
8926 "insufficient attention, and push those changes into the shared <quote>0.9</"
|
dongsheng@627
|
8927 "quote> tree, confusing your entire team (but don't worry, we'll return to "
|
dongsheng@627
|
8928 "this horror scenario later). However, it's more likely that you'll notice "
|
dongsheng@627
|
8929 "immediately, because Mercurial will display the URL it's pulling from, or you "
|
dongsheng@627
|
8930 "will see it pull a suspiciously large number of changes into the repository."
|
dongsheng@627
|
8931 msgstr ""
|
dongsheng@627
|
8932
|
dongsheng@627
|
8933 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8934 #: ../en/ch09-undo.xml:106
|
dongsheng@627
|
8935 msgid ""
|
dongsheng@627
|
8936 "The <command role=\"hg-cmd\">hg rollback</command> command will work nicely "
|
dongsheng@627
|
8937 "to expunge all of the changesets that you just pulled. Mercurial groups all "
|
dongsheng@627
|
8938 "changes from one <command role=\"hg-cmd\">hg pull</command> into a single "
|
dongsheng@627
|
8939 "transaction, so one <command role=\"hg-cmd\">hg rollback</command> is all you "
|
dongsheng@627
|
8940 "need to undo this mistake."
|
dongsheng@627
|
8941 msgstr ""
|
dongsheng@627
|
8942
|
dongsheng@627
|
8943 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
8944 #: ../en/ch09-undo.xml:115
|
dongsheng@627
|
8945 msgid "Rolling back is useless once you've pushed"
|
dongsheng@635
|
8946 msgstr "当完成推送后,回滚是无效的"
|
dongsheng@627
|
8947
|
dongsheng@627
|
8948 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8949 #: ../en/ch09-undo.xml:117
|
dongsheng@627
|
8950 msgid ""
|
dongsheng@627
|
8951 "The value of the <command role=\"hg-cmd\">hg rollback</command> command drops "
|
dongsheng@627
|
8952 "to zero once you've pushed your changes to another repository. Rolling back "
|
dongsheng@627
|
8953 "a change makes it disappear entirely, but <emphasis>only</emphasis> in the "
|
dongsheng@627
|
8954 "repository in which you perform the <command role=\"hg-cmd\">hg rollback</"
|
dongsheng@627
|
8955 "command>. Because a rollback eliminates history, there's no way for the "
|
dongsheng@627
|
8956 "disappearance of a change to propagate between repositories."
|
dongsheng@627
|
8957 msgstr ""
|
dongsheng@627
|
8958
|
dongsheng@627
|
8959 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8960 #: ../en/ch09-undo.xml:126
|
dongsheng@627
|
8961 msgid ""
|
dongsheng@627
|
8962 "If you've pushed a change to another repository&emdash;particularly if it's a "
|
dongsheng@627
|
8963 "shared repository&emdash;it has essentially <quote>escaped into the wild,</"
|
dongsheng@627
|
8964 "quote> and you'll have to recover from your mistake in a different way. What "
|
dongsheng@627
|
8965 "will happen if you push a changeset somewhere, then roll it back, then pull "
|
dongsheng@627
|
8966 "from the repository you pushed to, is that the changeset will reappear in "
|
dongsheng@627
|
8967 "your repository."
|
dongsheng@627
|
8968 msgstr ""
|
dongsheng@627
|
8969
|
dongsheng@627
|
8970 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8971 #: ../en/ch09-undo.xml:135
|
dongsheng@627
|
8972 msgid ""
|
dongsheng@627
|
8973 "(If you absolutely know for sure that the change you want to roll back is the "
|
dongsheng@627
|
8974 "most recent change in the repository that you pushed to, <emphasis>and</"
|
dongsheng@627
|
8975 "emphasis> you know that nobody else could have pulled it from that "
|
dongsheng@627
|
8976 "repository, you can roll back the changeset there, too, but you really should "
|
dongsheng@627
|
8977 "really not rely on this working reliably. If you do this, sooner or later a "
|
dongsheng@627
|
8978 "change really will make it into a repository that you don't directly control "
|
dongsheng@627
|
8979 "(or have forgotten about), and come back to bite you.)"
|
dongsheng@627
|
8980 msgstr ""
|
dongsheng@627
|
8981
|
dongsheng@627
|
8982 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
8983 #: ../en/ch09-undo.xml:147
|
dongsheng@627
|
8984 msgid "You can only roll back once"
|
dongsheng@635
|
8985 msgstr "你只能回滚一次"
|
dongsheng@627
|
8986
|
dongsheng@627
|
8987 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8988 #: ../en/ch09-undo.xml:149
|
dongsheng@627
|
8989 msgid ""
|
dongsheng@627
|
8990 "Mercurial stores exactly one transaction in its transaction log; that "
|
dongsheng@627
|
8991 "transaction is the most recent one that occurred in the repository. This "
|
dongsheng@627
|
8992 "means that you can only roll back one transaction. If you expect to be able "
|
dongsheng@627
|
8993 "to roll back one transaction, then its predecessor, this is not the behaviour "
|
dongsheng@627
|
8994 "you will get."
|
dongsheng@627
|
8995 msgstr ""
|
dongsheng@627
|
8996
|
dongsheng@627
|
8997 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
8998 #: ../en/ch09-undo.xml:158
|
dongsheng@627
|
8999 msgid ""
|
dongsheng@627
|
9000 "Once you've rolled back one transaction in a repository, you can't roll back "
|
dongsheng@627
|
9001 "again in that repository until you perform another commit or pull."
|
dongsheng@627
|
9002 msgstr ""
|
dongsheng@627
|
9003
|
dongsheng@627
|
9004 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
9005 #: ../en/ch09-undo.xml:165
|
dongsheng@627
|
9006 msgid "Reverting the mistaken change"
|
dongsheng@635
|
9007 msgstr "撤销错误的修改"
|
dongsheng@627
|
9008
|
dongsheng@627
|
9009 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
9010 #: ../en/ch09-undo.xml:167
|
dongsheng@627
|
9011 msgid ""
|
dongsheng@627
|
9012 "If you make a modification to a file, and decide that you really didn't want "
|
dongsheng@627
|
9013 "to change the file at all, and you haven't yet committed your changes, the "
|
dongsheng@627
|
9014 "<command role=\"hg-cmd\">hg revert</command> command is the one you'll need. "
|
dongsheng@627
|
9015 "It looks at the changeset that's the parent of the working directory, and "
|
dongsheng@627
|
9016 "restores the contents of the file to their state as of that changeset. "
|
dongsheng@627
|
9017 "(That's a long-winded way of saying that, in the normal case, it undoes your "
|
dongsheng@627
|
9018 "modifications.)"
|
dongsheng@627
|
9019 msgstr ""
|
dongsheng@627
|
9020
|
dongsheng@627
|
9021 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
9022 #: ../en/ch09-undo.xml:176
|
dongsheng@627
|
9023 msgid ""
|
dongsheng@627
|
9024 "Let's illustrate how the <command role=\"hg-cmd\">hg revert</command> command "
|
dongsheng@627
|
9025 "works with yet another small example. We'll begin by modifying a file that "
|
dongsheng@627
|
9026 "Mercurial is already tracking."
|
dongsheng@627
|
9027 msgstr ""
|
dongsheng@627
|
9028
|
dongsheng@627
|
9029 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
9030 #: ../en/ch09-undo.xml:183
|
dongsheng@627
|
9031 msgid ""
|
dongsheng@627
|
9032 "If we don't want that change, we can simply <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
9033 "revert</command> the file."
|
dongsheng@627
|
9034 msgstr ""
|
dongsheng@627
|
9035
|
dongsheng@627
|
9036 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
9037 #: ../en/ch09-undo.xml:189
|
dongsheng@627
|
9038 msgid ""
|
dongsheng@627
|
9039 "The <command role=\"hg-cmd\">hg revert</command> command provides us with an "
|
dongsheng@627
|
9040 "extra degree of safety by saving our modified file with a <filename>.orig</"
|
dongsheng@627
|
9041 "filename> extension."
|
dongsheng@627
|
9042 msgstr ""
|
dongsheng@627
|
9043
|
dongsheng@627
|
9044 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
9045 #: ../en/ch09-undo.xml:196
|
dongsheng@627
|
9046 msgid ""
|
dongsheng@627
|
9047 "Here is a summary of the cases that the <command role=\"hg-cmd\">hg revert</"
|
dongsheng@627
|
9048 "command> command can deal with. We will describe each of these in more "
|
dongsheng@627
|
9049 "detail in the section that follows."
|
dongsheng@627
|
9050 msgstr ""
|
dongsheng@627
|
9051
|
dongsheng@627
|
9052 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
9053 #: ../en/ch09-undo.xml:201
|
dongsheng@627
|
9054 msgid "If you modify a file, it will restore the file to its unmodified state."
|
dongsheng@627
|
9055 msgstr ""
|
dongsheng@627
|
9056
|
dongsheng@627
|
9057 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
9058 #: ../en/ch09-undo.xml:204
|
dongsheng@627
|
9059 msgid ""
|
dongsheng@627
|
9060 "If you <command role=\"hg-cmd\">hg add</command> a file, it will undo the "
|
dongsheng@627
|
9061 "<quote>added</quote> state of the file, but leave the file itself untouched."
|
dongsheng@627
|
9062 msgstr ""
|
dongsheng@627
|
9063
|
dongsheng@627
|
9064 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
9065 #: ../en/ch09-undo.xml:208
|
dongsheng@627
|
9066 msgid ""
|
dongsheng@627
|
9067 "If you delete a file without telling Mercurial, it will restore the file to "
|
dongsheng@627
|
9068 "its unmodified contents."
|
dongsheng@627
|
9069 msgstr ""
|
dongsheng@627
|
9070
|
dongsheng@627
|
9071 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
9072 #: ../en/ch09-undo.xml:211
|
dongsheng@627
|
9073 msgid ""
|
dongsheng@627
|
9074 "If you use the <command role=\"hg-cmd\">hg remove</command> command to remove "
|
dongsheng@627
|
9075 "a file, it will undo the <quote>removed</quote> state of the file, and "
|
dongsheng@627
|
9076 "restore the file to its unmodified contents."
|
dongsheng@627
|
9077 msgstr ""
|
dongsheng@627
|
9078
|
dongsheng@627
|
9079 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
9080 #: ../en/ch09-undo.xml:218
|
dongsheng@627
|
9081 msgid "File management errors"
|
dongsheng@635
|
9082 msgstr "文件管理错误"
|
dongsheng@627
|
9083
|
dongsheng@627
|
9084 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
9085 #: ../en/ch09-undo.xml:220
|
dongsheng@627
|
9086 msgid ""
|
dongsheng@627
|
9087 "The <command role=\"hg-cmd\">hg revert</command> command is useful for more "
|
dongsheng@627
|
9088 "than just modified files. It lets you reverse the results of all of "
|
dongsheng@627
|
9089 "Mercurial's file management commands&emdash;<command role=\"hg-cmd\">hg add</"
|
dongsheng@627
|
9090 "command>, <command role=\"hg-cmd\">hg remove</command>, and so on."
|
dongsheng@627
|
9091 msgstr ""
|
dongsheng@627
|
9092
|
dongsheng@627
|
9093 #
|
dongsheng@627
|
9094 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
9095 #: ../en/ch09-undo.xml:226
|
dongsheng@627
|
9096 msgid ""
|
dongsheng@627
|
9097 "If you <command role=\"hg-cmd\">hg add</command> a file, then decide that in "
|
dongsheng@627
|
9098 "fact you don't want Mercurial to track it, use <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
9099 "revert</command> to undo the add. Don't worry; Mercurial will not modify the "
|
dongsheng@627
|
9100 "file in any way. It will just <quote>unmark</quote> the file."
|
dongsheng@627
|
9101 msgstr ""
|
dongsheng@627
|
9102
|
dongsheng@627
|
9103 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
9104 #: ../en/ch09-undo.xml:234
|
dongsheng@627
|
9105 msgid ""
|
dongsheng@627
|
9106 "Similarly, if you ask Mercurial to <command role=\"hg-cmd\">hg remove</"
|
dongsheng@627
|
9107 "command> a file, you can use <command role=\"hg-cmd\">hg revert</command> to "
|
dongsheng@627
|
9108 "restore it to the contents it had as of the parent of the working directory. "
|
dongsheng@627
|
9109 "&interaction.daily.revert.remove; This works just as well for a file that you "
|
dongsheng@627
|
9110 "deleted by hand, without telling Mercurial (recall that in Mercurial "
|
dongsheng@627
|
9111 "terminology, this kind of file is called <quote>missing</quote>)."
|
dongsheng@627
|
9112 msgstr ""
|
dongsheng@627
|
9113
|
dongsheng@627
|
9114 #
|
dongsheng@627
|
9115 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
9116 #: ../en/ch09-undo.xml:245
|
dongsheng@627
|
9117 msgid ""
|
dongsheng@627
|
9118 "If you revert a <command role=\"hg-cmd\">hg copy</command>, the copied-to "
|
dongsheng@627
|
9119 "file remains in your working directory afterwards, untracked. Since a copy "
|
dongsheng@627
|
9120 "doesn't affect the copied-from file in any way, Mercurial doesn't do anything "
|
dongsheng@627
|
9121 "with the copied-from file."
|
dongsheng@627
|
9122 msgstr ""
|
dongsheng@627
|
9123
|
dongsheng@627
|
9124 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@627
|
9125 #: ../en/ch09-undo.xml:254
|
dongsheng@627
|
9126 msgid "A slightly special case: reverting a rename"
|
dongsheng@635
|
9127 msgstr "一个稍微特别的案例:撤销改名"
|
dongsheng@627
|
9128
|
dongsheng@627
|
9129 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
9130 #: ../en/ch09-undo.xml:256
|
dongsheng@627
|
9131 msgid ""
|
dongsheng@627
|
9132 "If you <command role=\"hg-cmd\">hg rename</command> a file, there is one "
|
dongsheng@627
|
9133 "small detail that you should remember. When you <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
9134 "revert</command> a rename, it's not enough to provide the name of the renamed-"
|
dongsheng@627
|
9135 "to file, as you can see here."
|
dongsheng@627
|
9136 msgstr ""
|
dongsheng@627
|
9137
|
dongsheng@627
|
9138 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
9139 #: ../en/ch09-undo.xml:264
|
dongsheng@627
|
9140 msgid ""
|
dongsheng@627
|
9141 "As you can see from the output of <command role=\"hg-cmd\">hg status</"
|
dongsheng@627
|
9142 "command>, the renamed-to file is no longer identified as added, but the "
|
dongsheng@627
|
9143 "renamed-<emphasis>from</emphasis> file is still removed! This is counter-"
|
dongsheng@627
|
9144 "intuitive (at least to me), but at least it's easy to deal with."
|
dongsheng@627
|
9145 msgstr ""
|
dongsheng@627
|
9146
|
dongsheng@627
|
9147 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
9148 #: ../en/ch09-undo.xml:273
|
dongsheng@627
|
9149 msgid ""
|
dongsheng@627
|
9150 "So remember, to revert a <command role=\"hg-cmd\">hg rename</command>, you "
|
dongsheng@627
|
9151 "must provide <emphasis>both</emphasis> the source and destination names."
|
dongsheng@627
|
9152 msgstr ""
|
dongsheng@627
|
9153
|
dongsheng@627
|
9154 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
9155 #: ../en/ch09-undo.xml:278
|
dongsheng@627
|
9156 msgid "% TODO: the output doesn't look like it will be removed!"
|
dongsheng@627
|
9157 msgstr ""
|
dongsheng@627
|
9158
|
dongsheng@627
|
9159 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
9160 #: ../en/ch09-undo.xml:281
|
dongsheng@627
|
9161 msgid ""
|
dongsheng@627
|
9162 "(By the way, if you rename a file, then modify the renamed-to file, then "
|
dongsheng@627
|
9163 "revert both components of the rename, when Mercurial restores the file that "
|
dongsheng@627
|
9164 "was removed as part of the rename, it will be unmodified. If you need the "
|
dongsheng@627
|
9165 "modifications in the renamed-to file to show up in the renamed-from file, "
|
dongsheng@627
|
9166 "don't forget to copy them over.)"
|
dongsheng@627
|
9167 msgstr ""
|
dongsheng@627
|
9168
|
dongsheng@627
|
9169 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
9170 #: ../en/ch09-undo.xml:288
|
dongsheng@627
|
9171 msgid ""
|
dongsheng@627
|
9172 "These fiddly aspects of reverting a rename arguably constitute a small bug in "
|
dongsheng@627
|
9173 "Mercurial."
|
dongsheng@627
|
9174 msgstr ""
|
dongsheng@627
|
9175
|
dongsheng@627
|
9176 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
9177 #: ../en/ch09-undo.xml:295
|
dongsheng@627
|
9178 msgid "Dealing with committed changes"
|
dongsheng@635
|
9179 msgstr "处理已经提交的修改"
|
dongsheng@627
|
9180
|
dongsheng@627
|
9181 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
9182 #: ../en/ch09-undo.xml:297
|
dongsheng@627
|
9183 msgid ""
|
dongsheng@627
|
9184 "Consider a case where you have committed a change $a$, and another change $b$ "
|
dongsheng@627
|
9185 "on top of it; you then realise that change $a$ was incorrect. Mercurial lets "
|
dongsheng@627
|
9186 "you <quote>back out</quote> an entire changeset automatically, and building "
|
dongsheng@627
|
9187 "blocks that let you reverse part of a changeset by hand."
|
dongsheng@627
|
9188 msgstr ""
|
dongsheng@627
|
9189
|
dongsheng@627
|
9190 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
9191 #: ../en/ch09-undo.xml:303
|
dongsheng@627
|
9192 msgid ""
|
dongsheng@627
|
9193 "Before you read this section, here's something to keep in mind: the <command "
|
dongsheng@627
|
9194 "role=\"hg-cmd\">hg backout</command> command undoes changes by "
|
dongsheng@627
|
9195 "<emphasis>adding</emphasis> history, not by modifying or erasing it. It's "
|
dongsheng@627
|
9196 "the right tool to use if you're fixing bugs, but not if you're trying to undo "
|
dongsheng@627
|
9197 "some change that has catastrophic consequences. To deal with those, see "
|
dongsheng@627
|
9198 "section <xref linkend=\"sec.undo.aaaiiieee\"/>."
|
dongsheng@627
|
9199 msgstr ""
|
dongsheng@627
|
9200
|
dongsheng@627
|
9201 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
9202 #: ../en/ch09-undo.xml:312
|
dongsheng@627
|
9203 msgid "Backing out a changeset"
|
dongsheng@635
|
9204 msgstr "恢复一个修改集"
|
dongsheng@627
|
9205
|
dongsheng@627
|
9206 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
9207 #: ../en/ch09-undo.xml:314
|
dongsheng@627
|
9208 msgid ""
|
dongsheng@627
|
9209 "The <command role=\"hg-cmd\">hg backout</command> command lets you "
|
dongsheng@627
|
9210 "<quote>undo</quote> the effects of an entire changeset in an automated "
|
dongsheng@627
|
9211 "fashion. Because Mercurial's history is immutable, this command "
|
dongsheng@627
|
9212 "<emphasis>does not</emphasis> get rid of the changeset you want to undo. "
|
dongsheng@627
|
9213 "Instead, it creates a new changeset that <emphasis>reverses</emphasis> the "
|
dongsheng@627
|
9214 "effect of the to-be-undone changeset."
|
dongsheng@627
|
9215 msgstr ""
|
dongsheng@627
|
9216
|
dongsheng@627
|
9217 #
|
dongsheng@627
|
9218 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
9219 #: ../en/ch09-undo.xml:323
|
dongsheng@627
|
9220 msgid ""
|
dongsheng@627
|
9221 "The operation of the <command role=\"hg-cmd\">hg backout</command> command is "
|
dongsheng@627
|
9222 "a little intricate, so let's illustrate it with some examples. First, we'll "
|
dongsheng@627
|
9223 "create a repository with some simple changes."
|
dongsheng@627
|
9224 msgstr ""
|
dongsheng@627
|
9225
|
dongsheng@627
|
9226 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
9227 #: ../en/ch09-undo.xml:330
|
dongsheng@627
|
9228 msgid ""
|
dongsheng@627
|
9229 "The <command role=\"hg-cmd\">hg backout</command> command takes a single "
|
dongsheng@627
|
9230 "changeset ID as its argument; this is the changeset to back out. Normally, "
|
dongsheng@627
|
9231 "<command role=\"hg-cmd\">hg backout</command> will drop you into a text "
|
dongsheng@627
|
9232 "editor to write a commit message, so you can record why you're backing the "
|
dongsheng@627
|
9233 "change out. In this example, we provide a commit message on the command line "
|
dongsheng@627
|
9234 "using the <option role=\"hg-opt-backout\">-m</option> option."
|
dongsheng@627
|
9235 msgstr ""
|
dongsheng@627
|
9236
|
dongsheng@627
|
9237 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
9238 #: ../en/ch09-undo.xml:341
|
dongsheng@627
|
9239 msgid "Backing out the tip changeset"
|
dongsheng@635
|
9240 msgstr "恢复顶点修改集"
|
dongsheng@627
|
9241
|
dongsheng@627
|
9242 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
9243 #: ../en/ch09-undo.xml:343
|
dongsheng@627
|
9244 msgid "We're going to start by backing out the last changeset we committed."
|
dongsheng@627
|
9245 msgstr ""
|
dongsheng@627
|
9246
|
dongsheng@627
|
9247 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
9248 #: ../en/ch09-undo.xml:348
|
dongsheng@627
|
9249 msgid ""
|
dongsheng@627
|
9250 "You can see that the second line from <filename>myfile</filename> is no "
|
dongsheng@627
|
9251 "longer present. Taking a look at the output of <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
9252 "log</command> gives us an idea of what the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
9253 "backout</command> command has done. &interaction.backout.simple.log; Notice "
|
dongsheng@627
|
9254 "that the new changeset that <command role=\"hg-cmd\">hg backout</command> has "
|
dongsheng@627
|
9255 "created is a child of the changeset we backed out. It's easier to see this "
|
dongsheng@641
|
9256 "in figure <xref endterm=\"fig.undo.backout.caption\" linkend=\"fig.undo."
|
dongsheng@641
|
9257 "backout\"/>, which presents a graphical view of the change history. As you "
|
dongsheng@641
|
9258 "can see, the history is nice and linear."
|
dongsheng@627
|
9259 msgstr ""
|
dongsheng@627
|
9260
|
dongsheng@627
|
9261 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
|
dongsheng@641
|
9262 #: ../en/ch09-undo.xml:364
|
dongsheng@641
|
9263 msgid ""
|
dongsheng@641
|
9264 "<imageobject><imagedata fileref=\"images/undo-simple.png\"/> </imageobject>"
|
dongsheng@627
|
9265 msgstr ""
|
dongsheng@627
|
9266
|
dongsheng@627
|
9267 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
|
dongsheng@641
|
9268 #: ../en/ch09-undo.xml:367 ../en/ch09-undo.xml:486
|
dongsheng@627
|
9269 msgid ""
|
dongsheng@627
|
9270 "Backing out a change using the <command role=\"hg-cmd\">hg backout</command> "
|
dongsheng@627
|
9271 "command"
|
dongsheng@627
|
9272 msgstr ""
|
dongsheng@627
|
9273
|
dongsheng@627
|
9274 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
9275 #: ../en/ch09-undo.xml:376
|
dongsheng@627
|
9276 msgid "Backing out a non-tip change"
|
dongsheng@635
|
9277 msgstr "恢复非顶点的修改"
|
dongsheng@627
|
9278
|
dongsheng@627
|
9279 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9280 #: ../en/ch09-undo.xml:378
|
dongsheng@627
|
9281 msgid ""
|
dongsheng@627
|
9282 "If you want to back out a change other than the last one you committed, pass "
|
dongsheng@627
|
9283 "the <option role=\"hg-opt-backout\">--merge</option> option to the <command "
|
dongsheng@627
|
9284 "role=\"hg-cmd\">hg backout</command> command."
|
dongsheng@627
|
9285 msgstr ""
|
dongsheng@627
|
9286
|
dongsheng@627
|
9287 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9288 #: ../en/ch09-undo.xml:385
|
dongsheng@627
|
9289 msgid ""
|
dongsheng@627
|
9290 "This makes backing out any changeset a <quote>one-shot</quote> operation "
|
dongsheng@627
|
9291 "that's usually simple and fast."
|
dongsheng@627
|
9292 msgstr ""
|
dongsheng@627
|
9293
|
dongsheng@627
|
9294 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9295 #: ../en/ch09-undo.xml:391
|
dongsheng@627
|
9296 msgid ""
|
dongsheng@627
|
9297 "If you take a look at the contents of <filename>myfile</filename> after the "
|
dongsheng@627
|
9298 "backout finishes, you'll see that the first and third changes are present, "
|
dongsheng@627
|
9299 "but not the second."
|
dongsheng@627
|
9300 msgstr ""
|
dongsheng@627
|
9301
|
dongsheng@627
|
9302 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9303 #: ../en/ch09-undo.xml:398
|
dongsheng@641
|
9304 msgid ""
|
dongsheng@641
|
9305 "As the graphical history in figure <xref endterm=\"fig.undo.backout-non-tip."
|
dongsheng@641
|
9306 "caption\" linkend=\"fig.undo.backout-non-tip\"/> illustrates, Mercurial "
|
dongsheng@641
|
9307 "actually commits <emphasis>two</emphasis> changes in this kind of situation "
|
dongsheng@641
|
9308 "(the box-shaped nodes are the ones that Mercurial commits automatically). "
|
dongsheng@641
|
9309 "Before Mercurial begins the backout process, it first remembers what the "
|
dongsheng@641
|
9310 "current parent of the working directory is. It then backs out the target "
|
dongsheng@641
|
9311 "changeset, and commits that as a changeset. Finally, it merges back to the "
|
dongsheng@641
|
9312 "previous parent of the working directory, and commits the result of the merge."
|
dongsheng@641
|
9313 msgstr ""
|
dongsheng@641
|
9314
|
dongsheng@641
|
9315 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9316 #: ../en/ch09-undo.xml:410
|
dongsheng@627
|
9317 msgid ""
|
dongsheng@627
|
9318 "% TODO: to me it looks like mercurial doesn't commit the second merge "
|
dongsheng@627
|
9319 "automatically!"
|
dongsheng@627
|
9320 msgstr ""
|
dongsheng@627
|
9321
|
dongsheng@627
|
9322 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
|
dongsheng@641
|
9323 #: ../en/ch09-undo.xml:415
|
dongsheng@641
|
9324 msgid ""
|
dongsheng@641
|
9325 "<imageobject><imagedata fileref=\"images/undo-non-tip.png\"/> </imageobject>"
|
dongsheng@627
|
9326 msgstr ""
|
dongsheng@627
|
9327
|
dongsheng@627
|
9328 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
|
dongsheng@641
|
9329 #: ../en/ch09-undo.xml:418
|
dongsheng@627
|
9330 msgid ""
|
dongsheng@627
|
9331 "Automated backout of a non-tip change using the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
9332 "backout</command> command"
|
dongsheng@627
|
9333 msgstr ""
|
dongsheng@627
|
9334
|
dongsheng@627
|
9335 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9336 #: ../en/ch09-undo.xml:424
|
dongsheng@627
|
9337 msgid ""
|
dongsheng@627
|
9338 "The result is that you end up <quote>back where you were</quote>, only with "
|
dongsheng@627
|
9339 "some extra history that undoes the effect of the changeset you wanted to back "
|
dongsheng@627
|
9340 "out."
|
dongsheng@627
|
9341 msgstr ""
|
dongsheng@627
|
9342
|
dongsheng@627
|
9343 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@641
|
9344 #: ../en/ch09-undo.xml:429
|
dongsheng@627
|
9345 msgid "Always use the <option role=\"hg-opt-backout\">--merge</option> option"
|
dongsheng@635
|
9346 msgstr "始终使用选项 <option role=\"hg-opt-backout\">--merge</option>"
|
dongsheng@627
|
9347
|
dongsheng@627
|
9348 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@641
|
9349 #: ../en/ch09-undo.xml:432
|
dongsheng@627
|
9350 msgid ""
|
dongsheng@627
|
9351 "In fact, since the <option role=\"hg-opt-backout\">--merge</option> option "
|
dongsheng@627
|
9352 "will do the <quote>right thing</quote> whether or not the changeset you're "
|
dongsheng@627
|
9353 "backing out is the tip (i.e. it won't try to merge if it's backing out the "
|
dongsheng@627
|
9354 "tip, since there's no need), you should <emphasis>always</emphasis> use this "
|
dongsheng@627
|
9355 "option when you run the <command role=\"hg-cmd\">hg backout</command> command."
|
dongsheng@627
|
9356 msgstr ""
|
dongsheng@627
|
9357
|
dongsheng@627
|
9358 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
9359 #: ../en/ch09-undo.xml:443
|
dongsheng@627
|
9360 msgid "Gaining more control of the backout process"
|
dongsheng@635
|
9361 msgstr "在恢复处理中获得更多控制"
|
dongsheng@627
|
9362
|
dongsheng@627
|
9363 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9364 #: ../en/ch09-undo.xml:445
|
dongsheng@627
|
9365 msgid ""
|
dongsheng@627
|
9366 "While I've recommended that you always use the <option role=\"hg-opt-backout"
|
dongsheng@627
|
9367 "\">--merge</option> option when backing out a change, the <command role=\"hg-"
|
dongsheng@627
|
9368 "cmd\">hg backout</command> command lets you decide how to merge a backout "
|
dongsheng@627
|
9369 "changeset. Taking control of the backout process by hand is something you "
|
dongsheng@627
|
9370 "will rarely need to do, but it can be useful to understand what the <command "
|
dongsheng@627
|
9371 "role=\"hg-cmd\">hg backout</command> command is doing for you automatically. "
|
dongsheng@627
|
9372 "To illustrate this, let's clone our first repository, but omit the backout "
|
dongsheng@627
|
9373 "change that it contains."
|
dongsheng@627
|
9374 msgstr ""
|
dongsheng@627
|
9375
|
dongsheng@627
|
9376 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9377 #: ../en/ch09-undo.xml:458
|
dongsheng@627
|
9378 msgid ""
|
dongsheng@627
|
9379 "As with our earlier example, We'll commit a third changeset, then back out "
|
dongsheng@627
|
9380 "its parent, and see what happens."
|
dongsheng@627
|
9381 msgstr ""
|
dongsheng@627
|
9382
|
dongsheng@627
|
9383 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9384 #: ../en/ch09-undo.xml:464
|
dongsheng@627
|
9385 msgid ""
|
dongsheng@627
|
9386 "Our new changeset is again a descendant of the changeset we backout out; it's "
|
dongsheng@627
|
9387 "thus a new head, <emphasis>not</emphasis> a descendant of the changeset that "
|
dongsheng@627
|
9388 "was the tip. The <command role=\"hg-cmd\">hg backout</command> command was "
|
dongsheng@627
|
9389 "quite explicit in telling us this."
|
dongsheng@627
|
9390 msgstr ""
|
dongsheng@627
|
9391
|
dongsheng@627
|
9392 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9393 #: ../en/ch09-undo.xml:472
|
dongsheng@627
|
9394 msgid ""
|
dongsheng@627
|
9395 "Again, it's easier to see what has happened by looking at a graph of the "
|
dongsheng@641
|
9396 "revision history, in figure <xref endterm=\"fig.undo.backout-manual.caption\" "
|
dongsheng@641
|
9397 "linkend=\"fig.undo.backout-manual\"/>. This makes it clear that when we use "
|
dongsheng@641
|
9398 "<command role=\"hg-cmd\">hg backout</command> to back out a change other than "
|
dongsheng@641
|
9399 "the tip, Mercurial adds a new head to the repository (the change it committed "
|
dongsheng@641
|
9400 "is box-shaped)."
|
dongsheng@627
|
9401 msgstr ""
|
dongsheng@627
|
9402
|
dongsheng@627
|
9403 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
|
dongsheng@641
|
9404 #: ../en/ch09-undo.xml:483
|
dongsheng@641
|
9405 msgid ""
|
dongsheng@641
|
9406 "<imageobject><imagedata fileref=\"images/undo-manual.png\"/> </imageobject>"
|
dongsheng@641
|
9407 msgstr ""
|
dongsheng@641
|
9408
|
dongsheng@641
|
9409 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9410 #: ../en/ch09-undo.xml:492
|
dongsheng@627
|
9411 msgid ""
|
dongsheng@627
|
9412 "After the <command role=\"hg-cmd\">hg backout</command> command has "
|
dongsheng@627
|
9413 "completed, it leaves the new <quote>backout</quote> changeset as the parent "
|
dongsheng@627
|
9414 "of the working directory."
|
dongsheng@627
|
9415 msgstr ""
|
dongsheng@627
|
9416
|
dongsheng@627
|
9417 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9418 #: ../en/ch09-undo.xml:499
|
dongsheng@627
|
9419 msgid "Now we have two isolated sets of changes."
|
dongsheng@627
|
9420 msgstr ""
|
dongsheng@627
|
9421
|
dongsheng@627
|
9422 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9423 #: ../en/ch09-undo.xml:503
|
dongsheng@627
|
9424 msgid ""
|
dongsheng@627
|
9425 "Let's think about what we expect to see as the contents of <filename>myfile</"
|
dongsheng@627
|
9426 "filename> now. The first change should be present, because we've never "
|
dongsheng@627
|
9427 "backed it out. The second change should be missing, as that's the change we "
|
dongsheng@627
|
9428 "backed out. Since the history graph shows the third change as a separate "
|
dongsheng@627
|
9429 "head, we <emphasis>don't</emphasis> expect to see the third change present in "
|
dongsheng@627
|
9430 "<filename>myfile</filename>."
|
dongsheng@627
|
9431 msgstr ""
|
dongsheng@627
|
9432
|
dongsheng@627
|
9433 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9434 #: ../en/ch09-undo.xml:513
|
dongsheng@627
|
9435 msgid ""
|
dongsheng@627
|
9436 "To get the third change back into the file, we just do a normal merge of our "
|
dongsheng@627
|
9437 "two heads."
|
dongsheng@627
|
9438 msgstr ""
|
dongsheng@627
|
9439
|
dongsheng@627
|
9440 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9441 #: ../en/ch09-undo.xml:518
|
dongsheng@627
|
9442 msgid ""
|
dongsheng@627
|
9443 "Afterwards, the graphical history of our repository looks like figure <xref "
|
dongsheng@641
|
9444 "endterm=\"fig.undo.backout-manual-merge.caption\" linkend=\"fig.undo.backout-"
|
dongsheng@641
|
9445 "manual-merge\"/>."
|
dongsheng@627
|
9446 msgstr ""
|
dongsheng@627
|
9447
|
dongsheng@627
|
9448 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
|
dongsheng@641
|
9449 #: ../en/ch09-undo.xml:525
|
dongsheng@641
|
9450 msgid ""
|
dongsheng@641
|
9451 "<imageobject><imagedata fileref=\"images/undo-manual-merge.png\"/> </"
|
dongsheng@627
|
9452 "imageobject>"
|
dongsheng@627
|
9453 msgstr ""
|
dongsheng@627
|
9454
|
dongsheng@627
|
9455 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
|
dongsheng@641
|
9456 #: ../en/ch09-undo.xml:528
|
dongsheng@627
|
9457 msgid "Manually merging a backout change"
|
dongsheng@627
|
9458 msgstr ""
|
dongsheng@627
|
9459
|
dongsheng@627
|
9460 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
9461 #: ../en/ch09-undo.xml:535
|
dongsheng@627
|
9462 msgid "Why <command role=\"hg-cmd\">hg backout</command> works as it does"
|
dongsheng@635
|
9463 msgstr "<command role=\"hg-cmd\">hg backout</command> 的内幕"
|
dongsheng@627
|
9464
|
dongsheng@627
|
9465 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9466 #: ../en/ch09-undo.xml:538
|
dongsheng@627
|
9467 msgid ""
|
dongsheng@627
|
9468 "Here's a brief description of how the <command role=\"hg-cmd\">hg backout</"
|
dongsheng@627
|
9469 "command> command works."
|
dongsheng@627
|
9470 msgstr ""
|
dongsheng@627
|
9471
|
dongsheng@627
|
9472 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
9473 #: ../en/ch09-undo.xml:541
|
dongsheng@627
|
9474 msgid ""
|
dongsheng@627
|
9475 "It ensures that the working directory is <quote>clean</quote>, i.e. that the "
|
dongsheng@627
|
9476 "output of <command role=\"hg-cmd\">hg status</command> would be empty."
|
dongsheng@627
|
9477 msgstr ""
|
dongsheng@627
|
9478
|
dongsheng@627
|
9479 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
9480 #: ../en/ch09-undo.xml:545
|
dongsheng@627
|
9481 msgid ""
|
dongsheng@627
|
9482 "It remembers the current parent of the working directory. Let's call this "
|
dongsheng@627
|
9483 "changeset <literal>orig</literal>"
|
dongsheng@627
|
9484 msgstr ""
|
dongsheng@627
|
9485
|
dongsheng@627
|
9486 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
9487 #: ../en/ch09-undo.xml:549
|
dongsheng@627
|
9488 msgid ""
|
dongsheng@627
|
9489 "It does the equivalent of a <command role=\"hg-cmd\">hg update</command> to "
|
dongsheng@627
|
9490 "sync the working directory to the changeset you want to back out. Let's call "
|
dongsheng@627
|
9491 "this changeset <literal>backout</literal>"
|
dongsheng@627
|
9492 msgstr ""
|
dongsheng@627
|
9493
|
dongsheng@627
|
9494 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
9495 #: ../en/ch09-undo.xml:554
|
dongsheng@627
|
9496 msgid ""
|
dongsheng@627
|
9497 "It finds the parent of that changeset. Let's call that changeset "
|
dongsheng@627
|
9498 "<literal>parent</literal>."
|
dongsheng@627
|
9499 msgstr ""
|
dongsheng@627
|
9500
|
dongsheng@627
|
9501 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
9502 #: ../en/ch09-undo.xml:557
|
dongsheng@627
|
9503 msgid ""
|
dongsheng@627
|
9504 "For each file that the <literal>backout</literal> changeset affected, it does "
|
dongsheng@627
|
9505 "the equivalent of a <command role=\"hg-cmd\">hg revert -r parent</command> on "
|
dongsheng@627
|
9506 "that file, to restore it to the contents it had before that changeset was "
|
dongsheng@627
|
9507 "committed."
|
dongsheng@627
|
9508 msgstr ""
|
dongsheng@627
|
9509
|
dongsheng@627
|
9510 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
9511 #: ../en/ch09-undo.xml:564
|
dongsheng@627
|
9512 msgid ""
|
dongsheng@627
|
9513 "It commits the result as a new changeset. This changeset has "
|
dongsheng@627
|
9514 "<literal>backout</literal> as its parent."
|
dongsheng@627
|
9515 msgstr ""
|
dongsheng@627
|
9516
|
dongsheng@627
|
9517 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
9518 #: ../en/ch09-undo.xml:568
|
dongsheng@627
|
9519 msgid ""
|
dongsheng@627
|
9520 "If you specify <option role=\"hg-opt-backout\">--merge</option> on the "
|
dongsheng@627
|
9521 "command line, it merges with <literal>orig</literal>, and commits the result "
|
dongsheng@627
|
9522 "of the merge."
|
dongsheng@627
|
9523 msgstr ""
|
dongsheng@627
|
9524
|
dongsheng@627
|
9525 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9526 #: ../en/ch09-undo.xml:574
|
dongsheng@627
|
9527 msgid ""
|
dongsheng@627
|
9528 "An alternative way to implement the <command role=\"hg-cmd\">hg backout</"
|
dongsheng@627
|
9529 "command> command would be to <command role=\"hg-cmd\">hg export</command> the "
|
dongsheng@627
|
9530 "to-be-backed-out changeset as a diff, then use the <option role=\"cmd-opt-"
|
dongsheng@627
|
9531 "patch\">--reverse</option> option to the <command>patch</command> command to "
|
dongsheng@627
|
9532 "reverse the effect of the change without fiddling with the working "
|
dongsheng@627
|
9533 "directory. This sounds much simpler, but it would not work nearly as well."
|
dongsheng@627
|
9534 msgstr ""
|
dongsheng@627
|
9535
|
dongsheng@627
|
9536 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9537 #: ../en/ch09-undo.xml:584
|
dongsheng@627
|
9538 msgid ""
|
dongsheng@627
|
9539 "The reason that <command role=\"hg-cmd\">hg backout</command> does an update, "
|
dongsheng@627
|
9540 "a commit, a merge, and another commit is to give the merge machinery the best "
|
dongsheng@627
|
9541 "chance to do a good job when dealing with all the changes <emphasis>between</"
|
dongsheng@627
|
9542 "emphasis> the change you're backing out and the current tip."
|
dongsheng@627
|
9543 msgstr ""
|
dongsheng@627
|
9544
|
dongsheng@627
|
9545 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9546 #: ../en/ch09-undo.xml:591
|
dongsheng@627
|
9547 msgid ""
|
dongsheng@627
|
9548 "If you're backing out a changeset that's 100 revisions back in your project's "
|
dongsheng@627
|
9549 "history, the chances that the <command>patch</command> command will be able "
|
dongsheng@627
|
9550 "to apply a reverse diff cleanly are not good, because intervening changes are "
|
dongsheng@627
|
9551 "likely to have <quote>broken the context</quote> that <command>patch</"
|
dongsheng@627
|
9552 "command> uses to determine whether it can apply a patch (if this sounds like "
|
dongsheng@627
|
9553 "gibberish, see <xref linkend=\"sec.mq.patch\"/> for a discussion of the "
|
dongsheng@627
|
9554 "<command>patch</command> command). Also, Mercurial's merge machinery will "
|
dongsheng@627
|
9555 "handle files and directories being renamed, permission changes, and "
|
dongsheng@627
|
9556 "modifications to binary files, none of which <command>patch</command> can "
|
dongsheng@627
|
9557 "deal with."
|
dongsheng@627
|
9558 msgstr ""
|
dongsheng@627
|
9559
|
dongsheng@627
|
9560 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
9561 #: ../en/ch09-undo.xml:608
|
dongsheng@627
|
9562 msgid "Changes that should never have been"
|
dongsheng@635
|
9563 msgstr "不该发生的修改"
|
dongsheng@627
|
9564
|
dongsheng@627
|
9565 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
9566 #: ../en/ch09-undo.xml:610
|
dongsheng@627
|
9567 msgid ""
|
dongsheng@627
|
9568 "Most of the time, the <command role=\"hg-cmd\">hg backout</command> command "
|
dongsheng@627
|
9569 "is exactly what you need if you want to undo the effects of a change. It "
|
dongsheng@627
|
9570 "leaves a permanent record of exactly what you did, both when committing the "
|
dongsheng@627
|
9571 "original changeset and when you cleaned up after it."
|
dongsheng@627
|
9572 msgstr ""
|
dongsheng@627
|
9573
|
dongsheng@627
|
9574 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
9575 #: ../en/ch09-undo.xml:616
|
dongsheng@627
|
9576 msgid ""
|
dongsheng@627
|
9577 "On rare occasions, though, you may find that you've committed a change that "
|
dongsheng@627
|
9578 "really should not be present in the repository at all. For example, it would "
|
dongsheng@627
|
9579 "be very unusual, and usually considered a mistake, to commit a software "
|
dongsheng@627
|
9580 "project's object files as well as its source files. Object files have almost "
|
dongsheng@627
|
9581 "no intrinsic value, and they're <emphasis>big</emphasis>, so they increase "
|
dongsheng@627
|
9582 "the size of the repository and the amount of time it takes to clone or pull "
|
dongsheng@627
|
9583 "changes."
|
dongsheng@627
|
9584 msgstr ""
|
dongsheng@627
|
9585
|
dongsheng@627
|
9586 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
9587 #: ../en/ch09-undo.xml:625
|
dongsheng@627
|
9588 msgid ""
|
dongsheng@627
|
9589 "Before I discuss the options that you have if you commit a <quote>brown paper "
|
dongsheng@627
|
9590 "bag</quote> change (the kind that's so bad that you want to pull a brown "
|
dongsheng@627
|
9591 "paper bag over your head), let me first discuss some approaches that probably "
|
dongsheng@627
|
9592 "won't work."
|
dongsheng@627
|
9593 msgstr ""
|
dongsheng@627
|
9594
|
dongsheng@627
|
9595 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
9596 #: ../en/ch09-undo.xml:630
|
dongsheng@627
|
9597 msgid ""
|
dongsheng@627
|
9598 "Since Mercurial treats history as accumulative&emdash;every change builds on "
|
dongsheng@627
|
9599 "top of all changes that preceded it&emdash;you generally can't just make "
|
dongsheng@627
|
9600 "disastrous changes disappear. The one exception is when you've just "
|
dongsheng@627
|
9601 "committed a change, and it hasn't been pushed or pulled into another "
|
dongsheng@627
|
9602 "repository. That's when you can safely use the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
9603 "rollback</command> command, as I detailed in section <xref linkend=\"sec.undo."
|
dongsheng@627
|
9604 "rollback\"/>."
|
dongsheng@627
|
9605 msgstr ""
|
dongsheng@627
|
9606
|
dongsheng@627
|
9607 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
9608 #: ../en/ch09-undo.xml:639
|
dongsheng@627
|
9609 msgid ""
|
dongsheng@627
|
9610 "After you've pushed a bad change to another repository, you <emphasis>could</"
|
dongsheng@627
|
9611 "emphasis> still use <command role=\"hg-cmd\">hg rollback</command> to make "
|
dongsheng@627
|
9612 "your local copy of the change disappear, but it won't have the consequences "
|
dongsheng@627
|
9613 "you want. The change will still be present in the remote repository, so it "
|
dongsheng@627
|
9614 "will reappear in your local repository the next time you pull."
|
dongsheng@627
|
9615 msgstr ""
|
dongsheng@627
|
9616
|
dongsheng@627
|
9617 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
9618 #: ../en/ch09-undo.xml:647
|
dongsheng@627
|
9619 msgid ""
|
dongsheng@627
|
9620 "If a situation like this arises, and you know which repositories your bad "
|
dongsheng@627
|
9621 "change has propagated into, you can <emphasis>try</emphasis> to get rid of "
|
dongsheng@627
|
9622 "the changeefrom <emphasis>every</emphasis> one of those repositories. This "
|
dongsheng@627
|
9623 "is, of course, not a satisfactory solution: if you miss even a single "
|
dongsheng@627
|
9624 "repository while you're expunging, the change is still <quote>in the wild</"
|
dongsheng@627
|
9625 "quote>, and could propagate further."
|
dongsheng@627
|
9626 msgstr ""
|
dongsheng@627
|
9627
|
dongsheng@627
|
9628 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
9629 #: ../en/ch09-undo.xml:655
|
dongsheng@627
|
9630 msgid ""
|
dongsheng@627
|
9631 "If you've committed one or more changes <emphasis>after</emphasis> the change "
|
dongsheng@627
|
9632 "that you'd like to see disappear, your options are further reduced. Mercurial "
|
dongsheng@627
|
9633 "doesn't provide a way to <quote>punch a hole</quote> in history, leaving "
|
dongsheng@627
|
9634 "changesets intact."
|
dongsheng@627
|
9635 msgstr ""
|
dongsheng@627
|
9636
|
dongsheng@627
|
9637 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
9638 #: ../en/ch09-undo.xml:661
|
dongsheng@627
|
9639 msgid ""
|
dongsheng@627
|
9640 "XXX This needs filling out. The <literal>hg-replay</literal> script in the "
|
dongsheng@627
|
9641 "<literal>examples</literal> directory works, but doesn't handle merge "
|
dongsheng@627
|
9642 "changesets. Kind of an important omission."
|
dongsheng@627
|
9643 msgstr ""
|
dongsheng@627
|
9644
|
dongsheng@627
|
9645 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
9646 #: ../en/ch09-undo.xml:667
|
dongsheng@627
|
9647 msgid "Protect yourself from <quote>escaped</quote> changes"
|
dongsheng@635
|
9648 msgstr "使用<quote>校验</quote>修改来保护你自己"
|
dongsheng@627
|
9649
|
dongsheng@627
|
9650 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9651 #: ../en/ch09-undo.xml:670
|
dongsheng@627
|
9652 msgid ""
|
dongsheng@627
|
9653 "If you've committed some changes to your local repository and they've been "
|
dongsheng@627
|
9654 "pushed or pulled somewhere else, this isn't necessarily a disaster. You can "
|
dongsheng@627
|
9655 "protect yourself ahead of time against some classes of bad changeset. This "
|
dongsheng@627
|
9656 "is particularly easy if your team usually pulls changes from a central "
|
dongsheng@627
|
9657 "repository."
|
dongsheng@627
|
9658 msgstr ""
|
dongsheng@627
|
9659
|
dongsheng@627
|
9660 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9661 #: ../en/ch09-undo.xml:677
|
dongsheng@627
|
9662 msgid ""
|
dongsheng@627
|
9663 "By configuring some hooks on that repository to validate incoming changesets "
|
dongsheng@627
|
9664 "(see chapter <xref linkend=\"chap.hook\"/>), you can automatically prevent "
|
dongsheng@627
|
9665 "some kinds of bad changeset from being pushed to the central repository at "
|
dongsheng@627
|
9666 "all. With such a configuration in place, some kinds of bad changeset will "
|
dongsheng@627
|
9667 "naturally tend to <quote>die out</quote> because they can't propagate into "
|
dongsheng@627
|
9668 "the central repository. Better yet, this happens without any need for "
|
dongsheng@627
|
9669 "explicit intervention."
|
dongsheng@627
|
9670 msgstr ""
|
dongsheng@627
|
9671
|
dongsheng@627
|
9672 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9673 #: ../en/ch09-undo.xml:687
|
dongsheng@627
|
9674 msgid ""
|
dongsheng@627
|
9675 "For instance, an incoming change hook that verifies that a changeset will "
|
dongsheng@627
|
9676 "actually compile can prevent people from inadvertantly <quote>breaking the "
|
dongsheng@627
|
9677 "build</quote>."
|
dongsheng@627
|
9678 msgstr ""
|
dongsheng@627
|
9679
|
dongsheng@627
|
9680 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
9681 #: ../en/ch09-undo.xml:694
|
dongsheng@627
|
9682 msgid "Finding the source of a bug"
|
dongsheng@635
|
9683 msgstr "查找问题的根源"
|
dongsheng@627
|
9684
|
dongsheng@627
|
9685 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
9686 #: ../en/ch09-undo.xml:696
|
dongsheng@627
|
9687 msgid ""
|
dongsheng@627
|
9688 "While it's all very well to be able to back out a changeset that introduced a "
|
dongsheng@627
|
9689 "bug, this requires that you know which changeset to back out. Mercurial "
|
dongsheng@627
|
9690 "provides an invaluable command, called <command role=\"hg-cmd\">hg bisect</"
|
dongsheng@627
|
9691 "command>, that helps you to automate this process and accomplish it very "
|
dongsheng@627
|
9692 "efficiently."
|
dongsheng@627
|
9693 msgstr ""
|
dongsheng@627
|
9694
|
dongsheng@627
|
9695 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
9696 #: ../en/ch09-undo.xml:703
|
dongsheng@627
|
9697 msgid ""
|
dongsheng@627
|
9698 "The idea behind the <command role=\"hg-cmd\">hg bisect</command> command is "
|
dongsheng@627
|
9699 "that a changeset has introduced some change of behaviour that you can "
|
dongsheng@627
|
9700 "identify with a simple binary test. You don't know which piece of code "
|
dongsheng@627
|
9701 "introduced the change, but you know how to test for the presence of the bug. "
|
dongsheng@627
|
9702 "The <command role=\"hg-cmd\">hg bisect</command> command uses your test to "
|
dongsheng@627
|
9703 "direct its search for the changeset that introduced the code that caused the "
|
dongsheng@627
|
9704 "bug."
|
dongsheng@627
|
9705 msgstr ""
|
dongsheng@627
|
9706
|
dongsheng@627
|
9707 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
9708 #: ../en/ch09-undo.xml:712
|
dongsheng@627
|
9709 msgid ""
|
dongsheng@627
|
9710 "Here are a few scenarios to help you understand how you might apply this "
|
dongsheng@627
|
9711 "command."
|
dongsheng@627
|
9712 msgstr ""
|
dongsheng@627
|
9713
|
dongsheng@627
|
9714 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@641
|
9715 #: ../en/ch09-undo.xml:715
|
dongsheng@627
|
9716 msgid ""
|
dongsheng@627
|
9717 "The most recent version of your software has a bug that you remember wasn't "
|
dongsheng@627
|
9718 "present a few weeks ago, but you don't know when it was introduced. Here, "
|
dongsheng@627
|
9719 "your binary test checks for the presence of that bug."
|
dongsheng@627
|
9720 msgstr ""
|
dongsheng@627
|
9721
|
dongsheng@627
|
9722 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@641
|
9723 #: ../en/ch09-undo.xml:720
|
dongsheng@627
|
9724 msgid ""
|
dongsheng@627
|
9725 "You fixed a bug in a rush, and now it's time to close the entry in your "
|
dongsheng@627
|
9726 "team's bug database. The bug database requires a changeset ID when you close "
|
dongsheng@627
|
9727 "an entry, but you don't remember which changeset you fixed the bug in. Once "
|
dongsheng@627
|
9728 "again, your binary test checks for the presence of the bug."
|
dongsheng@627
|
9729 msgstr ""
|
dongsheng@627
|
9730
|
dongsheng@627
|
9731 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@641
|
9732 #: ../en/ch09-undo.xml:727
|
dongsheng@627
|
9733 msgid ""
|
dongsheng@627
|
9734 "Your software works correctly, but runs 15% slower than the last time you "
|
dongsheng@627
|
9735 "measured it. You want to know which changeset introduced the performance "
|
dongsheng@627
|
9736 "regression. In this case, your binary test measures the performance of your "
|
dongsheng@627
|
9737 "software, to see whether it's <quote>fast</quote> or <quote>slow</quote>."
|
dongsheng@627
|
9738 msgstr ""
|
dongsheng@627
|
9739
|
dongsheng@627
|
9740 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@641
|
9741 #: ../en/ch09-undo.xml:734
|
dongsheng@627
|
9742 msgid ""
|
dongsheng@627
|
9743 "The sizes of the components of your project that you ship exploded recently, "
|
dongsheng@627
|
9744 "and you suspect that something changed in the way you build your project."
|
dongsheng@627
|
9745 msgstr ""
|
dongsheng@627
|
9746
|
dongsheng@627
|
9747 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
9748 #: ../en/ch09-undo.xml:739
|
dongsheng@627
|
9749 msgid ""
|
dongsheng@627
|
9750 "From these examples, it should be clear that the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
9751 "bisect</command> command is not useful only for finding the sources of bugs. "
|
dongsheng@627
|
9752 "You can use it to find any <quote>emergent property</quote> of a repository "
|
dongsheng@627
|
9753 "(anything that you can't find from a simple text search of the files in the "
|
dongsheng@627
|
9754 "tree) for which you can write a binary test."
|
dongsheng@627
|
9755 msgstr ""
|
dongsheng@627
|
9756
|
dongsheng@627
|
9757 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
9758 #: ../en/ch09-undo.xml:746
|
dongsheng@627
|
9759 msgid ""
|
dongsheng@627
|
9760 "We'll introduce a little bit of terminology here, just to make it clear which "
|
dongsheng@627
|
9761 "parts of the search process are your responsibility, and which are "
|
dongsheng@627
|
9762 "Mercurial's. A <emphasis>test</emphasis> is something that <emphasis>you</"
|
dongsheng@627
|
9763 "emphasis> run when <command role=\"hg-cmd\">hg bisect</command> chooses a "
|
dongsheng@627
|
9764 "changeset. A <emphasis>probe</emphasis> is what <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
9765 "bisect</command> runs to tell whether a revision is good. Finally, we'll use "
|
dongsheng@627
|
9766 "the word <quote>bisect</quote>, as both a noun and a verb, to stand in for "
|
dongsheng@627
|
9767 "the phrase <quote>search using the <command role=\"hg-cmd\">hg bisect</"
|
dongsheng@627
|
9768 "command> command</quote>."
|
dongsheng@627
|
9769 msgstr ""
|
dongsheng@627
|
9770
|
dongsheng@627
|
9771 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
9772 #: ../en/ch09-undo.xml:759
|
dongsheng@627
|
9773 msgid ""
|
dongsheng@627
|
9774 "One simple way to automate the searching process would be simply to probe "
|
dongsheng@627
|
9775 "every changeset. However, this scales poorly. If it took ten minutes to "
|
dongsheng@627
|
9776 "test a single changeset, and you had 10,000 changesets in your repository, "
|
dongsheng@627
|
9777 "the exhaustive approach would take on average 35 <emphasis>days</emphasis> to "
|
dongsheng@627
|
9778 "find the changeset that introduced a bug. Even if you knew that the bug was "
|
dongsheng@627
|
9779 "introduced by one of the last 500 changesets, and limited your search to "
|
dongsheng@627
|
9780 "those, you'd still be looking at over 40 hours to find the changeset that "
|
dongsheng@627
|
9781 "introduced your bug."
|
dongsheng@627
|
9782 msgstr ""
|
dongsheng@627
|
9783
|
dongsheng@627
|
9784 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
9785 #: ../en/ch09-undo.xml:769
|
dongsheng@627
|
9786 msgid ""
|
dongsheng@627
|
9787 "What the <command role=\"hg-cmd\">hg bisect</command> command does is use its "
|
dongsheng@627
|
9788 "knowledge of the <quote>shape</quote> of your project's revision history to "
|
dongsheng@627
|
9789 "perform a search in time proportional to the <emphasis>logarithm</emphasis> "
|
dongsheng@627
|
9790 "of the number of changesets to check (the kind of search it performs is "
|
dongsheng@627
|
9791 "called a dichotomic search). With this approach, searching through 10,000 "
|
dongsheng@627
|
9792 "changesets will take less than three hours, even at ten minutes per test (the "
|
dongsheng@627
|
9793 "search will require about 14 tests). Limit your search to the last hundred "
|
dongsheng@627
|
9794 "changesets, and it will take only about an hour (roughly seven tests)."
|
dongsheng@627
|
9795 msgstr ""
|
dongsheng@627
|
9796
|
dongsheng@627
|
9797 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
9798 #: ../en/ch09-undo.xml:780
|
dongsheng@627
|
9799 msgid ""
|
dongsheng@627
|
9800 "The <command role=\"hg-cmd\">hg bisect</command> command is aware of the "
|
dongsheng@627
|
9801 "<quote>branchy</quote> nature of a Mercurial project's revision history, so "
|
dongsheng@627
|
9802 "it has no problems dealing with branches, merges, or multiple heads in a "
|
dongsheng@627
|
9803 "repository. It can prune entire branches of history with a single probe, "
|
dongsheng@627
|
9804 "which is how it operates so efficiently."
|
dongsheng@627
|
9805 msgstr ""
|
dongsheng@627
|
9806
|
dongsheng@627
|
9807 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
9808 #: ../en/ch09-undo.xml:788
|
dongsheng@627
|
9809 msgid "Using the <command role=\"hg-cmd\">hg bisect</command> command"
|
dongsheng@635
|
9810 msgstr "使用命令 <command role=\"hg-cmd\">hg bisect</command>"
|
dongsheng@627
|
9811
|
dongsheng@627
|
9812 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9813 #: ../en/ch09-undo.xml:791
|
dongsheng@627
|
9814 msgid ""
|
dongsheng@627
|
9815 "Here's an example of <command role=\"hg-cmd\">hg bisect</command> in action."
|
dongsheng@627
|
9816 msgstr ""
|
dongsheng@627
|
9817
|
dongsheng@627
|
9818 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@641
|
9819 #: ../en/ch09-undo.xml:795
|
dongsheng@627
|
9820 msgid ""
|
dongsheng@627
|
9821 "In versions 0.9.5 and earlier of Mercurial, <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
9822 "bisect</command> was not a core command: it was distributed with Mercurial as "
|
dongsheng@627
|
9823 "an extension. This section describes the built-in command, not the old "
|
dongsheng@627
|
9824 "extension."
|
dongsheng@627
|
9825 msgstr ""
|
dongsheng@627
|
9826
|
dongsheng@627
|
9827 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9828 #: ../en/ch09-undo.xml:802
|
dongsheng@627
|
9829 msgid ""
|
dongsheng@627
|
9830 "Now let's create a repository, so that we can try out the <command role=\"hg-"
|
dongsheng@627
|
9831 "cmd\">hg bisect</command> command in isolation."
|
dongsheng@627
|
9832 msgstr ""
|
dongsheng@627
|
9833
|
dongsheng@627
|
9834 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9835 #: ../en/ch09-undo.xml:808
|
dongsheng@627
|
9836 msgid ""
|
dongsheng@627
|
9837 "We'll simulate a project that has a bug in it in a simple-minded way: create "
|
dongsheng@627
|
9838 "trivial changes in a loop, and nominate one specific change that will have "
|
dongsheng@627
|
9839 "the <quote>bug</quote>. This loop creates 35 changesets, each adding a "
|
dongsheng@627
|
9840 "single file to the repository. We'll represent our <quote>bug</quote> with a "
|
dongsheng@627
|
9841 "file that contains the text <quote>i have a gub</quote>."
|
dongsheng@627
|
9842 msgstr ""
|
dongsheng@627
|
9843
|
dongsheng@627
|
9844 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9845 #: ../en/ch09-undo.xml:818
|
dongsheng@627
|
9846 msgid ""
|
dongsheng@627
|
9847 "The next thing that we'd like to do is figure out how to use the <command "
|
dongsheng@627
|
9848 "role=\"hg-cmd\">hg bisect</command> command. We can use Mercurial's normal "
|
dongsheng@627
|
9849 "built-in help mechanism for this."
|
dongsheng@627
|
9850 msgstr ""
|
dongsheng@627
|
9851
|
dongsheng@627
|
9852 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9853 #: ../en/ch09-undo.xml:825
|
dongsheng@627
|
9854 msgid ""
|
dongsheng@627
|
9855 "The <command role=\"hg-cmd\">hg bisect</command> command works in steps. "
|
dongsheng@627
|
9856 "Each step proceeds as follows."
|
dongsheng@627
|
9857 msgstr ""
|
dongsheng@627
|
9858
|
dongsheng@627
|
9859 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
9860 #: ../en/ch09-undo.xml:828
|
dongsheng@627
|
9861 msgid "You run your binary test."
|
dongsheng@627
|
9862 msgstr ""
|
dongsheng@627
|
9863
|
dongsheng@627
|
9864 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><itemizedlist><listitem><para>
|
dongsheng@641
|
9865 #: ../en/ch09-undo.xml:830
|
dongsheng@627
|
9866 msgid ""
|
dongsheng@627
|
9867 "If the test succeeded, you tell <command role=\"hg-cmd\">hg bisect</command> "
|
dongsheng@627
|
9868 "by running the <command role=\"hg-cmd\">hg bisect good</command> command."
|
dongsheng@627
|
9869 msgstr ""
|
dongsheng@627
|
9870
|
dongsheng@627
|
9871 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><itemizedlist><listitem><para>
|
dongsheng@641
|
9872 #: ../en/ch09-undo.xml:835
|
dongsheng@627
|
9873 msgid ""
|
dongsheng@627
|
9874 "If it failed, run the <command role=\"hg-cmd\">hg bisect bad</command> "
|
dongsheng@627
|
9875 "command."
|
dongsheng@627
|
9876 msgstr ""
|
dongsheng@627
|
9877
|
dongsheng@627
|
9878 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
9879 #: ../en/ch09-undo.xml:839
|
dongsheng@627
|
9880 msgid ""
|
dongsheng@627
|
9881 "The command uses your information to decide which changeset to test next."
|
dongsheng@627
|
9882 msgstr ""
|
dongsheng@627
|
9883
|
dongsheng@627
|
9884 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@641
|
9885 #: ../en/ch09-undo.xml:842
|
dongsheng@627
|
9886 msgid ""
|
dongsheng@627
|
9887 "It updates the working directory to that changeset, and the process begins "
|
dongsheng@627
|
9888 "again."
|
dongsheng@627
|
9889 msgstr ""
|
dongsheng@627
|
9890
|
dongsheng@627
|
9891 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9892 #: ../en/ch09-undo.xml:845
|
dongsheng@627
|
9893 msgid ""
|
dongsheng@627
|
9894 "The process ends when <command role=\"hg-cmd\">hg bisect</command> identifies "
|
dongsheng@627
|
9895 "a unique changeset that marks the point where your test transitioned from "
|
dongsheng@627
|
9896 "<quote>succeeding</quote> to <quote>failing</quote>."
|
dongsheng@627
|
9897 msgstr ""
|
dongsheng@627
|
9898
|
dongsheng@627
|
9899 #
|
dongsheng@627
|
9900 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9901 #: ../en/ch09-undo.xml:850
|
dongsheng@627
|
9902 msgid ""
|
dongsheng@627
|
9903 "To start the search, we must run the <command role=\"hg-cmd\">hg bisect --"
|
dongsheng@627
|
9904 "reset</command> command."
|
dongsheng@627
|
9905 msgstr ""
|
dongsheng@627
|
9906
|
dongsheng@627
|
9907 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9908 #: ../en/ch09-undo.xml:855
|
dongsheng@627
|
9909 msgid ""
|
dongsheng@627
|
9910 "In our case, the binary test we use is simple: we check to see if any file in "
|
dongsheng@627
|
9911 "the repository contains the string <quote>i have a gub</quote>. If it does, "
|
dongsheng@627
|
9912 "this changeset contains the change that <quote>caused the bug</quote>. By "
|
dongsheng@627
|
9913 "convention, a changeset that has the property we're searching for is "
|
dongsheng@627
|
9914 "<quote>bad</quote>, while one that doesn't is <quote>good</quote>."
|
dongsheng@627
|
9915 msgstr ""
|
dongsheng@627
|
9916
|
dongsheng@627
|
9917 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9918 #: ../en/ch09-undo.xml:863
|
dongsheng@627
|
9919 msgid ""
|
dongsheng@627
|
9920 "Most of the time, the revision to which the working directory is synced "
|
dongsheng@627
|
9921 "(usually the tip) already exhibits the problem introduced by the buggy "
|
dongsheng@627
|
9922 "change, so we'll mark it as <quote>bad</quote>."
|
dongsheng@627
|
9923 msgstr ""
|
dongsheng@627
|
9924
|
dongsheng@627
|
9925 #
|
dongsheng@627
|
9926 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9927 #: ../en/ch09-undo.xml:870
|
dongsheng@627
|
9928 msgid ""
|
dongsheng@627
|
9929 "Our next task is to nominate a changeset that we know <emphasis>doesn't</"
|
dongsheng@627
|
9930 "emphasis> have the bug; the <command role=\"hg-cmd\">hg bisect</command> "
|
dongsheng@627
|
9931 "command will <quote>bracket</quote> its search between the first pair of good "
|
dongsheng@627
|
9932 "and bad changesets. In our case, we know that revision 10 didn't have the "
|
dongsheng@627
|
9933 "bug. (I'll have more words about choosing the first <quote>good</quote> "
|
dongsheng@627
|
9934 "changeset later.)"
|
dongsheng@627
|
9935 msgstr ""
|
dongsheng@627
|
9936
|
dongsheng@627
|
9937 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9938 #: ../en/ch09-undo.xml:880
|
dongsheng@627
|
9939 msgid "Notice that this command printed some output."
|
dongsheng@627
|
9940 msgstr ""
|
dongsheng@627
|
9941
|
dongsheng@627
|
9942 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
9943 #: ../en/ch09-undo.xml:882
|
dongsheng@627
|
9944 msgid ""
|
dongsheng@627
|
9945 "It told us how many changesets it must consider before it can identify the "
|
dongsheng@627
|
9946 "one that introduced the bug, and how many tests that will require."
|
dongsheng@627
|
9947 msgstr ""
|
dongsheng@627
|
9948
|
dongsheng@627
|
9949 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
9950 #: ../en/ch09-undo.xml:886
|
dongsheng@627
|
9951 msgid ""
|
dongsheng@627
|
9952 "It updated the working directory to the next changeset to test, and told us "
|
dongsheng@627
|
9953 "which changeset it's testing."
|
dongsheng@627
|
9954 msgstr ""
|
dongsheng@627
|
9955
|
dongsheng@627
|
9956 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9957 #: ../en/ch09-undo.xml:891
|
dongsheng@627
|
9958 msgid ""
|
dongsheng@627
|
9959 "We now run our test in the working directory. We use the <command>grep</"
|
dongsheng@627
|
9960 "command> command to see if our <quote>bad</quote> file is present in the "
|
dongsheng@627
|
9961 "working directory. If it is, this revision is bad; if not, this revision is "
|
dongsheng@627
|
9962 "good. &interaction.bisect.search.step1;"
|
dongsheng@627
|
9963 msgstr ""
|
dongsheng@627
|
9964
|
dongsheng@627
|
9965 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9966 #: ../en/ch09-undo.xml:897
|
dongsheng@627
|
9967 msgid ""
|
dongsheng@627
|
9968 "This test looks like a perfect candidate for automation, so let's turn it "
|
dongsheng@627
|
9969 "into a shell function."
|
dongsheng@627
|
9970 msgstr ""
|
dongsheng@627
|
9971
|
dongsheng@627
|
9972 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9973 #: ../en/ch09-undo.xml:901
|
dongsheng@627
|
9974 msgid ""
|
dongsheng@627
|
9975 "We can now run an entire test step with a single command, <literal>mytest</"
|
dongsheng@627
|
9976 "literal>."
|
dongsheng@627
|
9977 msgstr ""
|
dongsheng@627
|
9978
|
dongsheng@627
|
9979 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9980 #: ../en/ch09-undo.xml:906
|
dongsheng@627
|
9981 msgid "A few more invocations of our canned test step command, and we're done."
|
dongsheng@627
|
9982 msgstr ""
|
dongsheng@627
|
9983
|
dongsheng@627
|
9984 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
9985 #: ../en/ch09-undo.xml:911
|
dongsheng@627
|
9986 msgid ""
|
dongsheng@627
|
9987 "Even though we had 40 changesets to search through, the <command role=\"hg-cmd"
|
dongsheng@627
|
9988 "\">hg bisect</command> command let us find the changeset that introduced our "
|
dongsheng@627
|
9989 "<quote>bug</quote> with only five tests. Because the number of tests that "
|
dongsheng@627
|
9990 "the <command role=\"hg-cmd\">hg bisect</command> command performs grows "
|
dongsheng@627
|
9991 "logarithmically with the number of changesets to search, the advantage that "
|
dongsheng@627
|
9992 "it has over the <quote>brute force</quote> search approach increases with "
|
dongsheng@627
|
9993 "every changeset you add."
|
dongsheng@627
|
9994 msgstr ""
|
dongsheng@627
|
9995
|
dongsheng@627
|
9996 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
9997 #: ../en/ch09-undo.xml:922
|
dongsheng@627
|
9998 msgid "Cleaning up after your search"
|
dongsheng@635
|
9999 msgstr "搜索后的清理"
|
dongsheng@627
|
10000
|
dongsheng@627
|
10001 #
|
dongsheng@627
|
10002 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
10003 #: ../en/ch09-undo.xml:924
|
dongsheng@627
|
10004 msgid ""
|
dongsheng@627
|
10005 "When you're finished using the <command role=\"hg-cmd\">hg bisect</command> "
|
dongsheng@627
|
10006 "command in a repository, you can use the <command role=\"hg-cmd\">hg bisect "
|
dongsheng@627
|
10007 "reset</command> command to drop the information it was using to drive your "
|
dongsheng@627
|
10008 "search. The command doesn't use much space, so it doesn't matter if you "
|
dongsheng@627
|
10009 "forget to run this command. However, <command role=\"hg-cmd\">hg bisect</"
|
dongsheng@627
|
10010 "command> won't let you start a new search in that repository until you do a "
|
dongsheng@627
|
10011 "<command role=\"hg-cmd\">hg bisect reset</command>."
|
dongsheng@627
|
10012 msgstr ""
|
dongsheng@627
|
10013
|
dongsheng@627
|
10014 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
10015 #: ../en/ch09-undo.xml:939
|
dongsheng@627
|
10016 msgid "Tips for finding bugs effectively"
|
dongsheng@635
|
10017 msgstr "有效查找问题的技巧"
|
dongsheng@627
|
10018
|
dongsheng@627
|
10019 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
10020 #: ../en/ch09-undo.xml:942
|
dongsheng@627
|
10021 msgid "Give consistent input"
|
dongsheng@635
|
10022 msgstr "给出一致的输入"
|
dongsheng@627
|
10023
|
dongsheng@627
|
10024 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
10025 #: ../en/ch09-undo.xml:944
|
dongsheng@627
|
10026 msgid ""
|
dongsheng@627
|
10027 "The <command role=\"hg-cmd\">hg bisect</command> command requires that you "
|
dongsheng@627
|
10028 "correctly report the result of every test you perform. If you tell it that a "
|
dongsheng@627
|
10029 "test failed when it really succeeded, it <emphasis>might</emphasis> be able "
|
dongsheng@627
|
10030 "to detect the inconsistency. If it can identify an inconsistency in your "
|
dongsheng@627
|
10031 "reports, it will tell you that a particular changeset is both good and bad. "
|
dongsheng@627
|
10032 "However, it can't do this perfectly; it's about as likely to report the wrong "
|
dongsheng@627
|
10033 "changeset as the source of the bug."
|
dongsheng@627
|
10034 msgstr ""
|
dongsheng@627
|
10035
|
dongsheng@627
|
10036 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
10037 #: ../en/ch09-undo.xml:956
|
dongsheng@627
|
10038 msgid "Automate as much as possible"
|
dongsheng@635
|
10039 msgstr "尽量自动"
|
dongsheng@627
|
10040
|
dongsheng@627
|
10041 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
10042 #: ../en/ch09-undo.xml:958
|
dongsheng@627
|
10043 msgid ""
|
dongsheng@627
|
10044 "When I started using the <command role=\"hg-cmd\">hg bisect</command> "
|
dongsheng@627
|
10045 "command, I tried a few times to run my tests by hand, on the command line. "
|
dongsheng@627
|
10046 "This is an approach that I, at least, am not suited to. After a few tries, I "
|
dongsheng@627
|
10047 "found that I was making enough mistakes that I was having to restart my "
|
dongsheng@627
|
10048 "searches several times before finally getting correct results."
|
dongsheng@627
|
10049 msgstr ""
|
dongsheng@627
|
10050
|
dongsheng@627
|
10051 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
10052 #: ../en/ch09-undo.xml:966
|
dongsheng@627
|
10053 msgid ""
|
dongsheng@627
|
10054 "My initial problems with driving the <command role=\"hg-cmd\">hg bisect</"
|
dongsheng@627
|
10055 "command> command by hand occurred even with simple searches on small "
|
dongsheng@627
|
10056 "repositories; if the problem you're looking for is more subtle, or the number "
|
dongsheng@627
|
10057 "of tests that <command role=\"hg-cmd\">hg bisect</command> must perform "
|
dongsheng@627
|
10058 "increases, the likelihood of operator error ruining the search is much "
|
dongsheng@627
|
10059 "higher. Once I started automating my tests, I had much better results."
|
dongsheng@627
|
10060 msgstr ""
|
dongsheng@627
|
10061
|
dongsheng@627
|
10062 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
10063 #: ../en/ch09-undo.xml:975
|
dongsheng@627
|
10064 msgid "The key to automated testing is twofold:"
|
dongsheng@627
|
10065 msgstr ""
|
dongsheng@627
|
10066
|
dongsheng@627
|
10067 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
10068 #: ../en/ch09-undo.xml:977
|
dongsheng@627
|
10069 msgid "always test for the same symptom, and"
|
dongsheng@627
|
10070 msgstr ""
|
dongsheng@627
|
10071
|
dongsheng@627
|
10072 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
10073 #: ../en/ch09-undo.xml:979
|
dongsheng@627
|
10074 msgid ""
|
dongsheng@627
|
10075 "always feed consistent input to the <command role=\"hg-cmd\">hg bisect</"
|
dongsheng@627
|
10076 "command> command."
|
dongsheng@627
|
10077 msgstr ""
|
dongsheng@627
|
10078
|
dongsheng@627
|
10079 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
10080 #: ../en/ch09-undo.xml:982
|
dongsheng@627
|
10081 msgid ""
|
dongsheng@627
|
10082 "In my tutorial example above, the <command>grep</command> command tests for "
|
dongsheng@627
|
10083 "the symptom, and the <literal>if</literal> statement takes the result of this "
|
dongsheng@627
|
10084 "check and ensures that we always feed the same input to the <command role="
|
dongsheng@627
|
10085 "\"hg-cmd\">hg bisect</command> command. The <literal>mytest</literal> "
|
dongsheng@627
|
10086 "function marries these together in a reproducible way, so that every test is "
|
dongsheng@627
|
10087 "uniform and consistent."
|
dongsheng@627
|
10088 msgstr ""
|
dongsheng@627
|
10089
|
dongsheng@627
|
10090 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
10091 #: ../en/ch09-undo.xml:992
|
dongsheng@627
|
10092 msgid "Check your results"
|
dongsheng@635
|
10093 msgstr "检查你的结果"
|
dongsheng@627
|
10094
|
dongsheng@627
|
10095 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
10096 #: ../en/ch09-undo.xml:994
|
dongsheng@627
|
10097 msgid ""
|
dongsheng@627
|
10098 "Because the output of a <command role=\"hg-cmd\">hg bisect</command> search "
|
dongsheng@627
|
10099 "is only as good as the input you give it, don't take the changeset it reports "
|
dongsheng@627
|
10100 "as the absolute truth. A simple way to cross-check its report is to manually "
|
dongsheng@627
|
10101 "run your test at each of the following changesets:"
|
dongsheng@627
|
10102 msgstr ""
|
dongsheng@627
|
10103
|
dongsheng@627
|
10104 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
10105 #: ../en/ch09-undo.xml:1000
|
dongsheng@627
|
10106 msgid ""
|
dongsheng@627
|
10107 "The changeset that it reports as the first bad revision. Your test should "
|
dongsheng@627
|
10108 "still report this as bad."
|
dongsheng@627
|
10109 msgstr ""
|
dongsheng@627
|
10110
|
dongsheng@627
|
10111 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
10112 #: ../en/ch09-undo.xml:1004
|
dongsheng@627
|
10113 msgid ""
|
dongsheng@627
|
10114 "The parent of that changeset (either parent, if it's a merge). Your test "
|
dongsheng@627
|
10115 "should report this changeset as good."
|
dongsheng@627
|
10116 msgstr ""
|
dongsheng@627
|
10117
|
dongsheng@627
|
10118 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
10119 #: ../en/ch09-undo.xml:1008
|
dongsheng@627
|
10120 msgid ""
|
dongsheng@627
|
10121 "A child of that changeset. Your test should report this changeset as bad."
|
dongsheng@627
|
10122 msgstr ""
|
dongsheng@627
|
10123
|
dongsheng@627
|
10124 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
10125 #: ../en/ch09-undo.xml:1014
|
dongsheng@627
|
10126 msgid "Beware interference between bugs"
|
dongsheng@635
|
10127 msgstr "谨防问题之间的冲突"
|
dongsheng@627
|
10128
|
dongsheng@627
|
10129 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
10130 #: ../en/ch09-undo.xml:1016
|
dongsheng@627
|
10131 msgid ""
|
dongsheng@627
|
10132 "It's possible that your search for one bug could be disrupted by the presence "
|
dongsheng@627
|
10133 "of another. For example, let's say your software crashes at revision 100, "
|
dongsheng@627
|
10134 "and worked correctly at revision 50. Unknown to you, someone else introduced "
|
dongsheng@627
|
10135 "a different crashing bug at revision 60, and fixed it at revision 80. This "
|
dongsheng@627
|
10136 "could distort your results in one of several ways."
|
dongsheng@627
|
10137 msgstr ""
|
dongsheng@627
|
10138
|
dongsheng@627
|
10139 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
10140 #: ../en/ch09-undo.xml:1024
|
dongsheng@627
|
10141 msgid ""
|
dongsheng@627
|
10142 "It is possible that this other bug completely <quote>masks</quote> yours, "
|
dongsheng@627
|
10143 "which is to say that it occurs before your bug has a chance to manifest "
|
dongsheng@627
|
10144 "itself. If you can't avoid that other bug (for example, it prevents your "
|
dongsheng@627
|
10145 "project from building), and so can't tell whether your bug is present in a "
|
dongsheng@627
|
10146 "particular changeset, the <command role=\"hg-cmd\">hg bisect</command> "
|
dongsheng@627
|
10147 "command cannot help you directly. Instead, you can mark a changeset as "
|
dongsheng@627
|
10148 "untested by running <command role=\"hg-cmd\">hg bisect --skip</command>."
|
dongsheng@627
|
10149 msgstr ""
|
dongsheng@627
|
10150
|
dongsheng@627
|
10151 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
10152 #: ../en/ch09-undo.xml:1034
|
dongsheng@627
|
10153 msgid ""
|
dongsheng@627
|
10154 "A different problem could arise if your test for a bug's presence is not "
|
dongsheng@627
|
10155 "specific enough. If you check for <quote>my program crashes</quote>, then "
|
dongsheng@627
|
10156 "both your crashing bug and an unrelated crashing bug that masks it will look "
|
dongsheng@627
|
10157 "like the same thing, and mislead <command role=\"hg-cmd\">hg bisect</command>."
|
dongsheng@627
|
10158 msgstr ""
|
dongsheng@627
|
10159
|
dongsheng@627
|
10160 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
10161 #: ../en/ch09-undo.xml:1041
|
dongsheng@627
|
10162 msgid ""
|
dongsheng@627
|
10163 "Another useful situation in which to use <command role=\"hg-cmd\">hg bisect --"
|
dongsheng@627
|
10164 "skip</command> is if you can't test a revision because your project was in a "
|
dongsheng@627
|
10165 "broken and hence untestable state at that revision, perhaps because someone "
|
dongsheng@627
|
10166 "checked in a change that prevented the project from building."
|
dongsheng@627
|
10167 msgstr ""
|
dongsheng@627
|
10168
|
dongsheng@627
|
10169 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
10170 #: ../en/ch09-undo.xml:1050
|
dongsheng@627
|
10171 msgid "Bracket your search lazily"
|
dongsheng@635
|
10172 msgstr "减少你的查找工作"
|
dongsheng@627
|
10173
|
dongsheng@627
|
10174 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
10175 #: ../en/ch09-undo.xml:1052
|
dongsheng@627
|
10176 msgid ""
|
dongsheng@627
|
10177 "Choosing the first <quote>good</quote> and <quote>bad</quote> changesets that "
|
dongsheng@627
|
10178 "will mark the end points of your search is often easy, but it bears a little "
|
dongsheng@627
|
10179 "discussion nevertheless. From the perspective of <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
10180 "bisect</command>, the <quote>newest</quote> changeset is conventionally "
|
dongsheng@627
|
10181 "<quote>bad</quote>, and the older changeset is <quote>good</quote>."
|
dongsheng@627
|
10182 msgstr ""
|
dongsheng@627
|
10183
|
dongsheng@627
|
10184 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
10185 #: ../en/ch09-undo.xml:1060
|
dongsheng@627
|
10186 msgid ""
|
dongsheng@627
|
10187 "If you're having trouble remembering when a suitable <quote>good</quote> "
|
dongsheng@627
|
10188 "change was, so that you can tell <command role=\"hg-cmd\">hg bisect</"
|
dongsheng@627
|
10189 "command>, you could do worse than testing changesets at random. Just "
|
dongsheng@627
|
10190 "remember to eliminate contenders that can't possibly exhibit the bug (perhaps "
|
dongsheng@627
|
10191 "because the feature with the bug isn't present yet) and those where another "
|
dongsheng@627
|
10192 "problem masks the bug (as I discussed above)."
|
dongsheng@627
|
10193 msgstr ""
|
dongsheng@627
|
10194
|
dongsheng@627
|
10195 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
10196 #: ../en/ch09-undo.xml:1069
|
dongsheng@627
|
10197 msgid ""
|
dongsheng@627
|
10198 "Even if you end up <quote>early</quote> by thousands of changesets or months "
|
dongsheng@627
|
10199 "of history, you will only add a handful of tests to the total number that "
|
dongsheng@627
|
10200 "<command role=\"hg-cmd\">hg bisect</command> must perform, thanks to its "
|
dongsheng@627
|
10201 "logarithmic behaviour."
|
dongsheng@627
|
10202 msgstr ""
|
dongsheng@627
|
10203
|
dongsheng@627
|
10204 #. type: Content of: <book><chapter><title>
|
dongsheng@627
|
10205 #: ../en/ch10-hook.xml:5
|
dongsheng@627
|
10206 msgid "Handling repository events with hooks"
|
dongsheng@627
|
10207 msgstr "使用钩子处理版本库事件"
|
dongsheng@627
|
10208
|
dongsheng@627
|
10209 #. type: Content of: <book><chapter><para>
|
dongsheng@627
|
10210 #: ../en/ch10-hook.xml:7
|
dongsheng@627
|
10211 msgid ""
|
dongsheng@627
|
10212 "Mercurial offers a powerful mechanism to let you perform automated actions in "
|
dongsheng@627
|
10213 "response to events that occur in a repository. In some cases, you can even "
|
dongsheng@627
|
10214 "control Mercurial's response to those events."
|
dongsheng@627
|
10215 msgstr ""
|
dongsheng@627
|
10216
|
dongsheng@627
|
10217 #. type: Content of: <book><chapter><para>
|
dongsheng@627
|
10218 #: ../en/ch10-hook.xml:12
|
dongsheng@627
|
10219 msgid ""
|
dongsheng@627
|
10220 "The name Mercurial uses for one of these actions is a <emphasis>hook</"
|
dongsheng@627
|
10221 "emphasis>. Hooks are called <quote>triggers</quote> in some revision control "
|
dongsheng@627
|
10222 "systems, but the two names refer to the same idea."
|
dongsheng@627
|
10223 msgstr ""
|
dongsheng@627
|
10224
|
dongsheng@627
|
10225 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
10226 #: ../en/ch10-hook.xml:18
|
dongsheng@627
|
10227 msgid "An overview of hooks in Mercurial"
|
dongsheng@635
|
10228 msgstr "Mercurial 钩子概述"
|
dongsheng@627
|
10229
|
dongsheng@627
|
10230 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
10231 #: ../en/ch10-hook.xml:20
|
dongsheng@627
|
10232 msgid ""
|
dongsheng@627
|
10233 "Here is a brief list of the hooks that Mercurial supports. We will revisit "
|
dongsheng@627
|
10234 "each of these hooks in more detail later, in section <xref linkend=\"sec.hook."
|
dongsheng@627
|
10235 "ref\"/>."
|
dongsheng@627
|
10236 msgstr ""
|
dongsheng@627
|
10237
|
dongsheng@627
|
10238 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
10239 #: ../en/ch10-hook.xml:25
|
dongsheng@627
|
10240 msgid ""
|
dongsheng@627
|
10241 "<literal role=\"hook\">changegroup</literal>: This is run after a group of "
|
dongsheng@627
|
10242 "changesets has been brought into the repository from elsewhere."
|
dongsheng@627
|
10243 msgstr ""
|
dongsheng@627
|
10244
|
dongsheng@627
|
10245 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
10246 #: ../en/ch10-hook.xml:29
|
dongsheng@627
|
10247 msgid ""
|
dongsheng@627
|
10248 "<literal role=\"hook\">commit</literal>: This is run after a new changeset "
|
dongsheng@627
|
10249 "has been created in the local repository."
|
dongsheng@627
|
10250 msgstr ""
|
dongsheng@627
|
10251
|
dongsheng@627
|
10252 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
10253 #: ../en/ch10-hook.xml:33
|
dongsheng@627
|
10254 msgid ""
|
dongsheng@627
|
10255 "<literal role=\"hook\">incoming</literal>: This is run once for each new "
|
dongsheng@627
|
10256 "changeset that is brought into the repository from elsewhere. Notice the "
|
dongsheng@627
|
10257 "difference from <literal role=\"hook\">changegroup</literal>, which is run "
|
dongsheng@627
|
10258 "once per <emphasis>group</emphasis> of changesets brought in."
|
dongsheng@627
|
10259 msgstr ""
|
dongsheng@627
|
10260
|
dongsheng@627
|
10261 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
10262 #: ../en/ch10-hook.xml:40
|
dongsheng@627
|
10263 msgid ""
|
dongsheng@627
|
10264 "<literal role=\"hook\">outgoing</literal>: This is run after a group of "
|
dongsheng@627
|
10265 "changesets has been transmitted from this repository."
|
dongsheng@627
|
10266 msgstr ""
|
dongsheng@627
|
10267
|
dongsheng@627
|
10268 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
10269 #: ../en/ch10-hook.xml:44
|
dongsheng@627
|
10270 msgid ""
|
dongsheng@627
|
10271 "<literal role=\"hook\">prechangegroup</literal>: This is run before starting "
|
dongsheng@627
|
10272 "to bring a group of changesets into the repository."
|
dongsheng@627
|
10273 msgstr ""
|
dongsheng@627
|
10274
|
dongsheng@627
|
10275 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
10276 #: ../en/ch10-hook.xml:49
|
dongsheng@627
|
10277 msgid ""
|
dongsheng@627
|
10278 "<literal role=\"hook\">precommit</literal>: Controlling. This is run before "
|
dongsheng@627
|
10279 "starting a commit."
|
dongsheng@627
|
10280 msgstr ""
|
dongsheng@627
|
10281
|
dongsheng@627
|
10282 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
10283 #: ../en/ch10-hook.xml:53
|
dongsheng@627
|
10284 msgid ""
|
dongsheng@627
|
10285 "<literal role=\"hook\">preoutgoing</literal>: Controlling. This is run before "
|
dongsheng@627
|
10286 "starting to transmit a group of changesets from this repository."
|
dongsheng@627
|
10287 msgstr ""
|
dongsheng@627
|
10288
|
dongsheng@627
|
10289 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
10290 #: ../en/ch10-hook.xml:58
|
dongsheng@627
|
10291 msgid ""
|
dongsheng@627
|
10292 "<literal role=\"hook\">pretag</literal>: Controlling. This is run before "
|
dongsheng@627
|
10293 "creating a tag."
|
dongsheng@627
|
10294 msgstr ""
|
dongsheng@627
|
10295
|
dongsheng@627
|
10296 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
10297 #: ../en/ch10-hook.xml:62
|
dongsheng@627
|
10298 msgid ""
|
dongsheng@627
|
10299 "<literal role=\"hook\">pretxnchangegroup</literal>: Controlling. This is run "
|
dongsheng@627
|
10300 "after a group of changesets has been brought into the local repository from "
|
dongsheng@627
|
10301 "another, but before the transaction completes that will make the changes "
|
dongsheng@627
|
10302 "permanent in the repository."
|
dongsheng@627
|
10303 msgstr ""
|
dongsheng@627
|
10304
|
dongsheng@627
|
10305 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
10306 #: ../en/ch10-hook.xml:70
|
dongsheng@627
|
10307 msgid ""
|
dongsheng@627
|
10308 "<literal role=\"hook\">pretxncommit</literal>: Controlling. This is run after "
|
dongsheng@627
|
10309 "a new changeset has been created in the local repository, but before the "
|
dongsheng@627
|
10310 "transaction completes that will make it permanent."
|
dongsheng@627
|
10311 msgstr ""
|
dongsheng@627
|
10312
|
dongsheng@627
|
10313 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
10314 #: ../en/ch10-hook.xml:76
|
dongsheng@627
|
10315 msgid ""
|
dongsheng@627
|
10316 "<literal role=\"hook\">preupdate</literal>: Controlling. This is run before "
|
dongsheng@627
|
10317 "starting an update or merge of the working directory."
|
dongsheng@627
|
10318 msgstr ""
|
dongsheng@627
|
10319
|
dongsheng@627
|
10320 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
10321 #: ../en/ch10-hook.xml:81
|
dongsheng@627
|
10322 msgid ""
|
dongsheng@627
|
10323 "<literal role=\"hook\">tag</literal>: This is run after a tag is created."
|
dongsheng@627
|
10324 msgstr ""
|
dongsheng@627
|
10325
|
dongsheng@627
|
10326 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
10327 #: ../en/ch10-hook.xml:85
|
dongsheng@627
|
10328 msgid ""
|
dongsheng@627
|
10329 "<literal role=\"hook\">update</literal>: This is run after an update or merge "
|
dongsheng@627
|
10330 "of the working directory has finished."
|
dongsheng@627
|
10331 msgstr ""
|
dongsheng@627
|
10332
|
dongsheng@627
|
10333 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
10334 #: ../en/ch10-hook.xml:90
|
dongsheng@627
|
10335 msgid ""
|
dongsheng@627
|
10336 "Each of the hooks whose description begins with the word <quote>Controlling</"
|
dongsheng@627
|
10337 "quote> has the ability to determine whether an activity can proceed. If the "
|
dongsheng@627
|
10338 "hook succeeds, the activity may proceed; if it fails, the activity is either "
|
dongsheng@627
|
10339 "not permitted or undone, depending on the hook."
|
dongsheng@627
|
10340 msgstr ""
|
dongsheng@627
|
10341
|
dongsheng@627
|
10342 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
10343 #: ../en/ch10-hook.xml:99
|
dongsheng@627
|
10344 msgid "Hooks and security"
|
dongsheng@635
|
10345 msgstr "钩子与安全性"
|
dongsheng@627
|
10346
|
dongsheng@627
|
10347 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
10348 #: ../en/ch10-hook.xml:102
|
dongsheng@627
|
10349 msgid "Hooks are run with your privileges"
|
dongsheng@635
|
10350 msgstr "钩子以你的特权执行"
|
dongsheng@627
|
10351
|
dongsheng@627
|
10352 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10353 #: ../en/ch10-hook.xml:104
|
dongsheng@627
|
10354 msgid ""
|
dongsheng@627
|
10355 "When you run a Mercurial command in a repository, and the command causes a "
|
dongsheng@627
|
10356 "hook to run, that hook runs on <emphasis>your</emphasis> system, under "
|
dongsheng@627
|
10357 "<emphasis>your</emphasis> user account, with <emphasis>your</emphasis> "
|
dongsheng@627
|
10358 "privilege level. Since hooks are arbitrary pieces of executable code, you "
|
dongsheng@627
|
10359 "should treat them with an appropriate level of suspicion. Do not install a "
|
dongsheng@627
|
10360 "hook unless you are confident that you know who created it and what it does."
|
dongsheng@627
|
10361 msgstr ""
|
dongsheng@627
|
10362
|
dongsheng@627
|
10363 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10364 #: ../en/ch10-hook.xml:115
|
dongsheng@627
|
10365 msgid ""
|
dongsheng@627
|
10366 "In some cases, you may be exposed to hooks that you did not install "
|
dongsheng@627
|
10367 "yourself. If you work with Mercurial on an unfamiliar system, Mercurial will "
|
dongsheng@627
|
10368 "run hooks defined in that system's global <filename role=\"special\"> /.hgrc</"
|
dongsheng@627
|
10369 "filename>\\ file."
|
dongsheng@627
|
10370 msgstr ""
|
dongsheng@627
|
10371
|
dongsheng@627
|
10372 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10373 #: ../en/ch10-hook.xml:122
|
dongsheng@627
|
10374 msgid ""
|
dongsheng@627
|
10375 "If you are working with a repository owned by another user, Mercurial can run "
|
dongsheng@627
|
10376 "hooks defined in that user's repository, but it will still run them as "
|
dongsheng@627
|
10377 "<quote>you</quote>. For example, if you <command role=\"hg-cmd\">hg pull</"
|
dongsheng@627
|
10378 "command> from that repository, and its <filename role=\"special\">.hg/hgrc</"
|
dongsheng@627
|
10379 "filename> defines a local <literal role=\"hook\">outgoing</literal> hook, "
|
dongsheng@627
|
10380 "that hook will run under your user account, even though you don't own that "
|
dongsheng@627
|
10381 "repository."
|
dongsheng@627
|
10382 msgstr ""
|
dongsheng@627
|
10383
|
dongsheng@627
|
10384 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@627
|
10385 #: ../en/ch10-hook.xml:134
|
dongsheng@627
|
10386 msgid ""
|
dongsheng@627
|
10387 "This only applies if you are pulling from a repository on a local or network "
|
dongsheng@627
|
10388 "filesystem. If you're pulling over http or ssh, any <literal role=\"hook"
|
dongsheng@627
|
10389 "\">outgoing</literal> hook will run under whatever account is executing the "
|
dongsheng@627
|
10390 "server process, on the server."
|
dongsheng@627
|
10391 msgstr ""
|
dongsheng@627
|
10392
|
dongsheng@627
|
10393 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10394 #: ../en/ch10-hook.xml:142
|
dongsheng@627
|
10395 msgid ""
|
dongsheng@627
|
10396 "XXX To see what hooks are defined in a repository, use the <command role=\"hg-"
|
dongsheng@627
|
10397 "cmd\">hg config hooks</command> command. If you are working in one "
|
dongsheng@627
|
10398 "repository, but talking to another that you do not own (e.g. using <command "
|
dongsheng@627
|
10399 "role=\"hg-cmd\">hg pull</command> or <command role=\"hg-cmd\">hg incoming</"
|
dongsheng@627
|
10400 "command>), remember that it is the other repository's hooks you should be "
|
dongsheng@627
|
10401 "checking, not your own."
|
dongsheng@627
|
10402 msgstr ""
|
dongsheng@627
|
10403
|
dongsheng@627
|
10404 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
10405 #: ../en/ch10-hook.xml:153
|
dongsheng@627
|
10406 msgid "Hooks do not propagate"
|
dongsheng@635
|
10407 msgstr "钩子不会传播"
|
dongsheng@627
|
10408
|
dongsheng@627
|
10409 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10410 #: ../en/ch10-hook.xml:155
|
dongsheng@627
|
10411 msgid ""
|
dongsheng@627
|
10412 "In Mercurial, hooks are not revision controlled, and do not propagate when "
|
dongsheng@627
|
10413 "you clone, or pull from, a repository. The reason for this is simple: a hook "
|
dongsheng@627
|
10414 "is a completely arbitrary piece of executable code. It runs under your user "
|
dongsheng@627
|
10415 "identity, with your privilege level, on your machine."
|
dongsheng@627
|
10416 msgstr ""
|
dongsheng@627
|
10417
|
dongsheng@627
|
10418 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10419 #: ../en/ch10-hook.xml:162
|
dongsheng@627
|
10420 msgid ""
|
dongsheng@627
|
10421 "It would be extremely reckless for any distributed revision control system to "
|
dongsheng@627
|
10422 "implement revision-controlled hooks, as this would offer an easily "
|
dongsheng@627
|
10423 "exploitable way to subvert the accounts of users of the revision control "
|
dongsheng@627
|
10424 "system."
|
dongsheng@627
|
10425 msgstr ""
|
dongsheng@627
|
10426
|
dongsheng@627
|
10427 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10428 #: ../en/ch10-hook.xml:168
|
dongsheng@627
|
10429 msgid ""
|
dongsheng@627
|
10430 "Since Mercurial does not propagate hooks, if you are collaborating with other "
|
dongsheng@627
|
10431 "people on a common project, you should not assume that they are using the "
|
dongsheng@627
|
10432 "same Mercurial hooks as you are, or that theirs are correctly configured. "
|
dongsheng@627
|
10433 "You should document the hooks you expect people to use."
|
dongsheng@627
|
10434 msgstr ""
|
dongsheng@627
|
10435
|
dongsheng@627
|
10436 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10437 #: ../en/ch10-hook.xml:175
|
dongsheng@627
|
10438 msgid ""
|
dongsheng@627
|
10439 "In a corporate intranet, this is somewhat easier to control, as you can for "
|
dongsheng@627
|
10440 "example provide a <quote>standard</quote> installation of Mercurial on an NFS "
|
dongsheng@627
|
10441 "filesystem, and use a site-wide <filename role=\"special\"> /.hgrc</filename>"
|
dongsheng@627
|
10442 "\\ file to define hooks that all users will see. However, this too has its "
|
dongsheng@627
|
10443 "limits; see below."
|
dongsheng@627
|
10444 msgstr ""
|
dongsheng@627
|
10445
|
dongsheng@627
|
10446 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
10447 #: ../en/ch10-hook.xml:185
|
dongsheng@627
|
10448 msgid "Hooks can be overridden"
|
dongsheng@635
|
10449 msgstr "钩子可以被覆盖"
|
dongsheng@627
|
10450
|
dongsheng@627
|
10451 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10452 #: ../en/ch10-hook.xml:187
|
dongsheng@627
|
10453 msgid ""
|
dongsheng@627
|
10454 "Mercurial allows you to override a hook definition by redefining the hook. "
|
dongsheng@627
|
10455 "You can disable it by setting its value to the empty string, or change its "
|
dongsheng@627
|
10456 "behaviour as you wish."
|
dongsheng@627
|
10457 msgstr ""
|
dongsheng@627
|
10458
|
dongsheng@627
|
10459 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10460 #: ../en/ch10-hook.xml:192
|
dongsheng@627
|
10461 msgid ""
|
dongsheng@627
|
10462 "If you deploy a system- or site-wide <filename role=\"special\"> /.hgrc</"
|
dongsheng@627
|
10463 "filename>\\ file that defines some hooks, you should thus understand that "
|
dongsheng@627
|
10464 "your users can disable or override those hooks."
|
dongsheng@627
|
10465 msgstr ""
|
dongsheng@627
|
10466
|
dongsheng@627
|
10467 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
10468 #: ../en/ch10-hook.xml:200
|
dongsheng@627
|
10469 msgid "Ensuring that critical hooks are run"
|
dongsheng@635
|
10470 msgstr "确保关键钩子的执行"
|
dongsheng@627
|
10471
|
dongsheng@627
|
10472 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10473 #: ../en/ch10-hook.xml:202
|
dongsheng@627
|
10474 msgid ""
|
dongsheng@627
|
10475 "Sometimes you may want to enforce a policy that you do not want others to be "
|
dongsheng@627
|
10476 "able to work around. For example, you may have a requirement that every "
|
dongsheng@627
|
10477 "changeset must pass a rigorous set of tests. Defining this requirement via a "
|
dongsheng@627
|
10478 "hook in a site-wide <filename role=\"special\"> /.hgrc</filename>\\ won't "
|
dongsheng@627
|
10479 "work for remote users on laptops, and of course local users can subvert it at "
|
dongsheng@627
|
10480 "will by overriding the hook."
|
dongsheng@627
|
10481 msgstr ""
|
dongsheng@627
|
10482
|
dongsheng@627
|
10483 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10484 #: ../en/ch10-hook.xml:211
|
dongsheng@627
|
10485 msgid ""
|
dongsheng@627
|
10486 "Instead, you can set up your policies for use of Mercurial so that people are "
|
dongsheng@627
|
10487 "expected to propagate changes through a well-known <quote>canonical</quote> "
|
dongsheng@627
|
10488 "server that you have locked down and configured appropriately."
|
dongsheng@627
|
10489 msgstr ""
|
dongsheng@627
|
10490
|
dongsheng@627
|
10491 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10492 #: ../en/ch10-hook.xml:217
|
dongsheng@627
|
10493 msgid ""
|
dongsheng@627
|
10494 "One way to do this is via a combination of social engineering and "
|
dongsheng@627
|
10495 "technology. Set up a restricted-access account; users can push changes over "
|
dongsheng@627
|
10496 "the network to repositories managed by this account, but they cannot log into "
|
dongsheng@627
|
10497 "the account and run normal shell commands. In this scenario, a user can "
|
dongsheng@627
|
10498 "commit a changeset that contains any old garbage they want."
|
dongsheng@627
|
10499 msgstr ""
|
dongsheng@627
|
10500
|
dongsheng@627
|
10501 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10502 #: ../en/ch10-hook.xml:226
|
dongsheng@627
|
10503 msgid ""
|
dongsheng@627
|
10504 "When someone pushes a changeset to the server that everyone pulls from, the "
|
dongsheng@627
|
10505 "server will test the changeset before it accepts it as permanent, and reject "
|
dongsheng@627
|
10506 "it if it fails to pass the test suite. If people only pull changes from this "
|
dongsheng@627
|
10507 "filtering server, it will serve to ensure that all changes that people pull "
|
dongsheng@627
|
10508 "have been automatically vetted."
|
dongsheng@627
|
10509 msgstr ""
|
dongsheng@627
|
10510
|
dongsheng@627
|
10511 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
10512 #: ../en/ch10-hook.xml:237
|
dongsheng@627
|
10513 msgid "Care with <literal>pretxn</literal> hooks in a shared-access repository"
|
dongsheng@635
|
10514 msgstr "在共享版本库中注意 <literal>pretxn</literal> 钩子"
|
dongsheng@627
|
10515
|
dongsheng@627
|
10516 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
10517 #: ../en/ch10-hook.xml:240
|
dongsheng@627
|
10518 msgid ""
|
dongsheng@627
|
10519 "If you want to use hooks to do some automated work in a repository that a "
|
dongsheng@627
|
10520 "number of people have shared access to, you need to be careful in how you do "
|
dongsheng@627
|
10521 "this."
|
dongsheng@627
|
10522 msgstr ""
|
dongsheng@627
|
10523
|
dongsheng@627
|
10524 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
10525 #: ../en/ch10-hook.xml:245
|
dongsheng@627
|
10526 msgid ""
|
dongsheng@627
|
10527 "Mercurial only locks a repository when it is writing to the repository, and "
|
dongsheng@627
|
10528 "only the parts of Mercurial that write to the repository pay attention to "
|
dongsheng@627
|
10529 "locks. Write locks are necessary to prevent multiple simultaneous writers "
|
dongsheng@627
|
10530 "from scribbling on each other's work, corrupting the repository."
|
dongsheng@627
|
10531 msgstr ""
|
dongsheng@627
|
10532
|
dongsheng@627
|
10533 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
10534 #: ../en/ch10-hook.xml:252
|
dongsheng@627
|
10535 msgid ""
|
dongsheng@627
|
10536 "Because Mercurial is careful with the order in which it reads and writes "
|
dongsheng@627
|
10537 "data, it does not need to acquire a lock when it wants to read data from the "
|
dongsheng@627
|
10538 "repository. The parts of Mercurial that read from the repository never pay "
|
dongsheng@627
|
10539 "attention to locks. This lockless reading scheme greatly increases "
|
dongsheng@627
|
10540 "performance and concurrency."
|
dongsheng@627
|
10541 msgstr ""
|
dongsheng@627
|
10542
|
dongsheng@627
|
10543 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
10544 #: ../en/ch10-hook.xml:260
|
dongsheng@627
|
10545 msgid ""
|
dongsheng@627
|
10546 "With great performance comes a trade-off, though, one which has the potential "
|
dongsheng@627
|
10547 "to cause you trouble unless you're aware of it. To describe this requires a "
|
dongsheng@627
|
10548 "little detail about how Mercurial adds changesets to a repository and reads "
|
dongsheng@627
|
10549 "those changes."
|
dongsheng@627
|
10550 msgstr ""
|
dongsheng@627
|
10551
|
dongsheng@627
|
10552 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
10553 #: ../en/ch10-hook.xml:267
|
dongsheng@627
|
10554 msgid ""
|
dongsheng@627
|
10555 "When Mercurial <emphasis>writes</emphasis> metadata, it writes it straight "
|
dongsheng@627
|
10556 "into the destination file. It writes file data first, then manifest data "
|
dongsheng@627
|
10557 "(which contains pointers to the new file data), then changelog data (which "
|
dongsheng@627
|
10558 "contains pointers to the new manifest data). Before the first write to each "
|
dongsheng@627
|
10559 "file, it stores a record of where the end of the file was in its transaction "
|
dongsheng@627
|
10560 "log. If the transaction must be rolled back, Mercurial simply truncates each "
|
dongsheng@627
|
10561 "file back to the size it was before the transaction began."
|
dongsheng@627
|
10562 msgstr ""
|
dongsheng@627
|
10563
|
dongsheng@627
|
10564 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
10565 #: ../en/ch10-hook.xml:278
|
dongsheng@627
|
10566 msgid ""
|
dongsheng@627
|
10567 "When Mercurial <emphasis>reads</emphasis> metadata, it reads the changelog "
|
dongsheng@627
|
10568 "first, then everything else. Since a reader will only access parts of the "
|
dongsheng@627
|
10569 "manifest or file metadata that it can see in the changelog, it can never see "
|
dongsheng@627
|
10570 "partially written data."
|
dongsheng@627
|
10571 msgstr ""
|
dongsheng@627
|
10572
|
dongsheng@627
|
10573 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
10574 #: ../en/ch10-hook.xml:284
|
dongsheng@627
|
10575 msgid ""
|
dongsheng@627
|
10576 "Some controlling hooks (<literal role=\"hook\">pretxncommit</literal> and "
|
dongsheng@627
|
10577 "<literal role=\"hook\">pretxnchangegroup</literal>) run when a transaction is "
|
dongsheng@627
|
10578 "almost complete. All of the metadata has been written, but Mercurial can "
|
dongsheng@627
|
10579 "still roll the transaction back and cause the newly-written data to disappear."
|
dongsheng@627
|
10580 msgstr ""
|
dongsheng@627
|
10581
|
dongsheng@627
|
10582 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
10583 #: ../en/ch10-hook.xml:292
|
dongsheng@627
|
10584 msgid ""
|
dongsheng@627
|
10585 "If one of these hooks runs for long, it opens a window of time during which a "
|
dongsheng@627
|
10586 "reader can see the metadata for changesets that are not yet permanent, and "
|
dongsheng@627
|
10587 "should not be thought of as <quote>really there</quote>. The longer the hook "
|
dongsheng@627
|
10588 "runs, the longer that window is open."
|
dongsheng@627
|
10589 msgstr ""
|
dongsheng@627
|
10590
|
dongsheng@627
|
10591 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
10592 #: ../en/ch10-hook.xml:300
|
dongsheng@627
|
10593 msgid "The problem illustrated"
|
dongsheng@635
|
10594 msgstr "问题的演示"
|
dongsheng@627
|
10595
|
dongsheng@627
|
10596 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10597 #: ../en/ch10-hook.xml:302
|
dongsheng@627
|
10598 msgid ""
|
dongsheng@627
|
10599 "In principle, a good use for the <literal role=\"hook\">pretxnchangegroup</"
|
dongsheng@627
|
10600 "literal> hook would be to automatically build and test incoming changes "
|
dongsheng@627
|
10601 "before they are accepted into a central repository. This could let you "
|
dongsheng@627
|
10602 "guarantee that nobody can push changes to this repository that <quote>break "
|
dongsheng@627
|
10603 "the build</quote>. But if a client can pull changes while they're being "
|
dongsheng@627
|
10604 "tested, the usefulness of the test is zero; an unsuspecting someone can pull "
|
dongsheng@627
|
10605 "untested changes, potentially breaking their build."
|
dongsheng@627
|
10606 msgstr ""
|
dongsheng@627
|
10607
|
dongsheng@627
|
10608 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10609 #: ../en/ch10-hook.xml:313
|
dongsheng@627
|
10610 msgid ""
|
dongsheng@627
|
10611 "The safest technological answer to this challenge is to set up such a "
|
dongsheng@627
|
10612 "<quote>gatekeeper</quote> repository as <emphasis>unidirectional</emphasis>. "
|
dongsheng@627
|
10613 "Let it take changes pushed in from the outside, but do not allow anyone to "
|
dongsheng@627
|
10614 "pull changes from it (use the <literal role=\"hook\">preoutgoing</literal> "
|
dongsheng@627
|
10615 "hook to lock it down). Configure a <literal role=\"hook\">changegroup</"
|
dongsheng@627
|
10616 "literal> hook so that if a build or test succeeds, the hook will push the new "
|
dongsheng@627
|
10617 "changes out to another repository that people <emphasis>can</emphasis> pull "
|
dongsheng@627
|
10618 "from."
|
dongsheng@627
|
10619 msgstr ""
|
dongsheng@627
|
10620
|
dongsheng@627
|
10621 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10622 #: ../en/ch10-hook.xml:325
|
dongsheng@627
|
10623 msgid ""
|
dongsheng@627
|
10624 "In practice, putting a centralised bottleneck like this in place is not often "
|
dongsheng@627
|
10625 "a good idea, and transaction visibility has nothing to do with the problem. "
|
dongsheng@627
|
10626 "As the size of a project&emdash;and the time it takes to build and "
|
dongsheng@627
|
10627 "test&emdash;grows, you rapidly run into a wall with this <quote>try before "
|
dongsheng@627
|
10628 "you buy</quote> approach, where you have more changesets to test than time in "
|
dongsheng@627
|
10629 "which to deal with them. The inevitable result is frustration on the part of "
|
dongsheng@627
|
10630 "all involved."
|
dongsheng@627
|
10631 msgstr ""
|
dongsheng@627
|
10632
|
dongsheng@627
|
10633 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10634 #: ../en/ch10-hook.xml:336
|
dongsheng@627
|
10635 msgid ""
|
dongsheng@627
|
10636 "An approach that scales better is to get people to build and test before they "
|
dongsheng@627
|
10637 "push, then run automated builds and tests centrally <emphasis>after</"
|
dongsheng@627
|
10638 "emphasis> a push, to be sure all is well. The advantage of this approach is "
|
dongsheng@627
|
10639 "that it does not impose a limit on the rate at which the repository can "
|
dongsheng@627
|
10640 "accept changes."
|
dongsheng@627
|
10641 msgstr ""
|
dongsheng@627
|
10642
|
dongsheng@627
|
10643 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
10644 #: ../en/ch10-hook.xml:347
|
dongsheng@627
|
10645 msgid "A short tutorial on using hooks"
|
dongsheng@635
|
10646 msgstr "使用钩子的简短指南"
|
dongsheng@627
|
10647
|
dongsheng@627
|
10648 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
10649 #: ../en/ch10-hook.xml:349
|
dongsheng@627
|
10650 msgid ""
|
dongsheng@627
|
10651 "It is easy to write a Mercurial hook. Let's start with a hook that runs when "
|
dongsheng@627
|
10652 "you finish a <command role=\"hg-cmd\">hg commit</command>, and simply prints "
|
dongsheng@627
|
10653 "the hash of the changeset you just created. The hook is called <literal role="
|
dongsheng@627
|
10654 "\"hook\">commit</literal>."
|
dongsheng@627
|
10655 msgstr ""
|
dongsheng@627
|
10656
|
dongsheng@627
|
10657 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
10658 #: ../en/ch10-hook.xml:356
|
dongsheng@627
|
10659 msgid "All hooks follow the pattern in this example."
|
dongsheng@627
|
10660 msgstr ""
|
dongsheng@627
|
10661
|
dongsheng@627
|
10662 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
10663 #: ../en/ch10-hook.xml:360
|
dongsheng@627
|
10664 msgid ""
|
dongsheng@627
|
10665 "You add an entry to the <literal role=\"rc-hooks\">hooks</literal> section of "
|
dongsheng@627
|
10666 "your <filename role=\"special\"> /.hgrc</filename>. On the left is the name "
|
dongsheng@627
|
10667 "of the event to trigger on; on the right is the action to take. As you can "
|
dongsheng@627
|
10668 "see, you can run an arbitrary shell command in a hook. Mercurial passes "
|
dongsheng@627
|
10669 "extra information to the hook using environment variables (look for "
|
dongsheng@627
|
10670 "<envar>HG_NODE</envar> in the example)."
|
dongsheng@627
|
10671 msgstr ""
|
dongsheng@627
|
10672
|
dongsheng@627
|
10673 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
10674 #: ../en/ch10-hook.xml:370
|
dongsheng@627
|
10675 msgid "Performing multiple actions per event"
|
dongsheng@635
|
10676 msgstr "每个事件执行多个操作"
|
dongsheng@627
|
10677
|
dongsheng@627
|
10678 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10679 #: ../en/ch10-hook.xml:372
|
dongsheng@627
|
10680 msgid ""
|
dongsheng@627
|
10681 "Quite often, you will want to define more than one hook for a particular kind "
|
dongsheng@627
|
10682 "of event, as shown below."
|
dongsheng@627
|
10683 msgstr ""
|
dongsheng@627
|
10684
|
dongsheng@627
|
10685 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10686 #: ../en/ch10-hook.xml:377
|
dongsheng@627
|
10687 msgid ""
|
dongsheng@627
|
10688 "Mercurial lets you do this by adding an <emphasis>extension</emphasis> to the "
|
dongsheng@627
|
10689 "end of a hook's name. You extend a hook's name by giving the name of the "
|
dongsheng@627
|
10690 "hook, followed by a full stop (the <quote><literal>.</literal></quote> "
|
dongsheng@627
|
10691 "character), followed by some more text of your choosing. For example, "
|
dongsheng@627
|
10692 "Mercurial will run both <literal>commit.foo</literal> and <literal>commit."
|
dongsheng@627
|
10693 "bar</literal> when the <literal>commit</literal> event occurs."
|
dongsheng@627
|
10694 msgstr ""
|
dongsheng@627
|
10695
|
dongsheng@627
|
10696 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10697 #: ../en/ch10-hook.xml:388
|
dongsheng@627
|
10698 msgid ""
|
dongsheng@627
|
10699 "To give a well-defined order of execution when there are multiple hooks "
|
dongsheng@627
|
10700 "defined for an event, Mercurial sorts hooks by extension, and executes the "
|
dongsheng@627
|
10701 "hook commands in this sorted order. In the above example, it will execute "
|
dongsheng@627
|
10702 "<literal>commit.bar</literal> before <literal>commit.foo</literal>, and "
|
dongsheng@627
|
10703 "<literal>commit</literal> before both."
|
dongsheng@627
|
10704 msgstr ""
|
dongsheng@627
|
10705
|
dongsheng@627
|
10706 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10707 #: ../en/ch10-hook.xml:397
|
dongsheng@627
|
10708 msgid ""
|
dongsheng@627
|
10709 "It is a good idea to use a somewhat descriptive extension when you define a "
|
dongsheng@627
|
10710 "new hook. This will help you to remember what the hook was for. If the hook "
|
dongsheng@627
|
10711 "fails, you'll get an error message that contains the hook name and extension, "
|
dongsheng@627
|
10712 "so using a descriptive extension could give you an immediate hint as to why "
|
dongsheng@627
|
10713 "the hook failed (see section <xref linkend=\"sec.hook.perm\"/> for an "
|
dongsheng@627
|
10714 "example)."
|
dongsheng@627
|
10715 msgstr ""
|
dongsheng@627
|
10716
|
dongsheng@627
|
10717 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
10718 #: ../en/ch10-hook.xml:408
|
dongsheng@627
|
10719 msgid "Controlling whether an activity can proceed"
|
dongsheng@635
|
10720 msgstr "控制处理的活动"
|
dongsheng@627
|
10721
|
dongsheng@627
|
10722 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10723 #: ../en/ch10-hook.xml:410
|
dongsheng@627
|
10724 msgid ""
|
dongsheng@627
|
10725 "In our earlier examples, we used the <literal role=\"hook\">commit</literal> "
|
dongsheng@627
|
10726 "hook, which is run after a commit has completed. This is one of several "
|
dongsheng@627
|
10727 "Mercurial hooks that run after an activity finishes. Such hooks have no way "
|
dongsheng@627
|
10728 "of influencing the activity itself."
|
dongsheng@627
|
10729 msgstr ""
|
dongsheng@627
|
10730
|
dongsheng@627
|
10731 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10732 #: ../en/ch10-hook.xml:417
|
dongsheng@627
|
10733 msgid ""
|
dongsheng@627
|
10734 "Mercurial defines a number of events that occur before an activity starts; or "
|
dongsheng@627
|
10735 "after it starts, but before it finishes. Hooks that trigger on these events "
|
dongsheng@627
|
10736 "have the added ability to choose whether the activity can continue, or will "
|
dongsheng@627
|
10737 "abort."
|
dongsheng@627
|
10738 msgstr ""
|
dongsheng@627
|
10739
|
dongsheng@627
|
10740 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10741 #: ../en/ch10-hook.xml:423
|
dongsheng@627
|
10742 msgid ""
|
dongsheng@627
|
10743 "The <literal role=\"hook\">pretxncommit</literal> hook runs after a commit "
|
dongsheng@627
|
10744 "has all but completed. In other words, the metadata representing the "
|
dongsheng@627
|
10745 "changeset has been written out to disk, but the transaction has not yet been "
|
dongsheng@627
|
10746 "allowed to complete. The <literal role=\"hook\">pretxncommit</literal> hook "
|
dongsheng@627
|
10747 "has the ability to decide whether the transaction can complete, or must be "
|
dongsheng@627
|
10748 "rolled back."
|
dongsheng@627
|
10749 msgstr ""
|
dongsheng@627
|
10750
|
dongsheng@627
|
10751 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10752 #: ../en/ch10-hook.xml:432
|
dongsheng@627
|
10753 msgid ""
|
dongsheng@627
|
10754 "If the <literal role=\"hook\">pretxncommit</literal> hook exits with a status "
|
dongsheng@627
|
10755 "code of zero, the transaction is allowed to complete; the commit finishes; "
|
dongsheng@627
|
10756 "and the <literal role=\"hook\">commit</literal> hook is run. If the <literal "
|
dongsheng@627
|
10757 "role=\"hook\">pretxncommit</literal> hook exits with a non-zero status code, "
|
dongsheng@627
|
10758 "the transaction is rolled back; the metadata representing the changeset is "
|
dongsheng@627
|
10759 "erased; and the <literal role=\"hook\">commit</literal> hook is not run."
|
dongsheng@627
|
10760 msgstr ""
|
dongsheng@627
|
10761
|
dongsheng@627
|
10762 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10763 #: ../en/ch10-hook.xml:444
|
dongsheng@627
|
10764 msgid ""
|
dongsheng@627
|
10765 "The hook in the example above checks that a commit comment contains a bug "
|
dongsheng@627
|
10766 "ID. If it does, the commit can complete. If not, the commit is rolled back."
|
dongsheng@627
|
10767 msgstr ""
|
dongsheng@627
|
10768
|
dongsheng@627
|
10769 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
10770 #: ../en/ch10-hook.xml:452
|
dongsheng@627
|
10771 msgid "Writing your own hooks"
|
dongsheng@635
|
10772 msgstr "编写钩子"
|
dongsheng@627
|
10773
|
dongsheng@627
|
10774 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
10775 #: ../en/ch10-hook.xml:454
|
dongsheng@627
|
10776 msgid ""
|
dongsheng@627
|
10777 "When you are writing a hook, you might find it useful to run Mercurial either "
|
dongsheng@627
|
10778 "with the <option role=\"hg-opt-global\">-v</option> option, or the <envar "
|
dongsheng@627
|
10779 "role=\"rc-item-ui\">verbose</envar> config item set to <quote>true</quote>. "
|
dongsheng@627
|
10780 "When you do so, Mercurial will print a message before it calls each hook."
|
dongsheng@627
|
10781 msgstr ""
|
dongsheng@627
|
10782
|
dongsheng@627
|
10783 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
10784 #: ../en/ch10-hook.xml:463
|
dongsheng@627
|
10785 msgid "Choosing how your hook should run"
|
dongsheng@635
|
10786 msgstr "选择钩子的执行方式"
|
dongsheng@627
|
10787
|
dongsheng@627
|
10788 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10789 #: ../en/ch10-hook.xml:465
|
dongsheng@627
|
10790 msgid ""
|
dongsheng@627
|
10791 "You can write a hook either as a normal program&emdash;typically a shell "
|
dongsheng@627
|
10792 "script&emdash;or as a Python function that is executed within the Mercurial "
|
dongsheng@627
|
10793 "process."
|
dongsheng@627
|
10794 msgstr ""
|
dongsheng@627
|
10795
|
dongsheng@627
|
10796 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10797 #: ../en/ch10-hook.xml:470
|
dongsheng@627
|
10798 msgid ""
|
dongsheng@627
|
10799 "Writing a hook as an external program has the advantage that it requires no "
|
dongsheng@627
|
10800 "knowledge of Mercurial's internals. You can call normal Mercurial commands "
|
dongsheng@627
|
10801 "to get any added information you need. The trade-off is that external hooks "
|
dongsheng@627
|
10802 "are slower than in-process hooks."
|
dongsheng@627
|
10803 msgstr ""
|
dongsheng@627
|
10804
|
dongsheng@627
|
10805 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10806 #: ../en/ch10-hook.xml:477
|
dongsheng@627
|
10807 msgid ""
|
dongsheng@627
|
10808 "An in-process Python hook has complete access to the Mercurial API, and does "
|
dongsheng@627
|
10809 "not <quote>shell out</quote> to another process, so it is inherently faster "
|
dongsheng@627
|
10810 "than an external hook. It is also easier to obtain much of the information "
|
dongsheng@627
|
10811 "that a hook requires by using the Mercurial API than by running Mercurial "
|
dongsheng@627
|
10812 "commands."
|
dongsheng@627
|
10813 msgstr ""
|
dongsheng@627
|
10814
|
dongsheng@627
|
10815 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10816 #: ../en/ch10-hook.xml:485
|
dongsheng@627
|
10817 msgid ""
|
dongsheng@627
|
10818 "If you are comfortable with Python, or require high performance, writing your "
|
dongsheng@627
|
10819 "hooks in Python may be a good choice. However, when you have a "
|
dongsheng@627
|
10820 "straightforward hook to write and you don't need to care about performance "
|
dongsheng@627
|
10821 "(probably the majority of hooks), a shell script is perfectly fine."
|
dongsheng@627
|
10822 msgstr ""
|
dongsheng@627
|
10823
|
dongsheng@627
|
10824 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
10825 #: ../en/ch10-hook.xml:494
|
dongsheng@627
|
10826 msgid "Hook parameters"
|
dongsheng@635
|
10827 msgstr "钩子的参数"
|
dongsheng@627
|
10828
|
dongsheng@627
|
10829 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10830 #: ../en/ch10-hook.xml:496
|
dongsheng@627
|
10831 msgid ""
|
dongsheng@627
|
10832 "Mercurial calls each hook with a set of well-defined parameters. In Python, "
|
dongsheng@627
|
10833 "a parameter is passed as a keyword argument to your hook function. For an "
|
dongsheng@627
|
10834 "external program, a parameter is passed as an environment variable."
|
dongsheng@627
|
10835 msgstr ""
|
dongsheng@627
|
10836
|
dongsheng@627
|
10837 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10838 #: ../en/ch10-hook.xml:502
|
dongsheng@627
|
10839 msgid ""
|
dongsheng@627
|
10840 "Whether your hook is written in Python or as a shell script, the hook-"
|
dongsheng@627
|
10841 "specific parameter names and values will be the same. A boolean parameter "
|
dongsheng@627
|
10842 "will be represented as a boolean value in Python, but as the number 1 (for "
|
dongsheng@627
|
10843 "<quote>true</quote>) or 0 (for <quote>false</quote>) as an environment "
|
dongsheng@627
|
10844 "variable for an external hook. If a hook parameter is named <literal>foo</"
|
dongsheng@627
|
10845 "literal>, the keyword argument for a Python hook will also be named "
|
dongsheng@627
|
10846 "<literal>foo</literal>, while the environment variable for an external hook "
|
dongsheng@627
|
10847 "will be named <literal>HG_FOO</literal>."
|
dongsheng@627
|
10848 msgstr ""
|
dongsheng@627
|
10849
|
dongsheng@627
|
10850 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
10851 #: ../en/ch10-hook.xml:516
|
dongsheng@627
|
10852 msgid "Hook return values and activity control"
|
dongsheng@635
|
10853 msgstr "钩子的返回值与活动控制"
|
dongsheng@627
|
10854
|
dongsheng@627
|
10855 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10856 #: ../en/ch10-hook.xml:518
|
dongsheng@627
|
10857 msgid ""
|
dongsheng@627
|
10858 "A hook that executes successfully must exit with a status of zero if "
|
dongsheng@627
|
10859 "external, or return boolean <quote>false</quote> if in-process. Failure is "
|
dongsheng@627
|
10860 "indicated with a non-zero exit status from an external hook, or an in-process "
|
dongsheng@627
|
10861 "hook returning boolean <quote>true</quote>. If an in-process hook raises an "
|
dongsheng@627
|
10862 "exception, the hook is considered to have failed."
|
dongsheng@627
|
10863 msgstr ""
|
dongsheng@627
|
10864
|
dongsheng@627
|
10865 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10866 #: ../en/ch10-hook.xml:526
|
dongsheng@627
|
10867 msgid ""
|
dongsheng@627
|
10868 "For a hook that controls whether an activity can proceed, zero/false means "
|
dongsheng@627
|
10869 "<quote>allow</quote>, while non-zero/true/exception means <quote>deny</quote>."
|
dongsheng@627
|
10870 msgstr ""
|
dongsheng@627
|
10871
|
dongsheng@627
|
10872 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
10873 #: ../en/ch10-hook.xml:533
|
dongsheng@627
|
10874 msgid "Writing an external hook"
|
dongsheng@635
|
10875 msgstr "编写外部钩子"
|
dongsheng@627
|
10876
|
dongsheng@627
|
10877 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10878 #: ../en/ch10-hook.xml:535
|
dongsheng@627
|
10879 msgid ""
|
dongsheng@627
|
10880 "When you define an external hook in your <filename role=\"special\"> /.hgrc</"
|
dongsheng@627
|
10881 "filename>\\ and the hook is run, its value is passed to your shell, which "
|
dongsheng@627
|
10882 "interprets it. This means that you can use normal shell constructs in the "
|
dongsheng@627
|
10883 "body of the hook."
|
dongsheng@627
|
10884 msgstr ""
|
dongsheng@627
|
10885
|
dongsheng@627
|
10886 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10887 #: ../en/ch10-hook.xml:542
|
dongsheng@627
|
10888 msgid ""
|
dongsheng@627
|
10889 "An executable hook is always run with its current directory set to a "
|
dongsheng@627
|
10890 "repository's root directory."
|
dongsheng@627
|
10891 msgstr ""
|
dongsheng@627
|
10892
|
dongsheng@627
|
10893 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10894 #: ../en/ch10-hook.xml:546
|
dongsheng@627
|
10895 msgid ""
|
dongsheng@627
|
10896 "Each hook parameter is passed in as an environment variable; the name is "
|
dongsheng@627
|
10897 "upper-cased, and prefixed with the string <quote><literal>HG_</literal></"
|
dongsheng@627
|
10898 "quote>."
|
dongsheng@627
|
10899 msgstr ""
|
dongsheng@627
|
10900
|
dongsheng@627
|
10901 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10902 #: ../en/ch10-hook.xml:551
|
dongsheng@627
|
10903 msgid ""
|
dongsheng@627
|
10904 "With the exception of hook parameters, Mercurial does not set or modify any "
|
dongsheng@627
|
10905 "environment variables when running a hook. This is useful to remember if you "
|
dongsheng@627
|
10906 "are writing a site-wide hook that may be run by a number of different users "
|
dongsheng@627
|
10907 "with differing environment variables set. In multi-user situations, you "
|
dongsheng@627
|
10908 "should not rely on environment variables being set to the values you have in "
|
dongsheng@627
|
10909 "your environment when testing the hook."
|
dongsheng@627
|
10910 msgstr ""
|
dongsheng@627
|
10911
|
dongsheng@627
|
10912 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
10913 #: ../en/ch10-hook.xml:562
|
dongsheng@627
|
10914 msgid "Telling Mercurial to use an in-process hook"
|
dongsheng@635
|
10915 msgstr "让 MercurialMercurial 使用进程内钩子"
|
dongsheng@627
|
10916
|
dongsheng@627
|
10917 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10918 #: ../en/ch10-hook.xml:564
|
dongsheng@627
|
10919 msgid ""
|
dongsheng@627
|
10920 "The <filename role=\"special\"> /.hgrc</filename>\\ syntax for defining an in-"
|
dongsheng@627
|
10921 "process hook is slightly different than for an executable hook. The value of "
|
dongsheng@627
|
10922 "the hook must start with the text <quote><literal>python:</literal></quote>, "
|
dongsheng@627
|
10923 "and continue with the fully-qualified name of a callable object to use as the "
|
dongsheng@627
|
10924 "hook's value."
|
dongsheng@627
|
10925 msgstr ""
|
dongsheng@627
|
10926
|
dongsheng@627
|
10927 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10928 #: ../en/ch10-hook.xml:572
|
dongsheng@627
|
10929 msgid ""
|
dongsheng@627
|
10930 "The module in which a hook lives is automatically imported when a hook is "
|
dongsheng@627
|
10931 "run. So long as you have the module name and <envar>PYTHONPATH</envar> "
|
dongsheng@627
|
10932 "right, it should <quote>just work</quote>."
|
dongsheng@627
|
10933 msgstr ""
|
dongsheng@627
|
10934
|
dongsheng@627
|
10935 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10936 #: ../en/ch10-hook.xml:578
|
dongsheng@627
|
10937 msgid ""
|
dongsheng@627
|
10938 "The following <filename role=\"special\"> /.hgrc</filename>\\ example snippet "
|
dongsheng@627
|
10939 "illustrates the syntax and meaning of the notions we just described."
|
dongsheng@627
|
10940 msgstr ""
|
dongsheng@627
|
10941
|
dongsheng@627
|
10942 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10943 #: ../en/ch10-hook.xml:584
|
dongsheng@627
|
10944 msgid ""
|
dongsheng@627
|
10945 "When Mercurial runs the <literal>commit.example</literal> hook, it imports "
|
dongsheng@627
|
10946 "<literal>mymodule.submodule</literal>, looks for the callable object named "
|
dongsheng@627
|
10947 "<literal>myhook</literal>, and calls it."
|
dongsheng@627
|
10948 msgstr ""
|
dongsheng@627
|
10949
|
dongsheng@627
|
10950 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
10951 #: ../en/ch10-hook.xml:592
|
dongsheng@627
|
10952 msgid "Writing an in-process hook"
|
dongsheng@635
|
10953 msgstr "编写进程内钩子"
|
dongsheng@627
|
10954
|
dongsheng@627
|
10955 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10956 #: ../en/ch10-hook.xml:594
|
dongsheng@627
|
10957 msgid ""
|
dongsheng@627
|
10958 "The simplest in-process hook does nothing, but illustrates the basic shape of "
|
dongsheng@627
|
10959 "the hook API:"
|
dongsheng@627
|
10960 msgstr ""
|
dongsheng@627
|
10961
|
dongsheng@627
|
10962 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10963 #: ../en/ch10-hook.xml:599
|
dongsheng@627
|
10964 msgid ""
|
dongsheng@627
|
10965 "The first argument to a Python hook is always a <literal role=\"py-mod-"
|
dongsheng@627
|
10966 "mercurial.ui\">ui</literal> object. The second is a repository object; at "
|
dongsheng@627
|
10967 "the moment, it is always an instance of <literal role=\"py-mod-mercurial."
|
dongsheng@627
|
10968 "localrepo\">localrepository</literal>. Following these two arguments are "
|
dongsheng@627
|
10969 "other keyword arguments. Which ones are passed in depends on the hook being "
|
dongsheng@627
|
10970 "called, but a hook can ignore arguments it doesn't care about by dropping "
|
dongsheng@627
|
10971 "them into a keyword argument dict, as with <literal>**kwargs</literal> above."
|
dongsheng@627
|
10972 msgstr ""
|
dongsheng@627
|
10973
|
dongsheng@627
|
10974 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
10975 #: ../en/ch10-hook.xml:614
|
dongsheng@627
|
10976 msgid "Some hook examples"
|
dongsheng@635
|
10977 msgstr "钩子样例"
|
dongsheng@627
|
10978
|
dongsheng@627
|
10979 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
10980 #: ../en/ch10-hook.xml:617
|
dongsheng@627
|
10981 msgid "Writing meaningful commit messages"
|
dongsheng@635
|
10982 msgstr "编写有意义的提交日志"
|
dongsheng@627
|
10983
|
dongsheng@627
|
10984 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10985 #: ../en/ch10-hook.xml:619
|
dongsheng@627
|
10986 msgid ""
|
dongsheng@627
|
10987 "It's hard to imagine a useful commit message being very short. The simple "
|
dongsheng@627
|
10988 "<literal role=\"hook\">pretxncommit</literal> hook of the example below will "
|
dongsheng@627
|
10989 "prevent you from committing a changeset with a message that is less than ten "
|
dongsheng@627
|
10990 "bytes long."
|
dongsheng@627
|
10991 msgstr ""
|
dongsheng@627
|
10992
|
dongsheng@627
|
10993 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
10994 #: ../en/ch10-hook.xml:629
|
dongsheng@627
|
10995 msgid "Checking for trailing whitespace"
|
dongsheng@635
|
10996 msgstr "检查行尾空格"
|
dongsheng@627
|
10997
|
dongsheng@627
|
10998 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
10999 #: ../en/ch10-hook.xml:631
|
dongsheng@627
|
11000 msgid ""
|
dongsheng@627
|
11001 "An interesting use of a commit-related hook is to help you to write cleaner "
|
dongsheng@627
|
11002 "code. A simple example of <quote>cleaner code</quote> is the dictum that a "
|
dongsheng@627
|
11003 "change should not add any new lines of text that contain <quote>trailing "
|
dongsheng@627
|
11004 "whitespace</quote>. Trailing whitespace is a series of space and tab "
|
dongsheng@627
|
11005 "characters at the end of a line of text. In most cases, trailing whitespace "
|
dongsheng@627
|
11006 "is unnecessary, invisible noise, but it is occasionally problematic, and "
|
dongsheng@627
|
11007 "people often prefer to get rid of it."
|
dongsheng@627
|
11008 msgstr ""
|
dongsheng@627
|
11009
|
dongsheng@627
|
11010 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11011 #: ../en/ch10-hook.xml:642
|
dongsheng@627
|
11012 msgid ""
|
dongsheng@627
|
11013 "You can use either the <literal role=\"hook\">precommit</literal> or <literal "
|
dongsheng@627
|
11014 "role=\"hook\">pretxncommit</literal> hook to tell whether you have a trailing "
|
dongsheng@627
|
11015 "whitespace problem. If you use the <literal role=\"hook\">precommit</"
|
dongsheng@627
|
11016 "literal> hook, the hook will not know which files you are committing, so it "
|
dongsheng@627
|
11017 "will have to check every modified file in the repository for trailing white "
|
dongsheng@627
|
11018 "space. If you want to commit a change to just the file <filename>foo</"
|
dongsheng@627
|
11019 "filename>, but the file <filename>bar</filename> contains trailing "
|
dongsheng@627
|
11020 "whitespace, doing a check in the <literal role=\"hook\">precommit</literal> "
|
dongsheng@627
|
11021 "hook will prevent you from committing <filename>foo</filename> due to the "
|
dongsheng@627
|
11022 "problem with <filename>bar</filename>. This doesn't seem right."
|
dongsheng@627
|
11023 msgstr ""
|
dongsheng@627
|
11024
|
dongsheng@627
|
11025 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11026 #: ../en/ch10-hook.xml:658
|
dongsheng@627
|
11027 msgid ""
|
dongsheng@627
|
11028 "Should you choose the <literal role=\"hook\">pretxncommit</literal> hook, the "
|
dongsheng@627
|
11029 "check won't occur until just before the transaction for the commit "
|
dongsheng@627
|
11030 "completes. This will allow you to check for problems only the exact files "
|
dongsheng@627
|
11031 "that are being committed. However, if you entered the commit message "
|
dongsheng@627
|
11032 "interactively and the hook fails, the transaction will roll back; you'll have "
|
dongsheng@627
|
11033 "to re-enter the commit message after you fix the trailing whitespace and run "
|
dongsheng@627
|
11034 "<command role=\"hg-cmd\">hg commit</command> again."
|
dongsheng@627
|
11035 msgstr ""
|
dongsheng@627
|
11036
|
dongsheng@627
|
11037 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11038 #: ../en/ch10-hook.xml:671
|
dongsheng@627
|
11039 msgid ""
|
dongsheng@627
|
11040 "In this example, we introduce a simple <literal role=\"hook\">pretxncommit</"
|
dongsheng@627
|
11041 "literal> hook that checks for trailing whitespace. This hook is short, but "
|
dongsheng@627
|
11042 "not very helpful. It exits with an error status if a change adds a line with "
|
dongsheng@627
|
11043 "trailing whitespace to any file, but does not print any information that "
|
dongsheng@627
|
11044 "might help us to identify the offending file or line. It also has the nice "
|
dongsheng@627
|
11045 "property of not paying attention to unmodified lines; only lines that "
|
dongsheng@627
|
11046 "introduce new trailing whitespace cause problems."
|
dongsheng@627
|
11047 msgstr ""
|
dongsheng@627
|
11048
|
dongsheng@627
|
11049 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11050 #: ../en/ch10-hook.xml:682
|
dongsheng@627
|
11051 msgid ""
|
dongsheng@627
|
11052 "The above version is much more complex, but also more useful. It parses a "
|
dongsheng@627
|
11053 "unified diff to see if any lines add trailing whitespace, and prints the name "
|
dongsheng@627
|
11054 "of the file and the line number of each such occurrence. Even better, if the "
|
dongsheng@627
|
11055 "change adds trailing whitespace, this hook saves the commit comment and "
|
dongsheng@627
|
11056 "prints the name of the save file before exiting and telling Mercurial to roll "
|
dongsheng@627
|
11057 "the transaction back, so you can use the <option role=\"hg-opt-commit\">-l "
|
dongsheng@627
|
11058 "filename</option> option to <command role=\"hg-cmd\">hg commit</command> to "
|
dongsheng@627
|
11059 "reuse the saved commit message once you've corrected the problem."
|
dongsheng@627
|
11060 msgstr ""
|
dongsheng@627
|
11061
|
dongsheng@627
|
11062 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11063 #: ../en/ch10-hook.xml:696
|
dongsheng@627
|
11064 msgid ""
|
dongsheng@627
|
11065 "As a final aside, note in the example above the use of <command>perl</"
|
dongsheng@627
|
11066 "command>'s in-place editing feature to get rid of trailing whitespace from a "
|
dongsheng@627
|
11067 "file. This is concise and useful enough that I will reproduce it here."
|
dongsheng@627
|
11068 msgstr ""
|
dongsheng@627
|
11069
|
dongsheng@627
|
11070 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
11071 #: ../en/ch10-hook.xml:706
|
dongsheng@627
|
11072 msgid "Bundled hooks"
|
dongsheng@635
|
11073 msgstr "内置的钩子"
|
dongsheng@627
|
11074
|
dongsheng@627
|
11075 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
11076 #: ../en/ch10-hook.xml:708
|
dongsheng@627
|
11077 msgid ""
|
dongsheng@627
|
11078 "Mercurial ships with several bundled hooks. You can find them in the "
|
dongsheng@627
|
11079 "<filename class=\"directory\">hgext</filename> directory of a Mercurial "
|
dongsheng@627
|
11080 "source tree. If you are using a Mercurial binary package, the hooks will be "
|
dongsheng@627
|
11081 "located in the <filename class=\"directory\">hgext</filename> directory of "
|
dongsheng@627
|
11082 "wherever your package installer put Mercurial."
|
dongsheng@627
|
11083 msgstr ""
|
dongsheng@627
|
11084
|
dongsheng@627
|
11085 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
11086 #: ../en/ch10-hook.xml:717
|
dongsheng@627
|
11087 msgid ""
|
dongsheng@627
|
11088 "<literal role=\"hg-ext\">acl</literal>&emdash;access control for parts of a "
|
dongsheng@627
|
11089 "repository"
|
dongsheng@635
|
11090 msgstr "<literal role=\"hg-ext\">acl</literal>&emdash;版本库的访问控制"
|
dongsheng@627
|
11091
|
dongsheng@627
|
11092 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11093 #: ../en/ch10-hook.xml:720
|
dongsheng@627
|
11094 msgid ""
|
dongsheng@627
|
11095 "The <literal role=\"hg-ext\">acl</literal> extension lets you control which "
|
dongsheng@627
|
11096 "remote users are allowed to push changesets to a networked server. You can "
|
dongsheng@627
|
11097 "protect any portion of a repository (including the entire repo), so that a "
|
dongsheng@627
|
11098 "specific remote user can push changes that do not affect the protected "
|
dongsheng@627
|
11099 "portion."
|
dongsheng@627
|
11100 msgstr ""
|
dongsheng@627
|
11101
|
dongsheng@627
|
11102 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11103 #: ../en/ch10-hook.xml:728
|
dongsheng@627
|
11104 msgid ""
|
dongsheng@627
|
11105 "This extension implements access control based on the identity of the user "
|
dongsheng@627
|
11106 "performing a push, <emphasis>not</emphasis> on who committed the changesets "
|
dongsheng@627
|
11107 "they're pushing. It makes sense to use this hook only if you have a locked-"
|
dongsheng@627
|
11108 "down server environment that authenticates remote users, and you want to be "
|
dongsheng@627
|
11109 "sure that only specific users are allowed to push changes to that server."
|
dongsheng@627
|
11110 msgstr ""
|
dongsheng@627
|
11111
|
dongsheng@627
|
11112 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@627
|
11113 #: ../en/ch10-hook.xml:738
|
dongsheng@627
|
11114 msgid "Configuring the <literal role=\"hook\">acl</literal> hook"
|
dongsheng@635
|
11115 msgstr "配置 <literal role=\"hook\">acl</literal> 钩子"
|
dongsheng@627
|
11116
|
dongsheng@627
|
11117 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11118 #: ../en/ch10-hook.xml:741
|
dongsheng@627
|
11119 msgid ""
|
dongsheng@627
|
11120 "In order to manage incoming changesets, the <literal role=\"hg-ext\">acl</"
|
dongsheng@627
|
11121 "literal> hook must be used as a <literal role=\"hook\">pretxnchangegroup</"
|
dongsheng@627
|
11122 "literal> hook. This lets it see which files are modified by each incoming "
|
dongsheng@627
|
11123 "changeset, and roll back a group of changesets if they modify "
|
dongsheng@627
|
11124 "<quote>forbidden</quote> files. Example:"
|
dongsheng@627
|
11125 msgstr ""
|
dongsheng@627
|
11126
|
dongsheng@627
|
11127 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11128 #: ../en/ch10-hook.xml:751
|
dongsheng@627
|
11129 msgid ""
|
dongsheng@627
|
11130 "The <literal role=\"hg-ext\">acl</literal> extension is configured using "
|
dongsheng@627
|
11131 "three sections."
|
dongsheng@627
|
11132 msgstr ""
|
dongsheng@627
|
11133
|
dongsheng@627
|
11134 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11135 #: ../en/ch10-hook.xml:755
|
dongsheng@627
|
11136 msgid ""
|
dongsheng@627
|
11137 "The <literal role=\"rc-acl\">acl</literal> section has only one entry, <envar "
|
dongsheng@627
|
11138 "role=\"rc-item-acl\">sources</envar>, which lists the sources of incoming "
|
dongsheng@627
|
11139 "changesets that the hook should pay attention to. You don't normally need to "
|
dongsheng@627
|
11140 "configure this section."
|
dongsheng@627
|
11141 msgstr ""
|
dongsheng@627
|
11142
|
dongsheng@627
|
11143 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11144 #: ../en/ch10-hook.xml:762
|
dongsheng@627
|
11145 msgid ""
|
dongsheng@627
|
11146 "<envar role=\"rc-item-acl\">serve</envar>: Control incoming changesets that "
|
dongsheng@627
|
11147 "are arriving from a remote repository over http or ssh. This is the default "
|
dongsheng@627
|
11148 "value of <envar role=\"rc-item-acl\">sources</envar>, and usually the only "
|
dongsheng@627
|
11149 "setting you'll need for this configuration item."
|
dongsheng@627
|
11150 msgstr ""
|
dongsheng@627
|
11151
|
dongsheng@627
|
11152 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11153 #: ../en/ch10-hook.xml:770
|
dongsheng@627
|
11154 msgid ""
|
dongsheng@627
|
11155 "<envar role=\"rc-item-acl\">pull</envar>: Control incoming changesets that "
|
dongsheng@627
|
11156 "are arriving via a pull from a local repository."
|
dongsheng@627
|
11157 msgstr ""
|
dongsheng@627
|
11158
|
dongsheng@627
|
11159 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11160 #: ../en/ch10-hook.xml:775
|
dongsheng@627
|
11161 msgid ""
|
dongsheng@627
|
11162 "<envar role=\"rc-item-acl\">push</envar>: Control incoming changesets that "
|
dongsheng@627
|
11163 "are arriving via a push from a local repository."
|
dongsheng@627
|
11164 msgstr ""
|
dongsheng@627
|
11165
|
dongsheng@627
|
11166 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11167 #: ../en/ch10-hook.xml:780
|
dongsheng@627
|
11168 msgid ""
|
dongsheng@627
|
11169 "<envar role=\"rc-item-acl\">bundle</envar>: Control incoming changesets that "
|
dongsheng@627
|
11170 "are arriving from another repository via a bundle."
|
dongsheng@627
|
11171 msgstr ""
|
dongsheng@627
|
11172
|
dongsheng@627
|
11173 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11174 #: ../en/ch10-hook.xml:786
|
dongsheng@627
|
11175 msgid ""
|
dongsheng@627
|
11176 "The <literal role=\"rc-acl.allow\">acl.allow</literal> section controls the "
|
dongsheng@627
|
11177 "users that are allowed to add changesets to the repository. If this section "
|
dongsheng@627
|
11178 "is not present, all users that are not explicitly denied are allowed. If "
|
dongsheng@627
|
11179 "this section is present, all users that are not explicitly allowed are denied "
|
dongsheng@627
|
11180 "(so an empty section means that all users are denied)."
|
dongsheng@627
|
11181 msgstr ""
|
dongsheng@627
|
11182
|
dongsheng@627
|
11183 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11184 #: ../en/ch10-hook.xml:795
|
dongsheng@627
|
11185 msgid ""
|
dongsheng@627
|
11186 "The <literal role=\"rc-acl.deny\">acl.deny</literal> section determines which "
|
dongsheng@627
|
11187 "users are denied from adding changesets to the repository. If this section "
|
dongsheng@627
|
11188 "is not present or is empty, no users are denied."
|
dongsheng@627
|
11189 msgstr ""
|
dongsheng@627
|
11190
|
dongsheng@627
|
11191 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11192 #: ../en/ch10-hook.xml:801
|
dongsheng@627
|
11193 msgid ""
|
dongsheng@627
|
11194 "The syntaxes for the <literal role=\"rc-acl.allow\">acl.allow</literal> and "
|
dongsheng@627
|
11195 "<literal role=\"rc-acl.deny\">acl.deny</literal> sections are identical. On "
|
dongsheng@627
|
11196 "the left of each entry is a glob pattern that matches files or directories, "
|
dongsheng@627
|
11197 "relative to the root of the repository; on the right, a user name."
|
dongsheng@627
|
11198 msgstr ""
|
dongsheng@627
|
11199
|
dongsheng@627
|
11200 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11201 #: ../en/ch10-hook.xml:809
|
dongsheng@627
|
11202 msgid ""
|
dongsheng@627
|
11203 "In the following example, the user <literal>docwriter</literal> can only push "
|
dongsheng@627
|
11204 "changes to the <filename class=\"directory\">docs</filename> subtree of the "
|
dongsheng@627
|
11205 "repository, while <literal>intern</literal> can push changes to any file or "
|
dongsheng@627
|
11206 "directory except <filename class=\"directory\">source/sensitive</filename>."
|
dongsheng@627
|
11207 msgstr ""
|
dongsheng@627
|
11208
|
dongsheng@627
|
11209 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@627
|
11210 #: ../en/ch10-hook.xml:821 ../en/ch10-hook.xml:1095 ../en/ch10-hook.xml:1308
|
dongsheng@627
|
11211 msgid "Testing and troubleshooting"
|
dongsheng@635
|
11212 msgstr "测试与问题处理"
|
dongsheng@627
|
11213
|
dongsheng@627
|
11214 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11215 #: ../en/ch10-hook.xml:823
|
dongsheng@627
|
11216 msgid ""
|
dongsheng@627
|
11217 "If you want to test the <literal role=\"hg-ext\">acl</literal> hook, run it "
|
dongsheng@627
|
11218 "with Mercurial's debugging output enabled. Since you'll probably be running "
|
dongsheng@627
|
11219 "it on a server where it's not convenient (or sometimes possible) to pass in "
|
dongsheng@627
|
11220 "the <option role=\"hg-opt-global\">--debug</option> option, don't forget that "
|
dongsheng@627
|
11221 "you can enable debugging output in your <filename role=\"special\"> /.hgrc</"
|
dongsheng@627
|
11222 "filename>:"
|
dongsheng@627
|
11223 msgstr ""
|
dongsheng@627
|
11224
|
dongsheng@627
|
11225 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11226 #: ../en/ch10-hook.xml:833
|
dongsheng@627
|
11227 msgid ""
|
dongsheng@627
|
11228 "With this enabled, the <literal role=\"hg-ext\">acl</literal> hook will print "
|
dongsheng@627
|
11229 "enough information to let you figure out why it is allowing or forbidding "
|
dongsheng@627
|
11230 "pushes from specific users."
|
dongsheng@627
|
11231 msgstr ""
|
dongsheng@627
|
11232
|
dongsheng@627
|
11233 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
11234 #: ../en/ch10-hook.xml:842
|
dongsheng@627
|
11235 msgid ""
|
dongsheng@627
|
11236 "<literal role=\"hg-ext\">bugzilla</literal>&emdash;integration with Bugzilla"
|
dongsheng@635
|
11237 msgstr "<literal role=\"hg-ext\">bugzilla</literal>&emdash;与 Bugzilla 的集成"
|
dongsheng@627
|
11238
|
dongsheng@627
|
11239 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11240 #: ../en/ch10-hook.xml:846
|
dongsheng@627
|
11241 msgid ""
|
dongsheng@627
|
11242 "The <literal role=\"hg-ext\">bugzilla</literal> extension adds a comment to a "
|
dongsheng@627
|
11243 "Bugzilla bug whenever it finds a reference to that bug ID in a commit "
|
dongsheng@627
|
11244 "comment. You can install this hook on a shared server, so that any time a "
|
dongsheng@627
|
11245 "remote user pushes changes to this server, the hook gets run."
|
dongsheng@627
|
11246 msgstr ""
|
dongsheng@627
|
11247
|
dongsheng@627
|
11248 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11249 #: ../en/ch10-hook.xml:853
|
dongsheng@627
|
11250 msgid ""
|
dongsheng@627
|
11251 "It adds a comment to the bug that looks like this (you can configure the "
|
dongsheng@627
|
11252 "contents of the comment&emdash;see below):"
|
dongsheng@627
|
11253 msgstr ""
|
dongsheng@627
|
11254
|
dongsheng@627
|
11255 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11256 #: ../en/ch10-hook.xml:862
|
dongsheng@627
|
11257 msgid ""
|
dongsheng@627
|
11258 "The value of this hook is that it automates the process of updating a bug any "
|
dongsheng@627
|
11259 "time a changeset refers to it. If you configure the hook properly, it makes "
|
dongsheng@627
|
11260 "it easy for people to browse straight from a Bugzilla bug to a changeset that "
|
dongsheng@627
|
11261 "refers to that bug."
|
dongsheng@627
|
11262 msgstr ""
|
dongsheng@627
|
11263
|
dongsheng@627
|
11264 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11265 #: ../en/ch10-hook.xml:869
|
dongsheng@627
|
11266 msgid ""
|
dongsheng@627
|
11267 "You can use the code in this hook as a starting point for some more exotic "
|
dongsheng@627
|
11268 "Bugzilla integration recipes. Here are a few possibilities:"
|
dongsheng@627
|
11269 msgstr ""
|
dongsheng@627
|
11270
|
dongsheng@627
|
11271 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
11272 #: ../en/ch10-hook.xml:874
|
dongsheng@627
|
11273 msgid ""
|
dongsheng@627
|
11274 "Require that every changeset pushed to the server have a valid bug ID in its "
|
dongsheng@627
|
11275 "commit comment. In this case, you'd want to configure the hook as a <literal "
|
dongsheng@627
|
11276 "role=\"hook\">pretxncommit</literal> hook. This would allow the hook to "
|
dongsheng@627
|
11277 "reject changes that didn't contain bug IDs."
|
dongsheng@627
|
11278 msgstr ""
|
dongsheng@627
|
11279
|
dongsheng@627
|
11280 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
11281 #: ../en/ch10-hook.xml:882
|
dongsheng@627
|
11282 msgid ""
|
dongsheng@627
|
11283 "Allow incoming changesets to automatically modify the <emphasis>state</"
|
dongsheng@627
|
11284 "emphasis> of a bug, as well as simply adding a comment. For example, the "
|
dongsheng@627
|
11285 "hook could recognise the string <quote>fixed bug 31337</quote> as indicating "
|
dongsheng@627
|
11286 "that it should update the state of bug 31337 to <quote>requires testing</"
|
dongsheng@627
|
11287 "quote>."
|
dongsheng@627
|
11288 msgstr ""
|
dongsheng@627
|
11289
|
dongsheng@627
|
11290 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@627
|
11291 #: ../en/ch10-hook.xml:892
|
dongsheng@627
|
11292 msgid "Configuring the <literal role=\"hook\">bugzilla</literal> hook"
|
dongsheng@635
|
11293 msgstr "配置 <literal role=\"hook\">bugzilla</literal> 钩子"
|
dongsheng@627
|
11294
|
dongsheng@627
|
11295 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11296 #: ../en/ch10-hook.xml:895
|
dongsheng@627
|
11297 msgid ""
|
dongsheng@627
|
11298 "You should configure this hook in your server's <filename role=\"special\"> /."
|
dongsheng@627
|
11299 "hgrc</filename>\\ as an <literal role=\"hook\">incoming</literal> hook, for "
|
dongsheng@627
|
11300 "example as follows:"
|
dongsheng@627
|
11301 msgstr ""
|
dongsheng@627
|
11302
|
dongsheng@627
|
11303 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11304 #: ../en/ch10-hook.xml:903
|
dongsheng@627
|
11305 msgid ""
|
dongsheng@627
|
11306 "Because of the specialised nature of this hook, and because Bugzilla was not "
|
dongsheng@627
|
11307 "written with this kind of integration in mind, configuring this hook is a "
|
dongsheng@627
|
11308 "somewhat involved process."
|
dongsheng@627
|
11309 msgstr ""
|
dongsheng@627
|
11310
|
dongsheng@627
|
11311 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11312 #: ../en/ch10-hook.xml:909
|
dongsheng@627
|
11313 msgid ""
|
dongsheng@627
|
11314 "Before you begin, you must install the MySQL bindings for Python on the host"
|
dongsheng@627
|
11315 "(s) where you'll be running the hook. If this is not available as a binary "
|
dongsheng@627
|
11316 "package for your system, you can download it from <citation>web:mysql-python</"
|
dongsheng@627
|
11317 "citation>."
|
dongsheng@627
|
11318 msgstr ""
|
dongsheng@627
|
11319
|
dongsheng@627
|
11320 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11321 #: ../en/ch10-hook.xml:916
|
dongsheng@627
|
11322 msgid ""
|
dongsheng@627
|
11323 "Configuration information for this hook lives in the <literal role=\"rc-"
|
dongsheng@627
|
11324 "bugzilla\">bugzilla</literal> section of your <filename role=\"special\"> /."
|
dongsheng@627
|
11325 "hgrc</filename>."
|
dongsheng@627
|
11326 msgstr ""
|
dongsheng@627
|
11327
|
dongsheng@627
|
11328 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11329 #: ../en/ch10-hook.xml:921
|
dongsheng@627
|
11330 msgid ""
|
dongsheng@627
|
11331 "<envar role=\"rc-item-bugzilla\">version</envar>: The version of Bugzilla "
|
dongsheng@627
|
11332 "installed on the server. The database schema that Bugzilla uses changes "
|
dongsheng@627
|
11333 "occasionally, so this hook has to know exactly which schema to use. At the "
|
dongsheng@627
|
11334 "moment, the only version supported is <literal>2.16</literal>."
|
dongsheng@627
|
11335 msgstr ""
|
dongsheng@627
|
11336
|
dongsheng@627
|
11337 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11338 #: ../en/ch10-hook.xml:930
|
dongsheng@627
|
11339 msgid ""
|
dongsheng@627
|
11340 "<envar role=\"rc-item-bugzilla\">host</envar>: The hostname of the MySQL "
|
dongsheng@627
|
11341 "server that stores your Bugzilla data. The database must be configured to "
|
dongsheng@627
|
11342 "allow connections from whatever host you are running the <literal role=\"hook"
|
dongsheng@627
|
11343 "\">bugzilla</literal> hook on."
|
dongsheng@627
|
11344 msgstr ""
|
dongsheng@627
|
11345
|
dongsheng@627
|
11346 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11347 #: ../en/ch10-hook.xml:937
|
dongsheng@627
|
11348 msgid ""
|
dongsheng@627
|
11349 "<envar role=\"rc-item-bugzilla\">user</envar>: The username with which to "
|
dongsheng@627
|
11350 "connect to the MySQL server. The database must be configured to allow this "
|
dongsheng@627
|
11351 "user to connect from whatever host you are running the <literal role=\"hook"
|
dongsheng@627
|
11352 "\">bugzilla</literal> hook on. This user must be able to access and modify "
|
dongsheng@627
|
11353 "Bugzilla tables. The default value of this item is <literal>bugs</literal>, "
|
dongsheng@627
|
11354 "which is the standard name of the Bugzilla user in a MySQL database."
|
dongsheng@627
|
11355 msgstr ""
|
dongsheng@627
|
11356
|
dongsheng@627
|
11357 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11358 #: ../en/ch10-hook.xml:948
|
dongsheng@627
|
11359 msgid ""
|
dongsheng@627
|
11360 "<envar role=\"rc-item-bugzilla\">password</envar>: The MySQL password for the "
|
dongsheng@627
|
11361 "user you configured above. This is stored as plain text, so you should make "
|
dongsheng@627
|
11362 "sure that unauthorised users cannot read the <filename role=\"special\"> /."
|
dongsheng@627
|
11363 "hgrc</filename>\\ file where you store this information."
|
dongsheng@627
|
11364 msgstr ""
|
dongsheng@627
|
11365
|
dongsheng@627
|
11366 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11367 #: ../en/ch10-hook.xml:957
|
dongsheng@627
|
11368 msgid ""
|
dongsheng@627
|
11369 "<envar role=\"rc-item-bugzilla\">db</envar>: The name of the Bugzilla "
|
dongsheng@627
|
11370 "database on the MySQL server. The default value of this item is "
|
dongsheng@627
|
11371 "<literal>bugs</literal>, which is the standard name of the MySQL database "
|
dongsheng@627
|
11372 "where Bugzilla stores its data."
|
dongsheng@627
|
11373 msgstr ""
|
dongsheng@627
|
11374
|
dongsheng@627
|
11375 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11376 #: ../en/ch10-hook.xml:964
|
dongsheng@627
|
11377 msgid ""
|
dongsheng@627
|
11378 "<envar role=\"rc-item-bugzilla\">notify</envar>: If you want Bugzilla to send "
|
dongsheng@627
|
11379 "out a notification email to subscribers after this hook has added a comment "
|
dongsheng@627
|
11380 "to a bug, you will need this hook to run a command whenever it updates the "
|
dongsheng@627
|
11381 "database. The command to run depends on where you have installed Bugzilla, "
|
dongsheng@627
|
11382 "but it will typically look something like this, if you have Bugzilla "
|
dongsheng@627
|
11383 "installed in <filename class=\"directory\">/var/www/html/bugzilla</filename>:"
|
dongsheng@627
|
11384 msgstr ""
|
dongsheng@627
|
11385
|
dongsheng@627
|
11386 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11387 #: ../en/ch10-hook.xml:977
|
dongsheng@627
|
11388 msgid ""
|
dongsheng@627
|
11389 "The Bugzilla <literal>processmail</literal> program expects to be given a bug "
|
dongsheng@627
|
11390 "ID (the hook replaces <quote><literal>%s</literal></quote> with the bug ID) "
|
dongsheng@627
|
11391 "and an email address. It also expects to be able to write to some files in "
|
dongsheng@627
|
11392 "the directory that it runs in. If Bugzilla and this hook are not installed "
|
dongsheng@627
|
11393 "on the same machine, you will need to find a way to run <literal>processmail</"
|
dongsheng@627
|
11394 "literal> on the server where Bugzilla is installed."
|
dongsheng@627
|
11395 msgstr ""
|
dongsheng@627
|
11396
|
dongsheng@627
|
11397 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@627
|
11398 #: ../en/ch10-hook.xml:992
|
dongsheng@627
|
11399 msgid "Mapping committer names to Bugzilla user names"
|
dongsheng@635
|
11400 msgstr "提交者的名称与 Bugzilla 用户名称的映射"
|
dongsheng@627
|
11401
|
dongsheng@627
|
11402 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11403 #: ../en/ch10-hook.xml:994
|
dongsheng@627
|
11404 msgid ""
|
dongsheng@627
|
11405 "By default, the <literal role=\"hg-ext\">bugzilla</literal> hook tries to use "
|
dongsheng@627
|
11406 "the email address of a changeset's committer as the Bugzilla user name with "
|
dongsheng@627
|
11407 "which to update a bug. If this does not suit your needs, you can map "
|
dongsheng@627
|
11408 "committer email addresses to Bugzilla user names using a <literal role=\"rc-"
|
dongsheng@627
|
11409 "usermap\">usermap</literal> section."
|
dongsheng@627
|
11410 msgstr ""
|
dongsheng@627
|
11411
|
dongsheng@627
|
11412 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11413 #: ../en/ch10-hook.xml:1003
|
dongsheng@627
|
11414 msgid ""
|
dongsheng@627
|
11415 "Each item in the <literal role=\"rc-usermap\">usermap</literal> section "
|
dongsheng@627
|
11416 "contains an email address on the left, and a Bugzilla user name on the right."
|
dongsheng@627
|
11417 msgstr ""
|
dongsheng@627
|
11418
|
dongsheng@627
|
11419 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11420 #: ../en/ch10-hook.xml:1010
|
dongsheng@627
|
11421 msgid ""
|
dongsheng@627
|
11422 "You can either keep the <literal role=\"rc-usermap\">usermap</literal> data "
|
dongsheng@627
|
11423 "in a normal <filename role=\"special\">~/.hgrc</filename>, or tell the "
|
dongsheng@627
|
11424 "<literal role=\"hg-ext\">bugzilla</literal> hook to read the information from "
|
dongsheng@627
|
11425 "an external <filename>usermap</filename> file. In the latter case, you can "
|
dongsheng@627
|
11426 "store <filename>usermap</filename> data by itself in (for example) a user-"
|
dongsheng@627
|
11427 "modifiable repository. This makes it possible to let your users maintain "
|
dongsheng@627
|
11428 "their own <envar role=\"rc-item-bugzilla\">usermap</envar> entries. The main "
|
dongsheng@627
|
11429 "<filename role=\"special\"> /.hgrc</filename>\\ file might look like this:"
|
dongsheng@627
|
11430 msgstr ""
|
dongsheng@627
|
11431
|
dongsheng@627
|
11432 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11433 #: ../en/ch10-hook.xml:1026
|
dongsheng@627
|
11434 msgid ""
|
dongsheng@627
|
11435 "While the <filename>usermap</filename> file that it refers to might look like "
|
dongsheng@627
|
11436 "this:"
|
dongsheng@627
|
11437 msgstr ""
|
dongsheng@627
|
11438
|
dongsheng@627
|
11439 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@627
|
11440 #: ../en/ch10-hook.xml:1035
|
dongsheng@627
|
11441 msgid "Configuring the text that gets added to a bug"
|
dongsheng@635
|
11442 msgstr "配置增加到问题中的正文"
|
dongsheng@627
|
11443
|
dongsheng@627
|
11444 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11445 #: ../en/ch10-hook.xml:1037
|
dongsheng@627
|
11446 msgid ""
|
dongsheng@627
|
11447 "You can configure the text that this hook adds as a comment; you specify it "
|
dongsheng@627
|
11448 "in the form of a Mercurial template. Several <filename role=\"special\"> /."
|
dongsheng@627
|
11449 "hgrc</filename>\\ entries (still in the <literal role=\"rc-bugzilla"
|
dongsheng@627
|
11450 "\">bugzilla</literal> section) control this behaviour."
|
dongsheng@627
|
11451 msgstr ""
|
dongsheng@627
|
11452
|
dongsheng@627
|
11453 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11454 #: ../en/ch10-hook.xml:1044
|
dongsheng@627
|
11455 msgid ""
|
dongsheng@627
|
11456 "<literal>strip</literal>: The number of leading path elements to strip from a "
|
dongsheng@627
|
11457 "repository's path name to construct a partial path for a URL. For example, if "
|
dongsheng@627
|
11458 "the repositories on your server live under <filename class=\"directory\">/"
|
dongsheng@627
|
11459 "home/hg/repos</filename>, and you have a repository whose path is <filename "
|
dongsheng@627
|
11460 "class=\"directory\">/home/hg/repos/app/tests</filename>, then setting "
|
dongsheng@627
|
11461 "<literal>strip</literal> to <literal>4</literal> will give a partial path of "
|
dongsheng@627
|
11462 "<filename class=\"directory\">app/tests</filename>. The hook will make this "
|
dongsheng@627
|
11463 "partial path available when expanding a template, as <literal>webroot</"
|
dongsheng@627
|
11464 "literal>."
|
dongsheng@627
|
11465 msgstr ""
|
dongsheng@627
|
11466
|
dongsheng@627
|
11467 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11468 #: ../en/ch10-hook.xml:1058
|
dongsheng@627
|
11469 msgid ""
|
dongsheng@627
|
11470 "<literal>template</literal>: The text of the template to use. In addition to "
|
dongsheng@627
|
11471 "the usual changeset-related variables, this template can use <literal>hgweb</"
|
dongsheng@627
|
11472 "literal> (the value of the <literal>hgweb</literal> configuration item above) "
|
dongsheng@627
|
11473 "and <literal>webroot</literal> (the path constructed using <literal>strip</"
|
dongsheng@627
|
11474 "literal> above)."
|
dongsheng@627
|
11475 msgstr ""
|
dongsheng@627
|
11476
|
dongsheng@627
|
11477 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11478 #: ../en/ch10-hook.xml:1068
|
dongsheng@627
|
11479 msgid ""
|
dongsheng@627
|
11480 "In addition, you can add a <envar role=\"rc-item-web\">baseurl</envar> item "
|
dongsheng@627
|
11481 "to the <literal role=\"rc-web\">web</literal> section of your <filename role="
|
dongsheng@627
|
11482 "\"special\"> /.hgrc</filename>. The <literal role=\"hg-ext\">bugzilla</"
|
dongsheng@627
|
11483 "literal> hook will make this available when expanding a template, as the base "
|
dongsheng@627
|
11484 "string to use when constructing a URL that will let users browse from a "
|
dongsheng@627
|
11485 "Bugzilla comment to view a changeset. Example:"
|
dongsheng@627
|
11486 msgstr ""
|
dongsheng@627
|
11487
|
dongsheng@627
|
11488 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11489 #: ../en/ch10-hook.xml:1080
|
dongsheng@627
|
11490 msgid ""
|
dongsheng@627
|
11491 "Here is an example set of <literal role=\"hg-ext\">bugzilla</literal> hook "
|
dongsheng@627
|
11492 "config information."
|
dongsheng@627
|
11493 msgstr ""
|
dongsheng@627
|
11494
|
dongsheng@627
|
11495 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11496 #: ../en/ch10-hook.xml:1097
|
dongsheng@627
|
11497 msgid ""
|
dongsheng@627
|
11498 "The most common problems with configuring the <literal role=\"hg-ext"
|
dongsheng@627
|
11499 "\">bugzilla</literal> hook relate to running Bugzilla's "
|
dongsheng@627
|
11500 "<filename>processmail</filename> script and mapping committer names to user "
|
dongsheng@627
|
11501 "names."
|
dongsheng@627
|
11502 msgstr ""
|
dongsheng@627
|
11503
|
dongsheng@627
|
11504 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11505 #: ../en/ch10-hook.xml:1103
|
dongsheng@627
|
11506 msgid ""
|
dongsheng@627
|
11507 "Recall from section <xref linkend=\"sec.hook.bugzilla.config\"/> above that "
|
dongsheng@627
|
11508 "the user that runs the Mercurial process on the server is also the one that "
|
dongsheng@627
|
11509 "will run the <filename>processmail</filename> script. The "
|
dongsheng@627
|
11510 "<filename>processmail</filename> script sometimes causes Bugzilla to write to "
|
dongsheng@627
|
11511 "files in its configuration directory, and Bugzilla's configuration files are "
|
dongsheng@627
|
11512 "usually owned by the user that your web server runs under."
|
dongsheng@627
|
11513 msgstr ""
|
dongsheng@627
|
11514
|
dongsheng@627
|
11515 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11516 #: ../en/ch10-hook.xml:1114
|
dongsheng@627
|
11517 msgid ""
|
dongsheng@627
|
11518 "You can cause <filename>processmail</filename> to be run with the suitable "
|
dongsheng@627
|
11519 "user's identity using the <command>sudo</command> command. Here is an "
|
dongsheng@627
|
11520 "example entry for a <filename>sudoers</filename> file."
|
dongsheng@627
|
11521 msgstr ""
|
dongsheng@627
|
11522
|
dongsheng@627
|
11523 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11524 #: ../en/ch10-hook.xml:1122
|
dongsheng@627
|
11525 msgid ""
|
dongsheng@627
|
11526 "This allows the <literal>hg_user</literal> user to run a "
|
dongsheng@627
|
11527 "<filename>processmail-wrapper</filename> program under the identity of "
|
dongsheng@627
|
11528 "<literal>httpd_user</literal>."
|
dongsheng@627
|
11529 msgstr ""
|
dongsheng@627
|
11530
|
dongsheng@627
|
11531 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11532 #: ../en/ch10-hook.xml:1127
|
dongsheng@627
|
11533 msgid ""
|
dongsheng@627
|
11534 "This indirection through a wrapper script is necessary, because "
|
dongsheng@627
|
11535 "<filename>processmail</filename> expects to be run with its current directory "
|
dongsheng@627
|
11536 "set to wherever you installed Bugzilla; you can't specify that kind of "
|
dongsheng@627
|
11537 "constraint in a <filename>sudoers</filename> file. The contents of the "
|
dongsheng@627
|
11538 "wrapper script are simple:"
|
dongsheng@627
|
11539 msgstr ""
|
dongsheng@627
|
11540
|
dongsheng@627
|
11541 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11542 #: ../en/ch10-hook.xml:1136
|
dongsheng@627
|
11543 msgid ""
|
dongsheng@627
|
11544 "It doesn't seem to matter what email address you pass to "
|
dongsheng@627
|
11545 "<filename>processmail</filename>."
|
dongsheng@627
|
11546 msgstr ""
|
dongsheng@627
|
11547
|
dongsheng@627
|
11548 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11549 #: ../en/ch10-hook.xml:1140
|
dongsheng@627
|
11550 msgid ""
|
dongsheng@627
|
11551 "If your <literal role=\"rc-usermap\">usermap</literal> is not set up "
|
dongsheng@627
|
11552 "correctly, users will see an error message from the <literal role=\"hg-ext"
|
dongsheng@627
|
11553 "\">bugzilla</literal> hook when they push changes to the server. The error "
|
dongsheng@627
|
11554 "message will look like this:"
|
dongsheng@627
|
11555 msgstr ""
|
dongsheng@627
|
11556
|
dongsheng@627
|
11557 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11558 #: ../en/ch10-hook.xml:1148
|
dongsheng@627
|
11559 msgid ""
|
dongsheng@627
|
11560 "What this means is that the committer's address, <literal>john.q."
|
dongsheng@627
|
11561 "public@example.com</literal>, is not a valid Bugzilla user name, nor does it "
|
dongsheng@627
|
11562 "have an entry in your <literal role=\"rc-usermap\">usermap</literal> that "
|
dongsheng@627
|
11563 "maps it to a valid Bugzilla user name."
|
dongsheng@627
|
11564 msgstr ""
|
dongsheng@627
|
11565
|
dongsheng@627
|
11566 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
11567 #: ../en/ch10-hook.xml:1158
|
dongsheng@627
|
11568 msgid ""
|
dongsheng@627
|
11569 "<literal role=\"hg-ext\">notify</literal>&emdash;send email notifications"
|
dongsheng@635
|
11570 msgstr "<literal role=\"hg-ext\">notify</literal>&emdash;邮件通知"
|
dongsheng@627
|
11571
|
dongsheng@627
|
11572 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11573 #: ../en/ch10-hook.xml:1161
|
dongsheng@627
|
11574 msgid ""
|
dongsheng@627
|
11575 "Although Mercurial's built-in web server provides RSS feeds of changes in "
|
dongsheng@627
|
11576 "every repository, many people prefer to receive change notifications via "
|
dongsheng@627
|
11577 "email. The <literal role=\"hg-ext\">notify</literal> hook lets you send out "
|
dongsheng@627
|
11578 "notifications to a set of email addresses whenever changesets arrive that "
|
dongsheng@627
|
11579 "those subscribers are interested in."
|
dongsheng@627
|
11580 msgstr ""
|
dongsheng@627
|
11581
|
dongsheng@627
|
11582 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11583 #: ../en/ch10-hook.xml:1169
|
dongsheng@627
|
11584 msgid ""
|
dongsheng@627
|
11585 "As with the <literal role=\"hg-ext\">bugzilla</literal> hook, the <literal "
|
dongsheng@627
|
11586 "role=\"hg-ext\">notify</literal> hook is template-driven, so you can "
|
dongsheng@627
|
11587 "customise the contents of the notification messages that it sends."
|
dongsheng@627
|
11588 msgstr ""
|
dongsheng@627
|
11589
|
dongsheng@627
|
11590 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11591 #: ../en/ch10-hook.xml:1175
|
dongsheng@627
|
11592 msgid ""
|
dongsheng@627
|
11593 "By default, the <literal role=\"hg-ext\">notify</literal> hook includes a "
|
dongsheng@627
|
11594 "diff of every changeset that it sends out; you can limit the size of the "
|
dongsheng@627
|
11595 "diff, or turn this feature off entirely. It is useful for letting "
|
dongsheng@627
|
11596 "subscribers review changes immediately, rather than clicking to follow a URL."
|
dongsheng@627
|
11597 msgstr ""
|
dongsheng@627
|
11598
|
dongsheng@627
|
11599 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@627
|
11600 #: ../en/ch10-hook.xml:1183
|
dongsheng@627
|
11601 msgid "Configuring the <literal role=\"hg-ext\">notify</literal> hook"
|
dongsheng@635
|
11602 msgstr "配置 <literal role=\"hg-ext\">notify</literal> 钩子"
|
dongsheng@627
|
11603
|
dongsheng@627
|
11604 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11605 #: ../en/ch10-hook.xml:1186
|
dongsheng@627
|
11606 msgid ""
|
dongsheng@627
|
11607 "You can set up the <literal role=\"hg-ext\">notify</literal> hook to send one "
|
dongsheng@627
|
11608 "email message per incoming changeset, or one per incoming group of changesets "
|
dongsheng@627
|
11609 "(all those that arrived in a single pull or push)."
|
dongsheng@627
|
11610 msgstr ""
|
dongsheng@627
|
11611
|
dongsheng@627
|
11612 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11613 #: ../en/ch10-hook.xml:1197
|
dongsheng@627
|
11614 msgid ""
|
dongsheng@627
|
11615 "Configuration information for this hook lives in the <literal role=\"rc-notify"
|
dongsheng@627
|
11616 "\">notify</literal> section of a <filename role=\"special\"> /.hgrc</filename>"
|
dongsheng@627
|
11617 "\\ file."
|
dongsheng@627
|
11618 msgstr ""
|
dongsheng@627
|
11619
|
dongsheng@627
|
11620 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11621 #: ../en/ch10-hook.xml:1202
|
dongsheng@627
|
11622 msgid ""
|
dongsheng@627
|
11623 "<envar role=\"rc-item-notify\">test</envar>: By default, this hook does not "
|
dongsheng@627
|
11624 "send out email at all; instead, it prints the message that it "
|
dongsheng@627
|
11625 "<emphasis>would</emphasis> send. Set this item to <literal>false</literal> "
|
dongsheng@627
|
11626 "to allow email to be sent. The reason that sending of email is turned off by "
|
dongsheng@627
|
11627 "default is that it takes several tries to configure this extension exactly as "
|
dongsheng@627
|
11628 "you would like, and it would be bad form to spam subscribers with a number of "
|
dongsheng@627
|
11629 "<quote>broken</quote> notifications while you debug your configuration."
|
dongsheng@627
|
11630 msgstr ""
|
dongsheng@627
|
11631
|
dongsheng@627
|
11632 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11633 #: ../en/ch10-hook.xml:1214
|
dongsheng@627
|
11634 msgid ""
|
dongsheng@627
|
11635 "<envar role=\"rc-item-notify\">config</envar>: The path to a configuration "
|
dongsheng@627
|
11636 "file that contains subscription information. This is kept separate from the "
|
dongsheng@627
|
11637 "main <filename role=\"special\"> /.hgrc</filename>\\ so that you can maintain "
|
dongsheng@627
|
11638 "it in a repository of its own. People can then clone that repository, update "
|
dongsheng@627
|
11639 "their subscriptions, and push the changes back to your server."
|
dongsheng@627
|
11640 msgstr ""
|
dongsheng@627
|
11641
|
dongsheng@627
|
11642 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11643 #: ../en/ch10-hook.xml:1223
|
dongsheng@627
|
11644 msgid ""
|
dongsheng@627
|
11645 "<envar role=\"rc-item-notify\">strip</envar>: The number of leading path "
|
dongsheng@627
|
11646 "separator characters to strip from a repository's path, when deciding whether "
|
dongsheng@627
|
11647 "a repository has subscribers. For example, if the repositories on your "
|
dongsheng@627
|
11648 "server live in <filename class=\"directory\">/home/hg/repos</filename>, and "
|
dongsheng@627
|
11649 "<literal role=\"hg-ext\">notify</literal> is considering a repository named "
|
dongsheng@627
|
11650 "<filename class=\"directory\">/home/hg/repos/shared/test</filename>, setting "
|
dongsheng@627
|
11651 "<envar role=\"rc-item-notify\">strip</envar> to <literal>4</literal> will "
|
dongsheng@627
|
11652 "cause <literal role=\"hg-ext\">notify</literal> to trim the path it considers "
|
dongsheng@627
|
11653 "down to <filename class=\"directory\">shared/test</filename>, and it will "
|
dongsheng@627
|
11654 "match subscribers against that."
|
dongsheng@627
|
11655 msgstr ""
|
dongsheng@627
|
11656
|
dongsheng@627
|
11657 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11658 #: ../en/ch10-hook.xml:1240
|
dongsheng@627
|
11659 msgid ""
|
dongsheng@627
|
11660 "<envar role=\"rc-item-notify\">template</envar>: The template text to use "
|
dongsheng@627
|
11661 "when sending messages. This specifies both the contents of the message "
|
dongsheng@627
|
11662 "header and its body."
|
dongsheng@627
|
11663 msgstr ""
|
dongsheng@627
|
11664
|
dongsheng@627
|
11665 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11666 #: ../en/ch10-hook.xml:1246
|
dongsheng@627
|
11667 msgid ""
|
dongsheng@627
|
11668 "<envar role=\"rc-item-notify\">maxdiff</envar>: The maximum number of lines "
|
dongsheng@627
|
11669 "of diff data to append to the end of a message. If a diff is longer than "
|
dongsheng@627
|
11670 "this, it is truncated. By default, this is set to 300. Set this to "
|
dongsheng@627
|
11671 "<literal>0</literal> to omit diffs from notification emails."
|
dongsheng@627
|
11672 msgstr ""
|
dongsheng@627
|
11673
|
dongsheng@627
|
11674 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11675 #: ../en/ch10-hook.xml:1255
|
dongsheng@627
|
11676 msgid ""
|
dongsheng@627
|
11677 "<envar role=\"rc-item-notify\">sources</envar>: A list of sources of "
|
dongsheng@627
|
11678 "changesets to consider. This lets you limit <literal role=\"hg-ext\">notify</"
|
dongsheng@627
|
11679 "literal> to only sending out email about changes that remote users pushed "
|
dongsheng@627
|
11680 "into this repository via a server, for example. See section <xref linkend="
|
dongsheng@627
|
11681 "\"sec.hook.sources\"/> for the sources you can specify here."
|
dongsheng@627
|
11682 msgstr ""
|
dongsheng@627
|
11683
|
dongsheng@627
|
11684 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11685 #: ../en/ch10-hook.xml:1267
|
dongsheng@627
|
11686 msgid ""
|
dongsheng@627
|
11687 "If you set the <envar role=\"rc-item-web\">baseurl</envar> item in the "
|
dongsheng@627
|
11688 "<literal role=\"rc-web\">web</literal> section, you can use it in a template; "
|
dongsheng@627
|
11689 "it will be available as <literal>webroot</literal>."
|
dongsheng@627
|
11690 msgstr ""
|
dongsheng@627
|
11691
|
dongsheng@627
|
11692 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11693 #: ../en/ch10-hook.xml:1273
|
dongsheng@627
|
11694 msgid ""
|
dongsheng@627
|
11695 "Here is an example set of <literal role=\"hg-ext\">notify</literal> "
|
dongsheng@627
|
11696 "configuration information."
|
dongsheng@627
|
11697 msgstr ""
|
dongsheng@627
|
11698
|
dongsheng@627
|
11699 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11700 #: ../en/ch10-hook.xml:1289
|
dongsheng@627
|
11701 msgid "This will produce a message that looks like the following:"
|
dongsheng@627
|
11702 msgstr ""
|
dongsheng@627
|
11703
|
dongsheng@627
|
11704 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11705 #: ../en/ch10-hook.xml:1310
|
dongsheng@627
|
11706 msgid ""
|
dongsheng@627
|
11707 "Do not forget that by default, the <literal role=\"hg-ext\">notify</literal> "
|
dongsheng@627
|
11708 "extension <emphasis>will not send any mail</emphasis> until you explicitly "
|
dongsheng@627
|
11709 "configure it to do so, by setting <envar role=\"rc-item-notify\">test</envar> "
|
dongsheng@627
|
11710 "to <literal>false</literal>. Until you do that, it simply prints the message "
|
dongsheng@627
|
11711 "it <emphasis>would</emphasis> send."
|
dongsheng@627
|
11712 msgstr ""
|
dongsheng@627
|
11713
|
dongsheng@627
|
11714 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
11715 #: ../en/ch10-hook.xml:1322
|
dongsheng@627
|
11716 msgid "Information for writers of hooks"
|
dongsheng@635
|
11717 msgstr "编写钩子的信息"
|
dongsheng@627
|
11718
|
dongsheng@627
|
11719 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
11720 #: ../en/ch10-hook.xml:1325
|
dongsheng@627
|
11721 msgid "In-process hook execution"
|
dongsheng@635
|
11722 msgstr "进程内钩子的执行"
|
dongsheng@627
|
11723
|
dongsheng@627
|
11724 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11725 #: ../en/ch10-hook.xml:1327
|
dongsheng@627
|
11726 msgid "An in-process hook is called with arguments of the following form:"
|
dongsheng@627
|
11727 msgstr ""
|
dongsheng@627
|
11728
|
dongsheng@627
|
11729 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11730 #: ../en/ch10-hook.xml:1333
|
dongsheng@627
|
11731 msgid ""
|
dongsheng@627
|
11732 "The <literal>ui</literal> parameter is a <literal role=\"py-mod-mercurial.ui"
|
dongsheng@627
|
11733 "\">ui</literal> object. The <literal>repo</literal> parameter is a <literal "
|
dongsheng@627
|
11734 "role=\"py-mod-mercurial.localrepo\">localrepository</literal> object. The "
|
dongsheng@627
|
11735 "names and values of the <literal>**kwargs</literal> parameters depend on the "
|
dongsheng@627
|
11736 "hook being invoked, with the following common features:"
|
dongsheng@627
|
11737 msgstr ""
|
dongsheng@627
|
11738
|
dongsheng@627
|
11739 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
11740 #: ../en/ch10-hook.xml:1342
|
dongsheng@627
|
11741 msgid ""
|
dongsheng@627
|
11742 "If a parameter is named <literal>node</literal> or <literal>parentN</"
|
dongsheng@627
|
11743 "literal>, it will contain a hexadecimal changeset ID. The empty string is "
|
dongsheng@627
|
11744 "used to represent <quote>null changeset ID</quote> instead of a string of "
|
dongsheng@627
|
11745 "zeroes."
|
dongsheng@627
|
11746 msgstr ""
|
dongsheng@627
|
11747
|
dongsheng@627
|
11748 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
11749 #: ../en/ch10-hook.xml:1349
|
dongsheng@627
|
11750 msgid ""
|
dongsheng@627
|
11751 "If a parameter is named <literal>url</literal>, it will contain the URL of a "
|
dongsheng@627
|
11752 "remote repository, if that can be determined."
|
dongsheng@627
|
11753 msgstr ""
|
dongsheng@627
|
11754
|
dongsheng@627
|
11755 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
11756 #: ../en/ch10-hook.xml:1354
|
dongsheng@627
|
11757 msgid ""
|
dongsheng@627
|
11758 "Boolean-valued parameters are represented as Python <literal>bool</literal> "
|
dongsheng@627
|
11759 "objects."
|
dongsheng@627
|
11760 msgstr ""
|
dongsheng@627
|
11761
|
dongsheng@627
|
11762 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11763 #: ../en/ch10-hook.xml:1359
|
dongsheng@627
|
11764 msgid ""
|
dongsheng@627
|
11765 "An in-process hook is called without a change to the process's working "
|
dongsheng@627
|
11766 "directory (unlike external hooks, which are run in the root of the "
|
dongsheng@627
|
11767 "repository). It must not change the process's working directory, or it will "
|
dongsheng@627
|
11768 "cause any calls it makes into the Mercurial API to fail."
|
dongsheng@627
|
11769 msgstr ""
|
dongsheng@627
|
11770
|
dongsheng@627
|
11771 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11772 #: ../en/ch10-hook.xml:1366
|
dongsheng@627
|
11773 msgid ""
|
dongsheng@627
|
11774 "If a hook returns a boolean <quote>false</quote> value, it is considered to "
|
dongsheng@627
|
11775 "have succeeded. If it returns a boolean <quote>true</quote> value or raises "
|
dongsheng@627
|
11776 "an exception, it is considered to have failed. A useful way to think of the "
|
dongsheng@627
|
11777 "calling convention is <quote>tell me if you fail</quote>."
|
dongsheng@627
|
11778 msgstr ""
|
dongsheng@627
|
11779
|
dongsheng@627
|
11780 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11781 #: ../en/ch10-hook.xml:1373
|
dongsheng@627
|
11782 msgid ""
|
dongsheng@627
|
11783 "Note that changeset IDs are passed into Python hooks as hexadecimal strings, "
|
dongsheng@627
|
11784 "not the binary hashes that Mercurial's APIs normally use. To convert a hash "
|
dongsheng@627
|
11785 "from hex to binary, use the \\pymodfunc{mercurial.node}{bin} function."
|
dongsheng@627
|
11786 msgstr ""
|
dongsheng@627
|
11787
|
dongsheng@627
|
11788 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
11789 #: ../en/ch10-hook.xml:1381
|
dongsheng@627
|
11790 msgid "External hook execution"
|
dongsheng@635
|
11791 msgstr "外部钩子的执行"
|
dongsheng@627
|
11792
|
dongsheng@627
|
11793 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11794 #: ../en/ch10-hook.xml:1383
|
dongsheng@627
|
11795 msgid ""
|
dongsheng@627
|
11796 "An external hook is passed to the shell of the user running Mercurial. "
|
dongsheng@627
|
11797 "Features of that shell, such as variable substitution and command "
|
dongsheng@627
|
11798 "redirection, are available. The hook is run in the root directory of the "
|
dongsheng@627
|
11799 "repository (unlike in-process hooks, which are run in the same directory that "
|
dongsheng@627
|
11800 "Mercurial was run in)."
|
dongsheng@627
|
11801 msgstr ""
|
dongsheng@627
|
11802
|
dongsheng@627
|
11803 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11804 #: ../en/ch10-hook.xml:1391
|
dongsheng@627
|
11805 msgid ""
|
dongsheng@627
|
11806 "Hook parameters are passed to the hook as environment variables. Each "
|
dongsheng@627
|
11807 "environment variable's name is converted in upper case and prefixed with the "
|
dongsheng@627
|
11808 "string <quote><literal>HG_</literal></quote>. For example, if the name of a "
|
dongsheng@627
|
11809 "parameter is <quote><literal>node</literal></quote>, the name of the "
|
dongsheng@627
|
11810 "environment variable representing that parameter will be "
|
dongsheng@627
|
11811 "<quote><literal>HG_NODE</literal></quote>."
|
dongsheng@627
|
11812 msgstr ""
|
dongsheng@627
|
11813
|
dongsheng@627
|
11814 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11815 #: ../en/ch10-hook.xml:1400
|
dongsheng@627
|
11816 msgid ""
|
dongsheng@627
|
11817 "A boolean parameter is represented as the string <quote><literal>1</literal></"
|
dongsheng@627
|
11818 "quote> for <quote>true</quote>, <quote><literal>0</literal></quote> for "
|
dongsheng@627
|
11819 "<quote>false</quote>. If an environment variable is named <envar>HG_NODE</"
|
dongsheng@627
|
11820 "envar>, <envar>HG_PARENT1</envar> or <envar>HG_PARENT2</envar>, it contains a "
|
dongsheng@627
|
11821 "changeset ID represented as a hexadecimal string. The empty string is used "
|
dongsheng@627
|
11822 "to represent <quote>null changeset ID</quote> instead of a string of zeroes. "
|
dongsheng@627
|
11823 "If an environment variable is named <envar>HG_URL</envar>, it will contain "
|
dongsheng@627
|
11824 "the URL of a remote repository, if that can be determined."
|
dongsheng@627
|
11825 msgstr ""
|
dongsheng@627
|
11826
|
dongsheng@627
|
11827 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11828 #: ../en/ch10-hook.xml:1412
|
dongsheng@627
|
11829 msgid ""
|
dongsheng@627
|
11830 "If a hook exits with a status of zero, it is considered to have succeeded. "
|
dongsheng@627
|
11831 "If it exits with a non-zero status, it is considered to have failed."
|
dongsheng@627
|
11832 msgstr ""
|
dongsheng@627
|
11833
|
dongsheng@627
|
11834 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
11835 #: ../en/ch10-hook.xml:1419
|
dongsheng@627
|
11836 msgid "Finding out where changesets come from"
|
dongsheng@635
|
11837 msgstr "检查修改集来自何处"
|
dongsheng@627
|
11838
|
dongsheng@627
|
11839 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11840 #: ../en/ch10-hook.xml:1421
|
dongsheng@627
|
11841 msgid ""
|
dongsheng@627
|
11842 "A hook that involves the transfer of changesets between a local repository "
|
dongsheng@627
|
11843 "and another may be able to find out information about the <quote>far side</"
|
dongsheng@627
|
11844 "quote>. Mercurial knows <emphasis>how</emphasis> changes are being "
|
dongsheng@627
|
11845 "transferred, and in many cases <emphasis>where</emphasis> they are being "
|
dongsheng@627
|
11846 "transferred to or from."
|
dongsheng@627
|
11847 msgstr ""
|
dongsheng@627
|
11848
|
dongsheng@627
|
11849 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@627
|
11850 #: ../en/ch10-hook.xml:1430
|
dongsheng@627
|
11851 msgid "Sources of changesets"
|
dongsheng@635
|
11852 msgstr "修改集的来源"
|
dongsheng@627
|
11853
|
dongsheng@627
|
11854 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11855 #: ../en/ch10-hook.xml:1432
|
dongsheng@627
|
11856 msgid ""
|
dongsheng@627
|
11857 "Mercurial will tell a hook what means are, or were, used to transfer "
|
dongsheng@627
|
11858 "changesets between repositories. This is provided by Mercurial in a Python "
|
dongsheng@627
|
11859 "parameter named <literal>source</literal>, or an environment variable named "
|
dongsheng@627
|
11860 "<envar>HG_SOURCE</envar>."
|
dongsheng@627
|
11861 msgstr ""
|
dongsheng@627
|
11862
|
dongsheng@627
|
11863 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11864 #: ../en/ch10-hook.xml:1440
|
dongsheng@627
|
11865 msgid ""
|
dongsheng@627
|
11866 "<literal>serve</literal>: Changesets are transferred to or from a remote "
|
dongsheng@627
|
11867 "repository over http or ssh."
|
dongsheng@627
|
11868 msgstr ""
|
dongsheng@627
|
11869
|
dongsheng@627
|
11870 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11871 #: ../en/ch10-hook.xml:1445
|
dongsheng@627
|
11872 msgid ""
|
dongsheng@627
|
11873 "<literal>pull</literal>: Changesets are being transferred via a pull from one "
|
dongsheng@627
|
11874 "repository into another."
|
dongsheng@627
|
11875 msgstr ""
|
dongsheng@627
|
11876
|
dongsheng@627
|
11877 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11878 #: ../en/ch10-hook.xml:1450
|
dongsheng@627
|
11879 msgid ""
|
dongsheng@627
|
11880 "<literal>push</literal>: Changesets are being transferred via a push from one "
|
dongsheng@627
|
11881 "repository into another."
|
dongsheng@627
|
11882 msgstr ""
|
dongsheng@627
|
11883
|
dongsheng@627
|
11884 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11885 #: ../en/ch10-hook.xml:1455
|
dongsheng@627
|
11886 msgid ""
|
dongsheng@627
|
11887 "<literal>bundle</literal>: Changesets are being transferred to or from a "
|
dongsheng@627
|
11888 "bundle."
|
dongsheng@627
|
11889 msgstr ""
|
dongsheng@627
|
11890
|
dongsheng@627
|
11891 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@627
|
11892 #: ../en/ch10-hook.xml:1462
|
dongsheng@627
|
11893 msgid "Where changes are going&emdash;remote repository URLs"
|
dongsheng@635
|
11894 msgstr "修改集要到哪里&emdash;远程版本库的地址"
|
dongsheng@627
|
11895
|
dongsheng@627
|
11896 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11897 #: ../en/ch10-hook.xml:1465
|
dongsheng@627
|
11898 msgid ""
|
dongsheng@627
|
11899 "When possible, Mercurial will tell a hook the location of the <quote>far "
|
dongsheng@627
|
11900 "side</quote> of an activity that transfers changeset data between "
|
dongsheng@627
|
11901 "repositories. This is provided by Mercurial in a Python parameter named "
|
dongsheng@627
|
11902 "<literal>url</literal>, or an environment variable named <envar>HG_URL</"
|
dongsheng@627
|
11903 "envar>."
|
dongsheng@627
|
11904 msgstr ""
|
dongsheng@627
|
11905
|
dongsheng@627
|
11906 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@627
|
11907 #: ../en/ch10-hook.xml:1473
|
dongsheng@627
|
11908 msgid ""
|
dongsheng@627
|
11909 "This information is not always known. If a hook is invoked in a repository "
|
dongsheng@627
|
11910 "that is being served via http or ssh, Mercurial cannot tell where the remote "
|
dongsheng@627
|
11911 "repository is, but it may know where the client is connecting from. In such "
|
dongsheng@627
|
11912 "cases, the URL will take one of the following forms:"
|
dongsheng@627
|
11913 msgstr ""
|
dongsheng@627
|
11914
|
dongsheng@627
|
11915 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11916 #: ../en/ch10-hook.xml:1480
|
dongsheng@627
|
11917 msgid ""
|
dongsheng@627
|
11918 "<literal>remote:ssh:1.2.3.4</literal>&emdash;remote ssh client, at the IP "
|
dongsheng@627
|
11919 "address <literal>1.2.3.4</literal>."
|
dongsheng@627
|
11920 msgstr ""
|
dongsheng@627
|
11921
|
dongsheng@627
|
11922 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11923 #: ../en/ch10-hook.xml:1485
|
dongsheng@627
|
11924 msgid ""
|
dongsheng@627
|
11925 "<literal>remote:http:1.2.3.4</literal>&emdash;remote http client, at the IP "
|
dongsheng@627
|
11926 "address <literal>1.2.3.4</literal>. If the client is using SSL, this will be "
|
dongsheng@627
|
11927 "of the form <literal>remote:https:1.2.3.4</literal>."
|
dongsheng@627
|
11928 msgstr ""
|
dongsheng@627
|
11929
|
dongsheng@627
|
11930 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@627
|
11931 #: ../en/ch10-hook.xml:1492
|
dongsheng@627
|
11932 msgid "Empty&emdash;no information could be discovered about the remote client."
|
dongsheng@627
|
11933 msgstr ""
|
dongsheng@627
|
11934
|
dongsheng@627
|
11935 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
11936 #: ../en/ch10-hook.xml:1501
|
dongsheng@627
|
11937 msgid "Hook reference"
|
dongsheng@635
|
11938 msgstr "钩子参考"
|
dongsheng@627
|
11939
|
dongsheng@627
|
11940 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
11941 #: ../en/ch10-hook.xml:1504
|
dongsheng@627
|
11942 msgid ""
|
dongsheng@627
|
11943 "<literal role=\"hook\">changegroup</literal>&emdash;after remote changesets "
|
dongsheng@627
|
11944 "added"
|
dongsheng@635
|
11945 msgstr "<literal role=\"hook\">changegroup</literal>&emdash;增加远程修改集之后"
|
dongsheng@627
|
11946
|
dongsheng@627
|
11947 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11948 #: ../en/ch10-hook.xml:1507
|
dongsheng@627
|
11949 msgid ""
|
dongsheng@627
|
11950 "This hook is run after a group of pre-existing changesets has been added to "
|
dongsheng@627
|
11951 "the repository, for example via a <command role=\"hg-cmd\">hg pull</command> "
|
dongsheng@627
|
11952 "or <command role=\"hg-cmd\">hg unbundle</command>. This hook is run once per "
|
dongsheng@627
|
11953 "operation that added one or more changesets. This is in contrast to the "
|
dongsheng@627
|
11954 "<literal role=\"hook\">incoming</literal> hook, which is run once per "
|
dongsheng@627
|
11955 "changeset, regardless of whether the changesets arrive in a group."
|
dongsheng@627
|
11956 msgstr ""
|
dongsheng@627
|
11957
|
dongsheng@627
|
11958 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11959 #: ../en/ch10-hook.xml:1517
|
dongsheng@627
|
11960 msgid ""
|
dongsheng@627
|
11961 "Some possible uses for this hook include kicking off an automated build or "
|
dongsheng@627
|
11962 "test of the added changesets, updating a bug database, or notifying "
|
dongsheng@627
|
11963 "subscribers that a repository contains new changes."
|
dongsheng@627
|
11964 msgstr ""
|
dongsheng@627
|
11965
|
dongsheng@627
|
11966 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
11967 #: ../en/ch10-hook.xml:1523 ../en/ch10-hook.xml:1564 ../en/ch10-hook.xml:1607
|
dongsheng@627
|
11968 #: ../en/ch10-hook.xml:1649 ../en/ch10-hook.xml:1704 ../en/ch10-hook.xml:1744
|
dongsheng@627
|
11969 #: ../en/ch10-hook.xml:1780 ../en/ch10-hook.xml:1815 ../en/ch10-hook.xml:1877
|
dongsheng@627
|
11970 #: ../en/ch10-hook.xml:1935 ../en/ch10-hook.xml:1969 ../en/ch10-hook.xml:1997
|
dongsheng@627
|
11971 msgid "Parameters to this hook:"
|
dongsheng@627
|
11972 msgstr ""
|
dongsheng@627
|
11973
|
dongsheng@627
|
11974 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
11975 #: ../en/ch10-hook.xml:1526 ../en/ch10-hook.xml:1880
|
dongsheng@627
|
11976 msgid ""
|
dongsheng@627
|
11977 "<literal>node</literal>: A changeset ID. The changeset ID of the first "
|
dongsheng@627
|
11978 "changeset in the group that was added. All changesets between this and "
|
dongsheng@627
|
11979 "\\index{tags!<literal>tip</literal>}<literal>tip</literal>, inclusive, were "
|
dongsheng@627
|
11980 "added by a single <command role=\"hg-cmd\">hg pull</command>, <command role="
|
dongsheng@627
|
11981 "\"hg-cmd\">hg push</command> or <command role=\"hg-cmd\">hg unbundle</"
|
dongsheng@627
|
11982 "command>."
|
dongsheng@627
|
11983 msgstr ""
|
dongsheng@627
|
11984
|
dongsheng@627
|
11985 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
11986 #: ../en/ch10-hook.xml:1536 ../en/ch10-hook.xml:1614 ../en/ch10-hook.xml:1707
|
dongsheng@627
|
11987 #: ../en/ch10-hook.xml:1890
|
dongsheng@627
|
11988 msgid ""
|
dongsheng@627
|
11989 "<literal>source</literal>: A string. The source of these changes. See "
|
dongsheng@627
|
11990 "section <xref linkend=\"sec.hook.sources\"/> for details."
|
dongsheng@627
|
11991 msgstr ""
|
dongsheng@627
|
11992
|
dongsheng@627
|
11993 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
11994 #: ../en/ch10-hook.xml:1541 ../en/ch10-hook.xml:1619 ../en/ch10-hook.xml:1670
|
dongsheng@627
|
11995 #: ../en/ch10-hook.xml:1712 ../en/ch10-hook.xml:1794 ../en/ch10-hook.xml:1895
|
dongsheng@627
|
11996 msgid ""
|
dongsheng@627
|
11997 "<literal>url</literal>: A URL. The location of the remote repository, if "
|
dongsheng@627
|
11998 "known. See section <xref linkend=\"sec.hook.url\"/> for more information."
|
dongsheng@627
|
11999 msgstr ""
|
dongsheng@627
|
12000
|
dongsheng@627
|
12001 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12002 #: ../en/ch10-hook.xml:1548
|
dongsheng@627
|
12003 msgid ""
|
dongsheng@627
|
12004 "See also: <literal role=\"hook\">incoming</literal> (section <xref linkend="
|
dongsheng@627
|
12005 "\"sec.hook.incoming\"/>), <literal role=\"hook\">prechangegroup</literal> "
|
dongsheng@627
|
12006 "(section <xref linkend=\"sec.hook.prechangegroup\"/>), <literal role=\"hook"
|
dongsheng@627
|
12007 "\">pretxnchangegroup</literal> (section <xref linkend=\"sec.hook."
|
dongsheng@627
|
12008 "pretxnchangegroup\"/>)"
|
dongsheng@627
|
12009 msgstr ""
|
dongsheng@627
|
12010
|
dongsheng@627
|
12011 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
12012 #: ../en/ch10-hook.xml:1558
|
dongsheng@627
|
12013 msgid ""
|
dongsheng@627
|
12014 "<literal role=\"hook\">commit</literal>&emdash;after a new changeset is "
|
dongsheng@627
|
12015 "created"
|
dongsheng@635
|
12016 msgstr "<literal role=\"hook\">commit</literal>&emdash;创建新修改集之后"
|
dongsheng@627
|
12017
|
dongsheng@627
|
12018 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12019 #: ../en/ch10-hook.xml:1561
|
dongsheng@627
|
12020 msgid "This hook is run after a new changeset has been created."
|
dongsheng@627
|
12021 msgstr ""
|
dongsheng@627
|
12022
|
dongsheng@627
|
12023 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
12024 #: ../en/ch10-hook.xml:1567 ../en/ch10-hook.xml:1938
|
dongsheng@627
|
12025 msgid ""
|
dongsheng@627
|
12026 "<literal>node</literal>: A changeset ID. The changeset ID of the newly "
|
dongsheng@627
|
12027 "committed changeset."
|
dongsheng@627
|
12028 msgstr ""
|
dongsheng@627
|
12029
|
dongsheng@627
|
12030 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
12031 #: ../en/ch10-hook.xml:1571 ../en/ch10-hook.xml:1942
|
dongsheng@627
|
12032 msgid ""
|
dongsheng@627
|
12033 "<literal>parent1</literal>: A changeset ID. The changeset ID of the first "
|
dongsheng@627
|
12034 "parent of the newly committed changeset."
|
dongsheng@627
|
12035 msgstr ""
|
dongsheng@627
|
12036
|
dongsheng@627
|
12037 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
12038 #: ../en/ch10-hook.xml:1576 ../en/ch10-hook.xml:1947
|
dongsheng@627
|
12039 msgid ""
|
dongsheng@627
|
12040 "<literal>parent2</literal>: A changeset ID. The changeset ID of the second "
|
dongsheng@627
|
12041 "parent of the newly committed changeset."
|
dongsheng@627
|
12042 msgstr ""
|
dongsheng@627
|
12043
|
dongsheng@627
|
12044 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12045 #: ../en/ch10-hook.xml:1582
|
dongsheng@627
|
12046 msgid ""
|
dongsheng@627
|
12047 "See also: <literal role=\"hook\">precommit</literal> (section <xref linkend="
|
dongsheng@627
|
12048 "\"sec.hook.precommit\"/>), <literal role=\"hook\">pretxncommit</literal> "
|
dongsheng@627
|
12049 "(section <xref linkend=\"sec.hook.pretxncommit\"/>)"
|
dongsheng@627
|
12050 msgstr ""
|
dongsheng@627
|
12051
|
dongsheng@627
|
12052 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
12053 #: ../en/ch10-hook.xml:1590
|
dongsheng@627
|
12054 msgid ""
|
dongsheng@627
|
12055 "<literal role=\"hook\">incoming</literal>&emdash;after one remote changeset "
|
dongsheng@627
|
12056 "is added"
|
dongsheng@635
|
12057 msgstr "<literal role=\"hook\">incoming</literal>&emdash;增加远程修改集之后"
|
dongsheng@627
|
12058
|
dongsheng@627
|
12059 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12060 #: ../en/ch10-hook.xml:1593
|
dongsheng@627
|
12061 msgid ""
|
dongsheng@627
|
12062 "This hook is run after a pre-existing changeset has been added to the "
|
dongsheng@627
|
12063 "repository, for example via a <command role=\"hg-cmd\">hg push</command>. If "
|
dongsheng@627
|
12064 "a group of changesets was added in a single operation, this hook is called "
|
dongsheng@627
|
12065 "once for each added changeset."
|
dongsheng@627
|
12066 msgstr ""
|
dongsheng@627
|
12067
|
dongsheng@627
|
12068 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12069 #: ../en/ch10-hook.xml:1600
|
dongsheng@627
|
12070 msgid ""
|
dongsheng@627
|
12071 "You can use this hook for the same purposes as the <literal role=\"hook"
|
dongsheng@627
|
12072 "\">changegroup</literal> hook (section <xref linkend=\"sec.hook.changegroup\"/"
|
dongsheng@627
|
12073 ">); it's simply more convenient sometimes to run a hook once per group of "
|
dongsheng@627
|
12074 "changesets, while other times it's handier once per changeset."
|
dongsheng@627
|
12075 msgstr ""
|
dongsheng@627
|
12076
|
dongsheng@627
|
12077 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
12078 #: ../en/ch10-hook.xml:1610
|
dongsheng@627
|
12079 msgid ""
|
dongsheng@627
|
12080 "<literal>node</literal>: A changeset ID. The ID of the newly added changeset."
|
dongsheng@627
|
12081 msgstr ""
|
dongsheng@627
|
12082
|
dongsheng@627
|
12083 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12084 #: ../en/ch10-hook.xml:1626
|
dongsheng@627
|
12085 msgid ""
|
dongsheng@627
|
12086 "See also: <literal role=\"hook\">changegroup</literal> (section <xref linkend="
|
dongsheng@627
|
12087 "\"sec.hook.changegroup\"/>) <literal role=\"hook\">prechangegroup</literal> "
|
dongsheng@627
|
12088 "(section <xref linkend=\"sec.hook.prechangegroup\"/>), <literal role=\"hook"
|
dongsheng@627
|
12089 "\">pretxnchangegroup</literal> (section <xref linkend=\"sec.hook."
|
dongsheng@627
|
12090 "pretxnchangegroup\"/>)"
|
dongsheng@627
|
12091 msgstr ""
|
dongsheng@627
|
12092
|
dongsheng@627
|
12093 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
12094 #: ../en/ch10-hook.xml:1636
|
dongsheng@627
|
12095 msgid ""
|
dongsheng@627
|
12096 "<literal role=\"hook\">outgoing</literal>&emdash;after changesets are "
|
dongsheng@627
|
12097 "propagated"
|
dongsheng@635
|
12098 msgstr "<literal role=\"hook\">outgoing</literal>&emdash;传播修改集之后"
|
dongsheng@627
|
12099
|
dongsheng@627
|
12100 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12101 #: ../en/ch10-hook.xml:1639
|
dongsheng@627
|
12102 msgid ""
|
dongsheng@627
|
12103 "This hook is run after a group of changesets has been propagated out of this "
|
dongsheng@627
|
12104 "repository, for example by a <command role=\"hg-cmd\">hg push</command> or "
|
dongsheng@627
|
12105 "<command role=\"hg-cmd\">hg bundle</command> command."
|
dongsheng@627
|
12106 msgstr ""
|
dongsheng@627
|
12107
|
dongsheng@627
|
12108 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12109 #: ../en/ch10-hook.xml:1645
|
dongsheng@627
|
12110 msgid ""
|
dongsheng@627
|
12111 "One possible use for this hook is to notify administrators that changes have "
|
dongsheng@627
|
12112 "been pulled."
|
dongsheng@627
|
12113 msgstr ""
|
dongsheng@627
|
12114
|
dongsheng@627
|
12115 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
12116 #: ../en/ch10-hook.xml:1652
|
dongsheng@627
|
12117 msgid ""
|
dongsheng@627
|
12118 "<literal>node</literal>: A changeset ID. The changeset ID of the first "
|
dongsheng@627
|
12119 "changeset of the group that was sent."
|
dongsheng@627
|
12120 msgstr ""
|
dongsheng@627
|
12121
|
dongsheng@627
|
12122 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
12123 #: ../en/ch10-hook.xml:1657
|
dongsheng@627
|
12124 msgid ""
|
dongsheng@627
|
12125 "<literal>source</literal>: A string. The source of the of the operation (see "
|
dongsheng@627
|
12126 "section <xref linkend=\"sec.hook.sources\"/>). If a remote client pulled "
|
dongsheng@627
|
12127 "changes from this repository, <literal>source</literal> will be "
|
dongsheng@627
|
12128 "<literal>serve</literal>. If the client that obtained changes from this "
|
dongsheng@627
|
12129 "repository was local, <literal>source</literal> will be <literal>bundle</"
|
dongsheng@627
|
12130 "literal>, <literal>pull</literal>, or <literal>push</literal>, depending on "
|
dongsheng@627
|
12131 "the operation the client performed."
|
dongsheng@627
|
12132 msgstr ""
|
dongsheng@627
|
12133
|
dongsheng@627
|
12134 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12135 #: ../en/ch10-hook.xml:1677
|
dongsheng@627
|
12136 msgid ""
|
dongsheng@627
|
12137 "See also: <literal role=\"hook\">preoutgoing</literal> (section <xref linkend="
|
dongsheng@627
|
12138 "\"sec.hook.preoutgoing\"/>)"
|
dongsheng@627
|
12139 msgstr ""
|
dongsheng@627
|
12140
|
dongsheng@627
|
12141 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
12142 #: ../en/ch10-hook.xml:1683
|
dongsheng@627
|
12143 msgid ""
|
dongsheng@627
|
12144 "<literal role=\"hook\">prechangegroup</literal>&emdash;before starting to add "
|
dongsheng@627
|
12145 "remote changesets"
|
dongsheng@627
|
12146 msgstr ""
|
dongsheng@635
|
12147 "<literal role=\"hook\">prechangegroup</literal>&emdash;增加远程修改集之前"
|
dongsheng@627
|
12148
|
dongsheng@627
|
12149 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12150 #: ../en/ch10-hook.xml:1687
|
dongsheng@627
|
12151 msgid ""
|
dongsheng@627
|
12152 "This controlling hook is run before Mercurial begins to add a group of "
|
dongsheng@627
|
12153 "changesets from another repository."
|
dongsheng@627
|
12154 msgstr ""
|
dongsheng@627
|
12155
|
dongsheng@627
|
12156 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12157 #: ../en/ch10-hook.xml:1691
|
dongsheng@627
|
12158 msgid ""
|
dongsheng@627
|
12159 "This hook does not have any information about the changesets to be added, "
|
dongsheng@627
|
12160 "because it is run before transmission of those changesets is allowed to "
|
dongsheng@627
|
12161 "begin. If this hook fails, the changesets will not be transmitted."
|
dongsheng@627
|
12162 msgstr ""
|
dongsheng@627
|
12163
|
dongsheng@627
|
12164 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12165 #: ../en/ch10-hook.xml:1697
|
dongsheng@627
|
12166 msgid ""
|
dongsheng@627
|
12167 "One use for this hook is to prevent external changes from being added to a "
|
dongsheng@627
|
12168 "repository. For example, you could use this to <quote>freeze</quote> a "
|
dongsheng@627
|
12169 "server-hosted branch temporarily or permanently so that users cannot push to "
|
dongsheng@627
|
12170 "it, while still allowing a local administrator to modify the repository."
|
dongsheng@627
|
12171 msgstr ""
|
dongsheng@627
|
12172
|
dongsheng@627
|
12173 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12174 #: ../en/ch10-hook.xml:1719
|
dongsheng@627
|
12175 msgid ""
|
dongsheng@627
|
12176 "See also: <literal role=\"hook\">changegroup</literal> (section <xref linkend="
|
dongsheng@627
|
12177 "\"sec.hook.changegroup\"/>), <literal role=\"hook\">incoming</literal> "
|
dongsheng@627
|
12178 "(section <xref linkend=\"sec.hook.incoming\"/>), , <literal role=\"hook"
|
dongsheng@627
|
12179 "\">pretxnchangegroup</literal> (section <xref linkend=\"sec.hook."
|
dongsheng@627
|
12180 "pretxnchangegroup\"/>)"
|
dongsheng@627
|
12181 msgstr ""
|
dongsheng@627
|
12182
|
dongsheng@627
|
12183 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
12184 #: ../en/ch10-hook.xml:1729
|
dongsheng@627
|
12185 msgid ""
|
dongsheng@627
|
12186 "<literal role=\"hook\">precommit</literal>&emdash;before starting to commit a "
|
dongsheng@627
|
12187 "changeset"
|
dongsheng@635
|
12188 msgstr "<literal role=\"hook\">precommit</literal>&emdash;提交修改集之前"
|
dongsheng@627
|
12189
|
dongsheng@627
|
12190 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12191 #: ../en/ch10-hook.xml:1732
|
dongsheng@627
|
12192 msgid ""
|
dongsheng@627
|
12193 "This hook is run before Mercurial begins to commit a new changeset. It is run "
|
dongsheng@627
|
12194 "before Mercurial has any of the metadata for the commit, such as the files to "
|
dongsheng@627
|
12195 "be committed, the commit message, or the commit date."
|
dongsheng@627
|
12196 msgstr ""
|
dongsheng@627
|
12197
|
dongsheng@627
|
12198 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12199 #: ../en/ch10-hook.xml:1738
|
dongsheng@627
|
12200 msgid ""
|
dongsheng@627
|
12201 "One use for this hook is to disable the ability to commit new changesets, "
|
dongsheng@627
|
12202 "while still allowing incoming changesets. Another is to run a build or test, "
|
dongsheng@627
|
12203 "and only allow the commit to begin if the build or test succeeds."
|
dongsheng@627
|
12204 msgstr ""
|
dongsheng@627
|
12205
|
dongsheng@627
|
12206 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
12207 #: ../en/ch10-hook.xml:1747
|
dongsheng@627
|
12208 msgid ""
|
dongsheng@627
|
12209 "<literal>parent1</literal>: A changeset ID. The changeset ID of the first "
|
dongsheng@627
|
12210 "parent of the working directory."
|
dongsheng@627
|
12211 msgstr ""
|
dongsheng@627
|
12212
|
dongsheng@627
|
12213 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
12214 #: ../en/ch10-hook.xml:1752
|
dongsheng@627
|
12215 msgid ""
|
dongsheng@627
|
12216 "<literal>parent2</literal>: A changeset ID. The changeset ID of the second "
|
dongsheng@627
|
12217 "parent of the working directory."
|
dongsheng@627
|
12218 msgstr ""
|
dongsheng@627
|
12219
|
dongsheng@627
|
12220 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12221 #: ../en/ch10-hook.xml:1757
|
dongsheng@627
|
12222 msgid ""
|
dongsheng@627
|
12223 "If the commit proceeds, the parents of the working directory will become the "
|
dongsheng@627
|
12224 "parents of the new changeset."
|
dongsheng@627
|
12225 msgstr ""
|
dongsheng@627
|
12226
|
dongsheng@627
|
12227 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12228 #: ../en/ch10-hook.xml:1761
|
dongsheng@627
|
12229 msgid ""
|
dongsheng@627
|
12230 "See also: <literal role=\"hook\">commit</literal> (section <xref linkend="
|
dongsheng@627
|
12231 "\"sec.hook.commit\"/>), <literal role=\"hook\">pretxncommit</literal> "
|
dongsheng@627
|
12232 "(section <xref linkend=\"sec.hook.pretxncommit\"/>)"
|
dongsheng@627
|
12233 msgstr ""
|
dongsheng@627
|
12234
|
dongsheng@627
|
12235 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
12236 #: ../en/ch10-hook.xml:1769
|
dongsheng@627
|
12237 msgid ""
|
dongsheng@627
|
12238 "<literal role=\"hook\">preoutgoing</literal>&emdash;before starting to "
|
dongsheng@627
|
12239 "propagate changesets"
|
dongsheng@635
|
12240 msgstr "<literal role=\"hook\">preoutgoing</literal>&emdash;传播修改集之前"
|
dongsheng@627
|
12241
|
dongsheng@627
|
12242 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12243 #: ../en/ch10-hook.xml:1772
|
dongsheng@627
|
12244 msgid ""
|
dongsheng@627
|
12245 "This hook is invoked before Mercurial knows the identities of the changesets "
|
dongsheng@627
|
12246 "to be transmitted."
|
dongsheng@627
|
12247 msgstr ""
|
dongsheng@627
|
12248
|
dongsheng@627
|
12249 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12250 #: ../en/ch10-hook.xml:1776
|
dongsheng@627
|
12251 msgid ""
|
dongsheng@627
|
12252 "One use for this hook is to prevent changes from being transmitted to another "
|
dongsheng@627
|
12253 "repository."
|
dongsheng@627
|
12254 msgstr ""
|
dongsheng@627
|
12255
|
dongsheng@627
|
12256 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
12257 #: ../en/ch10-hook.xml:1783
|
dongsheng@627
|
12258 msgid ""
|
dongsheng@627
|
12259 "<literal>source</literal>: A string. The source of the operation that is "
|
dongsheng@627
|
12260 "attempting to obtain changes from this repository (see section <xref linkend="
|
dongsheng@627
|
12261 "\"sec.hook.sources\"/>). See the documentation for the <literal>source</"
|
dongsheng@627
|
12262 "literal> parameter to the <literal role=\"hook\">outgoing</literal> hook, in "
|
dongsheng@627
|
12263 "section <xref linkend=\"sec.hook.outgoing\"/>, for possible values of this "
|
dongsheng@627
|
12264 "parameter."
|
dongsheng@627
|
12265 msgstr ""
|
dongsheng@627
|
12266
|
dongsheng@627
|
12267 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12268 #: ../en/ch10-hook.xml:1801
|
dongsheng@627
|
12269 msgid ""
|
dongsheng@627
|
12270 "See also: <literal role=\"hook\">outgoing</literal> (section <xref linkend="
|
dongsheng@627
|
12271 "\"sec.hook.outgoing\"/>)"
|
dongsheng@627
|
12272 msgstr ""
|
dongsheng@627
|
12273
|
dongsheng@627
|
12274 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
12275 #: ../en/ch10-hook.xml:1807
|
dongsheng@627
|
12276 msgid ""
|
dongsheng@627
|
12277 "<literal role=\"hook\">pretag</literal>&emdash;before tagging a changeset"
|
dongsheng@635
|
12278 msgstr "<literal role=\"hook\">pretag</literal>&emdash;创建标签之前"
|
dongsheng@627
|
12279
|
dongsheng@627
|
12280 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12281 #: ../en/ch10-hook.xml:1810
|
dongsheng@627
|
12282 msgid ""
|
dongsheng@627
|
12283 "This controlling hook is run before a tag is created. If the hook succeeds, "
|
dongsheng@627
|
12284 "creation of the tag proceeds. If the hook fails, the tag is not created."
|
dongsheng@627
|
12285 msgstr ""
|
dongsheng@627
|
12286
|
dongsheng@627
|
12287 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
12288 #: ../en/ch10-hook.xml:1818
|
dongsheng@627
|
12289 msgid ""
|
dongsheng@627
|
12290 "<literal>local</literal>: A boolean. Whether the tag is local to this "
|
dongsheng@627
|
12291 "repository instance (i.e. stored in <filename role=\"special\">.hg/localtags</"
|
dongsheng@627
|
12292 "filename>) or managed by Mercurial (stored in <filename role=\"special\">."
|
dongsheng@627
|
12293 "hgtags</filename>)."
|
dongsheng@627
|
12294 msgstr ""
|
dongsheng@627
|
12295
|
dongsheng@627
|
12296 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
12297 #: ../en/ch10-hook.xml:1825
|
dongsheng@627
|
12298 msgid ""
|
dongsheng@627
|
12299 "<literal>node</literal>: A changeset ID. The ID of the changeset to be "
|
dongsheng@627
|
12300 "tagged."
|
dongsheng@627
|
12301 msgstr ""
|
dongsheng@627
|
12302
|
dongsheng@627
|
12303 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
12304 #: ../en/ch10-hook.xml:1829
|
dongsheng@627
|
12305 msgid "<literal>tag</literal>: A string. The name of the tag to be created."
|
dongsheng@627
|
12306 msgstr ""
|
dongsheng@627
|
12307
|
dongsheng@627
|
12308 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12309 #: ../en/ch10-hook.xml:1834
|
dongsheng@627
|
12310 msgid ""
|
dongsheng@627
|
12311 "If the tag to be created is revision-controlled, the <literal role=\"hook"
|
dongsheng@627
|
12312 "\">precommit</literal> and <literal role=\"hook\">pretxncommit</literal> "
|
dongsheng@627
|
12313 "hooks (sections <xref linkend=\"sec.hook.commit\"/> and <xref linkend=\"sec."
|
dongsheng@627
|
12314 "hook.pretxncommit\"/>) will also be run."
|
dongsheng@627
|
12315 msgstr ""
|
dongsheng@627
|
12316
|
dongsheng@627
|
12317 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12318 #: ../en/ch10-hook.xml:1841
|
dongsheng@627
|
12319 msgid ""
|
dongsheng@627
|
12320 "See also: <literal role=\"hook\">tag</literal> (section <xref linkend=\"sec."
|
dongsheng@627
|
12321 "hook.tag\"/>)"
|
dongsheng@627
|
12322 msgstr ""
|
dongsheng@627
|
12323
|
dongsheng@627
|
12324 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
12325 #: ../en/ch10-hook.xml:1846
|
dongsheng@627
|
12326 msgid ""
|
dongsheng@627
|
12327 "<literal role=\"hook\">pretxnchangegroup</literal>&emdash;before completing "
|
dongsheng@627
|
12328 "addition of remote changesets"
|
dongsheng@627
|
12329 msgstr ""
|
dongsheng@635
|
12330 "<literal role=\"hook\">pretxnchangegroup</literal>&emdash;完成增加远程修改集之"
|
dongsheng@635
|
12331 "前"
|
dongsheng@627
|
12332
|
dongsheng@627
|
12333 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12334 #: ../en/ch10-hook.xml:1850
|
dongsheng@627
|
12335 msgid ""
|
dongsheng@627
|
12336 "This controlling hook is run before a transaction&emdash;that manages the "
|
dongsheng@627
|
12337 "addition of a group of new changesets from outside the repository&emdash;"
|
dongsheng@627
|
12338 "completes. If the hook succeeds, the transaction completes, and all of the "
|
dongsheng@627
|
12339 "changesets become permanent within this repository. If the hook fails, the "
|
dongsheng@627
|
12340 "transaction is rolled back, and the data for the changesets is erased."
|
dongsheng@627
|
12341 msgstr ""
|
dongsheng@627
|
12342
|
dongsheng@627
|
12343 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12344 #: ../en/ch10-hook.xml:1859
|
dongsheng@627
|
12345 msgid ""
|
dongsheng@627
|
12346 "This hook can access the metadata associated with the almost-added "
|
dongsheng@627
|
12347 "changesets, but it should not do anything permanent with this data. It must "
|
dongsheng@627
|
12348 "also not modify the working directory."
|
dongsheng@627
|
12349 msgstr ""
|
dongsheng@627
|
12350
|
dongsheng@627
|
12351 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12352 #: ../en/ch10-hook.xml:1865
|
dongsheng@627
|
12353 msgid ""
|
dongsheng@627
|
12354 "While this hook is running, if other Mercurial processes access this "
|
dongsheng@627
|
12355 "repository, they will be able to see the almost-added changesets as if they "
|
dongsheng@627
|
12356 "are permanent. This may lead to race conditions if you do not take steps to "
|
dongsheng@627
|
12357 "avoid them."
|
dongsheng@627
|
12358 msgstr ""
|
dongsheng@627
|
12359
|
dongsheng@627
|
12360 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12361 #: ../en/ch10-hook.xml:1872
|
dongsheng@627
|
12362 msgid ""
|
dongsheng@627
|
12363 "This hook can be used to automatically vet a group of changesets. If the "
|
dongsheng@627
|
12364 "hook fails, all of the changesets are <quote>rejected</quote> when the "
|
dongsheng@627
|
12365 "transaction rolls back."
|
dongsheng@627
|
12366 msgstr ""
|
dongsheng@627
|
12367
|
dongsheng@627
|
12368 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12369 #: ../en/ch10-hook.xml:1902
|
dongsheng@627
|
12370 msgid ""
|
dongsheng@627
|
12371 "See also: <literal role=\"hook\">changegroup</literal> (section <xref linkend="
|
dongsheng@627
|
12372 "\"sec.hook.changegroup\"/>), <literal role=\"hook\">incoming</literal> "
|
dongsheng@627
|
12373 "(section <xref linkend=\"sec.hook.incoming\"/>), <literal role=\"hook"
|
dongsheng@627
|
12374 "\">prechangegroup</literal> (section <xref linkend=\"sec.hook.prechangegroup"
|
dongsheng@627
|
12375 "\"/>)"
|
dongsheng@627
|
12376 msgstr ""
|
dongsheng@627
|
12377
|
dongsheng@627
|
12378 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
12379 #: ../en/ch10-hook.xml:1912
|
dongsheng@627
|
12380 msgid ""
|
dongsheng@627
|
12381 "<literal role=\"hook\">pretxncommit</literal>&emdash;before completing commit "
|
dongsheng@627
|
12382 "of new changeset"
|
dongsheng@635
|
12383 msgstr "<literal role=\"hook\">pretxncommit</literal>&emdash;完成提交之前"
|
dongsheng@627
|
12384
|
dongsheng@627
|
12385 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12386 #: ../en/ch10-hook.xml:1915
|
dongsheng@627
|
12387 msgid ""
|
dongsheng@627
|
12388 "This controlling hook is run before a transaction&emdash;that manages a new "
|
dongsheng@627
|
12389 "commit&emdash;completes. If the hook succeeds, the transaction completes and "
|
dongsheng@627
|
12390 "the changeset becomes permanent within this repository. If the hook fails, "
|
dongsheng@627
|
12391 "the transaction is rolled back, and the commit data is erased."
|
dongsheng@627
|
12392 msgstr ""
|
dongsheng@627
|
12393
|
dongsheng@627
|
12394 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12395 #: ../en/ch10-hook.xml:1923
|
dongsheng@627
|
12396 msgid ""
|
dongsheng@627
|
12397 "This hook can access the metadata associated with the almost-new changeset, "
|
dongsheng@627
|
12398 "but it should not do anything permanent with this data. It must also not "
|
dongsheng@627
|
12399 "modify the working directory."
|
dongsheng@627
|
12400 msgstr ""
|
dongsheng@627
|
12401
|
dongsheng@627
|
12402 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12403 #: ../en/ch10-hook.xml:1929
|
dongsheng@627
|
12404 msgid ""
|
dongsheng@627
|
12405 "While this hook is running, if other Mercurial processes access this "
|
dongsheng@627
|
12406 "repository, they will be able to see the almost-new changeset as if it is "
|
dongsheng@627
|
12407 "permanent. This may lead to race conditions if you do not take steps to "
|
dongsheng@627
|
12408 "avoid them."
|
dongsheng@627
|
12409 msgstr ""
|
dongsheng@627
|
12410
|
dongsheng@627
|
12411 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12412 #: ../en/ch10-hook.xml:1953
|
dongsheng@627
|
12413 msgid ""
|
dongsheng@627
|
12414 "See also: <literal role=\"hook\">precommit</literal> (section <xref linkend="
|
dongsheng@627
|
12415 "\"sec.hook.precommit\"/>)"
|
dongsheng@627
|
12416 msgstr ""
|
dongsheng@627
|
12417
|
dongsheng@627
|
12418 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
12419 #: ../en/ch10-hook.xml:1959
|
dongsheng@627
|
12420 msgid ""
|
dongsheng@627
|
12421 "<literal role=\"hook\">preupdate</literal>&emdash;before updating or merging "
|
dongsheng@627
|
12422 "working directory"
|
dongsheng@627
|
12423 msgstr ""
|
dongsheng@635
|
12424 "<literal role=\"hook\">preupdate</literal>&emdash;更新或合并工作目录之前"
|
dongsheng@627
|
12425
|
dongsheng@627
|
12426 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12427 #: ../en/ch10-hook.xml:1962
|
dongsheng@627
|
12428 msgid ""
|
dongsheng@627
|
12429 "This controlling hook is run before an update or merge of the working "
|
dongsheng@627
|
12430 "directory begins. It is run only if Mercurial's normal pre-update checks "
|
dongsheng@627
|
12431 "determine that the update or merge can proceed. If the hook succeeds, the "
|
dongsheng@627
|
12432 "update or merge may proceed; if it fails, the update or merge does not start."
|
dongsheng@627
|
12433 msgstr ""
|
dongsheng@627
|
12434
|
dongsheng@627
|
12435 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
12436 #: ../en/ch10-hook.xml:1972
|
dongsheng@627
|
12437 msgid ""
|
dongsheng@627
|
12438 "<literal>parent1</literal>: A changeset ID. The ID of the parent that the "
|
dongsheng@627
|
12439 "working directory is to be updated to. If the working directory is being "
|
dongsheng@627
|
12440 "merged, it will not change this parent."
|
dongsheng@627
|
12441 msgstr ""
|
dongsheng@627
|
12442
|
dongsheng@627
|
12443 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
12444 #: ../en/ch10-hook.xml:1978
|
dongsheng@627
|
12445 msgid ""
|
dongsheng@627
|
12446 "<literal>parent2</literal>: A changeset ID. Only set if the working "
|
dongsheng@627
|
12447 "directory is being merged. The ID of the revision that the working directory "
|
dongsheng@627
|
12448 "is being merged with."
|
dongsheng@627
|
12449 msgstr ""
|
dongsheng@627
|
12450
|
dongsheng@627
|
12451 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12452 #: ../en/ch10-hook.xml:1985
|
dongsheng@627
|
12453 msgid ""
|
dongsheng@627
|
12454 "See also: <literal role=\"hook\">update</literal> (section <xref linkend="
|
dongsheng@627
|
12455 "\"sec.hook.update\"/>)"
|
dongsheng@627
|
12456 msgstr ""
|
dongsheng@627
|
12457
|
dongsheng@627
|
12458 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
12459 #: ../en/ch10-hook.xml:1991
|
dongsheng@627
|
12460 msgid "<literal role=\"hook\">tag</literal>&emdash;after tagging a changeset"
|
dongsheng@635
|
12461 msgstr "<literal role=\"hook\">tag</literal>&emdash;创建标签之后"
|
dongsheng@627
|
12462
|
dongsheng@627
|
12463 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12464 #: ../en/ch10-hook.xml:1994
|
dongsheng@627
|
12465 msgid "This hook is run after a tag has been created."
|
dongsheng@627
|
12466 msgstr ""
|
dongsheng@627
|
12467
|
dongsheng@627
|
12468 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
12469 #: ../en/ch10-hook.xml:2000
|
dongsheng@627
|
12470 msgid ""
|
dongsheng@627
|
12471 "<literal>local</literal>: A boolean. Whether the new tag is local to this "
|
dongsheng@627
|
12472 "repository instance (i.e. stored in <filename role=\"special\">.hg/"
|
dongsheng@627
|
12473 "localtags</filename>) or managed by Mercurial (stored in <filename role="
|
dongsheng@627
|
12474 "\"special\">.hgtags</filename>)."
|
dongsheng@627
|
12475 msgstr ""
|
dongsheng@627
|
12476
|
dongsheng@627
|
12477 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
12478 #: ../en/ch10-hook.xml:2008
|
dongsheng@627
|
12479 msgid ""
|
dongsheng@627
|
12480 "<literal>node</literal>: A changeset ID. The ID of the changeset that was "
|
dongsheng@627
|
12481 "tagged."
|
dongsheng@627
|
12482 msgstr ""
|
dongsheng@627
|
12483
|
dongsheng@627
|
12484 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
12485 #: ../en/ch10-hook.xml:2012
|
dongsheng@627
|
12486 msgid "<literal>tag</literal>: A string. The name of the tag that was created."
|
dongsheng@627
|
12487 msgstr ""
|
dongsheng@627
|
12488
|
dongsheng@627
|
12489 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12490 #: ../en/ch10-hook.xml:2017
|
dongsheng@627
|
12491 msgid ""
|
dongsheng@627
|
12492 "If the created tag is revision-controlled, the <literal role=\"hook\">commit</"
|
dongsheng@627
|
12493 "literal> hook (section <xref linkend=\"sec.hook.commit\"/>) is run before "
|
dongsheng@627
|
12494 "this hook."
|
dongsheng@627
|
12495 msgstr ""
|
dongsheng@627
|
12496
|
dongsheng@627
|
12497 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12498 #: ../en/ch10-hook.xml:2022
|
dongsheng@627
|
12499 msgid ""
|
dongsheng@627
|
12500 "See also: <literal role=\"hook\">pretag</literal> (section <xref linkend="
|
dongsheng@627
|
12501 "\"sec.hook.pretag\"/>)"
|
dongsheng@627
|
12502 msgstr ""
|
dongsheng@627
|
12503
|
dongsheng@627
|
12504 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
12505 #: ../en/ch10-hook.xml:2028
|
dongsheng@627
|
12506 msgid ""
|
dongsheng@627
|
12507 "<literal role=\"hook\">update</literal>&emdash;after updating or merging "
|
dongsheng@627
|
12508 "working directory"
|
dongsheng@635
|
12509 msgstr "<literal role=\"hook\">update</literal>&emdash;更新或合并工作目录之后"
|
dongsheng@627
|
12510
|
dongsheng@627
|
12511 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12512 #: ../en/ch10-hook.xml:2031
|
dongsheng@627
|
12513 msgid ""
|
dongsheng@627
|
12514 "This hook is run after an update or merge of the working directory "
|
dongsheng@627
|
12515 "completes. Since a merge can fail (if the external <command>hgmerge</"
|
dongsheng@627
|
12516 "command> command fails to resolve conflicts in a file), this hook "
|
dongsheng@627
|
12517 "communicates whether the update or merge completed cleanly."
|
dongsheng@627
|
12518 msgstr ""
|
dongsheng@627
|
12519
|
dongsheng@627
|
12520 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
12521 #: ../en/ch10-hook.xml:2039
|
dongsheng@627
|
12522 msgid ""
|
dongsheng@627
|
12523 "<literal>error</literal>: A boolean. Indicates whether the update or merge "
|
dongsheng@627
|
12524 "completed successfully."
|
dongsheng@627
|
12525 msgstr ""
|
dongsheng@627
|
12526
|
dongsheng@627
|
12527 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
12528 #: ../en/ch10-hook.xml:2044
|
dongsheng@627
|
12529 msgid ""
|
dongsheng@627
|
12530 "<literal>parent1</literal>: A changeset ID. The ID of the parent that the "
|
dongsheng@627
|
12531 "working directory was updated to. If the working directory was merged, it "
|
dongsheng@627
|
12532 "will not have changed this parent."
|
dongsheng@627
|
12533 msgstr ""
|
dongsheng@627
|
12534
|
dongsheng@627
|
12535 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
12536 #: ../en/ch10-hook.xml:2050
|
dongsheng@627
|
12537 msgid ""
|
dongsheng@627
|
12538 "<literal>parent2</literal>: A changeset ID. Only set if the working "
|
dongsheng@627
|
12539 "directory was merged. The ID of the revision that the working directory was "
|
dongsheng@627
|
12540 "merged with."
|
dongsheng@627
|
12541 msgstr ""
|
dongsheng@627
|
12542
|
dongsheng@627
|
12543 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12544 #: ../en/ch10-hook.xml:2056
|
dongsheng@627
|
12545 msgid ""
|
dongsheng@627
|
12546 "See also: <literal role=\"hook\">preupdate</literal> (section <xref linkend="
|
dongsheng@627
|
12547 "\"sec.hook.preupdate\"/>)"
|
dongsheng@627
|
12548 msgstr ""
|
dongsheng@627
|
12549
|
dongsheng@627
|
12550 #. type: Content of: <book><chapter><title>
|
dongsheng@627
|
12551 #: ../en/ch11-template.xml:5
|
dongsheng@627
|
12552 msgid "Customising the output of Mercurial"
|
dongsheng@627
|
12553 msgstr "定制 Mercurial 的输出"
|
dongsheng@627
|
12554
|
dongsheng@627
|
12555 #. type: Content of: <book><chapter><para>
|
dongsheng@627
|
12556 #: ../en/ch11-template.xml:7
|
dongsheng@627
|
12557 msgid ""
|
dongsheng@627
|
12558 "Mercurial provides a powerful mechanism to let you control how it displays "
|
dongsheng@627
|
12559 "information. The mechanism is based on templates. You can use templates to "
|
dongsheng@627
|
12560 "generate specific output for a single command, or to customise the entire "
|
dongsheng@627
|
12561 "appearance of the built-in web interface."
|
dongsheng@627
|
12562 msgstr ""
|
dongsheng@627
|
12563
|
dongsheng@627
|
12564 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
12565 #: ../en/ch11-template.xml:14
|
dongsheng@627
|
12566 msgid "Using precanned output styles"
|
dongsheng@636
|
12567 msgstr "使用预定义的输出样式"
|
dongsheng@627
|
12568
|
dongsheng@627
|
12569 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12570 #: ../en/ch11-template.xml:16
|
dongsheng@627
|
12571 msgid ""
|
dongsheng@627
|
12572 "Packaged with Mercurial are some output styles that you can use immediately. "
|
dongsheng@627
|
12573 "A style is simply a precanned template that someone wrote and installed "
|
dongsheng@627
|
12574 "somewhere that Mercurial can find."
|
dongsheng@627
|
12575 msgstr ""
|
dongsheng@627
|
12576
|
dongsheng@627
|
12577 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12578 #: ../en/ch11-template.xml:21
|
dongsheng@627
|
12579 msgid ""
|
dongsheng@627
|
12580 "Before we take a look at Mercurial's bundled styles, let's review its normal "
|
dongsheng@627
|
12581 "output."
|
dongsheng@627
|
12582 msgstr ""
|
dongsheng@627
|
12583
|
dongsheng@627
|
12584 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12585 #: ../en/ch11-template.xml:26
|
dongsheng@627
|
12586 msgid ""
|
dongsheng@627
|
12587 "This is somewhat informative, but it takes up a lot of space&emdash;five "
|
dongsheng@627
|
12588 "lines of output per changeset. The <literal>compact</literal> style reduces "
|
dongsheng@627
|
12589 "this to three lines, presented in a sparse manner."
|
dongsheng@627
|
12590 msgstr ""
|
dongsheng@627
|
12591
|
dongsheng@627
|
12592 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12593 #: ../en/ch11-template.xml:33
|
dongsheng@627
|
12594 msgid ""
|
dongsheng@627
|
12595 "The <literal>changelog</literal> style hints at the expressive power of "
|
dongsheng@627
|
12596 "Mercurial's templating engine. This style attempts to follow the GNU "
|
dongsheng@627
|
12597 "Project's changelog guidelines<citation>web:changelog</citation>."
|
dongsheng@627
|
12598 msgstr ""
|
dongsheng@627
|
12599
|
dongsheng@627
|
12600 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12601 #: ../en/ch11-template.xml:40
|
dongsheng@627
|
12602 msgid ""
|
dongsheng@627
|
12603 "You will not be shocked to learn that Mercurial's default output style is "
|
dongsheng@627
|
12604 "named <literal>default</literal>."
|
dongsheng@627
|
12605 msgstr ""
|
dongsheng@627
|
12606
|
dongsheng@627
|
12607 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
12608 #: ../en/ch11-template.xml:44
|
dongsheng@627
|
12609 msgid "Setting a default style"
|
dongsheng@636
|
12610 msgstr "设置默认样式"
|
dongsheng@627
|
12611
|
dongsheng@627
|
12612 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12613 #: ../en/ch11-template.xml:46
|
dongsheng@627
|
12614 msgid ""
|
dongsheng@627
|
12615 "You can modify the output style that Mercurial will use for every command by "
|
dongsheng@627
|
12616 "editing your <filename role=\"special\"> /.hgrc</filename>\\ file, naming the "
|
dongsheng@627
|
12617 "style you would prefer to use."
|
dongsheng@627
|
12618 msgstr ""
|
dongsheng@627
|
12619
|
dongsheng@627
|
12620 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
12621 #: ../en/ch11-template.xml:53
|
dongsheng@627
|
12622 msgid ""
|
dongsheng@627
|
12623 "If you write a style of your own, you can use it by either providing the path "
|
dongsheng@627
|
12624 "to your style file, or copying your style file into a location where "
|
dongsheng@627
|
12625 "Mercurial can find it (typically the <literal>templates</literal> "
|
dongsheng@627
|
12626 "subdirectory of your Mercurial install directory)."
|
dongsheng@627
|
12627 msgstr ""
|
dongsheng@627
|
12628
|
dongsheng@627
|
12629 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
12630 #: ../en/ch11-template.xml:62
|
dongsheng@627
|
12631 msgid "Commands that support styles and templates"
|
dongsheng@636
|
12632 msgstr "支持样式和模版的命令"
|
dongsheng@627
|
12633
|
dongsheng@627
|
12634 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12635 #: ../en/ch11-template.xml:64
|
dongsheng@627
|
12636 msgid ""
|
dongsheng@627
|
12637 "All of Mercurial's <quote><literal>log</literal>-like</quote> commands let "
|
dongsheng@627
|
12638 "you use styles and templates: <command role=\"hg-cmd\">hg incoming</command>, "
|
dongsheng@627
|
12639 "<command role=\"hg-cmd\">hg log</command>, <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
12640 "outgoing</command>, and <command role=\"hg-cmd\">hg tip</command>."
|
dongsheng@627
|
12641 msgstr ""
|
dongsheng@627
|
12642
|
dongsheng@627
|
12643 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12644 #: ../en/ch11-template.xml:71
|
dongsheng@627
|
12645 msgid ""
|
dongsheng@627
|
12646 "As I write this manual, these are so far the only commands that support "
|
dongsheng@627
|
12647 "styles and templates. Since these are the most important commands that need "
|
dongsheng@627
|
12648 "customisable output, there has been little pressure from the Mercurial user "
|
dongsheng@627
|
12649 "community to add style and template support to other commands."
|
dongsheng@627
|
12650 msgstr ""
|
dongsheng@627
|
12651
|
dongsheng@627
|
12652 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
12653 #: ../en/ch11-template.xml:79
|
dongsheng@627
|
12654 msgid "The basics of templating"
|
dongsheng@636
|
12655 msgstr "模版基础"
|
dongsheng@627
|
12656
|
dongsheng@627
|
12657 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12658 #: ../en/ch11-template.xml:81
|
dongsheng@627
|
12659 msgid ""
|
dongsheng@627
|
12660 "At its simplest, a Mercurial template is a piece of text. Some of the text "
|
dongsheng@627
|
12661 "never changes, while other parts are <emphasis>expanded</emphasis>, or "
|
dongsheng@627
|
12662 "replaced with new text, when necessary."
|
dongsheng@627
|
12663 msgstr ""
|
dongsheng@627
|
12664
|
dongsheng@627
|
12665 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12666 #: ../en/ch11-template.xml:86
|
dongsheng@627
|
12667 msgid ""
|
dongsheng@627
|
12668 "Before we continue, let's look again at a simple example of Mercurial's "
|
dongsheng@627
|
12669 "normal output."
|
dongsheng@627
|
12670 msgstr ""
|
dongsheng@627
|
12671
|
dongsheng@627
|
12672 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12673 #: ../en/ch11-template.xml:91
|
dongsheng@627
|
12674 msgid ""
|
dongsheng@627
|
12675 "Now, let's run the same command, but using a template to change its output."
|
dongsheng@627
|
12676 msgstr ""
|
dongsheng@627
|
12677
|
dongsheng@627
|
12678 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12679 #: ../en/ch11-template.xml:96
|
dongsheng@627
|
12680 msgid ""
|
dongsheng@627
|
12681 "The example above illustrates the simplest possible template; it's just a "
|
dongsheng@627
|
12682 "piece of static text, printed once for each changeset. The <option role=\"hg-"
|
dongsheng@627
|
12683 "opt-log\">--template</option> option to the <command role=\"hg-cmd\">hg log</"
|
dongsheng@627
|
12684 "command> command tells Mercurial to use the given text as the template when "
|
dongsheng@627
|
12685 "printing each changeset."
|
dongsheng@627
|
12686 msgstr ""
|
dongsheng@627
|
12687
|
dongsheng@627
|
12688 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12689 #: ../en/ch11-template.xml:104
|
dongsheng@627
|
12690 msgid ""
|
dongsheng@627
|
12691 "Notice that the template string above ends with the text <quote><literal>\\n</"
|
dongsheng@627
|
12692 "literal></quote>. This is an <emphasis>escape sequence</emphasis>, telling "
|
dongsheng@627
|
12693 "Mercurial to print a newline at the end of each template item. If you omit "
|
dongsheng@627
|
12694 "this newline, Mercurial will run each piece of output together. See section "
|
dongsheng@627
|
12695 "<xref linkend=\"sec.template.escape\"/> for more details of escape sequences."
|
dongsheng@627
|
12696 msgstr ""
|
dongsheng@627
|
12697
|
dongsheng@627
|
12698 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12699 #: ../en/ch11-template.xml:112
|
dongsheng@627
|
12700 msgid ""
|
dongsheng@627
|
12701 "A template that prints a fixed string of text all the time isn't very useful; "
|
dongsheng@627
|
12702 "let's try something a bit more complex."
|
dongsheng@627
|
12703 msgstr ""
|
dongsheng@627
|
12704
|
dongsheng@627
|
12705 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12706 #: ../en/ch11-template.xml:118
|
dongsheng@627
|
12707 msgid ""
|
dongsheng@627
|
12708 "As you can see, the string <quote><literal>{desc}</literal></quote> in the "
|
dongsheng@627
|
12709 "template has been replaced in the output with the description of each "
|
dongsheng@627
|
12710 "changeset. Every time Mercurial finds text enclosed in curly braces "
|
dongsheng@627
|
12711 "(<quote><literal>{</literal></quote> and <quote><literal>}</literal></"
|
dongsheng@627
|
12712 "quote>), it will try to replace the braces and text with the expansion of "
|
dongsheng@627
|
12713 "whatever is inside. To print a literal curly brace, you must escape it, as "
|
dongsheng@627
|
12714 "described in section <xref linkend=\"sec.template.escape\"/>."
|
dongsheng@627
|
12715 msgstr ""
|
dongsheng@627
|
12716
|
dongsheng@627
|
12717 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
12718 #: ../en/ch11-template.xml:131
|
dongsheng@627
|
12719 msgid "Common template keywords"
|
dongsheng@636
|
12720 msgstr "模版关键字"
|
dongsheng@627
|
12721
|
dongsheng@627
|
12722 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12723 #: ../en/ch11-template.xml:133
|
dongsheng@627
|
12724 msgid ""
|
dongsheng@627
|
12725 "You can start writing simple templates immediately using the keywords below."
|
dongsheng@627
|
12726 msgstr ""
|
dongsheng@627
|
12727
|
dongsheng@627
|
12728 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12729 #: ../en/ch11-template.xml:137
|
dongsheng@627
|
12730 msgid ""
|
dongsheng@627
|
12731 "<literal role=\"template-keyword\">author</literal>: String. The unmodified "
|
dongsheng@627
|
12732 "author of the changeset."
|
dongsheng@627
|
12733 msgstr ""
|
dongsheng@627
|
12734
|
dongsheng@627
|
12735 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12736 #: ../en/ch11-template.xml:141
|
dongsheng@627
|
12737 msgid ""
|
dongsheng@627
|
12738 "<literal role=\"template-keyword\">branches</literal>: String. The name of "
|
dongsheng@627
|
12739 "the branch on which the changeset was committed. Will be empty if the branch "
|
dongsheng@627
|
12740 "name was <literal>default</literal>."
|
dongsheng@627
|
12741 msgstr ""
|
dongsheng@627
|
12742
|
dongsheng@627
|
12743 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12744 #: ../en/ch11-template.xml:147
|
dongsheng@627
|
12745 msgid ""
|
dongsheng@627
|
12746 "<literal role=\"template-keyword\">date</literal>: Date information. The "
|
dongsheng@627
|
12747 "date when the changeset was committed. This is <emphasis>not</emphasis> "
|
dongsheng@627
|
12748 "human-readable; you must pass it through a filter that will render it "
|
dongsheng@627
|
12749 "appropriately. See section <xref linkend=\"sec.template.filter\"/> for more "
|
dongsheng@627
|
12750 "information on filters. The date is expressed as a pair of numbers. The "
|
dongsheng@627
|
12751 "first number is a Unix UTC timestamp (seconds since January 1, 1970); the "
|
dongsheng@627
|
12752 "second is the offset of the committer's timezone from UTC, in seconds."
|
dongsheng@627
|
12753 msgstr ""
|
dongsheng@627
|
12754
|
dongsheng@627
|
12755 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12756 #: ../en/ch11-template.xml:158
|
dongsheng@627
|
12757 msgid ""
|
dongsheng@627
|
12758 "<literal role=\"template-keyword\">desc</literal>: String. The text of the "
|
dongsheng@627
|
12759 "changeset description."
|
dongsheng@627
|
12760 msgstr ""
|
dongsheng@627
|
12761
|
dongsheng@627
|
12762 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12763 #: ../en/ch11-template.xml:161
|
dongsheng@627
|
12764 msgid ""
|
dongsheng@627
|
12765 "<literal role=\"template-keyword\">files</literal>: List of strings. All "
|
dongsheng@627
|
12766 "files modified, added, or removed by this changeset."
|
dongsheng@627
|
12767 msgstr ""
|
dongsheng@627
|
12768
|
dongsheng@627
|
12769 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12770 #: ../en/ch11-template.xml:166
|
dongsheng@627
|
12771 msgid ""
|
dongsheng@627
|
12772 "<literal role=\"template-keyword\">file_adds</literal>: List of strings. "
|
dongsheng@627
|
12773 "Files added by this changeset."
|
dongsheng@627
|
12774 msgstr ""
|
dongsheng@627
|
12775
|
dongsheng@627
|
12776 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12777 #: ../en/ch11-template.xml:170
|
dongsheng@627
|
12778 msgid ""
|
dongsheng@627
|
12779 "<literal role=\"template-keyword\">file_dels</literal>: List of strings. "
|
dongsheng@627
|
12780 "Files removed by this changeset."
|
dongsheng@627
|
12781 msgstr ""
|
dongsheng@627
|
12782
|
dongsheng@627
|
12783 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12784 #: ../en/ch11-template.xml:174
|
dongsheng@627
|
12785 msgid ""
|
dongsheng@627
|
12786 "<literal role=\"template-keyword\">node</literal>: String. The changeset "
|
dongsheng@627
|
12787 "identification hash, as a 40-character hexadecimal string."
|
dongsheng@627
|
12788 msgstr ""
|
dongsheng@627
|
12789
|
dongsheng@627
|
12790 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12791 #: ../en/ch11-template.xml:178
|
dongsheng@627
|
12792 msgid ""
|
dongsheng@627
|
12793 "<literal role=\"template-keyword\">parents</literal>: List of strings. The "
|
dongsheng@627
|
12794 "parents of the changeset."
|
dongsheng@627
|
12795 msgstr ""
|
dongsheng@627
|
12796
|
dongsheng@627
|
12797 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12798 #: ../en/ch11-template.xml:182
|
dongsheng@627
|
12799 msgid ""
|
dongsheng@627
|
12800 "<literal role=\"template-keyword\">rev</literal>: Integer. The repository-"
|
dongsheng@627
|
12801 "local changeset revision number."
|
dongsheng@627
|
12802 msgstr ""
|
dongsheng@627
|
12803
|
dongsheng@627
|
12804 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12805 #: ../en/ch11-template.xml:186
|
dongsheng@627
|
12806 msgid ""
|
dongsheng@627
|
12807 "<literal role=\"template-keyword\">tags</literal>: List of strings. Any tags "
|
dongsheng@627
|
12808 "associated with the changeset."
|
dongsheng@627
|
12809 msgstr ""
|
dongsheng@627
|
12810
|
dongsheng@627
|
12811 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12812 #: ../en/ch11-template.xml:191
|
dongsheng@627
|
12813 msgid ""
|
dongsheng@627
|
12814 "A few simple experiments will show us what to expect when we use these "
|
dongsheng@627
|
12815 "keywords; you can see the results below."
|
dongsheng@627
|
12816 msgstr ""
|
dongsheng@627
|
12817
|
dongsheng@627
|
12818 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12819 #: ../en/ch11-template.xml:196
|
dongsheng@627
|
12820 msgid ""
|
dongsheng@627
|
12821 "As we noted above, the date keyword does not produce human-readable output, "
|
dongsheng@627
|
12822 "so we must treat it specially. This involves using a <emphasis>filter</"
|
dongsheng@627
|
12823 "emphasis>, about which more in section <xref linkend=\"sec.template.filter\"/"
|
dongsheng@627
|
12824 ">."
|
dongsheng@627
|
12825 msgstr ""
|
dongsheng@627
|
12826
|
dongsheng@627
|
12827 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
12828 #: ../en/ch11-template.xml:206
|
dongsheng@627
|
12829 msgid "Escape sequences"
|
dongsheng@636
|
12830 msgstr "转义序列"
|
dongsheng@627
|
12831
|
dongsheng@627
|
12832 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12833 #: ../en/ch11-template.xml:208
|
dongsheng@627
|
12834 msgid ""
|
dongsheng@627
|
12835 "Mercurial's templating engine recognises the most commonly used escape "
|
dongsheng@627
|
12836 "sequences in strings. When it sees a backslash (<quote><literal>\\</"
|
dongsheng@627
|
12837 "literal></quote>) character, it looks at the following character and "
|
dongsheng@627
|
12838 "substitutes the two characters with a single replacement, as described below."
|
dongsheng@627
|
12839 msgstr ""
|
dongsheng@627
|
12840
|
dongsheng@627
|
12841 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12842 #: ../en/ch11-template.xml:215
|
dongsheng@627
|
12843 msgid ""
|
dongsheng@627
|
12844 "<literal>\\textbackslash\\textbackslash</literal>: Backslash, <quote><literal>"
|
dongsheng@627
|
12845 "\\</literal></quote>, ASCII 134."
|
dongsheng@627
|
12846 msgstr ""
|
dongsheng@627
|
12847
|
dongsheng@627
|
12848 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12849 #: ../en/ch11-template.xml:219
|
dongsheng@627
|
12850 msgid "<literal>\\textbackslash n</literal>: Newline, ASCII 12."
|
dongsheng@627
|
12851 msgstr ""
|
dongsheng@627
|
12852
|
dongsheng@627
|
12853 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12854 #: ../en/ch11-template.xml:222
|
dongsheng@627
|
12855 msgid "<literal>\\textbackslash r</literal>: Carriage return, ASCII 15."
|
dongsheng@627
|
12856 msgstr ""
|
dongsheng@627
|
12857
|
dongsheng@627
|
12858 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12859 #: ../en/ch11-template.xml:225
|
dongsheng@627
|
12860 msgid "<literal>\\textbackslash t</literal>: Tab, ASCII 11."
|
dongsheng@627
|
12861 msgstr ""
|
dongsheng@627
|
12862
|
dongsheng@627
|
12863 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12864 #: ../en/ch11-template.xml:228
|
dongsheng@627
|
12865 msgid "<literal>\\textbackslash v</literal>: Vertical tab, ASCII 13."
|
dongsheng@627
|
12866 msgstr ""
|
dongsheng@627
|
12867
|
dongsheng@627
|
12868 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12869 #: ../en/ch11-template.xml:231
|
dongsheng@627
|
12870 msgid ""
|
dongsheng@627
|
12871 "<literal>\\textbackslash {</literal>: Open curly brace, <quote><literal>{</"
|
dongsheng@627
|
12872 "literal></quote>, ASCII 173."
|
dongsheng@627
|
12873 msgstr ""
|
dongsheng@627
|
12874
|
dongsheng@627
|
12875 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12876 #: ../en/ch11-template.xml:235
|
dongsheng@627
|
12877 msgid ""
|
dongsheng@627
|
12878 "<literal>\\textbackslash }</literal>: Close curly brace, <quote><literal>}</"
|
dongsheng@627
|
12879 "literal></quote>, ASCII 175."
|
dongsheng@627
|
12880 msgstr ""
|
dongsheng@627
|
12881
|
dongsheng@627
|
12882 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12883 #: ../en/ch11-template.xml:240
|
dongsheng@627
|
12884 msgid ""
|
dongsheng@627
|
12885 "As indicated above, if you want the expansion of a template to contain a "
|
dongsheng@627
|
12886 "literal <quote><literal>\\</literal></quote>, <quote><literal>{</literal></"
|
dongsheng@627
|
12887 "quote>, or <quote><literal>{</literal></quote> character, you must escape it."
|
dongsheng@627
|
12888 msgstr ""
|
dongsheng@627
|
12889
|
dongsheng@627
|
12890 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
12891 #: ../en/ch11-template.xml:248
|
dongsheng@627
|
12892 msgid "Filtering keywords to change their results"
|
dongsheng@636
|
12893 msgstr "通过过滤关键字来修改输出结果"
|
dongsheng@627
|
12894
|
dongsheng@627
|
12895 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12896 #: ../en/ch11-template.xml:250
|
dongsheng@627
|
12897 msgid ""
|
dongsheng@627
|
12898 "Some of the results of template expansion are not immediately easy to use. "
|
dongsheng@627
|
12899 "Mercurial lets you specify an optional chain of <emphasis>filters</emphasis> "
|
dongsheng@627
|
12900 "to modify the result of expanding a keyword. You have already seen a common "
|
dongsheng@627
|
12901 "filter, <literal role=\"template-kw-filt-date\">isodate</literal>, in action "
|
dongsheng@627
|
12902 "above, to make a date readable."
|
dongsheng@627
|
12903 msgstr ""
|
dongsheng@627
|
12904
|
dongsheng@627
|
12905 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
12906 #: ../en/ch11-template.xml:257
|
dongsheng@627
|
12907 msgid ""
|
dongsheng@627
|
12908 "Below is a list of the most commonly used filters that Mercurial supports. "
|
dongsheng@627
|
12909 "While some filters can be applied to any text, others can only be used in "
|
dongsheng@627
|
12910 "specific circumstances. The name of each filter is followed first by an "
|
dongsheng@627
|
12911 "indication of where it can be used, then a description of its effect."
|
dongsheng@627
|
12912 msgstr ""
|
dongsheng@627
|
12913
|
dongsheng@627
|
12914 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12915 #: ../en/ch11-template.xml:264
|
dongsheng@627
|
12916 msgid ""
|
dongsheng@627
|
12917 "<literal role=\"template-filter\">addbreaks</literal>: Any text. Add an XHTML "
|
dongsheng@627
|
12918 "<quote><literal><br/></literal></quote> tag before the end of every "
|
dongsheng@627
|
12919 "line except the last. For example, <quote><literal>foo\\nbar</literal></"
|
dongsheng@627
|
12920 "quote> becomes <quote><literal>foo<br/>\\nbar</literal></quote>."
|
dongsheng@627
|
12921 msgstr ""
|
dongsheng@627
|
12922
|
dongsheng@627
|
12923 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12924 #: ../en/ch11-template.xml:271
|
dongsheng@627
|
12925 msgid ""
|
dongsheng@627
|
12926 "<literal role=\"template-kw-filt-date\">age</literal>: <literal role="
|
dongsheng@627
|
12927 "\"template-keyword\">date</literal> keyword. Render the age of the date, "
|
dongsheng@627
|
12928 "relative to the current time. Yields a string like <quote><literal>10 "
|
dongsheng@627
|
12929 "minutes</literal></quote>."
|
dongsheng@627
|
12930 msgstr ""
|
dongsheng@627
|
12931
|
dongsheng@627
|
12932 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12933 #: ../en/ch11-template.xml:278
|
dongsheng@627
|
12934 msgid ""
|
dongsheng@627
|
12935 "<literal role=\"template-filter\">basename</literal>: Any text, but most "
|
dongsheng@627
|
12936 "useful for the <literal role=\"template-keyword\">files</literal> keyword and "
|
dongsheng@627
|
12937 "its relatives. Treat the text as a path, and return the basename. For "
|
dongsheng@627
|
12938 "example, <quote><literal>foo/bar/baz</literal></quote> becomes "
|
dongsheng@627
|
12939 "<quote><literal>baz</literal></quote>."
|
dongsheng@627
|
12940 msgstr ""
|
dongsheng@627
|
12941
|
dongsheng@627
|
12942 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12943 #: ../en/ch11-template.xml:287
|
dongsheng@627
|
12944 msgid ""
|
dongsheng@627
|
12945 "<literal role=\"template-kw-filt-date\">date</literal>: <literal role="
|
dongsheng@627
|
12946 "\"template-keyword\">date</literal> keyword. Render a date in a similar "
|
dongsheng@627
|
12947 "format to the Unix <literal role=\"template-keyword\">date</literal> command, "
|
dongsheng@627
|
12948 "but with timezone included. Yields a string like <quote><literal>Mon Sep 04 "
|
dongsheng@627
|
12949 "15:13:13 2006 -0700</literal></quote>."
|
dongsheng@627
|
12950 msgstr ""
|
dongsheng@627
|
12951
|
dongsheng@627
|
12952 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12953 #: ../en/ch11-template.xml:295
|
dongsheng@627
|
12954 msgid ""
|
dongsheng@627
|
12955 "<literal role=\"template-kw-filt-author\">domain</literal>: Any text, but "
|
dongsheng@627
|
12956 "most useful for the <literal role=\"template-keyword\">author</literal> "
|
dongsheng@627
|
12957 "keyword. Finds the first string that looks like an email address, and "
|
dongsheng@627
|
12958 "extract just the domain component. For example, <quote><literal>Bryan "
|
dongsheng@627
|
12959 "O'Sullivan <bos@serpentine.com></literal></quote> becomes "
|
dongsheng@627
|
12960 "<quote><literal>serpentine.com</literal></quote>."
|
dongsheng@627
|
12961 msgstr ""
|
dongsheng@627
|
12962
|
dongsheng@627
|
12963 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12964 #: ../en/ch11-template.xml:305
|
dongsheng@627
|
12965 msgid ""
|
dongsheng@627
|
12966 "<literal role=\"template-kw-filt-author\">email</literal>: Any text, but most "
|
dongsheng@627
|
12967 "useful for the <literal role=\"template-keyword\">author</literal> keyword. "
|
dongsheng@627
|
12968 "Extract the first string that looks like an email address. For example, "
|
dongsheng@627
|
12969 "<quote><literal>Bryan O'Sullivan <bos@serpentine.com></literal></quote> "
|
dongsheng@627
|
12970 "becomes <quote><literal>bos@serpentine.com</literal></quote>."
|
dongsheng@627
|
12971 msgstr ""
|
dongsheng@627
|
12972
|
dongsheng@627
|
12973 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12974 #: ../en/ch11-template.xml:314
|
dongsheng@627
|
12975 msgid ""
|
dongsheng@627
|
12976 "<literal role=\"template-filter\">escape</literal>: Any text. Replace the "
|
dongsheng@627
|
12977 "special XML/XHTML characters <quote><literal>&</literal></quote>, "
|
dongsheng@627
|
12978 "<quote><literal><</literal></quote> and <quote><literal>></literal></"
|
dongsheng@627
|
12979 "quote> with XML entities."
|
dongsheng@627
|
12980 msgstr ""
|
dongsheng@627
|
12981
|
dongsheng@627
|
12982 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12983 #: ../en/ch11-template.xml:322
|
dongsheng@627
|
12984 msgid ""
|
dongsheng@627
|
12985 "<literal role=\"template-filter\">fill68</literal>: Any text. Wrap the text "
|
dongsheng@627
|
12986 "to fit in 68 columns. This is useful before you pass text through the "
|
dongsheng@627
|
12987 "<literal role=\"template-filter\">tabindent</literal> filter, and still want "
|
dongsheng@627
|
12988 "it to fit in an 80-column fixed-font window."
|
dongsheng@627
|
12989 msgstr ""
|
dongsheng@627
|
12990
|
dongsheng@627
|
12991 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12992 #: ../en/ch11-template.xml:330
|
dongsheng@627
|
12993 msgid ""
|
dongsheng@627
|
12994 "<literal role=\"template-filter\">fill76</literal>: Any text. Wrap the text "
|
dongsheng@627
|
12995 "to fit in 76 columns."
|
dongsheng@627
|
12996 msgstr ""
|
dongsheng@627
|
12997
|
dongsheng@627
|
12998 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
12999 #: ../en/ch11-template.xml:334
|
dongsheng@627
|
13000 msgid ""
|
dongsheng@627
|
13001 "<literal role=\"template-filter\">firstline</literal>: Any text. Yield the "
|
dongsheng@627
|
13002 "first line of text, without any trailing newlines."
|
dongsheng@627
|
13003 msgstr ""
|
dongsheng@627
|
13004
|
dongsheng@627
|
13005 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
13006 #: ../en/ch11-template.xml:339
|
dongsheng@627
|
13007 msgid ""
|
dongsheng@627
|
13008 "<literal role=\"template-kw-filt-date\">hgdate</literal>: <literal role="
|
dongsheng@627
|
13009 "\"template-keyword\">date</literal> keyword. Render the date as a pair of "
|
dongsheng@627
|
13010 "readable numbers. Yields a string like <quote><literal>1157407993 25200</"
|
dongsheng@627
|
13011 "literal></quote>."
|
dongsheng@627
|
13012 msgstr ""
|
dongsheng@627
|
13013
|
dongsheng@627
|
13014 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
13015 #: ../en/ch11-template.xml:346
|
dongsheng@627
|
13016 msgid ""
|
dongsheng@627
|
13017 "<literal role=\"template-kw-filt-date\">isodate</literal>: <literal role="
|
dongsheng@627
|
13018 "\"template-keyword\">date</literal> keyword. Render the date as a text "
|
dongsheng@627
|
13019 "string in ISO 8601 format. Yields a string like <quote><literal>2006-09-04 "
|
dongsheng@627
|
13020 "15:13:13 -0700</literal></quote>."
|
dongsheng@627
|
13021 msgstr ""
|
dongsheng@627
|
13022
|
dongsheng@627
|
13023 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
13024 #: ../en/ch11-template.xml:353
|
dongsheng@627
|
13025 msgid ""
|
dongsheng@627
|
13026 "<literal role=\"template-filter\">obfuscate</literal>: Any text, but most "
|
dongsheng@627
|
13027 "useful for the <literal role=\"template-keyword\">author</literal> keyword. "
|
dongsheng@627
|
13028 "Yield the input text rendered as a sequence of XML entities. This helps to "
|
dongsheng@627
|
13029 "defeat some particularly stupid screen-scraping email harvesting spambots."
|
dongsheng@627
|
13030 msgstr ""
|
dongsheng@627
|
13031
|
dongsheng@627
|
13032 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
13033 #: ../en/ch11-template.xml:361
|
dongsheng@627
|
13034 msgid ""
|
dongsheng@627
|
13035 "<literal role=\"template-kw-filt-author\">person</literal>: Any text, but "
|
dongsheng@627
|
13036 "most useful for the <literal role=\"template-keyword\">author</literal> "
|
dongsheng@627
|
13037 "keyword. Yield the text before an email address. For example, "
|
dongsheng@627
|
13038 "<quote><literal>Bryan O'Sullivan <bos@serpentine.com></literal></quote> "
|
dongsheng@627
|
13039 "becomes <quote><literal>Bryan O'Sullivan</literal></quote>."
|
dongsheng@627
|
13040 msgstr ""
|
dongsheng@627
|
13041
|
dongsheng@627
|
13042 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
13043 #: ../en/ch11-template.xml:370
|
dongsheng@627
|
13044 msgid ""
|
dongsheng@627
|
13045 "<literal role=\"template-kw-filt-date\">rfc822date</literal>: <literal role="
|
dongsheng@627
|
13046 "\"template-keyword\">date</literal> keyword. Render a date using the same "
|
dongsheng@627
|
13047 "format used in email headers. Yields a string like <quote><literal>Mon, 04 "
|
dongsheng@627
|
13048 "Sep 2006 15:13:13 -0700</literal></quote>."
|
dongsheng@627
|
13049 msgstr ""
|
dongsheng@627
|
13050
|
dongsheng@627
|
13051 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
13052 #: ../en/ch11-template.xml:377
|
dongsheng@627
|
13053 msgid ""
|
dongsheng@627
|
13054 "<literal role=\"template-kw-filt-node\">short</literal>: Changeset hash. "
|
dongsheng@627
|
13055 "Yield the short form of a changeset hash, i.e. a 12-character hexadecimal "
|
dongsheng@627
|
13056 "string."
|
dongsheng@627
|
13057 msgstr ""
|
dongsheng@627
|
13058
|
dongsheng@627
|
13059 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
13060 #: ../en/ch11-template.xml:382
|
dongsheng@627
|
13061 msgid ""
|
dongsheng@627
|
13062 "<literal role=\"template-kw-filt-date\">shortdate</literal>: <literal role="
|
dongsheng@627
|
13063 "\"template-keyword\">date</literal> keyword. Render the year, month, and day "
|
dongsheng@627
|
13064 "of the date. Yields a string like <quote><literal>2006-09-04</literal></"
|
dongsheng@627
|
13065 "quote>."
|
dongsheng@627
|
13066 msgstr ""
|
dongsheng@627
|
13067
|
dongsheng@627
|
13068 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
13069 #: ../en/ch11-template.xml:388
|
dongsheng@627
|
13070 msgid ""
|
dongsheng@627
|
13071 "<literal role=\"template-filter\">strip</literal>: Any text. Strip all "
|
dongsheng@627
|
13072 "leading and trailing whitespace from the string."
|
dongsheng@627
|
13073 msgstr ""
|
dongsheng@627
|
13074
|
dongsheng@627
|
13075 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
13076 #: ../en/ch11-template.xml:392
|
dongsheng@627
|
13077 msgid ""
|
dongsheng@627
|
13078 "<literal role=\"template-filter\">tabindent</literal>: Any text. Yield the "
|
dongsheng@627
|
13079 "text, with every line except the first starting with a tab character."
|
dongsheng@627
|
13080 msgstr ""
|
dongsheng@627
|
13081
|
dongsheng@627
|
13082 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
13083 #: ../en/ch11-template.xml:397
|
dongsheng@627
|
13084 msgid ""
|
dongsheng@627
|
13085 "<literal role=\"template-filter\">urlescape</literal>: Any text. Escape all "
|
dongsheng@627
|
13086 "characters that are considered <quote>special</quote> by URL parsers. For "
|
dongsheng@627
|
13087 "example, <literal>foo bar</literal> becomes <literal>foo%20bar</literal>."
|
dongsheng@627
|
13088 msgstr ""
|
dongsheng@627
|
13089
|
dongsheng@627
|
13090 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
13091 #: ../en/ch11-template.xml:404
|
dongsheng@627
|
13092 msgid ""
|
dongsheng@627
|
13093 "<literal role=\"template-kw-filt-author\">user</literal>: Any text, but most "
|
dongsheng@627
|
13094 "useful for the <literal role=\"template-keyword\">author</literal> keyword. "
|
dongsheng@627
|
13095 "Return the <quote>user</quote> portion of an email address. For example, "
|
dongsheng@627
|
13096 "<quote><literal>Bryan O'Sullivan <bos@serpentine.com></literal></quote> "
|
dongsheng@627
|
13097 "becomes <quote><literal>bos</literal></quote>."
|
dongsheng@627
|
13098 msgstr ""
|
dongsheng@627
|
13099
|
dongsheng@627
|
13100 #. type: Content of: <book><chapter><sect1><note><para>
|
dongsheng@627
|
13101 #: ../en/ch11-template.xml:417
|
dongsheng@627
|
13102 msgid ""
|
dongsheng@627
|
13103 "If you try to apply a filter to a piece of data that it cannot process, "
|
dongsheng@627
|
13104 "Mercurial will fail and print a Python exception. For example, trying to run "
|
dongsheng@627
|
13105 "the output of the <literal role=\"template-keyword\">desc</literal> keyword "
|
dongsheng@627
|
13106 "into the <literal role=\"template-kw-filt-date\">isodate</literal> filter is "
|
dongsheng@627
|
13107 "not a good idea."
|
dongsheng@627
|
13108 msgstr ""
|
dongsheng@627
|
13109
|
dongsheng@627
|
13110 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
13111 #: ../en/ch11-template.xml:426
|
dongsheng@627
|
13112 msgid "Combining filters"
|
dongsheng@636
|
13113 msgstr "组合过滤器"
|
dongsheng@627
|
13114
|
dongsheng@627
|
13115 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13116 #: ../en/ch11-template.xml:428
|
dongsheng@627
|
13117 msgid ""
|
dongsheng@627
|
13118 "It is easy to combine filters to yield output in the form you would like. "
|
dongsheng@627
|
13119 "The following chain of filters tidies up a description, then makes sure that "
|
dongsheng@627
|
13120 "it fits cleanly into 68 columns, then indents it by a further 8 characters "
|
dongsheng@627
|
13121 "(at least on Unix-like systems, where a tab is conventionally 8 characters "
|
dongsheng@627
|
13122 "wide)."
|
dongsheng@627
|
13123 msgstr ""
|
dongsheng@627
|
13124
|
dongsheng@627
|
13125 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13126 #: ../en/ch11-template.xml:437
|
dongsheng@627
|
13127 msgid ""
|
dongsheng@627
|
13128 "Note the use of <quote><literal>\\t</literal></quote> (a tab character) in "
|
dongsheng@627
|
13129 "the template to force the first line to be indented; this is necessary since "
|
dongsheng@627
|
13130 "<literal role=\"template-keyword\">tabindent</literal> indents all lines "
|
dongsheng@627
|
13131 "<emphasis>except</emphasis> the first."
|
dongsheng@627
|
13132 msgstr ""
|
dongsheng@627
|
13133
|
dongsheng@627
|
13134 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13135 #: ../en/ch11-template.xml:443
|
dongsheng@627
|
13136 msgid ""
|
dongsheng@627
|
13137 "Keep in mind that the order of filters in a chain is significant. The first "
|
dongsheng@627
|
13138 "filter is applied to the result of the keyword; the second to the result of "
|
dongsheng@627
|
13139 "the first filter; and so on. For example, using <literal>fill68|tabindent</"
|
dongsheng@627
|
13140 "literal> gives very different results from <literal>tabindent|fill68</"
|
dongsheng@627
|
13141 "literal>."
|
dongsheng@627
|
13142 msgstr ""
|
dongsheng@627
|
13143
|
dongsheng@627
|
13144 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
13145 #: ../en/ch11-template.xml:454
|
dongsheng@627
|
13146 msgid "From templates to styles"
|
dongsheng@636
|
13147 msgstr "从模版到样式"
|
dongsheng@627
|
13148
|
dongsheng@627
|
13149 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13150 #: ../en/ch11-template.xml:456
|
dongsheng@627
|
13151 msgid ""
|
dongsheng@627
|
13152 "A command line template provides a quick and simple way to format some "
|
dongsheng@627
|
13153 "output. Templates can become verbose, though, and it's useful to be able to "
|
dongsheng@627
|
13154 "give a template a name. A style file is a template with a name, stored in a "
|
dongsheng@627
|
13155 "file."
|
dongsheng@627
|
13156 msgstr ""
|
dongsheng@627
|
13157
|
dongsheng@627
|
13158 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13159 #: ../en/ch11-template.xml:461
|
dongsheng@627
|
13160 msgid ""
|
dongsheng@627
|
13161 "More than that, using a style file unlocks the power of Mercurial's "
|
dongsheng@627
|
13162 "templating engine in ways that are not possible using the command line "
|
dongsheng@627
|
13163 "<option role=\"hg-opt-log\">--template</option> option."
|
dongsheng@627
|
13164 msgstr ""
|
dongsheng@627
|
13165
|
dongsheng@627
|
13166 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
13167 #: ../en/ch11-template.xml:467
|
dongsheng@627
|
13168 msgid "The simplest of style files"
|
dongsheng@636
|
13169 msgstr "最简单的样式文件"
|
dongsheng@627
|
13170
|
dongsheng@627
|
13171 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13172 #: ../en/ch11-template.xml:469
|
dongsheng@627
|
13173 msgid "Our simple style file contains just one line:"
|
dongsheng@627
|
13174 msgstr ""
|
dongsheng@627
|
13175
|
dongsheng@627
|
13176 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13177 #: ../en/ch11-template.xml:473
|
dongsheng@627
|
13178 msgid ""
|
dongsheng@627
|
13179 "This tells Mercurial, <quote>if you're printing a changeset, use the text on "
|
dongsheng@627
|
13180 "the right as the template</quote>."
|
dongsheng@627
|
13181 msgstr ""
|
dongsheng@627
|
13182
|
dongsheng@627
|
13183 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
13184 #: ../en/ch11-template.xml:479
|
dongsheng@627
|
13185 msgid "Style file syntax"
|
dongsheng@636
|
13186 msgstr "样式文件语法"
|
dongsheng@627
|
13187
|
dongsheng@627
|
13188 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13189 #: ../en/ch11-template.xml:481
|
dongsheng@627
|
13190 msgid "The syntax rules for a style file are simple."
|
dongsheng@627
|
13191 msgstr ""
|
dongsheng@627
|
13192
|
dongsheng@627
|
13193 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13194 #: ../en/ch11-template.xml:484
|
dongsheng@627
|
13195 msgid "The file is processed one line at a time."
|
dongsheng@627
|
13196 msgstr ""
|
dongsheng@627
|
13197
|
dongsheng@627
|
13198 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13199 #: ../en/ch11-template.xml:487
|
dongsheng@627
|
13200 msgid "Leading and trailing white space are ignored."
|
dongsheng@627
|
13201 msgstr ""
|
dongsheng@627
|
13202
|
dongsheng@627
|
13203 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13204 #: ../en/ch11-template.xml:490
|
dongsheng@627
|
13205 msgid "Empty lines are skipped."
|
dongsheng@627
|
13206 msgstr ""
|
dongsheng@627
|
13207
|
dongsheng@627
|
13208 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13209 #: ../en/ch11-template.xml:492
|
dongsheng@627
|
13210 msgid ""
|
dongsheng@627
|
13211 "If a line starts with either of the characters <quote><literal>#</literal></"
|
dongsheng@627
|
13212 "quote> or <quote><literal>;</literal></quote>, the entire line is treated as "
|
dongsheng@627
|
13213 "a comment, and skipped as if empty."
|
dongsheng@627
|
13214 msgstr ""
|
dongsheng@627
|
13215
|
dongsheng@627
|
13216 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13217 #: ../en/ch11-template.xml:497
|
dongsheng@627
|
13218 msgid ""
|
dongsheng@627
|
13219 "A line starts with a keyword. This must start with an alphabetic character "
|
dongsheng@627
|
13220 "or underscore, and can subsequently contain any alphanumeric character or "
|
dongsheng@627
|
13221 "underscore. (In regexp notation, a keyword must match <literal>[A-Za-z_][A-"
|
dongsheng@627
|
13222 "Za-z0-9_]*</literal>.)"
|
dongsheng@627
|
13223 msgstr ""
|
dongsheng@627
|
13224
|
dongsheng@627
|
13225 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13226 #: ../en/ch11-template.xml:503
|
dongsheng@627
|
13227 msgid ""
|
dongsheng@627
|
13228 "The next element must be an <quote><literal>=</literal></quote> character, "
|
dongsheng@627
|
13229 "which can be preceded or followed by an arbitrary amount of white space."
|
dongsheng@627
|
13230 msgstr ""
|
dongsheng@627
|
13231
|
dongsheng@627
|
13232 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13233 #: ../en/ch11-template.xml:508
|
dongsheng@627
|
13234 msgid ""
|
dongsheng@627
|
13235 "If the rest of the line starts and ends with matching quote characters "
|
dongsheng@627
|
13236 "(either single or double quote), it is treated as a template body."
|
dongsheng@627
|
13237 msgstr ""
|
dongsheng@627
|
13238
|
dongsheng@627
|
13239 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13240 #: ../en/ch11-template.xml:512
|
dongsheng@627
|
13241 msgid ""
|
dongsheng@627
|
13242 "If the rest of the line <emphasis>does not</emphasis> start with a quote "
|
dongsheng@627
|
13243 "character, it is treated as the name of a file; the contents of this file "
|
dongsheng@627
|
13244 "will be read and used as a template body."
|
dongsheng@627
|
13245 msgstr ""
|
dongsheng@627
|
13246
|
dongsheng@627
|
13247 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
13248 #: ../en/ch11-template.xml:521
|
dongsheng@627
|
13249 msgid "Style files by example"
|
dongsheng@636
|
13250 msgstr "样式文件例子"
|
dongsheng@627
|
13251
|
dongsheng@627
|
13252 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13253 #: ../en/ch11-template.xml:523
|
dongsheng@627
|
13254 msgid ""
|
dongsheng@627
|
13255 "To illustrate how to write a style file, we will construct a few by example. "
|
dongsheng@627
|
13256 "Rather than provide a complete style file and walk through it, we'll mirror "
|
dongsheng@627
|
13257 "the usual process of developing a style file by starting with something very "
|
dongsheng@627
|
13258 "simple, and walking through a series of successively more complete examples."
|
dongsheng@627
|
13259 msgstr ""
|
dongsheng@627
|
13260
|
dongsheng@627
|
13261 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
13262 #: ../en/ch11-template.xml:530
|
dongsheng@627
|
13263 msgid "Identifying mistakes in style files"
|
dongsheng@636
|
13264 msgstr "在样式文件中定位错误"
|
dongsheng@627
|
13265
|
dongsheng@627
|
13266 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13267 #: ../en/ch11-template.xml:532
|
dongsheng@627
|
13268 msgid ""
|
dongsheng@627
|
13269 "If Mercurial encounters a problem in a style file you are working on, it "
|
dongsheng@627
|
13270 "prints a terse error message that, once you figure out what it means, is "
|
dongsheng@627
|
13271 "actually quite useful."
|
dongsheng@627
|
13272 msgstr ""
|
dongsheng@627
|
13273
|
dongsheng@627
|
13274 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13275 #: ../en/ch11-template.xml:538
|
dongsheng@627
|
13276 msgid ""
|
dongsheng@627
|
13277 "Notice that <filename>broken.style</filename> attempts to define a "
|
dongsheng@627
|
13278 "<literal>changeset</literal> keyword, but forgets to give any content for it. "
|
dongsheng@627
|
13279 "When instructed to use this style file, Mercurial promptly complains."
|
dongsheng@627
|
13280 msgstr ""
|
dongsheng@627
|
13281
|
dongsheng@627
|
13282 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13283 #: ../en/ch11-template.xml:545
|
dongsheng@627
|
13284 msgid "This error message looks intimidating, but it is not too hard to follow."
|
dongsheng@627
|
13285 msgstr ""
|
dongsheng@627
|
13286
|
dongsheng@627
|
13287 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13288 #: ../en/ch11-template.xml:549
|
dongsheng@627
|
13289 msgid ""
|
dongsheng@627
|
13290 "The first component is simply Mercurial's way of saying <quote>I am giving "
|
dongsheng@627
|
13291 "up</quote>."
|
dongsheng@627
|
13292 msgstr ""
|
dongsheng@627
|
13293
|
dongsheng@627
|
13294 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13295 #: ../en/ch11-template.xml:554
|
dongsheng@627
|
13296 msgid "Next comes the name of the style file that contains the error."
|
dongsheng@627
|
13297 msgstr ""
|
dongsheng@627
|
13298
|
dongsheng@627
|
13299 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13300 #: ../en/ch11-template.xml:560
|
dongsheng@627
|
13301 msgid ""
|
dongsheng@627
|
13302 "Following the file name is the line number where the error was encountered."
|
dongsheng@627
|
13303 msgstr ""
|
dongsheng@627
|
13304
|
dongsheng@627
|
13305 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13306 #: ../en/ch11-template.xml:565
|
dongsheng@627
|
13307 msgid "Finally, a description of what went wrong."
|
dongsheng@627
|
13308 msgstr ""
|
dongsheng@627
|
13309
|
dongsheng@627
|
13310 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13311 #: ../en/ch11-template.xml:570
|
dongsheng@627
|
13312 msgid ""
|
dongsheng@627
|
13313 "The description of the problem is not always clear (as in this case), but "
|
dongsheng@627
|
13314 "even when it is cryptic, it is almost always trivial to visually inspect the "
|
dongsheng@627
|
13315 "offending line in the style file and see what is wrong."
|
dongsheng@627
|
13316 msgstr ""
|
dongsheng@627
|
13317
|
dongsheng@627
|
13318 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
13319 #: ../en/ch11-template.xml:578
|
dongsheng@627
|
13320 msgid "Uniquely identifying a repository"
|
dongsheng@636
|
13321 msgstr "版本库的唯一标识"
|
dongsheng@627
|
13322
|
dongsheng@627
|
13323 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13324 #: ../en/ch11-template.xml:580
|
dongsheng@627
|
13325 msgid ""
|
dongsheng@627
|
13326 "If you would like to be able to identify a Mercurial repository <quote>fairly "
|
dongsheng@627
|
13327 "uniquely</quote> using a short string as an identifier, you can use the first "
|
dongsheng@627
|
13328 "revision in the repository."
|
dongsheng@627
|
13329 msgstr ""
|
dongsheng@627
|
13330
|
dongsheng@627
|
13331 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13332 #: ../en/ch11-template.xml:587
|
dongsheng@627
|
13333 msgid ""
|
dongsheng@627
|
13334 "This is not guaranteed to be unique, but it is nevertheless useful in many "
|
dongsheng@627
|
13335 "cases."
|
dongsheng@627
|
13336 msgstr ""
|
dongsheng@627
|
13337
|
dongsheng@627
|
13338 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13339 #: ../en/ch11-template.xml:590
|
dongsheng@627
|
13340 msgid ""
|
dongsheng@627
|
13341 "It will not work in a completely empty repository, because such a repository "
|
dongsheng@627
|
13342 "does not have a revision zero."
|
dongsheng@627
|
13343 msgstr ""
|
dongsheng@627
|
13344
|
dongsheng@627
|
13345 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13346 #: ../en/ch11-template.xml:594
|
dongsheng@627
|
13347 msgid ""
|
dongsheng@627
|
13348 "Neither will it work in the (extremely rare) case where a repository is a "
|
dongsheng@627
|
13349 "merge of two or more formerly independent repositories, and you still have "
|
dongsheng@627
|
13350 "those repositories around."
|
dongsheng@627
|
13351 msgstr ""
|
dongsheng@627
|
13352
|
dongsheng@627
|
13353 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13354 #: ../en/ch11-template.xml:599
|
dongsheng@627
|
13355 msgid "Here are some uses to which you could put this identifier:"
|
dongsheng@627
|
13356 msgstr ""
|
dongsheng@627
|
13357
|
dongsheng@627
|
13358 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13359 #: ../en/ch11-template.xml:602
|
dongsheng@627
|
13360 msgid ""
|
dongsheng@627
|
13361 "As a key into a table for a database that manages repositories on a server."
|
dongsheng@627
|
13362 msgstr ""
|
dongsheng@627
|
13363
|
dongsheng@627
|
13364 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13365 #: ../en/ch11-template.xml:605
|
dongsheng@627
|
13366 msgid ""
|
dongsheng@627
|
13367 "As half of a {<emphasis>repository ID</emphasis>, <emphasis>revision ID</"
|
dongsheng@627
|
13368 "emphasis>} tuple. Save this information away when you run an automated build "
|
dongsheng@627
|
13369 "or other activity, so that you can <quote>replay</quote> the build later if "
|
dongsheng@627
|
13370 "necessary."
|
dongsheng@627
|
13371 msgstr ""
|
dongsheng@627
|
13372
|
dongsheng@627
|
13373 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
13374 #: ../en/ch11-template.xml:614
|
dongsheng@627
|
13375 msgid "Mimicking Subversion's output"
|
dongsheng@636
|
13376 msgstr "模仿 Subversion 的输出"
|
dongsheng@627
|
13377
|
dongsheng@627
|
13378 #
|
dongsheng@627
|
13379 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13380 #: ../en/ch11-template.xml:616
|
dongsheng@627
|
13381 msgid ""
|
dongsheng@627
|
13382 "Let's try to emulate the default output format used by another revision "
|
dongsheng@627
|
13383 "control tool, Subversion."
|
dongsheng@627
|
13384 msgstr ""
|
dongsheng@627
|
13385
|
dongsheng@627
|
13386 #
|
dongsheng@627
|
13387 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13388 #: ../en/ch11-template.xml:621
|
dongsheng@627
|
13389 msgid ""
|
dongsheng@627
|
13390 "Since Subversion's output style is fairly simple, it is easy to copy-and-"
|
dongsheng@627
|
13391 "paste a hunk of its output into a file, and replace the text produced above "
|
dongsheng@627
|
13392 "by Subversion with the template values we'd like to see expanded."
|
dongsheng@627
|
13393 msgstr ""
|
dongsheng@627
|
13394
|
dongsheng@627
|
13395 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13396 #: ../en/ch11-template.xml:628
|
dongsheng@627
|
13397 msgid ""
|
dongsheng@627
|
13398 "There are a few small ways in which this template deviates from the output "
|
dongsheng@627
|
13399 "produced by Subversion."
|
dongsheng@627
|
13400 msgstr ""
|
dongsheng@627
|
13401
|
dongsheng@627
|
13402 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13403 #: ../en/ch11-template.xml:631
|
dongsheng@627
|
13404 msgid ""
|
dongsheng@627
|
13405 "Subversion prints a <quote>readable</quote> date (the <quote><literal>Wed, 27 "
|
dongsheng@627
|
13406 "Sep 2006</literal></quote> in the example output above) in parentheses. "
|
dongsheng@627
|
13407 "Mercurial's templating engine does not provide a way to display a date in "
|
dongsheng@627
|
13408 "this format without also printing the time and time zone."
|
dongsheng@627
|
13409 msgstr ""
|
dongsheng@627
|
13410
|
dongsheng@627
|
13411 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13412 #: ../en/ch11-template.xml:638
|
dongsheng@627
|
13413 msgid ""
|
dongsheng@627
|
13414 "We emulate Subversion's printing of <quote>separator</quote> lines full of "
|
dongsheng@627
|
13415 "<quote><literal>-</literal></quote> characters by ending the template with "
|
dongsheng@627
|
13416 "such a line. We use the templating engine's <literal role=\"template-keyword"
|
dongsheng@627
|
13417 "\">header</literal> keyword to print a separator line as the first line of "
|
dongsheng@627
|
13418 "output (see below), thus achieving similar output to Subversion."
|
dongsheng@627
|
13419 msgstr ""
|
dongsheng@627
|
13420
|
dongsheng@627
|
13421 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13422 #: ../en/ch11-template.xml:647
|
dongsheng@627
|
13423 msgid ""
|
dongsheng@627
|
13424 "Subversion's output includes a count in the header of the number of lines in "
|
dongsheng@627
|
13425 "the commit message. We cannot replicate this in Mercurial; the templating "
|
dongsheng@627
|
13426 "engine does not currently provide a filter that counts the number of lines "
|
dongsheng@627
|
13427 "the template generates."
|
dongsheng@627
|
13428 msgstr ""
|
dongsheng@627
|
13429
|
dongsheng@627
|
13430 #
|
dongsheng@627
|
13431 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13432 #: ../en/ch11-template.xml:653
|
dongsheng@627
|
13433 msgid ""
|
dongsheng@627
|
13434 "It took me no more than a minute or two of work to replace literal text from "
|
dongsheng@627
|
13435 "an example of Subversion's output with some keywords and filters to give the "
|
dongsheng@627
|
13436 "template above. The style file simply refers to the template."
|
dongsheng@627
|
13437 msgstr ""
|
dongsheng@627
|
13438
|
dongsheng@627
|
13439 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13440 #: ../en/ch11-template.xml:660
|
dongsheng@627
|
13441 msgid ""
|
dongsheng@627
|
13442 "We could have included the text of the template file directly in the style "
|
dongsheng@627
|
13443 "file by enclosing it in quotes and replacing the newlines with "
|
dongsheng@627
|
13444 "<quote><literal>\\n</literal></quote> sequences, but it would have made the "
|
dongsheng@627
|
13445 "style file too difficult to read. Readability is a good guide when you're "
|
dongsheng@627
|
13446 "trying to decide whether some text belongs in a style file, or in a template "
|
dongsheng@627
|
13447 "file that the style file points to. If the style file will look too big or "
|
dongsheng@627
|
13448 "cluttered if you insert a literal piece of text, drop it into a template "
|
dongsheng@627
|
13449 "instead."
|
dongsheng@627
|
13450 msgstr ""
|
dongsheng@627
|
13451
|
dongsheng@627
|
13452 #. type: Content of: <book><chapter><title>
|
dongsheng@627
|
13453 #: ../en/ch12-mq.xml:5
|
dongsheng@627
|
13454 msgid "Managing change with Mercurial Queues"
|
dongsheng@627
|
13455 msgstr "使用 MQ 管理修改"
|
dongsheng@627
|
13456
|
dongsheng@627
|
13457 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
13458 #: ../en/ch12-mq.xml:8
|
dongsheng@627
|
13459 msgid "The patch management problem"
|
dongsheng@636
|
13460 msgstr "补丁的管理问题"
|
dongsheng@627
|
13461
|
dongsheng@627
|
13462 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13463 #: ../en/ch12-mq.xml:10
|
dongsheng@627
|
13464 msgid ""
|
dongsheng@627
|
13465 "Here is a common scenario: you need to install a software package from "
|
dongsheng@627
|
13466 "source, but you find a bug that you must fix in the source before you can "
|
dongsheng@627
|
13467 "start using the package. You make your changes, forget about the package for "
|
dongsheng@627
|
13468 "a while, and a few months later you need to upgrade to a newer version of the "
|
dongsheng@627
|
13469 "package. If the newer version of the package still has the bug, you must "
|
dongsheng@627
|
13470 "extract your fix from the older source tree and apply it against the newer "
|
dongsheng@627
|
13471 "version. This is a tedious task, and it's easy to make mistakes."
|
dongsheng@627
|
13472 msgstr ""
|
dongsheng@627
|
13473
|
dongsheng@627
|
13474 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13475 #: ../en/ch12-mq.xml:20
|
dongsheng@627
|
13476 msgid ""
|
dongsheng@627
|
13477 "This is a simple case of the <quote>patch management</quote> problem. You "
|
dongsheng@627
|
13478 "have an <quote>upstream</quote> source tree that you can't change; you need "
|
dongsheng@627
|
13479 "to make some local changes on top of the upstream tree; and you'd like to be "
|
dongsheng@627
|
13480 "able to keep those changes separate, so that you can apply them to newer "
|
dongsheng@627
|
13481 "versions of the upstream source."
|
dongsheng@627
|
13482 msgstr ""
|
dongsheng@627
|
13483
|
dongsheng@627
|
13484 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13485 #: ../en/ch12-mq.xml:27
|
dongsheng@627
|
13486 msgid ""
|
dongsheng@627
|
13487 "The patch management problem arises in many situations. Probably the most "
|
dongsheng@627
|
13488 "visible is that a user of an open source software project will contribute a "
|
dongsheng@627
|
13489 "bug fix or new feature to the project's maintainers in the form of a patch."
|
dongsheng@627
|
13490 msgstr ""
|
dongsheng@627
|
13491
|
dongsheng@627
|
13492 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13493 #: ../en/ch12-mq.xml:32
|
dongsheng@627
|
13494 msgid ""
|
dongsheng@627
|
13495 "Distributors of operating systems that include open source software often "
|
dongsheng@627
|
13496 "need to make changes to the packages they distribute so that they will build "
|
dongsheng@627
|
13497 "properly in their environments."
|
dongsheng@627
|
13498 msgstr ""
|
dongsheng@627
|
13499
|
dongsheng@627
|
13500 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13501 #: ../en/ch12-mq.xml:37
|
dongsheng@627
|
13502 msgid ""
|
dongsheng@627
|
13503 "When you have few changes to maintain, it is easy to manage a single patch "
|
dongsheng@627
|
13504 "using the standard <command>diff</command> and <command>patch</command> "
|
dongsheng@627
|
13505 "programs (see section <xref linkend=\"sec.mq.patch\"/> for a discussion of "
|
dongsheng@627
|
13506 "these tools). Once the number of changes grows, it starts to make sense to "
|
dongsheng@627
|
13507 "maintain patches as discrete <quote>chunks of work,</quote> so that for "
|
dongsheng@627
|
13508 "example a single patch will contain only one bug fix (the patch might modify "
|
dongsheng@627
|
13509 "several files, but it's doing <quote>only one thing</quote>), and you may "
|
dongsheng@627
|
13510 "have a number of such patches for different bugs you need fixed and local "
|
dongsheng@627
|
13511 "changes you require. In this situation, if you submit a bug fix patch to the "
|
dongsheng@627
|
13512 "upstream maintainers of a package and they include your fix in a subsequent "
|
dongsheng@627
|
13513 "release, you can simply drop that single patch when you're updating to the "
|
dongsheng@627
|
13514 "newer release."
|
dongsheng@627
|
13515 msgstr ""
|
dongsheng@627
|
13516
|
dongsheng@627
|
13517 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13518 #: ../en/ch12-mq.xml:52
|
dongsheng@627
|
13519 msgid ""
|
dongsheng@627
|
13520 "Maintaining a single patch against an upstream tree is a little tedious and "
|
dongsheng@627
|
13521 "error-prone, but not difficult. However, the complexity of the problem grows "
|
dongsheng@627
|
13522 "rapidly as the number of patches you have to maintain increases. With more "
|
dongsheng@627
|
13523 "than a tiny number of patches in hand, understanding which ones you have "
|
dongsheng@627
|
13524 "applied and maintaining them moves from messy to overwhelming."
|
dongsheng@627
|
13525 msgstr ""
|
dongsheng@627
|
13526
|
dongsheng@627
|
13527 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13528 #: ../en/ch12-mq.xml:59
|
dongsheng@627
|
13529 msgid ""
|
dongsheng@627
|
13530 "Fortunately, Mercurial includes a powerful extension, Mercurial Queues (or "
|
dongsheng@627
|
13531 "simply <quote>MQ</quote>), that massively simplifies the patch management "
|
dongsheng@627
|
13532 "problem."
|
dongsheng@627
|
13533 msgstr ""
|
dongsheng@627
|
13534
|
dongsheng@627
|
13535 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
13536 #: ../en/ch12-mq.xml:65
|
dongsheng@627
|
13537 msgid "The prehistory of Mercurial Queues"
|
dongsheng@636
|
13538 msgstr "MQ 的历史"
|
dongsheng@627
|
13539
|
dongsheng@627
|
13540 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13541 #: ../en/ch12-mq.xml:67
|
dongsheng@627
|
13542 msgid ""
|
dongsheng@627
|
13543 "During the late 1990s, several Linux kernel developers started to maintain "
|
dongsheng@627
|
13544 "<quote>patch series</quote> that modified the behaviour of the Linux kernel. "
|
dongsheng@627
|
13545 "Some of these series were focused on stability, some on feature coverage, and "
|
dongsheng@627
|
13546 "others were more speculative."
|
dongsheng@627
|
13547 msgstr ""
|
dongsheng@627
|
13548
|
dongsheng@627
|
13549 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13550 #: ../en/ch12-mq.xml:73
|
dongsheng@627
|
13551 msgid ""
|
dongsheng@627
|
13552 "The sizes of these patch series grew rapidly. In 2002, Andrew Morton "
|
dongsheng@627
|
13553 "published some shell scripts he had been using to automate the task of "
|
dongsheng@627
|
13554 "managing his patch queues. Andrew was successfully using these scripts to "
|
dongsheng@627
|
13555 "manage hundreds (sometimes thousands) of patches on top of the Linux kernel."
|
dongsheng@627
|
13556 msgstr ""
|
dongsheng@627
|
13557
|
dongsheng@627
|
13558 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
13559 #: ../en/ch12-mq.xml:80
|
dongsheng@627
|
13560 msgid "A patchwork quilt"
|
dongsheng@627
|
13561 msgstr ""
|
dongsheng@627
|
13562
|
dongsheng@627
|
13563 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13564 #: ../en/ch12-mq.xml:82
|
dongsheng@627
|
13565 msgid ""
|
dongsheng@627
|
13566 "In early 2003, Andreas Gruenbacher and Martin Quinson borrowed the approach "
|
dongsheng@627
|
13567 "of Andrew's scripts and published a tool called <quote>patchwork quilt</"
|
dongsheng@627
|
13568 "quote> <citation>web:quilt</citation>, or simply <quote>quilt</quote> (see "
|
dongsheng@627
|
13569 "<citation>gruenbacher:2005</citation> for a paper describing it). Because "
|
dongsheng@627
|
13570 "quilt substantially automated patch management, it rapidly gained a large "
|
dongsheng@627
|
13571 "following among open source software developers."
|
dongsheng@627
|
13572 msgstr ""
|
dongsheng@627
|
13573
|
dongsheng@627
|
13574 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13575 #: ../en/ch12-mq.xml:91
|
dongsheng@627
|
13576 msgid ""
|
dongsheng@627
|
13577 "Quilt manages a <emphasis>stack of patches</emphasis> on top of a directory "
|
dongsheng@627
|
13578 "tree. To begin, you tell quilt to manage a directory tree, and tell it which "
|
dongsheng@627
|
13579 "files you want to manage; it stores away the names and contents of those "
|
dongsheng@627
|
13580 "files. To fix a bug, you create a new patch (using a single command), edit "
|
dongsheng@627
|
13581 "the files you need to fix, then <quote>refresh</quote> the patch."
|
dongsheng@627
|
13582 msgstr ""
|
dongsheng@627
|
13583
|
dongsheng@627
|
13584 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13585 #: ../en/ch12-mq.xml:99
|
dongsheng@627
|
13586 msgid ""
|
dongsheng@627
|
13587 "The refresh step causes quilt to scan the directory tree; it updates the "
|
dongsheng@627
|
13588 "patch with all of the changes you have made. You can create another patch on "
|
dongsheng@627
|
13589 "top of the first, which will track the changes required to modify the tree "
|
dongsheng@627
|
13590 "from <quote>tree with one patch applied</quote> to <quote>tree with two "
|
dongsheng@627
|
13591 "patches applied</quote>."
|
dongsheng@627
|
13592 msgstr ""
|
dongsheng@627
|
13593
|
dongsheng@627
|
13594 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13595 #: ../en/ch12-mq.xml:106
|
dongsheng@627
|
13596 msgid ""
|
dongsheng@627
|
13597 "You can <emphasis>change</emphasis> which patches are applied to the tree. "
|
dongsheng@627
|
13598 "If you <quote>pop</quote> a patch, the changes made by that patch will vanish "
|
dongsheng@627
|
13599 "from the directory tree. Quilt remembers which patches you have popped, "
|
dongsheng@627
|
13600 "though, so you can <quote>push</quote> a popped patch again, and the "
|
dongsheng@627
|
13601 "directory tree will be restored to contain the modifications in the patch. "
|
dongsheng@627
|
13602 "Most importantly, you can run the <quote>refresh</quote> command at any time, "
|
dongsheng@627
|
13603 "and the topmost applied patch will be updated. This means that you can, at "
|
dongsheng@627
|
13604 "any time, change both which patches are applied and what modifications those "
|
dongsheng@627
|
13605 "patches make."
|
dongsheng@627
|
13606 msgstr ""
|
dongsheng@627
|
13607
|
dongsheng@627
|
13608 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13609 #: ../en/ch12-mq.xml:118
|
dongsheng@627
|
13610 msgid ""
|
dongsheng@627
|
13611 "Quilt knows nothing about revision control tools, so it works equally well on "
|
dongsheng@627
|
13612 "top of an unpacked tarball or a Subversion working copy."
|
dongsheng@627
|
13613 msgstr ""
|
dongsheng@627
|
13614
|
dongsheng@627
|
13615 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
13616 #: ../en/ch12-mq.xml:124
|
dongsheng@627
|
13617 msgid "From patchwork quilt to Mercurial Queues"
|
dongsheng@636
|
13618 msgstr "从 patchwork quilt 到 MQ"
|
dongsheng@627
|
13619
|
dongsheng@627
|
13620 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13621 #: ../en/ch12-mq.xml:126
|
dongsheng@627
|
13622 msgid ""
|
dongsheng@627
|
13623 "In mid-2005, Chris Mason took the features of quilt and wrote an extension "
|
dongsheng@627
|
13624 "that he called Mercurial Queues, which added quilt-like behaviour to "
|
dongsheng@627
|
13625 "Mercurial."
|
dongsheng@627
|
13626 msgstr ""
|
dongsheng@627
|
13627
|
dongsheng@627
|
13628 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13629 #: ../en/ch12-mq.xml:130
|
dongsheng@627
|
13630 msgid ""
|
dongsheng@627
|
13631 "The key difference between quilt and MQ is that quilt knows nothing about "
|
dongsheng@627
|
13632 "revision control systems, while MQ is <emphasis>integrated</emphasis> into "
|
dongsheng@627
|
13633 "Mercurial. Each patch that you push is represented as a Mercurial "
|
dongsheng@627
|
13634 "changeset. Pop a patch, and the changeset goes away."
|
dongsheng@627
|
13635 msgstr ""
|
dongsheng@627
|
13636
|
dongsheng@627
|
13637 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13638 #: ../en/ch12-mq.xml:136
|
dongsheng@627
|
13639 msgid ""
|
dongsheng@627
|
13640 "Because quilt does not care about revision control tools, it is still a "
|
dongsheng@627
|
13641 "tremendously useful piece of software to know about for situations where you "
|
dongsheng@627
|
13642 "cannot use Mercurial and MQ."
|
dongsheng@627
|
13643 msgstr ""
|
dongsheng@627
|
13644
|
dongsheng@627
|
13645 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
13646 #: ../en/ch12-mq.xml:144
|
dongsheng@627
|
13647 msgid "The huge advantage of MQ"
|
dongsheng@636
|
13648 msgstr "MQ 的巨大优势"
|
dongsheng@627
|
13649
|
dongsheng@627
|
13650 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13651 #: ../en/ch12-mq.xml:146
|
dongsheng@627
|
13652 msgid ""
|
dongsheng@627
|
13653 "I cannot overstate the value that MQ offers through the unification of "
|
dongsheng@627
|
13654 "patches and revision control."
|
dongsheng@627
|
13655 msgstr ""
|
dongsheng@627
|
13656
|
dongsheng@627
|
13657 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13658 #: ../en/ch12-mq.xml:149
|
dongsheng@627
|
13659 msgid ""
|
dongsheng@627
|
13660 "A major reason that patches have persisted in the free software and open "
|
dongsheng@627
|
13661 "source world&emdash;in spite of the availability of increasingly capable "
|
dongsheng@627
|
13662 "revision control tools over the years&emdash;is the <emphasis>agility</"
|
dongsheng@627
|
13663 "emphasis> they offer."
|
dongsheng@627
|
13664 msgstr ""
|
dongsheng@627
|
13665
|
dongsheng@627
|
13666 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13667 #: ../en/ch12-mq.xml:155
|
dongsheng@627
|
13668 msgid ""
|
dongsheng@627
|
13669 "Traditional revision control tools make a permanent, irreversible record of "
|
dongsheng@627
|
13670 "everything that you do. While this has great value, it's also somewhat "
|
dongsheng@627
|
13671 "stifling. If you want to perform a wild-eyed experiment, you have to be "
|
dongsheng@627
|
13672 "careful in how you go about it, or you risk leaving unneeded&emdash;or worse, "
|
dongsheng@627
|
13673 "misleading or destabilising&emdash;traces of your missteps and errors in the "
|
dongsheng@627
|
13674 "permanent revision record."
|
dongsheng@627
|
13675 msgstr ""
|
dongsheng@627
|
13676
|
dongsheng@627
|
13677 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13678 #: ../en/ch12-mq.xml:163
|
dongsheng@627
|
13679 msgid ""
|
dongsheng@627
|
13680 "By contrast, MQ's marriage of distributed revision control with patches makes "
|
dongsheng@627
|
13681 "it much easier to isolate your work. Your patches live on top of normal "
|
dongsheng@627
|
13682 "revision history, and you can make them disappear or reappear at will. If "
|
dongsheng@627
|
13683 "you don't like a patch, you can drop it. If a patch isn't quite as you want "
|
dongsheng@627
|
13684 "it to be, simply fix it&emdash;as many times as you need to, until you have "
|
dongsheng@627
|
13685 "refined it into the form you desire."
|
dongsheng@627
|
13686 msgstr ""
|
dongsheng@627
|
13687
|
dongsheng@627
|
13688 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13689 #: ../en/ch12-mq.xml:171
|
dongsheng@627
|
13690 msgid ""
|
dongsheng@627
|
13691 "As an example, the integration of patches with revision control makes "
|
dongsheng@627
|
13692 "understanding patches and debugging their effects&emdash;and their interplay "
|
dongsheng@627
|
13693 "with the code they're based on&emdash;<emphasis>enormously</emphasis> easier. "
|
dongsheng@627
|
13694 "Since every applied patch has an associated changeset, you can give <command "
|
dongsheng@627
|
13695 "role=\"hg-cmd\">hg log</command> a file name to see which changesets and "
|
dongsheng@627
|
13696 "patches affected the file. You can use the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
13697 "bisect</command> command to binary-search through all changesets and applied "
|
dongsheng@627
|
13698 "patches to see where a bug got introduced or fixed. You can use the <command "
|
dongsheng@627
|
13699 "role=\"hg-cmd\">hg annotate</command> command to see which changeset or patch "
|
dongsheng@627
|
13700 "modified a particular line of a source file. And so on."
|
dongsheng@627
|
13701 msgstr ""
|
dongsheng@627
|
13702
|
dongsheng@627
|
13703 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
13704 #: ../en/ch12-mq.xml:187
|
dongsheng@627
|
13705 msgid "Understanding patches"
|
dongsheng@636
|
13706 msgstr "理解补丁"
|
dongsheng@627
|
13707
|
dongsheng@627
|
13708 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13709 #: ../en/ch12-mq.xml:189
|
dongsheng@627
|
13710 msgid ""
|
dongsheng@627
|
13711 "Because MQ doesn't hide its patch-oriented nature, it is helpful to "
|
dongsheng@627
|
13712 "understand what patches are, and a little about the tools that work with them."
|
dongsheng@627
|
13713 msgstr ""
|
dongsheng@627
|
13714
|
dongsheng@627
|
13715 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13716 #: ../en/ch12-mq.xml:193
|
dongsheng@627
|
13717 msgid ""
|
dongsheng@627
|
13718 "The traditional Unix <command>diff</command> command compares two files, and "
|
dongsheng@627
|
13719 "prints a list of differences between them. The <command>patch</command> "
|
dongsheng@627
|
13720 "command understands these differences as <emphasis>modifications</emphasis> "
|
dongsheng@627
|
13721 "to make to a file. Take a look below for a simple example of these commands "
|
dongsheng@627
|
13722 "in action."
|
dongsheng@627
|
13723 msgstr ""
|
dongsheng@627
|
13724
|
dongsheng@627
|
13725 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13726 #: ../en/ch12-mq.xml:202
|
dongsheng@627
|
13727 msgid ""
|
dongsheng@627
|
13728 "The type of file that <command>diff</command> generates (and <command>patch</"
|
dongsheng@627
|
13729 "command> takes as input) is called a <quote>patch</quote> or a <quote>diff</"
|
dongsheng@627
|
13730 "quote>; there is no difference between a patch and a diff. (We'll use the "
|
dongsheng@627
|
13731 "term <quote>patch</quote>, since it's more commonly used.)"
|
dongsheng@627
|
13732 msgstr ""
|
dongsheng@627
|
13733
|
dongsheng@627
|
13734 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13735 #: ../en/ch12-mq.xml:208
|
dongsheng@627
|
13736 msgid ""
|
dongsheng@627
|
13737 "A patch file can start with arbitrary text; the <command>patch</command> "
|
dongsheng@627
|
13738 "command ignores this text, but MQ uses it as the commit message when creating "
|
dongsheng@627
|
13739 "changesets. To find the beginning of the patch content, <command>patch</"
|
dongsheng@627
|
13740 "command> searches for the first line that starts with the string "
|
dongsheng@627
|
13741 "<quote><literal>diff -</literal></quote>."
|
dongsheng@627
|
13742 msgstr ""
|
dongsheng@627
|
13743
|
dongsheng@627
|
13744 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13745 #: ../en/ch12-mq.xml:215
|
dongsheng@627
|
13746 msgid ""
|
dongsheng@627
|
13747 "MQ works with <emphasis>unified</emphasis> diffs (<command>patch</command> "
|
dongsheng@627
|
13748 "can accept several other diff formats, but MQ doesn't). A unified diff "
|
dongsheng@627
|
13749 "contains two kinds of header. The <emphasis>file header</emphasis> describes "
|
dongsheng@627
|
13750 "the file being modified; it contains the name of the file to modify. When "
|
dongsheng@627
|
13751 "<command>patch</command> sees a new file header, it looks for a file with "
|
dongsheng@627
|
13752 "that name to start modifying."
|
dongsheng@627
|
13753 msgstr ""
|
dongsheng@627
|
13754
|
dongsheng@627
|
13755 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13756 #: ../en/ch12-mq.xml:223
|
dongsheng@627
|
13757 msgid ""
|
dongsheng@627
|
13758 "After the file header comes a series of <emphasis>hunks</emphasis>. Each "
|
dongsheng@627
|
13759 "hunk starts with a header; this identifies the range of line numbers within "
|
dongsheng@627
|
13760 "the file that the hunk should modify. Following the header, a hunk starts "
|
dongsheng@627
|
13761 "and ends with a few (usually three) lines of text from the unmodified file; "
|
dongsheng@627
|
13762 "these are called the <emphasis>context</emphasis> for the hunk. If there's "
|
dongsheng@627
|
13763 "only a small amount of context between successive hunks, <command>diff</"
|
dongsheng@627
|
13764 "command> doesn't print a new hunk header; it just runs the hunks together, "
|
dongsheng@627
|
13765 "with a few lines of context between modifications."
|
dongsheng@627
|
13766 msgstr ""
|
dongsheng@627
|
13767
|
dongsheng@627
|
13768 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13769 #: ../en/ch12-mq.xml:235
|
dongsheng@627
|
13770 msgid ""
|
dongsheng@627
|
13771 "Each line of context begins with a space character. Within the hunk, a line "
|
dongsheng@627
|
13772 "that begins with <quote><literal>-</literal></quote> means <quote>remove this "
|
dongsheng@627
|
13773 "line,</quote> while a line that begins with <quote><literal>+</literal></"
|
dongsheng@627
|
13774 "quote> means <quote>insert this line.</quote> For example, a line that is "
|
dongsheng@627
|
13775 "modified is represented by one deletion and one insertion."
|
dongsheng@627
|
13776 msgstr ""
|
dongsheng@627
|
13777
|
dongsheng@627
|
13778 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13779 #: ../en/ch12-mq.xml:243
|
dongsheng@627
|
13780 msgid ""
|
dongsheng@627
|
13781 "We will return to some of the more subtle aspects of patches later (in "
|
dongsheng@627
|
13782 "section <xref linkend=\"sec.mq.adv-patch\"/>), but you should have enough "
|
dongsheng@627
|
13783 "information now to use MQ."
|
dongsheng@627
|
13784 msgstr ""
|
dongsheng@627
|
13785
|
dongsheng@627
|
13786 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
13787 #: ../en/ch12-mq.xml:250
|
dongsheng@627
|
13788 msgid "Getting started with Mercurial Queues"
|
dongsheng@636
|
13789 msgstr "开始使用 MQ"
|
dongsheng@627
|
13790
|
dongsheng@627
|
13791 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13792 #: ../en/ch12-mq.xml:252
|
dongsheng@627
|
13793 msgid ""
|
dongsheng@627
|
13794 "Because MQ is implemented as an extension, you must explicitly enable before "
|
dongsheng@627
|
13795 "you can use it. (You don't need to download anything; MQ ships with the "
|
dongsheng@627
|
13796 "standard Mercurial distribution.) To enable MQ, edit your <filename role="
|
dongsheng@627
|
13797 "\"home\">~/.hgrc</filename> file, and add the lines below."
|
dongsheng@627
|
13798 msgstr ""
|
dongsheng@627
|
13799
|
dongsheng@627
|
13800 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13801 #: ../en/ch12-mq.xml:261
|
dongsheng@627
|
13802 msgid ""
|
dongsheng@627
|
13803 "Once the extension is enabled, it will make a number of new commands "
|
dongsheng@627
|
13804 "available. To verify that the extension is working, you can use <command "
|
dongsheng@627
|
13805 "role=\"hg-cmd\">hg help</command> to see if the <command role=\"hg-ext-mq"
|
dongsheng@627
|
13806 "\">qinit</command> command is now available."
|
dongsheng@627
|
13807 msgstr ""
|
dongsheng@627
|
13808
|
dongsheng@627
|
13809 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13810 #: ../en/ch12-mq.xml:269
|
dongsheng@627
|
13811 msgid ""
|
dongsheng@627
|
13812 "You can use MQ with <emphasis>any</emphasis> Mercurial repository, and its "
|
dongsheng@627
|
13813 "commands only operate within that repository. To get started, simply prepare "
|
dongsheng@627
|
13814 "the repository using the <command role=\"hg-ext-mq\">qinit</command> command."
|
dongsheng@627
|
13815 msgstr ""
|
dongsheng@627
|
13816
|
dongsheng@627
|
13817 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
13818 #: ../en/ch12-mq.xml:276
|
dongsheng@627
|
13819 msgid ""
|
dongsheng@627
|
13820 "This command creates an empty directory called <filename role=\"special\" "
|
dongsheng@627
|
13821 "class=\"directory\">.hg/patches</filename>, where MQ will keep its metadata. "
|
dongsheng@627
|
13822 "As with many Mercurial commands, the <command role=\"hg-ext-mq\">qinit</"
|
dongsheng@627
|
13823 "command> command prints nothing if it succeeds."
|
dongsheng@627
|
13824 msgstr ""
|
dongsheng@627
|
13825
|
dongsheng@627
|
13826 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
13827 #: ../en/ch12-mq.xml:283
|
dongsheng@627
|
13828 msgid "Creating a new patch"
|
dongsheng@636
|
13829 msgstr "创建新补丁"
|
dongsheng@627
|
13830
|
dongsheng@627
|
13831 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13832 #: ../en/ch12-mq.xml:285
|
dongsheng@627
|
13833 msgid ""
|
dongsheng@627
|
13834 "To begin work on a new patch, use the <command role=\"hg-ext-mq\">qnew</"
|
dongsheng@627
|
13835 "command> command. This command takes one argument, the name of the patch to "
|
dongsheng@627
|
13836 "create."
|
dongsheng@627
|
13837 msgstr ""
|
dongsheng@627
|
13838
|
dongsheng@627
|
13839 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13840 #: ../en/ch12-mq.xml:289
|
dongsheng@627
|
13841 msgid ""
|
dongsheng@627
|
13842 "MQ will use this as the name of an actual file in the <filename role=\"special"
|
dongsheng@627
|
13843 "\" class=\"directory\">.hg/patches</filename> directory, as you can see below."
|
dongsheng@627
|
13844 msgstr ""
|
dongsheng@627
|
13845
|
dongsheng@627
|
13846 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13847 #: ../en/ch12-mq.xml:296
|
dongsheng@627
|
13848 msgid ""
|
dongsheng@627
|
13849 "Also newly present in the <filename role=\"special\" class=\"directory\">.hg/"
|
dongsheng@627
|
13850 "patches</filename> directory are two other files, <filename role=\"special"
|
dongsheng@627
|
13851 "\">series</filename> and <filename role=\"special\">status</filename>. The "
|
dongsheng@627
|
13852 "<filename role=\"special\">series</filename> file lists all of the patches "
|
dongsheng@627
|
13853 "that MQ knows about for this repository, with one patch per line. Mercurial "
|
dongsheng@627
|
13854 "uses the <filename role=\"special\">status</filename> file for internal book-"
|
dongsheng@627
|
13855 "keeping; it tracks all of the patches that MQ has <emphasis>applied</"
|
dongsheng@627
|
13856 "emphasis> in this repository."
|
dongsheng@627
|
13857 msgstr ""
|
dongsheng@627
|
13858
|
dongsheng@627
|
13859 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@627
|
13860 #: ../en/ch12-mq.xml:308
|
dongsheng@627
|
13861 msgid ""
|
dongsheng@627
|
13862 "You may sometimes want to edit the <filename role=\"special\">series</"
|
dongsheng@627
|
13863 "filename> file by hand; for example, to change the sequence in which some "
|
dongsheng@627
|
13864 "patches are applied. However, manually editing the <filename role=\"special"
|
dongsheng@627
|
13865 "\">status</filename> file is almost always a bad idea, as it's easy to "
|
dongsheng@627
|
13866 "corrupt MQ's idea of what is happening."
|
dongsheng@627
|
13867 msgstr ""
|
dongsheng@627
|
13868
|
dongsheng@627
|
13869 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13870 #: ../en/ch12-mq.xml:317
|
dongsheng@627
|
13871 msgid ""
|
dongsheng@627
|
13872 "Once you have created your new patch, you can edit files in the working "
|
dongsheng@627
|
13873 "directory as you usually would. All of the normal Mercurial commands, such "
|
dongsheng@627
|
13874 "as <command role=\"hg-cmd\">hg diff</command> and <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
13875 "annotate</command>, work exactly as they did before."
|
dongsheng@627
|
13876 msgstr ""
|
dongsheng@627
|
13877
|
dongsheng@627
|
13878 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
13879 #: ../en/ch12-mq.xml:325
|
dongsheng@627
|
13880 msgid "Refreshing a patch"
|
dongsheng@636
|
13881 msgstr "刷新补丁"
|
dongsheng@627
|
13882
|
dongsheng@627
|
13883 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13884 #: ../en/ch12-mq.xml:327
|
dongsheng@627
|
13885 msgid ""
|
dongsheng@627
|
13886 "When you reach a point where you want to save your work, use the <command "
|
dongsheng@627
|
13887 "role=\"hg-ext-mq\">qrefresh</command> command to update the patch you are "
|
dongsheng@627
|
13888 "working on."
|
dongsheng@627
|
13889 msgstr ""
|
dongsheng@627
|
13890
|
dongsheng@627
|
13891 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13892 #: ../en/ch12-mq.xml:333
|
dongsheng@627
|
13893 msgid ""
|
dongsheng@627
|
13894 "This command folds the changes you have made in the working directory into "
|
dongsheng@627
|
13895 "your patch, and updates its corresponding changeset to contain those changes."
|
dongsheng@627
|
13896 msgstr ""
|
dongsheng@627
|
13897
|
dongsheng@627
|
13898 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13899 #: ../en/ch12-mq.xml:337
|
dongsheng@627
|
13900 msgid ""
|
dongsheng@627
|
13901 "You can run <command role=\"hg-ext-mq\">qrefresh</command> as often as you "
|
dongsheng@627
|
13902 "like, so it's a good way to <quote>checkpoint</quote> your work. Refresh "
|
dongsheng@627
|
13903 "your patch at an opportune time; try an experiment; and if the experiment "
|
dongsheng@627
|
13904 "doesn't work out, <command role=\"hg-cmd\">hg revert</command> your "
|
dongsheng@627
|
13905 "modifications back to the last time you refreshed."
|
dongsheng@627
|
13906 msgstr ""
|
dongsheng@627
|
13907
|
dongsheng@627
|
13908 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
13909 #: ../en/ch12-mq.xml:348
|
dongsheng@627
|
13910 msgid "Stacking and tracking patches"
|
dongsheng@636
|
13911 msgstr "堆叠和跟踪补丁"
|
dongsheng@627
|
13912
|
dongsheng@627
|
13913 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13914 #: ../en/ch12-mq.xml:350
|
dongsheng@627
|
13915 msgid ""
|
dongsheng@627
|
13916 "Once you have finished working on a patch, or need to work on another, you "
|
dongsheng@627
|
13917 "can use the <command role=\"hg-ext-mq\">qnew</command> command again to "
|
dongsheng@627
|
13918 "create a new patch. Mercurial will apply this patch on top of your existing "
|
dongsheng@627
|
13919 "patch."
|
dongsheng@627
|
13920 msgstr ""
|
dongsheng@627
|
13921
|
dongsheng@627
|
13922 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13923 #: ../en/ch12-mq.xml:357
|
dongsheng@627
|
13924 msgid ""
|
dongsheng@627
|
13925 "Notice that the patch contains the changes in our prior patch as part of its "
|
dongsheng@627
|
13926 "context (you can see this more clearly in the output of <command role=\"hg-cmd"
|
dongsheng@627
|
13927 "\">hg annotate</command>)."
|
dongsheng@627
|
13928 msgstr ""
|
dongsheng@627
|
13929
|
dongsheng@627
|
13930 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13931 #: ../en/ch12-mq.xml:362
|
dongsheng@627
|
13932 msgid ""
|
dongsheng@627
|
13933 "So far, with the exception of <command role=\"hg-ext-mq\">qnew</command> and "
|
dongsheng@627
|
13934 "<command role=\"hg-ext-mq\">qrefresh</command>, we've been careful to only "
|
dongsheng@627
|
13935 "use regular Mercurial commands. However, MQ provides many commands that are "
|
dongsheng@627
|
13936 "easier to use when you are thinking about patches, as illustrated below."
|
dongsheng@627
|
13937 msgstr ""
|
dongsheng@627
|
13938
|
dongsheng@627
|
13939 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13940 #: ../en/ch12-mq.xml:372
|
dongsheng@627
|
13941 msgid ""
|
dongsheng@627
|
13942 "The <command role=\"hg-ext-mq\">qseries</command> command lists every patch "
|
dongsheng@627
|
13943 "that MQ knows about in this repository, from oldest to newest (most recently "
|
dongsheng@627
|
13944 "<emphasis>created</emphasis>)."
|
dongsheng@627
|
13945 msgstr ""
|
dongsheng@627
|
13946
|
dongsheng@627
|
13947 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
13948 #: ../en/ch12-mq.xml:378
|
dongsheng@627
|
13949 msgid ""
|
dongsheng@627
|
13950 "The <command role=\"hg-ext-mq\">qapplied</command> command lists every patch "
|
dongsheng@627
|
13951 "that MQ has <emphasis>applied</emphasis> in this repository, again from "
|
dongsheng@627
|
13952 "oldest to newest (most recently applied)."
|
dongsheng@627
|
13953 msgstr ""
|
dongsheng@627
|
13954
|
dongsheng@627
|
13955 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
13956 #: ../en/ch12-mq.xml:387
|
dongsheng@627
|
13957 msgid "Manipulating the patch stack"
|
dongsheng@636
|
13958 msgstr "操作补丁堆栈"
|
dongsheng@627
|
13959
|
dongsheng@627
|
13960 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13961 #: ../en/ch12-mq.xml:389
|
dongsheng@627
|
13962 msgid ""
|
dongsheng@627
|
13963 "The previous discussion implied that there must be a difference between "
|
dongsheng@627
|
13964 "<quote>known</quote> and <quote>applied</quote> patches, and there is. MQ "
|
dongsheng@627
|
13965 "can manage a patch without it being applied in the repository."
|
dongsheng@627
|
13966 msgstr ""
|
dongsheng@627
|
13967
|
dongsheng@627
|
13968 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
13969 #: ../en/ch12-mq.xml:394
|
dongsheng@627
|
13970 msgid ""
|
dongsheng@627
|
13971 "An <emphasis>applied</emphasis> patch has a corresponding changeset in the "
|
dongsheng@627
|
13972 "repository, and the effects of the patch and changeset are visible in the "
|
dongsheng@627
|
13973 "working directory. You can undo the application of a patch using the "
|
dongsheng@627
|
13974 "<command role=\"hg-ext-mq\">qpop</command> command. MQ still <emphasis>knows "
|
dongsheng@627
|
13975 "about</emphasis>, or manages, a popped patch, but the patch no longer has a "
|
dongsheng@627
|
13976 "corresponding changeset in the repository, and the working directory does not "
|
dongsheng@641
|
13977 "contain the changes made by the patch. Figure <xref endterm=\"fig.mq.stack."
|
dongsheng@641
|
13978 "caption\" linkend=\"fig.mq.stack\"/> illustrates the difference between "
|
dongsheng@641
|
13979 "applied and tracked patches."
|
dongsheng@627
|
13980 msgstr ""
|
dongsheng@627
|
13981
|
dongsheng@627
|
13982 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
|
dongsheng@641
|
13983 #: ../en/ch12-mq.xml:408
|
dongsheng@627
|
13984 msgid "<imageobject><imagedata fileref=\"images/mq-stack.png\"/></imageobject>"
|
dongsheng@627
|
13985 msgstr ""
|
dongsheng@627
|
13986
|
dongsheng@627
|
13987 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
|
dongsheng@641
|
13988 #: ../en/ch12-mq.xml:410
|
dongsheng@627
|
13989 msgid "Applied and unapplied patches in the MQ patch stack"
|
dongsheng@627
|
13990 msgstr ""
|
dongsheng@627
|
13991
|
dongsheng@627
|
13992 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
13993 #: ../en/ch12-mq.xml:415
|
dongsheng@627
|
13994 msgid ""
|
dongsheng@627
|
13995 "You can reapply an unapplied, or popped, patch using the <command role=\"hg-"
|
dongsheng@627
|
13996 "ext-mq\">qpush</command> command. This creates a new changeset to correspond "
|
dongsheng@627
|
13997 "to the patch, and the patch's changes once again become present in the "
|
dongsheng@627
|
13998 "working directory. See below for examples of <command role=\"hg-ext-mq"
|
dongsheng@627
|
13999 "\">qpop</command> and <command role=\"hg-ext-mq\">qpush</command> in action."
|
dongsheng@627
|
14000 msgstr ""
|
dongsheng@627
|
14001
|
dongsheng@627
|
14002 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14003 #: ../en/ch12-mq.xml:424
|
dongsheng@627
|
14004 msgid ""
|
dongsheng@627
|
14005 "Notice that once we have popped a patch or two patches, the output of "
|
dongsheng@627
|
14006 "<command role=\"hg-ext-mq\">qseries</command> remains the same, while that of "
|
dongsheng@627
|
14007 "<command role=\"hg-ext-mq\">qapplied</command> has changed."
|
dongsheng@627
|
14008 msgstr ""
|
dongsheng@627
|
14009
|
dongsheng@627
|
14010 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
14011 #: ../en/ch12-mq.xml:432
|
dongsheng@627
|
14012 msgid "Pushing and popping many patches"
|
dongsheng@636
|
14013 msgstr "压入或弹出多个补丁"
|
dongsheng@627
|
14014
|
dongsheng@627
|
14015 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14016 #: ../en/ch12-mq.xml:434
|
dongsheng@627
|
14017 msgid ""
|
dongsheng@627
|
14018 "While <command role=\"hg-ext-mq\">qpush</command> and <command role=\"hg-ext-"
|
dongsheng@627
|
14019 "mq\">qpop</command> each operate on a single patch at a time by default, you "
|
dongsheng@627
|
14020 "can push and pop many patches in one go. The <option role=\"hg-ext-mq-cmd-"
|
dongsheng@627
|
14021 "qpush-opt\">hg -a</option> option to <command role=\"hg-ext-mq\">qpush</"
|
dongsheng@627
|
14022 "command> causes it to push all unapplied patches, while the <option role=\"hg-"
|
dongsheng@627
|
14023 "ext-mq-cmd-qpop-opt\">-a</option> option to <command role=\"hg-ext-mq\">qpop</"
|
dongsheng@627
|
14024 "command> causes it to pop all applied patches. (For some more ways to push "
|
dongsheng@627
|
14025 "and pop many patches, see section <xref linkend=\"sec.mq.perf\"/> below.)"
|
dongsheng@627
|
14026 msgstr ""
|
dongsheng@627
|
14027
|
dongsheng@627
|
14028 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
14029 #: ../en/ch12-mq.xml:451
|
dongsheng@627
|
14030 msgid "Safety checks, and overriding them"
|
dongsheng@636
|
14031 msgstr "安全的检查,然后覆盖它们"
|
dongsheng@627
|
14032
|
dongsheng@627
|
14033 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14034 #: ../en/ch12-mq.xml:453
|
dongsheng@627
|
14035 msgid ""
|
dongsheng@627
|
14036 "Several MQ commands check the working directory before they do anything, and "
|
dongsheng@627
|
14037 "fail if they find any modifications. They do this to ensure that you won't "
|
dongsheng@627
|
14038 "lose any changes that you have made, but not yet incorporated into a patch. "
|
dongsheng@627
|
14039 "The example below illustrates this; the <command role=\"hg-ext-mq\">qnew</"
|
dongsheng@627
|
14040 "command> command will not create a new patch if there are outstanding "
|
dongsheng@627
|
14041 "changes, caused in this case by the <command role=\"hg-cmd\">hg add</command> "
|
dongsheng@627
|
14042 "of <filename>file3</filename>."
|
dongsheng@627
|
14043 msgstr ""
|
dongsheng@627
|
14044
|
dongsheng@627
|
14045 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14046 #: ../en/ch12-mq.xml:465
|
dongsheng@627
|
14047 msgid ""
|
dongsheng@627
|
14048 "Commands that check the working directory all take an <quote>I know what I'm "
|
dongsheng@627
|
14049 "doing</quote> option, which is always named <option>-f</option>. The exact "
|
dongsheng@627
|
14050 "meaning of <option>-f</option> depends on the command. For example, <command "
|
dongsheng@627
|
14051 "role=\"hg-cmd\">hg qnew <option role=\"hg-ext-mq-cmd-qnew-opt\">hg -f</"
|
dongsheng@627
|
14052 "option></command> will incorporate any outstanding changes into the new patch "
|
dongsheng@627
|
14053 "it creates, but <command role=\"hg-cmd\">hg qpop <option role=\"hg-ext-mq-cmd-"
|
dongsheng@627
|
14054 "qpop-opt\">hg -f</option></command> will revert modifications to any files "
|
dongsheng@627
|
14055 "affected by the patch that it is popping. Be sure to read the documentation "
|
dongsheng@627
|
14056 "for a command's <option>-f</option> option before you use it!"
|
dongsheng@627
|
14057 msgstr ""
|
dongsheng@627
|
14058
|
dongsheng@627
|
14059 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
14060 #: ../en/ch12-mq.xml:480
|
dongsheng@627
|
14061 msgid "Working on several patches at once"
|
dongsheng@636
|
14062 msgstr "同时处理多个补丁"
|
dongsheng@627
|
14063
|
dongsheng@627
|
14064 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14065 #: ../en/ch12-mq.xml:482
|
dongsheng@627
|
14066 msgid ""
|
dongsheng@627
|
14067 "The <command role=\"hg-ext-mq\">qrefresh</command> command always refreshes "
|
dongsheng@627
|
14068 "the <emphasis>topmost</emphasis> applied patch. This means that you can "
|
dongsheng@627
|
14069 "suspend work on one patch (by refreshing it), pop or push to make a different "
|
dongsheng@627
|
14070 "patch the top, and work on <emphasis>that</emphasis> patch for a while."
|
dongsheng@627
|
14071 msgstr ""
|
dongsheng@627
|
14072
|
dongsheng@627
|
14073 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14074 #: ../en/ch12-mq.xml:489
|
dongsheng@627
|
14075 msgid ""
|
dongsheng@627
|
14076 "Here's an example that illustrates how you can use this ability. Let's say "
|
dongsheng@627
|
14077 "you're developing a new feature as two patches. The first is a change to the "
|
dongsheng@627
|
14078 "core of your software, and the second&emdash;layered on top of the "
|
dongsheng@627
|
14079 "first&emdash;changes the user interface to use the code you just added to the "
|
dongsheng@627
|
14080 "core. If you notice a bug in the core while you're working on the UI patch, "
|
dongsheng@627
|
14081 "it's easy to fix the core. Simply <command role=\"hg-ext-mq\">qrefresh</"
|
dongsheng@627
|
14082 "command> the UI patch to save your in-progress changes, and <command role="
|
dongsheng@627
|
14083 "\"hg-ext-mq\">qpop</command> down to the core patch. Fix the core bug, "
|
dongsheng@627
|
14084 "<command role=\"hg-ext-mq\">qrefresh</command> the core patch, and <command "
|
dongsheng@627
|
14085 "role=\"hg-ext-mq\">qpush</command> back to the UI patch to continue where you "
|
dongsheng@627
|
14086 "left off."
|
dongsheng@627
|
14087 msgstr ""
|
dongsheng@627
|
14088
|
dongsheng@627
|
14089 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
14090 #: ../en/ch12-mq.xml:506
|
dongsheng@627
|
14091 msgid "More about patches"
|
dongsheng@636
|
14092 msgstr "关于补丁的更多信息"
|
dongsheng@627
|
14093
|
dongsheng@627
|
14094 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14095 #: ../en/ch12-mq.xml:508
|
dongsheng@627
|
14096 msgid ""
|
dongsheng@627
|
14097 "MQ uses the GNU <command>patch</command> command to apply patches, so it's "
|
dongsheng@627
|
14098 "helpful to know a few more detailed aspects of how <command>patch</command> "
|
dongsheng@627
|
14099 "works, and about patches themselves."
|
dongsheng@627
|
14100 msgstr ""
|
dongsheng@627
|
14101
|
dongsheng@627
|
14102 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
14103 #: ../en/ch12-mq.xml:514
|
dongsheng@627
|
14104 msgid "The strip count"
|
dongsheng@636
|
14105 msgstr "修剪计数"
|
dongsheng@627
|
14106
|
dongsheng@627
|
14107 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14108 #: ../en/ch12-mq.xml:516
|
dongsheng@627
|
14109 msgid ""
|
dongsheng@627
|
14110 "If you look at the file headers in a patch, you will notice that the "
|
dongsheng@627
|
14111 "pathnames usually have an extra component on the front that isn't present in "
|
dongsheng@627
|
14112 "the actual path name. This is a holdover from the way that people used to "
|
dongsheng@627
|
14113 "generate patches (people still do this, but it's somewhat rare with modern "
|
dongsheng@627
|
14114 "revision control tools)."
|
dongsheng@627
|
14115 msgstr ""
|
dongsheng@627
|
14116
|
dongsheng@627
|
14117 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14118 #: ../en/ch12-mq.xml:523
|
dongsheng@627
|
14119 msgid ""
|
dongsheng@627
|
14120 "Alice would unpack a tarball, edit her files, then decide that she wanted to "
|
dongsheng@627
|
14121 "create a patch. So she'd rename her working directory, unpack the tarball "
|
dongsheng@627
|
14122 "again (hence the need for the rename), and use the <option role=\"cmd-opt-diff"
|
dongsheng@627
|
14123 "\">-r</option> and <option role=\"cmd-opt-diff\">-N</option> options to "
|
dongsheng@627
|
14124 "<command>diff</command> to recursively generate a patch between the "
|
dongsheng@627
|
14125 "unmodified directory and the modified one. The result would be that the name "
|
dongsheng@627
|
14126 "of the unmodified directory would be at the front of the left-hand path in "
|
dongsheng@627
|
14127 "every file header, and the name of the modified directory would be at the "
|
dongsheng@627
|
14128 "front of the right-hand path."
|
dongsheng@627
|
14129 msgstr ""
|
dongsheng@627
|
14130
|
dongsheng@627
|
14131 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14132 #: ../en/ch12-mq.xml:536
|
dongsheng@627
|
14133 msgid ""
|
dongsheng@627
|
14134 "Since someone receiving a patch from the Alices of the net would be unlikely "
|
dongsheng@627
|
14135 "to have unmodified and modified directories with exactly the same names, the "
|
dongsheng@627
|
14136 "<command>patch</command> command has a <option role=\"cmd-opt-patch\">-p</"
|
dongsheng@627
|
14137 "option> option that indicates the number of leading path name components to "
|
dongsheng@627
|
14138 "strip when trying to apply a patch. This number is called the "
|
dongsheng@627
|
14139 "<emphasis>strip count</emphasis>."
|
dongsheng@627
|
14140 msgstr ""
|
dongsheng@627
|
14141
|
dongsheng@627
|
14142 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14143 #: ../en/ch12-mq.xml:544
|
dongsheng@627
|
14144 msgid ""
|
dongsheng@627
|
14145 "An option of <quote><literal>-p1</literal></quote> means <quote>use a strip "
|
dongsheng@627
|
14146 "count of one</quote>. If <command>patch</command> sees a file name "
|
dongsheng@627
|
14147 "<filename>foo/bar/baz</filename> in a file header, it will strip "
|
dongsheng@627
|
14148 "<filename>foo</filename> and try to patch a file named <filename>bar/baz</"
|
dongsheng@627
|
14149 "filename>. (Strictly speaking, the strip count refers to the number of "
|
dongsheng@627
|
14150 "<emphasis>path separators</emphasis> (and the components that go with them ) "
|
dongsheng@627
|
14151 "to strip. A strip count of one will turn <filename>foo/bar</filename> into "
|
dongsheng@627
|
14152 "<filename>bar</filename>, but <filename>/foo/bar</filename> (notice the extra "
|
dongsheng@627
|
14153 "leading slash) into <filename>foo/bar</filename>.)"
|
dongsheng@627
|
14154 msgstr ""
|
dongsheng@627
|
14155
|
dongsheng@627
|
14156 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14157 #: ../en/ch12-mq.xml:557
|
dongsheng@627
|
14158 msgid ""
|
dongsheng@627
|
14159 "The <quote>standard</quote> strip count for patches is one; almost all "
|
dongsheng@627
|
14160 "patches contain one leading path name component that needs to be stripped. "
|
dongsheng@627
|
14161 "Mercurial's <command role=\"hg-cmd\">hg diff</command> command generates path "
|
dongsheng@627
|
14162 "names in this form, and the <command role=\"hg-cmd\">hg import</command> "
|
dongsheng@627
|
14163 "command and MQ expect patches to have a strip count of one."
|
dongsheng@627
|
14164 msgstr ""
|
dongsheng@627
|
14165
|
dongsheng@627
|
14166 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14167 #: ../en/ch12-mq.xml:565
|
dongsheng@627
|
14168 msgid ""
|
dongsheng@627
|
14169 "If you receive a patch from someone that you want to add to your patch queue, "
|
dongsheng@627
|
14170 "and the patch needs a strip count other than one, you cannot just <command "
|
dongsheng@627
|
14171 "role=\"hg-ext-mq\">qimport</command> the patch, because <command role=\"hg-"
|
dongsheng@627
|
14172 "ext-mq\">qimport</command> does not yet have a <literal>-p</literal> option "
|
dongsheng@627
|
14173 "(see <ulink role=\"hg-bug\" url=\"http://www.selenic.com/mercurial/bts/"
|
dongsheng@627
|
14174 "issue311\">issue 311</ulink>). Your best bet is to <command role=\"hg-ext-mq"
|
dongsheng@627
|
14175 "\">qnew</command> a patch of your own, then use <command>patch -pN</command> "
|
dongsheng@627
|
14176 "to apply their patch, followed by <command role=\"hg-cmd\">hg addremove</"
|
dongsheng@627
|
14177 "command> to pick up any files added or removed by the patch, followed by "
|
dongsheng@627
|
14178 "<command role=\"hg-ext-mq\">hg qrefresh</command>. This complexity may become "
|
dongsheng@627
|
14179 "unnecessary; see <ulink role=\"hg-bug\" url=\"http://www.selenic.com/"
|
dongsheng@627
|
14180 "mercurial/bts/issue311\">issue 311</ulink> for details."
|
dongsheng@627
|
14181 msgstr ""
|
dongsheng@627
|
14182
|
dongsheng@627
|
14183 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
14184 #: ../en/ch12-mq.xml:584
|
dongsheng@627
|
14185 msgid "Strategies for applying a patch"
|
dongsheng@636
|
14186 msgstr "应用补丁的策略"
|
dongsheng@627
|
14187
|
dongsheng@627
|
14188 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14189 #: ../en/ch12-mq.xml:586
|
dongsheng@627
|
14190 msgid ""
|
dongsheng@627
|
14191 "When <command>patch</command> applies a hunk, it tries a handful of "
|
dongsheng@627
|
14192 "successively less accurate strategies to try to make the hunk apply. This "
|
dongsheng@627
|
14193 "falling-back technique often makes it possible to take a patch that was "
|
dongsheng@627
|
14194 "generated against an old version of a file, and apply it against a newer "
|
dongsheng@627
|
14195 "version of that file."
|
dongsheng@627
|
14196 msgstr ""
|
dongsheng@627
|
14197
|
dongsheng@627
|
14198 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14199 #: ../en/ch12-mq.xml:593
|
dongsheng@627
|
14200 msgid ""
|
dongsheng@627
|
14201 "First, <command>patch</command> tries an exact match, where the line numbers, "
|
dongsheng@627
|
14202 "the context, and the text to be modified must apply exactly. If it cannot "
|
dongsheng@627
|
14203 "make an exact match, it tries to find an exact match for the context, without "
|
dongsheng@627
|
14204 "honouring the line numbering information. If this succeeds, it prints a line "
|
dongsheng@627
|
14205 "of output saying that the hunk was applied, but at some <emphasis>offset</"
|
dongsheng@627
|
14206 "emphasis> from the original line number."
|
dongsheng@627
|
14207 msgstr ""
|
dongsheng@627
|
14208
|
dongsheng@627
|
14209 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14210 #: ../en/ch12-mq.xml:602
|
dongsheng@627
|
14211 msgid ""
|
dongsheng@627
|
14212 "If a context-only match fails, <command>patch</command> removes the first and "
|
dongsheng@627
|
14213 "last lines of the context, and tries a <emphasis>reduced</emphasis> context-"
|
dongsheng@627
|
14214 "only match. If the hunk with reduced context succeeds, it prints a message "
|
dongsheng@627
|
14215 "saying that it applied the hunk with a <emphasis>fuzz factor</emphasis> (the "
|
dongsheng@627
|
14216 "number after the fuzz factor indicates how many lines of context "
|
dongsheng@627
|
14217 "<command>patch</command> had to trim before the patch applied)."
|
dongsheng@627
|
14218 msgstr ""
|
dongsheng@627
|
14219
|
dongsheng@627
|
14220 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14221 #: ../en/ch12-mq.xml:611
|
dongsheng@627
|
14222 msgid ""
|
dongsheng@627
|
14223 "When neither of these techniques works, <command>patch</command> prints a "
|
dongsheng@627
|
14224 "message saying that the hunk in question was rejected. It saves rejected "
|
dongsheng@627
|
14225 "hunks (also simply called <quote>rejects</quote>) to a file with the same "
|
dongsheng@627
|
14226 "name, and an added <filename role=\"special\">.rej</filename> extension. It "
|
dongsheng@627
|
14227 "also saves an unmodified copy of the file with a <filename role=\"special\">."
|
dongsheng@627
|
14228 "orig</filename> extension; the copy of the file without any extensions will "
|
dongsheng@627
|
14229 "contain any changes made by hunks that <emphasis>did</emphasis> apply "
|
dongsheng@627
|
14230 "cleanly. If you have a patch that modifies <filename>foo</filename> with six "
|
dongsheng@627
|
14231 "hunks, and one of them fails to apply, you will have: an unmodified "
|
dongsheng@627
|
14232 "<filename>foo.orig</filename>, a <filename>foo.rej</filename> containing one "
|
dongsheng@627
|
14233 "hunk, and <filename>foo</filename>, containing the changes made by the five "
|
dongsheng@627
|
14234 "successful hunks."
|
dongsheng@627
|
14235 msgstr ""
|
dongsheng@627
|
14236
|
dongsheng@627
|
14237 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
14238 #: ../en/ch12-mq.xml:629
|
dongsheng@627
|
14239 msgid "Some quirks of patch representation"
|
dongsheng@636
|
14240 msgstr "补丁的一些特性"
|
dongsheng@627
|
14241
|
dongsheng@627
|
14242 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14243 #: ../en/ch12-mq.xml:631
|
dongsheng@627
|
14244 msgid ""
|
dongsheng@627
|
14245 "There are a few useful things to know about how <command>patch</command> "
|
dongsheng@627
|
14246 "works with files."
|
dongsheng@627
|
14247 msgstr ""
|
dongsheng@627
|
14248
|
dongsheng@627
|
14249 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
14250 #: ../en/ch12-mq.xml:634
|
dongsheng@627
|
14251 msgid ""
|
dongsheng@627
|
14252 "This should already be obvious, but <command>patch</command> cannot handle "
|
dongsheng@627
|
14253 "binary files."
|
dongsheng@627
|
14254 msgstr ""
|
dongsheng@627
|
14255
|
dongsheng@627
|
14256 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
14257 #: ../en/ch12-mq.xml:638
|
dongsheng@627
|
14258 msgid ""
|
dongsheng@627
|
14259 "Neither does it care about the executable bit; it creates new files as "
|
dongsheng@627
|
14260 "readable, but not executable."
|
dongsheng@627
|
14261 msgstr ""
|
dongsheng@627
|
14262
|
dongsheng@627
|
14263 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
14264 #: ../en/ch12-mq.xml:642
|
dongsheng@627
|
14265 msgid ""
|
dongsheng@627
|
14266 "<command>patch</command> treats the removal of a file as a diff between the "
|
dongsheng@627
|
14267 "file to be removed and the empty file. So your idea of <quote>I deleted this "
|
dongsheng@627
|
14268 "file</quote> looks like <quote>every line of this file was deleted</quote> in "
|
dongsheng@627
|
14269 "a patch."
|
dongsheng@627
|
14270 msgstr ""
|
dongsheng@627
|
14271
|
dongsheng@627
|
14272 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
14273 #: ../en/ch12-mq.xml:648
|
dongsheng@627
|
14274 msgid ""
|
dongsheng@627
|
14275 "It treats the addition of a file as a diff between the empty file and the "
|
dongsheng@627
|
14276 "file to be added. So in a patch, your idea of <quote>I added this file</"
|
dongsheng@627
|
14277 "quote> looks like <quote>every line of this file was added</quote>."
|
dongsheng@627
|
14278 msgstr ""
|
dongsheng@627
|
14279
|
dongsheng@627
|
14280 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
14281 #: ../en/ch12-mq.xml:654
|
dongsheng@627
|
14282 msgid ""
|
dongsheng@627
|
14283 "It treats a renamed file as the removal of the old name, and the addition of "
|
dongsheng@627
|
14284 "the new name. This means that renamed files have a big footprint in "
|
dongsheng@627
|
14285 "patches. (Note also that Mercurial does not currently try to infer when "
|
dongsheng@627
|
14286 "files have been renamed or copied in a patch.)"
|
dongsheng@627
|
14287 msgstr ""
|
dongsheng@627
|
14288
|
dongsheng@627
|
14289 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
14290 #: ../en/ch12-mq.xml:660
|
dongsheng@627
|
14291 msgid ""
|
dongsheng@627
|
14292 "<command>patch</command> cannot represent empty files, so you cannot use a "
|
dongsheng@627
|
14293 "patch to represent the notion <quote>I added this empty file to the tree</"
|
dongsheng@627
|
14294 "quote>."
|
dongsheng@627
|
14295 msgstr ""
|
dongsheng@627
|
14296
|
dongsheng@627
|
14297 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
14298 #: ../en/ch12-mq.xml:667
|
dongsheng@627
|
14299 msgid "Beware the fuzz"
|
dongsheng@636
|
14300 msgstr "当心毛刺"
|
dongsheng@627
|
14301
|
dongsheng@627
|
14302 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14303 #: ../en/ch12-mq.xml:669
|
dongsheng@627
|
14304 msgid ""
|
dongsheng@627
|
14305 "While applying a hunk at an offset, or with a fuzz factor, will often be "
|
dongsheng@627
|
14306 "completely successful, these inexact techniques naturally leave open the "
|
dongsheng@627
|
14307 "possibility of corrupting the patched file. The most common cases typically "
|
dongsheng@627
|
14308 "involve applying a patch twice, or at an incorrect location in the file. If "
|
dongsheng@627
|
14309 "<command>patch</command> or <command role=\"hg-ext-mq\">qpush</command> ever "
|
dongsheng@627
|
14310 "mentions an offset or fuzz factor, you should make sure that the modified "
|
dongsheng@627
|
14311 "files are correct afterwards."
|
dongsheng@627
|
14312 msgstr ""
|
dongsheng@627
|
14313
|
dongsheng@627
|
14314 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14315 #: ../en/ch12-mq.xml:679
|
dongsheng@627
|
14316 msgid ""
|
dongsheng@627
|
14317 "It's often a good idea to refresh a patch that has applied with an offset or "
|
dongsheng@627
|
14318 "fuzz factor; refreshing the patch generates new context information that will "
|
dongsheng@627
|
14319 "make it apply cleanly. I say <quote>often,</quote> not <quote>always,</"
|
dongsheng@627
|
14320 "quote> because sometimes refreshing a patch will make it fail to apply "
|
dongsheng@627
|
14321 "against a different revision of the underlying files. In some cases, such as "
|
dongsheng@627
|
14322 "when you're maintaining a patch that must sit on top of multiple versions of "
|
dongsheng@627
|
14323 "a source tree, it's acceptable to have a patch apply with some fuzz, provided "
|
dongsheng@627
|
14324 "you've verified the results of the patching process in such cases."
|
dongsheng@627
|
14325 msgstr ""
|
dongsheng@627
|
14326
|
dongsheng@627
|
14327 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
14328 #: ../en/ch12-mq.xml:692
|
dongsheng@627
|
14329 msgid "Handling rejection"
|
dongsheng@636
|
14330 msgstr "处理拒绝"
|
dongsheng@627
|
14331
|
dongsheng@627
|
14332 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14333 #: ../en/ch12-mq.xml:694
|
dongsheng@627
|
14334 msgid ""
|
dongsheng@627
|
14335 "If <command role=\"hg-ext-mq\">qpush</command> fails to apply a patch, it "
|
dongsheng@627
|
14336 "will print an error message and exit. If it has left <filename role=\"special"
|
dongsheng@627
|
14337 "\">.rej</filename> files behind, it is usually best to fix up the rejected "
|
dongsheng@627
|
14338 "hunks before you push more patches or do any further work."
|
dongsheng@627
|
14339 msgstr ""
|
dongsheng@627
|
14340
|
dongsheng@627
|
14341 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14342 #: ../en/ch12-mq.xml:700
|
dongsheng@627
|
14343 msgid ""
|
dongsheng@627
|
14344 "If your patch <emphasis>used to</emphasis> apply cleanly, and no longer does "
|
dongsheng@627
|
14345 "because you've changed the underlying code that your patches are based on, "
|
dongsheng@627
|
14346 "Mercurial Queues can help; see section <xref linkend=\"sec.mq.merge\"/> for "
|
dongsheng@627
|
14347 "details."
|
dongsheng@627
|
14348 msgstr ""
|
dongsheng@627
|
14349
|
dongsheng@627
|
14350 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14351 #: ../en/ch12-mq.xml:706
|
dongsheng@627
|
14352 msgid ""
|
dongsheng@627
|
14353 "Unfortunately, there aren't any great techniques for dealing with rejected "
|
dongsheng@627
|
14354 "hunks. Most often, you'll need to view the <filename role=\"special\">.rej</"
|
dongsheng@627
|
14355 "filename> file and edit the target file, applying the rejected hunks by hand."
|
dongsheng@627
|
14356 msgstr ""
|
dongsheng@627
|
14357
|
dongsheng@627
|
14358 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14359 #: ../en/ch12-mq.xml:711
|
dongsheng@627
|
14360 msgid ""
|
dongsheng@627
|
14361 "If you're feeling adventurous, Neil Brown, a Linux kernel hacker, wrote a "
|
dongsheng@627
|
14362 "tool called <command>wiggle</command> <citation>web:wiggle</citation>, which "
|
dongsheng@627
|
14363 "is more vigorous than <command>patch</command> in its attempts to make a "
|
dongsheng@627
|
14364 "patch apply."
|
dongsheng@627
|
14365 msgstr ""
|
dongsheng@627
|
14366
|
dongsheng@627
|
14367 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14368 #: ../en/ch12-mq.xml:717
|
dongsheng@627
|
14369 msgid ""
|
dongsheng@627
|
14370 "Another Linux kernel hacker, Chris Mason (the author of Mercurial Queues), "
|
dongsheng@627
|
14371 "wrote a similar tool called <command>mpatch</command> <citation>web:mpatch</"
|
dongsheng@627
|
14372 "citation>, which takes a simple approach to automating the application of "
|
dongsheng@627
|
14373 "hunks rejected by <command>patch</command>. The <command>mpatch</command> "
|
dongsheng@627
|
14374 "command can help with four common reasons that a hunk may be rejected:"
|
dongsheng@627
|
14375 msgstr ""
|
dongsheng@627
|
14376
|
dongsheng@627
|
14377 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
14378 #: ../en/ch12-mq.xml:726
|
dongsheng@627
|
14379 msgid "The context in the middle of a hunk has changed."
|
dongsheng@627
|
14380 msgstr ""
|
dongsheng@627
|
14381
|
dongsheng@627
|
14382 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
14383 #: ../en/ch12-mq.xml:729
|
dongsheng@627
|
14384 msgid "A hunk is missing some context at the beginning or end."
|
dongsheng@627
|
14385 msgstr ""
|
dongsheng@627
|
14386
|
dongsheng@627
|
14387 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
14388 #: ../en/ch12-mq.xml:732
|
dongsheng@627
|
14389 msgid ""
|
dongsheng@627
|
14390 "A large hunk might apply better&emdash;either entirely or in part&emdash;if "
|
dongsheng@627
|
14391 "it was broken up into smaller hunks."
|
dongsheng@627
|
14392 msgstr ""
|
dongsheng@627
|
14393
|
dongsheng@627
|
14394 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
14395 #: ../en/ch12-mq.xml:736
|
dongsheng@627
|
14396 msgid ""
|
dongsheng@627
|
14397 "A hunk removes lines with slightly different content than those currently "
|
dongsheng@627
|
14398 "present in the file."
|
dongsheng@627
|
14399 msgstr ""
|
dongsheng@627
|
14400
|
dongsheng@627
|
14401 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14402 #: ../en/ch12-mq.xml:740
|
dongsheng@627
|
14403 msgid ""
|
dongsheng@627
|
14404 "If you use <command>wiggle</command> or <command>mpatch</command>, you should "
|
dongsheng@627
|
14405 "be doubly careful to check your results when you're done. In fact, "
|
dongsheng@627
|
14406 "<command>mpatch</command> enforces this method of double-checking the tool's "
|
dongsheng@627
|
14407 "output, by automatically dropping you into a merge program when it has done "
|
dongsheng@627
|
14408 "its job, so that you can verify its work and finish off any remaining merges."
|
dongsheng@627
|
14409 msgstr ""
|
dongsheng@627
|
14410
|
dongsheng@627
|
14411 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
14412 #: ../en/ch12-mq.xml:752
|
dongsheng@627
|
14413 msgid "Getting the best performance out of MQ"
|
dongsheng@636
|
14414 msgstr "MQ 的性能"
|
dongsheng@627
|
14415
|
dongsheng@627
|
14416 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14417 #: ../en/ch12-mq.xml:754
|
dongsheng@627
|
14418 msgid ""
|
dongsheng@627
|
14419 "MQ is very efficient at handling a large number of patches. I ran some "
|
dongsheng@627
|
14420 "performance experiments in mid-2006 for a talk that I gave at the 2006 "
|
dongsheng@627
|
14421 "EuroPython conference <citation>web:europython</citation>. I used as my data "
|
dongsheng@627
|
14422 "set the Linux 2.6.17-mm1 patch series, which consists of 1,738 patches. I "
|
dongsheng@627
|
14423 "applied these on top of a Linux kernel repository containing all 27,472 "
|
dongsheng@627
|
14424 "revisions between Linux 2.6.12-rc2 and Linux 2.6.17."
|
dongsheng@627
|
14425 msgstr ""
|
dongsheng@627
|
14426
|
dongsheng@627
|
14427 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14428 #: ../en/ch12-mq.xml:763
|
dongsheng@627
|
14429 msgid ""
|
dongsheng@627
|
14430 "On my old, slow laptop, I was able to <command role=\"hg-cmd\">hg qpush "
|
dongsheng@627
|
14431 "<option role=\"hg-ext-mq-cmd-qpush-opt\">hg -a</option></command> all 1,738 "
|
dongsheng@627
|
14432 "patches in 3.5 minutes, and <command role=\"hg-cmd\">hg qpop <option role="
|
dongsheng@627
|
14433 "\"hg-ext-mq-cmd-qpop-opt\">hg -a</option></command> them all in 30 seconds. "
|
dongsheng@627
|
14434 "(On a newer laptop, the time to push all patches dropped to two minutes.) I "
|
dongsheng@627
|
14435 "could <command role=\"hg-ext-mq\">qrefresh</command> one of the biggest "
|
dongsheng@627
|
14436 "patches (which made 22,779 lines of changes to 287 files) in 6.6 seconds."
|
dongsheng@627
|
14437 msgstr ""
|
dongsheng@627
|
14438
|
dongsheng@627
|
14439 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14440 #: ../en/ch12-mq.xml:774
|
dongsheng@627
|
14441 msgid ""
|
dongsheng@627
|
14442 "Clearly, MQ is well suited to working in large trees, but there are a few "
|
dongsheng@627
|
14443 "tricks you can use to get the best performance of it."
|
dongsheng@627
|
14444 msgstr ""
|
dongsheng@627
|
14445
|
dongsheng@627
|
14446 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14447 #: ../en/ch12-mq.xml:778
|
dongsheng@627
|
14448 msgid ""
|
dongsheng@627
|
14449 "First of all, try to <quote>batch</quote> operations together. Every time "
|
dongsheng@627
|
14450 "you run <command role=\"hg-ext-mq\">qpush</command> or <command role=\"hg-ext-"
|
dongsheng@627
|
14451 "mq\">qpop</command>, these commands scan the working directory once to make "
|
dongsheng@627
|
14452 "sure you haven't made some changes and then forgotten to run <command role="
|
dongsheng@627
|
14453 "\"hg-ext-mq\">qrefresh</command>. On a small tree, the time that this scan "
|
dongsheng@627
|
14454 "takes is unnoticeable. However, on a medium-sized tree (containing tens of "
|
dongsheng@627
|
14455 "thousands of files), it can take a second or more."
|
dongsheng@627
|
14456 msgstr ""
|
dongsheng@627
|
14457
|
dongsheng@627
|
14458 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14459 #: ../en/ch12-mq.xml:789
|
dongsheng@627
|
14460 msgid ""
|
dongsheng@627
|
14461 "The <command role=\"hg-ext-mq\">qpush</command> and <command role=\"hg-ext-mq"
|
dongsheng@627
|
14462 "\">qpop</command> commands allow you to push and pop multiple patches at a "
|
dongsheng@627
|
14463 "time. You can identify the <quote>destination patch</quote> that you want to "
|
dongsheng@627
|
14464 "end up at. When you <command role=\"hg-ext-mq\">qpush</command> with a "
|
dongsheng@627
|
14465 "destination specified, it will push patches until that patch is at the top of "
|
dongsheng@627
|
14466 "the applied stack. When you <command role=\"hg-ext-mq\">qpop</command> to a "
|
dongsheng@627
|
14467 "destination, MQ will pop patches until the destination patch is at the top."
|
dongsheng@627
|
14468 msgstr ""
|
dongsheng@627
|
14469
|
dongsheng@627
|
14470 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14471 #: ../en/ch12-mq.xml:799
|
dongsheng@627
|
14472 msgid ""
|
dongsheng@627
|
14473 "You can identify a destination patch using either the name of the patch, or "
|
dongsheng@627
|
14474 "by number. If you use numeric addressing, patches are counted from zero; "
|
dongsheng@627
|
14475 "this means that the first patch is zero, the second is one, and so on."
|
dongsheng@627
|
14476 msgstr ""
|
dongsheng@627
|
14477
|
dongsheng@627
|
14478 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
14479 #: ../en/ch12-mq.xml:806
|
dongsheng@627
|
14480 msgid "Updating your patches when the underlying code changes"
|
dongsheng@636
|
14481 msgstr "当基础代码改变时,更新补丁的方法"
|
dongsheng@627
|
14482
|
dongsheng@627
|
14483 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14484 #: ../en/ch12-mq.xml:809
|
dongsheng@627
|
14485 msgid ""
|
dongsheng@627
|
14486 "It's common to have a stack of patches on top of an underlying repository "
|
dongsheng@627
|
14487 "that you don't modify directly. If you're working on changes to third-party "
|
dongsheng@627
|
14488 "code, or on a feature that is taking longer to develop than the rate of "
|
dongsheng@627
|
14489 "change of the code beneath, you will often need to sync up with the "
|
dongsheng@627
|
14490 "underlying code, and fix up any hunks in your patches that no longer apply. "
|
dongsheng@627
|
14491 "This is called <emphasis>rebasing</emphasis> your patch series."
|
dongsheng@627
|
14492 msgstr ""
|
dongsheng@627
|
14493
|
dongsheng@627
|
14494 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14495 #: ../en/ch12-mq.xml:818
|
dongsheng@627
|
14496 msgid ""
|
dongsheng@627
|
14497 "The simplest way to do this is to <command role=\"hg-cmd\">hg qpop <option "
|
dongsheng@627
|
14498 "role=\"hg-ext-mq-cmd-qpop-opt\">hg -a</option></command> your patches, then "
|
dongsheng@627
|
14499 "<command role=\"hg-cmd\">hg pull</command> changes into the underlying "
|
dongsheng@627
|
14500 "repository, and finally <command role=\"hg-cmd\">hg qpush <option role=\"hg-"
|
dongsheng@627
|
14501 "ext-mq-cmd-qpop-opt\">hg -a</option></command> your patches again. MQ will "
|
dongsheng@627
|
14502 "stop pushing any time it runs across a patch that fails to apply during "
|
dongsheng@627
|
14503 "conflicts, allowing you to fix your conflicts, <command role=\"hg-ext-mq"
|
dongsheng@627
|
14504 "\">qrefresh</command> the affected patch, and continue pushing until you have "
|
dongsheng@627
|
14505 "fixed your entire stack."
|
dongsheng@627
|
14506 msgstr ""
|
dongsheng@627
|
14507
|
dongsheng@627
|
14508 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14509 #: ../en/ch12-mq.xml:830
|
dongsheng@627
|
14510 msgid ""
|
dongsheng@627
|
14511 "This approach is easy to use and works well if you don't expect changes to "
|
dongsheng@627
|
14512 "the underlying code to affect how well your patches apply. If your patch "
|
dongsheng@627
|
14513 "stack touches code that is modified frequently or invasively in the "
|
dongsheng@627
|
14514 "underlying repository, however, fixing up rejected hunks by hand quickly "
|
dongsheng@627
|
14515 "becomes tiresome."
|
dongsheng@627
|
14516 msgstr ""
|
dongsheng@627
|
14517
|
dongsheng@627
|
14518 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14519 #: ../en/ch12-mq.xml:837
|
dongsheng@627
|
14520 msgid ""
|
dongsheng@627
|
14521 "It's possible to partially automate the rebasing process. If your patches "
|
dongsheng@627
|
14522 "apply cleanly against some revision of the underlying repo, MQ can use this "
|
dongsheng@627
|
14523 "information to help you to resolve conflicts between your patches and a "
|
dongsheng@627
|
14524 "different revision."
|
dongsheng@627
|
14525 msgstr ""
|
dongsheng@627
|
14526
|
dongsheng@627
|
14527 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14528 #: ../en/ch12-mq.xml:843
|
dongsheng@627
|
14529 msgid "The process is a little involved."
|
dongsheng@627
|
14530 msgstr ""
|
dongsheng@627
|
14531
|
dongsheng@627
|
14532 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@641
|
14533 #: ../en/ch12-mq.xml:845
|
dongsheng@627
|
14534 msgid ""
|
dongsheng@627
|
14535 "To begin, <command role=\"hg-cmd\">hg qpush -a</command> all of your patches "
|
dongsheng@627
|
14536 "on top of the revision where you know that they apply cleanly."
|
dongsheng@627
|
14537 msgstr ""
|
dongsheng@627
|
14538
|
dongsheng@627
|
14539 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@641
|
14540 #: ../en/ch12-mq.xml:849
|
dongsheng@627
|
14541 msgid ""
|
dongsheng@627
|
14542 "Save a backup copy of your patch directory using <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
14543 "qsave <option role=\"hg-ext-mq-cmd-qsave-opt\">hg -e</option> <option role="
|
dongsheng@627
|
14544 "\"hg-ext-mq-cmd-qsave-opt\">hg -c</option></command>. This prints the name "
|
dongsheng@627
|
14545 "of the directory that it has saved the patches in. It will save the patches "
|
dongsheng@627
|
14546 "to a directory called <filename role=\"special\" class=\"directory\">.hg/"
|
dongsheng@627
|
14547 "patches.N</filename>, where <literal>N</literal> is a small integer. It also "
|
dongsheng@627
|
14548 "commits a <quote>save changeset</quote> on top of your applied patches; this "
|
dongsheng@627
|
14549 "is for internal book-keeping, and records the states of the <filename role="
|
dongsheng@627
|
14550 "\"special\">series</filename> and <filename role=\"special\">status</"
|
dongsheng@627
|
14551 "filename> files."
|
dongsheng@627
|
14552 msgstr ""
|
dongsheng@627
|
14553
|
dongsheng@627
|
14554 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@641
|
14555 #: ../en/ch12-mq.xml:863
|
dongsheng@627
|
14556 msgid ""
|
dongsheng@627
|
14557 "Use <command role=\"hg-cmd\">hg pull</command> to bring new changes into the "
|
dongsheng@627
|
14558 "underlying repository. (Don't run <command role=\"hg-cmd\">hg pull -u</"
|
dongsheng@627
|
14559 "command>; see below for why.)"
|
dongsheng@627
|
14560 msgstr ""
|
dongsheng@627
|
14561
|
dongsheng@627
|
14562 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@641
|
14563 #: ../en/ch12-mq.xml:868
|
dongsheng@627
|
14564 msgid ""
|
dongsheng@627
|
14565 "Update to the new tip revision, using <command role=\"hg-cmd\">hg update "
|
dongsheng@627
|
14566 "<option role=\"hg-opt-update\">-C</option></command> to override the patches "
|
dongsheng@627
|
14567 "you have pushed."
|
dongsheng@627
|
14568 msgstr ""
|
dongsheng@627
|
14569
|
dongsheng@627
|
14570 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@641
|
14571 #: ../en/ch12-mq.xml:873
|
dongsheng@627
|
14572 msgid ""
|
dongsheng@627
|
14573 "Merge all patches using \\hgcmdargs{qpush}{<option role=\"hg-ext-mq-cmd-qpush-"
|
dongsheng@627
|
14574 "opt\">hg -m</option> <option role=\"hg-ext-mq-cmd-qpush-opt\">hg -a</"
|
dongsheng@627
|
14575 "option>}. The <option role=\"hg-ext-mq-cmd-qpush-opt\">hg -m</option> option "
|
dongsheng@627
|
14576 "to <command role=\"hg-ext-mq\">qpush</command> tells MQ to perform a three-"
|
dongsheng@627
|
14577 "way merge if the patch fails to apply."
|
dongsheng@627
|
14578 msgstr ""
|
dongsheng@627
|
14579
|
dongsheng@627
|
14580 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14581 #: ../en/ch12-mq.xml:883
|
dongsheng@627
|
14582 msgid ""
|
dongsheng@627
|
14583 "During the <command role=\"hg-cmd\">hg qpush <option role=\"hg-ext-mq-cmd-"
|
dongsheng@627
|
14584 "qpush-opt\">hg -m</option></command>, each patch in the <filename role="
|
dongsheng@627
|
14585 "\"special\">series</filename> file is applied normally. If a patch applies "
|
dongsheng@627
|
14586 "with fuzz or rejects, MQ looks at the queue you <command role=\"hg-ext-mq"
|
dongsheng@627
|
14587 "\">qsave</command>d, and performs a three-way merge with the corresponding "
|
dongsheng@627
|
14588 "changeset. This merge uses Mercurial's normal merge machinery, so it may pop "
|
dongsheng@627
|
14589 "up a GUI merge tool to help you to resolve problems."
|
dongsheng@627
|
14590 msgstr ""
|
dongsheng@627
|
14591
|
dongsheng@627
|
14592 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14593 #: ../en/ch12-mq.xml:893
|
dongsheng@627
|
14594 msgid ""
|
dongsheng@627
|
14595 "When you finish resolving the effects of a patch, MQ refreshes your patch "
|
dongsheng@627
|
14596 "based on the result of the merge."
|
dongsheng@627
|
14597 msgstr ""
|
dongsheng@627
|
14598
|
dongsheng@627
|
14599 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14600 #: ../en/ch12-mq.xml:896
|
dongsheng@627
|
14601 msgid ""
|
dongsheng@627
|
14602 "At the end of this process, your repository will have one extra head from the "
|
dongsheng@627
|
14603 "old patch queue, and a copy of the old patch queue will be in <filename role="
|
dongsheng@627
|
14604 "\"special\" class=\"directory\">.hg/patches.N</filename>. You can remove the "
|
dongsheng@627
|
14605 "extra head using <command role=\"hg-cmd\">hg qpop -a -n patches.N</command> "
|
dongsheng@627
|
14606 "or <command role=\"hg-cmd\">hg strip</command>. You can delete <filename "
|
dongsheng@627
|
14607 "role=\"special\" class=\"directory\">.hg/patches.N</filename> once you are "
|
dongsheng@627
|
14608 "sure that you no longer need it as a backup."
|
dongsheng@627
|
14609 msgstr ""
|
dongsheng@627
|
14610
|
dongsheng@627
|
14611 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
14612 #: ../en/ch12-mq.xml:908
|
dongsheng@627
|
14613 msgid "Identifying patches"
|
dongsheng@636
|
14614 msgstr "标识补丁"
|
dongsheng@627
|
14615
|
dongsheng@627
|
14616 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14617 #: ../en/ch12-mq.xml:910
|
dongsheng@627
|
14618 msgid ""
|
dongsheng@627
|
14619 "MQ commands that work with patches let you refer to a patch either by using "
|
dongsheng@627
|
14620 "its name or by a number. By name is obvious enough; pass the name "
|
dongsheng@627
|
14621 "<filename>foo.patch</filename> to <command role=\"hg-ext-mq\">qpush</"
|
dongsheng@627
|
14622 "command>, for example, and it will push patches until <filename>foo.patch</"
|
dongsheng@627
|
14623 "filename> is applied."
|
dongsheng@627
|
14624 msgstr ""
|
dongsheng@627
|
14625
|
dongsheng@627
|
14626 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14627 #: ../en/ch12-mq.xml:917
|
dongsheng@627
|
14628 msgid ""
|
dongsheng@627
|
14629 "As a shortcut, you can refer to a patch using both a name and a numeric "
|
dongsheng@627
|
14630 "offset; <literal>foo.patch-2</literal> means <quote>two patches before "
|
dongsheng@627
|
14631 "<literal>foo.patch</literal></quote>, while <literal>bar.patch+4</literal> "
|
dongsheng@627
|
14632 "means <quote>four patches after <literal>bar.patch</literal></quote>."
|
dongsheng@627
|
14633 msgstr ""
|
dongsheng@627
|
14634
|
dongsheng@627
|
14635 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14636 #: ../en/ch12-mq.xml:923
|
dongsheng@627
|
14637 msgid ""
|
dongsheng@627
|
14638 "Referring to a patch by index isn't much different. The first patch printed "
|
dongsheng@627
|
14639 "in the output of <command role=\"hg-ext-mq\">qseries</command> is patch zero "
|
dongsheng@627
|
14640 "(yes, it's one of those start-at-zero counting systems); the second is patch "
|
dongsheng@627
|
14641 "one; and so on."
|
dongsheng@627
|
14642 msgstr ""
|
dongsheng@627
|
14643
|
dongsheng@627
|
14644 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14645 #: ../en/ch12-mq.xml:929
|
dongsheng@627
|
14646 msgid ""
|
dongsheng@627
|
14647 "MQ also makes it easy to work with patches when you are using normal "
|
dongsheng@627
|
14648 "Mercurial commands. Every command that accepts a changeset ID will also "
|
dongsheng@627
|
14649 "accept the name of an applied patch. MQ augments the tags normally in the "
|
dongsheng@627
|
14650 "repository with an eponymous one for each applied patch. In addition, the "
|
dongsheng@627
|
14651 "special tags \\index{tags!special tag names!<literal>qbase</literal>}"
|
dongsheng@627
|
14652 "<literal>qbase</literal> and \\index{tags!special tag names!<literal>qtip</"
|
dongsheng@627
|
14653 "literal>}<literal>qtip</literal> identify the <quote>bottom-most</quote> and "
|
dongsheng@627
|
14654 "topmost applied patches, respectively."
|
dongsheng@627
|
14655 msgstr ""
|
dongsheng@627
|
14656
|
dongsheng@627
|
14657 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14658 #: ../en/ch12-mq.xml:941
|
dongsheng@627
|
14659 msgid ""
|
dongsheng@627
|
14660 "These additions to Mercurial's normal tagging capabilities make dealing with "
|
dongsheng@627
|
14661 "patches even more of a breeze."
|
dongsheng@627
|
14662 msgstr ""
|
dongsheng@627
|
14663
|
dongsheng@627
|
14664 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@641
|
14665 #: ../en/ch12-mq.xml:944
|
dongsheng@627
|
14666 msgid "Want to patchbomb a mailing list with your latest series of changes?"
|
dongsheng@627
|
14667 msgstr ""
|
dongsheng@627
|
14668
|
dongsheng@627
|
14669 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@641
|
14670 #: ../en/ch12-mq.xml:948
|
dongsheng@627
|
14671 msgid ""
|
dongsheng@627
|
14672 "(Don't know what <quote>patchbombing</quote> is? See section <xref linkend="
|
dongsheng@627
|
14673 "\"sec.hgext.patchbomb\"/>.)"
|
dongsheng@627
|
14674 msgstr ""
|
dongsheng@627
|
14675
|
dongsheng@627
|
14676 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@641
|
14677 #: ../en/ch12-mq.xml:951
|
dongsheng@627
|
14678 msgid ""
|
dongsheng@627
|
14679 "Need to see all of the patches since <literal>foo.patch</literal> that have "
|
dongsheng@627
|
14680 "touched files in a subdirectory of your tree?"
|
dongsheng@627
|
14681 msgstr ""
|
dongsheng@627
|
14682
|
dongsheng@627
|
14683 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><programlisting><emphasis>
|
dongsheng@641
|
14684 #: ../en/ch12-mq.xml:955
|
dongsheng@627
|
14685 msgid "subdir"
|
dongsheng@627
|
14686 msgstr ""
|
dongsheng@627
|
14687
|
dongsheng@627
|
14688 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14689 #: ../en/ch12-mq.xml:960
|
dongsheng@627
|
14690 msgid ""
|
dongsheng@627
|
14691 "Because MQ makes the names of patches available to the rest of Mercurial "
|
dongsheng@627
|
14692 "through its normal internal tag machinery, you don't need to type in the "
|
dongsheng@627
|
14693 "entire name of a patch when you want to identify it by name."
|
dongsheng@627
|
14694 msgstr ""
|
dongsheng@627
|
14695
|
dongsheng@627
|
14696 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14697 #: ../en/ch12-mq.xml:965
|
dongsheng@627
|
14698 msgid ""
|
dongsheng@627
|
14699 "Another nice consequence of representing patch names as tags is that when you "
|
dongsheng@627
|
14700 "run the <command role=\"hg-cmd\">hg log</command> command, it will display a "
|
dongsheng@627
|
14701 "patch's name as a tag, simply as part of its normal output. This makes it "
|
dongsheng@627
|
14702 "easy to visually distinguish applied patches from underlying <quote>normal</"
|
dongsheng@627
|
14703 "quote> revisions. The following example shows a few normal Mercurial "
|
dongsheng@627
|
14704 "commands in use with applied patches."
|
dongsheng@627
|
14705 msgstr ""
|
dongsheng@627
|
14706
|
dongsheng@627
|
14707 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
14708 #: ../en/ch12-mq.xml:978
|
dongsheng@627
|
14709 msgid "Useful things to know about"
|
dongsheng@636
|
14710 msgstr "其它需要了解的东西"
|
dongsheng@627
|
14711
|
dongsheng@627
|
14712 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14713 #: ../en/ch12-mq.xml:980
|
dongsheng@627
|
14714 msgid ""
|
dongsheng@627
|
14715 "There are a number of aspects of MQ usage that don't fit tidily into sections "
|
dongsheng@627
|
14716 "of their own, but that are good to know. Here they are, in one place."
|
dongsheng@627
|
14717 msgstr ""
|
dongsheng@627
|
14718
|
dongsheng@627
|
14719 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@641
|
14720 #: ../en/ch12-mq.xml:985
|
dongsheng@627
|
14721 msgid ""
|
dongsheng@627
|
14722 "Normally, when you <command role=\"hg-ext-mq\">qpop</command> a patch and "
|
dongsheng@627
|
14723 "<command role=\"hg-ext-mq\">qpush</command> it again, the changeset that "
|
dongsheng@627
|
14724 "represents the patch after the pop/push will have a <emphasis>different "
|
dongsheng@627
|
14725 "identity</emphasis> than the changeset that represented the hash beforehand. "
|
dongsheng@627
|
14726 "See section <xref linkend=\"sec.mqref.cmd.qpush\"/> for information as to why "
|
dongsheng@627
|
14727 "this is."
|
dongsheng@627
|
14728 msgstr ""
|
dongsheng@627
|
14729
|
dongsheng@627
|
14730 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@641
|
14731 #: ../en/ch12-mq.xml:994
|
dongsheng@627
|
14732 msgid ""
|
dongsheng@627
|
14733 "It's not a good idea to <command role=\"hg-cmd\">hg merge</command> changes "
|
dongsheng@627
|
14734 "from another branch with a patch changeset, at least if you want to maintain "
|
dongsheng@627
|
14735 "the <quote>patchiness</quote> of that changeset and changesets below it on "
|
dongsheng@627
|
14736 "the patch stack. If you try to do this, it will appear to succeed, but MQ "
|
dongsheng@627
|
14737 "will become confused."
|
dongsheng@627
|
14738 msgstr ""
|
dongsheng@627
|
14739
|
dongsheng@627
|
14740 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
14741 #: ../en/ch12-mq.xml:1005
|
dongsheng@627
|
14742 msgid "Managing patches in a repository"
|
dongsheng@636
|
14743 msgstr "在版本库管理补丁"
|
dongsheng@627
|
14744
|
dongsheng@627
|
14745 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14746 #: ../en/ch12-mq.xml:1007
|
dongsheng@627
|
14747 msgid ""
|
dongsheng@627
|
14748 "Because MQ's <filename role=\"special\" class=\"directory\">.hg/patches</"
|
dongsheng@627
|
14749 "filename> directory resides outside a Mercurial repository's working "
|
dongsheng@627
|
14750 "directory, the <quote>underlying</quote> Mercurial repository knows nothing "
|
dongsheng@627
|
14751 "about the management or presence of patches."
|
dongsheng@627
|
14752 msgstr ""
|
dongsheng@627
|
14753
|
dongsheng@627
|
14754 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14755 #: ../en/ch12-mq.xml:1013
|
dongsheng@627
|
14756 msgid ""
|
dongsheng@627
|
14757 "This presents the interesting possibility of managing the contents of the "
|
dongsheng@627
|
14758 "patch directory as a Mercurial repository in its own right. This can be a "
|
dongsheng@627
|
14759 "useful way to work. For example, you can work on a patch for a while, "
|
dongsheng@627
|
14760 "<command role=\"hg-ext-mq\">qrefresh</command> it, then <command role=\"hg-cmd"
|
dongsheng@627
|
14761 "\">hg commit</command> the current state of the patch. This lets you "
|
dongsheng@627
|
14762 "<quote>roll back</quote> to that version of the patch later on."
|
dongsheng@627
|
14763 msgstr ""
|
dongsheng@627
|
14764
|
dongsheng@627
|
14765 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14766 #: ../en/ch12-mq.xml:1022
|
dongsheng@627
|
14767 msgid ""
|
dongsheng@627
|
14768 "You can then share different versions of the same patch stack among multiple "
|
dongsheng@627
|
14769 "underlying repositories. I use this when I am developing a Linux kernel "
|
dongsheng@627
|
14770 "feature. I have a pristine copy of my kernel sources for each of several CPU "
|
dongsheng@627
|
14771 "architectures, and a cloned repository under each that contains the patches I "
|
dongsheng@627
|
14772 "am working on. When I want to test a change on a different architecture, I "
|
dongsheng@627
|
14773 "push my current patches to the patch repository associated with that kernel "
|
dongsheng@627
|
14774 "tree, pop and push all of my patches, and build and test that kernel."
|
dongsheng@627
|
14775 msgstr ""
|
dongsheng@627
|
14776
|
dongsheng@627
|
14777 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14778 #: ../en/ch12-mq.xml:1032
|
dongsheng@627
|
14779 msgid ""
|
dongsheng@627
|
14780 "Managing patches in a repository makes it possible for multiple developers to "
|
dongsheng@627
|
14781 "work on the same patch series without colliding with each other, all on top "
|
dongsheng@627
|
14782 "of an underlying source base that they may or may not control."
|
dongsheng@627
|
14783 msgstr ""
|
dongsheng@627
|
14784
|
dongsheng@627
|
14785 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
14786 #: ../en/ch12-mq.xml:1038
|
dongsheng@627
|
14787 msgid "MQ support for patch repositories"
|
dongsheng@636
|
14788 msgstr "MQ 支持补丁版本库"
|
dongsheng@627
|
14789
|
dongsheng@627
|
14790 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14791 #: ../en/ch12-mq.xml:1040
|
dongsheng@627
|
14792 msgid ""
|
dongsheng@627
|
14793 "MQ helps you to work with the <filename role=\"special\" class=\"directory\">."
|
dongsheng@627
|
14794 "hg/patches</filename> directory as a repository; when you prepare a "
|
dongsheng@627
|
14795 "repository for working with patches using <command role=\"hg-ext-mq\">qinit</"
|
dongsheng@627
|
14796 "command>, you can pass the <option role=\"hg-ext-mq-cmd-qinit-opt\">hg -c</"
|
dongsheng@627
|
14797 "option> option to create the <filename role=\"special\" class=\"directory\">."
|
dongsheng@627
|
14798 "hg/patches</filename> directory as a Mercurial repository."
|
dongsheng@627
|
14799 msgstr ""
|
dongsheng@627
|
14800
|
dongsheng@627
|
14801 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@641
|
14802 #: ../en/ch12-mq.xml:1050
|
dongsheng@627
|
14803 msgid ""
|
dongsheng@627
|
14804 "If you forget to use the <option role=\"hg-ext-mq-cmd-qinit-opt\">hg -c</"
|
dongsheng@627
|
14805 "option> option, you can simply go into the <filename role=\"special\" class="
|
dongsheng@627
|
14806 "\"directory\">.hg/patches</filename> directory at any time and run <command "
|
dongsheng@627
|
14807 "role=\"hg-cmd\">hg init</command>. Don't forget to add an entry for the "
|
dongsheng@627
|
14808 "<filename role=\"special\">status</filename> file to the <filename role="
|
dongsheng@627
|
14809 "\"special\">.hgignore</filename> file, though"
|
dongsheng@627
|
14810 msgstr ""
|
dongsheng@627
|
14811
|
dongsheng@627
|
14812 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@641
|
14813 #: ../en/ch12-mq.xml:1059
|
dongsheng@627
|
14814 msgid ""
|
dongsheng@627
|
14815 "(<command role=\"hg-cmd\">hg qinit <option role=\"hg-ext-mq-cmd-qinit-opt"
|
dongsheng@627
|
14816 "\">hg -c</option></command> does this for you automatically); you "
|
dongsheng@627
|
14817 "<emphasis>really</emphasis> don't want to manage the <filename role=\"special"
|
dongsheng@627
|
14818 "\">status</filename> file."
|
dongsheng@627
|
14819 msgstr ""
|
dongsheng@627
|
14820
|
dongsheng@627
|
14821 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14822 #: ../en/ch12-mq.xml:1066
|
dongsheng@627
|
14823 msgid ""
|
dongsheng@627
|
14824 "As a convenience, if MQ notices that the <filename class=\"directory\">.hg/"
|
dongsheng@627
|
14825 "patches</filename> directory is a repository, it will automatically <command "
|
dongsheng@627
|
14826 "role=\"hg-cmd\">hg add</command> every patch that you create and import."
|
dongsheng@627
|
14827 msgstr ""
|
dongsheng@627
|
14828
|
dongsheng@627
|
14829 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14830 #: ../en/ch12-mq.xml:1071
|
dongsheng@627
|
14831 msgid ""
|
dongsheng@627
|
14832 "MQ provides a shortcut command, <command role=\"hg-ext-mq\">qcommit</"
|
dongsheng@627
|
14833 "command>, that runs <command role=\"hg-cmd\">hg commit</command> in the "
|
dongsheng@627
|
14834 "<filename role=\"special\" class=\"directory\">.hg/patches</filename> "
|
dongsheng@627
|
14835 "directory. This saves some bothersome typing."
|
dongsheng@627
|
14836 msgstr ""
|
dongsheng@627
|
14837
|
dongsheng@627
|
14838 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14839 #: ../en/ch12-mq.xml:1077
|
dongsheng@627
|
14840 msgid ""
|
dongsheng@627
|
14841 "Finally, as a convenience to manage the patch directory, you can define the "
|
dongsheng@627
|
14842 "alias <command>mq</command> on Unix systems. For example, on Linux systems "
|
dongsheng@627
|
14843 "using the <command>bash</command> shell, you can include the following "
|
dongsheng@627
|
14844 "snippet in your <filename role=\"home\">~/.bashrc</filename>."
|
dongsheng@627
|
14845 msgstr ""
|
dongsheng@627
|
14846
|
dongsheng@627
|
14847 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14848 #: ../en/ch12-mq.xml:1087
|
dongsheng@627
|
14849 msgid ""
|
dongsheng@627
|
14850 "You can then issue commands of the form <command>mq pull</command> from the "
|
dongsheng@627
|
14851 "main repository."
|
dongsheng@627
|
14852 msgstr ""
|
dongsheng@627
|
14853
|
dongsheng@627
|
14854 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
14855 #: ../en/ch12-mq.xml:1092
|
dongsheng@627
|
14856 msgid "A few things to watch out for"
|
dongsheng@636
|
14857 msgstr "需要注意的事情"
|
dongsheng@627
|
14858
|
dongsheng@627
|
14859 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14860 #: ../en/ch12-mq.xml:1094
|
dongsheng@627
|
14861 msgid ""
|
dongsheng@627
|
14862 "MQ's support for working with a repository full of patches is limited in a "
|
dongsheng@627
|
14863 "few small respects."
|
dongsheng@627
|
14864 msgstr ""
|
dongsheng@627
|
14865
|
dongsheng@627
|
14866 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14867 #: ../en/ch12-mq.xml:1097
|
dongsheng@627
|
14868 msgid ""
|
dongsheng@627
|
14869 "MQ cannot automatically detect changes that you make to the patch directory. "
|
dongsheng@627
|
14870 "If you <command role=\"hg-cmd\">hg pull</command>, manually edit, or <command "
|
dongsheng@627
|
14871 "role=\"hg-cmd\">hg update</command> changes to patches or the <filename role="
|
dongsheng@627
|
14872 "\"special\">series</filename> file, you will have to <command role=\"hg-cmd"
|
dongsheng@627
|
14873 "\">hg qpop <option role=\"hg-ext-mq-cmd-qpop-opt\">hg -a</option></command> "
|
dongsheng@627
|
14874 "and then <command role=\"hg-cmd\">hg qpush <option role=\"hg-ext-mq-cmd-qpush-"
|
dongsheng@627
|
14875 "opt\">hg -a</option></command> in the underlying repository to see those "
|
dongsheng@627
|
14876 "changes show up there. If you forget to do this, you can confuse MQ's idea "
|
dongsheng@627
|
14877 "of which patches are applied."
|
dongsheng@627
|
14878 msgstr ""
|
dongsheng@627
|
14879
|
dongsheng@627
|
14880 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
14881 #: ../en/ch12-mq.xml:1113
|
dongsheng@627
|
14882 msgid "Third party tools for working with patches"
|
dongsheng@636
|
14883 msgstr "操作补丁的第三方工具"
|
dongsheng@627
|
14884
|
dongsheng@627
|
14885 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14886 #: ../en/ch12-mq.xml:1115
|
dongsheng@627
|
14887 msgid ""
|
dongsheng@627
|
14888 "Once you've been working with patches for a while, you'll find yourself "
|
dongsheng@627
|
14889 "hungry for tools that will help you to understand and manipulate the patches "
|
dongsheng@627
|
14890 "you're dealing with."
|
dongsheng@627
|
14891 msgstr ""
|
dongsheng@627
|
14892
|
dongsheng@627
|
14893 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14894 #: ../en/ch12-mq.xml:1119
|
dongsheng@627
|
14895 msgid ""
|
dongsheng@627
|
14896 "The <command>diffstat</command> command <citation>web:diffstat</citation> "
|
dongsheng@627
|
14897 "generates a histogram of the modifications made to each file in a patch. It "
|
dongsheng@627
|
14898 "provides a good way to <quote>get a sense of</quote> a patch&emdash;which "
|
dongsheng@627
|
14899 "files it affects, and how much change it introduces to each file and as a "
|
dongsheng@627
|
14900 "whole. (I find that it's a good idea to use <command>diffstat</command>'s "
|
dongsheng@627
|
14901 "<option role=\"cmd-opt-diffstat\">-p</option> option as a matter of course, "
|
dongsheng@627
|
14902 "as otherwise it will try to do clever things with prefixes of file names that "
|
dongsheng@627
|
14903 "inevitably confuse at least me.)"
|
dongsheng@627
|
14904 msgstr ""
|
dongsheng@627
|
14905
|
dongsheng@627
|
14906 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14907 #: ../en/ch12-mq.xml:1133
|
dongsheng@627
|
14908 msgid ""
|
dongsheng@627
|
14909 "The <literal role=\"package\">patchutils</literal> package <citation>web:"
|
dongsheng@627
|
14910 "patchutils</citation> is invaluable. It provides a set of small utilities "
|
dongsheng@627
|
14911 "that follow the <quote>Unix philosophy;</quote> each does one useful thing "
|
dongsheng@627
|
14912 "with a patch. The <literal role=\"package\">patchutils</literal> command I "
|
dongsheng@627
|
14913 "use most is <command>filterdiff</command>, which extracts subsets from a "
|
dongsheng@627
|
14914 "patch file. For example, given a patch that modifies hundreds of files "
|
dongsheng@627
|
14915 "across dozens of directories, a single invocation of <command>filterdiff</"
|
dongsheng@627
|
14916 "command> can generate a smaller patch that only touches files whose names "
|
dongsheng@627
|
14917 "match a particular glob pattern. See section <xref linkend=\"mq-collab.tips."
|
dongsheng@627
|
14918 "interdiff\"/> for another example."
|
dongsheng@627
|
14919 msgstr ""
|
dongsheng@627
|
14920
|
dongsheng@627
|
14921 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
14922 #: ../en/ch12-mq.xml:1149
|
dongsheng@627
|
14923 msgid "Good ways to work with patches"
|
dongsheng@636
|
14924 msgstr "操作补丁的好习惯"
|
dongsheng@627
|
14925
|
dongsheng@627
|
14926 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14927 #: ../en/ch12-mq.xml:1151
|
dongsheng@627
|
14928 msgid ""
|
dongsheng@627
|
14929 "Whether you are working on a patch series to submit to a free software or "
|
dongsheng@627
|
14930 "open source project, or a series that you intend to treat as a sequence of "
|
dongsheng@627
|
14931 "regular changesets when you're done, you can use some simple techniques to "
|
dongsheng@627
|
14932 "keep your work well organised."
|
dongsheng@627
|
14933 msgstr ""
|
dongsheng@627
|
14934
|
dongsheng@627
|
14935 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14936 #: ../en/ch12-mq.xml:1157
|
dongsheng@627
|
14937 msgid ""
|
dongsheng@627
|
14938 "Give your patches descriptive names. A good name for a patch might be "
|
dongsheng@627
|
14939 "<filename>rework-device-alloc.patch</filename>, because it will immediately "
|
dongsheng@627
|
14940 "give you a hint what the purpose of the patch is. Long names shouldn't be a "
|
dongsheng@627
|
14941 "problem; you won't be typing the names often, but you <emphasis>will</"
|
dongsheng@627
|
14942 "emphasis> be running commands like <command role=\"hg-ext-mq\">qapplied</"
|
dongsheng@627
|
14943 "command> and <command role=\"hg-ext-mq\">qtop</command> over and over. Good "
|
dongsheng@627
|
14944 "naming becomes especially important when you have a number of patches to work "
|
dongsheng@627
|
14945 "with, or if you are juggling a number of different tasks and your patches "
|
dongsheng@627
|
14946 "only get a fraction of your attention."
|
dongsheng@627
|
14947 msgstr ""
|
dongsheng@627
|
14948
|
dongsheng@627
|
14949 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14950 #: ../en/ch12-mq.xml:1169
|
dongsheng@627
|
14951 msgid ""
|
dongsheng@627
|
14952 "Be aware of what patch you're working on. Use the <command role=\"hg-ext-mq"
|
dongsheng@627
|
14953 "\">qtop</command> command and skim over the text of your patches "
|
dongsheng@627
|
14954 "frequently&emdash;for example, using <command role=\"hg-cmd\">hg tip <option "
|
dongsheng@627
|
14955 "role=\"hg-opt-tip\">-p</option></command>)&emdash;to be sure of where you "
|
dongsheng@627
|
14956 "stand. I have several times worked on and <command role=\"hg-ext-mq"
|
dongsheng@627
|
14957 "\">qrefresh</command>ed a patch other than the one I intended, and it's often "
|
dongsheng@627
|
14958 "tricky to migrate changes into the right patch after making them in the wrong "
|
dongsheng@627
|
14959 "one."
|
dongsheng@627
|
14960 msgstr ""
|
dongsheng@627
|
14961
|
dongsheng@627
|
14962 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
14963 #: ../en/ch12-mq.xml:1179
|
dongsheng@627
|
14964 msgid ""
|
dongsheng@627
|
14965 "For this reason, it is very much worth investing a little time to learn how "
|
dongsheng@627
|
14966 "to use some of the third-party tools I described in section <xref linkend="
|
dongsheng@627
|
14967 "\"sec.mq.tools\"/>, particularly <command>diffstat</command> and "
|
dongsheng@627
|
14968 "<command>filterdiff</command>. The former will give you a quick idea of what "
|
dongsheng@627
|
14969 "changes your patch is making, while the latter makes it easy to splice hunks "
|
dongsheng@627
|
14970 "selectively out of one patch and into another."
|
dongsheng@627
|
14971 msgstr ""
|
dongsheng@627
|
14972
|
dongsheng@627
|
14973 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
14974 #: ../en/ch12-mq.xml:1190
|
dongsheng@627
|
14975 msgid "MQ cookbook"
|
dongsheng@636
|
14976 msgstr "MQ 手册"
|
dongsheng@627
|
14977
|
dongsheng@627
|
14978 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
14979 #: ../en/ch12-mq.xml:1193
|
dongsheng@627
|
14980 msgid "Manage <quote>trivial</quote> patches"
|
dongsheng@636
|
14981 msgstr "管理<quote>琐碎的</quote>补丁"
|
dongsheng@627
|
14982
|
dongsheng@627
|
14983 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14984 #: ../en/ch12-mq.xml:1195
|
dongsheng@627
|
14985 msgid ""
|
dongsheng@627
|
14986 "Because the overhead of dropping files into a new Mercurial repository is so "
|
dongsheng@627
|
14987 "low, it makes a lot of sense to manage patches this way even if you simply "
|
dongsheng@627
|
14988 "want to make a few changes to a source tarball that you downloaded."
|
dongsheng@627
|
14989 msgstr ""
|
dongsheng@627
|
14990
|
dongsheng@627
|
14991 #
|
dongsheng@627
|
14992 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
14993 #: ../en/ch12-mq.xml:1200
|
dongsheng@627
|
14994 msgid ""
|
dongsheng@627
|
14995 "Begin by downloading and unpacking the source tarball, and turning it into a "
|
dongsheng@627
|
14996 "Mercurial repository."
|
dongsheng@627
|
14997 msgstr ""
|
dongsheng@627
|
14998
|
dongsheng@627
|
14999 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
15000 #: ../en/ch12-mq.xml:1205
|
dongsheng@627
|
15001 msgid "Continue by creating a patch stack and making your changes."
|
dongsheng@627
|
15002 msgstr ""
|
dongsheng@627
|
15003
|
dongsheng@627
|
15004 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
15005 #: ../en/ch12-mq.xml:1210
|
dongsheng@627
|
15006 msgid ""
|
dongsheng@627
|
15007 "Let's say a few weeks or months pass, and your package author releases a new "
|
dongsheng@627
|
15008 "version. First, bring their changes into the repository."
|
dongsheng@627
|
15009 msgstr ""
|
dongsheng@627
|
15010
|
dongsheng@627
|
15011 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
15012 #: ../en/ch12-mq.xml:1216
|
dongsheng@627
|
15013 msgid ""
|
dongsheng@627
|
15014 "The pipeline starting with <command role=\"hg-cmd\">hg locate</command> above "
|
dongsheng@627
|
15015 "deletes all files in the working directory, so that <command role=\"hg-cmd"
|
dongsheng@627
|
15016 "\">hg commit</command>'s <option role=\"hg-opt-commit\">--addremove</option> "
|
dongsheng@627
|
15017 "option can actually tell which files have really been removed in the newer "
|
dongsheng@627
|
15018 "version of the source."
|
dongsheng@627
|
15019 msgstr ""
|
dongsheng@627
|
15020
|
dongsheng@627
|
15021 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
15022 #: ../en/ch12-mq.xml:1224
|
dongsheng@627
|
15023 msgid "Finally, you can apply your patches on top of the new tree."
|
dongsheng@627
|
15024 msgstr ""
|
dongsheng@627
|
15025
|
dongsheng@627
|
15026 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
15027 #: ../en/ch12-mq.xml:1231
|
dongsheng@627
|
15028 msgid "Combining entire patches"
|
dongsheng@636
|
15029 msgstr "组合全部的补丁"
|
dongsheng@627
|
15030
|
dongsheng@627
|
15031 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
15032 #: ../en/ch12-mq.xml:1233
|
dongsheng@627
|
15033 msgid ""
|
dongsheng@627
|
15034 "MQ provides a command, <command role=\"hg-ext-mq\">qfold</command> that lets "
|
dongsheng@627
|
15035 "you combine entire patches. This <quote>folds</quote> the patches you name, "
|
dongsheng@627
|
15036 "in the order you name them, into the topmost applied patch, and concatenates "
|
dongsheng@627
|
15037 "their descriptions onto the end of its description. The patches that you "
|
dongsheng@627
|
15038 "fold must be unapplied before you fold them."
|
dongsheng@627
|
15039 msgstr ""
|
dongsheng@627
|
15040
|
dongsheng@627
|
15041 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
15042 #: ../en/ch12-mq.xml:1241
|
dongsheng@627
|
15043 msgid ""
|
dongsheng@627
|
15044 "The order in which you fold patches matters. If your topmost applied patch "
|
dongsheng@627
|
15045 "is <literal>foo</literal>, and you <command role=\"hg-ext-mq\">qfold</"
|
dongsheng@627
|
15046 "command> <literal>bar</literal> and <literal>quux</literal> into it, you will "
|
dongsheng@627
|
15047 "end up with a patch that has the same effect as if you applied first "
|
dongsheng@627
|
15048 "<literal>foo</literal>, then <literal>bar</literal>, followed by "
|
dongsheng@627
|
15049 "<literal>quux</literal>."
|
dongsheng@627
|
15050 msgstr ""
|
dongsheng@627
|
15051
|
dongsheng@627
|
15052 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@641
|
15053 #: ../en/ch12-mq.xml:1252
|
dongsheng@627
|
15054 msgid "Merging part of one patch into another"
|
dongsheng@636
|
15055 msgstr "合并补丁的部分内容到其它补丁"
|
dongsheng@627
|
15056
|
dongsheng@627
|
15057 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
15058 #: ../en/ch12-mq.xml:1254
|
dongsheng@627
|
15059 msgid ""
|
dongsheng@627
|
15060 "Merging <emphasis>part</emphasis> of one patch into another is more difficult "
|
dongsheng@627
|
15061 "than combining entire patches."
|
dongsheng@627
|
15062 msgstr ""
|
dongsheng@627
|
15063
|
dongsheng@627
|
15064 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
15065 #: ../en/ch12-mq.xml:1258
|
dongsheng@627
|
15066 msgid ""
|
dongsheng@627
|
15067 "If you want to move changes to entire files, you can use <command>filterdiff</"
|
dongsheng@627
|
15068 "command>'s <option role=\"cmd-opt-filterdiff\">-i</option> and <option role="
|
dongsheng@627
|
15069 "\"cmd-opt-filterdiff\">-x</option> options to choose the modifications to "
|
dongsheng@627
|
15070 "snip out of one patch, concatenating its output onto the end of the patch you "
|
dongsheng@627
|
15071 "want to merge into. You usually won't need to modify the patch you've merged "
|
dongsheng@627
|
15072 "the changes from. Instead, MQ will report some rejected hunks when you "
|
dongsheng@627
|
15073 "<command role=\"hg-ext-mq\">qpush</command> it (from the hunks you moved into "
|
dongsheng@627
|
15074 "the other patch), and you can simply <command role=\"hg-ext-mq\">qrefresh</"
|
dongsheng@627
|
15075 "command> the patch to drop the duplicate hunks."
|
dongsheng@627
|
15076 msgstr ""
|
dongsheng@627
|
15077
|
dongsheng@627
|
15078 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
15079 #: ../en/ch12-mq.xml:1271
|
dongsheng@627
|
15080 msgid ""
|
dongsheng@627
|
15081 "If you have a patch that has multiple hunks modifying a file, and you only "
|
dongsheng@627
|
15082 "want to move a few of those hunks, the job becomes more messy, but you can "
|
dongsheng@627
|
15083 "still partly automate it. Use <command>lsdiff -nvv</command> to print some "
|
dongsheng@627
|
15084 "metadata about the patch."
|
dongsheng@627
|
15085 msgstr ""
|
dongsheng@627
|
15086
|
dongsheng@627
|
15087 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
15088 #: ../en/ch12-mq.xml:1279
|
dongsheng@627
|
15089 msgid "This command prints three different kinds of number:"
|
dongsheng@627
|
15090 msgstr ""
|
dongsheng@627
|
15091
|
dongsheng@627
|
15092 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
15093 #: ../en/ch12-mq.xml:1282
|
dongsheng@627
|
15094 msgid ""
|
dongsheng@627
|
15095 "(in the first column) a <emphasis>file number</emphasis> to identify each "
|
dongsheng@627
|
15096 "file modified in the patch;"
|
dongsheng@627
|
15097 msgstr ""
|
dongsheng@627
|
15098
|
dongsheng@627
|
15099 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
15100 #: ../en/ch12-mq.xml:1286
|
dongsheng@627
|
15101 msgid ""
|
dongsheng@627
|
15102 "(on the next line, indented) the line number within a modified file where a "
|
dongsheng@627
|
15103 "hunk starts; and"
|
dongsheng@627
|
15104 msgstr ""
|
dongsheng@627
|
15105
|
dongsheng@627
|
15106 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@641
|
15107 #: ../en/ch12-mq.xml:1289
|
dongsheng@627
|
15108 msgid ""
|
dongsheng@627
|
15109 "(on the same line) a <emphasis>hunk number</emphasis> to identify that hunk."
|
dongsheng@627
|
15110 msgstr ""
|
dongsheng@627
|
15111
|
dongsheng@627
|
15112 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
15113 #: ../en/ch12-mq.xml:1293
|
dongsheng@627
|
15114 msgid ""
|
dongsheng@627
|
15115 "You'll have to use some visual inspection, and reading of the patch, to "
|
dongsheng@627
|
15116 "identify the file and hunk numbers you'll want, but you can then pass them to "
|
dongsheng@627
|
15117 "to <command>filterdiff</command>'s <option role=\"cmd-opt-filterdiff\">--"
|
dongsheng@627
|
15118 "files</option> and <option role=\"cmd-opt-filterdiff\">--hunks</option> "
|
dongsheng@627
|
15119 "options, to select exactly the file and hunk you want to extract."
|
dongsheng@627
|
15120 msgstr ""
|
dongsheng@627
|
15121
|
dongsheng@627
|
15122 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@641
|
15123 #: ../en/ch12-mq.xml:1301
|
dongsheng@627
|
15124 msgid ""
|
dongsheng@627
|
15125 "Once you have this hunk, you can concatenate it onto the end of your "
|
dongsheng@627
|
15126 "destination patch and continue with the remainder of section <xref linkend="
|
dongsheng@627
|
15127 "\"sec.mq.combine\"/>."
|
dongsheng@627
|
15128 msgstr ""
|
dongsheng@627
|
15129
|
dongsheng@627
|
15130 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@641
|
15131 #: ../en/ch12-mq.xml:1308
|
dongsheng@627
|
15132 msgid "Differences between quilt and MQ"
|
dongsheng@636
|
15133 msgstr "MQ 与 quilt 的区别"
|
dongsheng@627
|
15134
|
dongsheng@627
|
15135 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
15136 #: ../en/ch12-mq.xml:1310
|
dongsheng@627
|
15137 msgid ""
|
dongsheng@627
|
15138 "If you are already familiar with quilt, MQ provides a similar command set. "
|
dongsheng@627
|
15139 "There are a few differences in the way that it works."
|
dongsheng@627
|
15140 msgstr ""
|
dongsheng@627
|
15141
|
dongsheng@627
|
15142 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@641
|
15143 #: ../en/ch12-mq.xml:1314
|
dongsheng@627
|
15144 msgid ""
|
dongsheng@627
|
15145 "You will already have noticed that most quilt commands have MQ counterparts "
|
dongsheng@627
|
15146 "that simply begin with a <quote><literal>q</literal></quote>. The exceptions "
|
dongsheng@627
|
15147 "are quilt's <literal>add</literal> and <literal>remove</literal> commands, "
|
dongsheng@627
|
15148 "the counterparts for which are the normal Mercurial <command role=\"hg-cmd"
|
dongsheng@627
|
15149 "\">hg add</command> and <command role=\"hg-cmd\">hg remove</command> "
|
dongsheng@627
|
15150 "commands. There is no MQ equivalent of the quilt <literal>edit</literal> "
|
dongsheng@627
|
15151 "command."
|
dongsheng@627
|
15152 msgstr ""
|
dongsheng@627
|
15153
|
dongsheng@627
|
15154 #. type: Content of: <book><chapter><title>
|
dongsheng@627
|
15155 #: ../en/ch13-mq-collab.xml:5
|
dongsheng@627
|
15156 msgid "Advanced uses of Mercurial Queues"
|
dongsheng@627
|
15157 msgstr "MQ 的高级用法"
|
dongsheng@627
|
15158
|
dongsheng@627
|
15159 #. type: Content of: <book><chapter><para>
|
dongsheng@627
|
15160 #: ../en/ch13-mq-collab.xml:7
|
dongsheng@627
|
15161 msgid ""
|
dongsheng@627
|
15162 "While it's easy to pick up straightforward uses of Mercurial Queues, use of a "
|
dongsheng@627
|
15163 "little discipline and some of MQ's less frequently used capabilities makes it "
|
dongsheng@627
|
15164 "possible to work in complicated development environments."
|
dongsheng@627
|
15165 msgstr ""
|
dongsheng@627
|
15166
|
dongsheng@627
|
15167 #. type: Content of: <book><chapter><para>
|
dongsheng@627
|
15168 #: ../en/ch13-mq-collab.xml:12
|
dongsheng@627
|
15169 msgid ""
|
dongsheng@627
|
15170 "In this chapter, I will use as an example a technique I have used to manage "
|
dongsheng@627
|
15171 "the development of an Infiniband device driver for the Linux kernel. The "
|
dongsheng@627
|
15172 "driver in question is large (at least as drivers go), with 25,000 lines of "
|
dongsheng@627
|
15173 "code spread across 35 source files. It is maintained by a small team of "
|
dongsheng@627
|
15174 "developers."
|
dongsheng@627
|
15175 msgstr ""
|
dongsheng@627
|
15176
|
dongsheng@627
|
15177 #. type: Content of: <book><chapter><para>
|
dongsheng@627
|
15178 #: ../en/ch13-mq-collab.xml:18
|
dongsheng@627
|
15179 msgid ""
|
dongsheng@627
|
15180 "While much of the material in this chapter is specific to Linux, the same "
|
dongsheng@627
|
15181 "principles apply to any code base for which you're not the primary owner, and "
|
dongsheng@627
|
15182 "upon which you need to do a lot of development."
|
dongsheng@627
|
15183 msgstr ""
|
dongsheng@627
|
15184
|
dongsheng@627
|
15185 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
15186 #: ../en/ch13-mq-collab.xml:24
|
dongsheng@627
|
15187 msgid "The problem of many targets"
|
dongsheng@636
|
15188 msgstr "多个目标的问题"
|
dongsheng@627
|
15189
|
dongsheng@627
|
15190 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15191 #: ../en/ch13-mq-collab.xml:26
|
dongsheng@627
|
15192 msgid ""
|
dongsheng@627
|
15193 "The Linux kernel changes rapidly, and has never been internally stable; "
|
dongsheng@627
|
15194 "developers frequently make drastic changes between releases. This means that "
|
dongsheng@627
|
15195 "a version of the driver that works well with a particular released version of "
|
dongsheng@627
|
15196 "the kernel will not even <emphasis>compile</emphasis> correctly against, "
|
dongsheng@627
|
15197 "typically, any other version."
|
dongsheng@627
|
15198 msgstr ""
|
dongsheng@627
|
15199
|
dongsheng@627
|
15200 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15201 #: ../en/ch13-mq-collab.xml:33
|
dongsheng@627
|
15202 msgid ""
|
dongsheng@627
|
15203 "To maintain a driver, we have to keep a number of distinct versions of Linux "
|
dongsheng@627
|
15204 "in mind."
|
dongsheng@627
|
15205 msgstr ""
|
dongsheng@627
|
15206
|
dongsheng@627
|
15207 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
15208 #: ../en/ch13-mq-collab.xml:36
|
dongsheng@627
|
15209 msgid ""
|
dongsheng@627
|
15210 "One target is the main Linux kernel development tree. Maintenance of the code "
|
dongsheng@627
|
15211 "is in this case partly shared by other developers in the kernel community, "
|
dongsheng@627
|
15212 "who make <quote>drive-by</quote> modifications to the driver as they develop "
|
dongsheng@627
|
15213 "and refine kernel subsystems."
|
dongsheng@627
|
15214 msgstr ""
|
dongsheng@627
|
15215
|
dongsheng@627
|
15216 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
15217 #: ../en/ch13-mq-collab.xml:42
|
dongsheng@627
|
15218 msgid ""
|
dongsheng@627
|
15219 "We also maintain a number of <quote>backports</quote> to older versions of "
|
dongsheng@627
|
15220 "the Linux kernel, to support the needs of customers who are running older "
|
dongsheng@627
|
15221 "Linux distributions that do not incorporate our drivers. (To "
|
dongsheng@627
|
15222 "<emphasis>backport</emphasis> a piece of code is to modify it to work in an "
|
dongsheng@627
|
15223 "older version of its target environment than the version it was developed "
|
dongsheng@627
|
15224 "for.)"
|
dongsheng@627
|
15225 msgstr ""
|
dongsheng@627
|
15226
|
dongsheng@627
|
15227 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
15228 #: ../en/ch13-mq-collab.xml:50
|
dongsheng@627
|
15229 msgid ""
|
dongsheng@627
|
15230 "Finally, we make software releases on a schedule that is necessarily not "
|
dongsheng@627
|
15231 "aligned with those used by Linux distributors and kernel developers, so that "
|
dongsheng@627
|
15232 "we can deliver new features to customers without forcing them to upgrade "
|
dongsheng@627
|
15233 "their entire kernels or distributions."
|
dongsheng@627
|
15234 msgstr ""
|
dongsheng@627
|
15235
|
dongsheng@627
|
15236 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
15237 #: ../en/ch13-mq-collab.xml:58
|
dongsheng@627
|
15238 msgid "Tempting approaches that don't work well"
|
dongsheng@636
|
15239 msgstr "工作不好的诱人方法"
|
dongsheng@627
|
15240
|
dongsheng@627
|
15241 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
15242 #: ../en/ch13-mq-collab.xml:60
|
dongsheng@627
|
15243 msgid ""
|
dongsheng@627
|
15244 "There are two <quote>standard</quote> ways to maintain a piece of software "
|
dongsheng@627
|
15245 "that has to target many different environments."
|
dongsheng@627
|
15246 msgstr ""
|
dongsheng@627
|
15247
|
dongsheng@627
|
15248 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
15249 #: ../en/ch13-mq-collab.xml:64
|
dongsheng@627
|
15250 msgid ""
|
dongsheng@627
|
15251 "The first is to maintain a number of branches, each intended for a single "
|
dongsheng@627
|
15252 "target. The trouble with this approach is that you must maintain iron "
|
dongsheng@627
|
15253 "discipline in the flow of changes between repositories. A new feature or bug "
|
dongsheng@627
|
15254 "fix must start life in a <quote>pristine</quote> repository, then percolate "
|
dongsheng@627
|
15255 "out to every backport repository. Backport changes are more limited in the "
|
dongsheng@627
|
15256 "branches they should propagate to; a backport change that is applied to a "
|
dongsheng@627
|
15257 "branch where it doesn't belong will probably stop the driver from compiling."
|
dongsheng@627
|
15258 msgstr ""
|
dongsheng@627
|
15259
|
dongsheng@627
|
15260 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
15261 #: ../en/ch13-mq-collab.xml:74
|
dongsheng@627
|
15262 msgid ""
|
dongsheng@627
|
15263 "The second is to maintain a single source tree filled with conditional "
|
dongsheng@627
|
15264 "statements that turn chunks of code on or off depending on the intended "
|
dongsheng@627
|
15265 "target. Because these <quote>ifdefs</quote> are not allowed in the Linux "
|
dongsheng@627
|
15266 "kernel tree, a manual or automatic process must be followed to strip them out "
|
dongsheng@627
|
15267 "and yield a clean tree. A code base maintained in this fashion rapidly "
|
dongsheng@627
|
15268 "becomes a rat's nest of conditional blocks that are difficult to understand "
|
dongsheng@627
|
15269 "and maintain."
|
dongsheng@627
|
15270 msgstr ""
|
dongsheng@627
|
15271
|
dongsheng@627
|
15272 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
15273 #: ../en/ch13-mq-collab.xml:83
|
dongsheng@627
|
15274 msgid ""
|
dongsheng@627
|
15275 "Neither of these approaches is well suited to a situation where you don't "
|
dongsheng@627
|
15276 "<quote>own</quote> the canonical copy of a source tree. In the case of a "
|
dongsheng@627
|
15277 "Linux driver that is distributed with the standard kernel, Linus's tree "
|
dongsheng@627
|
15278 "contains the copy of the code that will be treated by the world as "
|
dongsheng@627
|
15279 "canonical. The upstream version of <quote>my</quote> driver can be modified "
|
dongsheng@627
|
15280 "by people I don't know, without me even finding out about it until after the "
|
dongsheng@627
|
15281 "changes show up in Linus's tree."
|
dongsheng@627
|
15282 msgstr ""
|
dongsheng@627
|
15283
|
dongsheng@627
|
15284 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
15285 #: ../en/ch13-mq-collab.xml:93
|
dongsheng@627
|
15286 msgid ""
|
dongsheng@627
|
15287 "These approaches have the added weakness of making it difficult to generate "
|
dongsheng@627
|
15288 "well-formed patches to submit upstream."
|
dongsheng@627
|
15289 msgstr ""
|
dongsheng@627
|
15290
|
dongsheng@627
|
15291 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
15292 #: ../en/ch13-mq-collab.xml:97
|
dongsheng@627
|
15293 msgid ""
|
dongsheng@627
|
15294 "In principle, Mercurial Queues seems like a good candidate to manage a "
|
dongsheng@627
|
15295 "development scenario such as the above. While this is indeed the case, MQ "
|
dongsheng@627
|
15296 "contains a few added features that make the job more pleasant."
|
dongsheng@627
|
15297 msgstr ""
|
dongsheng@627
|
15298
|
dongsheng@627
|
15299 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
15300 #: ../en/ch13-mq-collab.xml:105
|
dongsheng@627
|
15301 msgid "Conditionally applying patches with guards"
|
dongsheng@636
|
15302 msgstr "有条件的应用补丁"
|
dongsheng@627
|
15303
|
dongsheng@627
|
15304 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15305 #: ../en/ch13-mq-collab.xml:107
|
dongsheng@627
|
15306 msgid ""
|
dongsheng@627
|
15307 "Perhaps the best way to maintain sanity with so many targets is to be able to "
|
dongsheng@627
|
15308 "choose specific patches to apply for a given situation. MQ provides a "
|
dongsheng@627
|
15309 "feature called <quote>guards</quote> (which originates with quilt's "
|
dongsheng@627
|
15310 "<literal>guards</literal> command) that does just this. To start off, let's "
|
dongsheng@627
|
15311 "create a simple repository for experimenting in."
|
dongsheng@627
|
15312 msgstr ""
|
dongsheng@627
|
15313
|
dongsheng@627
|
15314 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15315 #: ../en/ch13-mq-collab.xml:116
|
dongsheng@627
|
15316 msgid ""
|
dongsheng@627
|
15317 "This gives us a tiny repository that contains two patches that don't have any "
|
dongsheng@627
|
15318 "dependencies on each other, because they touch different files."
|
dongsheng@627
|
15319 msgstr ""
|
dongsheng@627
|
15320
|
dongsheng@627
|
15321 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15322 #: ../en/ch13-mq-collab.xml:120
|
dongsheng@627
|
15323 msgid ""
|
dongsheng@627
|
15324 "The idea behind conditional application is that you can <quote>tag</quote> a "
|
dongsheng@627
|
15325 "patch with a <emphasis>guard</emphasis>, which is simply a text string of "
|
dongsheng@627
|
15326 "your choosing, then tell MQ to select specific guards to use when applying "
|
dongsheng@627
|
15327 "patches. MQ will then either apply, or skip over, a guarded patch, depending "
|
dongsheng@627
|
15328 "on the guards that you have selected."
|
dongsheng@627
|
15329 msgstr ""
|
dongsheng@627
|
15330
|
dongsheng@627
|
15331 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15332 #: ../en/ch13-mq-collab.xml:127
|
dongsheng@627
|
15333 msgid ""
|
dongsheng@627
|
15334 "A patch can have an arbitrary number of guards; each one is "
|
dongsheng@627
|
15335 "<emphasis>positive</emphasis> (<quote>apply this patch if this guard is "
|
dongsheng@627
|
15336 "selected</quote>) or <emphasis>negative</emphasis> (<quote>skip this patch if "
|
dongsheng@627
|
15337 "this guard is selected</quote>). A patch with no guards is always applied."
|
dongsheng@627
|
15338 msgstr ""
|
dongsheng@627
|
15339
|
dongsheng@627
|
15340 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
15341 #: ../en/ch13-mq-collab.xml:135
|
dongsheng@627
|
15342 msgid "Controlling the guards on a patch"
|
dongsheng@636
|
15343 msgstr "控制补丁的应用条件"
|
dongsheng@627
|
15344
|
dongsheng@627
|
15345 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15346 #: ../en/ch13-mq-collab.xml:137
|
dongsheng@627
|
15347 msgid ""
|
dongsheng@627
|
15348 "The <command role=\"hg-ext-mq\">qguard</command> command lets you determine "
|
dongsheng@627
|
15349 "which guards should apply to a patch, or display the guards that are already "
|
dongsheng@627
|
15350 "in effect. Without any arguments, it displays the guards on the current "
|
dongsheng@627
|
15351 "topmost patch."
|
dongsheng@627
|
15352 msgstr ""
|
dongsheng@627
|
15353
|
dongsheng@627
|
15354 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15355 #: ../en/ch13-mq-collab.xml:144
|
dongsheng@627
|
15356 msgid ""
|
dongsheng@627
|
15357 "To set a positive guard on a patch, prefix the name of the guard with a "
|
dongsheng@627
|
15358 "<quote><literal>+</literal></quote>."
|
dongsheng@627
|
15359 msgstr ""
|
dongsheng@627
|
15360
|
dongsheng@627
|
15361 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15362 #: ../en/ch13-mq-collab.xml:149
|
dongsheng@627
|
15363 msgid ""
|
dongsheng@627
|
15364 "To set a negative guard on a patch, prefix the name of the guard with a "
|
dongsheng@627
|
15365 "<quote><literal>-</literal></quote>."
|
dongsheng@627
|
15366 msgstr ""
|
dongsheng@627
|
15367
|
dongsheng@627
|
15368 #. type: Content of: <book><chapter><sect1><note><para>
|
dongsheng@627
|
15369 #: ../en/ch13-mq-collab.xml:156
|
dongsheng@627
|
15370 msgid ""
|
dongsheng@627
|
15371 "The <command role=\"hg-ext-mq\">qguard</command> command <emphasis>sets</"
|
dongsheng@627
|
15372 "emphasis> the guards on a patch; it doesn't <emphasis>modify</emphasis> "
|
dongsheng@627
|
15373 "them. What this means is that if you run <command role=\"hg-cmd\">hg qguard "
|
dongsheng@627
|
15374 "+a +b</command> on a patch, then <command role=\"hg-cmd\">hg qguard +c</"
|
dongsheng@627
|
15375 "command> on the same patch, the <emphasis>only</emphasis> guard that will be "
|
dongsheng@627
|
15376 "set on it afterwards is <literal>+c</literal>."
|
dongsheng@627
|
15377 msgstr ""
|
dongsheng@627
|
15378
|
dongsheng@627
|
15379 #
|
dongsheng@627
|
15380 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15381 #: ../en/ch13-mq-collab.xml:165
|
dongsheng@627
|
15382 msgid ""
|
dongsheng@627
|
15383 "Mercurial stores guards in the <filename role=\"special\">series</filename> "
|
dongsheng@627
|
15384 "file; the form in which they are stored is easy both to understand and to "
|
dongsheng@627
|
15385 "edit by hand. (In other words, you don't have to use the <command role=\"hg-"
|
dongsheng@627
|
15386 "ext-mq\">qguard</command> command if you don't want to; it's okay to simply "
|
dongsheng@627
|
15387 "edit the <filename role=\"special\">series</filename> file.)"
|
dongsheng@627
|
15388 msgstr ""
|
dongsheng@627
|
15389
|
dongsheng@627
|
15390 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
15391 #: ../en/ch13-mq-collab.xml:177
|
dongsheng@627
|
15392 msgid "Selecting the guards to use"
|
dongsheng@636
|
15393 msgstr "选择使用的条件"
|
dongsheng@627
|
15394
|
dongsheng@627
|
15395 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15396 #: ../en/ch13-mq-collab.xml:179
|
dongsheng@627
|
15397 msgid ""
|
dongsheng@627
|
15398 "The <command role=\"hg-ext-mq\">qselect</command> command determines which "
|
dongsheng@627
|
15399 "guards are active at a given time. The effect of this is to determine which "
|
dongsheng@627
|
15400 "patches MQ will apply the next time you run <command role=\"hg-ext-mq"
|
dongsheng@627
|
15401 "\">qpush</command>. It has no other effect; in particular, it doesn't do "
|
dongsheng@627
|
15402 "anything to patches that are already applied."
|
dongsheng@627
|
15403 msgstr ""
|
dongsheng@627
|
15404
|
dongsheng@627
|
15405 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15406 #: ../en/ch13-mq-collab.xml:186
|
dongsheng@627
|
15407 msgid ""
|
dongsheng@627
|
15408 "With no arguments, the <command role=\"hg-ext-mq\">qselect</command> command "
|
dongsheng@627
|
15409 "lists the guards currently in effect, one per line of output. Each argument "
|
dongsheng@627
|
15410 "is treated as the name of a guard to apply."
|
dongsheng@627
|
15411 msgstr ""
|
dongsheng@627
|
15412
|
dongsheng@627
|
15413 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15414 #: ../en/ch13-mq-collab.xml:193
|
dongsheng@627
|
15415 msgid ""
|
dongsheng@627
|
15416 "In case you're interested, the currently selected guards are stored in the "
|
dongsheng@627
|
15417 "<filename role=\"special\">guards</filename> file."
|
dongsheng@627
|
15418 msgstr ""
|
dongsheng@627
|
15419
|
dongsheng@627
|
15420 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15421 #: ../en/ch13-mq-collab.xml:198
|
dongsheng@627
|
15422 msgid ""
|
dongsheng@627
|
15423 "We can see the effect the selected guards have when we run <command role=\"hg-"
|
dongsheng@627
|
15424 "ext-mq\">qpush</command>."
|
dongsheng@627
|
15425 msgstr ""
|
dongsheng@627
|
15426
|
dongsheng@627
|
15427 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15428 #: ../en/ch13-mq-collab.xml:203
|
dongsheng@627
|
15429 msgid ""
|
dongsheng@627
|
15430 "A guard cannot start with a <quote><literal>+</literal></quote> or "
|
dongsheng@627
|
15431 "<quote><literal>-</literal></quote> character. The name of a guard must not "
|
dongsheng@627
|
15432 "contain white space, but most other characters are acceptable. If you try to "
|
dongsheng@627
|
15433 "use a guard with an invalid name, MQ will complain:"
|
dongsheng@627
|
15434 msgstr ""
|
dongsheng@627
|
15435
|
dongsheng@627
|
15436 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15437 #: ../en/ch13-mq-collab.xml:212
|
dongsheng@627
|
15438 msgid "Changing the selected guards changes the patches that are applied."
|
dongsheng@627
|
15439 msgstr ""
|
dongsheng@627
|
15440
|
dongsheng@627
|
15441 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15442 #: ../en/ch13-mq-collab.xml:217
|
dongsheng@627
|
15443 msgid ""
|
dongsheng@627
|
15444 "You can see in the example below that negative guards take precedence over "
|
dongsheng@627
|
15445 "positive guards."
|
dongsheng@627
|
15446 msgstr ""
|
dongsheng@627
|
15447
|
dongsheng@627
|
15448 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
15449 #: ../en/ch13-mq-collab.xml:224
|
dongsheng@627
|
15450 msgid "MQ's rules for applying patches"
|
dongsheng@636
|
15451 msgstr "MQ 应用补丁的规则"
|
dongsheng@627
|
15452
|
dongsheng@627
|
15453 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15454 #: ../en/ch13-mq-collab.xml:226
|
dongsheng@627
|
15455 msgid ""
|
dongsheng@627
|
15456 "The rules that MQ uses when deciding whether to apply a patch are as follows."
|
dongsheng@627
|
15457 msgstr ""
|
dongsheng@627
|
15458
|
dongsheng@627
|
15459 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
15460 #: ../en/ch13-mq-collab.xml:229
|
dongsheng@627
|
15461 msgid "A patch that has no guards is always applied."
|
dongsheng@627
|
15462 msgstr ""
|
dongsheng@627
|
15463
|
dongsheng@627
|
15464 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
15465 #: ../en/ch13-mq-collab.xml:232
|
dongsheng@627
|
15466 msgid ""
|
dongsheng@627
|
15467 "If the patch has any negative guard that matches any currently selected "
|
dongsheng@627
|
15468 "guard, the patch is skipped."
|
dongsheng@627
|
15469 msgstr ""
|
dongsheng@627
|
15470
|
dongsheng@627
|
15471 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
15472 #: ../en/ch13-mq-collab.xml:235
|
dongsheng@627
|
15473 msgid ""
|
dongsheng@627
|
15474 "If the patch has any positive guard that matches any currently selected "
|
dongsheng@627
|
15475 "guard, the patch is applied."
|
dongsheng@627
|
15476 msgstr ""
|
dongsheng@627
|
15477
|
dongsheng@627
|
15478 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
15479 #: ../en/ch13-mq-collab.xml:238
|
dongsheng@627
|
15480 msgid ""
|
dongsheng@627
|
15481 "If the patch has positive or negative guards, but none matches any currently "
|
dongsheng@627
|
15482 "selected guard, the patch is skipped."
|
dongsheng@627
|
15483 msgstr ""
|
dongsheng@627
|
15484
|
dongsheng@627
|
15485 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
15486 #: ../en/ch13-mq-collab.xml:245
|
dongsheng@627
|
15487 msgid "Trimming the work environment"
|
dongsheng@636
|
15488 msgstr "修剪工作环境"
|
dongsheng@627
|
15489
|
dongsheng@627
|
15490 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15491 #: ../en/ch13-mq-collab.xml:247
|
dongsheng@627
|
15492 msgid ""
|
dongsheng@627
|
15493 "In working on the device driver I mentioned earlier, I don't apply the "
|
dongsheng@627
|
15494 "patches to a normal Linux kernel tree. Instead, I use a repository that "
|
dongsheng@627
|
15495 "contains only a snapshot of the source files and headers that are relevant to "
|
dongsheng@627
|
15496 "Infiniband development. This repository is 1% the size of a kernel "
|
dongsheng@627
|
15497 "repository, so it's easier to work with."
|
dongsheng@627
|
15498 msgstr ""
|
dongsheng@627
|
15499
|
dongsheng@627
|
15500 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15501 #: ../en/ch13-mq-collab.xml:254
|
dongsheng@627
|
15502 msgid ""
|
dongsheng@627
|
15503 "I then choose a <quote>base</quote> version on top of which the patches are "
|
dongsheng@627
|
15504 "applied. This is a snapshot of the Linux kernel tree as of a revision of my "
|
dongsheng@627
|
15505 "choosing. When I take the snapshot, I record the changeset ID from the "
|
dongsheng@627
|
15506 "kernel repository in the commit message. Since the snapshot preserves the "
|
dongsheng@627
|
15507 "<quote>shape</quote> and content of the relevant parts of the kernel tree, I "
|
dongsheng@627
|
15508 "can apply my patches on top of either my tiny repository or a normal kernel "
|
dongsheng@627
|
15509 "tree."
|
dongsheng@627
|
15510 msgstr ""
|
dongsheng@627
|
15511
|
dongsheng@627
|
15512 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15513 #: ../en/ch13-mq-collab.xml:263
|
dongsheng@627
|
15514 msgid ""
|
dongsheng@627
|
15515 "Normally, the base tree atop which the patches apply should be a snapshot of "
|
dongsheng@627
|
15516 "a very recent upstream tree. This best facilitates the development of "
|
dongsheng@627
|
15517 "patches that can easily be submitted upstream with few or no modifications."
|
dongsheng@627
|
15518 msgstr ""
|
dongsheng@627
|
15519
|
dongsheng@627
|
15520 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
15521 #: ../en/ch13-mq-collab.xml:270
|
dongsheng@627
|
15522 msgid "Dividing up the <filename role=\"special\">series</filename> file"
|
dongsheng@636
|
15523 msgstr "分类补丁<filename role=\"special\">系列</filename>"
|
dongsheng@627
|
15524
|
dongsheng@627
|
15525 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15526 #: ../en/ch13-mq-collab.xml:273
|
dongsheng@627
|
15527 msgid ""
|
dongsheng@627
|
15528 "I categorise the patches in the <filename role=\"special\">series</filename> "
|
dongsheng@627
|
15529 "file into a number of logical groups. Each section of like patches begins "
|
dongsheng@627
|
15530 "with a block of comments that describes the purpose of the patches that "
|
dongsheng@627
|
15531 "follow."
|
dongsheng@627
|
15532 msgstr ""
|
dongsheng@627
|
15533
|
dongsheng@627
|
15534 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15535 #: ../en/ch13-mq-collab.xml:279
|
dongsheng@627
|
15536 msgid ""
|
dongsheng@627
|
15537 "The sequence of patch groups that I maintain follows. The ordering of these "
|
dongsheng@627
|
15538 "groups is important; I'll describe why after I introduce the groups."
|
dongsheng@627
|
15539 msgstr ""
|
dongsheng@627
|
15540
|
dongsheng@627
|
15541 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
15542 #: ../en/ch13-mq-collab.xml:283
|
dongsheng@627
|
15543 msgid ""
|
dongsheng@627
|
15544 "The <quote>accepted</quote> group. Patches that the development team has "
|
dongsheng@627
|
15545 "submitted to the maintainer of the Infiniband subsystem, and which he has "
|
dongsheng@627
|
15546 "accepted, but which are not present in the snapshot that the tiny repository "
|
dongsheng@627
|
15547 "is based on. These are <quote>read only</quote> patches, present only to "
|
dongsheng@627
|
15548 "transform the tree into a similar state as it is in the upstream maintainer's "
|
dongsheng@627
|
15549 "repository."
|
dongsheng@627
|
15550 msgstr ""
|
dongsheng@627
|
15551
|
dongsheng@627
|
15552 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
15553 #: ../en/ch13-mq-collab.xml:291
|
dongsheng@627
|
15554 msgid ""
|
dongsheng@627
|
15555 "The <quote>rework</quote> group. Patches that I have submitted, but that the "
|
dongsheng@627
|
15556 "upstream maintainer has requested modifications to before he will accept them."
|
dongsheng@627
|
15557 msgstr ""
|
dongsheng@627
|
15558
|
dongsheng@627
|
15559 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
15560 #: ../en/ch13-mq-collab.xml:296
|
dongsheng@627
|
15561 msgid ""
|
dongsheng@627
|
15562 "The <quote>pending</quote> group. Patches that I have not yet submitted to "
|
dongsheng@627
|
15563 "the upstream maintainer, but which we have finished working on. These will be "
|
dongsheng@627
|
15564 "<quote>read only</quote> for a while. If the upstream maintainer accepts "
|
dongsheng@627
|
15565 "them upon submission, I'll move them to the end of the <quote>accepted</"
|
dongsheng@627
|
15566 "quote> group. If he requests that I modify any, I'll move them to the "
|
dongsheng@627
|
15567 "beginning of the <quote>rework</quote> group."
|
dongsheng@627
|
15568 msgstr ""
|
dongsheng@627
|
15569
|
dongsheng@627
|
15570 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
15571 #: ../en/ch13-mq-collab.xml:305
|
dongsheng@627
|
15572 msgid ""
|
dongsheng@627
|
15573 "The <quote>in progress</quote> group. Patches that are actively being "
|
dongsheng@627
|
15574 "developed, and should not be submitted anywhere yet."
|
dongsheng@627
|
15575 msgstr ""
|
dongsheng@627
|
15576
|
dongsheng@627
|
15577 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
15578 #: ../en/ch13-mq-collab.xml:309
|
dongsheng@627
|
15579 msgid ""
|
dongsheng@627
|
15580 "The <quote>backport</quote> group. Patches that adapt the source tree to "
|
dongsheng@627
|
15581 "older versions of the kernel tree."
|
dongsheng@627
|
15582 msgstr ""
|
dongsheng@627
|
15583
|
dongsheng@627
|
15584 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
15585 #: ../en/ch13-mq-collab.xml:313
|
dongsheng@627
|
15586 msgid ""
|
dongsheng@627
|
15587 "The <quote>do not ship</quote> group. Patches that for some reason should "
|
dongsheng@627
|
15588 "never be submitted upstream. For example, one such patch might change "
|
dongsheng@627
|
15589 "embedded driver identification strings to make it easier to distinguish, in "
|
dongsheng@627
|
15590 "the field, between an out-of-tree version of the driver and a version shipped "
|
dongsheng@627
|
15591 "by a distribution vendor."
|
dongsheng@627
|
15592 msgstr ""
|
dongsheng@627
|
15593
|
dongsheng@627
|
15594 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15595 #: ../en/ch13-mq-collab.xml:321
|
dongsheng@627
|
15596 msgid ""
|
dongsheng@627
|
15597 "Now to return to the reasons for ordering groups of patches in this way. We "
|
dongsheng@627
|
15598 "would like the lowest patches in the stack to be as stable as possible, so "
|
dongsheng@627
|
15599 "that we will not need to rework higher patches due to changes in context. "
|
dongsheng@627
|
15600 "Putting patches that will never be changed first in the <filename role="
|
dongsheng@627
|
15601 "\"special\">series</filename> file serves this purpose."
|
dongsheng@627
|
15602 msgstr ""
|
dongsheng@627
|
15603
|
dongsheng@627
|
15604 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15605 #: ../en/ch13-mq-collab.xml:329
|
dongsheng@627
|
15606 msgid ""
|
dongsheng@627
|
15607 "We would also like the patches that we know we'll need to modify to be "
|
dongsheng@627
|
15608 "applied on top of a source tree that resembles the upstream tree as closely "
|
dongsheng@627
|
15609 "as possible. This is why we keep accepted patches around for a while."
|
dongsheng@627
|
15610 msgstr ""
|
dongsheng@627
|
15611
|
dongsheng@627
|
15612 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15613 #: ../en/ch13-mq-collab.xml:334
|
dongsheng@627
|
15614 msgid ""
|
dongsheng@627
|
15615 "The <quote>backport</quote> and <quote>do not ship</quote> patches float at "
|
dongsheng@627
|
15616 "the end of the <filename role=\"special\">series</filename> file. The "
|
dongsheng@627
|
15617 "backport patches must be applied on top of all other patches, and the "
|
dongsheng@627
|
15618 "<quote>do not ship</quote> patches might as well stay out of harm's way."
|
dongsheng@627
|
15619 msgstr ""
|
dongsheng@627
|
15620
|
dongsheng@627
|
15621 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
15622 #: ../en/ch13-mq-collab.xml:343
|
dongsheng@627
|
15623 msgid "Maintaining the patch series"
|
dongsheng@636
|
15624 msgstr "维护补丁系列"
|
dongsheng@627
|
15625
|
dongsheng@627
|
15626 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15627 #: ../en/ch13-mq-collab.xml:345
|
dongsheng@627
|
15628 msgid ""
|
dongsheng@627
|
15629 "In my work, I use a number of guards to control which patches are to be "
|
dongsheng@627
|
15630 "applied."
|
dongsheng@627
|
15631 msgstr ""
|
dongsheng@627
|
15632
|
dongsheng@627
|
15633 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
15634 #: ../en/ch13-mq-collab.xml:349
|
dongsheng@627
|
15635 msgid ""
|
dongsheng@627
|
15636 "<quote>Accepted</quote> patches are guarded with <literal>accepted</"
|
dongsheng@627
|
15637 "literal>. I enable this guard most of the time. When I'm applying the "
|
dongsheng@627
|
15638 "patches on top of a tree where the patches are already present, I can turn "
|
dongsheng@627
|
15639 "this patch off, and the patches that follow it will apply cleanly."
|
dongsheng@627
|
15640 msgstr ""
|
dongsheng@627
|
15641
|
dongsheng@627
|
15642 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
15643 #: ../en/ch13-mq-collab.xml:356
|
dongsheng@627
|
15644 msgid ""
|
dongsheng@627
|
15645 "Patches that are <quote>finished</quote>, but not yet submitted, have no "
|
dongsheng@627
|
15646 "guards. If I'm applying the patch stack to a copy of the upstream tree, I "
|
dongsheng@627
|
15647 "don't need to enable any guards in order to get a reasonably safe source tree."
|
dongsheng@627
|
15648 msgstr ""
|
dongsheng@627
|
15649
|
dongsheng@627
|
15650 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
15651 #: ../en/ch13-mq-collab.xml:362
|
dongsheng@627
|
15652 msgid ""
|
dongsheng@627
|
15653 "Those patches that need reworking before being resubmitted are guarded with "
|
dongsheng@627
|
15654 "<literal>rework</literal>."
|
dongsheng@627
|
15655 msgstr ""
|
dongsheng@627
|
15656
|
dongsheng@627
|
15657 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
15658 #: ../en/ch13-mq-collab.xml:366
|
dongsheng@627
|
15659 msgid ""
|
dongsheng@627
|
15660 "For those patches that are still under development, I use <literal>devel</"
|
dongsheng@627
|
15661 "literal>."
|
dongsheng@627
|
15662 msgstr ""
|
dongsheng@627
|
15663
|
dongsheng@627
|
15664 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
15665 #: ../en/ch13-mq-collab.xml:369
|
dongsheng@627
|
15666 msgid ""
|
dongsheng@627
|
15667 "A backport patch may have several guards, one for each version of the kernel "
|
dongsheng@627
|
15668 "to which it applies. For example, a patch that backports a piece of code to "
|
dongsheng@627
|
15669 "2.6.9 will have a <literal>2.6.9</literal> guard."
|
dongsheng@627
|
15670 msgstr ""
|
dongsheng@627
|
15671
|
dongsheng@627
|
15672 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15673 #: ../en/ch13-mq-collab.xml:374
|
dongsheng@627
|
15674 msgid ""
|
dongsheng@627
|
15675 "This variety of guards gives me considerable flexibility in determining what "
|
dongsheng@627
|
15676 "kind of source tree I want to end up with. For most situations, the "
|
dongsheng@627
|
15677 "selection of appropriate guards is automated during the build process, but I "
|
dongsheng@627
|
15678 "can manually tune the guards to use for less common circumstances."
|
dongsheng@627
|
15679 msgstr ""
|
dongsheng@627
|
15680
|
dongsheng@627
|
15681 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
15682 #: ../en/ch13-mq-collab.xml:381
|
dongsheng@627
|
15683 msgid "The art of writing backport patches"
|
dongsheng@636
|
15684 msgstr "编写向后移植补丁的艺术"
|
dongsheng@627
|
15685
|
dongsheng@627
|
15686 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
15687 #: ../en/ch13-mq-collab.xml:383
|
dongsheng@627
|
15688 msgid ""
|
dongsheng@627
|
15689 "Using MQ, writing a backport patch is a simple process. All such a patch has "
|
dongsheng@627
|
15690 "to do is modify a piece of code that uses a kernel feature not present in the "
|
dongsheng@627
|
15691 "older version of the kernel, so that the driver continues to work correctly "
|
dongsheng@627
|
15692 "under that older version."
|
dongsheng@627
|
15693 msgstr ""
|
dongsheng@627
|
15694
|
dongsheng@627
|
15695 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
15696 #: ../en/ch13-mq-collab.xml:389
|
dongsheng@627
|
15697 msgid ""
|
dongsheng@627
|
15698 "A useful goal when writing a good backport patch is to make your code look as "
|
dongsheng@627
|
15699 "if it was written for the older version of the kernel you're targeting. The "
|
dongsheng@627
|
15700 "less obtrusive the patch, the easier it will be to understand and maintain. "
|
dongsheng@627
|
15701 "If you're writing a collection of backport patches to avoid the <quote>rat's "
|
dongsheng@627
|
15702 "nest</quote> effect of lots of <literal>#ifdef</literal>s (hunks of source "
|
dongsheng@627
|
15703 "code that are only used conditionally) in your code, don't introduce version-"
|
dongsheng@627
|
15704 "dependent <literal>#ifdef</literal>s into the patches. Instead, write "
|
dongsheng@627
|
15705 "several patches, each of which makes unconditional changes, and control their "
|
dongsheng@627
|
15706 "application using guards."
|
dongsheng@627
|
15707 msgstr ""
|
dongsheng@627
|
15708
|
dongsheng@627
|
15709 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
15710 #: ../en/ch13-mq-collab.xml:402
|
dongsheng@627
|
15711 msgid ""
|
dongsheng@627
|
15712 "There are two reasons to divide backport patches into a distinct group, away "
|
dongsheng@627
|
15713 "from the <quote>regular</quote> patches whose effects they modify. The first "
|
dongsheng@627
|
15714 "is that intermingling the two makes it more difficult to use a tool like the "
|
dongsheng@627
|
15715 "<literal role=\"hg-ext\">patchbomb</literal> extension to automate the "
|
dongsheng@627
|
15716 "process of submitting the patches to an upstream maintainer. The second is "
|
dongsheng@627
|
15717 "that a backport patch could perturb the context in which a subsequent regular "
|
dongsheng@627
|
15718 "patch is applied, making it impossible to apply the regular patch cleanly "
|
dongsheng@627
|
15719 "<emphasis>without</emphasis> the earlier backport patch already being applied."
|
dongsheng@627
|
15720 msgstr ""
|
dongsheng@627
|
15721
|
dongsheng@627
|
15722 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
15723 #: ../en/ch13-mq-collab.xml:417
|
dongsheng@627
|
15724 msgid "Useful tips for developing with MQ"
|
dongsheng@636
|
15725 msgstr "使用 MQ 开发的技巧"
|
dongsheng@627
|
15726
|
dongsheng@627
|
15727 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
15728 #: ../en/ch13-mq-collab.xml:420
|
dongsheng@627
|
15729 msgid "Organising patches in directories"
|
dongsheng@636
|
15730 msgstr "将补丁放到几个目录中"
|
dongsheng@627
|
15731
|
dongsheng@627
|
15732 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
15733 #: ../en/ch13-mq-collab.xml:422
|
dongsheng@627
|
15734 msgid ""
|
dongsheng@627
|
15735 "If you're working on a substantial project with MQ, it's not difficult to "
|
dongsheng@627
|
15736 "accumulate a large number of patches. For example, I have one patch "
|
dongsheng@627
|
15737 "repository that contains over 250 patches."
|
dongsheng@627
|
15738 msgstr ""
|
dongsheng@627
|
15739
|
dongsheng@627
|
15740 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
15741 #: ../en/ch13-mq-collab.xml:427
|
dongsheng@627
|
15742 msgid ""
|
dongsheng@627
|
15743 "If you can group these patches into separate logical categories, you can if "
|
dongsheng@627
|
15744 "you like store them in different directories; MQ has no problems with patch "
|
dongsheng@627
|
15745 "names that contain path separators."
|
dongsheng@627
|
15746 msgstr ""
|
dongsheng@627
|
15747
|
dongsheng@627
|
15748 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
15749 #: ../en/ch13-mq-collab.xml:434
|
dongsheng@627
|
15750 msgid "Viewing the history of a patch"
|
dongsheng@636
|
15751 msgstr "察看补丁的历史"
|
dongsheng@627
|
15752
|
dongsheng@627
|
15753 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
15754 #: ../en/ch13-mq-collab.xml:436
|
dongsheng@627
|
15755 msgid ""
|
dongsheng@627
|
15756 "If you're developing a set of patches over a long time, it's a good idea to "
|
dongsheng@627
|
15757 "maintain them in a repository, as discussed in section <xref linkend=\"sec.mq."
|
dongsheng@627
|
15758 "repo\"/>. If you do so, you'll quickly discover that using the <command role="
|
dongsheng@627
|
15759 "\"hg-cmd\">hg diff</command> command to look at the history of changes to a "
|
dongsheng@627
|
15760 "patch is unworkable. This is in part because you're looking at the second "
|
dongsheng@627
|
15761 "derivative of the real code (a diff of a diff), but also because MQ adds "
|
dongsheng@627
|
15762 "noise to the process by modifying time stamps and directory names when it "
|
dongsheng@627
|
15763 "updates a patch."
|
dongsheng@627
|
15764 msgstr ""
|
dongsheng@627
|
15765
|
dongsheng@627
|
15766 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
15767 #: ../en/ch13-mq-collab.xml:448
|
dongsheng@627
|
15768 msgid ""
|
dongsheng@627
|
15769 "However, you can use the <literal role=\"hg-ext\">extdiff</literal> "
|
dongsheng@627
|
15770 "extension, which is bundled with Mercurial, to turn a diff of two versions of "
|
dongsheng@627
|
15771 "a patch into something readable. To do this, you will need a third-party "
|
dongsheng@627
|
15772 "package called <literal role=\"package\">patchutils</literal> <citation>web:"
|
dongsheng@627
|
15773 "patchutils</citation>. This provides a command named <command>interdiff</"
|
dongsheng@627
|
15774 "command>, which shows the differences between two diffs as a diff. Used on "
|
dongsheng@627
|
15775 "two versions of the same diff, it generates a diff that represents the diff "
|
dongsheng@627
|
15776 "from the first to the second version."
|
dongsheng@627
|
15777 msgstr ""
|
dongsheng@627
|
15778
|
dongsheng@627
|
15779 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
15780 #: ../en/ch13-mq-collab.xml:459
|
dongsheng@627
|
15781 msgid ""
|
dongsheng@627
|
15782 "You can enable the <literal role=\"hg-ext\">extdiff</literal> extension in "
|
dongsheng@627
|
15783 "the usual way, by adding a line to the <literal role=\"rc-extensions"
|
dongsheng@627
|
15784 "\">extensions</literal> section of your <filename role=\"special\"> /.hgrc</"
|
dongsheng@627
|
15785 "filename>."
|
dongsheng@627
|
15786 msgstr ""
|
dongsheng@627
|
15787
|
dongsheng@627
|
15788 #
|
dongsheng@641
|
15789 #. &example.hg-interdiff;
|
dongsheng@627
|
15790 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
15791 #: ../en/ch13-mq-collab.xml:465
|
dongsheng@627
|
15792 msgid ""
|
dongsheng@627
|
15793 "The <command>interdiff</command> command expects to be passed the names of "
|
dongsheng@627
|
15794 "two files, but the <literal role=\"hg-ext\">extdiff</literal> extension "
|
dongsheng@627
|
15795 "passes the program it runs a pair of directories, each of which can contain "
|
dongsheng@627
|
15796 "an arbitrary number of files. We thus need a small program that will run "
|
dongsheng@627
|
15797 "<command>interdiff</command> on each pair of files in these two directories. "
|
dongsheng@627
|
15798 "This program is available as <filename role=\"special\">hg-interdiff</"
|
dongsheng@627
|
15799 "filename> in the <filename class=\"directory\">examples</filename> directory "
|
dongsheng@627
|
15800 "of the source code repository that accompanies this book."
|
dongsheng@627
|
15801 msgstr ""
|
dongsheng@627
|
15802
|
dongsheng@627
|
15803 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
15804 #: ../en/ch13-mq-collab.xml:477
|
dongsheng@627
|
15805 msgid ""
|
dongsheng@627
|
15806 "With the <filename role=\"special\">hg-interdiff</filename> program in your "
|
dongsheng@627
|
15807 "shell's search path, you can run it as follows, from inside an MQ patch "
|
dongsheng@627
|
15808 "directory:"
|
dongsheng@627
|
15809 msgstr ""
|
dongsheng@627
|
15810
|
dongsheng@627
|
15811 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
15812 #: ../en/ch13-mq-collab.xml:482
|
dongsheng@627
|
15813 msgid ""
|
dongsheng@627
|
15814 "Since you'll probably want to use this long-winded command a lot, you can get "
|
dongsheng@627
|
15815 "<literal role=\"hg-ext\">hgext</literal> to make it available as a normal "
|
dongsheng@627
|
15816 "Mercurial command, again by editing your <filename role=\"special\"> /.hgrc</"
|
dongsheng@627
|
15817 "filename>."
|
dongsheng@627
|
15818 msgstr ""
|
dongsheng@627
|
15819
|
dongsheng@627
|
15820 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
15821 #: ../en/ch13-mq-collab.xml:489
|
dongsheng@627
|
15822 msgid ""
|
dongsheng@627
|
15823 "This directs <literal role=\"hg-ext\">hgext</literal> to make an "
|
dongsheng@627
|
15824 "<literal>interdiff</literal> command available, so you can now shorten the "
|
dongsheng@627
|
15825 "previous invocation of <command role=\"hg-ext-extdiff\">extdiff</command> to "
|
dongsheng@627
|
15826 "something a little more wieldy."
|
dongsheng@627
|
15827 msgstr ""
|
dongsheng@627
|
15828
|
dongsheng@627
|
15829 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@627
|
15830 #: ../en/ch13-mq-collab.xml:498
|
dongsheng@627
|
15831 msgid ""
|
dongsheng@627
|
15832 "The <command>interdiff</command> command works well only if the underlying "
|
dongsheng@627
|
15833 "files against which versions of a patch are generated remain the same. If "
|
dongsheng@627
|
15834 "you create a patch, modify the underlying files, and then regenerate the "
|
dongsheng@627
|
15835 "patch, <command>interdiff</command> may not produce useful output."
|
dongsheng@627
|
15836 msgstr ""
|
dongsheng@627
|
15837
|
dongsheng@627
|
15838 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
15839 #: ../en/ch13-mq-collab.xml:506
|
dongsheng@627
|
15840 msgid ""
|
dongsheng@627
|
15841 "The <literal role=\"hg-ext\">extdiff</literal> extension is useful for more "
|
dongsheng@627
|
15842 "than merely improving the presentation of MQ patches. To read more about it, "
|
dongsheng@627
|
15843 "go to section <xref linkend=\"sec.hgext.extdiff\"/>."
|
dongsheng@627
|
15844 msgstr ""
|
dongsheng@627
|
15845
|
dongsheng@627
|
15846 #. type: Content of: <book><chapter><title>
|
dongsheng@627
|
15847 #: ../en/ch14-hgext.xml:5
|
dongsheng@627
|
15848 msgid "Adding functionality with extensions"
|
dongsheng@627
|
15849 msgstr "使用扩展增加功能"
|
dongsheng@627
|
15850
|
dongsheng@627
|
15851 #. type: Content of: <book><chapter><para>
|
dongsheng@627
|
15852 #: ../en/ch14-hgext.xml:7
|
dongsheng@627
|
15853 msgid ""
|
dongsheng@627
|
15854 "While the core of Mercurial is quite complete from a functionality "
|
dongsheng@627
|
15855 "standpoint, it's deliberately shorn of fancy features. This approach of "
|
dongsheng@627
|
15856 "preserving simplicity keeps the software easy to deal with for both "
|
dongsheng@627
|
15857 "maintainers and users."
|
dongsheng@627
|
15858 msgstr ""
|
dongsheng@627
|
15859
|
dongsheng@627
|
15860 #. type: Content of: <book><chapter><para>
|
dongsheng@627
|
15861 #: ../en/ch14-hgext.xml:12
|
dongsheng@627
|
15862 msgid ""
|
dongsheng@627
|
15863 "However, Mercurial doesn't box you in with an inflexible command set: you can "
|
dongsheng@627
|
15864 "add features to it as <emphasis>extensions</emphasis> (sometimes known as "
|
dongsheng@627
|
15865 "<emphasis>plugins</emphasis>). We've already discussed a few of these "
|
dongsheng@627
|
15866 "extensions in earlier chapters."
|
dongsheng@627
|
15867 msgstr ""
|
dongsheng@627
|
15868
|
dongsheng@627
|
15869 #. type: Content of: <book><chapter><itemizedlist><listitem><para>
|
dongsheng@627
|
15870 #: ../en/ch14-hgext.xml:18
|
dongsheng@627
|
15871 msgid ""
|
dongsheng@627
|
15872 "Section <xref linkend=\"sec.tour-merge.fetch\"/> covers the <literal role="
|
dongsheng@627
|
15873 "\"hg-ext\">fetch</literal> extension; this combines pulling new changes and "
|
dongsheng@627
|
15874 "merging them with local changes into a single command, <command role=\"hg-ext-"
|
dongsheng@627
|
15875 "fetch\">fetch</command>."
|
dongsheng@627
|
15876 msgstr ""
|
dongsheng@627
|
15877
|
dongsheng@627
|
15878 #. type: Content of: <book><chapter><itemizedlist><listitem><para>
|
dongsheng@627
|
15879 #: ../en/ch14-hgext.xml:24
|
dongsheng@627
|
15880 msgid ""
|
dongsheng@627
|
15881 "In chapter <xref linkend=\"chap.hook\"/>, we covered several extensions that "
|
dongsheng@627
|
15882 "are useful for hook-related functionality: <literal role=\"hg-ext\">acl</"
|
dongsheng@627
|
15883 "literal> adds access control lists; <literal role=\"hg-ext\">bugzilla</"
|
dongsheng@627
|
15884 "literal> adds integration with the Bugzilla bug tracking system; and <literal "
|
dongsheng@627
|
15885 "role=\"hg-ext\">notify</literal> sends notification emails on new changes."
|
dongsheng@627
|
15886 msgstr ""
|
dongsheng@627
|
15887
|
dongsheng@627
|
15888 #. type: Content of: <book><chapter><itemizedlist><listitem><para>
|
dongsheng@627
|
15889 #: ../en/ch14-hgext.xml:33
|
dongsheng@627
|
15890 msgid ""
|
dongsheng@627
|
15891 "The Mercurial Queues patch management extension is so invaluable that it "
|
dongsheng@627
|
15892 "merits two chapters and an appendix all to itself. Chapter <xref linkend="
|
dongsheng@627
|
15893 "\"chap.mq\"/> covers the basics; chapter <xref linkend=\"chap.mq-collab\"/> "
|
dongsheng@627
|
15894 "discusses advanced topics; and appendix <xref linkend=\"chap.mqref\"/> goes "
|
dongsheng@627
|
15895 "into detail on each command."
|
dongsheng@627
|
15896 msgstr ""
|
dongsheng@627
|
15897
|
dongsheng@627
|
15898 #. type: Content of: <book><chapter><para>
|
dongsheng@627
|
15899 #: ../en/ch14-hgext.xml:43
|
dongsheng@627
|
15900 msgid ""
|
dongsheng@627
|
15901 "In this chapter, we'll cover some of the other extensions that are available "
|
dongsheng@627
|
15902 "for Mercurial, and briefly touch on some of the machinery you'll need to know "
|
dongsheng@627
|
15903 "about if you want to write an extension of your own."
|
dongsheng@627
|
15904 msgstr ""
|
dongsheng@627
|
15905
|
dongsheng@627
|
15906 #. type: Content of: <book><chapter><itemizedlist><listitem><para>
|
dongsheng@627
|
15907 #: ../en/ch14-hgext.xml:48
|
dongsheng@627
|
15908 msgid ""
|
dongsheng@627
|
15909 "In section <xref linkend=\"sec.hgext.inotify\"/>, we'll discuss the "
|
dongsheng@627
|
15910 "possibility of <emphasis>huge</emphasis> performance improvements using the "
|
dongsheng@627
|
15911 "<literal role=\"hg-ext\">inotify</literal> extension."
|
dongsheng@627
|
15912 msgstr ""
|
dongsheng@627
|
15913
|
dongsheng@627
|
15914 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
15915 #: ../en/ch14-hgext.xml:55
|
dongsheng@627
|
15916 msgid ""
|
dongsheng@627
|
15917 "Improve performance with the <literal role=\"hg-ext\">inotify</literal> "
|
dongsheng@627
|
15918 "extension"
|
dongsheng@636
|
15919 msgstr "使用扩展 <literal role=\"hg-ext\">inotify</literal> 以提高性能"
|
dongsheng@627
|
15920
|
dongsheng@627
|
15921 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15922 #: ../en/ch14-hgext.xml:58
|
dongsheng@627
|
15923 msgid ""
|
dongsheng@627
|
15924 "Are you interested in having some of the most common Mercurial operations run "
|
dongsheng@627
|
15925 "as much as a hundred times faster? Read on!"
|
dongsheng@627
|
15926 msgstr ""
|
dongsheng@627
|
15927
|
dongsheng@627
|
15928 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15929 #: ../en/ch14-hgext.xml:62
|
dongsheng@627
|
15930 msgid ""
|
dongsheng@627
|
15931 "Mercurial has great performance under normal circumstances. For example, "
|
dongsheng@627
|
15932 "when you run the <command role=\"hg-cmd\">hg status</command> command, "
|
dongsheng@627
|
15933 "Mercurial has to scan almost every directory and file in your repository so "
|
dongsheng@627
|
15934 "that it can display file status. Many other Mercurial commands need to do "
|
dongsheng@627
|
15935 "the same work behind the scenes; for example, the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
15936 "diff</command> command uses the status machinery to avoid doing an expensive "
|
dongsheng@627
|
15937 "comparison operation on files that obviously haven't changed."
|
dongsheng@627
|
15938 msgstr ""
|
dongsheng@627
|
15939
|
dongsheng@627
|
15940 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15941 #: ../en/ch14-hgext.xml:72
|
dongsheng@627
|
15942 msgid ""
|
dongsheng@627
|
15943 "Because obtaining file status is crucial to good performance, the authors of "
|
dongsheng@627
|
15944 "Mercurial have optimised this code to within an inch of its life. However, "
|
dongsheng@627
|
15945 "there's no avoiding the fact that when you run <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
15946 "status</command>, Mercurial is going to have to perform at least one "
|
dongsheng@627
|
15947 "expensive system call for each managed file to determine whether it's changed "
|
dongsheng@627
|
15948 "since the last time Mercurial checked. For a sufficiently large repository, "
|
dongsheng@627
|
15949 "this can take a long time."
|
dongsheng@627
|
15950 msgstr ""
|
dongsheng@627
|
15951
|
dongsheng@627
|
15952 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15953 #: ../en/ch14-hgext.xml:82
|
dongsheng@627
|
15954 msgid ""
|
dongsheng@627
|
15955 "To put a number on the magnitude of this effect, I created a repository "
|
dongsheng@627
|
15956 "containing 150,000 managed files. I timed <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
15957 "status</command> as taking ten seconds to run, even when <emphasis>none</"
|
dongsheng@627
|
15958 "emphasis> of those files had been modified."
|
dongsheng@627
|
15959 msgstr ""
|
dongsheng@627
|
15960
|
dongsheng@627
|
15961 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15962 #: ../en/ch14-hgext.xml:88
|
dongsheng@627
|
15963 msgid ""
|
dongsheng@627
|
15964 "Many modern operating systems contain a file notification facility. If a "
|
dongsheng@627
|
15965 "program signs up to an appropriate service, the operating system will notify "
|
dongsheng@627
|
15966 "it every time a file of interest is created, modified, or deleted. On Linux "
|
dongsheng@627
|
15967 "systems, the kernel component that does this is called <literal>inotify</"
|
dongsheng@627
|
15968 "literal>."
|
dongsheng@627
|
15969 msgstr ""
|
dongsheng@627
|
15970
|
dongsheng@627
|
15971 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15972 #: ../en/ch14-hgext.xml:95
|
dongsheng@627
|
15973 msgid ""
|
dongsheng@627
|
15974 "Mercurial's <literal role=\"hg-ext\">inotify</literal> extension talks to the "
|
dongsheng@627
|
15975 "kernel's <literal>inotify</literal> component to optimise <command role=\"hg-"
|
dongsheng@627
|
15976 "cmd\">hg status</command> commands. The extension has two components. A "
|
dongsheng@627
|
15977 "daemon sits in the background and receives notifications from the "
|
dongsheng@627
|
15978 "<literal>inotify</literal> subsystem. It also listens for connections from a "
|
dongsheng@627
|
15979 "regular Mercurial command. The extension modifies Mercurial's behaviour so "
|
dongsheng@627
|
15980 "that instead of scanning the filesystem, it queries the daemon. Since the "
|
dongsheng@627
|
15981 "daemon has perfect information about the state of the repository, it can "
|
dongsheng@627
|
15982 "respond with a result instantaneously, avoiding the need to scan every "
|
dongsheng@627
|
15983 "directory and file in the repository."
|
dongsheng@627
|
15984 msgstr ""
|
dongsheng@627
|
15985
|
dongsheng@627
|
15986 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15987 #: ../en/ch14-hgext.xml:108
|
dongsheng@627
|
15988 msgid ""
|
dongsheng@627
|
15989 "Recall the ten seconds that I measured plain Mercurial as taking to run "
|
dongsheng@627
|
15990 "<command role=\"hg-cmd\">hg status</command> on a 150,000 file repository. "
|
dongsheng@627
|
15991 "With the <literal role=\"hg-ext\">inotify</literal> extension enabled, the "
|
dongsheng@627
|
15992 "time dropped to 0.1 seconds, a factor of <emphasis>one hundred</emphasis> "
|
dongsheng@627
|
15993 "faster."
|
dongsheng@627
|
15994 msgstr ""
|
dongsheng@627
|
15995
|
dongsheng@627
|
15996 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
15997 #: ../en/ch14-hgext.xml:115
|
dongsheng@627
|
15998 msgid "Before we continue, please pay attention to some caveats."
|
dongsheng@627
|
15999 msgstr ""
|
dongsheng@627
|
16000
|
dongsheng@627
|
16001 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
16002 #: ../en/ch14-hgext.xml:118
|
dongsheng@627
|
16003 msgid ""
|
dongsheng@627
|
16004 "The <literal role=\"hg-ext\">inotify</literal> extension is Linux-specific. "
|
dongsheng@627
|
16005 "Because it interfaces directly to the Linux kernel's <literal>inotify</"
|
dongsheng@627
|
16006 "literal> subsystem, it does not work on other operating systems."
|
dongsheng@627
|
16007 msgstr ""
|
dongsheng@627
|
16008
|
dongsheng@627
|
16009 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
16010 #: ../en/ch14-hgext.xml:123
|
dongsheng@627
|
16011 msgid ""
|
dongsheng@627
|
16012 "It should work on any Linux distribution that was released after early 2005. "
|
dongsheng@627
|
16013 "Older distributions are likely to have a kernel that lacks <literal>inotify</"
|
dongsheng@627
|
16014 "literal>, or a version of <literal>glibc</literal> that does not have the "
|
dongsheng@627
|
16015 "necessary interfacing support."
|
dongsheng@627
|
16016 msgstr ""
|
dongsheng@627
|
16017
|
dongsheng@627
|
16018 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@627
|
16019 #: ../en/ch14-hgext.xml:130
|
dongsheng@627
|
16020 msgid ""
|
dongsheng@627
|
16021 "Not all filesystems are suitable for use with the <literal role=\"hg-ext"
|
dongsheng@627
|
16022 "\">inotify</literal> extension. Network filesystems such as NFS are a non-"
|
dongsheng@627
|
16023 "starter, for example, particularly if you're running Mercurial on several "
|
dongsheng@627
|
16024 "systems, all mounting the same network filesystem. The kernel's "
|
dongsheng@627
|
16025 "<literal>inotify</literal> system has no way of knowing about changes made on "
|
dongsheng@627
|
16026 "another system. Most local filesystems (e.g. ext3, XFS, ReiserFS) should "
|
dongsheng@627
|
16027 "work fine."
|
dongsheng@627
|
16028 msgstr ""
|
dongsheng@627
|
16029
|
dongsheng@627
|
16030 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16031 #: ../en/ch14-hgext.xml:141
|
dongsheng@627
|
16032 msgid ""
|
dongsheng@627
|
16033 "The <literal role=\"hg-ext\">inotify</literal> extension is not yet shipped "
|
dongsheng@627
|
16034 "with Mercurial as of May 2007, so it's a little more involved to set up than "
|
dongsheng@627
|
16035 "other extensions. But the performance improvement is worth it!"
|
dongsheng@627
|
16036 msgstr ""
|
dongsheng@627
|
16037
|
dongsheng@627
|
16038 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16039 #: ../en/ch14-hgext.xml:146
|
dongsheng@627
|
16040 msgid ""
|
dongsheng@627
|
16041 "The extension currently comes in two parts: a set of patches to the Mercurial "
|
dongsheng@627
|
16042 "source code, and a library of Python bindings to the <literal>inotify</"
|
dongsheng@627
|
16043 "literal> subsystem."
|
dongsheng@627
|
16044 msgstr ""
|
dongsheng@627
|
16045
|
dongsheng@627
|
16046 #. type: Content of: <book><chapter><sect1><note><para>
|
dongsheng@627
|
16047 #: ../en/ch14-hgext.xml:150
|
dongsheng@627
|
16048 msgid ""
|
dongsheng@627
|
16049 "There are <emphasis>two</emphasis> Python <literal>inotify</literal> binding "
|
dongsheng@627
|
16050 "libraries. One of them is called <literal>pyinotify</literal>, and is "
|
dongsheng@627
|
16051 "packaged by some Linux distributions as <literal>python-inotify</literal>. "
|
dongsheng@627
|
16052 "This is <emphasis>not</emphasis> the one you'll need, as it is too buggy and "
|
dongsheng@627
|
16053 "inefficient to be practical."
|
dongsheng@627
|
16054 msgstr ""
|
dongsheng@627
|
16055
|
dongsheng@627
|
16056 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16057 #: ../en/ch14-hgext.xml:157
|
dongsheng@627
|
16058 msgid ""
|
dongsheng@627
|
16059 "To get going, it's best to already have a functioning copy of Mercurial "
|
dongsheng@627
|
16060 "installed."
|
dongsheng@627
|
16061 msgstr ""
|
dongsheng@627
|
16062
|
dongsheng@627
|
16063 #. type: Content of: <book><chapter><sect1><note><para>
|
dongsheng@627
|
16064 #: ../en/ch14-hgext.xml:160
|
dongsheng@627
|
16065 msgid ""
|
dongsheng@627
|
16066 "If you follow the instructions below, you'll be <emphasis>replacing</"
|
dongsheng@627
|
16067 "emphasis> and overwriting any existing installation of Mercurial that you "
|
dongsheng@627
|
16068 "might already have, using the latest <quote>bleeding edge</quote> Mercurial "
|
dongsheng@627
|
16069 "code. Don't say you weren't warned!"
|
dongsheng@627
|
16070 msgstr ""
|
dongsheng@627
|
16071
|
dongsheng@627
|
16072 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
16073 #: ../en/ch14-hgext.xml:167
|
dongsheng@627
|
16074 msgid ""
|
dongsheng@627
|
16075 "Clone the Python <literal>inotify</literal> binding repository. Build and "
|
dongsheng@627
|
16076 "install it."
|
dongsheng@627
|
16077 msgstr ""
|
dongsheng@627
|
16078
|
dongsheng@627
|
16079 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
16080 #: ../en/ch14-hgext.xml:175
|
dongsheng@627
|
16081 msgid ""
|
dongsheng@627
|
16082 "Clone the <filename class=\"directory\">crew</filename> Mercurial "
|
dongsheng@627
|
16083 "repository. Clone the <literal role=\"hg-ext\">inotify</literal> patch "
|
dongsheng@627
|
16084 "repository so that Mercurial Queues will be able to apply patches to your "
|
dongsheng@627
|
16085 "cope of the <filename class=\"directory\">crew</filename> repository."
|
dongsheng@627
|
16086 msgstr ""
|
dongsheng@627
|
16087
|
dongsheng@627
|
16088 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
16089 #: ../en/ch14-hgext.xml:188
|
dongsheng@627
|
16090 msgid ""
|
dongsheng@627
|
16091 "Make sure that you have the Mercurial Queues extension, <literal role=\"hg-ext"
|
dongsheng@627
|
16092 "\">mq</literal>, enabled. If you've never used MQ, read section <xref "
|
dongsheng@627
|
16093 "linkend=\"sec.mq.start\"/> to get started quickly."
|
dongsheng@627
|
16094 msgstr ""
|
dongsheng@627
|
16095
|
dongsheng@627
|
16096 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
16097 #: ../en/ch14-hgext.xml:194
|
dongsheng@627
|
16098 msgid ""
|
dongsheng@627
|
16099 "Go into the <filename class=\"directory\">inotify</filename> repo, and apply "
|
dongsheng@627
|
16100 "all of the <literal role=\"hg-ext\">inotify</literal> patches using the "
|
dongsheng@627
|
16101 "<option role=\"hg-ext-mq-cmd-qpush-opt\">hg -a</option> option to the "
|
dongsheng@627
|
16102 "<command role=\"hg-ext-mq\">qpush</command> command."
|
dongsheng@627
|
16103 msgstr ""
|
dongsheng@627
|
16104
|
dongsheng@627
|
16105 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
16106 #: ../en/ch14-hgext.xml:204
|
dongsheng@627
|
16107 msgid ""
|
dongsheng@627
|
16108 "If you get an error message from <command role=\"hg-ext-mq\">qpush</command>, "
|
dongsheng@627
|
16109 "you should not continue. Instead, ask for help."
|
dongsheng@627
|
16110 msgstr ""
|
dongsheng@627
|
16111
|
dongsheng@627
|
16112 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
16113 #: ../en/ch14-hgext.xml:208
|
dongsheng@627
|
16114 msgid "Build and install the patched version of Mercurial."
|
dongsheng@627
|
16115 msgstr ""
|
dongsheng@627
|
16116
|
dongsheng@627
|
16117 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16118 #: ../en/ch14-hgext.xml:216
|
dongsheng@627
|
16119 msgid ""
|
dongsheng@627
|
16120 "Once you've build a suitably patched version of Mercurial, all you need to do "
|
dongsheng@627
|
16121 "to enable the <literal role=\"hg-ext\">inotify</literal> extension is add an "
|
dongsheng@627
|
16122 "entry to your <filename role=\"special\"> /.hgrc</filename>."
|
dongsheng@627
|
16123 msgstr ""
|
dongsheng@627
|
16124
|
dongsheng@627
|
16125 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16126 #: ../en/ch14-hgext.xml:221
|
dongsheng@627
|
16127 msgid ""
|
dongsheng@627
|
16128 "When the <literal role=\"hg-ext\">inotify</literal> extension is enabled, "
|
dongsheng@627
|
16129 "Mercurial will automatically and transparently start the status daemon the "
|
dongsheng@627
|
16130 "first time you run a command that needs status in a repository. It runs one "
|
dongsheng@627
|
16131 "status daemon per repository."
|
dongsheng@627
|
16132 msgstr ""
|
dongsheng@627
|
16133
|
dongsheng@627
|
16134 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16135 #: ../en/ch14-hgext.xml:227
|
dongsheng@627
|
16136 msgid ""
|
dongsheng@627
|
16137 "The status daemon is started silently, and runs in the background. If you "
|
dongsheng@627
|
16138 "look at a list of running processes after you've enabled the <literal role="
|
dongsheng@627
|
16139 "\"hg-ext\">inotify</literal> extension and run a few commands in different "
|
dongsheng@627
|
16140 "repositories, you'll thus see a few <literal>hg</literal> processes sitting "
|
dongsheng@627
|
16141 "around, waiting for updates from the kernel and queries from Mercurial."
|
dongsheng@627
|
16142 msgstr ""
|
dongsheng@627
|
16143
|
dongsheng@627
|
16144 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16145 #: ../en/ch14-hgext.xml:235
|
dongsheng@627
|
16146 msgid ""
|
dongsheng@627
|
16147 "The first time you run a Mercurial command in a repository when you have the "
|
dongsheng@627
|
16148 "<literal role=\"hg-ext\">inotify</literal> extension enabled, it will run "
|
dongsheng@627
|
16149 "with about the same performance as a normal Mercurial command. This is "
|
dongsheng@627
|
16150 "because the status daemon needs to perform a normal status scan so that it "
|
dongsheng@627
|
16151 "has a baseline against which to apply later updates from the kernel. "
|
dongsheng@627
|
16152 "However, <emphasis>every</emphasis> subsequent command that does any kind of "
|
dongsheng@627
|
16153 "status check should be noticeably faster on repositories of even fairly "
|
dongsheng@627
|
16154 "modest size. Better yet, the bigger your repository is, the greater a "
|
dongsheng@627
|
16155 "performance advantage you'll see. The <literal role=\"hg-ext\">inotify</"
|
dongsheng@627
|
16156 "literal> daemon makes status operations almost instantaneous on repositories "
|
dongsheng@627
|
16157 "of all sizes!"
|
dongsheng@627
|
16158 msgstr ""
|
dongsheng@627
|
16159
|
dongsheng@627
|
16160 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16161 #: ../en/ch14-hgext.xml:249
|
dongsheng@627
|
16162 msgid ""
|
dongsheng@627
|
16163 "If you like, you can manually start a status daemon using the <command role="
|
dongsheng@627
|
16164 "\"hg-ext-inotify\">inserve</command> command. This gives you slightly finer "
|
dongsheng@627
|
16165 "control over how the daemon ought to run. This command will of course only "
|
dongsheng@627
|
16166 "be available when the <literal role=\"hg-ext\">inotify</literal> extension is "
|
dongsheng@627
|
16167 "enabled."
|
dongsheng@627
|
16168 msgstr ""
|
dongsheng@627
|
16169
|
dongsheng@627
|
16170 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16171 #: ../en/ch14-hgext.xml:256
|
dongsheng@627
|
16172 msgid ""
|
dongsheng@627
|
16173 "When you're using the <literal role=\"hg-ext\">inotify</literal> extension, "
|
dongsheng@627
|
16174 "you should notice <emphasis>no difference at all</emphasis> in Mercurial's "
|
dongsheng@627
|
16175 "behaviour, with the sole exception of status-related commands running a whole "
|
dongsheng@627
|
16176 "lot faster than they used to. You should specifically expect that commands "
|
dongsheng@627
|
16177 "will not print different output; neither should they give different results. "
|
dongsheng@627
|
16178 "If either of these situations occurs, please report a bug."
|
dongsheng@627
|
16179 msgstr ""
|
dongsheng@627
|
16180
|
dongsheng@627
|
16181 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
16182 #: ../en/ch14-hgext.xml:267
|
dongsheng@627
|
16183 msgid ""
|
dongsheng@627
|
16184 "Flexible diff support with the <literal role=\"hg-ext\">extdiff</literal> "
|
dongsheng@627
|
16185 "extension"
|
dongsheng@636
|
16186 msgstr "使用扩展 <literal role=\"hg-ext\">extdiff</literal> 以扩展差异支持"
|
dongsheng@627
|
16187
|
dongsheng@627
|
16188 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16189 #: ../en/ch14-hgext.xml:270
|
dongsheng@627
|
16190 msgid ""
|
dongsheng@627
|
16191 "Mercurial's built-in <command role=\"hg-cmd\">hg diff</command> command "
|
dongsheng@627
|
16192 "outputs plaintext unified diffs."
|
dongsheng@627
|
16193 msgstr ""
|
dongsheng@627
|
16194 "Mercurial 内置命令 <command role=\"hg-cmd\">hg diff</command> 的输出与统一差异"
|
dongsheng@627
|
16195 "不同。"
|
dongsheng@627
|
16196
|
dongsheng@627
|
16197 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16198 #: ../en/ch14-hgext.xml:275
|
dongsheng@627
|
16199 msgid ""
|
dongsheng@627
|
16200 "If you would like to use an external tool to display modifications, you'll "
|
dongsheng@627
|
16201 "want to use the <literal role=\"hg-ext\">extdiff</literal> extension. This "
|
dongsheng@627
|
16202 "will let you use, for example, a graphical diff tool."
|
dongsheng@627
|
16203 msgstr ""
|
dongsheng@627
|
16204
|
dongsheng@627
|
16205 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16206 #: ../en/ch14-hgext.xml:280
|
dongsheng@627
|
16207 msgid ""
|
dongsheng@627
|
16208 "The <literal role=\"hg-ext\">extdiff</literal> extension is bundled with "
|
dongsheng@627
|
16209 "Mercurial, so it's easy to set up. In the <literal role=\"rc-extensions"
|
dongsheng@627
|
16210 "\">extensions</literal> section of your <filename role=\"special\"> /.hgrc</"
|
dongsheng@627
|
16211 "filename>, simply add a one-line entry to enable the extension."
|
dongsheng@627
|
16212 msgstr ""
|
dongsheng@627
|
16213
|
dongsheng@627
|
16214 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16215 #: ../en/ch14-hgext.xml:286
|
dongsheng@627
|
16216 msgid ""
|
dongsheng@627
|
16217 "This introduces a command named <command role=\"hg-ext-extdiff\">extdiff</"
|
dongsheng@627
|
16218 "command>, which by default uses your system's <command>diff</command> command "
|
dongsheng@627
|
16219 "to generate a unified diff in the same form as the built-in <command role="
|
dongsheng@627
|
16220 "\"hg-cmd\">hg diff</command> command."
|
dongsheng@627
|
16221 msgstr ""
|
dongsheng@627
|
16222
|
dongsheng@627
|
16223 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16224 #: ../en/ch14-hgext.xml:294
|
dongsheng@627
|
16225 msgid ""
|
dongsheng@627
|
16226 "The result won't be exactly the same as with the built-in <command role=\"hg-"
|
dongsheng@627
|
16227 "cmd\">hg diff</command> variations, because the output of <command>diff</"
|
dongsheng@627
|
16228 "command> varies from one system to another, even when passed the same options."
|
dongsheng@627
|
16229 msgstr ""
|
dongsheng@627
|
16230
|
dongsheng@627
|
16231 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16232 #: ../en/ch14-hgext.xml:299
|
dongsheng@627
|
16233 msgid ""
|
dongsheng@627
|
16234 "As the <quote><literal>making snapshot</literal></quote> lines of output "
|
dongsheng@627
|
16235 "above imply, the <command role=\"hg-ext-extdiff\">extdiff</command> command "
|
dongsheng@627
|
16236 "works by creating two snapshots of your source tree. The first snapshot is "
|
dongsheng@627
|
16237 "of the source revision; the second, of the target revision or working "
|
dongsheng@627
|
16238 "directory. The <command role=\"hg-ext-extdiff\">extdiff</command> command "
|
dongsheng@627
|
16239 "generates these snapshots in a temporary directory, passes the name of each "
|
dongsheng@627
|
16240 "directory to an external diff viewer, then deletes the temporary directory. "
|
dongsheng@627
|
16241 "For efficiency, it only snapshots the directories and files that have changed "
|
dongsheng@627
|
16242 "between the two revisions."
|
dongsheng@627
|
16243 msgstr ""
|
dongsheng@627
|
16244
|
dongsheng@627
|
16245 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16246 #: ../en/ch14-hgext.xml:312
|
dongsheng@627
|
16247 msgid ""
|
dongsheng@627
|
16248 "Snapshot directory names have the same base name as your repository. If your "
|
dongsheng@627
|
16249 "repository path is <filename class=\"directory\">/quux/bar/foo</filename>, "
|
dongsheng@627
|
16250 "then <filename class=\"directory\">foo</filename> will be the name of each "
|
dongsheng@627
|
16251 "snapshot directory. Each snapshot directory name has its changeset ID "
|
dongsheng@627
|
16252 "appended, if appropriate. If a snapshot is of revision "
|
dongsheng@627
|
16253 "<literal>a631aca1083f</literal>, the directory will be named <filename class="
|
dongsheng@627
|
16254 "\"directory\">foo.a631aca1083f</filename>. A snapshot of the working "
|
dongsheng@627
|
16255 "directory won't have a changeset ID appended, so it would just be <filename "
|
dongsheng@627
|
16256 "class=\"directory\">foo</filename> in this example. To see what this looks "
|
dongsheng@627
|
16257 "like in practice, look again at the <command role=\"hg-ext-extdiff\">extdiff</"
|
dongsheng@627
|
16258 "command> example above. Notice that the diff has the snapshot directory "
|
dongsheng@627
|
16259 "names embedded in its header."
|
dongsheng@627
|
16260 msgstr ""
|
dongsheng@627
|
16261
|
dongsheng@627
|
16262 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16263 #: ../en/ch14-hgext.xml:328
|
dongsheng@627
|
16264 msgid ""
|
dongsheng@627
|
16265 "The <command role=\"hg-ext-extdiff\">extdiff</command> command accepts two "
|
dongsheng@627
|
16266 "important options. The <option role=\"hg-ext-extdiff-cmd-extdiff-opt\">hg -p</"
|
dongsheng@627
|
16267 "option> option lets you choose a program to view differences with, instead of "
|
dongsheng@627
|
16268 "<command>diff</command>. With the <option role=\"hg-ext-extdiff-cmd-extdiff-"
|
dongsheng@627
|
16269 "opt\">hg -o</option> option, you can change the options that <command role="
|
dongsheng@627
|
16270 "\"hg-ext-extdiff\">extdiff</command> passes to the program (by default, these "
|
dongsheng@627
|
16271 "options are <quote><literal>-Npru</literal></quote>, which only make sense if "
|
dongsheng@627
|
16272 "you're running <command>diff</command>). In other respects, the <command "
|
dongsheng@627
|
16273 "role=\"hg-ext-extdiff\">extdiff</command> command acts similarly to the built-"
|
dongsheng@627
|
16274 "in <command role=\"hg-cmd\">hg diff</command> command: you use the same "
|
dongsheng@627
|
16275 "option names, syntax, and arguments to specify the revisions you want, the "
|
dongsheng@627
|
16276 "files you want, and so on."
|
dongsheng@627
|
16277 msgstr ""
|
dongsheng@627
|
16278
|
dongsheng@627
|
16279 #
|
dongsheng@627
|
16280 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16281 #: ../en/ch14-hgext.xml:345
|
dongsheng@627
|
16282 msgid ""
|
dongsheng@627
|
16283 "As an example, here's how to run the normal system <command>diff</command> "
|
dongsheng@627
|
16284 "command, getting it to generate context diffs (using the <option role=\"cmd-"
|
dongsheng@627
|
16285 "opt-diff\">-c</option> option) instead of unified diffs, and five lines of "
|
dongsheng@627
|
16286 "context instead of the default three (passing <literal>5</literal> as the "
|
dongsheng@627
|
16287 "argument to the <option role=\"cmd-opt-diff\">-C</option> option)."
|
dongsheng@627
|
16288 msgstr ""
|
dongsheng@627
|
16289
|
dongsheng@627
|
16290 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16291 #: ../en/ch14-hgext.xml:354
|
dongsheng@627
|
16292 msgid ""
|
dongsheng@627
|
16293 "Launching a visual diff tool is just as easy. Here's how to launch the "
|
dongsheng@627
|
16294 "<command>kdiff3</command> viewer."
|
dongsheng@627
|
16295 msgstr ""
|
dongsheng@627
|
16296
|
dongsheng@627
|
16297 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16298 #: ../en/ch14-hgext.xml:358
|
dongsheng@627
|
16299 msgid ""
|
dongsheng@627
|
16300 "If your diff viewing command can't deal with directories, you can easily work "
|
dongsheng@627
|
16301 "around this with a little scripting. For an example of such scripting in "
|
dongsheng@627
|
16302 "action with the <literal role=\"hg-ext\">mq</literal> extension and the "
|
dongsheng@627
|
16303 "<command>interdiff</command> command, see section <xref linkend=\"mq-collab."
|
dongsheng@627
|
16304 "tips.interdiff\"/>."
|
dongsheng@627
|
16305 msgstr ""
|
dongsheng@627
|
16306
|
dongsheng@627
|
16307 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
16308 #: ../en/ch14-hgext.xml:366
|
dongsheng@627
|
16309 msgid "Defining command aliases"
|
dongsheng@636
|
16310 msgstr "定义命令的别名"
|
dongsheng@627
|
16311
|
dongsheng@627
|
16312 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
16313 #: ../en/ch14-hgext.xml:368
|
dongsheng@627
|
16314 msgid ""
|
dongsheng@627
|
16315 "It can be cumbersome to remember the options to both the <command role=\"hg-"
|
dongsheng@627
|
16316 "ext-extdiff\">extdiff</command> command and the diff viewer you want to use, "
|
dongsheng@627
|
16317 "so the <literal role=\"hg-ext\">extdiff</literal> extension lets you define "
|
dongsheng@627
|
16318 "<emphasis>new</emphasis> commands that will invoke your diff viewer with "
|
dongsheng@627
|
16319 "exactly the right options."
|
dongsheng@627
|
16320 msgstr ""
|
dongsheng@627
|
16321
|
dongsheng@627
|
16322 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
16323 #: ../en/ch14-hgext.xml:375
|
dongsheng@627
|
16324 msgid ""
|
dongsheng@627
|
16325 "All you need to do is edit your <filename role=\"special\"> /.hgrc</"
|
dongsheng@627
|
16326 "filename>, and add a section named <literal role=\"rc-extdiff\">extdiff</"
|
dongsheng@627
|
16327 "literal>. Inside this section, you can define multiple commands. Here's how "
|
dongsheng@627
|
16328 "to add a <literal>kdiff3</literal> command. Once you've defined this, you "
|
dongsheng@627
|
16329 "can type <quote><literal>hg kdiff3</literal></quote> and the <literal role="
|
dongsheng@627
|
16330 "\"hg-ext\">extdiff</literal> extension will run <command>kdiff3</command> for "
|
dongsheng@627
|
16331 "you."
|
dongsheng@627
|
16332 msgstr ""
|
dongsheng@627
|
16333
|
dongsheng@627
|
16334 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
16335 #: ../en/ch14-hgext.xml:384
|
dongsheng@627
|
16336 msgid ""
|
dongsheng@627
|
16337 "If you leave the right hand side of the definition empty, as above, the "
|
dongsheng@627
|
16338 "<literal role=\"hg-ext\">extdiff</literal> extension uses the name of the "
|
dongsheng@627
|
16339 "command you defined as the name of the external program to run. But these "
|
dongsheng@627
|
16340 "names don't have to be the same. Here, we define a command named "
|
dongsheng@627
|
16341 "<quote><literal>hg wibble</literal></quote>, which runs <command>kdiff3</"
|
dongsheng@627
|
16342 "command>."
|
dongsheng@627
|
16343 msgstr ""
|
dongsheng@627
|
16344
|
dongsheng@627
|
16345 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
16346 #: ../en/ch14-hgext.xml:393
|
dongsheng@627
|
16347 msgid ""
|
dongsheng@627
|
16348 "You can also specify the default options that you want to invoke your diff "
|
dongsheng@627
|
16349 "viewing program with. The prefix to use is <quote><literal>opts.</literal></"
|
dongsheng@627
|
16350 "quote>, followed by the name of the command to which the options apply. This "
|
dongsheng@627
|
16351 "example defines a <quote><literal>hg vimdiff</literal></quote> command that "
|
dongsheng@627
|
16352 "runs the <command>vim</command> editor's <literal>DirDiff</literal> extension."
|
dongsheng@627
|
16353 msgstr ""
|
dongsheng@627
|
16354
|
dongsheng@627
|
16355 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
16356 #: ../en/ch14-hgext.xml:406
|
dongsheng@627
|
16357 msgid ""
|
dongsheng@627
|
16358 "Cherrypicking changes with the <literal role=\"hg-ext\">transplant</literal> "
|
dongsheng@627
|
16359 "extension"
|
dongsheng@636
|
16360 msgstr "使用扩展 <literal role=\"hg-ext\">transplant</literal> 以挑选修改"
|
dongsheng@627
|
16361
|
dongsheng@627
|
16362 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16363 #: ../en/ch14-hgext.xml:409
|
dongsheng@627
|
16364 msgid "Need to have a long chat with Brendan about this."
|
dongsheng@627
|
16365 msgstr ""
|
dongsheng@627
|
16366
|
dongsheng@627
|
16367 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@627
|
16368 #: ../en/ch14-hgext.xml:413
|
dongsheng@627
|
16369 msgid ""
|
dongsheng@627
|
16370 "Send changes via email with the <literal role=\"hg-ext\">patchbomb</literal> "
|
dongsheng@627
|
16371 "extension"
|
dongsheng@627
|
16372 msgstr ""
|
dongsheng@636
|
16373 "使用扩展 <literal role=\"hg-ext\">patchbomb</literal> 通过 email 发送修改"
|
dongsheng@627
|
16374
|
dongsheng@627
|
16375 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16376 #: ../en/ch14-hgext.xml:416
|
dongsheng@627
|
16377 msgid ""
|
dongsheng@627
|
16378 "Many projects have a culture of <quote>change review</quote>, in which people "
|
dongsheng@627
|
16379 "send their modifications to a mailing list for others to read and comment on "
|
dongsheng@627
|
16380 "before they commit the final version to a shared repository. Some projects "
|
dongsheng@627
|
16381 "have people who act as gatekeepers; they apply changes from other people to a "
|
dongsheng@627
|
16382 "repository to which those others don't have access."
|
dongsheng@627
|
16383 msgstr ""
|
dongsheng@627
|
16384
|
dongsheng@627
|
16385 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16386 #: ../en/ch14-hgext.xml:424
|
dongsheng@627
|
16387 msgid ""
|
dongsheng@627
|
16388 "Mercurial makes it easy to send changes over email for review or application, "
|
dongsheng@627
|
16389 "via its <literal role=\"hg-ext\">patchbomb</literal> extension. The "
|
dongsheng@627
|
16390 "extension is so named because changes are formatted as patches, and it's "
|
dongsheng@627
|
16391 "usual to send one changeset per email message. Sending a long series of "
|
dongsheng@627
|
16392 "changes by email is thus much like <quote>bombing</quote> the recipient's "
|
dongsheng@627
|
16393 "inbox, hence <quote>patchbomb</quote>."
|
dongsheng@627
|
16394 msgstr ""
|
dongsheng@627
|
16395
|
dongsheng@627
|
16396 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16397 #: ../en/ch14-hgext.xml:432
|
dongsheng@627
|
16398 msgid ""
|
dongsheng@627
|
16399 "As usual, the basic configuration of the <literal role=\"hg-ext\">patchbomb</"
|
dongsheng@627
|
16400 "literal> extension takes just one or two lines in your <filename role="
|
dongsheng@627
|
16401 "\"special\"> /.hgrc</filename>."
|
dongsheng@627
|
16402 msgstr ""
|
dongsheng@627
|
16403
|
dongsheng@627
|
16404 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16405 #: ../en/ch14-hgext.xml:437
|
dongsheng@627
|
16406 msgid ""
|
dongsheng@627
|
16407 "Once you've enabled the extension, you will have a new command available, "
|
dongsheng@627
|
16408 "named <command role=\"hg-ext-patchbomb\">email</command>."
|
dongsheng@627
|
16409 msgstr ""
|
dongsheng@627
|
16410
|
dongsheng@627
|
16411 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16412 #: ../en/ch14-hgext.xml:441
|
dongsheng@627
|
16413 msgid ""
|
dongsheng@627
|
16414 "The safest and best way to invoke the <command role=\"hg-ext-patchbomb"
|
dongsheng@627
|
16415 "\">email</command> command is to <emphasis>always</emphasis> run it first "
|
dongsheng@627
|
16416 "with the <option role=\"hg-ext-patchbomb-cmd-email-opt\">hg -n</option> "
|
dongsheng@627
|
16417 "option. This will show you what the command <emphasis>would</emphasis> send, "
|
dongsheng@627
|
16418 "without actually sending anything. Once you've had a quick glance over the "
|
dongsheng@627
|
16419 "changes and verified that you are sending the right ones, you can rerun the "
|
dongsheng@627
|
16420 "same command, with the <option role=\"hg-ext-patchbomb-cmd-email-opt\">hg -n</"
|
dongsheng@627
|
16421 "option> option removed."
|
dongsheng@627
|
16422 msgstr ""
|
dongsheng@627
|
16423
|
dongsheng@627
|
16424 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16425 #: ../en/ch14-hgext.xml:452
|
dongsheng@627
|
16426 msgid ""
|
dongsheng@627
|
16427 "The <command role=\"hg-ext-patchbomb\">email</command> command accepts the "
|
dongsheng@627
|
16428 "same kind of revision syntax as every other Mercurial command. For example, "
|
dongsheng@627
|
16429 "this command will send every revision between 7 and <literal>tip</literal>, "
|
dongsheng@627
|
16430 "inclusive."
|
dongsheng@627
|
16431 msgstr ""
|
dongsheng@627
|
16432
|
dongsheng@627
|
16433 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16434 #: ../en/ch14-hgext.xml:457
|
dongsheng@627
|
16435 msgid ""
|
dongsheng@627
|
16436 "You can also specify a <emphasis>repository</emphasis> to compare with. If "
|
dongsheng@627
|
16437 "you provide a repository but no revisions, the <command role=\"hg-ext-"
|
dongsheng@627
|
16438 "patchbomb\">email</command> command will send all revisions in the local "
|
dongsheng@627
|
16439 "repository that are not present in the remote repository. If you "
|
dongsheng@627
|
16440 "additionally specify revisions or a branch name (the latter using the <option "
|
dongsheng@627
|
16441 "role=\"hg-ext-patchbomb-cmd-email-opt\">hg -b</option> option), this will "
|
dongsheng@627
|
16442 "constrain the revisions sent."
|
dongsheng@627
|
16443 msgstr ""
|
dongsheng@627
|
16444
|
dongsheng@627
|
16445 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16446 #: ../en/ch14-hgext.xml:466
|
dongsheng@627
|
16447 msgid ""
|
dongsheng@627
|
16448 "It's perfectly safe to run the <command role=\"hg-ext-patchbomb\">email</"
|
dongsheng@627
|
16449 "command> command without the names of the people you want to send to: if you "
|
dongsheng@627
|
16450 "do this, it will just prompt you for those values interactively. (If you're "
|
dongsheng@627
|
16451 "using a Linux or Unix-like system, you should have enhanced "
|
dongsheng@627
|
16452 "<literal>readline</literal>-style editing capabilities when entering those "
|
dongsheng@627
|
16453 "headers, too, which is useful.)"
|
dongsheng@627
|
16454 msgstr ""
|
dongsheng@627
|
16455
|
dongsheng@627
|
16456 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16457 #: ../en/ch14-hgext.xml:474
|
dongsheng@627
|
16458 msgid ""
|
dongsheng@627
|
16459 "When you are sending just one revision, the <command role=\"hg-ext-patchbomb"
|
dongsheng@627
|
16460 "\">email</command> command will by default use the first line of the "
|
dongsheng@627
|
16461 "changeset description as the subject of the single email message it sends."
|
dongsheng@627
|
16462 msgstr ""
|
dongsheng@627
|
16463
|
dongsheng@627
|
16464 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@627
|
16465 #: ../en/ch14-hgext.xml:479
|
dongsheng@627
|
16466 msgid ""
|
dongsheng@627
|
16467 "If you send multiple revisions, the <command role=\"hg-ext-patchbomb\">email</"
|
dongsheng@627
|
16468 "command> command will usually send one message per changeset. It will "
|
dongsheng@627
|
16469 "preface the series with an introductory message, in which you should describe "
|
dongsheng@627
|
16470 "the purpose of the series of changes you're sending."
|
dongsheng@627
|
16471 msgstr ""
|
dongsheng@627
|
16472
|
dongsheng@627
|
16473 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@627
|
16474 #: ../en/ch14-hgext.xml:486
|
dongsheng@627
|
16475 msgid "Changing the behaviour of patchbombs"
|
dongsheng@636
|
16476 msgstr "修改 patchbomb 的行为"
|
dongsheng@627
|
16477
|
dongsheng@627
|
16478 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@627
|
16479 #: ../en/ch14-hgext.xml:488
|
dongsheng@627
|
16480 msgid ""
|
dongsheng@627
|
16481 "Not every project has exactly the same conventions for sending changes in "
|
dongsheng@627
|
16482 "email; the <literal role=\"hg-ext\">patchbomb</literal> extension tries to "
|
dongsheng@627
|
16483 "accommodate a number of variations through command line options."
|
dongsheng@627
|
16484 msgstr ""
|
dongsheng@627
|
16485
|
dongsheng@627
|
16486 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
16487 #: ../en/ch14-hgext.xml:494
|
dongsheng@627
|
16488 msgid ""
|
dongsheng@627
|
16489 "You can write a subject for the introductory message on the command line "
|
dongsheng@627
|
16490 "using the <option role=\"hg-ext-patchbomb-cmd-email-opt\">hg -s</option> "
|
dongsheng@627
|
16491 "option. This takes one argument, the text of the subject to use."
|
dongsheng@627
|
16492 msgstr ""
|
dongsheng@627
|
16493
|
dongsheng@627
|
16494 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
16495 #: ../en/ch14-hgext.xml:500
|
dongsheng@627
|
16496 msgid ""
|
dongsheng@627
|
16497 "To change the email address from which the messages originate, use the "
|
dongsheng@627
|
16498 "<option role=\"hg-ext-patchbomb-cmd-email-opt\">hg -f</option> option. This "
|
dongsheng@627
|
16499 "takes one argument, the email address to use."
|
dongsheng@627
|
16500 msgstr ""
|
dongsheng@627
|
16501
|
dongsheng@627
|
16502 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
16503 #: ../en/ch14-hgext.xml:506
|
dongsheng@627
|
16504 msgid ""
|
dongsheng@627
|
16505 "The default behaviour is to send unified diffs (see section <xref linkend="
|
dongsheng@627
|
16506 "\"sec.mq.patch\"/> for a description of the format), one per message. You "
|
dongsheng@627
|
16507 "can send a binary bundle instead with the <option role=\"hg-ext-patchbomb-cmd-"
|
dongsheng@627
|
16508 "email-opt\">hg -b</option> option."
|
dongsheng@627
|
16509 msgstr ""
|
dongsheng@627
|
16510
|
dongsheng@627
|
16511 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
16512 #: ../en/ch14-hgext.xml:514
|
dongsheng@627
|
16513 msgid ""
|
dongsheng@627
|
16514 "Unified diffs are normally prefaced with a metadata header. You can omit "
|
dongsheng@627
|
16515 "this, and send unadorned diffs, with the <option role=\"hg-ext-patchbomb-cmd-"
|
dongsheng@627
|
16516 "email-opt\">hg --plain</option> option."
|
dongsheng@627
|
16517 msgstr ""
|
dongsheng@627
|
16518
|
dongsheng@627
|
16519 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
16520 #: ../en/ch14-hgext.xml:520
|
dongsheng@627
|
16521 msgid ""
|
dongsheng@627
|
16522 "Diffs are normally sent <quote>inline</quote>, in the same body part as the "
|
dongsheng@627
|
16523 "description of a patch. This makes it easiest for the largest number of "
|
dongsheng@627
|
16524 "readers to quote and respond to parts of a diff, as some mail clients will "
|
dongsheng@627
|
16525 "only quote the first MIME body part in a message. If you'd prefer to send the "
|
dongsheng@627
|
16526 "description and the diff in separate body parts, use the <option role=\"hg-"
|
dongsheng@627
|
16527 "ext-patchbomb-cmd-email-opt\">hg -a</option> option."
|
dongsheng@627
|
16528 msgstr ""
|
dongsheng@627
|
16529
|
dongsheng@627
|
16530 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
16531 #: ../en/ch14-hgext.xml:530
|
dongsheng@627
|
16532 msgid ""
|
dongsheng@627
|
16533 "Instead of sending mail messages, you can write them to an <literal>mbox</"
|
dongsheng@627
|
16534 "literal>-format mail folder using the <option role=\"hg-ext-patchbomb-cmd-"
|
dongsheng@627
|
16535 "email-opt\">hg -m</option> option. That option takes one argument, the name "
|
dongsheng@627
|
16536 "of the file to write to."
|
dongsheng@627
|
16537 msgstr ""
|
dongsheng@627
|
16538
|
dongsheng@627
|
16539 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@627
|
16540 #: ../en/ch14-hgext.xml:537
|
dongsheng@627
|
16541 msgid ""
|
dongsheng@627
|
16542 "If you would like to add a <command>diffstat</command>-format summary to each "
|
dongsheng@627
|
16543 "patch, and one to the introductory message, use the <option role=\"hg-ext-"
|
dongsheng@627
|
16544 "patchbomb-cmd-email-opt\">hg -d</option> option. The <command>diffstat</"
|
dongsheng@627
|
16545 "command> command displays a table containing the name of each file patched, "
|
dongsheng@627
|
16546 "the number of lines affected, and a histogram showing how much each file is "
|
dongsheng@627
|
16547 "modified. This gives readers a qualitative glance at how complex a patch is."
|
dongsheng@627
|
16548 msgstr ""
|