hgbook

view po/zh.po @ 648:e0ac2341a861

Fix building error introduced by bos at rev 8366882f67f2
author Dongsheng Song <dongsheng.song@gmail.com>
date Wed Mar 18 21:50:57 2009 +0800 (2009-03-18)
parents 3b864df20e3b
children 7e7c47481e4f
line source
1 #
2 # Simplified Chinese translation for hgbook
3 # This file is distributed under the same license as the hgbook.
4 #
5 # Authors:
6 # Dongsheng Song <dongsheng.song@gmail.com>, 2009
7 #
8 # Update to new pot:
9 # msgmerge --update zh.po hgbook.pot
10 #
11 # Check translation:
12 # msgfmt --statistics -c -o zh.mo zh.po
13 #
14 # Please format your translation before commit:
15 # msgcat --sort-by-file --width=80 -o zh_new.po zh.po
16 # mv -f zh_new.po zh.po
17 #
18 # Dictionary:
19 # blame 追溯
20 # branch 分支
21 # changes 修改
22 # changeset 修改集
23 # checkout 检出
24 # remove 移除(从版本库删除)
25 # delete 删除(只从文件系统删除)
26 # patchset 补丁集
27 # pushing to 推到
28 # pulling from 拉自,抓取
29 # rename 改名
30 # repository 版本库
31 # revert 恢复
32 # revision 版本
33 # tag 标签
34 # tip 顶点
35 # undo 撤销
36 # unversioned 未版本控制
37 # versioned 受版本控制
38 # working copy 工作副本
39 # ...
40 #
41 msgid ""
42 msgstr ""
43 "Project-Id-Version: hgbook 1.2\n"
44 "POT-Creation-Date: 2009-03-18 19:48+0800\n"
45 "PO-Revision-Date: 2009-03-18 19:50+0800\n"
46 "Last-Translator: \n"
47 "Language-Team: Simplified Chinese <i18n-zh@googlegroups.com >\n"
48 "MIME-Version: 1.0\n"
49 "Content-Type: text/plain; charset=UTF-8\n"
50 "Content-Transfer-Encoding: 8bit\n"
51 "X-Poedit-Language: Chinese\n"
52 "X-Poedit-Country: CHINA\n"
53 "X-Poedit-SourceCharset: utf-8\n"
55 #. type: Content of: <book><title>
56 #: ../en/00book.xml:41
57 msgid "Mercurial: The Definitive Guide"
58 msgstr "Mercurial 权威指南"
60 #. type: Content of: <book><subtitle>
61 #: ../en/00book.xml:46
62 msgid "Compiled from $rev_id$"
63 msgstr "编译自 $rev_id$"
65 #. type: Content of: <book><bookinfo><authorgroup><author><firstname>
66 #: ../en/00book.xml:50
67 msgid "Bryan"
68 msgstr "Bryan"
70 #. type: Content of: <book><bookinfo><authorgroup><author><surname>
71 #: ../en/00book.xml:51
72 msgid "O'Sullivan"
73 msgstr "O'Sullivan"
75 #. type: Content of: <book><bookinfo>
76 #: ../en/00book.xml:55
77 msgid ""
78 "<editor> <firstname>Mike</firstname> <surname>Loukides</surname> </editor> "
79 "<copyright> <year>2006</year> <year>2007</year> <year>2008</year> <year>2009</"
80 "year> <holder>Bryan O'Sullivan</holder> </copyright>"
81 msgstr ""
82 "<editor> <firstname>Mike</firstname> <surname>Loukides</surname> </editor> "
83 "<copyright> <year>2006</year> <year>2007</year> <year>2008</year> <year>2009</"
84 "year> <holder>Bryan O'Sullivan</holder> </copyright>"
86 #. type: Content of: <book><appendix><title>
87 #: ../en/appA-cmdref.xml:4
88 msgid "Command reference"
89 msgstr "命令参考"
91 #. type: Content of: <book><appendix><para>
92 #: ../en/appA-cmdref.xml:6
93 msgid ""
94 "\\cmdref{add}{add files at the next commit} \\optref{add}{I}{include} \\optref"
95 "{add}{X}{exclude} \\optref{add}{n}{dry-run}"
96 msgstr ""
98 #. type: Content of: <book><appendix><para>
99 #: ../en/appA-cmdref.xml:11
100 msgid "\\cmdref{diff}{print changes in history or working directory}"
101 msgstr ""
103 #. type: Content of: <book><appendix><para>
104 #: ../en/appA-cmdref.xml:13
105 msgid ""
106 "Show differences between revisions for the specified files or directories, "
107 "using the unified diff format. For a description of the unified diff format, "
108 "see section <xref linkend=\"sec.mq.patch\"/>."
109 msgstr ""
111 #. type: Content of: <book><appendix><para>
112 #: ../en/appA-cmdref.xml:17
113 msgid ""
114 "By default, this command does not print diffs for files that Mercurial "
115 "considers to contain binary data. To control this behaviour, see the <option "
116 "role=\"hg-opt-diff\">-a</option> and <option role=\"hg-opt-diff\">--git</"
117 "option> options."
118 msgstr ""
120 #. type: Content of: <book><appendix><sect2><title>
121 #: ../en/appA-cmdref.xml:22
122 msgid "Options"
123 msgstr "选项"
125 #. type: Content of: <book><appendix><sect2><para>
126 #: ../en/appA-cmdref.xml:24
127 msgid "\\loptref{diff}{nodates}"
128 msgstr ""
130 #. type: Content of: <book><appendix><sect2><para>
131 #: ../en/appA-cmdref.xml:26
132 msgid "Omit date and time information when printing diff headers."
133 msgstr ""
135 #. type: Content of: <book><appendix><sect2><para>
136 #: ../en/appA-cmdref.xml:28
137 msgid "\\optref{diff}{B}{ignore-blank-lines}"
138 msgstr ""
140 #. type: Content of: <book><appendix><sect2><para>
141 #: ../en/appA-cmdref.xml:30
142 msgid ""
143 "Do not print changes that only insert or delete blank lines. A line that "
144 "contains only whitespace is not considered blank."
145 msgstr ""
147 #. type: Content of: <book><appendix><sect2><para>
148 #: ../en/appA-cmdref.xml:34
149 msgid "\\optref{diff}{I}{include}"
150 msgstr ""
152 #. type: Content of: <book><appendix><sect2><para>
153 #: ../en/appA-cmdref.xml:37
154 msgid "Include files and directories whose names match the given patterns."
155 msgstr ""
157 #. type: Content of: <book><appendix><sect2><para>
158 #: ../en/appA-cmdref.xml:40
159 msgid "\\optref{diff}{X}{exclude}"
160 msgstr ""
162 #. type: Content of: <book><appendix><sect2><para>
163 #: ../en/appA-cmdref.xml:43
164 msgid "Exclude files and directories whose names match the given patterns."
165 msgstr ""
167 #. type: Content of: <book><appendix><sect2><para>
168 #: ../en/appA-cmdref.xml:46
169 msgid "\\optref{diff}{a}{text}"
170 msgstr ""
172 #. type: Content of: <book><appendix><sect2><para>
173 #: ../en/appA-cmdref.xml:49
174 msgid ""
175 "If this option is not specified, <command role=\"hg-cmd\">hg diff</command> "
176 "will refuse to print diffs for files that it detects as binary. Specifying "
177 "<option role=\"hg-opt-diff\">-a</option> forces <command role=\"hg-cmd\">hg "
178 "diff</command> to treat all files as text, and generate diffs for all of them."
179 msgstr ""
181 #. type: Content of: <book><appendix><sect2><para>
182 #: ../en/appA-cmdref.xml:55
183 msgid ""
184 "This option is useful for files that are <quote>mostly text</quote> but have "
185 "a few embedded NUL characters. If you use it on files that contain a lot of "
186 "binary data, its output will be incomprehensible."
187 msgstr ""
189 #. type: Content of: <book><appendix><sect2><para>
190 #: ../en/appA-cmdref.xml:60
191 msgid "\\optref{diff}{b}{ignore-space-change}"
192 msgstr ""
194 #. type: Content of: <book><appendix><sect2><para>
195 #: ../en/appA-cmdref.xml:63
196 msgid ""
197 "Do not print a line if the only change to that line is in the amount of white "
198 "space it contains."
199 msgstr ""
201 #. type: Content of: <book><appendix><sect2><para>
202 #: ../en/appA-cmdref.xml:67
203 msgid "\\optref{diff}{g}{git}"
204 msgstr ""
206 #. type: Content of: <book><appendix><sect2><para>
207 #: ../en/appA-cmdref.xml:70
208 msgid ""
209 "Print <command>git</command>-compatible diffs. XXX reference a format "
210 "description."
211 msgstr ""
213 #. type: Content of: <book><appendix><sect2><para>
214 #: ../en/appA-cmdref.xml:74
215 msgid "\\optref{diff}{p}{show-function}"
216 msgstr ""
218 #. type: Content of: <book><appendix><sect2><para>
219 #: ../en/appA-cmdref.xml:77
220 msgid ""
221 "Display the name of the enclosing function in a hunk header, using a simple "
222 "heuristic. This functionality is enabled by default, so the <option role="
223 "\"hg-opt-diff\">-p</option> option has no effect unless you change the value "
224 "of the <envar role=\"rc-item-diff\">showfunc</envar> config item, as in the "
225 "following example."
226 msgstr ""
228 #. type: Content of: <book><appendix><sect2><para>
229 #: ../en/appA-cmdref.xml:84
230 msgid "\\optref{diff}{r}{rev}"
231 msgstr ""
233 #. type: Content of: <book><appendix><sect2><para>
234 #: ../en/appA-cmdref.xml:87
235 msgid ""
236 "Specify one or more revisions to compare. The <command role=\"hg-cmd\">hg "
237 "diff</command> command accepts up to two <option role=\"hg-opt-diff\">-r</"
238 "option> options to specify the revisions to compare."
239 msgstr ""
241 #. type: Content of: <book><appendix><sect2><orderedlist><listitem><para>
242 #: ../en/appA-cmdref.xml:93
243 msgid ""
244 "Display the differences between the parent revision of the working directory "
245 "and the working directory."
246 msgstr ""
248 #. type: Content of: <book><appendix><sect2><orderedlist><listitem><para>
249 #: ../en/appA-cmdref.xml:97
250 msgid ""
251 "Display the differences between the specified changeset and the working "
252 "directory."
253 msgstr ""
255 #. type: Content of: <book><appendix><sect2><orderedlist><listitem><para>
256 #: ../en/appA-cmdref.xml:101
257 msgid "Display the differences between the two specified changesets."
258 msgstr ""
260 #. type: Content of: <book><appendix><sect2><para>
261 #: ../en/appA-cmdref.xml:105
262 msgid ""
263 "You can specify two revisions using either two <option role=\"hg-opt-diff\">-"
264 "r</option> options or revision range notation. For example, the two revision "
265 "specifications below are equivalent."
266 msgstr ""
268 #. type: Content of: <book><appendix><sect2><para>
269 #: ../en/appA-cmdref.xml:112
270 msgid ""
271 "When you provide two revisions, Mercurial treats the order of those revisions "
272 "as significant. Thus, <command role=\"hg-cmd\">hg diff -r10:20</command> "
273 "will produce a diff that will transform files from their contents as of "
274 "revision 10 to their contents as of revision 20, while <command role=\"hg-cmd"
275 "\">hg diff -r20:10</command> means the opposite: the diff that will transform "
276 "files from their revision 20 contents to their revision 10 contents. You "
277 "cannot reverse the ordering in this way if you are diffing against the "
278 "working directory."
279 msgstr ""
281 #. type: Content of: <book><appendix><sect2><para>
282 #: ../en/appA-cmdref.xml:122
283 msgid "\\optref{diff}{w}{ignore-all-space}"
284 msgstr ""
286 #. type: Content of: <book><appendix><sect2><para>
287 #: ../en/appA-cmdref.xml:125
288 msgid "\\cmdref{version}{print version and copyright information}"
289 msgstr ""
291 #. type: Content of: <book><appendix><sect2><para>
292 #: ../en/appA-cmdref.xml:128
293 msgid ""
294 "This command displays the version of Mercurial you are running, and its "
295 "copyright license. There are four kinds of version string that you may see."
296 msgstr ""
298 #. type: Content of: <book><appendix><sect2><itemizedlist><listitem><para>
299 #: ../en/appA-cmdref.xml:133
300 msgid ""
301 "The string <quote><literal>unknown</literal></quote>. This version of "
302 "Mercurial was not built in a Mercurial repository, and cannot determine its "
303 "own version."
304 msgstr ""
306 #. type: Content of: <book><appendix><sect2><itemizedlist><listitem><para>
307 #: ../en/appA-cmdref.xml:138
308 msgid ""
309 "A short numeric string, such as <quote><literal>1.1</literal></quote>. This "
310 "is a build of a revision of Mercurial that was identified by a specific tag "
311 "in the repository where it was built. (This doesn't necessarily mean that "
312 "you're running an official release; someone else could have added that tag to "
313 "any revision in the repository where they built Mercurial.)"
314 msgstr ""
316 #. type: Content of: <book><appendix><sect2><itemizedlist><listitem><para>
317 #: ../en/appA-cmdref.xml:146
318 msgid ""
319 "A hexadecimal string, such as <quote><literal>875489e31abe</literal></"
320 "quote>. This is a build of the given revision of Mercurial."
321 msgstr ""
323 #. type: Content of: <book><appendix><sect2><itemizedlist><listitem><para>
324 #: ../en/appA-cmdref.xml:150
325 msgid ""
326 "A hexadecimal string followed by a date, such as <quote><literal>875489e31abe"
327 "+20070205</literal></quote>. This is a build of the given revision of "
328 "Mercurial, where the build repository contained some local changes that had "
329 "not been committed."
330 msgstr ""
332 #. type: Content of: <book><appendix><sect2><title>
333 #: ../en/appA-cmdref.xml:159
334 msgid "Tips and tricks"
335 msgstr ""
337 #. type: Content of: <book><appendix><sect2><sect3><title>
338 #: ../en/appA-cmdref.xml:162
339 msgid ""
340 "Why do the results of <command role=\"hg-cmd\">hg diff</command> and <command "
341 "role=\"hg-cmd\">hg status</command> differ?"
342 msgstr ""
343 "为什么 <command role=\"hg-cmd\">hg diff</command> 与 <command role=\"hg-cmd"
344 "\">hg status</command> 的结果不同 ?"
346 #. type: Content of: <book><appendix><sect2><sect3><para>
347 #: ../en/appA-cmdref.xml:164
348 msgid ""
349 "When you run the <command role=\"hg-cmd\">hg status</command> command, you'll "
350 "see a list of files that Mercurial will record changes for the next time you "
351 "perform a commit. If you run the <command role=\"hg-cmd\">hg diff</command> "
352 "command, you may notice that it prints diffs for only a <emphasis>subset</"
353 "emphasis> of the files that <command role=\"hg-cmd\">hg status</command> "
354 "listed. There are two possible reasons for this."
355 msgstr ""
357 #. type: Content of: <book><appendix><sect2><sect3><para>
358 #: ../en/appA-cmdref.xml:171
359 msgid ""
360 "The first is that <command role=\"hg-cmd\">hg status</command> prints some "
361 "kinds of modifications that <command role=\"hg-cmd\">hg diff</command> "
362 "doesn't normally display. The <command role=\"hg-cmd\">hg diff</command> "
363 "command normally outputs unified diffs, which don't have the ability to "
364 "represent some changes that Mercurial can track. Most notably, traditional "
365 "diffs can't represent a change in whether or not a file is executable, but "
366 "Mercurial records this information."
367 msgstr ""
369 #. type: Content of: <book><appendix><sect2><sect3><para>
370 #: ../en/appA-cmdref.xml:179
371 msgid ""
372 "If you use the <option role=\"hg-opt-diff\">--git</option> option to <command "
373 "role=\"hg-cmd\">hg diff</command>, it will display <command>git</command>-"
374 "compatible diffs that <emphasis>can</emphasis> display this extra information."
375 msgstr ""
377 #. type: Content of: <book><appendix><sect2><sect3><para>
378 #: ../en/appA-cmdref.xml:184
379 msgid ""
380 "The second possible reason that <command role=\"hg-cmd\">hg diff</command> "
381 "might be printing diffs for a subset of the files displayed by <command role="
382 "\"hg-cmd\">hg status</command> is that if you invoke it without any "
383 "arguments, <command role=\"hg-cmd\">hg diff</command> prints diffs against "
384 "the first parent of the working directory. If you have run <command role="
385 "\"hg-cmd\">hg merge</command> to merge two changesets, but you haven't yet "
386 "committed the results of the merge, your working directory has two parents "
387 "(use <command role=\"hg-cmd\">hg parents</command> to see them). While "
388 "<command role=\"hg-cmd\">hg status</command> prints modifications relative to "
389 "<emphasis>both</emphasis> parents after an uncommitted merge, <command role="
390 "\"hg-cmd\">hg diff</command> still operates relative only to the first "
391 "parent. You can get it to print diffs relative to the second parent by "
392 "specifying that parent with the <option role=\"hg-opt-diff\">-r</option> "
393 "option. There is no way to print diffs relative to both parents."
394 msgstr ""
396 #. type: Content of: <book><appendix><sect2><sect3><title>
397 #: ../en/appA-cmdref.xml:200
398 msgid "Generating safe binary diffs"
399 msgstr "生成安全的二进制差异"
401 #. type: Content of: <book><appendix><sect2><sect3><para>
402 #: ../en/appA-cmdref.xml:202
403 msgid ""
404 "If you use the <option role=\"hg-opt-diff\">-a</option> option to force "
405 "Mercurial to print diffs of files that are either <quote>mostly text</quote> "
406 "or contain lots of binary data, those diffs cannot subsequently be applied by "
407 "either Mercurial's <command role=\"hg-cmd\">hg import</command> command or "
408 "the system's <command>patch</command> command."
409 msgstr ""
411 #. type: Content of: <book><appendix><sect2><sect3><para>
412 #: ../en/appA-cmdref.xml:209
413 msgid ""
414 "If you want to generate a diff of a binary file that is safe to use as input "
415 "for <command role=\"hg-cmd\">hg import</command>, use the <command role=\"hg-"
416 "cmd\">hg diff</command>{--git} option when you generate the patch. The "
417 "system <command>patch</command> command cannot handle binary patches at all."
418 msgstr ""
420 #. type: Content of: <book><appendix><title>
421 #: ../en/appB-mq-ref.xml:5
422 msgid "Mercurial Queues reference"
423 msgstr "Mercurial 队列参考"
425 #. type: Content of: <book><appendix><sect1><title>
426 #: ../en/appB-mq-ref.xml:8
427 msgid "MQ command reference"
428 msgstr "MQ 命令参考"
430 #. type: Content of: <book><appendix><sect1><para>
431 #: ../en/appB-mq-ref.xml:10
432 msgid ""
433 "For an overview of the commands provided by MQ, use the command <command role="
434 "\"hg-cmd\">hg help mq</command>."
435 msgstr ""
437 #. type: Content of: <book><appendix><sect1><sect2><title>
438 #: ../en/appB-mq-ref.xml:14
439 msgid ""
440 "<command role=\"hg-ext-mq\">qapplied</command>&emdash;print applied patches"
441 msgstr "<command role=\"hg-ext-mq\">qapplied</command>&emdash;显示已应用的补丁"
443 #. type: Content of: <book><appendix><sect1><sect2><para>
444 #: ../en/appB-mq-ref.xml:17
445 msgid ""
446 "The <command role=\"hg-ext-mq\">qapplied</command> command prints the current "
447 "stack of applied patches. Patches are printed in oldest-to-newest order, so "
448 "the last patch in the list is the <quote>top</quote> patch."
449 msgstr ""
451 #. type: Content of: <book><appendix><sect1><sect2><title>
452 #: ../en/appB-mq-ref.xml:24
453 msgid ""
454 "<command role=\"hg-ext-mq\">qcommit</command>&emdash;commit changes in the "
455 "queue repository"
456 msgstr "<command role=\"hg-ext-mq\">qcommit</command>&emdash;提交队列中的修改"
458 #. type: Content of: <book><appendix><sect1><sect2><para>
459 #: ../en/appB-mq-ref.xml:27
460 msgid ""
461 "The <command role=\"hg-ext-mq\">qcommit</command> command commits any "
462 "outstanding changes in the <filename role=\"special\" class=\"directory\">.hg/"
463 "patches</filename> repository. This command only works if the <filename role="
464 "\"special\" class=\"directory\">.hg/patches</filename> directory is a "
465 "repository, i.e. you created the directory using <command role=\"hg-cmd\">hg "
466 "qinit <option role=\"hg-ext-mq-cmd-qinit-opt\">-c</option></command> or ran "
467 "<command role=\"hg-cmd\">hg init</command> in the directory after running "
468 "<command role=\"hg-ext-mq\">qinit</command>."
469 msgstr ""
471 #. type: Content of: <book><appendix><sect1><sect2><para>
472 #: ../en/appB-mq-ref.xml:39
473 msgid ""
474 "This command is shorthand for <command role=\"hg-cmd\">hg commit --cwd .hg/"
475 "patches</command>."
476 msgstr ""
478 #. type: Content of: <book><appendix><sect1><sect2><para>
479 #: ../en/appB-mq-ref.xml:42
480 msgid ""
481 "\\subsection{<command role=\"hg-ext-mq\">qdelete</command>&emdash;delete a "
482 "patch from the <filename role=\"special\">series</filename> file}"
483 msgstr ""
485 #. type: Content of: <book><appendix><sect1><sect2><para>
486 #: ../en/appB-mq-ref.xml:47
487 msgid ""
488 "The <command role=\"hg-ext-mq\">qdelete</command> command removes the entry "
489 "for a patch from the <filename role=\"special\">series</filename> file in the "
490 "<filename role=\"special\" class=\"directory\">.hg/patches</filename> "
491 "directory. It does not pop the patch if the patch is already applied. By "
492 "default, it does not delete the patch file; use the <option role=\"hg-ext-mq-"
493 "cmd-qdel-opt\">-f</option> option to do that."
494 msgstr ""
496 #. type: Content of: <book><appendix><sect1><sect2><para>
497 #: ../en/appB-mq-ref.xml:56 ../en/appB-mq-ref.xml:98 ../en/appB-mq-ref.xml:156
498 #: ../en/appB-mq-ref.xml:196 ../en/appB-mq-ref.xml:263
499 #: ../en/appB-mq-ref.xml:334 ../en/appB-mq-ref.xml:403
500 #: ../en/appB-mq-ref.xml:496
501 msgid "Options:"
502 msgstr ""
504 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
505 #: ../en/appB-mq-ref.xml:58
506 msgid ""
507 "<option role=\"hg-ext-mq-cmd-qdel-opt\">-f</option>: Delete the patch file."
508 msgstr ""
510 #. type: Content of: <book><appendix><sect1><sect2><title>
511 #: ../en/appB-mq-ref.xml:65
512 msgid ""
513 "<command role=\"hg-ext-mq\">qdiff</command>&emdash;print a diff of the "
514 "topmost applied patch"
515 msgstr ""
516 "<command role=\"hg-ext-mq\">qdiff</command>&emdash;显示最新应用补丁的差异"
518 #. type: Content of: <book><appendix><sect1><sect2><para>
519 #: ../en/appB-mq-ref.xml:68
520 msgid ""
521 "The <command role=\"hg-ext-mq\">qdiff</command> command prints a diff of the "
522 "topmost applied patch. It is equivalent to <command role=\"hg-cmd\">hg diff -"
523 "r-2:-1</command>."
524 msgstr ""
526 #. type: Content of: <book><appendix><sect1><sect2><title>
527 #: ../en/appB-mq-ref.xml:74
528 msgid ""
529 "<command role=\"hg-ext-mq\">qfold</command>&emdash;merge (<quote>fold</"
530 "quote>) several patches into one"
531 msgstr ""
532 "<command role=\"hg-ext-mq\">qfold</command>&emdash;将多个补丁合并(<quote>折叠"
533 "</quote>)成一个"
535 #. type: Content of: <book><appendix><sect1><sect2><para>
536 #: ../en/appB-mq-ref.xml:77
537 msgid ""
538 "The <command role=\"hg-ext-mq\">qfold</command> command merges multiple "
539 "patches into the topmost applied patch, so that the topmost applied patch "
540 "makes the union of all of the changes in the patches in question."
541 msgstr ""
543 #. type: Content of: <book><appendix><sect1><sect2><para>
544 #: ../en/appB-mq-ref.xml:82
545 msgid ""
546 "The patches to fold must not be applied; <command role=\"hg-ext-mq\">qfold</"
547 "command> will exit with an error if any is. The order in which patches are "
548 "folded is significant; <command role=\"hg-cmd\">hg qfold a b</command> means "
549 "<quote>apply the current topmost patch, followed by <literal>a</literal>, "
550 "followed by <literal>b</literal></quote>."
551 msgstr ""
553 #. type: Content of: <book><appendix><sect1><sect2><para>
554 #: ../en/appB-mq-ref.xml:90
555 msgid ""
556 "The comments from the folded patches are appended to the comments of the "
557 "destination patch, with each block of comments separated by three asterisk "
558 "(<quote><literal>*</literal></quote>) characters. Use the <option role=\"hg-"
559 "ext-mq-cmd-qfold-opt\">-e</option> option to edit the commit message for the "
560 "combined patch/changeset after the folding has completed."
561 msgstr ""
563 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
564 #: ../en/appB-mq-ref.xml:100
565 msgid ""
566 "<option role=\"hg-ext-mq-cmd-qfold-opt\">-e</option>: Edit the commit message "
567 "and patch description for the newly folded patch."
568 msgstr ""
570 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
571 #: ../en/appB-mq-ref.xml:105
572 msgid ""
573 "<option role=\"hg-ext-mq-cmd-qfold-opt\">-l</option>: Use the contents of the "
574 "given file as the new commit message and patch description for the folded "
575 "patch."
576 msgstr ""
578 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
579 #: ../en/appB-mq-ref.xml:110
580 msgid ""
581 "<option role=\"hg-ext-mq-cmd-qfold-opt\">-m</option>: Use the given text as "
582 "the new commit message and patch description for the folded patch."
583 msgstr ""
585 #. type: Content of: <book><appendix><sect1><sect2><title>
586 #: ../en/appB-mq-ref.xml:118
587 msgid ""
588 "<command role=\"hg-ext-mq\">qheader</command>&emdash;display the header/"
589 "description of a patch"
590 msgstr "<command role=\"hg-ext-mq\">qheader</command>&emdash;显示补丁头部描述"
592 #. type: Content of: <book><appendix><sect1><sect2><para>
593 #: ../en/appB-mq-ref.xml:122
594 msgid ""
595 "The <command role=\"hg-ext-mq\">qheader</command> command prints the header, "
596 "or description, of a patch. By default, it prints the header of the topmost "
597 "applied patch. Given an argument, it prints the header of the named patch."
598 msgstr ""
600 #. type: Content of: <book><appendix><sect1><sect2><title>
601 #: ../en/appB-mq-ref.xml:129
602 msgid ""
603 "<command role=\"hg-ext-mq\">qimport</command>&emdash;import a third-party "
604 "patch into the queue"
605 msgstr ""
606 "<command role=\"hg-ext-mq\">qimport</command>&emdash;将第三方补丁导入队列"
608 #. type: Content of: <book><appendix><sect1><sect2><para>
609 #: ../en/appB-mq-ref.xml:132
610 msgid ""
611 "The <command role=\"hg-ext-mq\">qimport</command> command adds an entry for "
612 "an external patch to the <filename role=\"special\">series</filename> file, "
613 "and copies the patch into the <filename role=\"special\" class=\"directory\">."
614 "hg/patches</filename> directory. It adds the entry immediately after the "
615 "topmost applied patch, but does not push the patch."
616 msgstr ""
618 #. type: Content of: <book><appendix><sect1><sect2><para>
619 #: ../en/appB-mq-ref.xml:140
620 msgid ""
621 "If the <filename role=\"special\" class=\"directory\">.hg/patches</filename> "
622 "directory is a repository, <command role=\"hg-ext-mq\">qimport</command> "
623 "automatically does an <command role=\"hg-cmd\">hg add</command> of the "
624 "imported patch."
625 msgstr ""
627 #. type: Content of: <book><appendix><sect1><sect2><title>
628 #: ../en/appB-mq-ref.xml:148
629 msgid ""
630 "<command role=\"hg-ext-mq\">qinit</command>&emdash;prepare a repository to "
631 "work with MQ"
632 msgstr "<command role=\"hg-ext-mq\">qinit</command>&emdash;为使用 MQ 配置版本库"
634 #. type: Content of: <book><appendix><sect1><sect2><para>
635 #: ../en/appB-mq-ref.xml:151
636 msgid ""
637 "The <command role=\"hg-ext-mq\">qinit</command> command prepares a repository "
638 "to work with MQ. It creates a directory called <filename role=\"special\" "
639 "class=\"directory\">.hg/patches</filename>."
640 msgstr ""
642 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
643 #: ../en/appB-mq-ref.xml:158
644 msgid ""
645 "<option role=\"hg-ext-mq-cmd-qinit-opt\">-c</option>: Create <filename role="
646 "\"special\" class=\"directory\">.hg/patches</filename> as a repository in its "
647 "own right. Also creates a <filename role=\"special\">.hgignore</filename> "
648 "file that will ignore the <filename role=\"special\">status</filename> file."
649 msgstr ""
651 #. type: Content of: <book><appendix><sect1><sect2><para>
652 #: ../en/appB-mq-ref.xml:168
653 msgid ""
654 "When the <filename role=\"special\" class=\"directory\">.hg/patches</"
655 "filename> directory is a repository, the <command role=\"hg-ext-mq\">qimport</"
656 "command> and <command role=\"hg-ext-mq\">qnew</command> commands "
657 "automatically <command role=\"hg-cmd\">hg add</command> new patches."
658 msgstr ""
660 #. type: Content of: <book><appendix><sect1><sect2><title>
661 #: ../en/appB-mq-ref.xml:177
662 msgid "<command role=\"hg-ext-mq\">qnew</command>&emdash;create a new patch"
663 msgstr "<command role=\"hg-ext-mq\">qnew</command>&emdash;创建新补丁"
665 #. type: Content of: <book><appendix><sect1><sect2><para>
666 #: ../en/appB-mq-ref.xml:180
667 msgid ""
668 "The <command role=\"hg-ext-mq\">qnew</command> command creates a new patch. "
669 "It takes one mandatory argument, the name to use for the patch file. The "
670 "newly created patch is created empty by default. It is added to the "
671 "<filename role=\"special\">series</filename> file after the current topmost "
672 "applied patch, and is immediately pushed on top of that patch."
673 msgstr ""
675 #. type: Content of: <book><appendix><sect1><sect2><para>
676 #: ../en/appB-mq-ref.xml:188
677 msgid ""
678 "If <command role=\"hg-ext-mq\">qnew</command> finds modified files in the "
679 "working directory, it will refuse to create a new patch unless the <option "
680 "role=\"hg-ext-mq-cmd-qnew-opt\">-f</option> option is used (see below). This "
681 "behaviour allows you to <command role=\"hg-ext-mq\">qrefresh</command> your "
682 "topmost applied patch before you apply a new patch on top of it."
683 msgstr ""
685 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
686 #: ../en/appB-mq-ref.xml:198
687 msgid ""
688 "<option role=\"hg-ext-mq-cmd-qnew-opt\">-f</option>: Create a new patch if "
689 "the contents of the working directory are modified. Any outstanding "
690 "modifications are added to the newly created patch, so after this command "
691 "completes, the working directory will no longer be modified."
692 msgstr ""
694 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
695 #: ../en/appB-mq-ref.xml:205
696 msgid ""
697 "<option role=\"hg-ext-mq-cmd-qnew-opt\">-m</option>: Use the given text as "
698 "the commit message. This text will be stored at the beginning of the patch "
699 "file, before the patch data."
700 msgstr ""
702 #. type: Content of: <book><appendix><sect1><sect2><title>
703 #: ../en/appB-mq-ref.xml:214
704 msgid ""
705 "<command role=\"hg-ext-mq\">qnext</command>&emdash;print the name of the next "
706 "patch"
707 msgstr "<command role=\"hg-ext-mq\">qnext</command>&emdash;显示下个补丁的名称"
709 #. type: Content of: <book><appendix><sect1><sect2><para>
710 #: ../en/appB-mq-ref.xml:217
711 msgid ""
712 "The <command role=\"hg-ext-mq\">qnext</command> command prints the name name "
713 "of the next patch in the <filename role=\"special\">series</filename> file "
714 "after the topmost applied patch. This patch will become the topmost applied "
715 "patch if you run <command role=\"hg-ext-mq\">qpush</command>."
716 msgstr ""
718 #. type: Content of: <book><appendix><sect1><sect2><title>
719 #: ../en/appB-mq-ref.xml:226
720 msgid ""
721 "<command role=\"hg-ext-mq\">qpop</command>&emdash;pop patches off the stack"
722 msgstr "<command role=\"hg-ext-mq\">qpop</command>&emdash;删除堆栈顶部的补丁"
724 #. type: Content of: <book><appendix><sect1><sect2><para>
725 #: ../en/appB-mq-ref.xml:229
726 msgid ""
727 "The <command role=\"hg-ext-mq\">qpop</command> command removes applied "
728 "patches from the top of the stack of applied patches. By default, it removes "
729 "only one patch."
730 msgstr ""
732 #. type: Content of: <book><appendix><sect1><sect2><para>
733 #: ../en/appB-mq-ref.xml:233
734 msgid ""
735 "This command removes the changesets that represent the popped patches from "
736 "the repository, and updates the working directory to undo the effects of the "
737 "patches."
738 msgstr ""
740 #. type: Content of: <book><appendix><sect1><sect2><para>
741 #: ../en/appB-mq-ref.xml:237
742 msgid ""
743 "This command takes an optional argument, which it uses as the name or index "
744 "of the patch to pop to. If given a name, it will pop patches until the named "
745 "patch is the topmost applied patch. If given a number, <command role=\"hg-"
746 "ext-mq\">qpop</command> treats the number as an index into the entries in the "
747 "series file, counting from zero (empty lines and lines containing only "
748 "comments do not count). It pops patches until the patch identified by the "
749 "given index is the topmost applied patch."
750 msgstr ""
752 #. type: Content of: <book><appendix><sect1><sect2><para>
753 #: ../en/appB-mq-ref.xml:247
754 msgid ""
755 "The <command role=\"hg-ext-mq\">qpop</command> command does not read or write "
756 "patches or the <filename role=\"special\">series</filename> file. It is thus "
757 "safe to <command role=\"hg-ext-mq\">qpop</command> a patch that you have "
758 "removed from the <filename role=\"special\">series</filename> file, or a "
759 "patch that you have renamed or deleted entirely. In the latter two cases, "
760 "use the name of the patch as it was when you applied it."
761 msgstr ""
763 #. type: Content of: <book><appendix><sect1><sect2><para>
764 #: ../en/appB-mq-ref.xml:256
765 msgid ""
766 "By default, the <command role=\"hg-ext-mq\">qpop</command> command will not "
767 "pop any patches if the working directory has been modified. You can override "
768 "this behaviour using the <option role=\"hg-ext-mq-cmd-qpop-opt\">-f</option> "
769 "option, which reverts all modifications in the working directory."
770 msgstr ""
772 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
773 #: ../en/appB-mq-ref.xml:265
774 msgid ""
775 "<option role=\"hg-ext-mq-cmd-qpop-opt\">-a</option>: Pop all applied "
776 "patches. This returns the repository to its state before you applied any "
777 "patches."
778 msgstr ""
780 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
781 #: ../en/appB-mq-ref.xml:270
782 msgid ""
783 "<option role=\"hg-ext-mq-cmd-qpop-opt\">-f</option>: Forcibly revert any "
784 "modifications to the working directory when popping."
785 msgstr ""
787 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
788 #: ../en/appB-mq-ref.xml:275
789 msgid ""
790 "<option role=\"hg-ext-mq-cmd-qpop-opt\">-n</option>: Pop a patch from the "
791 "named queue."
792 msgstr ""
794 #. type: Content of: <book><appendix><sect1><sect2><para>
795 #: ../en/appB-mq-ref.xml:280
796 msgid ""
797 "The <command role=\"hg-ext-mq\">qpop</command> command removes one line from "
798 "the end of the <filename role=\"special\">status</filename> file for each "
799 "patch that it pops."
800 msgstr ""
802 #. type: Content of: <book><appendix><sect1><sect2><title>
803 #: ../en/appB-mq-ref.xml:287
804 msgid ""
805 "<command role=\"hg-ext-mq\">qprev</command>&emdash;print the name of the "
806 "previous patch"
807 msgstr "<command role=\"hg-ext-mq\">qprev</command>&emdash;显示上个补丁的名称"
809 #. type: Content of: <book><appendix><sect1><sect2><para>
810 #: ../en/appB-mq-ref.xml:290
811 msgid ""
812 "The <command role=\"hg-ext-mq\">qprev</command> command prints the name of "
813 "the patch in the <filename role=\"special\">series</filename> file that comes "
814 "before the topmost applied patch. This will become the topmost applied patch "
815 "if you run <command role=\"hg-ext-mq\">qpop</command>."
816 msgstr ""
818 #. type: Content of: <book><appendix><sect1><sect2><title>
819 #: ../en/appB-mq-ref.xml:299
820 msgid ""
821 "<command role=\"hg-ext-mq\">qpush</command>&emdash;push patches onto the stack"
822 msgstr "<command role=\"hg-ext-mq\">qpush</command>&emdash;增加补丁到堆栈"
824 #. type: Content of: <book><appendix><sect1><sect2><para>
825 #: ../en/appB-mq-ref.xml:302
826 msgid ""
827 "The <command role=\"hg-ext-mq\">qpush</command> command adds patches onto the "
828 "applied stack. By default, it adds only one patch."
829 msgstr ""
831 #. type: Content of: <book><appendix><sect1><sect2><para>
832 #: ../en/appB-mq-ref.xml:306
833 msgid ""
834 "This command creates a new changeset to represent each applied patch, and "
835 "updates the working directory to apply the effects of the patches."
836 msgstr ""
838 #. type: Content of: <book><appendix><sect1><sect2><para>
839 #: ../en/appB-mq-ref.xml:310
840 msgid "The default data used when creating a changeset are as follows:"
841 msgstr ""
843 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
844 #: ../en/appB-mq-ref.xml:313
845 msgid ""
846 "The commit date and time zone are the current date and time zone. Because "
847 "these data are used to compute the identity of a changeset, this means that "
848 "if you <command role=\"hg-ext-mq\">qpop</command> a patch and <command role="
849 "\"hg-ext-mq\">qpush</command> it again, the changeset that you push will have "
850 "a different identity than the changeset you popped."
851 msgstr ""
853 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
854 #: ../en/appB-mq-ref.xml:321
855 msgid ""
856 "The author is the same as the default used by the <command role=\"hg-cmd\">hg "
857 "commit</command> command."
858 msgstr ""
860 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
861 #: ../en/appB-mq-ref.xml:325
862 msgid ""
863 "The commit message is any text from the patch file that comes before the "
864 "first diff header. If there is no such text, a default commit message is "
865 "used that identifies the name of the patch."
866 msgstr ""
868 #. type: Content of: <book><appendix><sect1><sect2><para>
869 #: ../en/appB-mq-ref.xml:330
870 msgid ""
871 "If a patch contains a Mercurial patch header (XXX add link), the information "
872 "in the patch header overrides these defaults."
873 msgstr ""
875 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
876 #: ../en/appB-mq-ref.xml:336
877 msgid ""
878 "<option role=\"hg-ext-mq-cmd-qpush-opt\">-a</option>: Push all unapplied "
879 "patches from the <filename role=\"special\">series</filename> file until "
880 "there are none left to push."
881 msgstr ""
883 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
884 #: ../en/appB-mq-ref.xml:342
885 msgid ""
886 "<option role=\"hg-ext-mq-cmd-qpush-opt\">-l</option>: Add the name of the "
887 "patch to the end of the commit message."
888 msgstr ""
890 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
891 #: ../en/appB-mq-ref.xml:346
892 msgid ""
893 "<option role=\"hg-ext-mq-cmd-qpush-opt\">-m</option>: If a patch fails to "
894 "apply cleanly, use the entry for the patch in another saved queue to compute "
895 "the parameters for a three-way merge, and perform a three-way merge using the "
896 "normal Mercurial merge machinery. Use the resolution of the merge as the new "
897 "patch content."
898 msgstr ""
900 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
901 #: ../en/appB-mq-ref.xml:354
902 msgid ""
903 "<option role=\"hg-ext-mq-cmd-qpush-opt\">-n</option>: Use the named queue if "
904 "merging while pushing."
905 msgstr ""
907 #. type: Content of: <book><appendix><sect1><sect2><para>
908 #: ../en/appB-mq-ref.xml:359
909 msgid ""
910 "The <command role=\"hg-ext-mq\">qpush</command> command reads, but does not "
911 "modify, the <filename role=\"special\">series</filename> file. It appends "
912 "one line to the <command role=\"hg-cmd\">hg status</command> file for each "
913 "patch that it pushes."
914 msgstr ""
916 #. type: Content of: <book><appendix><sect1><sect2><title>
917 #: ../en/appB-mq-ref.xml:367
918 msgid ""
919 "<command role=\"hg-ext-mq\">qrefresh</command>&emdash;update the topmost "
920 "applied patch"
921 msgstr "<command role=\"hg-ext-mq\">qrefresh</command>&emdash;更新最新的补丁"
923 #. type: Content of: <book><appendix><sect1><sect2><para>
924 #: ../en/appB-mq-ref.xml:371
925 msgid ""
926 "The <command role=\"hg-ext-mq\">qrefresh</command> command updates the "
927 "topmost applied patch. It modifies the patch, removes the old changeset that "
928 "represented the patch, and creates a new changeset to represent the modified "
929 "patch."
930 msgstr ""
932 #. type: Content of: <book><appendix><sect1><sect2><para>
933 #: ../en/appB-mq-ref.xml:377
934 msgid ""
935 "The <command role=\"hg-ext-mq\">qrefresh</command> command looks for the "
936 "following modifications:"
937 msgstr ""
939 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
940 #: ../en/appB-mq-ref.xml:380
941 msgid ""
942 "Changes to the commit message, i.e. the text before the first diff header in "
943 "the patch file, are reflected in the new changeset that represents the patch."
944 msgstr ""
946 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
947 #: ../en/appB-mq-ref.xml:385
948 msgid ""
949 "Modifications to tracked files in the working directory are added to the "
950 "patch."
951 msgstr ""
953 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
954 #: ../en/appB-mq-ref.xml:388
955 msgid ""
956 "Changes to the files tracked using <command role=\"hg-cmd\">hg add</command>, "
957 "<command role=\"hg-cmd\">hg copy</command>, <command role=\"hg-cmd\">hg "
958 "remove</command>, or <command role=\"hg-cmd\">hg rename</command>. Added "
959 "files and copy and rename destinations are added to the patch, while removed "
960 "files and rename sources are removed."
961 msgstr ""
963 #. type: Content of: <book><appendix><sect1><sect2><para>
964 #: ../en/appB-mq-ref.xml:397
965 msgid ""
966 "Even if <command role=\"hg-ext-mq\">qrefresh</command> detects no changes, it "
967 "still recreates the changeset that represents the patch. This causes the "
968 "identity of the changeset to differ from the previous changeset that "
969 "identified the patch."
970 msgstr ""
972 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
973 #: ../en/appB-mq-ref.xml:405
974 msgid ""
975 "<option role=\"hg-ext-mq-cmd-qrefresh-opt\">-e</option>: Modify the commit "
976 "and patch description, using the preferred text editor."
977 msgstr ""
979 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
980 #: ../en/appB-mq-ref.xml:410
981 msgid ""
982 "<option role=\"hg-ext-mq-cmd-qrefresh-opt\">-m</option>: Modify the commit "
983 "message and patch description, using the given text."
984 msgstr ""
986 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
987 #: ../en/appB-mq-ref.xml:415
988 msgid ""
989 "<option role=\"hg-ext-mq-cmd-qrefresh-opt\">-l</option>: Modify the commit "
990 "message and patch description, using text from the given file."
991 msgstr ""
993 #. type: Content of: <book><appendix><sect1><sect2><title>
994 #: ../en/appB-mq-ref.xml:423
995 msgid "<command role=\"hg-ext-mq\">qrename</command>&emdash;rename a patch"
996 msgstr "<command role=\"hg-ext-mq\">qrename</command>&emdash;改名补丁"
998 #. type: Content of: <book><appendix><sect1><sect2><para>
999 #: ../en/appB-mq-ref.xml:426
1000 msgid ""
1001 "The <command role=\"hg-ext-mq\">qrename</command> command renames a patch, "
1002 "and changes the entry for the patch in the <filename role=\"special\">series</"
1003 "filename> file."
1004 msgstr ""
1006 #. type: Content of: <book><appendix><sect1><sect2><para>
1007 #: ../en/appB-mq-ref.xml:430
1008 msgid ""
1009 "With a single argument, <command role=\"hg-ext-mq\">qrename</command> renames "
1010 "the topmost applied patch. With two arguments, it renames its first argument "
1011 "to its second."
1012 msgstr ""
1014 #. type: Content of: <book><appendix><sect1><sect2><title>
1015 #: ../en/appB-mq-ref.xml:437
1016 msgid ""
1017 "<command role=\"hg-ext-mq\">qrestore</command>&emdash;restore saved queue "
1018 "state"
1019 msgstr "<command role=\"hg-ext-mq\">qrestore</command>&emdash;恢复保存的队列"
1021 #. type: Content of: <book><appendix><sect1><sect2><para>
1022 #: ../en/appB-mq-ref.xml:441
1023 msgid "XXX No idea what this does."
1024 msgstr ""
1026 #. type: Content of: <book><appendix><sect1><sect2><title>
1027 #: ../en/appB-mq-ref.xml:445
1028 msgid ""
1029 "<command role=\"hg-ext-mq\">qsave</command>&emdash;save current queue state"
1030 msgstr "<command role=\"hg-ext-mq\">qsave</command>&emdash;保存当前的队列状态"
1032 #. type: Content of: <book><appendix><sect1><sect2><para>
1033 #: ../en/appB-mq-ref.xml:448
1034 msgid "XXX Likewise."
1035 msgstr ""
1037 #. type: Content of: <book><appendix><sect1><sect2><title>
1038 #: ../en/appB-mq-ref.xml:452
1039 msgid ""
1040 "<command role=\"hg-ext-mq\">qseries</command>&emdash;print the entire patch "
1041 "series"
1042 msgstr "<command role=\"hg-ext-mq\">qseries</command>&emdash;显示补丁序列"
1044 #. type: Content of: <book><appendix><sect1><sect2><para>
1045 #: ../en/appB-mq-ref.xml:455
1046 msgid ""
1047 "The <command role=\"hg-ext-mq\">qseries</command> command prints the entire "
1048 "patch series from the <filename role=\"special\">series</filename> file. It "
1049 "prints only patch names, not empty lines or comments. It prints in order "
1050 "from first to be applied to last."
1051 msgstr ""
1053 #. type: Content of: <book><appendix><sect1><sect2><title>
1054 #: ../en/appB-mq-ref.xml:463
1055 msgid ""
1056 "<command role=\"hg-ext-mq\">qtop</command>&emdash;print the name of the "
1057 "current patch"
1058 msgstr "<command role=\"hg-ext-mq\">qtop</command>&emdash;显示当前补丁的名称"
1060 #. type: Content of: <book><appendix><sect1><sect2><para>
1061 #: ../en/appB-mq-ref.xml:466
1062 msgid ""
1063 "The <command role=\"hg-ext-mq\">qtop</command> prints the name of the topmost "
1064 "currently applied patch."
1065 msgstr ""
1067 #. type: Content of: <book><appendix><sect1><sect2><title>
1068 #: ../en/appB-mq-ref.xml:471
1069 msgid ""
1070 "<command role=\"hg-ext-mq\">qunapplied</command>&emdash;print patches not yet "
1071 "applied"
1072 msgstr ""
1073 "<command role=\"hg-ext-mq\">qunapplied</command>&emdash;显示尚未应用的补丁"
1075 #. type: Content of: <book><appendix><sect1><sect2><para>
1076 #: ../en/appB-mq-ref.xml:475
1077 msgid ""
1078 "The <command role=\"hg-ext-mq\">qunapplied</command> command prints the names "
1079 "of patches from the <filename role=\"special\">series</filename> file that "
1080 "are not yet applied. It prints them in order from the next patch that will "
1081 "be pushed to the last."
1082 msgstr ""
1084 #. type: Content of: <book><appendix><sect1><sect2><title>
1085 #: ../en/appB-mq-ref.xml:483
1086 msgid ""
1087 "<command role=\"hg-cmd\">hg strip</command>&emdash;remove a revision and "
1088 "descendants"
1089 msgstr "<command role=\"hg-cmd\">hg strip</command>&emdash;删除一个版本及其后继"
1091 #. type: Content of: <book><appendix><sect1><sect2><para>
1092 #: ../en/appB-mq-ref.xml:486
1093 msgid ""
1094 "The <command role=\"hg-cmd\">hg strip</command> command removes a revision, "
1095 "and all of its descendants, from the repository. It undoes the effects of "
1096 "the removed revisions from the repository, and updates the working directory "
1097 "to the first parent of the removed revision."
1098 msgstr ""
1100 #. type: Content of: <book><appendix><sect1><sect2><para>
1101 #: ../en/appB-mq-ref.xml:492
1102 msgid ""
1103 "The <command role=\"hg-cmd\">hg strip</command> command saves a backup of the "
1104 "removed changesets in a bundle, so that they can be reapplied if removed in "
1105 "error."
1106 msgstr ""
1108 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
1109 #: ../en/appB-mq-ref.xml:498
1110 msgid ""
1111 "<option role=\"hg-opt-strip\">-b</option>: Save unrelated changesets that are "
1112 "intermixed with the stripped changesets in the backup bundle."
1113 msgstr ""
1115 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
1116 #: ../en/appB-mq-ref.xml:502
1117 msgid ""
1118 "<option role=\"hg-opt-strip\">-f</option>: If a branch has multiple heads, "
1119 "remove all heads. XXX This should be renamed, and use <literal>-f</literal> "
1120 "to strip revs when there are pending changes."
1121 msgstr ""
1123 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
1124 #: ../en/appB-mq-ref.xml:507
1125 msgid "<option role=\"hg-opt-strip\">-n</option>: Do not save a backup bundle."
1126 msgstr ""
1128 #. type: Content of: <book><appendix><sect1><title>
1129 #: ../en/appB-mq-ref.xml:514
1130 msgid "MQ file reference"
1131 msgstr "MQ 文件参考"
1133 #. type: Content of: <book><appendix><sect1><sect2><title>
1134 #: ../en/appB-mq-ref.xml:517
1135 msgid "The <filename role=\"special\">series</filename> file"
1136 msgstr "<filename role=\"special\">序列</filename>文件"
1138 #. type: Content of: <book><appendix><sect1><sect2><para>
1139 #: ../en/appB-mq-ref.xml:520
1140 msgid ""
1141 "The <filename role=\"special\">series</filename> file contains a list of the "
1142 "names of all patches that MQ can apply. It is represented as a list of "
1143 "names, with one name saved per line. Leading and trailing white space in "
1144 "each line are ignored."
1145 msgstr ""
1147 #. type: Content of: <book><appendix><sect1><sect2><para>
1148 #: ../en/appB-mq-ref.xml:526
1149 msgid ""
1150 "Lines may contain comments. A comment begins with the <quote><literal>#</"
1151 "literal></quote> character, and extends to the end of the line. Empty lines, "
1152 "and lines that contain only comments, are ignored."
1153 msgstr ""
1155 #. type: Content of: <book><appendix><sect1><sect2><para>
1156 #: ../en/appB-mq-ref.xml:531
1157 msgid ""
1158 "You will often need to edit the <filename role=\"special\">series</filename> "
1159 "file by hand, hence the support for comments and empty lines noted above. "
1160 "For example, you can comment out a patch temporarily, and <command role=\"hg-"
1161 "ext-mq\">qpush</command> will skip over that patch when applying patches. "
1162 "You can also change the order in which patches are applied by reordering "
1163 "their entries in the <filename role=\"special\">series</filename> file."
1164 msgstr ""
1166 #. type: Content of: <book><appendix><sect1><sect2><para>
1167 #: ../en/appB-mq-ref.xml:540
1168 msgid ""
1169 "Placing the <filename role=\"special\">series</filename> file under revision "
1170 "control is also supported; it is a good idea to place all of the patches that "
1171 "it refers to under revision control, as well. If you create a patch "
1172 "directory using the <option role=\"hg-ext-mq-cmd-qinit-opt\">-c</option> "
1173 "option to <command role=\"hg-ext-mq\">qinit</command>, this will be done for "
1174 "you automatically."
1175 msgstr ""
1177 #. type: Content of: <book><appendix><sect1><sect2><title>
1178 #: ../en/appB-mq-ref.xml:550
1179 msgid "The <filename role=\"special\">status</filename> file"
1180 msgstr "<filename role=\"special\">状态</filename>文件"
1182 #. type: Content of: <book><appendix><sect1><sect2><para>
1183 #: ../en/appB-mq-ref.xml:553
1184 msgid ""
1185 "The <filename role=\"special\">status</filename> file contains the names and "
1186 "changeset hashes of all patches that MQ currently has applied. Unlike the "
1187 "<filename role=\"special\">series</filename> file, this file is not intended "
1188 "for editing. You should not place this file under revision control, or "
1189 "modify it in any way. It is used by MQ strictly for internal book-keeping."
1190 msgstr ""
1192 #. type: Content of: <book><appendix><title>
1193 #: ../en/appC-srcinstall.xml:5
1194 msgid "Installing Mercurial from source"
1195 msgstr "从源代码安装 Mercurial"
1197 #. type: Content of: <book><appendix><sect1><title>
1198 #: ../en/appC-srcinstall.xml:8
1199 msgid "On a Unix-like system"
1200 msgstr "类 Unix 系统"
1202 #. type: Content of: <book><appendix><sect1><para>
1203 #: ../en/appC-srcinstall.xml:10
1204 msgid ""
1205 "If you are using a Unix-like system that has a sufficiently recent version of "
1206 "Python (2.3 or newer) available, it is easy to install Mercurial from source."
1207 msgstr ""
1209 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
1210 #: ../en/appC-srcinstall.xml:14
1211 msgid ""
1212 "Download a recent source tarball from <ulink url=\"http://www.selenic.com/"
1213 "mercurial/download\">http://www.selenic.com/mercurial/download</ulink>."
1214 msgstr ""
1216 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
1217 #: ../en/appC-srcinstall.xml:17
1218 msgid "Unpack the tarball:"
1219 msgstr ""
1221 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
1222 #: ../en/appC-srcinstall.xml:20
1223 msgid ""
1224 "Go into the source directory and run the installer script. This will build "
1225 "Mercurial and install it in your home directory."
1226 msgstr ""
1228 #. type: Content of: <book><appendix><sect1><para>
1229 #: ../en/appC-srcinstall.xml:27
1230 msgid ""
1231 "Once the install finishes, Mercurial will be in the <literal>bin</literal> "
1232 "subdirectory of your home directory. Don't forget to make sure that this "
1233 "directory is present in your shell's search path."
1234 msgstr ""
1236 #. type: Content of: <book><appendix><sect1><para>
1237 #: ../en/appC-srcinstall.xml:32
1238 msgid ""
1239 "You will probably need to set the <envar>PYTHONPATH</envar> environment "
1240 "variable so that the Mercurial executable can find the rest of the Mercurial "
1241 "packages. For example, on my laptop, I have set it to <literal>/home/bos/lib/"
1242 "python</literal>. The exact path that you will need to use depends on how "
1243 "Python was built for your system, but should be easy to figure out. If "
1244 "you're uncertain, look through the output of the installer script above, and "
1245 "see where the contents of the <literal>mercurial</literal> directory were "
1246 "installed to."
1247 msgstr ""
1249 #. type: Content of: <book><appendix><sect1><title>
1250 #: ../en/appC-srcinstall.xml:44
1251 msgid "On Windows"
1252 msgstr "Windows 系统"
1254 #. type: Content of: <book><appendix><sect1><para>
1255 #: ../en/appC-srcinstall.xml:46
1256 msgid ""
1257 "Building and installing Mercurial on Windows requires a variety of tools, a "
1258 "fair amount of technical knowledge, and considerable patience. I very much "
1259 "<emphasis>do not recommend</emphasis> this route if you are a <quote>casual "
1260 "user</quote>. Unless you intend to hack on Mercurial, I strongly suggest "
1261 "that you use a binary package instead."
1262 msgstr ""
1264 #. type: Content of: <book><appendix><sect1><para>
1265 #: ../en/appC-srcinstall.xml:53
1266 msgid ""
1267 "If you are intent on building Mercurial from source on Windows, follow the "
1268 "<quote>hard way</quote> directions on the Mercurial wiki at <ulink url="
1269 "\"http://www.selenic.com/mercurial/wiki/index.cgi/WindowsInstall\">http://www."
1270 "selenic.com/mercurial/wiki/index.cgi/WindowsInstall</ulink>, and expect the "
1271 "process to involve a lot of fiddly work."
1272 msgstr ""
1274 #. type: Content of: <book><appendix><title>
1275 #: ../en/appD-license.xml:5
1276 msgid "Open Publication License"
1277 msgstr ""
1279 #. type: Content of: <book><appendix><para>
1280 #: ../en/appD-license.xml:7
1281 msgid "Version 1.0, 8 June 1999"
1282 msgstr ""
1284 #. type: Content of: <book><appendix><sect1><title>
1285 #: ../en/appD-license.xml:10
1286 msgid "Requirements on both unmodified and modified versions"
1287 msgstr ""
1289 #. type: Content of: <book><appendix><sect1><para>
1290 #: ../en/appD-license.xml:13
1291 msgid ""
1292 "The Open Publication works may be reproduced and distributed in whole or in "
1293 "part, in any medium physical or electronic, provided that the terms of this "
1294 "license are adhered to, and that this license or an incorporation of it by "
1295 "reference (with any options elected by the author(s) and/or publisher) is "
1296 "displayed in the reproduction."
1297 msgstr ""
1299 #. type: Content of: <book><appendix><sect1><para>
1300 #: ../en/appD-license.xml:20
1301 msgid "Proper form for an incorporation by reference is as follows:"
1302 msgstr ""
1304 #. type: Content of: <book><appendix><sect1><blockquote><para>
1305 #: ../en/appD-license.xml:24
1306 msgid ""
1307 "Copyright (c) <emphasis>year</emphasis> by <emphasis>author's name or "
1308 "designee</emphasis>. This material may be distributed only subject to the "
1309 "terms and conditions set forth in the Open Publication License, v<emphasis>x."
1310 "y</emphasis> or later (the latest version is presently available at <ulink "
1311 "url=\"http://www.opencontent.org/openpub/\">http://www.opencontent.org/"
1312 "openpub/</ulink>)."
1313 msgstr ""
1315 #. type: Content of: <book><appendix><sect1><para>
1316 #: ../en/appD-license.xml:33
1317 msgid ""
1318 "The reference must be immediately followed with any options elected by the "
1319 "author(s) and/or publisher of the document (see section <xref linkend=\"sec."
1320 "opl.options\"/>)."
1321 msgstr ""
1323 #. type: Content of: <book><appendix><sect1><para>
1324 #: ../en/appD-license.xml:37
1325 msgid ""
1326 "Commercial redistribution of Open Publication-licensed material is permitted."
1327 msgstr ""
1329 #. type: Content of: <book><appendix><sect1><para>
1330 #: ../en/appD-license.xml:40
1331 msgid ""
1332 "Any publication in standard (paper) book form shall require the citation of "
1333 "the original publisher and author. The publisher and author's names shall "
1334 "appear on all outer surfaces of the book. On all outer surfaces of the book "
1335 "the original publisher's name shall be as large as the title of the work and "
1336 "cited as possessive with respect to the title."
1337 msgstr ""
1339 #. type: Content of: <book><appendix><sect1><title>
1340 #: ../en/appD-license.xml:49
1341 msgid "Copyright"
1342 msgstr ""
1344 #. type: Content of: <book><appendix><sect1><para>
1345 #: ../en/appD-license.xml:51
1346 msgid ""
1347 "The copyright to each Open Publication is owned by its author(s) or designee."
1348 msgstr ""
1350 #. type: Content of: <book><appendix><sect1><title>
1351 #: ../en/appD-license.xml:56
1352 msgid "Scope of license"
1353 msgstr ""
1355 #. type: Content of: <book><appendix><sect1><para>
1356 #: ../en/appD-license.xml:58
1357 msgid ""
1358 "The following license terms apply to all Open Publication works, unless "
1359 "otherwise explicitly stated in the document."
1360 msgstr ""
1362 #. type: Content of: <book><appendix><sect1><para>
1363 #: ../en/appD-license.xml:62
1364 msgid ""
1365 "Mere aggregation of Open Publication works or a portion of an Open "
1366 "Publication work with other works or programs on the same media shall not "
1367 "cause this license to apply to those other works. The aggregate work shall "
1368 "contain a notice specifying the inclusion of the Open Publication material "
1369 "and appropriate copyright notice."
1370 msgstr ""
1372 #. type: Content of: <book><appendix><sect1><para>
1373 #: ../en/appD-license.xml:69
1374 msgid ""
1375 "<emphasis role=\"bold\">Severability</emphasis>. If any part of this license "
1376 "is found to be unenforceable in any jurisdiction, the remaining portions of "
1377 "the license remain in force."
1378 msgstr ""
1380 #. type: Content of: <book><appendix><sect1><para>
1381 #: ../en/appD-license.xml:74
1382 msgid ""
1383 "<emphasis role=\"bold\">No warranty</emphasis>. Open Publication works are "
1384 "licensed and provided <quote>as is</quote> without warranty of any kind, "
1385 "express or implied, including, but not limited to, the implied warranties of "
1386 "merchantability and fitness for a particular purpose or a warranty of non-"
1387 "infringement."
1388 msgstr ""
1390 #. type: Content of: <book><appendix><sect1><title>
1391 #: ../en/appD-license.xml:83
1392 msgid "Requirements on modified works"
1393 msgstr ""
1395 #. type: Content of: <book><appendix><sect1><para>
1396 #: ../en/appD-license.xml:85
1397 msgid ""
1398 "All modified versions of documents covered by this license, including "
1399 "translations, anthologies, compilations and partial documents, must meet the "
1400 "following requirements:"
1401 msgstr ""
1403 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
1404 #: ../en/appD-license.xml:90
1405 msgid "The modified version must be labeled as such."
1406 msgstr ""
1408 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
1409 #: ../en/appD-license.xml:93
1410 msgid ""
1411 "The person making the modifications must be identified and the modifications "
1412 "dated."
1413 msgstr ""
1415 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
1416 #: ../en/appD-license.xml:96
1417 msgid ""
1418 "Acknowledgement of the original author and publisher if applicable must be "
1419 "retained according to normal academic citation practices."
1420 msgstr ""
1422 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
1423 #: ../en/appD-license.xml:100
1424 msgid "The location of the original unmodified document must be identified."
1425 msgstr ""
1427 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
1428 #: ../en/appD-license.xml:103
1429 msgid ""
1430 "The original author's (or authors') name(s) may not be used to assert or "
1431 "imply endorsement of the resulting document without the original author's (or "
1432 "authors') permission."
1433 msgstr ""
1435 #. type: Content of: <book><appendix><sect1><title>
1436 #: ../en/appD-license.xml:111
1437 msgid "Good-practice recommendations"
1438 msgstr ""
1440 #. type: Content of: <book><appendix><sect1><para>
1441 #: ../en/appD-license.xml:113
1442 msgid ""
1443 "In addition to the requirements of this license, it is requested from and "
1444 "strongly recommended of redistributors that:"
1445 msgstr ""
1447 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
1448 #: ../en/appD-license.xml:118
1449 msgid ""
1450 "If you are distributing Open Publication works on hardcopy or CD-ROM, you "
1451 "provide email notification to the authors of your intent to redistribute at "
1452 "least thirty days before your manuscript or media freeze, to give the authors "
1453 "time to provide updated documents. This notification should describe "
1454 "modifications, if any, made to the document."
1455 msgstr ""
1457 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
1458 #: ../en/appD-license.xml:125
1459 msgid ""
1460 "All substantive modifications (including deletions) be either clearly marked "
1461 "up in the document or else described in an attachment to the document."
1462 msgstr ""
1464 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
1465 #: ../en/appD-license.xml:129
1466 msgid ""
1467 "Finally, while it is not mandatory under this license, it is considered good "
1468 "form to offer a free copy of any hardcopy and CD-ROM expression of an Open "
1469 "Publication-licensed work to its author(s)."
1470 msgstr ""
1472 #. type: Content of: <book><appendix><sect1><title>
1473 #: ../en/appD-license.xml:137
1474 msgid "License options"
1475 msgstr ""
1477 #. type: Content of: <book><appendix><sect1><para>
1478 #: ../en/appD-license.xml:139
1479 msgid ""
1480 "The author(s) and/or publisher of an Open Publication-licensed document may "
1481 "elect certain options by appending language to the reference to or copy of "
1482 "the license. These options are considered part of the license instance and "
1483 "must be included with the license (or its incorporation by reference) in "
1484 "derived works."
1485 msgstr ""
1487 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
1488 #: ../en/appD-license.xml:147
1489 msgid ""
1490 "To prohibit distribution of substantively modified versions without the "
1491 "explicit permission of the author(s). <quote>Substantive modification</quote> "
1492 "is defined as a change to the semantic content of the document, and excludes "
1493 "mere changes in format or typographical corrections."
1494 msgstr ""
1496 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
1497 #: ../en/appD-license.xml:154
1498 msgid ""
1499 "To accomplish this, add the phrase <quote>Distribution of substantively "
1500 "modified versions of this document is prohibited without the explicit "
1501 "permission of the copyright holder.</quote> to the license reference or copy."
1502 msgstr ""
1504 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
1505 #: ../en/appD-license.xml:160
1506 msgid ""
1507 "To prohibit any publication of this work or derivative works in whole or in "
1508 "part in standard (paper) book form for commercial purposes is prohibited "
1509 "unless prior permission is obtained from the copyright holder."
1510 msgstr ""
1512 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
1513 #: ../en/appD-license.xml:165
1514 msgid ""
1515 "To accomplish this, add the phrase <quote>Distribution of the work or "
1516 "derivative of the work in any standard (paper) book form is prohibited unless "
1517 "prior permission is obtained from the copyright holder.</quote> to the "
1518 "license reference or copy."
1519 msgstr ""
1521 #. type: Content of: <book><chapter><title>
1522 #: ../en/ch01-intro.xml:5
1523 msgid "Introduction"
1524 msgstr "简介"
1526 #. type: Content of: <book><chapter><sect1><title>
1527 #: ../en/ch01-intro.xml:8
1528 msgid "About revision control"
1529 msgstr "关于版本控制"
1531 #. type: Content of: <book><chapter><sect1><para>
1532 #: ../en/ch01-intro.xml:10
1533 msgid ""
1534 "Revision control is the process of managing multiple versions of a piece of "
1535 "information. In its simplest form, this is something that many people do by "
1536 "hand: every time you modify a file, save it under a new name that contains a "
1537 "number, each one higher than the number of the preceding version."
1538 msgstr ""
1540 #. type: Content of: <book><chapter><sect1><para>
1541 #: ../en/ch01-intro.xml:16
1542 msgid ""
1543 "Manually managing multiple versions of even a single file is an error-prone "
1544 "task, though, so software tools to help automate this process have long been "
1545 "available. The earliest automated revision control tools were intended to "
1546 "help a single user to manage revisions of a single file. Over the past few "
1547 "decades, the scope of revision control tools has expanded greatly; they now "
1548 "manage multiple files, and help multiple people to work together. The best "
1549 "modern revision control tools have no problem coping with thousands of people "
1550 "working together on projects that consist of hundreds of thousands of files."
1551 msgstr ""
1553 #. type: Content of: <book><chapter><sect1><sect2><title>
1554 #: ../en/ch01-intro.xml:28
1555 msgid "Why use revision control?"
1556 msgstr "为什么使用版本控制?"
1558 #. type: Content of: <book><chapter><sect1><sect2><para>
1559 #: ../en/ch01-intro.xml:30
1560 msgid ""
1561 "There are a number of reasons why you or your team might want to use an "
1562 "automated revision control tool for a project."
1563 msgstr ""
1565 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
1566 #: ../en/ch01-intro.xml:34
1567 msgid ""
1568 "It will track the history and evolution of your project, so you don't have "
1569 "to. For every change, you'll have a log of <emphasis>who</emphasis> made it; "
1570 "<emphasis>why</emphasis> they made it; <emphasis>when</emphasis> they made "
1571 "it; and <emphasis>what</emphasis> the change was."
1572 msgstr ""
1574 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
1575 #: ../en/ch01-intro.xml:41
1576 msgid ""
1577 "When you're working with other people, revision control software makes it "
1578 "easier for you to collaborate. For example, when people more or less "
1579 "simultaneously make potentially incompatible changes, the software will help "
1580 "you to identify and resolve those conflicts."
1581 msgstr ""
1583 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
1584 #: ../en/ch01-intro.xml:47
1585 msgid ""
1586 "It can help you to recover from mistakes. If you make a change that later "
1587 "turns out to be in error, you can revert to an earlier version of one or more "
1588 "files. In fact, a <emphasis>really</emphasis> good revision control tool "
1589 "will even help you to efficiently figure out exactly when a problem was "
1590 "introduced (see section <xref linkend=\"sec.undo.bisect\"/> for details)."
1591 msgstr ""
1593 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
1594 #: ../en/ch01-intro.xml:54
1595 msgid ""
1596 "It will help you to work simultaneously on, and manage the drift between, "
1597 "multiple versions of your project."
1598 msgstr ""
1600 #. type: Content of: <book><chapter><sect1><sect2><para>
1601 #: ../en/ch01-intro.xml:57
1602 msgid ""
1603 "Most of these reasons are equally valid---at least in theory---whether you're "
1604 "working on a project by yourself, or with a hundred other people."
1605 msgstr ""
1607 #. type: Content of: <book><chapter><sect1><sect2><para>
1608 #: ../en/ch01-intro.xml:61
1609 msgid ""
1610 "A key question about the practicality of revision control at these two "
1611 "different scales (<quote>lone hacker</quote> and <quote>huge team</quote>) is "
1612 "how its <emphasis>benefits</emphasis> compare to its <emphasis>costs</"
1613 "emphasis>. A revision control tool that's difficult to understand or use is "
1614 "going to impose a high cost."
1615 msgstr ""
1617 #. type: Content of: <book><chapter><sect1><sect2><para>
1618 #: ../en/ch01-intro.xml:69
1619 msgid ""
1620 "A five-hundred-person project is likely to collapse under its own weight "
1621 "almost immediately without a revision control tool and process. In this case, "
1622 "the cost of using revision control might hardly seem worth considering, since "
1623 "<emphasis>without</emphasis> it, failure is almost guaranteed."
1624 msgstr ""
1626 #. type: Content of: <book><chapter><sect1><sect2><para>
1627 #: ../en/ch01-intro.xml:76
1628 msgid ""
1629 "On the other hand, a one-person <quote>quick hack</quote> might seem like a "
1630 "poor place to use a revision control tool, because surely the cost of using "
1631 "one must be close to the overall cost of the project. Right?"
1632 msgstr ""
1634 #. type: Content of: <book><chapter><sect1><sect2><para>
1635 #: ../en/ch01-intro.xml:81
1636 msgid ""
1637 "Mercurial uniquely supports <emphasis>both</emphasis> of these scales of "
1638 "development. You can learn the basics in just a few minutes, and due to its "
1639 "low overhead, you can apply revision control to the smallest of projects with "
1640 "ease. Its simplicity means you won't have a lot of abstruse concepts or "
1641 "command sequences competing for mental space with whatever you're "
1642 "<emphasis>really</emphasis> trying to do. At the same time, Mercurial's high "
1643 "performance and peer-to-peer nature let you scale painlessly to handle large "
1644 "projects."
1645 msgstr ""
1647 #. type: Content of: <book><chapter><sect1><sect2><para>
1648 #: ../en/ch01-intro.xml:91
1649 msgid ""
1650 "No revision control tool can rescue a poorly run project, but a good choice "
1651 "of tools can make a huge difference to the fluidity with which you can work "
1652 "on a project."
1653 msgstr ""
1655 #. type: Content of: <book><chapter><sect1><sect2><title>
1656 #: ../en/ch01-intro.xml:97
1657 msgid "The many names of revision control"
1658 msgstr "版本控制的别名"
1660 #. type: Content of: <book><chapter><sect1><sect2><para>
1661 #: ../en/ch01-intro.xml:99
1662 msgid ""
1663 "Revision control is a diverse field, so much so that it doesn't actually have "
1664 "a single name or acronym. Here are a few of the more common names and "
1665 "acronyms you'll encounter:"
1666 msgstr ""
1668 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
1669 #: ../en/ch01-intro.xml:104
1670 msgid "Revision control (RCS)"
1671 msgstr "版本控制(RCS)"
1673 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
1674 #: ../en/ch01-intro.xml:105
1675 msgid "Software configuration management (SCM), or configuration management"
1676 msgstr "软件配置管理(SCM),或配置管理"
1678 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
1679 #: ../en/ch01-intro.xml:107
1680 msgid "Source code management"
1681 msgstr "源代码管理"
1683 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
1684 #: ../en/ch01-intro.xml:108
1685 msgid "Source code control, or source control"
1686 msgstr "源代码控制,或源控制"
1688 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
1689 #: ../en/ch01-intro.xml:110
1690 msgid "Version control (VCS)"
1691 msgstr "版本控制(VCS)"
1693 #. type: Content of: <book><chapter><sect1><sect2><para>
1694 #: ../en/ch01-intro.xml:112
1695 msgid ""
1696 "Some people claim that these terms actually have different meanings, but in "
1697 "practice they overlap so much that there's no agreed or even useful way to "
1698 "tease them apart."
1699 msgstr ""
1701 #. type: Content of: <book><chapter><sect1><title>
1702 #: ../en/ch01-intro.xml:119
1703 msgid "A short history of revision control"
1704 msgstr "版本控制简史"
1706 #. type: Content of: <book><chapter><sect1><para>
1707 #: ../en/ch01-intro.xml:121
1708 msgid ""
1709 "The best known of the old-time revision control tools is SCCS (Source Code "
1710 "Control System), which Marc Rochkind wrote at Bell Labs, in the early 1970s. "
1711 "SCCS operated on individual files, and required every person working on a "
1712 "project to have access to a shared workspace on a single system. Only one "
1713 "person could modify a file at any time; arbitration for access to files was "
1714 "via locks. It was common for people to lock files, and later forget to "
1715 "unlock them, preventing anyone else from modifying those files without the "
1716 "help of an administrator."
1717 msgstr ""
1719 #. type: Content of: <book><chapter><sect1><para>
1720 #: ../en/ch01-intro.xml:132
1721 msgid ""
1722 "Walter Tichy developed a free alternative to SCCS in the early 1980s; he "
1723 "called his program RCS (Revision Control System). Like SCCS, RCS required "
1724 "developers to work in a single shared workspace, and to lock files to prevent "
1725 "multiple people from modifying them simultaneously."
1726 msgstr ""
1728 #. type: Content of: <book><chapter><sect1><para>
1729 #: ../en/ch01-intro.xml:138
1730 msgid ""
1731 "Later in the 1980s, Dick Grune used RCS as a building block for a set of "
1732 "shell scripts he initially called cmt, but then renamed to CVS (Concurrent "
1733 "Versions System). The big innovation of CVS was that it let developers work "
1734 "simultaneously and somewhat independently in their own personal workspaces. "
1735 "The personal workspaces prevented developers from stepping on each other's "
1736 "toes all the time, as was common with SCCS and RCS. Each developer had a copy "
1737 "of every project file, and could modify their copies independently. They had "
1738 "to merge their edits prior to committing changes to the central repository."
1739 msgstr ""
1741 #. type: Content of: <book><chapter><sect1><para>
1742 #: ../en/ch01-intro.xml:149
1743 msgid ""
1744 "Brian Berliner took Grune's original scripts and rewrote them in C, releasing "
1745 "in 1989 the code that has since developed into the modern version of CVS. "
1746 "CVS subsequently acquired the ability to operate over a network connection, "
1747 "giving it a client/server architecture. CVS's architecture is centralised; "
1748 "only the server has a copy of the history of the project. Client workspaces "
1749 "just contain copies of recent versions of the project's files, and a little "
1750 "metadata to tell them where the server is. CVS has been enormously "
1751 "successful; it is probably the world's most widely used revision control "
1752 "system."
1753 msgstr ""
1755 #. type: Content of: <book><chapter><sect1><para>
1756 #: ../en/ch01-intro.xml:160
1757 msgid ""
1758 "In the early 1990s, Sun Microsystems developed an early distributed revision "
1759 "control system, called TeamWare. A TeamWare workspace contains a complete "
1760 "copy of the project's history. TeamWare has no notion of a central "
1761 "repository. (CVS relied upon RCS for its history storage; TeamWare used "
1762 "SCCS.)"
1763 msgstr ""
1765 #. type: Content of: <book><chapter><sect1><para>
1766 #: ../en/ch01-intro.xml:167
1767 msgid ""
1768 "As the 1990s progressed, awareness grew of a number of problems with CVS. It "
1769 "records simultaneous changes to multiple files individually, instead of "
1770 "grouping them together as a single logically atomic operation. It does not "
1771 "manage its file hierarchy well; it is easy to make a mess of a repository by "
1772 "renaming files and directories. Worse, its source code is difficult to read "
1773 "and maintain, which made the <quote>pain level</quote> of fixing these "
1774 "architectural problems prohibitive."
1775 msgstr ""
1777 #. type: Content of: <book><chapter><sect1><para>
1778 #: ../en/ch01-intro.xml:177
1779 msgid ""
1780 "In 2001, Jim Blandy and Karl Fogel, two developers who had worked on CVS, "
1781 "started a project to replace it with a tool that would have a better "
1782 "architecture and cleaner code. The result, Subversion, does not stray from "
1783 "CVS's centralised client/server model, but it adds multi-file atomic commits, "
1784 "better namespace management, and a number of other features that make it a "
1785 "generally better tool than CVS. Since its initial release, it has rapidly "
1786 "grown in popularity."
1787 msgstr ""
1789 #. type: Content of: <book><chapter><sect1><para>
1790 #: ../en/ch01-intro.xml:186
1791 msgid ""
1792 "More or less simultaneously, Graydon Hoare began working on an ambitious "
1793 "distributed revision control system that he named Monotone. While Monotone "
1794 "addresses many of CVS's design flaws and has a peer-to-peer architecture, it "
1795 "goes beyond earlier (and subsequent) revision control tools in a number of "
1796 "innovative ways. It uses cryptographic hashes as identifiers, and has an "
1797 "integral notion of <quote>trust</quote> for code from different sources."
1798 msgstr ""
1800 #. type: Content of: <book><chapter><sect1><para>
1801 #: ../en/ch01-intro.xml:195
1802 msgid ""
1803 "Mercurial began life in 2005. While a few aspects of its design are "
1804 "influenced by Monotone, Mercurial focuses on ease of use, high performance, "
1805 "and scalability to very large projects."
1806 msgstr ""
1808 #. type: Content of: <book><chapter><sect1><title>
1809 #: ../en/ch01-intro.xml:202
1810 msgid "Trends in revision control"
1811 msgstr "版本控制的发展趋势"
1813 #. type: Content of: <book><chapter><sect1><para>
1814 #: ../en/ch01-intro.xml:204
1815 msgid ""
1816 "There has been an unmistakable trend in the development and use of revision "
1817 "control tools over the past four decades, as people have become familiar with "
1818 "the capabilities of their tools and constrained by their limitations."
1819 msgstr ""
1821 #. type: Content of: <book><chapter><sect1><para>
1822 #: ../en/ch01-intro.xml:209
1823 msgid ""
1824 "The first generation began by managing single files on individual computers. "
1825 "Although these tools represented a huge advance over ad-hoc manual revision "
1826 "control, their locking model and reliance on a single computer limited them "
1827 "to small, tightly-knit teams."
1828 msgstr ""
1830 #. type: Content of: <book><chapter><sect1><para>
1831 #: ../en/ch01-intro.xml:215
1832 msgid ""
1833 "The second generation loosened these constraints by moving to network-"
1834 "centered architectures, and managing entire projects at a time. As projects "
1835 "grew larger, they ran into new problems. With clients needing to talk to "
1836 "servers very frequently, server scaling became an issue for large projects. "
1837 "An unreliable network connection could prevent remote users from being able "
1838 "to talk to the server at all. As open source projects started making read-"
1839 "only access available anonymously to anyone, people without commit privileges "
1840 "found that they could not use the tools to interact with a project in a "
1841 "natural way, as they could not record their changes."
1842 msgstr ""
1844 #. type: Content of: <book><chapter><sect1><para>
1845 #: ../en/ch01-intro.xml:227
1846 msgid ""
1847 "The current generation of revision control tools is peer-to-peer in nature. "
1848 "All of these systems have dropped the dependency on a single central server, "
1849 "and allow people to distribute their revision control data to where it's "
1850 "actually needed. Collaboration over the Internet has moved from constrained "
1851 "by technology to a matter of choice and consensus. Modern tools can operate "
1852 "offline indefinitely and autonomously, with a network connection only needed "
1853 "when syncing changes with another repository."
1854 msgstr ""
1856 #. type: Content of: <book><chapter><sect1><title>
1857 #: ../en/ch01-intro.xml:239
1858 msgid "A few of the advantages of distributed revision control"
1859 msgstr "分布版本控制的优点"
1861 #. type: Content of: <book><chapter><sect1><para>
1862 #: ../en/ch01-intro.xml:242
1863 msgid ""
1864 "Even though distributed revision control tools have for several years been as "
1865 "robust and usable as their previous-generation counterparts, people using "
1866 "older tools have not yet necessarily woken up to their advantages. There are "
1867 "a number of ways in which distributed tools shine relative to centralised "
1868 "ones."
1869 msgstr ""
1871 #. type: Content of: <book><chapter><sect1><para>
1872 #: ../en/ch01-intro.xml:249
1873 msgid ""
1874 "For an individual developer, distributed tools are almost always much faster "
1875 "than centralised tools. This is for a simple reason: a centralised tool "
1876 "needs to talk over the network for many common operations, because most "
1877 "metadata is stored in a single copy on the central server. A distributed "
1878 "tool stores all of its metadata locally. All else being equal, talking over "
1879 "the network adds overhead to a centralised tool. Don't underestimate the "
1880 "value of a snappy, responsive tool: you're going to spend a lot of time "
1881 "interacting with your revision control software."
1882 msgstr ""
1884 #. type: Content of: <book><chapter><sect1><para>
1885 #: ../en/ch01-intro.xml:260
1886 msgid ""
1887 "Distributed tools are indifferent to the vagaries of your server "
1888 "infrastructure, again because they replicate metadata to so many locations. "
1889 "If you use a centralised system and your server catches fire, you'd better "
1890 "hope that your backup media are reliable, and that your last backup was "
1891 "recent and actually worked. With a distributed tool, you have many backups "
1892 "available on every contributor's computer."
1893 msgstr ""
1895 #. type: Content of: <book><chapter><sect1><para>
1896 #: ../en/ch01-intro.xml:268
1897 msgid ""
1898 "The reliability of your network will affect distributed tools far less than "
1899 "it will centralised tools. You can't even use a centralised tool without a "
1900 "network connection, except for a few highly constrained commands. With a "
1901 "distributed tool, if your network connection goes down while you're working, "
1902 "you may not even notice. The only thing you won't be able to do is talk to "
1903 "repositories on other computers, something that is relatively rare compared "
1904 "with local operations. If you have a far-flung team of collaborators, this "
1905 "may be significant."
1906 msgstr ""
1908 #. type: Content of: <book><chapter><sect1><sect2><title>
1909 #: ../en/ch01-intro.xml:279
1910 msgid "Advantages for open source projects"
1911 msgstr "开源项目的优点"
1913 #. type: Content of: <book><chapter><sect1><sect2><para>
1914 #: ../en/ch01-intro.xml:281
1915 msgid ""
1916 "If you take a shine to an open source project and decide that you would like "
1917 "to start hacking on it, and that project uses a distributed revision control "
1918 "tool, you are at once a peer with the people who consider themselves the "
1919 "<quote>core</quote> of that project. If they publish their repositories, you "
1920 "can immediately copy their project history, start making changes, and record "
1921 "your work, using the same tools in the same ways as insiders. By contrast, "
1922 "with a centralised tool, you must use the software in a <quote>read only</"
1923 "quote> mode unless someone grants you permission to commit changes to their "
1924 "central server. Until then, you won't be able to record changes, and your "
1925 "local modifications will be at risk of corruption any time you try to update "
1926 "your client's view of the repository."
1927 msgstr ""
1929 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
1930 #: ../en/ch01-intro.xml:297
1931 msgid "The forking non-problem"
1932 msgstr ""
1934 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
1935 #: ../en/ch01-intro.xml:299
1936 msgid ""
1937 "It has been suggested that distributed revision control tools pose some sort "
1938 "of risk to open source projects because they make it easy to <quote>fork</"
1939 "quote> the development of a project. A fork happens when there are "
1940 "differences in opinion or attitude between groups of developers that cause "
1941 "them to decide that they can't work together any longer. Each side takes a "
1942 "more or less complete copy of the project's source code, and goes off in its "
1943 "own direction."
1944 msgstr ""
1946 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
1947 #: ../en/ch01-intro.xml:309
1948 msgid ""
1949 "Sometimes the camps in a fork decide to reconcile their differences. With a "
1950 "centralised revision control system, the <emphasis>technical</emphasis> "
1951 "process of reconciliation is painful, and has to be performed largely by "
1952 "hand. You have to decide whose revision history is going to <quote>win</"
1953 "quote>, and graft the other team's changes into the tree somehow. This "
1954 "usually loses some or all of one side's revision history."
1955 msgstr ""
1957 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
1958 #: ../en/ch01-intro.xml:318
1959 msgid ""
1960 "What distributed tools do with respect to forking is they make forking the "
1961 "<emphasis>only</emphasis> way to develop a project. Every single change that "
1962 "you make is potentially a fork point. The great strength of this approach is "
1963 "that a distributed revision control tool has to be really good at "
1964 "<emphasis>merging</emphasis> forks, because forks are absolutely fundamental: "
1965 "they happen all the time."
1966 msgstr ""
1968 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
1969 #: ../en/ch01-intro.xml:327
1970 msgid ""
1971 "If every piece of work that everybody does, all the time, is framed in terms "
1972 "of forking and merging, then what the open source world refers to as a "
1973 "<quote>fork</quote> becomes <emphasis>purely</emphasis> a social issue. If "
1974 "anything, distributed tools <emphasis>lower</emphasis> the likelihood of a "
1975 "fork:"
1976 msgstr ""
1978 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
1979 #: ../en/ch01-intro.xml:334
1980 msgid ""
1981 "They eliminate the social distinction that centralised tools impose: that "
1982 "between insiders (people with commit access) and outsiders (people without)."
1983 msgstr ""
1985 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
1986 #: ../en/ch01-intro.xml:338
1987 msgid ""
1988 "They make it easier to reconcile after a social fork, because all that's "
1989 "involved from the perspective of the revision control software is just "
1990 "another merge."
1991 msgstr ""
1993 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
1994 #: ../en/ch01-intro.xml:343
1995 msgid ""
1996 "Some people resist distributed tools because they want to retain tight "
1997 "control over their projects, and they believe that centralised tools give "
1998 "them this control. However, if you're of this belief, and you publish your "
1999 "CVS or Subversion repositories publicly, there are plenty of tools available "
2000 "that can pull out your entire project's history (albeit slowly) and recreate "
2001 "it somewhere that you don't control. So while your control in this case is "
2002 "illusory, you are forgoing the ability to fluidly collaborate with whatever "
2003 "people feel compelled to mirror and fork your history."
2004 msgstr ""
2006 #. type: Content of: <book><chapter><sect1><sect2><title>
2007 #: ../en/ch01-intro.xml:358
2008 msgid "Advantages for commercial projects"
2009 msgstr "商业项目的优点"
2011 #. type: Content of: <book><chapter><sect1><sect2><para>
2012 #: ../en/ch01-intro.xml:360
2013 msgid ""
2014 "Many commercial projects are undertaken by teams that are scattered across "
2015 "the globe. Contributors who are far from a central server will see slower "
2016 "command execution and perhaps less reliability. Commercial revision control "
2017 "systems attempt to ameliorate these problems with remote-site replication add-"
2018 "ons that are typically expensive to buy and cantankerous to administer. A "
2019 "distributed system doesn't suffer from these problems in the first place. "
2020 "Better yet, you can easily set up multiple authoritative servers, say one per "
2021 "site, so that there's no redundant communication between repositories over "
2022 "expensive long-haul network links."
2023 msgstr ""
2025 #. type: Content of: <book><chapter><sect1><sect2><para>
2026 #: ../en/ch01-intro.xml:372
2027 msgid ""
2028 "Centralised revision control systems tend to have relatively low "
2029 "scalability. It's not unusual for an expensive centralised system to fall "
2030 "over under the combined load of just a few dozen concurrent users. Once "
2031 "again, the typical response tends to be an expensive and clunky replication "
2032 "facility. Since the load on a central server---if you have one at all---is "
2033 "many times lower with a distributed tool (because all of the data is "
2034 "replicated everywhere), a single cheap server can handle the needs of a much "
2035 "larger team, and replication to balance load becomes a simple matter of "
2036 "scripting."
2037 msgstr ""
2039 #. type: Content of: <book><chapter><sect1><sect2><para>
2040 #: ../en/ch01-intro.xml:384
2041 msgid ""
2042 "If you have an employee in the field, troubleshooting a problem at a "
2043 "customer's site, they'll benefit from distributed revision control. The tool "
2044 "will let them generate custom builds, try different fixes in isolation from "
2045 "each other, and search efficiently through history for the sources of bugs "
2046 "and regressions in the customer's environment, all without needing to connect "
2047 "to your company's network."
2048 msgstr ""
2050 #. type: Content of: <book><chapter><sect1><title>
2051 #: ../en/ch01-intro.xml:395
2052 msgid "Why choose Mercurial?"
2053 msgstr "为什么选择 Mercurial?"
2055 #. type: Content of: <book><chapter><sect1><para>
2056 #: ../en/ch01-intro.xml:397
2057 msgid ""
2058 "Mercurial has a unique set of properties that make it a particularly good "
2059 "choice as a revision control system."
2060 msgstr ""
2062 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
2063 #: ../en/ch01-intro.xml:400
2064 msgid "It is easy to learn and use."
2065 msgstr ""
2067 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
2068 #: ../en/ch01-intro.xml:401
2069 msgid "It is lightweight."
2070 msgstr ""
2072 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
2073 #: ../en/ch01-intro.xml:402
2074 msgid "It scales excellently."
2075 msgstr ""
2077 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
2078 #: ../en/ch01-intro.xml:403
2079 msgid "It is easy to customise."
2080 msgstr ""
2082 #. type: Content of: <book><chapter><sect1><para>
2083 #: ../en/ch01-intro.xml:406
2084 msgid ""
2085 "If you are at all familiar with revision control systems, you should be able "
2086 "to get up and running with Mercurial in less than five minutes. Even if not, "
2087 "it will take no more than a few minutes longer. Mercurial's command and "
2088 "feature sets are generally uniform and consistent, so you can keep track of a "
2089 "few general rules instead of a host of exceptions."
2090 msgstr ""
2092 #. type: Content of: <book><chapter><sect1><para>
2093 #: ../en/ch01-intro.xml:413
2094 msgid ""
2095 "On a small project, you can start working with Mercurial in moments. Creating "
2096 "new changes and branches; transferring changes around (whether locally or "
2097 "over a network); and history and status operations are all fast. Mercurial "
2098 "attempts to stay nimble and largely out of your way by combining low "
2099 "cognitive overhead with blazingly fast operations."
2100 msgstr ""
2102 #. type: Content of: <book><chapter><sect1><para>
2103 #: ../en/ch01-intro.xml:420
2104 msgid ""
2105 "The usefulness of Mercurial is not limited to small projects: it is used by "
2106 "projects with hundreds to thousands of contributors, each containing tens of "
2107 "thousands of files and hundreds of megabytes of source code."
2108 msgstr ""
2110 #. type: Content of: <book><chapter><sect1><para>
2111 #: ../en/ch01-intro.xml:425
2112 msgid ""
2113 "If the core functionality of Mercurial is not enough for you, it's easy to "
2114 "build on. Mercurial is well suited to scripting tasks, and its clean "
2115 "internals and implementation in Python make it easy to add features in the "
2116 "form of extensions. There are a number of popular and useful extensions "
2117 "already available, ranging from helping to identify bugs to improving "
2118 "performance."
2119 msgstr ""
2121 #. type: Content of: <book><chapter><sect1><title>
2122 #: ../en/ch01-intro.xml:435
2123 msgid "Mercurial compared with other tools"
2124 msgstr "Mercurial 与其它工具的比较"
2126 #. type: Content of: <book><chapter><sect1><para>
2127 #: ../en/ch01-intro.xml:437
2128 msgid ""
2129 "Before you read on, please understand that this section necessarily reflects "
2130 "my own experiences, interests, and (dare I say it) biases. I have used every "
2131 "one of the revision control tools listed below, in most cases for several "
2132 "years at a time."
2133 msgstr ""
2135 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
2136 #: ../en/ch01-intro.xml:445 ../en/ch01-intro.xml:656
2137 msgid "Subversion"
2138 msgstr ""
2140 #. type: Content of: <book><chapter><sect1><sect2><para>
2141 #: ../en/ch01-intro.xml:447
2142 msgid ""
2143 "Subversion is a popular revision control tool, developed to replace CVS. It "
2144 "has a centralised client/server architecture."
2145 msgstr ""
2147 #. type: Content of: <book><chapter><sect1><sect2><para>
2148 #: ../en/ch01-intro.xml:451
2149 msgid ""
2150 "Subversion and Mercurial have similarly named commands for performing the "
2151 "same operations, so if you're familiar with one, it is easy to learn to use "
2152 "the other. Both tools are portable to all popular operating systems."
2153 msgstr ""
2155 #. type: Content of: <book><chapter><sect1><sect2><para>
2156 #: ../en/ch01-intro.xml:456
2157 msgid ""
2158 "Prior to version 1.5, Subversion had no useful support for merges. At the "
2159 "time of writing, its merge tracking capability is new, and known to be <ulink "
2160 "url=\"http://svnbook.red-bean.com/nightly/en/svn.branchmerge.advanced."
2161 "html#svn.branchmerge.advanced.finalword\">complicated and buggy</ulink>."
2162 msgstr ""
2164 #. type: Content of: <book><chapter><sect1><sect2><para>
2165 #: ../en/ch01-intro.xml:462
2166 msgid ""
2167 "Mercurial has a substantial performance advantage over Subversion on every "
2168 "revision control operation I have benchmarked. I have measured its advantage "
2169 "as ranging from a factor of two to a factor of six when compared with "
2170 "Subversion 1.4.3's <emphasis>ra_local</emphasis> file store, which is the "
2171 "fastest access method available. In more realistic deployments involving a "
2172 "network-based store, Subversion will be at a substantially larger "
2173 "disadvantage. Because many Subversion commands must talk to the server and "
2174 "Subversion does not have useful replication facilities, server capacity and "
2175 "network bandwidth become bottlenecks for modestly large projects."
2176 msgstr ""
2178 #. type: Content of: <book><chapter><sect1><sect2><para>
2179 #: ../en/ch01-intro.xml:475
2180 msgid ""
2181 "Additionally, Subversion incurs substantial storage overhead to avoid network "
2182 "transactions for a few common operations, such as finding modified files "
2183 "(<literal>status</literal>) and displaying modifications against the current "
2184 "revision (<literal>diff</literal>). As a result, a Subversion working copy "
2185 "is often the same size as, or larger than, a Mercurial repository and working "
2186 "directory, even though the Mercurial repository contains a complete history "
2187 "of the project."
2188 msgstr ""
2190 #. type: Content of: <book><chapter><sect1><sect2><para>
2191 #: ../en/ch01-intro.xml:485
2192 msgid ""
2193 "Subversion is widely supported by third party tools. Mercurial currently "
2194 "lags considerably in this area. This gap is closing, however, and indeed "
2195 "some of Mercurial's GUI tools now outshine their Subversion equivalents. "
2196 "Like Mercurial, Subversion has an excellent user manual."
2197 msgstr ""
2199 #. type: Content of: <book><chapter><sect1><sect2><para>
2200 #: ../en/ch01-intro.xml:491
2201 msgid ""
2202 "Because Subversion doesn't store revision history on the client, it is well "
2203 "suited to managing projects that deal with lots of large, opaque binary "
2204 "files. If you check in fifty revisions to an incompressible 10MB file, "
2205 "Subversion's client-side space usage stays constant The space used by any "
2206 "distributed SCM will grow rapidly in proportion to the number of revisions, "
2207 "because the differences between each revision are large."
2208 msgstr ""
2210 #. type: Content of: <book><chapter><sect1><sect2><para>
2211 #: ../en/ch01-intro.xml:500
2212 msgid ""
2213 "In addition, it's often difficult or, more usually, impossible to merge "
2214 "different versions of a binary file. Subversion's ability to let a user lock "
2215 "a file, so that they temporarily have the exclusive right to commit changes "
2216 "to it, can be a significant advantage to a project where binary files are "
2217 "widely used."
2218 msgstr ""
2220 #. type: Content of: <book><chapter><sect1><sect2><para>
2221 #: ../en/ch01-intro.xml:507
2222 msgid ""
2223 "Mercurial can import revision history from a Subversion repository. It can "
2224 "also export revision history to a Subversion repository. This makes it easy "
2225 "to <quote>test the waters</quote> and use Mercurial and Subversion in "
2226 "parallel before deciding to switch. History conversion is incremental, so "
2227 "you can perform an initial conversion, then small additional conversions "
2228 "afterwards to bring in new changes."
2229 msgstr ""
2231 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
2232 #: ../en/ch01-intro.xml:519 ../en/ch01-intro.xml:658
2233 msgid "Git"
2234 msgstr ""
2236 #. type: Content of: <book><chapter><sect1><sect2><para>
2237 #: ../en/ch01-intro.xml:521
2238 msgid ""
2239 "Git is a distributed revision control tool that was developed for managing "
2240 "the Linux kernel source tree. Like Mercurial, its early design was somewhat "
2241 "influenced by Monotone."
2242 msgstr ""
2244 #. type: Content of: <book><chapter><sect1><sect2><para>
2245 #: ../en/ch01-intro.xml:526
2246 msgid ""
2247 "Git has a very large command set, with version 1.5.0 providing 139 individual "
2248 "commands. It has something of a reputation for being difficult to learn. "
2249 "Compared to Git, Mercurial has a strong focus on simplicity."
2250 msgstr ""
2252 #. type: Content of: <book><chapter><sect1><sect2><para>
2253 #: ../en/ch01-intro.xml:531
2254 msgid ""
2255 "In terms of performance, Git is extremely fast. In several cases, it is "
2256 "faster than Mercurial, at least on Linux, while Mercurial performs better on "
2257 "other operations. However, on Windows, the performance and general level of "
2258 "support that Git provides is, at the time of writing, far behind that of "
2259 "Mercurial."
2260 msgstr ""
2262 #. type: Content of: <book><chapter><sect1><sect2><para>
2263 #: ../en/ch01-intro.xml:538
2264 msgid ""
2265 "While a Mercurial repository needs no maintenance, a Git repository requires "
2266 "frequent manual <quote>repacks</quote> of its metadata. Without these, "
2267 "performance degrades, while space usage grows rapidly. A server that "
2268 "contains many Git repositories that are not rigorously and frequently "
2269 "repacked will become heavily disk-bound during backups, and there have been "
2270 "instances of daily backups taking far longer than 24 hours as a result. A "
2271 "freshly packed Git repository is slightly smaller than a Mercurial "
2272 "repository, but an unpacked repository is several orders of magnitude larger."
2273 msgstr ""
2275 #. type: Content of: <book><chapter><sect1><sect2><para>
2276 #: ../en/ch01-intro.xml:549
2277 msgid ""
2278 "The core of Git is written in C. Many Git commands are implemented as shell "
2279 "or Perl scripts, and the quality of these scripts varies widely. I have "
2280 "encountered several instances where scripts charged along blindly in the "
2281 "presence of errors that should have been fatal."
2282 msgstr ""
2284 #. type: Content of: <book><chapter><sect1><sect2><para>
2285 #: ../en/ch01-intro.xml:555
2286 msgid "Mercurial can import revision history from a Git repository."
2287 msgstr ""
2289 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
2290 #: ../en/ch01-intro.xml:561 ../en/ch01-intro.xml:657
2291 msgid "CVS"
2292 msgstr ""
2294 #. type: Content of: <book><chapter><sect1><sect2><para>
2295 #: ../en/ch01-intro.xml:563
2296 msgid ""
2297 "CVS is probably the most widely used revision control tool in the world. Due "
2298 "to its age and internal untidiness, it has been only lightly maintained for "
2299 "many years."
2300 msgstr ""
2302 #. type: Content of: <book><chapter><sect1><sect2><para>
2303 #: ../en/ch01-intro.xml:567
2304 msgid ""
2305 "It has a centralised client/server architecture. It does not group related "
2306 "file changes into atomic commits, making it easy for people to <quote>break "
2307 "the build</quote>: one person can successfully commit part of a change and "
2308 "then be blocked by the need for a merge, causing other people to see only a "
2309 "portion of the work they intended to do. This also affects how you work with "
2310 "project history. If you want to see all of the modifications someone made as "
2311 "part of a task, you will need to manually inspect the descriptions and "
2312 "timestamps of the changes made to each file involved (if you even know what "
2313 "those files were)."
2314 msgstr ""
2316 #. type: Content of: <book><chapter><sect1><sect2><para>
2317 #: ../en/ch01-intro.xml:579
2318 msgid ""
2319 "CVS has a muddled notion of tags and branches that I will not attempt to even "
2320 "describe. It does not support renaming of files or directories well, making "
2321 "it easy to corrupt a repository. It has almost no internal consistency "
2322 "checking capabilities, so it is usually not even possible to tell whether or "
2323 "how a repository is corrupt. I would not recommend CVS for any project, "
2324 "existing or new."
2325 msgstr ""
2327 #. type: Content of: <book><chapter><sect1><sect2><para>
2328 #: ../en/ch01-intro.xml:587
2329 msgid ""
2330 "Mercurial can import CVS revision history. However, there are a few caveats "
2331 "that apply; these are true of every other revision control tool's CVS "
2332 "importer, too. Due to CVS's lack of atomic changes and unversioned "
2333 "filesystem hierarchy, it is not possible to reconstruct CVS history "
2334 "completely accurately; some guesswork is involved, and renames will usually "
2335 "not show up. Because a lot of advanced CVS administration has to be done by "
2336 "hand and is hence error-prone, it's common for CVS importers to run into "
2337 "multiple problems with corrupted repositories (completely bogus revision "
2338 "timestamps and files that have remained locked for over a decade are just two "
2339 "of the less interesting problems I can recall from personal experience)."
2340 msgstr ""
2342 #. type: Content of: <book><chapter><sect1><sect2><para>
2343 #: ../en/ch01-intro.xml:601
2344 msgid "Mercurial can import revision history from a CVS repository."
2345 msgstr ""
2347 #. type: Content of: <book><chapter><sect1><sect2><title>
2348 #: ../en/ch01-intro.xml:607
2349 msgid "Commercial tools"
2350 msgstr "商业工具"
2352 #. type: Content of: <book><chapter><sect1><sect2><para>
2353 #: ../en/ch01-intro.xml:609
2354 msgid ""
2355 "Perforce has a centralised client/server architecture, with no client-side "
2356 "caching of any data. Unlike modern revision control tools, Perforce requires "
2357 "that a user run a command to inform the server about every file they intend "
2358 "to edit."
2359 msgstr ""
2361 #. type: Content of: <book><chapter><sect1><sect2><para>
2362 #: ../en/ch01-intro.xml:615
2363 msgid ""
2364 "The performance of Perforce is quite good for small teams, but it falls off "
2365 "rapidly as the number of users grows beyond a few dozen. Modestly large "
2366 "Perforce installations require the deployment of proxies to cope with the "
2367 "load their users generate."
2368 msgstr ""
2370 #. type: Content of: <book><chapter><sect1><sect2><title>
2371 #: ../en/ch01-intro.xml:624
2372 msgid "Choosing a revision control tool"
2373 msgstr "选择版本控制工具"
2375 #. type: Content of: <book><chapter><sect1><sect2><para>
2376 #: ../en/ch01-intro.xml:626
2377 msgid ""
2378 "With the exception of CVS, all of the tools listed above have unique "
2379 "strengths that suit them to particular styles of work. There is no single "
2380 "revision control tool that is best in all situations."
2381 msgstr ""
2383 #. type: Content of: <book><chapter><sect1><sect2><para>
2384 #: ../en/ch01-intro.xml:631
2385 msgid ""
2386 "As an example, Subversion is a good choice for working with frequently edited "
2387 "binary files, due to its centralised nature and support for file locking."
2388 msgstr ""
2390 #. type: Content of: <book><chapter><sect1><sect2><para>
2391 #: ../en/ch01-intro.xml:635
2392 msgid ""
2393 "I personally find Mercurial's properties of simplicity, performance, and good "
2394 "merge support to be a compelling combination that has served me well for "
2395 "several years."
2396 msgstr ""
2398 #. type: Content of: <book><chapter><sect1><title>
2399 #: ../en/ch01-intro.xml:643
2400 msgid "Switching from another tool to Mercurial"
2401 msgstr "从其它工具切换到 Mercurial"
2403 #. type: Content of: <book><chapter><sect1><para>
2404 #: ../en/ch01-intro.xml:645
2405 msgid ""
2406 "Mercurial is bundled with an extension named <literal role=\"hg-ext"
2407 "\">convert</literal>, which can incrementally import revision history from "
2408 "several other revision control tools. By <quote>incremental</quote>, I mean "
2409 "that you can convert all of a project's history to date in one go, then rerun "
2410 "the conversion later to obtain new changes that happened after the initial "
2411 "conversion."
2412 msgstr ""
2414 #. type: Content of: <book><chapter><sect1><para>
2415 #: ../en/ch01-intro.xml:653
2416 msgid ""
2417 "The revision control tools supported by <literal role=\"hg-ext\">convert</"
2418 "literal> are as follows:"
2419 msgstr ""
2421 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
2422 #: ../en/ch01-intro.xml:659
2423 msgid "Darcs"
2424 msgstr ""
2426 #. type: Content of: <book><chapter><sect1><para>
2427 #: ../en/ch01-intro.xml:661
2428 msgid ""
2429 "In addition, <literal role=\"hg-ext\">convert</literal> can export changes "
2430 "from Mercurial to Subversion. This makes it possible to try Subversion and "
2431 "Mercurial in parallel before committing to a switchover, without risking the "
2432 "loss of any work."
2433 msgstr ""
2435 #. type: Content of: <book><chapter><sect1><para>
2436 #: ../en/ch01-intro.xml:667
2437 msgid ""
2438 "The <command role=\"hg-ext-conver\">convert</command> command is easy to "
2439 "use. Simply point it at the path or URL of the source repository, optionally "
2440 "give it the name of the destination repository, and it will start working. "
2441 "After the initial conversion, just run the same command again to import new "
2442 "changes."
2443 msgstr ""
2445 #. type: Content of: <book><chapter><title>
2446 #: ../en/ch02-tour-basic.xml:5
2447 msgid "A tour of Mercurial: the basics"
2448 msgstr "Mercurial 教程: 基础知识"
2450 #. type: Content of: <book><chapter><sect1><title>
2451 #: ../en/ch02-tour-basic.xml:8
2452 msgid "Installing Mercurial on your system"
2453 msgstr "安装 Mercurial"
2455 #. type: Content of: <book><chapter><sect1><para>
2456 #: ../en/ch02-tour-basic.xml:10
2457 msgid ""
2458 "Prebuilt binary packages of Mercurial are available for every popular "
2459 "operating system. These make it easy to start using Mercurial on your "
2460 "computer immediately."
2461 msgstr ""
2462 "对于每种流行的操作系统,都有已经构建的二进制软件包。这让在你的计算机上开始使"
2463 "用 Mercurial 变得很容易。"
2465 #. type: Content of: <book><chapter><sect1><sect2><title>
2466 #: ../en/ch02-tour-basic.xml:15
2467 msgid "Linux"
2468 msgstr "Linux"
2470 #. type: Content of: <book><chapter><sect1><sect2><para>
2471 #: ../en/ch02-tour-basic.xml:17
2472 msgid ""
2473 "Because each Linux distribution has its own packaging tools, policies, and "
2474 "rate of development, it's difficult to give a comprehensive set of "
2475 "instructions on how to install Mercurial binaries. The version of Mercurial "
2476 "that you will end up with can vary depending on how active the person is who "
2477 "maintains the package for your distribution."
2478 msgstr ""
2479 "由于每种 Linux 发行版都有自己的包管理工具,开发策略和进度,从而很难给出安装 "
2480 "Mercurial 二进制包的全面说明。你安装的 Mercurial 版本,在很大程度上依赖于你所"
2481 "使用的发行版的 Mercurial 维护者的活跃程度。"
2483 #. type: Content of: <book><chapter><sect1><sect2><para>
2484 #: ../en/ch02-tour-basic.xml:24
2485 msgid ""
2486 "To keep things simple, I will focus on installing Mercurial from the command "
2487 "line under the most popular Linux distributions. Most of these distributions "
2488 "provide graphical package managers that will let you install Mercurial with a "
2489 "single click; the package name to look for is <literal>mercurial</literal>."
2490 msgstr ""
2491 "为了让事情简单,我会致力于说明在最流行的 Linux 发行版中,从命令行安装 "
2492 "Mercurial 的方法。这些发行版都提供了图形界面的包管理器,让你通过点击鼠标安装 "
2493 "Mercurial;寻找的包名称是 <literal>mercurial</literal>。"
2495 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
2496 #: ../en/ch02-tour-basic.xml:32
2497 msgid "Debian:"
2498 msgstr "Debian:"
2500 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
2501 #: ../en/ch02-tour-basic.xml:34
2502 msgid "Fedora Core:"
2503 msgstr "Fedora Core:"
2505 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
2506 #: ../en/ch02-tour-basic.xml:36
2507 msgid "Gentoo:"
2508 msgstr "Gentoo:"
2510 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
2511 #: ../en/ch02-tour-basic.xml:38
2512 msgid "OpenSUSE:"
2513 msgstr "OpenSUSE:"
2515 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
2516 #: ../en/ch02-tour-basic.xml:40
2517 msgid ""
2518 "Ubuntu: Ubuntu's Mercurial package is based on Debian's. To install it, run "
2519 "the following command."
2520 msgstr "Ubuntu: Ubuntu 的 Mercurial 包基于 Debian。安装时,使用如下命令:"
2522 #. type: Content of: <book><chapter><sect1><sect2><title>
2523 #: ../en/ch02-tour-basic.xml:48
2524 msgid "Solaris"
2525 msgstr "Solaris"
2527 #. type: Content of: <book><chapter><sect1><sect2><para>
2528 #: ../en/ch02-tour-basic.xml:50
2529 msgid ""
2530 "SunFreeWare, at <ulink url=\"http://www.sunfreeware.com\">http://www."
2531 "sunfreeware.com</ulink>, is a good source for a large number of pre-built "
2532 "Solaris packages for 32 and 64 bit Intel and Sparc architectures, including "
2533 "current versions of Mercurial."
2534 msgstr ""
2535 "位于 <ulink url=\"http://www.sunfreeware.com\">http://www.sunfreeware.com</"
2536 "ulink> 的 SunFreeWare 是很好的二进制安装源,它包含 Intel 和 Sparc 架构的 32 位"
2537 "和 64 位包,包含 Mercurial 的当前版本。"
2539 #. type: Content of: <book><chapter><sect1><sect2><title>
2540 #: ../en/ch02-tour-basic.xml:58
2541 msgid "Mac OS X"
2542 msgstr "Mac OS X"
2544 #. type: Content of: <book><chapter><sect1><sect2><para>
2545 #: ../en/ch02-tour-basic.xml:60
2546 msgid ""
2547 "Lee Cantey publishes an installer of Mercurial for Mac OS X at <ulink url="
2548 "\"http://mercurial.berkwood.com\">http://mercurial.berkwood.com</ulink>. "
2549 "This package works on both Intel- and Power-based Macs. Before you can use "
2550 "it, you must install a compatible version of Universal MacPython "
2551 "<citation>web:macpython</citation>. This is easy to do; simply follow the "
2552 "instructions on Lee's site."
2553 msgstr ""
2555 #. type: Content of: <book><chapter><sect1><sect2><para>
2556 #: ../en/ch02-tour-basic.xml:69
2557 msgid ""
2558 "It's also possible to install Mercurial using Fink or MacPorts, two popular "
2559 "free package managers for Mac OS X. If you have Fink, use <command>sudo apt-"
2560 "get install mercurial-py25</command>. If MacPorts, <command>sudo port "
2561 "install mercurial</command>."
2562 msgstr ""
2564 #. type: Content of: <book><chapter><sect1><sect2><title>
2565 #: ../en/ch02-tour-basic.xml:77
2566 msgid "Windows"
2567 msgstr ""
2569 #. type: Content of: <book><chapter><sect1><sect2><para>
2570 #: ../en/ch02-tour-basic.xml:79
2571 msgid ""
2572 "Lee Cantey publishes an installer of Mercurial for Windows at <ulink url="
2573 "\"http://mercurial.berkwood.com\">http://mercurial.berkwood.com</ulink>. "
2574 "This package has no external dependencies; it <quote>just works</quote>."
2575 msgstr ""
2577 #. type: Content of: <book><chapter><sect1><sect2><note><para>
2578 #: ../en/ch02-tour-basic.xml:86
2579 msgid ""
2580 "The Windows version of Mercurial does not automatically convert line endings "
2581 "between Windows and Unix styles. If you want to share work with Unix users, "
2582 "you must do a little additional configuration work. XXX Flesh this out."
2583 msgstr ""
2585 #. type: Content of: <book><chapter><sect1><title>
2586 #: ../en/ch02-tour-basic.xml:96
2587 msgid "Getting started"
2588 msgstr "开始"
2590 #. type: Content of: <book><chapter><sect1><para>
2591 #: ../en/ch02-tour-basic.xml:98
2592 msgid ""
2593 "To begin, we'll use the <command role=\"hg-cmd\">hg version</command> command "
2594 "to find out whether Mercurial is actually installed properly. The actual "
2595 "version information that it prints isn't so important; it's whether it prints "
2596 "anything at all that we care about."
2597 msgstr ""
2599 #. type: Content of: <book><chapter><sect1><sect2><title>
2600 #: ../en/ch02-tour-basic.xml:107
2601 msgid "Built-in help"
2602 msgstr "内置帮助"
2604 #. type: Content of: <book><chapter><sect1><sect2><para>
2605 #: ../en/ch02-tour-basic.xml:109
2606 msgid ""
2607 "Mercurial provides a built-in help system. This is invaluable for those "
2608 "times when you find yourself stuck trying to remember how to run a command. "
2609 "If you are completely stuck, simply run <command role=\"hg-cmd\">hg help</"
2610 "command>; it will print a brief list of commands, along with a description of "
2611 "what each does. If you ask for help on a specific command (as below), it "
2612 "prints more detailed information."
2613 msgstr ""
2615 #. type: Content of: <book><chapter><sect1><sect2><para>
2616 #: ../en/ch02-tour-basic.xml:120
2617 msgid ""
2618 "For a more impressive level of detail (which you won't usually need) run "
2619 "<command role=\"hg-cmd\">hg help <option role=\"hg-opt-global\">-v</option></"
2620 "command>. The <option role=\"hg-opt-global\">-v</option> option is short for "
2621 "<option role=\"hg-opt-global\">--verbose</option>, and tells Mercurial to "
2622 "print more information than it usually would."
2623 msgstr ""
2625 #. type: Content of: <book><chapter><sect1><title>
2626 #: ../en/ch02-tour-basic.xml:131
2627 msgid "Working with a repository"
2628 msgstr "使用版本库"
2630 #. type: Content of: <book><chapter><sect1><para>
2631 #: ../en/ch02-tour-basic.xml:133
2632 msgid ""
2633 "In Mercurial, everything happens inside a <emphasis>repository</emphasis>. "
2634 "The repository for a project contains all of the files that <quote>belong to</"
2635 "quote> that project, along with a historical record of the project's files."
2636 msgstr ""
2638 #. type: Content of: <book><chapter><sect1><para>
2639 #: ../en/ch02-tour-basic.xml:139
2640 msgid ""
2641 "There's nothing particularly magical about a repository; it is simply a "
2642 "directory tree in your filesystem that Mercurial treats as special. You can "
2643 "rename or delete a repository any time you like, using either the command "
2644 "line or your file browser."
2645 msgstr ""
2647 #. type: Content of: <book><chapter><sect1><sect2><title>
2648 #: ../en/ch02-tour-basic.xml:146
2649 msgid "Making a local copy of a repository"
2650 msgstr "创建版本库的工作副本"
2652 #. type: Content of: <book><chapter><sect1><sect2><para>
2653 #: ../en/ch02-tour-basic.xml:148
2654 msgid ""
2655 "<emphasis>Copying</emphasis> a repository is just a little bit special. "
2656 "While you could use a normal file copying command to make a copy of a "
2657 "repository, it's best to use a built-in command that Mercurial provides. "
2658 "This command is called <command role=\"hg-cmd\">hg clone</command>, because "
2659 "it creates an identical copy of an existing repository."
2660 msgstr ""
2662 #. type: Content of: <book><chapter><sect1><sect2><para>
2663 #: ../en/ch02-tour-basic.xml:157
2664 msgid ""
2665 "If our clone succeeded, we should now have a local directory called <filename "
2666 "class=\"directory\">hello</filename>. This directory will contain some files."
2667 msgstr ""
2669 #. type: Content of: <book><chapter><sect1><sect2><para>
2670 #: ../en/ch02-tour-basic.xml:163
2671 msgid ""
2672 "These files have the same contents and history in our repository as they do "
2673 "in the repository we cloned."
2674 msgstr ""
2676 #. type: Content of: <book><chapter><sect1><sect2><para>
2677 #: ../en/ch02-tour-basic.xml:166
2678 msgid ""
2679 "Every Mercurial repository is complete, self-contained, and independent. It "
2680 "contains its own private copy of a project's files and history. A cloned "
2681 "repository remembers the location of the repository it was cloned from, but "
2682 "it does not communicate with that repository, or any other, unless you tell "
2683 "it to."
2684 msgstr ""
2686 #. type: Content of: <book><chapter><sect1><sect2><para>
2687 #: ../en/ch02-tour-basic.xml:173
2688 msgid ""
2689 "What this means for now is that we're free to experiment with our repository, "
2690 "safe in the knowledge that it's a private <quote>sandbox</quote> that won't "
2691 "affect anyone else."
2692 msgstr ""
2694 #. type: Content of: <book><chapter><sect1><sect2><title>
2695 #: ../en/ch02-tour-basic.xml:179
2696 msgid "What's in a repository?"
2697 msgstr "什么是版本库?"
2699 #. type: Content of: <book><chapter><sect1><sect2><para>
2700 #: ../en/ch02-tour-basic.xml:181
2701 msgid ""
2702 "When we take a more detailed look inside a repository, we can see that it "
2703 "contains a directory named <filename class=\"directory\">.hg</filename>. "
2704 "This is where Mercurial keeps all of its metadata for the repository."
2705 msgstr ""
2707 #. type: Content of: <book><chapter><sect1><sect2><para>
2708 #: ../en/ch02-tour-basic.xml:188
2709 msgid ""
2710 "The contents of the <filename class=\"directory\">.hg</filename> directory "
2711 "and its subdirectories are private to Mercurial. Every other file and "
2712 "directory in the repository is yours to do with as you please."
2713 msgstr ""
2715 #. type: Content of: <book><chapter><sect1><sect2><para>
2716 #: ../en/ch02-tour-basic.xml:194
2717 msgid ""
2718 "To introduce a little terminology, the <filename class=\"directory\">.hg</"
2719 "filename> directory is the <quote>real</quote> repository, and all of the "
2720 "files and directories that coexist with it are said to live in the "
2721 "<emphasis>working directory</emphasis>. An easy way to remember the "
2722 "distinction is that the <emphasis>repository</emphasis> contains the "
2723 "<emphasis>history</emphasis> of your project, while the <emphasis>working "
2724 "directory</emphasis> contains a <emphasis>snapshot</emphasis> of your project "
2725 "at a particular point in history."
2726 msgstr ""
2728 #. type: Content of: <book><chapter><sect1><title>
2729 #: ../en/ch02-tour-basic.xml:209
2730 msgid "A tour through history"
2731 msgstr "回溯历史"
2733 #. type: Content of: <book><chapter><sect1><para>
2734 #: ../en/ch02-tour-basic.xml:211
2735 msgid ""
2736 "One of the first things we might want to do with a new, unfamiliar repository "
2737 "is understand its history. The <command role=\"hg-cmd\">hg log</command> "
2738 "command gives us a view of history."
2739 msgstr ""
2741 #. type: Content of: <book><chapter><sect1><para>
2742 #: ../en/ch02-tour-basic.xml:218
2743 msgid ""
2744 "By default, this command prints a brief paragraph of output for each change "
2745 "to the project that was recorded. In Mercurial terminology, we call each of "
2746 "these recorded events a <emphasis>changeset</emphasis>, because it can "
2747 "contain a record of changes to several files."
2748 msgstr ""
2750 #. type: Content of: <book><chapter><sect1><para>
2751 #: ../en/ch02-tour-basic.xml:224
2752 msgid ""
2753 "The fields in a record of output from <command role=\"hg-cmd\">hg log</"
2754 "command> are as follows."
2755 msgstr ""
2757 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
2758 #: ../en/ch02-tour-basic.xml:227
2759 msgid ""
2760 "<literal>changeset</literal>: This field has the format of a number, followed "
2761 "by a colon, followed by a hexadecimal string. These are "
2762 "<emphasis>identifiers</emphasis> for the changeset. There are two "
2763 "identifiers because the number is shorter and easier to type than the hex "
2764 "string."
2765 msgstr ""
2767 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
2768 #: ../en/ch02-tour-basic.xml:233
2769 msgid ""
2770 "<literal>user</literal>: The identity of the person who created the "
2771 "changeset. This is a free-form field, but it most often contains a person's "
2772 "name and email address."
2773 msgstr ""
2775 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
2776 #: ../en/ch02-tour-basic.xml:237
2777 msgid ""
2778 "<literal>date</literal>: The date and time on which the changeset was "
2779 "created, and the timezone in which it was created. (The date and time are "
2780 "local to that timezone; they display what time and date it was for the person "
2781 "who created the changeset.)"
2782 msgstr ""
2784 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
2785 #: ../en/ch02-tour-basic.xml:242
2786 msgid ""
2787 "<literal>summary</literal>: The first line of the text message that the "
2788 "creator of the changeset entered to describe the changeset."
2789 msgstr ""
2791 #. type: Content of: <book><chapter><sect1><para>
2792 #: ../en/ch02-tour-basic.xml:245
2793 msgid ""
2794 "The default output printed by <command role=\"hg-cmd\">hg log</command> is "
2795 "purely a summary; it is missing a lot of detail."
2796 msgstr ""
2798 #. type: Content of: <book><chapter><sect1><para>
2799 #: ../en/ch02-tour-basic.xml:249
2800 msgid ""
2801 "Figure <xref endterm=\"fig.tour-basic.history.caption\" linkend=\"fig.tour-"
2802 "basic.history\"/> provides a graphical representation of the history of the "
2803 "<filename class=\"directory\">hello</filename> repository, to make it a "
2804 "little easier to see which direction history is <quote>flowing</quote> in. "
2805 "We'll be returning to this figure several times in this chapter and the "
2806 "chapter that follows."
2807 msgstr ""
2809 #. type: Content of: <book><chapter><sect1><informalfigure><mediaobject>
2810 #: ../en/ch02-tour-basic.xml:260
2811 msgid ""
2812 "<imageobject><imagedata fileref=\"images/tour-history.png\"/></imageobject>"
2813 msgstr ""
2815 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><textobject><phrase>
2816 #: ../en/ch02-tour-basic.xml:261 ../en/ch03-tour-merge.xml:48
2817 #: ../en/ch03-tour-merge.xml:78 ../en/ch03-tour-merge.xml:126
2818 #: ../en/ch03-tour-merge.xml:182 ../en/ch03-tour-merge.xml:254
2819 #: ../en/ch04-concepts.xml:56 ../en/ch04-concepts.xml:108
2820 #: ../en/ch04-concepts.xml:194 ../en/ch04-concepts.xml:301
2821 #: ../en/ch04-concepts.xml:353 ../en/ch04-concepts.xml:370
2822 #: ../en/ch04-concepts.xml:414 ../en/ch04-concepts.xml:436
2823 #: ../en/ch04-concepts.xml:480 ../en/ch06-collab.xml:277
2824 #: ../en/ch09-undo.xml:366 ../en/ch09-undo.xml:417 ../en/ch09-undo.xml:485
2825 #: ../en/ch09-undo.xml:527 ../en/ch12-mq.xml:409
2826 msgid "XXX add text"
2827 msgstr ""
2829 #. type: Content of: <book><chapter><sect1><informalfigure><mediaobject><caption><para>
2830 #: ../en/ch02-tour-basic.xml:262
2831 msgid ""
2832 "Graphical history of the <filename class=\"directory\">hello</filename> "
2833 "repository"
2834 msgstr ""
2836 #. type: Content of: <book><chapter><sect1><sect2><title>
2837 #: ../en/ch02-tour-basic.xml:269
2838 msgid "Changesets, revisions, and talking to other people"
2839 msgstr "改变集,版本,与其它用户交互"
2841 #. type: Content of: <book><chapter><sect1><sect2><para>
2842 #: ../en/ch02-tour-basic.xml:272
2843 msgid ""
2844 "As English is a notoriously sloppy language, and computer science has a "
2845 "hallowed history of terminological confusion (why use one term when four will "
2846 "do?), revision control has a variety of words and phrases that mean the same "
2847 "thing. If you are talking about Mercurial history with other people, you "
2848 "will find that the word <quote>changeset</quote> is often compressed to "
2849 "<quote>change</quote> or (when written) <quote>cset</quote>, and sometimes a "
2850 "changeset is referred to as a <quote>revision</quote> or a <quote>rev</quote>."
2851 msgstr ""
2853 #. type: Content of: <book><chapter><sect1><sect2><para>
2854 #: ../en/ch02-tour-basic.xml:282
2855 msgid ""
2856 "While it doesn't matter what <emphasis>word</emphasis> you use to refer to "
2857 "the concept of <quote>a changeset</quote>, the <emphasis>identifier</"
2858 "emphasis> that you use to refer to <quote>a <emphasis>specific</emphasis> "
2859 "changeset</quote> is of great importance. Recall that the <literal>changeset</"
2860 "literal> field in the output from <command role=\"hg-cmd\">hg log</command> "
2861 "identifies a changeset using both a number and a hexadecimal string."
2862 msgstr ""
2864 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
2865 #: ../en/ch02-tour-basic.xml:291
2866 msgid ""
2867 "The revision number is <emphasis>only valid in that repository</emphasis>,"
2868 msgstr ""
2870 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
2871 #: ../en/ch02-tour-basic.xml:293
2872 msgid ""
2873 "while the hex string is the <emphasis>permanent, unchanging identifier</"
2874 "emphasis> that will always identify that exact changeset in <emphasis>every</"
2875 "emphasis> copy of the repository."
2876 msgstr ""
2878 #. type: Content of: <book><chapter><sect1><sect2><para>
2879 #: ../en/ch02-tour-basic.xml:298
2880 msgid ""
2881 "This distinction is important. If you send someone an email talking about "
2882 "<quote>revision 33</quote>, there's a high likelihood that their revision 33 "
2883 "will <emphasis>not be the same</emphasis> as yours. The reason for this is "
2884 "that a revision number depends on the order in which changes arrived in a "
2885 "repository, and there is no guarantee that the same changes will happen in "
2886 "the same order in different repositories. Three changes $a,b,c$ can easily "
2887 "appear in one repository as $0,1,2$, while in another as $1,0,2$."
2888 msgstr ""
2890 #. type: Content of: <book><chapter><sect1><sect2><para>
2891 #: ../en/ch02-tour-basic.xml:308
2892 msgid ""
2893 "Mercurial uses revision numbers purely as a convenient shorthand. If you "
2894 "need to discuss a changeset with someone, or make a record of a changeset for "
2895 "some other reason (for example, in a bug report), use the hexadecimal "
2896 "identifier."
2897 msgstr ""
2899 #. type: Content of: <book><chapter><sect1><sect2><title>
2900 #: ../en/ch02-tour-basic.xml:316
2901 msgid "Viewing specific revisions"
2902 msgstr "察看指定版本"
2904 #. type: Content of: <book><chapter><sect1><sect2><para>
2905 #: ../en/ch02-tour-basic.xml:318
2906 msgid ""
2907 "To narrow the output of <command role=\"hg-cmd\">hg log</command> down to a "
2908 "single revision, use the <option role=\"hg-opt-log\">-r</option> (or <option "
2909 "role=\"hg-opt-log\">--rev</option>) option. You can use either a revision "
2910 "number or a long-form changeset identifier, and you can provide as many "
2911 "revisions as you want."
2912 msgstr ""
2914 #. type: Content of: <book><chapter><sect1><sect2><para>
2915 #: ../en/ch02-tour-basic.xml:327
2916 msgid ""
2917 "If you want to see the history of several revisions without having to list "
2918 "each one, you can use <emphasis>range notation</emphasis>; this lets you "
2919 "express the idea <quote>I want all revisions between <literal>abc</literal> "
2920 "and <literal>def</literal>, inclusive</quote>."
2921 msgstr ""
2923 #. type: Content of: <book><chapter><sect1><sect2><para>
2924 #: ../en/ch02-tour-basic.xml:335
2925 msgid ""
2926 "Mercurial also honours the order in which you specify revisions, so <command "
2927 "role=\"hg-cmd\">hg log -r 2:4</command> prints 2, 3, and 4. while <command "
2928 "role=\"hg-cmd\">hg log -r 4:2</command> prints 4, 3, and 2."
2929 msgstr ""
2931 #. type: Content of: <book><chapter><sect1><sect2><title>
2932 #: ../en/ch02-tour-basic.xml:342
2933 msgid "More detailed information"
2934 msgstr "更详细的信息"
2936 #. type: Content of: <book><chapter><sect1><sect2><para>
2937 #: ../en/ch02-tour-basic.xml:344
2938 msgid ""
2939 "While the summary information printed by <command role=\"hg-cmd\">hg log</"
2940 "command> is useful if you already know what you're looking for, you may need "
2941 "to see a complete description of the change, or a list of the files changed, "
2942 "if you're trying to decide whether a changeset is the one you're looking for. "
2943 "The <command role=\"hg-cmd\">hg log</command> command's <option role=\"hg-opt-"
2944 "global\">-v</option> (or <option role=\"hg-opt-global\">--verbose</option>) "
2945 "option gives you this extra detail."
2946 msgstr ""
2948 #. type: Content of: <book><chapter><sect1><sect2><para>
2949 #: ../en/ch02-tour-basic.xml:356
2950 msgid ""
2951 "If you want to see both the description and content of a change, add the "
2952 "<option role=\"hg-opt-log\">-p</option> (or <option role=\"hg-opt-log\">--"
2953 "patch</option>) option. This displays the content of a change as a "
2954 "<emphasis>unified diff</emphasis> (if you've never seen a unified diff "
2955 "before, see section <xref linkend=\"sec.mq.patch\"/> for an overview)."
2956 msgstr ""
2958 #. type: Content of: <book><chapter><sect1><title>
2959 #: ../en/ch02-tour-basic.xml:369
2960 msgid "All about command options"
2961 msgstr "命令选项"
2963 #. type: Content of: <book><chapter><sect1><para>
2964 #: ../en/ch02-tour-basic.xml:371
2965 msgid ""
2966 "Let's take a brief break from exploring Mercurial commands to discuss a "
2967 "pattern in the way that they work; you may find this useful to keep in mind "
2968 "as we continue our tour."
2969 msgstr ""
2971 #. type: Content of: <book><chapter><sect1><para>
2972 #: ../en/ch02-tour-basic.xml:375
2973 msgid ""
2974 "Mercurial has a consistent and straightforward approach to dealing with the "
2975 "options that you can pass to commands. It follows the conventions for "
2976 "options that are common to modern Linux and Unix systems."
2977 msgstr ""
2979 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
2980 #: ../en/ch02-tour-basic.xml:380
2981 msgid ""
2982 "Every option has a long name. For example, as we've already seen, the "
2983 "<command role=\"hg-cmd\">hg log</command> command accepts a <option role=\"hg-"
2984 "opt-log\">--rev</option> option."
2985 msgstr ""
2987 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
2988 #: ../en/ch02-tour-basic.xml:384
2989 msgid ""
2990 "Most options have short names, too. Instead of <option role=\"hg-opt-log\">--"
2991 "rev</option>, we can use <option role=\"hg-opt-log\">-r</option>. (The "
2992 "reason that some options don't have short names is that the options in "
2993 "question are rarely used.)"
2994 msgstr ""
2996 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
2997 #: ../en/ch02-tour-basic.xml:389
2998 msgid ""
2999 "Long options start with two dashes (e.g. <option role=\"hg-opt-log\">--rev</"
3000 "option>), while short options start with one (e.g. <option role=\"hg-opt-log"
3001 "\">-r</option>)."
3002 msgstr ""
3004 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
3005 #: ../en/ch02-tour-basic.xml:393
3006 msgid ""
3007 "Option naming and usage is consistent across commands. For example, every "
3008 "command that lets you specify a changeset ID or revision number accepts both "
3009 "<option role=\"hg-opt-log\">-r</option> and <option role=\"hg-opt-log\">--"
3010 "rev</option> arguments."
3011 msgstr ""
3013 #. type: Content of: <book><chapter><sect1><para>
3014 #: ../en/ch02-tour-basic.xml:399
3015 msgid ""
3016 "In the examples throughout this book, I use short options instead of long. "
3017 "This just reflects my own preference, so don't read anything significant into "
3018 "it."
3019 msgstr ""
3021 #. type: Content of: <book><chapter><sect1><para>
3022 #: ../en/ch02-tour-basic.xml:403
3023 msgid ""
3024 "Most commands that print output of some kind will print more output when "
3025 "passed a <option role=\"hg-opt-global\">-v</option> (or <option role=\"hg-opt-"
3026 "global\">--verbose</option>) option, and less when passed <option role=\"hg-"
3027 "opt-global\">-q</option> (or <option role=\"hg-opt-global\">--quiet</option>)."
3028 msgstr ""
3030 #. type: Content of: <book><chapter><sect1><title>
3031 #: ../en/ch02-tour-basic.xml:411
3032 msgid "Making and reviewing changes"
3033 msgstr "创建和复审修改"
3035 #. type: Content of: <book><chapter><sect1><para>
3036 #: ../en/ch02-tour-basic.xml:413
3037 msgid ""
3038 "Now that we have a grasp of viewing history in Mercurial, let's take a look "
3039 "at making some changes and examining them."
3040 msgstr ""
3042 #. type: Content of: <book><chapter><sect1><para>
3043 #: ../en/ch02-tour-basic.xml:417
3044 msgid ""
3045 "The first thing we'll do is isolate our experiment in a repository of its "
3046 "own. We use the <command role=\"hg-cmd\">hg clone</command> command, but we "
3047 "don't need to clone a copy of the remote repository. Since we already have a "
3048 "copy of it locally, we can just clone that instead. This is much faster than "
3049 "cloning over the network, and cloning a local repository uses less disk space "
3050 "in most cases, too."
3051 msgstr ""
3053 #. type: Content of: <book><chapter><sect1><para>
3054 #: ../en/ch02-tour-basic.xml:427
3055 msgid ""
3056 "As an aside, it's often good practice to keep a <quote>pristine</quote> copy "
3057 "of a remote repository around, which you can then make temporary clones of to "
3058 "create sandboxes for each task you want to work on. This lets you work on "
3059 "multiple tasks in parallel, each isolated from the others until it's complete "
3060 "and you're ready to integrate it back. Because local clones are so cheap, "
3061 "there's almost no overhead to cloning and destroying repositories whenever "
3062 "you want."
3063 msgstr ""
3065 #. type: Content of: <book><chapter><sect1><para>
3066 #: ../en/ch02-tour-basic.xml:436
3067 msgid ""
3068 "In our <filename class=\"directory\">my-hello</filename> repository, we have "
3069 "a file <filename>hello.c</filename> that contains the classic <quote>hello, "
3070 "world</quote> program. Let's use the ancient and venerable <command>sed</"
3071 "command> command to edit this file so that it prints a second line of "
3072 "output. (I'm only using <command>sed</command> to do this because it's easy "
3073 "to write a scripted example this way. Since you're not under the same "
3074 "constraint, you probably won't want to use <command>sed</command>; simply use "
3075 "your preferred text editor to do the same thing.)"
3076 msgstr ""
3078 #. type: Content of: <book><chapter><sect1><para>
3079 #: ../en/ch02-tour-basic.xml:449
3080 msgid ""
3081 "Mercurial's <command role=\"hg-cmd\">hg status</command> command will tell us "
3082 "what Mercurial knows about the files in the repository."
3083 msgstr ""
3085 #. type: Content of: <book><chapter><sect1><para>
3086 #: ../en/ch02-tour-basic.xml:455
3087 msgid ""
3088 "The <command role=\"hg-cmd\">hg status</command> command prints no output for "
3089 "some files, but a line starting with <quote><literal>M</literal></quote> for "
3090 "<filename>hello.c</filename>. Unless you tell it to, <command role=\"hg-cmd"
3091 "\">hg status</command> will not print any output for files that have not been "
3092 "modified."
3093 msgstr ""
3095 #. type: Content of: <book><chapter><sect1><para>
3096 #: ../en/ch02-tour-basic.xml:462
3097 msgid ""
3098 "The <quote><literal>M</literal></quote> indicates that Mercurial has noticed "
3099 "that we modified <filename>hello.c</filename>. We didn't need to "
3100 "<emphasis>inform</emphasis> Mercurial that we were going to modify the file "
3101 "before we started, or that we had modified the file after we were done; it "
3102 "was able to figure this out itself."
3103 msgstr ""
3105 #. type: Content of: <book><chapter><sect1><para>
3106 #: ../en/ch02-tour-basic.xml:470
3107 msgid ""
3108 "It's a little bit helpful to know that we've modified <filename>hello.c</"
3109 "filename>, but we might prefer to know exactly <emphasis>what</emphasis> "
3110 "changes we've made to it. To do this, we use the <command role=\"hg-cmd\">hg "
3111 "diff</command> command."
3112 msgstr ""
3114 #. type: Content of: <book><chapter><sect1><title>
3115 #: ../en/ch02-tour-basic.xml:480
3116 msgid "Recording changes in a new changeset"
3117 msgstr "在新修改集中记录修改"
3119 #. type: Content of: <book><chapter><sect1><para>
3120 #: ../en/ch02-tour-basic.xml:482
3121 msgid ""
3122 "We can modify files, build and test our changes, and use <command role=\"hg-"
3123 "cmd\">hg status</command> and <command role=\"hg-cmd\">hg diff</command> to "
3124 "review our changes, until we're satisfied with what we've done and arrive at "
3125 "a natural stopping point where we want to record our work in a new changeset."
3126 msgstr ""
3128 #. type: Content of: <book><chapter><sect1><para>
3129 #: ../en/ch02-tour-basic.xml:489
3130 msgid ""
3131 "The <command role=\"hg-cmd\">hg commit</command> command lets us create a new "
3132 "changeset; we'll usually refer to this as <quote>making a commit</quote> or "
3133 "<quote>committing</quote>."
3134 msgstr ""
3136 #. type: Content of: <book><chapter><sect1><sect2><title>
3137 #: ../en/ch02-tour-basic.xml:495
3138 msgid "Setting up a username"
3139 msgstr "配置用户名称"
3141 #. type: Content of: <book><chapter><sect1><sect2><para>
3142 #: ../en/ch02-tour-basic.xml:497
3143 msgid ""
3144 "When you try to run <command role=\"hg-cmd\">hg commit</command> for the "
3145 "first time, it is not guaranteed to succeed. Mercurial records your name and "
3146 "address with each change that you commit, so that you and others will later "
3147 "be able to tell who made each change. Mercurial tries to automatically "
3148 "figure out a sensible username to commit the change with. It will attempt "
3149 "each of the following methods, in order:"
3150 msgstr ""
3152 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
3153 #: ../en/ch02-tour-basic.xml:506
3154 msgid ""
3155 "If you specify a <option role=\"hg-opt-commit\">-u</option> option to the "
3156 "<command role=\"hg-cmd\">hg commit</command> command on the command line, "
3157 "followed by a username, this is always given the highest precedence."
3158 msgstr ""
3160 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
3161 #: ../en/ch02-tour-basic.xml:511
3162 msgid ""
3163 "If you have set the <envar>HGUSER</envar> environment variable, this is "
3164 "checked next."
3165 msgstr ""
3167 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
3168 #: ../en/ch02-tour-basic.xml:514
3169 msgid ""
3170 "If you create a file in your home directory called <filename role=\"special"
3171 "\">.hgrc</filename>, with a <envar role=\"rc-item-ui\">username</envar> "
3172 "entry, that will be used next. To see what the contents of this file should "
3173 "look like, refer to section <xref linkend=\"sec.tour-basic.username\"/> below."
3174 msgstr ""
3176 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
3177 #: ../en/ch02-tour-basic.xml:521
3178 msgid ""
3179 "If you have set the <envar>EMAIL</envar> environment variable, this will be "
3180 "used next."
3181 msgstr ""
3183 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
3184 #: ../en/ch02-tour-basic.xml:524
3185 msgid ""
3186 "Mercurial will query your system to find out your local user name and host "
3187 "name, and construct a username from these components. Since this often "
3188 "results in a username that is not very useful, it will print a warning if it "
3189 "has to do this."
3190 msgstr ""
3192 #. type: Content of: <book><chapter><sect1><sect2><para>
3193 #: ../en/ch02-tour-basic.xml:531
3194 msgid ""
3195 "If all of these mechanisms fail, Mercurial will fail, printing an error "
3196 "message. In this case, it will not let you commit until you set up a "
3197 "username."
3198 msgstr ""
3200 #. type: Content of: <book><chapter><sect1><sect2><para>
3201 #: ../en/ch02-tour-basic.xml:535
3202 msgid ""
3203 "You should think of the <envar>HGUSER</envar> environment variable and the "
3204 "<option role=\"hg-opt-commit\">-u</option> option to the <command role=\"hg-"
3205 "cmd\">hg commit</command> command as ways to <emphasis>override</emphasis> "
3206 "Mercurial's default selection of username. For normal use, the simplest and "
3207 "most robust way to set a username for yourself is by creating a <filename "
3208 "role=\"special\">.hgrc</filename> file; see below for details."
3209 msgstr ""
3211 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
3212 #: ../en/ch02-tour-basic.xml:544
3213 msgid "Creating a Mercurial configuration file"
3214 msgstr "创建 Mercurial 的配置文件"
3216 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
3217 #: ../en/ch02-tour-basic.xml:546
3218 msgid ""
3219 "To set a user name, use your favourite editor to create a file called "
3220 "<filename role=\"special\">.hgrc</filename> in your home directory. "
3221 "Mercurial will use this file to look up your personalised configuration "
3222 "settings. The initial contents of your <filename role=\"special\">.hgrc</"
3223 "filename> should look like this."
3224 msgstr ""
3226 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
3227 #: ../en/ch02-tour-basic.xml:557
3228 msgid ""
3229 "The <quote><literal>[ui]</literal></quote> line begins a <emphasis>section</"
3230 "emphasis> of the config file, so you can read the <quote><literal>username "
3231 "= ...</literal></quote> line as meaning <quote>set the value of the "
3232 "<literal>username</literal> item in the <literal>ui</literal> section</"
3233 "quote>. A section continues until a new section begins, or the end of the "
3234 "file. Mercurial ignores empty lines and treats any text from "
3235 "<quote><literal>#</literal></quote> to the end of a line as a comment."
3236 msgstr ""
3238 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
3239 #: ../en/ch02-tour-basic.xml:570
3240 msgid "Choosing a user name"
3241 msgstr "选择用户名称"
3243 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
3244 #: ../en/ch02-tour-basic.xml:572
3245 msgid ""
3246 "You can use any text you like as the value of the <literal>username</literal> "
3247 "config item, since this information is for reading by other people, but for "
3248 "interpreting by Mercurial. The convention that most people follow is to use "
3249 "their name and email address, as in the example above."
3250 msgstr ""
3252 #. type: Content of: <book><chapter><sect1><sect2><sect3><note><para>
3253 #: ../en/ch02-tour-basic.xml:579
3254 msgid ""
3255 "Mercurial's built-in web server obfuscates email addresses, to make it more "
3256 "difficult for the email harvesting tools that spammers use. This reduces the "
3257 "likelihood that you'll start receiving more junk email if you publish a "
3258 "Mercurial repository on the web."
3259 msgstr ""
3261 #. type: Content of: <book><chapter><sect1><sect2><title>
3262 #: ../en/ch02-tour-basic.xml:589
3263 msgid "Writing a commit message"
3264 msgstr "写提交日志"
3266 #. type: Content of: <book><chapter><sect1><sect2><para>
3267 #: ../en/ch02-tour-basic.xml:591
3268 msgid ""
3269 "When we commit a change, Mercurial drops us into a text editor, to enter a "
3270 "message that will describe the modifications we've made in this changeset. "
3271 "This is called the <emphasis>commit message</emphasis>. It will be a record "
3272 "for readers of what we did and why, and it will be printed by <command role="
3273 "\"hg-cmd\">hg log</command> after we've finished committing."
3274 msgstr ""
3276 #. type: Content of: <book><chapter><sect1><sect2><para>
3277 #: ../en/ch02-tour-basic.xml:601
3278 msgid ""
3279 "The editor that the <command role=\"hg-cmd\">hg commit</command> command "
3280 "drops us into will contain an empty line, followed by a number of lines "
3281 "starting with <quote><literal>HG:</literal></quote>."
3282 msgstr ""
3284 #. type: Content of: <book><chapter><sect1><sect2><para>
3285 #: ../en/ch02-tour-basic.xml:608
3286 msgid ""
3287 "Mercurial ignores the lines that start with <quote><literal>HG:</literal></"
3288 "quote>; it uses them only to tell us which files it's recording changes to. "
3289 "Modifying or deleting these lines has no effect."
3290 msgstr ""
3292 #. type: Content of: <book><chapter><sect1><sect2><title>
3293 #: ../en/ch02-tour-basic.xml:614
3294 msgid "Writing a good commit message"
3295 msgstr "写好提交日志"
3297 #. type: Content of: <book><chapter><sect1><sect2><para>
3298 #: ../en/ch02-tour-basic.xml:616
3299 msgid ""
3300 "Since <command role=\"hg-cmd\">hg log</command> only prints the first line of "
3301 "a commit message by default, it's best to write a commit message whose first "
3302 "line stands alone. Here's a real example of a commit message that "
3303 "<emphasis>doesn't</emphasis> follow this guideline, and hence has a summary "
3304 "that is not readable."
3305 msgstr ""
3307 #. type: Content of: <book><chapter><sect1><sect2><para>
3308 #: ../en/ch02-tour-basic.xml:630
3309 msgid ""
3310 "As far as the remainder of the contents of the commit message are concerned, "
3311 "there are no hard-and-fast rules. Mercurial itself doesn't interpret or care "
3312 "about the contents of the commit message, though your project may have "
3313 "policies that dictate a certain kind of formatting."
3314 msgstr ""
3316 #. type: Content of: <book><chapter><sect1><sect2><para>
3317 #: ../en/ch02-tour-basic.xml:636
3318 msgid ""
3319 "My personal preference is for short, but informative, commit messages that "
3320 "tell me something that I can't figure out with a quick glance at the output "
3321 "of <command role=\"hg-cmd\">hg log --patch</command>."
3322 msgstr ""
3324 #. type: Content of: <book><chapter><sect1><sect2><title>
3325 #: ../en/ch02-tour-basic.xml:643
3326 msgid "Aborting a commit"
3327 msgstr "终止提交"
3329 #. type: Content of: <book><chapter><sect1><sect2><para>
3330 #: ../en/ch02-tour-basic.xml:645
3331 msgid ""
3332 "If you decide that you don't want to commit while in the middle of editing a "
3333 "commit message, simply exit from your editor without saving the file that "
3334 "it's editing. This will cause nothing to happen to either the repository or "
3335 "the working directory."
3336 msgstr ""
3338 #. type: Content of: <book><chapter><sect1><sect2><para>
3339 #: ../en/ch02-tour-basic.xml:650
3340 msgid ""
3341 "If we run the <command role=\"hg-cmd\">hg commit</command> command without "
3342 "any arguments, it records all of the changes we've made, as reported by "
3343 "<command role=\"hg-cmd\">hg status</command> and <command role=\"hg-cmd\">hg "
3344 "diff</command>."
3345 msgstr ""
3347 #. type: Content of: <book><chapter><sect1><sect2><title>
3348 #: ../en/ch02-tour-basic.xml:657
3349 msgid "Admiring our new handiwork"
3350 msgstr "欣赏我们的新手艺"
3352 #. type: Content of: <book><chapter><sect1><sect2><para>
3353 #: ../en/ch02-tour-basic.xml:659
3354 msgid ""
3355 "Once we've finished the commit, we can use the <command role=\"hg-cmd\">hg "
3356 "tip</command> command to display the changeset we just created. This command "
3357 "produces output that is identical to <command role=\"hg-cmd\">hg log</"
3358 "command>, but it only displays the newest revision in the repository."
3359 msgstr ""
3361 #. type: Content of: <book><chapter><sect1><sect2><para>
3362 #: ../en/ch02-tour-basic.xml:668
3363 msgid ""
3364 "We refer to the newest revision in the repository as the tip revision, or "
3365 "simply the tip."
3366 msgstr ""
3368 #. type: Content of: <book><chapter><sect1><title>
3369 #: ../en/ch02-tour-basic.xml:675
3370 msgid "Sharing changes"
3371 msgstr "共享修改"
3373 #. type: Content of: <book><chapter><sect1><para>
3374 #: ../en/ch02-tour-basic.xml:677
3375 msgid ""
3376 "We mentioned earlier that repositories in Mercurial are self-contained. This "
3377 "means that the changeset we just created exists only in our <filename class="
3378 "\"directory\">my-hello</filename> repository. Let's look at a few ways that "
3379 "we can propagate this change into other repositories."
3380 msgstr ""
3382 #. type: Content of: <book><chapter><sect1><sect2><title>
3383 #: ../en/ch02-tour-basic.xml:685
3384 msgid "Pulling changes from another repository"
3385 msgstr "从其它版本库取得修改"
3387 #. type: Content of: <book><chapter><sect1><sect2><para>
3388 #: ../en/ch02-tour-basic.xml:686
3389 msgid ""
3390 "To get started, let's clone our original <filename class=\"directory\">hello</"
3391 "filename> repository, which does not contain the change we just committed. "
3392 "We'll call our temporary repository <filename class=\"directory\">hello-pull</"
3393 "filename>."
3394 msgstr ""
3396 #. type: Content of: <book><chapter><sect1><sect2><para>
3397 #: ../en/ch02-tour-basic.xml:694
3398 msgid ""
3399 "We'll use the <command role=\"hg-cmd\">hg pull</command> command to bring "
3400 "changes from <filename class=\"directory\">my-hello</filename> into <filename "
3401 "class=\"directory\">hello-pull</filename>. However, blindly pulling unknown "
3402 "changes into a repository is a somewhat scary prospect. Mercurial provides "
3403 "the <command role=\"hg-cmd\">hg incoming</command> command to tell us what "
3404 "changes the <command role=\"hg-cmd\">hg pull</command> command "
3405 "<emphasis>would</emphasis> pull into the repository, without actually pulling "
3406 "the changes in."
3407 msgstr ""
3409 #. type: Content of: <book><chapter><sect1><sect2><para>
3410 #: ../en/ch02-tour-basic.xml:707
3411 msgid ""
3412 "(Of course, someone could cause more changesets to appear in the repository "
3413 "that we ran <command role=\"hg-cmd\">hg incoming</command> in, before we get "
3414 "a chance to <command role=\"hg-cmd\">hg pull</command> the changes, so that "
3415 "we could end up pulling changes that we didn't expect.)"
3416 msgstr ""
3418 #. type: Content of: <book><chapter><sect1><sect2><para>
3419 #: ../en/ch02-tour-basic.xml:714
3420 msgid ""
3421 "Bringing changes into a repository is a simple matter of running the <command "
3422 "role=\"hg-cmd\">hg pull</command> command, and telling it which repository to "
3423 "pull from."
3424 msgstr ""
3426 #. type: Content of: <book><chapter><sect1><sect2><para>
3427 #: ../en/ch02-tour-basic.xml:721
3428 msgid ""
3429 "As you can see from the before-and-after output of <command role=\"hg-cmd"
3430 "\">hg tip</command>, we have successfully pulled changes into our "
3431 "repository. There remains one step before we can see these changes in the "
3432 "working directory."
3433 msgstr ""
3435 #. type: Content of: <book><chapter><sect1><sect2><title>
3436 #: ../en/ch02-tour-basic.xml:729
3437 msgid "Updating the working directory"
3438 msgstr "更新工作目录"
3440 #. type: Content of: <book><chapter><sect1><sect2><para>
3441 #: ../en/ch02-tour-basic.xml:731
3442 msgid ""
3443 "We have so far glossed over the relationship between a repository and its "
3444 "working directory. The <command role=\"hg-cmd\">hg pull</command> command "
3445 "that we ran in section <xref linkend=\"sec.tour.pull\"/> brought changes into "
3446 "the repository, but if we check, there's no sign of those changes in the "
3447 "working directory. This is because <command role=\"hg-cmd\">hg pull</"
3448 "command> does not (by default) touch the working directory. Instead, we use "
3449 "the <command role=\"hg-cmd\">hg update</command> command to do this."
3450 msgstr ""
3452 #. type: Content of: <book><chapter><sect1><sect2><para>
3453 #: ../en/ch02-tour-basic.xml:743
3454 msgid ""
3455 "It might seem a bit strange that <command role=\"hg-cmd\">hg pull</command> "
3456 "doesn't update the working directory automatically. There's actually a good "
3457 "reason for this: you can use <command role=\"hg-cmd\">hg update</command> to "
3458 "update the working directory to the state it was in at <emphasis>any "
3459 "revision</emphasis> in the history of the repository. If you had the working "
3460 "directory updated to an old revision---to hunt down the origin of a bug, "
3461 "say---and ran a <command role=\"hg-cmd\">hg pull</command> which "
3462 "automatically updated the working directory to a new revision, you might not "
3463 "be terribly happy."
3464 msgstr ""
3466 #. type: Content of: <book><chapter><sect1><sect2><para>
3467 #: ../en/ch02-tour-basic.xml:754
3468 msgid ""
3469 "However, since pull-then-update is such a common thing to do, Mercurial lets "
3470 "you combine the two by passing the <option role=\"hg-opt-pull\">-u</option> "
3471 "option to <command role=\"hg-cmd\">hg pull</command>."
3472 msgstr ""
3474 #. type: Content of: <book><chapter><sect1><sect2><para>
3475 #: ../en/ch02-tour-basic.xml:759
3476 msgid ""
3477 "If you look back at the output of <command role=\"hg-cmd\">hg pull</command> "
3478 "in section <xref linkend=\"sec.tour.pull\"/> when we ran it without <option "
3479 "role=\"hg-opt-pull\">-u</option>, you can see that it printed a helpful "
3480 "reminder that we'd have to take an explicit step to update the working "
3481 "directory:"
3482 msgstr ""
3484 #. type: Content of: <book><chapter><sect1><sect2><para>
3485 #: ../en/ch02-tour-basic.xml:768
3486 msgid ""
3487 "To find out what revision the working directory is at, use the <command role="
3488 "\"hg-cmd\">hg parents</command> command."
3489 msgstr ""
3491 #. type: Content of: <book><chapter><sect1><sect2><para>
3492 #: ../en/ch02-tour-basic.xml:774
3493 msgid ""
3494 "If you look back at figure <xref endterm=\"fig.tour-basic.history.caption\" "
3495 "linkend=\"fig.tour-basic.history\"/>, you'll see arrows connecting each "
3496 "changeset. The node that the arrow leads <emphasis>from</emphasis> in each "
3497 "case is a parent, and the node that the arrow leads <emphasis>to</emphasis> "
3498 "is its child. The working directory has a parent in just the same way; this "
3499 "is the changeset that the working directory currently contains."
3500 msgstr ""
3502 #. type: Content of: <book><chapter><sect1><sect2><para>
3503 #: ../en/ch02-tour-basic.xml:784
3504 msgid ""
3505 "To update the working directory to a particular revision, give a revision "
3506 "number or changeset ID to the <command role=\"hg-cmd\">hg update</command> "
3507 "command."
3508 msgstr ""
3510 #. type: Content of: <book><chapter><sect1><sect2><para>
3511 #: ../en/ch02-tour-basic.xml:791
3512 msgid ""
3513 "If you omit an explicit revision, <command role=\"hg-cmd\">hg update</"
3514 "command> will update to the tip revision, as shown by the second call to "
3515 "<command role=\"hg-cmd\">hg update</command> in the example above."
3516 msgstr ""
3518 #. type: Content of: <book><chapter><sect1><sect2><title>
3519 #: ../en/ch02-tour-basic.xml:799
3520 msgid "Pushing changes to another repository"
3521 msgstr "发布修改到其它版本库"
3523 #. type: Content of: <book><chapter><sect1><sect2><para>
3524 #: ../en/ch02-tour-basic.xml:801
3525 msgid ""
3526 "Mercurial lets us push changes to another repository, from the repository "
3527 "we're currently visiting. As with the example of <command role=\"hg-cmd\">hg "
3528 "pull</command> above, we'll create a temporary repository to push our changes "
3529 "into."
3530 msgstr ""
3532 #. type: Content of: <book><chapter><sect1><sect2><para>
3533 #: ../en/ch02-tour-basic.xml:809
3534 msgid ""
3535 "The <command role=\"hg-cmd\">hg outgoing</command> command tells us what "
3536 "changes would be pushed into another repository."
3537 msgstr ""
3539 #. type: Content of: <book><chapter><sect1><sect2><para>
3540 #: ../en/ch02-tour-basic.xml:815
3541 msgid ""
3542 "And the <command role=\"hg-cmd\">hg push</command> command does the actual "
3543 "push."
3544 msgstr ""
3546 #. type: Content of: <book><chapter><sect1><sect2><para>
3547 #: ../en/ch02-tour-basic.xml:821
3548 msgid ""
3549 "As with <command role=\"hg-cmd\">hg pull</command>, the <command role=\"hg-cmd"
3550 "\">hg push</command> command does not update the working directory in the "
3551 "repository that it's pushing changes into. (Unlike <command role=\"hg-cmd"
3552 "\">hg pull</command>, <command role=\"hg-cmd\">hg push</command> does not "
3553 "provide a <literal>-u</literal> option that updates the other repository's "
3554 "working directory.)"
3555 msgstr ""
3557 #. type: Content of: <book><chapter><sect1><sect2><para>
3558 #: ../en/ch02-tour-basic.xml:830
3559 msgid ""
3560 "What happens if we try to pull or push changes and the receiving repository "
3561 "already has those changes? Nothing too exciting."
3562 msgstr ""
3564 #. type: Content of: <book><chapter><sect1><sect2><title>
3565 #: ../en/ch02-tour-basic.xml:837
3566 msgid "Sharing changes over a network"
3567 msgstr "通过网络共享修改"
3569 #. type: Content of: <book><chapter><sect1><sect2><para>
3570 #: ../en/ch02-tour-basic.xml:839
3571 msgid ""
3572 "The commands we have covered in the previous few sections are not limited to "
3573 "working with local repositories. Each works in exactly the same fashion over "
3574 "a network connection; simply pass in a URL instead of a local path."
3575 msgstr ""
3577 #. type: Content of: <book><chapter><sect1><sect2><para>
3578 #: ../en/ch02-tour-basic.xml:847
3579 msgid ""
3580 "In this example, we can see what changes we could push to the remote "
3581 "repository, but the repository is understandably not set up to let anonymous "
3582 "users push to it."
3583 msgstr ""
3585 #. type: Content of: <book><chapter><title>
3586 #: ../en/ch03-tour-merge.xml:5
3587 msgid "A tour of Mercurial: merging work"
3588 msgstr "Mercurial 教程: 合并工作"
3590 #. type: Content of: <book><chapter><para>
3591 #: ../en/ch03-tour-merge.xml:7
3592 msgid ""
3593 "We've now covered cloning a repository, making changes in a repository, and "
3594 "pulling or pushing changes from one repository into another. Our next step "
3595 "is <emphasis>merging</emphasis> changes from separate repositories."
3596 msgstr ""
3598 #. type: Content of: <book><chapter><sect1><title>
3599 #: ../en/ch03-tour-merge.xml:13
3600 msgid "Merging streams of work"
3601 msgstr "合并的流程"
3603 #. type: Content of: <book><chapter><sect1><para>
3604 #: ../en/ch03-tour-merge.xml:15
3605 msgid ""
3606 "Merging is a fundamental part of working with a distributed revision control "
3607 "tool."
3608 msgstr ""
3610 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
3611 #: ../en/ch03-tour-merge.xml:18
3612 msgid ""
3613 "Alice and Bob each have a personal copy of a repository for a project they're "
3614 "collaborating on. Alice fixes a bug in her repository; Bob adds a new "
3615 "feature in his. They want the shared repository to contain both the bug fix "
3616 "and the new feature."
3617 msgstr ""
3619 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
3620 #: ../en/ch03-tour-merge.xml:24
3621 msgid ""
3622 "I frequently work on several different tasks for a single project at once, "
3623 "each safely isolated in its own repository. Working this way means that I "
3624 "often need to merge one piece of my own work with another."
3625 msgstr ""
3627 #. type: Content of: <book><chapter><sect1><para>
3628 #: ../en/ch03-tour-merge.xml:30
3629 msgid ""
3630 "Because merging is such a common thing to need to do, Mercurial makes it "
3631 "easy. Let's walk through the process. We'll begin by cloning yet another "
3632 "repository (see how often they spring up?) and making a change in it."
3633 msgstr ""
3635 #. type: Content of: <book><chapter><sect1><para>
3636 #: ../en/ch03-tour-merge.xml:37
3637 msgid ""
3638 "We should now have two copies of <filename>hello.c</filename> with different "
3639 "contents. The histories of the two repositories have also diverged, as "
3640 "illustrated in figure <xref endterm=\"fig.tour-merge.sep-repos.caption\" "
3641 "linkend=\"fig.tour-merge.sep-repos\"/>."
3642 msgstr ""
3644 #. type: Content of: <book><chapter><sect1><informalfigure><mediaobject>
3645 #: ../en/ch03-tour-merge.xml:47
3646 msgid ""
3647 "<imageobject><imagedata fileref=\"images/tour-merge-sep-repos.png\"/></"
3648 "imageobject>"
3649 msgstr ""
3651 #. type: Content of: <book><chapter><sect1><informalfigure><mediaobject><caption><para>
3652 #: ../en/ch03-tour-merge.xml:49
3653 msgid ""
3654 "Divergent recent histories of the <filename class=\"directory\">my-hello</"
3655 "filename> and <filename class=\"directory\">my-new-hello</filename> "
3656 "repositories"
3657 msgstr ""
3659 #. type: Content of: <book><chapter><sect1><para>
3660 #: ../en/ch03-tour-merge.xml:57
3661 msgid ""
3662 "We already know that pulling changes from our <filename class=\"directory"
3663 "\">my-hello</filename> repository will have no effect on the working "
3664 "directory."
3665 msgstr ""
3667 #. type: Content of: <book><chapter><sect1><para>
3668 #: ../en/ch03-tour-merge.xml:63
3669 msgid ""
3670 "However, the <command role=\"hg-cmd\">hg pull</command> command says "
3671 "something about <quote>heads</quote>."
3672 msgstr ""
3674 #. type: Content of: <book><chapter><sect1><sect2><title>
3675 #: ../en/ch03-tour-merge.xml:67
3676 msgid "Head changesets"
3677 msgstr "顶点改变集"
3679 #. type: Content of: <book><chapter><sect1><sect2><para>
3680 #: ../en/ch03-tour-merge.xml:69
3681 msgid ""
3682 "A head is a change that has no descendants, or children, as they're also "
3683 "known. The tip revision is thus a head, because the newest revision in a "
3684 "repository doesn't have any children, but a repository can contain more than "
3685 "one head."
3686 msgstr ""
3688 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
3689 #: ../en/ch03-tour-merge.xml:77
3690 msgid ""
3691 "<imageobject><imagedata fileref=\"images/tour-merge-pull.png\"/></imageobject>"
3692 msgstr ""
3694 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
3695 #: ../en/ch03-tour-merge.xml:79
3696 msgid ""
3697 "Repository contents after pulling from <filename class=\"directory\">my-"
3698 "hello</filename> into <filename class=\"directory\">my-new-hello</filename>"
3699 msgstr ""
3701 #. type: Content of: <book><chapter><sect1><sect2><para>
3702 #: ../en/ch03-tour-merge.xml:85
3703 msgid ""
3704 "In figure <xref endterm=\"fig.tour-merge.pull.caption\" linkend=\"fig.tour-"
3705 "merge.pull\"/>, you can see the effect of the pull from <filename class="
3706 "\"directory\">my-hello</filename> into <filename class=\"directory\">my-new-"
3707 "hello</filename>. The history that was already present in <filename class="
3708 "\"directory\">my-new-hello</filename> is untouched, but a new revision has "
3709 "been added. By referring to figure <xref endterm=\"fig.tour-merge.sep-repos."
3710 "caption\" linkend=\"fig.tour-merge.sep-repos\"/>, we can see that the "
3711 "<emphasis>changeset ID</emphasis> remains the same in the new repository, but "
3712 "the <emphasis>revision number</emphasis> has changed. (This, incidentally, "
3713 "is a fine example of why it's not safe to use revision numbers when "
3714 "discussing changesets.) We can view the heads in a repository using the "
3715 "<command role=\"hg-cmd\">hg heads</command> command."
3716 msgstr ""
3718 #. type: Content of: <book><chapter><sect1><sect2><title>
3719 #: ../en/ch03-tour-merge.xml:106
3720 msgid "Performing the merge"
3721 msgstr "执行合并"
3723 #. type: Content of: <book><chapter><sect1><sect2><para>
3724 #: ../en/ch03-tour-merge.xml:108
3725 msgid ""
3726 "What happens if we try to use the normal <command role=\"hg-cmd\">hg update</"
3727 "command> command to update to the new tip?"
3728 msgstr ""
3730 #. type: Content of: <book><chapter><sect1><sect2><para>
3731 #: ../en/ch03-tour-merge.xml:114
3732 msgid ""
3733 "Mercurial is telling us that the <command role=\"hg-cmd\">hg update</command> "
3734 "command won't do a merge; it won't update the working directory when it "
3735 "thinks we might be wanting to do a merge, unless we force it to do so. "
3736 "Instead, we use the <command role=\"hg-cmd\">hg merge</command> command to "
3737 "merge the two heads."
3738 msgstr ""
3740 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
3741 #: ../en/ch03-tour-merge.xml:125
3742 msgid ""
3743 "<imageobject><imagedata fileref=\"images/tour-merge-merge.png\"/></"
3744 "imageobject>"
3745 msgstr ""
3747 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
3748 #: ../en/ch03-tour-merge.xml:127
3749 msgid "Working directory and repository during merge, and following commit"
3750 msgstr ""
3752 #. type: Content of: <book><chapter><sect1><sect2><para>
3753 #: ../en/ch03-tour-merge.xml:132
3754 msgid ""
3755 "This updates the working directory so that it contains changes from "
3756 "<emphasis>both</emphasis> heads, which is reflected in both the output of "
3757 "<command role=\"hg-cmd\">hg parents</command> and the contents of "
3758 "<filename>hello.c</filename>."
3759 msgstr ""
3761 #. type: Content of: <book><chapter><sect1><sect2><title>
3762 #: ../en/ch03-tour-merge.xml:142
3763 msgid "Committing the results of the merge"
3764 msgstr "提交合并结果"
3766 #. type: Content of: <book><chapter><sect1><sect2><para>
3767 #: ../en/ch03-tour-merge.xml:144
3768 msgid ""
3769 "Whenever we've done a merge, <command role=\"hg-cmd\">hg parents</command> "
3770 "will display two parents until we <command role=\"hg-cmd\">hg commit</"
3771 "command> the results of the merge."
3772 msgstr ""
3774 #. type: Content of: <book><chapter><sect1><sect2><para>
3775 #: ../en/ch03-tour-merge.xml:151
3776 msgid ""
3777 "We now have a new tip revision; notice that it has <emphasis>both</emphasis> "
3778 "of our former heads as its parents. These are the same revisions that were "
3779 "previously displayed by <command role=\"hg-cmd\">hg parents</command>."
3780 msgstr ""
3782 #. type: Content of: <book><chapter><sect1><sect2><para>
3783 #: ../en/ch03-tour-merge.xml:158
3784 msgid ""
3785 "In figure <xref endterm=\"fig.tour-merge.merge.caption\" linkend=\"fig.tour-"
3786 "merge.merge\"/>, you can see a representation of what happens to the working "
3787 "directory during the merge, and how this affects the repository when the "
3788 "commit happens. During the merge, the working directory has two parent "
3789 "changesets, and these become the parents of the new changeset."
3790 msgstr ""
3792 #. type: Content of: <book><chapter><sect1><title>
3793 #: ../en/ch03-tour-merge.xml:169
3794 msgid "Merging conflicting changes"
3795 msgstr "合并有冲突的改变"
3797 #. type: Content of: <book><chapter><sect1><para>
3798 #: ../en/ch03-tour-merge.xml:171
3799 msgid ""
3800 "Most merges are simple affairs, but sometimes you'll find yourself merging "
3801 "changes where each modifies the same portions of the same files. Unless both "
3802 "modifications are identical, this results in a <emphasis>conflict</emphasis>, "
3803 "where you have to decide how to reconcile the different changes into "
3804 "something coherent."
3805 msgstr ""
3807 #. type: Content of: <book><chapter><sect1><informalfigure><mediaobject>
3808 #: ../en/ch03-tour-merge.xml:180
3809 msgid ""
3810 "<imageobject><imagedata fileref=\"images/tour-merge-conflict.png\"/> </"
3811 "imageobject>"
3812 msgstr ""
3814 #. type: Content of: <book><chapter><sect1><informalfigure><mediaobject><caption><para>
3815 #: ../en/ch03-tour-merge.xml:183
3816 msgid "Conflicting changes to a document"
3817 msgstr ""
3819 #. type: Content of: <book><chapter><sect1><para>
3820 #: ../en/ch03-tour-merge.xml:188
3821 msgid ""
3822 "Figure <xref endterm=\"fig.tour-merge.conflict.caption\" linkend=\"fig.tour-"
3823 "merge.conflict\"/> illustrates an instance of two conflicting changes to a "
3824 "document. We started with a single version of the file; then we made some "
3825 "changes; while someone else made different changes to the same text. Our "
3826 "task in resolving the conflicting changes is to decide what the file should "
3827 "look like."
3828 msgstr ""
3830 #. type: Content of: <book><chapter><sect1><para>
3831 #: ../en/ch03-tour-merge.xml:196
3832 msgid ""
3833 "Mercurial doesn't have a built-in facility for handling conflicts. Instead, "
3834 "it runs an external program called <command>hgmerge</command>. This is a "
3835 "shell script that is bundled with Mercurial; you can change it to behave "
3836 "however you please. What it does by default is try to find one of several "
3837 "different merging tools that are likely to be installed on your system. It "
3838 "first tries a few fully automatic merging tools; if these don't succeed "
3839 "(because the resolution process requires human guidance) or aren't present, "
3840 "the script tries a few different graphical merging tools."
3841 msgstr ""
3843 #. type: Content of: <book><chapter><sect1><para>
3844 #: ../en/ch03-tour-merge.xml:207
3845 msgid ""
3846 "It's also possible to get Mercurial to run another program or script instead "
3847 "of <command>hgmerge</command>, by setting the <envar>HGMERGE</envar> "
3848 "environment variable to the name of your preferred program."
3849 msgstr ""
3851 #. type: Content of: <book><chapter><sect1><sect2><title>
3852 #: ../en/ch03-tour-merge.xml:213
3853 msgid "Using a graphical merge tool"
3854 msgstr "使用图形合并工具"
3856 #. type: Content of: <book><chapter><sect1><sect2><para>
3857 #: ../en/ch03-tour-merge.xml:215
3858 msgid ""
3859 "My preferred graphical merge tool is <command>kdiff3</command>, which I'll "
3860 "use to describe the features that are common to graphical file merging "
3861 "tools. You can see a screenshot of <command>kdiff3</command> in action in "
3862 "figure <xref endterm=\"fig.tour-merge.kdiff3.caption\" linkend=\"fig.tour-"
3863 "merge.kdiff3\"/>. The kind of merge it is performing is called a "
3864 "<emphasis>three-way merge</emphasis>, because there are three different "
3865 "versions of the file of interest to us. The tool thus splits the upper "
3866 "portion of the window into three panes:"
3867 msgstr ""
3869 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
3870 #: ../en/ch03-tour-merge.xml:226
3871 msgid ""
3872 "At the left is the <emphasis>base</emphasis> version of the file, i.e. the "
3873 "most recent version from which the two versions we're trying to merge are "
3874 "descended."
3875 msgstr ""
3877 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
3878 #: ../en/ch03-tour-merge.xml:231
3879 msgid ""
3880 "In the middle is <quote>our</quote> version of the file, with the contents "
3881 "that we modified."
3882 msgstr ""
3884 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
3885 #: ../en/ch03-tour-merge.xml:234
3886 msgid ""
3887 "On the right is <quote>their</quote> version of the file, the one that from "
3888 "the changeset that we're trying to merge with."
3889 msgstr ""
3891 #. type: Content of: <book><chapter><sect1><sect2><para>
3892 #: ../en/ch03-tour-merge.xml:238
3893 msgid ""
3894 "In the pane below these is the current <emphasis>result</emphasis> of the "
3895 "merge. Our task is to replace all of the red text, which indicates unresolved "
3896 "conflicts, with some sensible merger of the <quote>ours</quote> and "
3897 "<quote>theirs</quote> versions of the file."
3898 msgstr ""
3900 #. type: Content of: <book><chapter><sect1><sect2><para>
3901 #: ../en/ch03-tour-merge.xml:245
3902 msgid ""
3903 "All four of these panes are <emphasis>locked together</emphasis>; if we "
3904 "scroll vertically or horizontally in any of them, the others are updated to "
3905 "display the corresponding sections of their respective files."
3906 msgstr ""
3908 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
3909 #: ../en/ch03-tour-merge.xml:252
3910 msgid ""
3911 "<imageobject><imagedata width=\"100%\" fileref=\"images/kdiff3.png\"/> </"
3912 "imageobject>"
3913 msgstr ""
3915 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
3916 #: ../en/ch03-tour-merge.xml:255
3917 msgid "Using <command>kdiff3</command> to merge versions of a file"
3918 msgstr ""
3920 #. type: Content of: <book><chapter><sect1><sect2><para>
3921 #: ../en/ch03-tour-merge.xml:261
3922 msgid ""
3923 "For each conflicting portion of the file, we can choose to resolve the "
3924 "conflict using some combination of text from the base version, ours, or "
3925 "theirs. We can also manually edit the merged file at any time, in case we "
3926 "need to make further modifications."
3927 msgstr ""
3929 #. type: Content of: <book><chapter><sect1><sect2><para>
3930 #: ../en/ch03-tour-merge.xml:267
3931 msgid ""
3932 "There are <emphasis>many</emphasis> file merging tools available, too many to "
3933 "cover here. They vary in which platforms they are available for, and in "
3934 "their particular strengths and weaknesses. Most are tuned for merging files "
3935 "containing plain text, while a few are aimed at specialised file formats "
3936 "(generally XML)."
3937 msgstr ""
3939 #. type: Content of: <book><chapter><sect1><sect2><title>
3940 #: ../en/ch03-tour-merge.xml:276
3941 msgid "A worked example"
3942 msgstr "合并实例"
3944 #. type: Content of: <book><chapter><sect1><sect2><para>
3945 #: ../en/ch03-tour-merge.xml:278
3946 msgid ""
3947 "In this example, we will reproduce the file modification history of figure "
3948 "<xref endterm=\"fig.tour-merge.conflict.caption\" linkend=\"fig.tour-merge."
3949 "conflict\"/> above. Let's begin by creating a repository with a base version "
3950 "of our document."
3951 msgstr ""
3953 #. type: Content of: <book><chapter><sect1><sect2><para>
3954 #: ../en/ch03-tour-merge.xml:286
3955 msgid "We'll clone the repository and make a change to the file."
3956 msgstr ""
3958 #. type: Content of: <book><chapter><sect1><sect2><para>
3959 #: ../en/ch03-tour-merge.xml:291
3960 msgid ""
3961 "And another clone, to simulate someone else making a change to the file. "
3962 "(This hints at the idea that it's not all that unusual to merge with yourself "
3963 "when you isolate tasks in separate repositories, and indeed to find and "
3964 "resolve conflicts while doing so.)"
3965 msgstr ""
3967 #. type: Content of: <book><chapter><sect1><sect2><para>
3968 #: ../en/ch03-tour-merge.xml:299
3969 msgid ""
3970 "Having created two different versions of the file, we'll set up an "
3971 "environment suitable for running our merge."
3972 msgstr ""
3974 #. type: Content of: <book><chapter><sect1><sect2><para>
3975 #: ../en/ch03-tour-merge.xml:305
3976 msgid ""
3977 "In this example, I won't use Mercurial's normal <command>hgmerge</command> "
3978 "program to do the merge, because it would drop my nice automated example-"
3979 "running tool into a graphical user interface. Instead, I'll set "
3980 "<envar>HGMERGE</envar> to tell Mercurial to use the non-interactive "
3981 "<command>merge</command> command. This is bundled with many Unix-like "
3982 "systems. If you're following this example on your computer, don't bother "
3983 "setting <envar>HGMERGE</envar>."
3984 msgstr ""
3986 #. type: Content of: <book><chapter><sect1><sect2><para>
3987 #: ../en/ch03-tour-merge.xml:315
3988 msgid "<emphasis role=\"bold\">XXX FIX THIS EXAMPLE.</emphasis>"
3989 msgstr ""
3991 #. type: Content of: <book><chapter><sect1><sect2><para>
3992 #: ../en/ch03-tour-merge.xml:320
3993 msgid ""
3994 "Because <command>merge</command> can't resolve the conflicting changes, it "
3995 "leaves <emphasis>merge markers</emphasis> inside the file that has conflicts, "
3996 "indicating which lines have conflicts, and whether they came from our version "
3997 "of the file or theirs."
3998 msgstr ""
4000 #. type: Content of: <book><chapter><sect1><sect2><para>
4001 #: ../en/ch03-tour-merge.xml:326
4002 msgid ""
4003 "Mercurial can tell from the way <command>merge</command> exits that it wasn't "
4004 "able to merge successfully, so it tells us what commands we'll need to run if "
4005 "we want to redo the merging operation. This could be useful if, for example, "
4006 "we were running a graphical merge tool and quit because we were confused or "
4007 "realised we had made a mistake."
4008 msgstr ""
4010 #. type: Content of: <book><chapter><sect1><sect2><para>
4011 #: ../en/ch03-tour-merge.xml:333
4012 msgid ""
4013 "If automatic or manual merges fail, there's nothing to prevent us from "
4014 "<quote>fixing up</quote> the affected files ourselves, and committing the "
4015 "results of our merge:"
4016 msgstr ""
4018 #. type: Content of: <book><chapter><sect1><title>
4019 #: ../en/ch03-tour-merge.xml:342
4020 msgid "Simplifying the pull-merge-commit sequence"
4021 msgstr "简化拉-合并-提交程序"
4023 #. type: Content of: <book><chapter><sect1><para>
4024 #: ../en/ch03-tour-merge.xml:344
4025 msgid ""
4026 "The process of merging changes as outlined above is straightforward, but "
4027 "requires running three commands in sequence."
4028 msgstr ""
4030 #. type: Content of: <book><chapter><sect1><para>
4031 #: ../en/ch03-tour-merge.xml:350
4032 msgid ""
4033 "In the case of the final commit, you also need to enter a commit message, "
4034 "which is almost always going to be a piece of uninteresting "
4035 "<quote>boilerplate</quote> text."
4036 msgstr ""
4038 #. type: Content of: <book><chapter><sect1><para>
4039 #: ../en/ch03-tour-merge.xml:354
4040 msgid ""
4041 "It would be nice to reduce the number of steps needed, if this were "
4042 "possible. Indeed, Mercurial is distributed with an extension called <literal "
4043 "role=\"hg-ext\">fetch</literal> that does just this."
4044 msgstr ""
4046 #. type: Content of: <book><chapter><sect1><para>
4047 #: ../en/ch03-tour-merge.xml:359
4048 msgid ""
4049 "Mercurial provides a flexible extension mechanism that lets people extend its "
4050 "functionality, while keeping the core of Mercurial small and easy to deal "
4051 "with. Some extensions add new commands that you can use from the command "
4052 "line, while others work <quote>behind the scenes,</quote> for example adding "
4053 "capabilities to the server."
4054 msgstr ""
4056 #. type: Content of: <book><chapter><sect1><para>
4057 #: ../en/ch03-tour-merge.xml:366
4058 msgid ""
4059 "The <literal role=\"hg-ext\">fetch</literal> extension adds a new command "
4060 "called, not surprisingly, <command role=\"hg-cmd\">hg fetch</command>. This "
4061 "extension acts as a combination of <command role=\"hg-cmd\">hg pull</"
4062 "command>, <command role=\"hg-cmd\">hg update</command> and <command role=\"hg-"
4063 "cmd\">hg merge</command>. It begins by pulling changes from another "
4064 "repository into the current repository. If it finds that the changes added a "
4065 "new head to the repository, it begins a merge, then commits the result of the "
4066 "merge with an automatically-generated commit message. If no new heads were "
4067 "added, it updates the working directory to the new tip changeset."
4068 msgstr ""
4070 #. type: Content of: <book><chapter><sect1><para>
4071 #: ../en/ch03-tour-merge.xml:379
4072 msgid ""
4073 "Enabling the <literal role=\"hg-ext\">fetch</literal> extension is easy. "
4074 "Edit your <filename role=\"special\">.hgrc</filename>, and either go to the "
4075 "<literal role=\"rc-extensions\">extensions</literal> section or create an "
4076 "<literal role=\"rc-extensions\">extensions</literal> section. Then add a line "
4077 "that simply reads <quote><literal>fetch </literal></quote>."
4078 msgstr ""
4080 #. type: Content of: <book><chapter><sect1><para>
4081 #: ../en/ch03-tour-merge.xml:389
4082 msgid ""
4083 "(Normally, on the right-hand side of the <quote><literal>=</literal></quote> "
4084 "would appear the location of the extension, but since the <literal role=\"hg-"
4085 "ext\">fetch</literal> extension is in the standard distribution, Mercurial "
4086 "knows where to search for it.)"
4087 msgstr ""
4089 #. type: Content of: <book><chapter><title>
4090 #: ../en/ch04-concepts.xml:5
4091 msgid "Behind the scenes"
4092 msgstr "Mercurial 内幕"
4094 #. type: Content of: <book><chapter><para>
4095 #: ../en/ch04-concepts.xml:7
4096 msgid ""
4097 "Unlike many revision control systems, the concepts upon which Mercurial is "
4098 "built are simple enough that it's easy to understand how the software really "
4099 "works. Knowing this certainly isn't necessary, but I find it useful to have "
4100 "a <quote>mental model</quote> of what's going on."
4101 msgstr ""
4103 #. type: Content of: <book><chapter><para>
4104 #: ../en/ch04-concepts.xml:13
4105 msgid ""
4106 "This understanding gives me confidence that Mercurial has been carefully "
4107 "designed to be both <emphasis>safe</emphasis> and <emphasis>efficient</"
4108 "emphasis>. And just as importantly, if it's easy for me to retain a good "
4109 "idea of what the software is doing when I perform a revision control task, "
4110 "I'm less likely to be surprised by its behaviour."
4111 msgstr ""
4113 #. type: Content of: <book><chapter><para>
4114 #: ../en/ch04-concepts.xml:20
4115 msgid ""
4116 "In this chapter, we'll initially cover the core concepts behind Mercurial's "
4117 "design, then continue to discuss some of the interesting details of its "
4118 "implementation."
4119 msgstr ""
4121 #. type: Content of: <book><chapter><sect1><title>
4122 #: ../en/ch04-concepts.xml:25
4123 msgid "Mercurial's historical record"
4124 msgstr "Mercurial 的历史记录"
4126 #. type: Content of: <book><chapter><sect1><sect2><title>
4127 #: ../en/ch04-concepts.xml:28
4128 msgid "Tracking the history of a single file"
4129 msgstr "跟踪单一文件的历史"
4131 #. type: Content of: <book><chapter><sect1><sect2><para>
4132 #: ../en/ch04-concepts.xml:30
4133 msgid ""
4134 "When Mercurial tracks modifications to a file, it stores the history of that "
4135 "file in a metadata object called a <emphasis>filelog</emphasis>. Each entry "
4136 "in the filelog contains enough information to reconstruct one revision of the "
4137 "file that is being tracked. Filelogs are stored as files in the <filename "
4138 "role=\"special\" class=\"directory\">.hg/store/data</filename> directory. A "
4139 "filelog contains two kinds of information: revision data, and an index to "
4140 "help Mercurial to find a revision efficiently."
4141 msgstr ""
4143 #. type: Content of: <book><chapter><sect1><sect2><para>
4144 #: ../en/ch04-concepts.xml:41
4145 msgid ""
4146 "A file that is large, or has a lot of history, has its filelog stored in "
4147 "separate data (<quote><literal>.d</literal></quote> suffix) and index "
4148 "(<quote><literal>.i</literal></quote> suffix) files. For small files without "
4149 "much history, the revision data and index are combined in a single "
4150 "<quote><literal>.i</literal></quote> file. The correspondence between a file "
4151 "in the working directory and the filelog that tracks its history in the "
4152 "repository is illustrated in figure <xref endterm=\"fig.concepts.filelog."
4153 "caption\" linkend=\"fig.concepts.filelog\"/>."
4154 msgstr ""
4156 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
4157 #: ../en/ch04-concepts.xml:55
4158 msgid "<imageobject><imagedata fileref=\"images/filelog.png\"/></imageobject>"
4159 msgstr ""
4161 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
4162 #: ../en/ch04-concepts.xml:57
4163 msgid ""
4164 "Relationships between files in working directory and filelogs in repository"
4165 msgstr ""
4167 #. type: Content of: <book><chapter><sect1><sect2><title>
4168 #: ../en/ch04-concepts.xml:65
4169 msgid "Managing tracked files"
4170 msgstr "管理跟踪的文件"
4172 #. type: Content of: <book><chapter><sect1><sect2><para>
4173 #: ../en/ch04-concepts.xml:67
4174 msgid ""
4175 "Mercurial uses a structure called a <emphasis>manifest</emphasis> to collect "
4176 "together information about the files that it tracks. Each entry in the "
4177 "manifest contains information about the files present in a single changeset. "
4178 "An entry records which files are present in the changeset, the revision of "
4179 "each file, and a few other pieces of file metadata."
4180 msgstr ""
4182 #. type: Content of: <book><chapter><sect1><sect2><title>
4183 #: ../en/ch04-concepts.xml:77
4184 msgid "Recording changeset information"
4185 msgstr "记录修改集信息"
4187 #. type: Content of: <book><chapter><sect1><sect2><para>
4188 #: ../en/ch04-concepts.xml:79
4189 msgid ""
4190 "The <emphasis>changelog</emphasis> contains information about each "
4191 "changeset. Each revision records who committed a change, the changeset "
4192 "comment, other pieces of changeset-related information, and the revision of "
4193 "the manifest to use."
4194 msgstr ""
4196 #. type: Content of: <book><chapter><sect1><sect2><title>
4197 #: ../en/ch04-concepts.xml:87
4198 msgid "Relationships between revisions"
4199 msgstr "版本之间的关系"
4201 #. type: Content of: <book><chapter><sect1><sect2><para>
4202 #: ../en/ch04-concepts.xml:89
4203 msgid ""
4204 "Within a changelog, a manifest, or a filelog, each revision stores a pointer "
4205 "to its immediate parent (or to its two parents, if it's a merge revision). "
4206 "As I mentioned above, there are also relationships between revisions "
4207 "<emphasis>across</emphasis> these structures, and they are hierarchical in "
4208 "nature."
4209 msgstr ""
4211 #. type: Content of: <book><chapter><sect1><sect2><para>
4212 #: ../en/ch04-concepts.xml:96
4213 msgid ""
4214 "For every changeset in a repository, there is exactly one revision stored in "
4215 "the changelog. Each revision of the changelog contains a pointer to a single "
4216 "revision of the manifest. A revision of the manifest stores a pointer to a "
4217 "single revision of each filelog tracked when that changeset was created. "
4218 "These relationships are illustrated in figure <xref endterm=\"fig.concepts."
4219 "metadata.caption\" linkend=\"fig.concepts.metadata\"/>."
4220 msgstr ""
4222 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
4223 #: ../en/ch04-concepts.xml:107
4224 msgid "<imageobject><imagedata fileref=\"images/metadata.png\"/></imageobject>"
4225 msgstr ""
4227 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
4228 #: ../en/ch04-concepts.xml:109
4229 msgid "Metadata relationships"
4230 msgstr ""
4232 #. type: Content of: <book><chapter><sect1><sect2><para>
4233 #: ../en/ch04-concepts.xml:114
4234 msgid ""
4235 "As the illustration shows, there is <emphasis>not</emphasis> a <quote>one to "
4236 "one</quote> relationship between revisions in the changelog, manifest, or "
4237 "filelog. If the manifest hasn't changed between two changesets, the changelog "
4238 "entries for those changesets will point to the same revision of the "
4239 "manifest. If a file that Mercurial tracks hasn't changed between two "
4240 "changesets, the entry for that file in the two revisions of the manifest will "
4241 "point to the same revision of its filelog."
4242 msgstr ""
4244 #. type: Content of: <book><chapter><sect1><title>
4245 #: ../en/ch04-concepts.xml:127
4246 msgid "Safe, efficient storage"
4247 msgstr "安全,高效的存储"
4249 #. type: Content of: <book><chapter><sect1><para>
4250 #: ../en/ch04-concepts.xml:129
4251 msgid ""
4252 "The underpinnings of changelogs, manifests, and filelogs are provided by a "
4253 "single structure called the <emphasis>revlog</emphasis>."
4254 msgstr ""
4256 #. type: Content of: <book><chapter><sect1><sect2><title>
4257 #: ../en/ch04-concepts.xml:134
4258 msgid "Efficient storage"
4259 msgstr "高效存储"
4261 #. type: Content of: <book><chapter><sect1><sect2><para>
4262 #: ../en/ch04-concepts.xml:136
4263 msgid ""
4264 "The revlog provides efficient storage of revisions using a <emphasis>delta</"
4265 "emphasis> mechanism. Instead of storing a complete copy of a file for each "
4266 "revision, it stores the changes needed to transform an older revision into "
4267 "the new revision. For many kinds of file data, these deltas are typically a "
4268 "fraction of a percent of the size of a full copy of a file."
4269 msgstr ""
4271 #. type: Content of: <book><chapter><sect1><sect2><para>
4272 #: ../en/ch04-concepts.xml:144
4273 msgid ""
4274 "Some obsolete revision control systems can only work with deltas of text "
4275 "files. They must either store binary files as complete snapshots or encoded "
4276 "into a text representation, both of which are wasteful approaches. Mercurial "
4277 "can efficiently handle deltas of files with arbitrary binary contents; it "
4278 "doesn't need to treat text as special."
4279 msgstr ""
4281 #. type: Content of: <book><chapter><sect1><sect2><title>
4282 #: ../en/ch04-concepts.xml:153
4283 msgid "Safe operation"
4284 msgstr "安全操作"
4286 #. type: Content of: <book><chapter><sect1><sect2><para>
4287 #: ../en/ch04-concepts.xml:155
4288 msgid ""
4289 "Mercurial only ever <emphasis>appends</emphasis> data to the end of a revlog "
4290 "file. It never modifies a section of a file after it has written it. This is "
4291 "both more robust and efficient than schemes that need to modify or rewrite "
4292 "data."
4293 msgstr ""
4295 #. type: Content of: <book><chapter><sect1><sect2><para>
4296 #: ../en/ch04-concepts.xml:161
4297 msgid ""
4298 "In addition, Mercurial treats every write as part of a <emphasis>transaction</"
4299 "emphasis> that can span a number of files. A transaction is "
4300 "<emphasis>atomic</emphasis>: either the entire transaction succeeds and its "
4301 "effects are all visible to readers in one go, or the whole thing is undone. "
4302 "This guarantee of atomicity means that if you're running two copies of "
4303 "Mercurial, where one is reading data and one is writing it, the reader will "
4304 "never see a partially written result that might confuse it."
4305 msgstr ""
4307 #. type: Content of: <book><chapter><sect1><sect2><para>
4308 #: ../en/ch04-concepts.xml:171
4309 msgid ""
4310 "The fact that Mercurial only appends to files makes it easier to provide this "
4311 "transactional guarantee. The easier it is to do stuff like this, the more "
4312 "confident you should be that it's done correctly."
4313 msgstr ""
4315 #. type: Content of: <book><chapter><sect1><sect2><title>
4316 #: ../en/ch04-concepts.xml:178
4317 msgid "Fast retrieval"
4318 msgstr "快速检索"
4320 #. type: Content of: <book><chapter><sect1><sect2><para>
4321 #: ../en/ch04-concepts.xml:180
4322 msgid ""
4323 "Mercurial cleverly avoids a pitfall common to all earlier revision control "
4324 "systems: the problem of <emphasis>inefficient retrieval</emphasis>. Most "
4325 "revision control systems store the contents of a revision as an incremental "
4326 "series of modifications against a <quote>snapshot</quote>. To reconstruct a "
4327 "specific revision, you must first read the snapshot, and then every one of "
4328 "the revisions between the snapshot and your target revision. The more "
4329 "history that a file accumulates, the more revisions you must read, hence the "
4330 "longer it takes to reconstruct a particular revision."
4331 msgstr ""
4333 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
4334 #: ../en/ch04-concepts.xml:193
4335 msgid "<imageobject><imagedata fileref=\"images/snapshot.png\"/></imageobject>"
4336 msgstr ""
4338 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
4339 #: ../en/ch04-concepts.xml:195
4340 msgid "Snapshot of a revlog, with incremental deltas"
4341 msgstr ""
4343 #. type: Content of: <book><chapter><sect1><sect2><para>
4344 #: ../en/ch04-concepts.xml:200
4345 msgid ""
4346 "The innovation that Mercurial applies to this problem is simple but "
4347 "effective. Once the cumulative amount of delta information stored since the "
4348 "last snapshot exceeds a fixed threshold, it stores a new snapshot "
4349 "(compressed, of course), instead of another delta. This makes it possible to "
4350 "reconstruct <emphasis>any</emphasis> revision of a file quickly. This "
4351 "approach works so well that it has since been copied by several other "
4352 "revision control systems."
4353 msgstr ""
4355 #. type: Content of: <book><chapter><sect1><sect2><para>
4356 #: ../en/ch04-concepts.xml:209
4357 msgid ""
4358 "Figure <xref endterm=\"fig.concepts.snapshot.caption\" linkend=\"fig.concepts."
4359 "snapshot\"/> illustrates the idea. In an entry in a revlog's index file, "
4360 "Mercurial stores the range of entries from the data file that it must read to "
4361 "reconstruct a particular revision."
4362 msgstr ""
4364 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
4365 #: ../en/ch04-concepts.xml:216
4366 msgid "Aside: the influence of video compression"
4367 msgstr ""
4369 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
4370 #: ../en/ch04-concepts.xml:218
4371 msgid ""
4372 "If you're familiar with video compression or have ever watched a TV feed "
4373 "through a digital cable or satellite service, you may know that most video "
4374 "compression schemes store each frame of video as a delta against its "
4375 "predecessor frame. In addition, these schemes use <quote>lossy</quote> "
4376 "compression techniques to increase the compression ratio, so visual errors "
4377 "accumulate over the course of a number of inter-frame deltas."
4378 msgstr ""
4380 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
4381 #: ../en/ch04-concepts.xml:227
4382 msgid ""
4383 "Because it's possible for a video stream to <quote>drop out</quote> "
4384 "occasionally due to signal glitches, and to limit the accumulation of "
4385 "artefacts introduced by the lossy compression process, video encoders "
4386 "periodically insert a complete frame (called a <quote>key frame</quote>) into "
4387 "the video stream; the next delta is generated against that frame. This means "
4388 "that if the video signal gets interrupted, it will resume once the next key "
4389 "frame is received. Also, the accumulation of encoding errors restarts anew "
4390 "with each key frame."
4391 msgstr ""
4393 #. type: Content of: <book><chapter><sect1><sect2><title>
4394 #: ../en/ch04-concepts.xml:241
4395 msgid "Identification and strong integrity"
4396 msgstr "鉴别和强完整性"
4398 #. type: Content of: <book><chapter><sect1><sect2><para>
4399 #: ../en/ch04-concepts.xml:243
4400 msgid ""
4401 "Along with delta or snapshot information, a revlog entry contains a "
4402 "cryptographic hash of the data that it represents. This makes it difficult "
4403 "to forge the contents of a revision, and easy to detect accidental corruption."
4404 msgstr ""
4406 #. type: Content of: <book><chapter><sect1><sect2><para>
4407 #: ../en/ch04-concepts.xml:248
4408 msgid ""
4409 "Hashes provide more than a mere check against corruption; they are used as "
4410 "the identifiers for revisions. The changeset identification hashes that you "
4411 "see as an end user are from revisions of the changelog. Although filelogs "
4412 "and the manifest also use hashes, Mercurial only uses these behind the scenes."
4413 msgstr ""
4415 #. type: Content of: <book><chapter><sect1><sect2><para>
4416 #: ../en/ch04-concepts.xml:255
4417 msgid ""
4418 "Mercurial verifies that hashes are correct when it retrieves file revisions "
4419 "and when it pulls changes from another repository. If it encounters an "
4420 "integrity problem, it will complain and stop whatever it's doing."
4421 msgstr ""
4423 #. type: Content of: <book><chapter><sect1><sect2><para>
4424 #: ../en/ch04-concepts.xml:260
4425 msgid ""
4426 "In addition to the effect it has on retrieval efficiency, Mercurial's use of "
4427 "periodic snapshots makes it more robust against partial data corruption. If "
4428 "a revlog becomes partly corrupted due to a hardware error or system bug, it's "
4429 "often possible to reconstruct some or most revisions from the uncorrupted "
4430 "sections of the revlog, both before and after the corrupted section. This "
4431 "would not be possible with a delta-only storage model."
4432 msgstr ""
4434 #. type: Content of: <book><chapter><sect1><title>
4435 #: ../en/ch04-concepts.xml:272
4436 msgid "Revision history, branching, and merging"
4437 msgstr "修订历史,分支与合并"
4439 #. type: Content of: <book><chapter><sect1><para>
4440 #: ../en/ch04-concepts.xml:274
4441 msgid ""
4442 "Every entry in a Mercurial revlog knows the identity of its immediate "
4443 "ancestor revision, usually referred to as its <emphasis>parent</emphasis>. "
4444 "In fact, a revision contains room for not one parent, but two. Mercurial "
4445 "uses a special hash, called the <quote>null ID</quote>, to represent the idea "
4446 "<quote>there is no parent here</quote>. This hash is simply a string of "
4447 "zeroes."
4448 msgstr ""
4450 #. type: Content of: <book><chapter><sect1><para>
4451 #: ../en/ch04-concepts.xml:282
4452 msgid ""
4453 "In figure <xref endterm=\"fig.concepts.revlog.caption\" linkend=\"fig."
4454 "concepts.revlog\"/>, you can see an example of the conceptual structure of a "
4455 "revlog. Filelogs, manifests, and changelogs all have this same structure; "
4456 "they differ only in the kind of data stored in each delta or snapshot."
4457 msgstr ""
4459 #. type: Content of: <book><chapter><sect1><para>
4460 #: ../en/ch04-concepts.xml:289
4461 msgid ""
4462 "The first revision in a revlog (at the bottom of the image) has the null ID "
4463 "in both of its parent slots. For a <quote>normal</quote> revision, its first "
4464 "parent slot contains the ID of its parent revision, and its second contains "
4465 "the null ID, indicating that the revision has only one real parent. Any two "
4466 "revisions that have the same parent ID are branches. A revision that "
4467 "represents a merge between branches has two normal revision IDs in its parent "
4468 "slots."
4469 msgstr ""
4471 #. type: Content of: <book><chapter><sect1><informalfigure><mediaobject>
4472 #: ../en/ch04-concepts.xml:300
4473 msgid "<imageobject><imagedata fileref=\"images/revlog.png\"/></imageobject>"
4474 msgstr ""
4476 #. type: Content of: <book><chapter><sect1><informalfigure><mediaobject><caption><para>
4477 #: ../en/ch04-concepts.xml:302
4478 msgid "Revision in revlog"
4479 msgstr ""
4481 #. type: Content of: <book><chapter><sect1><title>
4482 #: ../en/ch04-concepts.xml:309
4483 msgid "The working directory"
4484 msgstr "工作目录"
4486 #. type: Content of: <book><chapter><sect1><para>
4487 #: ../en/ch04-concepts.xml:311
4488 msgid ""
4489 "In the working directory, Mercurial stores a snapshot of the files from the "
4490 "repository as of a particular changeset."
4491 msgstr ""
4493 #. type: Content of: <book><chapter><sect1><para>
4494 #: ../en/ch04-concepts.xml:314
4495 msgid ""
4496 "The working directory <quote>knows</quote> which changeset it contains. When "
4497 "you update the working directory to contain a particular changeset, Mercurial "
4498 "looks up the appropriate revision of the manifest to find out which files it "
4499 "was tracking at the time that changeset was committed, and which revision of "
4500 "each file was then current. It then recreates a copy of each of those files, "
4501 "with the same contents it had when the changeset was committed."
4502 msgstr ""
4504 #. type: Content of: <book><chapter><sect1><para>
4505 #: ../en/ch04-concepts.xml:323
4506 msgid ""
4507 "The <emphasis>dirstate</emphasis> contains Mercurial's knowledge of the "
4508 "working directory. This details which changeset the working directory is "
4509 "updated to, and all of the files that Mercurial is tracking in the working "
4510 "directory."
4511 msgstr ""
4513 #. type: Content of: <book><chapter><sect1><para>
4514 #: ../en/ch04-concepts.xml:329
4515 msgid ""
4516 "Just as a revision of a revlog has room for two parents, so that it can "
4517 "represent either a normal revision (with one parent) or a merge of two "
4518 "earlier revisions, the dirstate has slots for two parents. When you use the "
4519 "<command role=\"hg-cmd\">hg update</command> command, the changeset that you "
4520 "update to is stored in the <quote>first parent</quote> slot, and the null ID "
4521 "in the second. When you <command role=\"hg-cmd\">hg merge</command> with "
4522 "another changeset, the first parent remains unchanged, and the second parent "
4523 "is filled in with the changeset you're merging with. The <command role=\"hg-"
4524 "cmd\">hg parents</command> command tells you what the parents of the dirstate "
4525 "are."
4526 msgstr ""
4528 #. type: Content of: <book><chapter><sect1><sect2><title>
4529 #: ../en/ch04-concepts.xml:343
4530 msgid "What happens when you commit"
4531 msgstr "当你提交时发生的事情"
4533 #. type: Content of: <book><chapter><sect1><sect2><para>
4534 #: ../en/ch04-concepts.xml:345
4535 msgid ""
4536 "The dirstate stores parent information for more than just book-keeping "
4537 "purposes. Mercurial uses the parents of the dirstate as <emphasis>the "
4538 "parents of a new changeset</emphasis> when you perform a commit."
4539 msgstr ""
4541 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
4542 #: ../en/ch04-concepts.xml:352
4543 msgid "<imageobject><imagedata fileref=\"images/wdir.png\"/></imageobject>"
4544 msgstr ""
4546 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
4547 #: ../en/ch04-concepts.xml:354
4548 msgid "The working directory can have two parents"
4549 msgstr ""
4551 #. type: Content of: <book><chapter><sect1><sect2><para>
4552 #: ../en/ch04-concepts.xml:359
4553 msgid ""
4554 "Figure <xref endterm=\"fig.concepts.wdir.caption\" linkend=\"fig.concepts.wdir"
4555 "\"/> shows the normal state of the working directory, where it has a single "
4556 "changeset as parent. That changeset is the <emphasis>tip</emphasis>, the "
4557 "newest changeset in the repository that has no children."
4558 msgstr ""
4560 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
4561 #: ../en/ch04-concepts.xml:368
4562 msgid ""
4563 "<imageobject><imagedata fileref=\"images/wdir-after-commit.png\"/> </"
4564 "imageobject>"
4565 msgstr ""
4567 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
4568 #: ../en/ch04-concepts.xml:371
4569 msgid "The working directory gains new parents after a commit"
4570 msgstr ""
4572 #. type: Content of: <book><chapter><sect1><sect2><para>
4573 #: ../en/ch04-concepts.xml:376
4574 msgid ""
4575 "It's useful to think of the working directory as <quote>the changeset I'm "
4576 "about to commit</quote>. Any files that you tell Mercurial that you've "
4577 "added, removed, renamed, or copied will be reflected in that changeset, as "
4578 "will modifications to any files that Mercurial is already tracking; the new "
4579 "changeset will have the parents of the working directory as its parents."
4580 msgstr ""
4582 #. type: Content of: <book><chapter><sect1><sect2><para>
4583 #: ../en/ch04-concepts.xml:384
4584 msgid ""
4585 "After a commit, Mercurial will update the parents of the working directory, "
4586 "so that the first parent is the ID of the new changeset, and the second is "
4587 "the null ID. This is shown in figure <xref endterm=\"fig.concepts.wdir-after-"
4588 "commit.caption\" linkend=\"fig.concepts.wdir-after-commit\"/>. Mercurial "
4589 "doesn't touch any of the files in the working directory when you commit; it "
4590 "just modifies the dirstate to note its new parents."
4591 msgstr ""
4593 #. type: Content of: <book><chapter><sect1><sect2><title>
4594 #: ../en/ch04-concepts.xml:396
4595 msgid "Creating a new head"
4596 msgstr "创建新顶点"
4598 #. type: Content of: <book><chapter><sect1><sect2><para>
4599 #: ../en/ch04-concepts.xml:398
4600 msgid ""
4601 "It's perfectly normal to update the working directory to a changeset other "
4602 "than the current tip. For example, you might want to know what your project "
4603 "looked like last Tuesday, or you could be looking through changesets to see "
4604 "which one introduced a bug. In cases like this, the natural thing to do is "
4605 "update the working directory to the changeset you're interested in, and then "
4606 "examine the files in the working directory directly to see their contents as "
4607 "they were when you committed that changeset. The effect of this is shown in "
4608 "figure <xref endterm=\"fig.concepts.wdir-pre-branch.caption\" linkend=\"fig."
4609 "concepts.wdir-pre-branch\"/>."
4610 msgstr ""
4612 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
4613 #: ../en/ch04-concepts.xml:412
4614 msgid ""
4615 "<imageobject><imagedata fileref=\"images/wdir-pre-branch.png\"/> </"
4616 "imageobject>"
4617 msgstr ""
4619 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
4620 #: ../en/ch04-concepts.xml:415
4621 msgid "The working directory, updated to an older changeset"
4622 msgstr ""
4624 #. type: Content of: <book><chapter><sect1><sect2><para>
4625 #: ../en/ch04-concepts.xml:420
4626 msgid ""
4627 "Having updated the working directory to an older changeset, what happens if "
4628 "you make some changes, and then commit? Mercurial behaves in the same way as "
4629 "I outlined above. The parents of the working directory become the parents of "
4630 "the new changeset. This new changeset has no children, so it becomes the new "
4631 "tip. And the repository now contains two changesets that have no children; "
4632 "we call these <emphasis>heads</emphasis>. You can see the structure that "
4633 "this creates in figure <xref endterm=\"fig.concepts.wdir-branch.caption\" "
4634 "linkend=\"fig.concepts.wdir-branch\"/>."
4635 msgstr ""
4637 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
4638 #: ../en/ch04-concepts.xml:434
4639 msgid ""
4640 "<imageobject><imagedata fileref=\"images/wdir-branch.png\"/> </imageobject>"
4641 msgstr ""
4643 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
4644 #: ../en/ch04-concepts.xml:437
4645 msgid "After a commit made while synced to an older changeset"
4646 msgstr ""
4648 #. type: Content of: <book><chapter><sect1><sect2><note><para>
4649 #: ../en/ch04-concepts.xml:443
4650 msgid ""
4651 "If you're new to Mercurial, you should keep in mind a common <quote>error</"
4652 "quote>, which is to use the <command role=\"hg-cmd\">hg pull</command> "
4653 "command without any options. By default, the <command role=\"hg-cmd\">hg "
4654 "pull</command> command <emphasis>does not</emphasis> update the working "
4655 "directory, so you'll bring new changesets into your repository, but the "
4656 "working directory will stay synced at the same changeset as before the pull. "
4657 "If you make some changes and commit afterwards, you'll thus create a new "
4658 "head, because your working directory isn't synced to whatever the current tip "
4659 "is."
4660 msgstr ""
4662 #. type: Content of: <book><chapter><sect1><sect2><note><para>
4663 #: ../en/ch04-concepts.xml:455
4664 msgid ""
4665 "I put the word <quote>error</quote> in quotes because all that you need to do "
4666 "to rectify this situation is <command role=\"hg-cmd\">hg merge</command>, "
4667 "then <command role=\"hg-cmd\">hg commit</command>. In other words, this "
4668 "almost never has negative consequences; it just surprises people. I'll "
4669 "discuss other ways to avoid this behaviour, and why Mercurial behaves in this "
4670 "initially surprising way, later on."
4671 msgstr ""
4673 #. type: Content of: <book><chapter><sect1><sect2><title>
4674 #: ../en/ch04-concepts.xml:467
4675 msgid "Merging heads"
4676 msgstr "合并顶点"
4678 #. type: Content of: <book><chapter><sect1><sect2><para>
4679 #: ../en/ch04-concepts.xml:469
4680 msgid ""
4681 "When you run the <command role=\"hg-cmd\">hg merge</command> command, "
4682 "Mercurial leaves the first parent of the working directory unchanged, and "
4683 "sets the second parent to the changeset you're merging with, as shown in "
4684 "figure <xref endterm=\"fig.concepts.wdir-merge.caption\" linkend=\"fig."
4685 "concepts.wdir-merge\"/>."
4686 msgstr ""
4688 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
4689 #: ../en/ch04-concepts.xml:478
4690 msgid ""
4691 "<imageobject><imagedata fileref=\"images/wdir-merge.png\"/> </imageobject>"
4692 msgstr ""
4694 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
4695 #: ../en/ch04-concepts.xml:481
4696 msgid "Merging two heads"
4697 msgstr ""
4699 #. type: Content of: <book><chapter><sect1><sect2><para>
4700 #: ../en/ch04-concepts.xml:486
4701 msgid ""
4702 "Mercurial also has to modify the working directory, to merge the files "
4703 "managed in the two changesets. Simplified a little, the merging process goes "
4704 "like this, for every file in the manifests of both changesets."
4705 msgstr ""
4707 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
4708 #: ../en/ch04-concepts.xml:491
4709 msgid "If neither changeset has modified a file, do nothing with that file."
4710 msgstr ""
4712 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
4713 #: ../en/ch04-concepts.xml:494
4714 msgid ""
4715 "If one changeset has modified a file, and the other hasn't, create the "
4716 "modified copy of the file in the working directory."
4717 msgstr ""
4719 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
4720 #: ../en/ch04-concepts.xml:498
4721 msgid ""
4722 "If one changeset has removed a file, and the other hasn't (or has also "
4723 "deleted it), delete the file from the working directory."
4724 msgstr ""
4726 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
4727 #: ../en/ch04-concepts.xml:502
4728 msgid ""
4729 "If one changeset has removed a file, but the other has modified the file, ask "
4730 "the user what to do: keep the modified file, or remove it?"
4731 msgstr ""
4733 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
4734 #: ../en/ch04-concepts.xml:506
4735 msgid ""
4736 "If both changesets have modified a file, invoke an external merge program to "
4737 "choose the new contents for the merged file. This may require input from the "
4738 "user."
4739 msgstr ""
4741 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
4742 #: ../en/ch04-concepts.xml:511
4743 msgid ""
4744 "If one changeset has modified a file, and the other has renamed or copied the "
4745 "file, make sure that the changes follow the new name of the file."
4746 msgstr ""
4748 #. type: Content of: <book><chapter><sect1><sect2><para>
4749 #: ../en/ch04-concepts.xml:515
4750 msgid ""
4751 "There are more details&emdash;merging has plenty of corner cases&emdash;but "
4752 "these are the most common choices that are involved in a merge. As you can "
4753 "see, most cases are completely automatic, and indeed most merges finish "
4754 "automatically, without requiring your input to resolve any conflicts."
4755 msgstr ""
4757 #. type: Content of: <book><chapter><sect1><sect2><para>
4758 #: ../en/ch04-concepts.xml:522
4759 msgid ""
4760 "When you're thinking about what happens when you commit after a merge, once "
4761 "again the working directory is <quote>the changeset I'm about to commit</"
4762 "quote>. After the <command role=\"hg-cmd\">hg merge</command> command "
4763 "completes, the working directory has two parents; these will become the "
4764 "parents of the new changeset."
4765 msgstr ""
4767 #. type: Content of: <book><chapter><sect1><sect2><para>
4768 #: ../en/ch04-concepts.xml:529
4769 msgid ""
4770 "Mercurial lets you perform multiple merges, but you must commit the results "
4771 "of each individual merge as you go. This is necessary because Mercurial only "
4772 "tracks two parents for both revisions and the working directory. While it "
4773 "would be technically possible to merge multiple changesets at once, the "
4774 "prospect of user confusion and making a terrible mess of a merge immediately "
4775 "becomes overwhelming."
4776 msgstr ""
4778 #. type: Content of: <book><chapter><sect1><title>
4779 #: ../en/ch04-concepts.xml:540
4780 msgid "Other interesting design features"
4781 msgstr "其它有趣的设计特性"
4783 #. type: Content of: <book><chapter><sect1><para>
4784 #: ../en/ch04-concepts.xml:542
4785 msgid ""
4786 "In the sections above, I've tried to highlight some of the most important "
4787 "aspects of Mercurial's design, to illustrate that it pays careful attention "
4788 "to reliability and performance. However, the attention to detail doesn't "
4789 "stop there. There are a number of other aspects of Mercurial's construction "
4790 "that I personally find interesting. I'll detail a few of them here, separate "
4791 "from the <quote>big ticket</quote> items above, so that if you're interested, "
4792 "you can gain a better idea of the amount of thinking that goes into a well-"
4793 "designed system."
4794 msgstr ""
4796 #. type: Content of: <book><chapter><sect1><sect2><title>
4797 #: ../en/ch04-concepts.xml:553
4798 msgid "Clever compression"
4799 msgstr "智能压缩"
4801 #. type: Content of: <book><chapter><sect1><sect2><para>
4802 #: ../en/ch04-concepts.xml:555
4803 msgid ""
4804 "When appropriate, Mercurial will store both snapshots and deltas in "
4805 "compressed form. It does this by always <emphasis>trying to</emphasis> "
4806 "compress a snapshot or delta, but only storing the compressed version if it's "
4807 "smaller than the uncompressed version."
4808 msgstr ""
4810 #. type: Content of: <book><chapter><sect1><sect2><para>
4811 #: ../en/ch04-concepts.xml:561
4812 msgid ""
4813 "This means that Mercurial does <quote>the right thing</quote> when storing a "
4814 "file whose native form is compressed, such as a <literal>zip</literal> "
4815 "archive or a JPEG image. When these types of files are compressed a second "
4816 "time, the resulting file is usually bigger than the once-compressed form, and "
4817 "so Mercurial will store the plain <literal>zip</literal> or JPEG."
4818 msgstr ""
4820 #. type: Content of: <book><chapter><sect1><sect2><para>
4821 #: ../en/ch04-concepts.xml:569
4822 msgid ""
4823 "Deltas between revisions of a compressed file are usually larger than "
4824 "snapshots of the file, and Mercurial again does <quote>the right thing</"
4825 "quote> in these cases. It finds that such a delta exceeds the threshold at "
4826 "which it should store a complete snapshot of the file, so it stores the "
4827 "snapshot, again saving space compared to a naive delta-only approach."
4828 msgstr ""
4830 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
4831 #: ../en/ch04-concepts.xml:578
4832 msgid "Network recompression"
4833 msgstr "网络重新压缩"
4835 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
4836 #: ../en/ch04-concepts.xml:580
4837 msgid ""
4838 "When storing revisions on disk, Mercurial uses the <quote>deflate</quote> "
4839 "compression algorithm (the same one used by the popular <literal>zip</"
4840 "literal> archive format), which balances good speed with a respectable "
4841 "compression ratio. However, when transmitting revision data over a network "
4842 "connection, Mercurial uncompresses the compressed revision data."
4843 msgstr ""
4845 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
4846 #: ../en/ch04-concepts.xml:588
4847 msgid ""
4848 "If the connection is over HTTP, Mercurial recompresses the entire stream of "
4849 "data using a compression algorithm that gives a better compression ratio (the "
4850 "Burrows-Wheeler algorithm from the widely used <literal>bzip2</literal> "
4851 "compression package). This combination of algorithm and compression of the "
4852 "entire stream (instead of a revision at a time) substantially reduces the "
4853 "number of bytes to be transferred, yielding better network performance over "
4854 "almost all kinds of network."
4855 msgstr ""
4857 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
4858 #: ../en/ch04-concepts.xml:598
4859 msgid ""
4860 "(If the connection is over <command>ssh</command>, Mercurial "
4861 "<emphasis>doesn't</emphasis> recompress the stream, because <command>ssh</"
4862 "command> can already do this itself.)"
4863 msgstr ""
4865 #. type: Content of: <book><chapter><sect1><sect2><title>
4866 #: ../en/ch04-concepts.xml:606
4867 msgid "Read/write ordering and atomicity"
4868 msgstr "读写顺序与原子性"
4870 #. type: Content of: <book><chapter><sect1><sect2><para>
4871 #: ../en/ch04-concepts.xml:608
4872 msgid ""
4873 "Appending to files isn't the whole story when it comes to guaranteeing that a "
4874 "reader won't see a partial write. If you recall figure <xref endterm=\"fig."
4875 "concepts.metadata.caption\" linkend=\"fig.concepts.metadata\"/>, revisions in "
4876 "the changelog point to revisions in the manifest, and revisions in the "
4877 "manifest point to revisions in filelogs. This hierarchy is deliberate."
4878 msgstr ""
4880 #. type: Content of: <book><chapter><sect1><sect2><para>
4881 #: ../en/ch04-concepts.xml:616
4882 msgid ""
4883 "A writer starts a transaction by writing filelog and manifest data, and "
4884 "doesn't write any changelog data until those are finished. A reader starts "
4885 "by reading changelog data, then manifest data, followed by filelog data."
4886 msgstr ""
4888 #. type: Content of: <book><chapter><sect1><sect2><para>
4889 #: ../en/ch04-concepts.xml:621
4890 msgid ""
4891 "Since the writer has always finished writing filelog and manifest data before "
4892 "it writes to the changelog, a reader will never read a pointer to a partially "
4893 "written manifest revision from the changelog, and it will never read a "
4894 "pointer to a partially written filelog revision from the manifest."
4895 msgstr ""
4897 #. type: Content of: <book><chapter><sect1><sect2><title>
4898 #: ../en/ch04-concepts.xml:629
4899 msgid "Concurrent access"
4900 msgstr "并发访问"
4902 #. type: Content of: <book><chapter><sect1><sect2><para>
4903 #: ../en/ch04-concepts.xml:631
4904 msgid ""
4905 "The read/write ordering and atomicity guarantees mean that Mercurial never "
4906 "needs to <emphasis>lock</emphasis> a repository when it's reading data, even "
4907 "if the repository is being written to while the read is occurring. This has a "
4908 "big effect on scalability; you can have an arbitrary number of Mercurial "
4909 "processes safely reading data from a repository safely all at once, no matter "
4910 "whether it's being written to or not."
4911 msgstr ""
4913 #. type: Content of: <book><chapter><sect1><sect2><para>
4914 #: ../en/ch04-concepts.xml:640
4915 msgid ""
4916 "The lockless nature of reading means that if you're sharing a repository on a "
4917 "multi-user system, you don't need to grant other local users permission to "
4918 "<emphasis>write</emphasis> to your repository in order for them to be able to "
4919 "clone it or pull changes from it; they only need <emphasis>read</emphasis> "
4920 "permission. (This is <emphasis>not</emphasis> a common feature among "
4921 "revision control systems, so don't take it for granted! Most require readers "
4922 "to be able to lock a repository to access it safely, and this requires write "
4923 "permission on at least one directory, which of course makes for all kinds of "
4924 "nasty and annoying security and administrative problems.)"
4925 msgstr ""
4927 #. type: Content of: <book><chapter><sect1><sect2><para>
4928 #: ../en/ch04-concepts.xml:653
4929 msgid ""
4930 "Mercurial uses locks to ensure that only one process can write to a "
4931 "repository at a time (the locking mechanism is safe even over filesystems "
4932 "that are notoriously hostile to locking, such as NFS). If a repository is "
4933 "locked, a writer will wait for a while to retry if the repository becomes "
4934 "unlocked, but if the repository remains locked for too long, the process "
4935 "attempting to write will time out after a while. This means that your daily "
4936 "automated scripts won't get stuck forever and pile up if a system crashes "
4937 "unnoticed, for example. (Yes, the timeout is configurable, from zero to "
4938 "infinity.)"
4939 msgstr ""
4941 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
4942 #: ../en/ch04-concepts.xml:665
4943 msgid "Safe dirstate access"
4944 msgstr "安全的目录状态访问"
4946 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
4947 #: ../en/ch04-concepts.xml:667
4948 msgid ""
4949 "As with revision data, Mercurial doesn't take a lock to read the dirstate "
4950 "file; it does acquire a lock to write it. To avoid the possibility of "
4951 "reading a partially written copy of the dirstate file, Mercurial writes to a "
4952 "file with a unique name in the same directory as the dirstate file, then "
4953 "renames the temporary file atomically to <filename>dirstate</filename>. The "
4954 "file named <filename>dirstate</filename> is thus guaranteed to be complete, "
4955 "not partially written."
4956 msgstr ""
4958 #. type: Content of: <book><chapter><sect1><sect2><title>
4959 #: ../en/ch04-concepts.xml:680
4960 msgid "Avoiding seeks"
4961 msgstr "避免查找"
4963 #. type: Content of: <book><chapter><sect1><sect2><para>
4964 #: ../en/ch04-concepts.xml:682
4965 msgid ""
4966 "Critical to Mercurial's performance is the avoidance of seeks of the disk "
4967 "head, since any seek is far more expensive than even a comparatively large "
4968 "read operation."
4969 msgstr ""
4971 #. type: Content of: <book><chapter><sect1><sect2><para>
4972 #: ../en/ch04-concepts.xml:686
4973 msgid ""
4974 "This is why, for example, the dirstate is stored in a single file. If there "
4975 "were a dirstate file per directory that Mercurial tracked, the disk would "
4976 "seek once per directory. Instead, Mercurial reads the entire single dirstate "
4977 "file in one step."
4978 msgstr ""
4980 #. type: Content of: <book><chapter><sect1><sect2><para>
4981 #: ../en/ch04-concepts.xml:692
4982 msgid ""
4983 "Mercurial also uses a <quote>copy on write</quote> scheme when cloning a "
4984 "repository on local storage. Instead of copying every revlog file from the "
4985 "old repository into the new repository, it makes a <quote>hard link</quote>, "
4986 "which is a shorthand way to say <quote>these two names point to the same "
4987 "file</quote>. When Mercurial is about to write to one of a revlog's files, "
4988 "it checks to see if the number of names pointing at the file is greater than "
4989 "one. If it is, more than one repository is using the file, so Mercurial "
4990 "makes a new copy of the file that is private to this repository."
4991 msgstr ""
4993 #. type: Content of: <book><chapter><sect1><sect2><para>
4994 #: ../en/ch04-concepts.xml:703
4995 msgid ""
4996 "A few revision control developers have pointed out that this idea of making a "
4997 "complete private copy of a file is not very efficient in its use of storage. "
4998 "While this is true, storage is cheap, and this method gives the highest "
4999 "performance while deferring most book-keeping to the operating system. An "
5000 "alternative scheme would most likely reduce performance and increase the "
5001 "complexity of the software, each of which is much more important to the "
5002 "<quote>feel</quote> of day-to-day use."
5003 msgstr ""
5005 #. type: Content of: <book><chapter><sect1><sect2><title>
5006 #: ../en/ch04-concepts.xml:715
5007 msgid "Other contents of the dirstate"
5008 msgstr "目录状态的其它内容"
5010 #. type: Content of: <book><chapter><sect1><sect2><para>
5011 #: ../en/ch04-concepts.xml:717
5012 msgid ""
5013 "Because Mercurial doesn't force you to tell it when you're modifying a file, "
5014 "it uses the dirstate to store some extra information so it can determine "
5015 "efficiently whether you have modified a file. For each file in the working "
5016 "directory, it stores the time that it last modified the file itself, and the "
5017 "size of the file at that time."
5018 msgstr ""
5020 #. type: Content of: <book><chapter><sect1><sect2><para>
5021 #: ../en/ch04-concepts.xml:724
5022 msgid ""
5023 "When you explicitly <command role=\"hg-cmd\">hg add</command>, <command role="
5024 "\"hg-cmd\">hg remove</command>, <command role=\"hg-cmd\">hg rename</command> "
5025 "or <command role=\"hg-cmd\">hg copy</command> files, Mercurial updates the "
5026 "dirstate so that it knows what to do with those files when you commit."
5027 msgstr ""
5029 #. type: Content of: <book><chapter><sect1><sect2><para>
5030 #: ../en/ch04-concepts.xml:731
5031 msgid ""
5032 "When Mercurial is checking the states of files in the working directory, it "
5033 "first checks a file's modification time. If that has not changed, the file "
5034 "must not have been modified. If the file's size has changed, the file must "
5035 "have been modified. If the modification time has changed, but the size has "
5036 "not, only then does Mercurial need to read the actual contents of the file to "
5037 "see if they've changed. Storing these few extra pieces of information "
5038 "dramatically reduces the amount of data that Mercurial needs to read, which "
5039 "yields large performance improvements compared to other revision control "
5040 "systems."
5041 msgstr ""
5043 #. type: Content of: <book><chapter><title>
5044 #: ../en/ch05-daily.xml:5
5045 msgid "Mercurial in daily use"
5046 msgstr "Mercurial 的日常使用"
5048 #. type: Content of: <book><chapter><sect1><title>
5049 #: ../en/ch05-daily.xml:8
5050 msgid "Telling Mercurial which files to track"
5051 msgstr "告诉 Mercurial 要跟踪哪些文件"
5053 #. type: Content of: <book><chapter><sect1><para>
5054 #: ../en/ch05-daily.xml:10
5055 msgid ""
5056 "Mercurial does not work with files in your repository unless you tell it to "
5057 "manage them. The <command role=\"hg-cmd\">hg status</command> command will "
5058 "tell you which files Mercurial doesn't know about; it uses a <quote><literal>?"
5059 "</literal></quote> to display such files."
5060 msgstr ""
5063 #. type: Content of: <book><chapter><sect1><para>
5064 #: ../en/ch05-daily.xml:17
5065 msgid ""
5066 "To tell Mercurial to track a file, use the <command role=\"hg-cmd\">hg add</"
5067 "command> command. Once you have added a file, the entry in the output of "
5068 "<command role=\"hg-cmd\">hg status</command> for that file changes from "
5069 "<quote><literal>?</literal></quote> to <quote><literal>A</literal></quote>."
5070 msgstr ""
5072 #. type: Content of: <book><chapter><sect1><para>
5073 #: ../en/ch05-daily.xml:26
5074 msgid ""
5075 "After you run a <command role=\"hg-cmd\">hg commit</command>, the files that "
5076 "you added before the commit will no longer be listed in the output of "
5077 "<command role=\"hg-cmd\">hg status</command>. The reason for this is that "
5078 "<command role=\"hg-cmd\">hg status</command> only tells you about "
5079 "<quote>interesting</quote> files&emdash;those that you have modified or told "
5080 "Mercurial to do something with&emdash;by default. If you have a repository "
5081 "that contains thousands of files, you will rarely want to know about files "
5082 "that Mercurial is tracking, but that have not changed. (You can still get "
5083 "this information; we'll return to this later.)"
5084 msgstr ""
5086 #. type: Content of: <book><chapter><sect1><para>
5087 #: ../en/ch05-daily.xml:38
5088 msgid ""
5089 "Once you add a file, Mercurial doesn't do anything with it immediately. "
5090 "Instead, it will take a snapshot of the file's state the next time you "
5091 "perform a commit. It will then continue to track the changes you make to the "
5092 "file every time you commit, until you remove the file."
5093 msgstr ""
5095 #. type: Content of: <book><chapter><sect1><sect2><title>
5096 #: ../en/ch05-daily.xml:45
5097 msgid "Explicit versus implicit file naming"
5098 msgstr "明确与隐含文件命名"
5100 #. type: Content of: <book><chapter><sect1><sect2><para>
5101 #: ../en/ch05-daily.xml:47
5102 msgid ""
5103 "A useful behaviour that Mercurial has is that if you pass the name of a "
5104 "directory to a command, every Mercurial command will treat this as <quote>I "
5105 "want to operate on every file in this directory and its subdirectories</"
5106 "quote>."
5107 msgstr ""
5109 #. type: Content of: <book><chapter><sect1><sect2><para>
5110 #: ../en/ch05-daily.xml:54
5111 msgid ""
5112 "Notice in this example that Mercurial printed the names of the files it "
5113 "added, whereas it didn't do so when we added the file named <filename>a</"
5114 "filename> in the earlier example."
5115 msgstr ""
5117 #. type: Content of: <book><chapter><sect1><sect2><para>
5118 #: ../en/ch05-daily.xml:59
5119 msgid ""
5120 "What's going on is that in the former case, we explicitly named the file to "
5121 "add on the command line, so the assumption that Mercurial makes in such cases "
5122 "is that you know what you were doing, and it doesn't print any output."
5123 msgstr ""
5125 #. type: Content of: <book><chapter><sect1><sect2><para>
5126 #: ../en/ch05-daily.xml:64
5127 msgid ""
5128 "However, when we <emphasis>imply</emphasis> the names of files by giving the "
5129 "name of a directory, Mercurial takes the extra step of printing the name of "
5130 "each file that it does something with. This makes it more clear what is "
5131 "happening, and reduces the likelihood of a silent and nasty surprise. This "
5132 "behaviour is common to most Mercurial commands."
5133 msgstr ""
5135 #. type: Content of: <book><chapter><sect1><sect2><title>
5136 #: ../en/ch05-daily.xml:73
5137 msgid "Aside: Mercurial tracks files, not directories"
5138 msgstr "旁白: Mercurial 只跟踪文件,不跟踪目录"
5140 #. type: Content of: <book><chapter><sect1><sect2><para>
5141 #: ../en/ch05-daily.xml:75
5142 msgid ""
5143 "Mercurial does not track directory information. Instead, it tracks the path "
5144 "to a file. Before creating a file, it first creates any missing directory "
5145 "components of the path. After it deletes a file, it then deletes any empty "
5146 "directories that were in the deleted file's path. This sounds like a trivial "
5147 "distinction, but it has one minor practical consequence: it is not possible "
5148 "to represent a completely empty directory in Mercurial."
5149 msgstr ""
5151 #. type: Content of: <book><chapter><sect1><sect2><para>
5152 #: ../en/ch05-daily.xml:84
5153 msgid ""
5154 "Empty directories are rarely useful, and there are unintrusive workarounds "
5155 "that you can use to achieve an appropriate effect. The developers of "
5156 "Mercurial thus felt that the complexity that would be required to manage "
5157 "empty directories was not worth the limited benefit this feature would bring."
5158 msgstr ""
5160 #. type: Content of: <book><chapter><sect1><sect2><para>
5161 #: ../en/ch05-daily.xml:91
5162 msgid ""
5163 "If you need an empty directory in your repository, there are a few ways to "
5164 "achieve this. One is to create a directory, then <command role=\"hg-cmd\">hg "
5165 "add</command> a <quote>hidden</quote> file to that directory. On Unix-like "
5166 "systems, any file name that begins with a period (<quote><literal>.</"
5167 "literal></quote>) is treated as hidden by most commands and GUI tools. This "
5168 "approach is illustrated below."
5169 msgstr ""
5171 #. type: Content of: <book><chapter><sect1><sect2><para>
5172 #: ../en/ch05-daily.xml:102
5173 msgid ""
5174 "Another way to tackle a need for an empty directory is to simply create one "
5175 "in your automated build scripts before they will need it."
5176 msgstr ""
5178 #. type: Content of: <book><chapter><sect1><title>
5179 #: ../en/ch05-daily.xml:109
5180 msgid "How to stop tracking a file"
5181 msgstr "如何停止跟踪文件"
5184 #. type: Content of: <book><chapter><sect1><para>
5185 #: ../en/ch05-daily.xml:111
5186 msgid ""
5187 "Once you decide that a file no longer belongs in your repository, use the "
5188 "<command role=\"hg-cmd\">hg remove</command> command; this deletes the file, "
5189 "and tells Mercurial to stop tracking it. A removed file is represented in "
5190 "the output of <command role=\"hg-cmd\">hg status</command> with a "
5191 "<quote><literal>R</literal></quote>."
5192 msgstr ""
5194 #. type: Content of: <book><chapter><sect1><para>
5195 #: ../en/ch05-daily.xml:120
5196 msgid ""
5197 "After you <command role=\"hg-cmd\">hg remove</command> a file, Mercurial will "
5198 "no longer track changes to that file, even if you recreate a file with the "
5199 "same name in your working directory. If you do recreate a file with the same "
5200 "name and want Mercurial to track the new file, simply <command role=\"hg-cmd"
5201 "\">hg add</command> it. Mercurial will know that the newly added file is not "
5202 "related to the old file of the same name."
5203 msgstr ""
5205 #. type: Content of: <book><chapter><sect1><sect2><title>
5206 #: ../en/ch05-daily.xml:129
5207 msgid "Removing a file does not affect its history"
5208 msgstr "删除文件不影响历史"
5210 #. type: Content of: <book><chapter><sect1><sect2><para>
5211 #: ../en/ch05-daily.xml:131
5212 msgid "It is important to understand that removing a file has only two effects."
5213 msgstr ""
5215 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
5216 #: ../en/ch05-daily.xml:134
5217 msgid "It removes the current version of the file from the working directory."
5218 msgstr ""
5220 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
5221 #: ../en/ch05-daily.xml:137
5222 msgid ""
5223 "It stops Mercurial from tracking changes to the file, from the time of the "
5224 "next commit."
5225 msgstr ""
5227 #. type: Content of: <book><chapter><sect1><sect2><para>
5228 #: ../en/ch05-daily.xml:140
5229 msgid ""
5230 "Removing a file <emphasis>does not</emphasis> in any way alter the "
5231 "<emphasis>history</emphasis> of the file."
5232 msgstr ""
5234 #. type: Content of: <book><chapter><sect1><sect2><para>
5235 #: ../en/ch05-daily.xml:143
5236 msgid ""
5237 "If you update the working directory to a changeset in which a file that you "
5238 "have removed was still tracked, it will reappear in the working directory, "
5239 "with the contents it had when you committed that changeset. If you then "
5240 "update the working directory to a later changeset, in which the file had been "
5241 "removed, Mercurial will once again remove the file from the working directory."
5242 msgstr ""
5244 #. type: Content of: <book><chapter><sect1><sect2><title>
5245 #: ../en/ch05-daily.xml:153
5246 msgid "Missing files"
5247 msgstr "丢失的文件"
5249 #. type: Content of: <book><chapter><sect1><sect2><para>
5250 #: ../en/ch05-daily.xml:155
5251 msgid ""
5252 "Mercurial considers a file that you have deleted, but not used <command role="
5253 "\"hg-cmd\">hg remove</command> to delete, to be <emphasis>missing</"
5254 "emphasis>. A missing file is represented with <quote><literal>!</literal></"
5255 "quote> in the output of <command role=\"hg-cmd\">hg status</command>. "
5256 "Mercurial commands will not generally do anything with missing files."
5257 msgstr ""
5259 #. type: Content of: <book><chapter><sect1><sect2><para>
5260 #: ../en/ch05-daily.xml:165
5261 msgid ""
5262 "If your repository contains a file that <command role=\"hg-cmd\">hg status</"
5263 "command> reports as missing, and you want the file to stay gone, you can run "
5264 "<command role=\"hg-cmd\">hg remove <option role=\"hg-opt-remove\">--after</"
5265 "option></command> at any time later on, to tell Mercurial that you really did "
5266 "mean to remove the file."
5267 msgstr ""
5269 #. type: Content of: <book><chapter><sect1><sect2><para>
5270 #: ../en/ch05-daily.xml:175
5271 msgid ""
5272 "On the other hand, if you deleted the missing file by accident, give <command "
5273 "role=\"hg-cmd\">hg revert</command> the name of the file to recover. It will "
5274 "reappear, in unmodified form."
5275 msgstr ""
5277 #. type: Content of: <book><chapter><sect1><sect2><title>
5278 #: ../en/ch05-daily.xml:184
5279 msgid "Aside: why tell Mercurial explicitly to remove a file?"
5280 msgstr "旁白: 为什么要明确告诉 Mercurial 删除文件?"
5282 #. type: Content of: <book><chapter><sect1><sect2><para>
5283 #: ../en/ch05-daily.xml:187
5284 msgid ""
5285 "You might wonder why Mercurial requires you to explicitly tell it that you "
5286 "are deleting a file. Early during the development of Mercurial, it let you "
5287 "delete a file however you pleased; Mercurial would notice the absence of the "
5288 "file automatically when you next ran a <command role=\"hg-cmd\">hg commit</"
5289 "command>, and stop tracking the file. In practice, this made it too easy to "
5290 "accidentally remove a file without noticing."
5291 msgstr ""
5293 #. type: Content of: <book><chapter><sect1><sect2><title>
5294 #: ../en/ch05-daily.xml:198
5295 msgid "Useful shorthand&emdash;adding and removing files in one step"
5296 msgstr "有用的速记&emdash;一个步骤添加和删除文件"
5298 #. type: Content of: <book><chapter><sect1><sect2><para>
5299 #: ../en/ch05-daily.xml:201
5300 msgid ""
5301 "Mercurial offers a combination command, <command role=\"hg-cmd\">hg "
5302 "addremove</command>, that adds untracked files and marks missing files as "
5303 "removed."
5304 msgstr ""
5306 #. type: Content of: <book><chapter><sect1><sect2><para>
5307 #: ../en/ch05-daily.xml:207
5308 msgid ""
5309 "The <command role=\"hg-cmd\">hg commit</command> command also provides a "
5310 "<option role=\"hg-opt-commit\">-A</option> option that performs this same add-"
5311 "and-remove, immediately followed by a commit."
5312 msgstr ""
5314 #. type: Content of: <book><chapter><sect1><title>
5315 #: ../en/ch05-daily.xml:217
5316 msgid "Copying files"
5317 msgstr "复制文件"
5319 #. type: Content of: <book><chapter><sect1><para>
5320 #: ../en/ch05-daily.xml:219
5321 msgid ""
5322 "Mercurial provides a <command role=\"hg-cmd\">hg copy</command> command that "
5323 "lets you make a new copy of a file. When you copy a file using this command, "
5324 "Mercurial makes a record of the fact that the new file is a copy of the "
5325 "original file. It treats these copied files specially when you merge your "
5326 "work with someone else's."
5327 msgstr ""
5329 #. type: Content of: <book><chapter><sect1><sect2><title>
5330 #: ../en/ch05-daily.xml:227
5331 msgid "The results of copying during a merge"
5332 msgstr "合并期间的复制结果"
5334 #. type: Content of: <book><chapter><sect1><sect2><para>
5335 #: ../en/ch05-daily.xml:229
5336 msgid ""
5337 "What happens during a merge is that changes <quote>follow</quote> a copy. To "
5338 "best illustrate what this means, let's create an example. We'll start with "
5339 "the usual tiny repository that contains a single file."
5340 msgstr ""
5342 #. type: Content of: <book><chapter><sect1><sect2><para>
5343 #: ../en/ch05-daily.xml:236
5344 msgid ""
5345 "We need to do some work in parallel, so that we'll have something to merge. "
5346 "So let's clone our repository."
5347 msgstr ""
5349 #. type: Content of: <book><chapter><sect1><sect2><para>
5350 #: ../en/ch05-daily.xml:242
5351 msgid ""
5352 "Back in our initial repository, let's use the <command role=\"hg-cmd\">hg "
5353 "copy</command> command to make a copy of the first file we created."
5354 msgstr ""
5356 #. type: Content of: <book><chapter><sect1><sect2><para>
5357 #: ../en/ch05-daily.xml:248
5358 msgid ""
5359 "If we look at the output of the <command role=\"hg-cmd\">hg status</command> "
5360 "command afterwards, the copied file looks just like a normal added file."
5361 msgstr ""
5363 #. type: Content of: <book><chapter><sect1><sect2><para>
5364 #: ../en/ch05-daily.xml:254
5365 msgid ""
5366 "But if we pass the <option role=\"hg-opt-status\">-C</option> option to "
5367 "<command role=\"hg-cmd\">hg status</command>, it prints another line of "
5368 "output: this is the file that our newly-added file was copied <emphasis>from</"
5369 "emphasis>."
5370 msgstr ""
5372 #. type: Content of: <book><chapter><sect1><sect2><para>
5373 #: ../en/ch05-daily.xml:262
5374 msgid ""
5375 "Now, back in the repository we cloned, let's make a change in parallel. "
5376 "We'll add a line of content to the original file that we created."
5377 msgstr ""
5379 #. type: Content of: <book><chapter><sect1><sect2><para>
5380 #: ../en/ch05-daily.xml:268
5381 msgid ""
5382 "Now we have a modified <filename>file</filename> in this repository. When we "
5383 "pull the changes from the first repository, and merge the two heads, "
5384 "Mercurial will propagate the changes that we made locally to <filename>file</"
5385 "filename> into its copy, <filename>new-file</filename>."
5386 msgstr ""
5388 #. type: Content of: <book><chapter><sect1><sect2><title>
5389 #: ../en/ch05-daily.xml:278
5390 msgid "Why should changes follow copies?"
5391 msgstr "为什么复制后需要后续修改?"
5393 #. type: Content of: <book><chapter><sect1><sect2><para>
5394 #: ../en/ch05-daily.xml:280
5395 msgid ""
5396 "This behaviour, of changes to a file propagating out to copies of the file, "
5397 "might seem esoteric, but in most cases it's highly desirable."
5398 msgstr ""
5400 #. type: Content of: <book><chapter><sect1><sect2><para>
5401 #: ../en/ch05-daily.xml:284
5402 msgid ""
5403 "First of all, remember that this propagation <emphasis>only</emphasis> "
5404 "happens when you merge. So if you <command role=\"hg-cmd\">hg copy</command> "
5405 "a file, and subsequently modify the original file during the normal course of "
5406 "your work, nothing will happen."
5407 msgstr ""
5409 #. type: Content of: <book><chapter><sect1><sect2><para>
5410 #: ../en/ch05-daily.xml:290
5411 msgid ""
5412 "The second thing to know is that modifications will only propagate across a "
5413 "copy as long as the repository that you're pulling changes from "
5414 "<emphasis>doesn't know</emphasis> about the copy."
5415 msgstr ""
5417 #. type: Content of: <book><chapter><sect1><sect2><para>
5418 #: ../en/ch05-daily.xml:295
5419 msgid ""
5420 "The reason that Mercurial does this is as follows. Let's say I make an "
5421 "important bug fix in a source file, and commit my changes. Meanwhile, you've "
5422 "decided to <command role=\"hg-cmd\">hg copy</command> the file in your "
5423 "repository, without knowing about the bug or having seen the fix, and you "
5424 "have started hacking on your copy of the file."
5425 msgstr ""
5427 #. type: Content of: <book><chapter><sect1><sect2><para>
5428 #: ../en/ch05-daily.xml:302
5429 msgid ""
5430 "If you pulled and merged my changes, and Mercurial <emphasis>didn't</"
5431 "emphasis> propagate changes across copies, your source file would now contain "
5432 "the bug, and unless you remembered to propagate the bug fix by hand, the bug "
5433 "would <emphasis>remain</emphasis> in your copy of the file."
5434 msgstr ""
5436 #. type: Content of: <book><chapter><sect1><sect2><para>
5437 #: ../en/ch05-daily.xml:308
5438 msgid ""
5439 "By automatically propagating the change that fixed the bug from the original "
5440 "file to the copy, Mercurial prevents this class of problem. To my knowledge, "
5441 "Mercurial is the <emphasis>only</emphasis> revision control system that "
5442 "propagates changes across copies like this."
5443 msgstr ""
5445 #. type: Content of: <book><chapter><sect1><sect2><para>
5446 #: ../en/ch05-daily.xml:314
5447 msgid ""
5448 "Once your change history has a record that the copy and subsequent merge "
5449 "occurred, there's usually no further need to propagate changes from the "
5450 "original file to the copied file, and that's why Mercurial only propagates "
5451 "changes across copies until this point, and no further."
5452 msgstr ""
5454 #. type: Content of: <book><chapter><sect1><sect2><title>
5455 #: ../en/ch05-daily.xml:322
5456 msgid "How to make changes <emphasis>not</emphasis> follow a copy"
5457 msgstr "如何让复制后<emphasis>不</emphasis>修改?"
5459 #. type: Content of: <book><chapter><sect1><sect2><para>
5460 #: ../en/ch05-daily.xml:325
5461 msgid ""
5462 "If, for some reason, you decide that this business of automatically "
5463 "propagating changes across copies is not for you, simply use your system's "
5464 "normal file copy command (on Unix-like systems, that's <command>cp</command>) "
5465 "to make a copy of a file, then <command role=\"hg-cmd\">hg add</command> the "
5466 "new copy by hand. Before you do so, though, please do reread section <xref "
5467 "linkend=\"sec.daily.why-copy\"/>, and make an informed decision that this "
5468 "behaviour is not appropriate to your specific case."
5469 msgstr ""
5471 #. type: Content of: <book><chapter><sect1><sect2><title>
5472 #: ../en/ch05-daily.xml:338
5473 msgid "Behaviour of the <command role=\"hg-cmd\">hg copy</command> command"
5474 msgstr "命令 <command role=\"hg-cmd\">hg copy</command> 的特性"
5476 #. type: Content of: <book><chapter><sect1><sect2><para>
5477 #: ../en/ch05-daily.xml:341
5478 msgid ""
5479 "When you use the <command role=\"hg-cmd\">hg copy</command> command, "
5480 "Mercurial makes a copy of each source file as it currently stands in the "
5481 "working directory. This means that if you make some modifications to a file, "
5482 "then <command role=\"hg-cmd\">hg copy</command> it without first having "
5483 "committed those changes, the new copy will also contain the modifications you "
5484 "have made up until that point. (I find this behaviour a little "
5485 "counterintuitive, which is why I mention it here.)"
5486 msgstr ""
5488 #. type: Content of: <book><chapter><sect1><sect2><para>
5489 #: ../en/ch05-daily.xml:351
5490 msgid ""
5491 "The <command role=\"hg-cmd\">hg copy</command> command acts similarly to the "
5492 "Unix <command>cp</command> command (you can use the <command role=\"hg-cmd"
5493 "\">hg cp</command> alias if you prefer). The last argument is the "
5494 "<emphasis>destination</emphasis>, and all prior arguments are "
5495 "<emphasis>sources</emphasis>. If you pass it a single file as the source, "
5496 "and the destination does not exist, it creates a new file with that name."
5497 msgstr ""
5499 #. type: Content of: <book><chapter><sect1><sect2><para>
5500 #: ../en/ch05-daily.xml:362
5501 msgid ""
5502 "If the destination is a directory, Mercurial copies its sources into that "
5503 "directory."
5504 msgstr ""
5506 #. type: Content of: <book><chapter><sect1><sect2><para>
5507 #: ../en/ch05-daily.xml:367
5508 msgid ""
5509 "Copying a directory is recursive, and preserves the directory structure of "
5510 "the source."
5511 msgstr ""
5513 #. type: Content of: <book><chapter><sect1><sect2><para>
5514 #: ../en/ch05-daily.xml:373
5515 msgid ""
5516 "If the source and destination are both directories, the source tree is "
5517 "recreated in the destination directory."
5518 msgstr ""
5521 #. type: Content of: <book><chapter><sect1><sect2><para>
5522 #: ../en/ch05-daily.xml:378
5523 msgid ""
5524 "As with the <command role=\"hg-cmd\">hg rename</command> command, if you copy "
5525 "a file manually and then want Mercurial to know that you've copied the file, "
5526 "simply use the <option role=\"hg-opt-copy\">--after</option> option to "
5527 "<command role=\"hg-cmd\">hg copy</command>."
5528 msgstr ""
5530 #. type: Content of: <book><chapter><sect1><title>
5531 #: ../en/ch05-daily.xml:389
5532 msgid "Renaming files"
5533 msgstr "改名文件"
5535 #. type: Content of: <book><chapter><sect1><para>
5536 #: ../en/ch05-daily.xml:391
5537 msgid ""
5538 "It's rather more common to need to rename a file than to make a copy of it. "
5539 "The reason I discussed the <command role=\"hg-cmd\">hg copy</command> command "
5540 "before talking about renaming files is that Mercurial treats a rename in "
5541 "essentially the same way as a copy. Therefore, knowing what Mercurial does "
5542 "when you copy a file tells you what to expect when you rename a file."
5543 msgstr ""
5545 #. type: Content of: <book><chapter><sect1><para>
5546 #: ../en/ch05-daily.xml:399
5547 msgid ""
5548 "When you use the <command role=\"hg-cmd\">hg rename</command> command, "
5549 "Mercurial makes a copy of each source file, then deletes it and marks the "
5550 "file as removed."
5551 msgstr ""
5553 #. type: Content of: <book><chapter><sect1><para>
5554 #: ../en/ch05-daily.xml:405
5555 msgid ""
5556 "The <command role=\"hg-cmd\">hg status</command> command shows the newly "
5557 "copied file as added, and the copied-from file as removed."
5558 msgstr ""
5560 #. type: Content of: <book><chapter><sect1><para>
5561 #: ../en/ch05-daily.xml:411
5562 msgid ""
5563 "As with the results of a <command role=\"hg-cmd\">hg copy</command>, we must "
5564 "use the <option role=\"hg-opt-status\">-C</option> option to <command role="
5565 "\"hg-cmd\">hg status</command> to see that the added file is really being "
5566 "tracked by Mercurial as a copy of the original, now removed, file."
5567 msgstr ""
5569 #. type: Content of: <book><chapter><sect1><para>
5570 #: ../en/ch05-daily.xml:420
5571 msgid ""
5572 "As with <command role=\"hg-cmd\">hg remove</command> and <command role=\"hg-"
5573 "cmd\">hg copy</command>, you can tell Mercurial about a rename after the fact "
5574 "using the <option role=\"hg-opt-rename\">--after</option> option. In most "
5575 "other respects, the behaviour of the <command role=\"hg-cmd\">hg rename</"
5576 "command> command, and the options it accepts, are similar to the <command "
5577 "role=\"hg-cmd\">hg copy</command> command."
5578 msgstr ""
5580 #. type: Content of: <book><chapter><sect1><sect2><title>
5581 #: ../en/ch05-daily.xml:430
5582 msgid "Renaming files and merging changes"
5583 msgstr "改名文件与合并修改"
5585 #. type: Content of: <book><chapter><sect1><sect2><para>
5586 #: ../en/ch05-daily.xml:432
5587 msgid ""
5588 "Since Mercurial's rename is implemented as copy-and-remove, the same "
5589 "propagation of changes happens when you merge after a rename as after a copy."
5590 msgstr ""
5592 #. type: Content of: <book><chapter><sect1><sect2><para>
5593 #: ../en/ch05-daily.xml:436
5594 msgid ""
5595 "If I modify a file, and you rename it to a new name, and then we merge our "
5596 "respective changes, my modifications to the file under its original name will "
5597 "be propagated into the file under its new name. (This is something you might "
5598 "expect to <quote>simply work,</quote> but not all revision control systems "
5599 "actually do this.)"
5600 msgstr ""
5602 #. type: Content of: <book><chapter><sect1><sect2><para>
5603 #: ../en/ch05-daily.xml:443
5604 msgid ""
5605 "Whereas having changes follow a copy is a feature where you can perhaps nod "
5606 "and say <quote>yes, that might be useful,</quote> it should be clear that "
5607 "having them follow a rename is definitely important. Without this facility, "
5608 "it would simply be too easy for changes to become orphaned when files are "
5609 "renamed."
5610 msgstr ""
5612 #. type: Content of: <book><chapter><sect1><sect2><title>
5613 #: ../en/ch05-daily.xml:452
5614 msgid "Divergent renames and merging"
5615 msgstr "改名与合并的分歧"
5617 #. type: Content of: <book><chapter><sect1><sect2><para>
5618 #: ../en/ch05-daily.xml:454
5619 msgid ""
5620 "The case of diverging names occurs when two developers start with a "
5621 "file&emdash;let's call it <filename>foo</filename>&emdash;in their respective "
5622 "repositories."
5623 msgstr ""
5625 #. type: Content of: <book><chapter><sect1><sect2><para>
5626 #: ../en/ch05-daily.xml:461
5627 msgid "Anne renames the file to <filename>bar</filename>."
5628 msgstr ""
5630 #. type: Content of: <book><chapter><sect1><sect2><para>
5631 #: ../en/ch05-daily.xml:465
5632 msgid "Meanwhile, Bob renames it to <filename>quux</filename>."
5633 msgstr ""
5635 #. type: Content of: <book><chapter><sect1><sect2><para>
5636 #: ../en/ch05-daily.xml:470
5637 msgid ""
5638 "I like to think of this as a conflict because each developer has expressed "
5639 "different intentions about what the file ought to be named."
5640 msgstr ""
5643 #. type: Content of: <book><chapter><sect1><sect2><para>
5644 #: ../en/ch05-daily.xml:474
5645 msgid ""
5646 "What do you think should happen when they merge their work? Mercurial's "
5647 "actual behaviour is that it always preserves <emphasis>both</emphasis> names "
5648 "when it merges changesets that contain divergent renames."
5649 msgstr ""
5651 #. type: Content of: <book><chapter><sect1><sect2><para>
5652 #: ../en/ch05-daily.xml:481
5653 msgid ""
5654 "Notice that Mercurial does warn about the divergent renames, but it leaves it "
5655 "up to you to do something about the divergence after the merge."
5656 msgstr ""
5658 #. type: Content of: <book><chapter><sect1><sect2><title>
5659 #: ../en/ch05-daily.xml:487
5660 msgid "Convergent renames and merging"
5661 msgstr "收敛改名与合并"
5663 #. type: Content of: <book><chapter><sect1><sect2><para>
5664 #: ../en/ch05-daily.xml:489
5665 msgid ""
5666 "Another kind of rename conflict occurs when two people choose to rename "
5667 "different <emphasis>source</emphasis> files to the same "
5668 "<emphasis>destination</emphasis>. In this case, Mercurial runs its normal "
5669 "merge machinery, and lets you guide it to a suitable resolution."
5670 msgstr ""
5672 #. type: Content of: <book><chapter><sect1><sect2><title>
5673 #: ../en/ch05-daily.xml:497
5674 msgid "Other name-related corner cases"
5675 msgstr "其它名称相关的角落"
5677 #. type: Content of: <book><chapter><sect1><sect2><para>
5678 #: ../en/ch05-daily.xml:499
5679 msgid ""
5680 "Mercurial has a longstanding bug in which it fails to handle a merge where "
5681 "one side has a file with a given name, while another has a directory with the "
5682 "same name. This is documented as <ulink role=\"hg-bug\" url=\"http://www."
5683 "selenic.com/mercurial/bts/issue29\">issue 29</ulink>."
5684 msgstr ""
5686 #. type: Content of: <book><chapter><sect1><title>
5687 #: ../en/ch05-daily.xml:511
5688 msgid "Recovering from mistakes"
5689 msgstr "从错误恢复"
5691 #. type: Content of: <book><chapter><sect1><para>
5692 #: ../en/ch05-daily.xml:513
5693 msgid ""
5694 "Mercurial has some useful commands that will help you to recover from some "
5695 "common mistakes."
5696 msgstr ""
5698 #. type: Content of: <book><chapter><sect1><para>
5699 #: ../en/ch05-daily.xml:516
5700 msgid ""
5701 "The <command role=\"hg-cmd\">hg revert</command> command lets you undo "
5702 "changes that you have made to your working directory. For example, if you "
5703 "<command role=\"hg-cmd\">hg add</command> a file by accident, just run "
5704 "<command role=\"hg-cmd\">hg revert</command> with the name of the file you "
5705 "added, and while the file won't be touched in any way, it won't be tracked "
5706 "for adding by Mercurial any longer, either. You can also use <command role="
5707 "\"hg-cmd\">hg revert</command> to get rid of erroneous changes to a file."
5708 msgstr ""
5710 #. type: Content of: <book><chapter><sect1><para>
5711 #: ../en/ch05-daily.xml:526
5712 msgid ""
5713 "It's useful to remember that the <command role=\"hg-cmd\">hg revert</command> "
5714 "command is useful for changes that you have not yet committed. Once you've "
5715 "committed a change, if you decide it was a mistake, you can still do "
5716 "something about it, though your options may be more limited."
5717 msgstr ""
5719 #. type: Content of: <book><chapter><sect1><para>
5720 #: ../en/ch05-daily.xml:532
5721 msgid ""
5722 "For more information about the <command role=\"hg-cmd\">hg revert</command> "
5723 "command, and details about how to deal with changes you have already "
5724 "committed, see chapter <xref linkend=\"chap.undo\"/>."
5725 msgstr ""
5727 #. type: Content of: <book><chapter><title>
5728 #: ../en/ch06-collab.xml:5
5729 msgid "Collaborating with other people"
5730 msgstr "团体协作"
5732 #. type: Content of: <book><chapter><para>
5733 #: ../en/ch06-collab.xml:7
5734 msgid ""
5735 "As a completely decentralised tool, Mercurial doesn't impose any policy on "
5736 "how people ought to work with each other. However, if you're new to "
5737 "distributed revision control, it helps to have some tools and examples in "
5738 "mind when you're thinking about possible workflow models."
5739 msgstr ""
5741 #. type: Content of: <book><chapter><sect1><title>
5742 #: ../en/ch06-collab.xml:14
5743 msgid "Mercurial's web interface"
5744 msgstr "Mercurial 的 web 接口"
5746 #. type: Content of: <book><chapter><sect1><para>
5747 #: ../en/ch06-collab.xml:16
5748 msgid ""
5749 "Mercurial has a powerful web interface that provides several useful "
5750 "capabilities."
5751 msgstr ""
5753 #. type: Content of: <book><chapter><sect1><para>
5754 #: ../en/ch06-collab.xml:19
5755 msgid ""
5756 "For interactive use, the web interface lets you browse a single repository or "
5757 "a collection of repositories. You can view the history of a repository, "
5758 "examine each change (comments and diffs), and view the contents of each "
5759 "directory and file."
5760 msgstr ""
5762 #. type: Content of: <book><chapter><sect1><para>
5763 #: ../en/ch06-collab.xml:24
5764 msgid ""
5765 "Also for human consumption, the web interface provides an RSS feed of the "
5766 "changes in a repository. This lets you <quote>subscribe</quote> to a "
5767 "repository using your favourite feed reader, and be automatically notified of "
5768 "activity in that repository as soon as it happens. I find this capability "
5769 "much more convenient than the model of subscribing to a mailing list to which "
5770 "notifications are sent, as it requires no additional configuration on the "
5771 "part of whoever is serving the repository."
5772 msgstr ""
5774 #. type: Content of: <book><chapter><sect1><para>
5775 #: ../en/ch06-collab.xml:34
5776 msgid ""
5777 "The web interface also lets remote users clone a repository, pull changes "
5778 "from it, and (when the server is configured to permit it) push changes back "
5779 "to it. Mercurial's HTTP tunneling protocol aggressively compresses data, so "
5780 "that it works efficiently even over low-bandwidth network connections."
5781 msgstr ""
5783 #. type: Content of: <book><chapter><sect1><para>
5784 #: ../en/ch06-collab.xml:40
5785 msgid ""
5786 "The easiest way to get started with the web interface is to use your web "
5787 "browser to visit an existing repository, such as the master Mercurial "
5788 "repository at <ulink url=\"http://www.selenic.com/repo/hg?style=gitweb"
5789 "\">http://www.selenic.com/repo/hg?style=gitweb</ulink>."
5790 msgstr ""
5792 #. type: Content of: <book><chapter><sect1><para>
5793 #: ../en/ch06-collab.xml:45
5794 msgid ""
5795 "If you're interested in providing a web interface to your own repositories, "
5796 "Mercurial provides two ways to do this. The first is using the <command role="
5797 "\"hg-cmd\">hg serve</command> command, which is best suited to short-term "
5798 "<quote>lightweight</quote> serving. See section <xref linkend=\"sec.collab."
5799 "serve\"/> below for details of how to use this command. If you have a long-"
5800 "lived repository that you'd like to make permanently available, Mercurial has "
5801 "built-in support for the CGI (Common Gateway Interface) standard, which all "
5802 "common web servers support. See section <xref linkend=\"sec.collab.cgi\"/> "
5803 "for details of CGI configuration."
5804 msgstr ""
5806 #. type: Content of: <book><chapter><sect1><title>
5807 #: ../en/ch06-collab.xml:60
5808 msgid "Collaboration models"
5809 msgstr "协作模型"
5811 #. type: Content of: <book><chapter><sect1><para>
5812 #: ../en/ch06-collab.xml:62
5813 msgid ""
5814 "With a suitably flexible tool, making decisions about workflow is much more "
5815 "of a social engineering challenge than a technical one. Mercurial imposes few "
5816 "limitations on how you can structure the flow of work in a project, so it's "
5817 "up to you and your group to set up and live with a model that matches your "
5818 "own particular needs."
5819 msgstr ""
5821 #. type: Content of: <book><chapter><sect1><sect2><title>
5822 #: ../en/ch06-collab.xml:70
5823 msgid "Factors to keep in mind"
5824 msgstr "要牢记的因素"
5826 #. type: Content of: <book><chapter><sect1><sect2><para>
5827 #: ../en/ch06-collab.xml:72
5828 msgid ""
5829 "The most important aspect of any model that you must keep in mind is how well "
5830 "it matches the needs and capabilities of the people who will be using it. "
5831 "This might seem self-evident; even so, you still can't afford to forget it "
5832 "for a moment."
5833 msgstr ""
5835 #. type: Content of: <book><chapter><sect1><sect2><para>
5836 #: ../en/ch06-collab.xml:78
5837 msgid ""
5838 "I once put together a workflow model that seemed to make perfect sense to me, "
5839 "but that caused a considerable amount of consternation and strife within my "
5840 "development team. In spite of my attempts to explain why we needed a complex "
5841 "set of branches, and how changes ought to flow between them, a few team "
5842 "members revolted. Even though they were smart people, they didn't want to "
5843 "pay attention to the constraints we were operating under, or face the "
5844 "consequences of those constraints in the details of the model that I was "
5845 "advocating."
5846 msgstr ""
5848 #. type: Content of: <book><chapter><sect1><sect2><para>
5849 #: ../en/ch06-collab.xml:88
5850 msgid ""
5851 "Don't sweep foreseeable social or technical problems under the rug. Whatever "
5852 "scheme you put into effect, you should plan for mistakes and problem "
5853 "scenarios. Consider adding automated machinery to prevent, or quickly "
5854 "recover from, trouble that you can anticipate. As an example, if you intend "
5855 "to have a branch with not-for-release changes in it, you'd do well to think "
5856 "early about the possibility that someone might accidentally merge those "
5857 "changes into a release branch. You could avoid this particular problem by "
5858 "writing a hook that prevents changes from being merged from an inappropriate "
5859 "branch."
5860 msgstr ""
5862 #. type: Content of: <book><chapter><sect1><sect2><title>
5863 #: ../en/ch06-collab.xml:102
5864 msgid "Informal anarchy"
5865 msgstr "无政府状态"
5867 #. type: Content of: <book><chapter><sect1><sect2><para>
5868 #: ../en/ch06-collab.xml:104
5869 msgid ""
5870 "I wouldn't suggest an <quote>anything goes</quote> approach as something "
5871 "sustainable, but it's a model that's easy to grasp, and it works perfectly "
5872 "well in a few unusual situations."
5873 msgstr ""
5875 #. type: Content of: <book><chapter><sect1><sect2><para>
5876 #: ../en/ch06-collab.xml:109
5877 msgid ""
5878 "As one example, many projects have a loose-knit group of collaborators who "
5879 "rarely physically meet each other. Some groups like to overcome the "
5880 "isolation of working at a distance by organising occasional <quote>sprints</"
5881 "quote>. In a sprint, a number of people get together in a single location (a "
5882 "company's conference room, a hotel meeting room, that kind of place) and "
5883 "spend several days more or less locked in there, hacking intensely on a "
5884 "handful of projects."
5885 msgstr ""
5887 #. type: Content of: <book><chapter><sect1><sect2><para>
5888 #: ../en/ch06-collab.xml:118
5889 msgid ""
5890 "A sprint is the perfect place to use the <command role=\"hg-cmd\">hg serve</"
5891 "command> command, since <command role=\"hg-cmd\">hg serve</command> does not "
5892 "require any fancy server infrastructure. You can get started with <command "
5893 "role=\"hg-cmd\">hg serve</command> in moments, by reading section <xref "
5894 "linkend=\"sec.collab.serve\"/> below. Then simply tell the person next to "
5895 "you that you're running a server, send the URL to them in an instant message, "
5896 "and you immediately have a quick-turnaround way to work together. They can "
5897 "type your URL into their web browser and quickly review your changes; or they "
5898 "can pull a bugfix from you and verify it; or they can clone a branch "
5899 "containing a new feature and try it out."
5900 msgstr ""
5902 #. type: Content of: <book><chapter><sect1><sect2><para>
5903 #: ../en/ch06-collab.xml:132
5904 msgid ""
5905 "The charm, and the problem, with doing things in an ad hoc fashion like this "
5906 "is that only people who know about your changes, and where they are, can see "
5907 "them. Such an informal approach simply doesn't scale beyond a handful "
5908 "people, because each individual needs to know about $n$ different "
5909 "repositories to pull from."
5910 msgstr ""
5912 #. type: Content of: <book><chapter><sect1><sect2><title>
5913 #: ../en/ch06-collab.xml:141
5914 msgid "A single central repository"
5915 msgstr "单一中央版本库"
5917 #. type: Content of: <book><chapter><sect1><sect2><para>
5918 #: ../en/ch06-collab.xml:143
5919 msgid ""
5920 "For smaller projects migrating from a centralised revision control tool, "
5921 "perhaps the easiest way to get started is to have changes flow through a "
5922 "single shared central repository. This is also the most common "
5923 "<quote>building block</quote> for more ambitious workflow schemes."
5924 msgstr ""
5926 #. type: Content of: <book><chapter><sect1><sect2><para>
5927 #: ../en/ch06-collab.xml:149
5928 msgid ""
5929 "Contributors start by cloning a copy of this repository. They can pull "
5930 "changes from it whenever they need to, and some (perhaps all) developers have "
5931 "permission to push a change back when they're ready for other people to see "
5932 "it."
5933 msgstr ""
5935 #. type: Content of: <book><chapter><sect1><sect2><para>
5936 #: ../en/ch06-collab.xml:154
5937 msgid ""
5938 "Under this model, it can still often make sense for people to pull changes "
5939 "directly from each other, without going through the central repository. "
5940 "Consider a case in which I have a tentative bug fix, but I am worried that if "
5941 "I were to publish it to the central repository, it might subsequently break "
5942 "everyone else's trees as they pull it. To reduce the potential for damage, I "
5943 "can ask you to clone my repository into a temporary repository of your own "
5944 "and test it. This lets us put off publishing the potentially unsafe change "
5945 "until it has had a little testing."
5946 msgstr ""
5948 #. type: Content of: <book><chapter><sect1><sect2><para>
5949 #: ../en/ch06-collab.xml:165
5950 msgid ""
5951 "In this kind of scenario, people usually use the <command>ssh</command> "
5952 "protocol to securely push changes to the central repository, as documented in "
5953 "section <xref linkend=\"sec.collab.ssh\"/>. It's also usual to publish a "
5954 "read-only copy of the repository over HTTP using CGI, as in section <xref "
5955 "linkend=\"sec.collab.cgi\"/>. Publishing over HTTP satisfies the needs of "
5956 "people who don't have push access, and those who want to use web browsers to "
5957 "browse the repository's history."
5958 msgstr ""
5960 #. type: Content of: <book><chapter><sect1><sect2><title>
5961 #: ../en/ch06-collab.xml:178
5962 msgid "Working with multiple branches"
5963 msgstr "使用多个分支工作"
5965 #. type: Content of: <book><chapter><sect1><sect2><para>
5966 #: ../en/ch06-collab.xml:180
5967 msgid ""
5968 "Projects of any significant size naturally tend to make progress on several "
5969 "fronts simultaneously. In the case of software, it's common for a project to "
5970 "go through periodic official releases. A release might then go into "
5971 "<quote>maintenance mode</quote> for a while after its first publication; "
5972 "maintenance releases tend to contain only bug fixes, not new features. In "
5973 "parallel with these maintenance releases, one or more future releases may be "
5974 "under development. People normally use the word <quote>branch</quote> to "
5975 "refer to one of these many slightly different directions in which development "
5976 "is proceeding."
5977 msgstr ""
5979 #. type: Content of: <book><chapter><sect1><sect2><para>
5980 #: ../en/ch06-collab.xml:193
5981 msgid ""
5982 "Mercurial is particularly well suited to managing a number of simultaneous, "
5983 "but not identical, branches. Each <quote>development direction</quote> can "
5984 "live in its own central repository, and you can merge changes from one to "
5985 "another as the need arises. Because repositories are independent of each "
5986 "other, unstable changes in a development branch will never affect a stable "
5987 "branch unless someone explicitly merges those changes in."
5988 msgstr ""
5990 #. type: Content of: <book><chapter><sect1><sect2><para>
5991 #: ../en/ch06-collab.xml:202
5992 msgid ""
5993 "Here's an example of how this can work in practice. Let's say you have one "
5994 "<quote>main branch</quote> on a central server."
5995 msgstr ""
5997 #. type: Content of: <book><chapter><sect1><sect2><para>
5998 #: ../en/ch06-collab.xml:208
5999 msgid "People clone it, make changes locally, test them, and push them back."
6000 msgstr ""
6002 #. type: Content of: <book><chapter><sect1><sect2><para>
6003 #: ../en/ch06-collab.xml:211
6004 msgid ""
6005 "Once the main branch reaches a release milestone, you can use the <command "
6006 "role=\"hg-cmd\">hg tag</command> command to give a permanent name to the "
6007 "milestone revision."
6008 msgstr ""
6010 #. type: Content of: <book><chapter><sect1><sect2><para>
6011 #: ../en/ch06-collab.xml:217
6012 msgid "Let's say some ongoing development occurs on the main branch."
6013 msgstr ""
6015 #. type: Content of: <book><chapter><sect1><sect2><para>
6016 #: ../en/ch06-collab.xml:222
6017 msgid ""
6018 "Using the tag that was recorded at the milestone, people who clone that "
6019 "repository at any time in the future can use <command role=\"hg-cmd\">hg "
6020 "update</command> to get a copy of the working directory exactly as it was "
6021 "when that tagged revision was committed."
6022 msgstr ""
6025 #. type: Content of: <book><chapter><sect1><sect2><para>
6026 #: ../en/ch06-collab.xml:230
6027 msgid ""
6028 "In addition, immediately after the main branch is tagged, someone can then "
6029 "clone the main branch on the server to a new <quote>stable</quote> branch, "
6030 "also on the server."
6031 msgstr ""
6033 #. type: Content of: <book><chapter><sect1><sect2><para>
6034 #: ../en/ch06-collab.xml:236
6035 msgid ""
6036 "Someone who needs to make a change to the stable branch can then clone "
6037 "<emphasis>that</emphasis> repository, make their changes, commit, and push "
6038 "their changes back there."
6039 msgstr ""
6041 #. type: Content of: <book><chapter><sect1><sect2><para>
6042 #: ../en/ch06-collab.xml:242
6043 msgid ""
6044 "Because Mercurial repositories are independent, and Mercurial doesn't move "
6045 "changes around automatically, the stable and main branches are "
6046 "<emphasis>isolated</emphasis> from each other. The changes that you made on "
6047 "the main branch don't <quote>leak</quote> to the stable branch, and vice "
6048 "versa."
6049 msgstr ""
6051 #. type: Content of: <book><chapter><sect1><sect2><para>
6052 #: ../en/ch06-collab.xml:249
6053 msgid ""
6054 "You'll often want all of your bugfixes on the stable branch to show up on the "
6055 "main branch, too. Rather than rewrite a bugfix on the main branch, you can "
6056 "simply pull and merge changes from the stable to the main branch, and "
6057 "Mercurial will bring those bugfixes in for you."
6058 msgstr ""
6060 #. type: Content of: <book><chapter><sect1><sect2><para>
6061 #: ../en/ch06-collab.xml:257
6062 msgid ""
6063 "The main branch will still contain changes that are not on the stable branch, "
6064 "but it will also contain all of the bugfixes from the stable branch. The "
6065 "stable branch remains unaffected by these changes."
6066 msgstr ""
6068 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
6069 #: ../en/ch06-collab.xml:264 ../en/ch06-collab.xml:278
6070 msgid "Feature branches"
6071 msgstr "特性分支"
6073 #. type: Content of: <book><chapter><sect1><sect2><para>
6074 #: ../en/ch06-collab.xml:266
6075 msgid ""
6076 "For larger projects, an effective way to manage change is to break up a team "
6077 "into smaller groups. Each group has a shared branch of its own, cloned from "
6078 "a single <quote>master</quote> branch used by the entire project. People "
6079 "working on an individual branch are typically quite isolated from "
6080 "developments on other branches."
6081 msgstr ""
6083 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
6084 #: ../en/ch06-collab.xml:275
6085 msgid ""
6086 "<imageobject><imagedata fileref=\"images/feature-branches.png\"/> </"
6087 "imageobject>"
6088 msgstr ""
6090 #. type: Content of: <book><chapter><sect1><sect2><para>
6091 #: ../en/ch06-collab.xml:283
6092 msgid ""
6093 "When a particular feature is deemed to be in suitable shape, someone on that "
6094 "feature team pulls and merges from the master branch into the feature branch, "
6095 "then pushes back up to the master branch."
6096 msgstr ""
6098 #. type: Content of: <book><chapter><sect1><sect2><title>
6099 #: ../en/ch06-collab.xml:290
6100 msgid "The release train"
6101 msgstr "发布列车"
6103 #. type: Content of: <book><chapter><sect1><sect2><para>
6104 #: ../en/ch06-collab.xml:292
6105 msgid ""
6106 "Some projects are organised on a <quote>train</quote> basis: a release is "
6107 "scheduled to happen every few months, and whatever features are ready when "
6108 "the <quote>train</quote> is ready to leave are allowed in."
6109 msgstr ""
6111 #. type: Content of: <book><chapter><sect1><sect2><para>
6112 #: ../en/ch06-collab.xml:297
6113 msgid ""
6114 "This model resembles working with feature branches. The difference is that "
6115 "when a feature branch misses a train, someone on the feature team pulls and "
6116 "merges the changes that went out on that train release into the feature "
6117 "branch, and the team continues its work on top of that release so that their "
6118 "feature can make the next release."
6119 msgstr ""
6121 #. type: Content of: <book><chapter><sect1><sect2><title>
6122 #: ../en/ch06-collab.xml:306
6123 msgid "The Linux kernel model"
6124 msgstr "Linux 内核模型"
6126 #. type: Content of: <book><chapter><sect1><sect2><para>
6127 #: ../en/ch06-collab.xml:308
6128 msgid ""
6129 "The development of the Linux kernel has a shallow hierarchical structure, "
6130 "surrounded by a cloud of apparent chaos. Because most Linux developers use "
6131 "<command>git</command>, a distributed revision control tool with capabilities "
6132 "similar to Mercurial, it's useful to describe the way work flows in that "
6133 "environment; if you like the ideas, the approach translates well across tools."
6134 msgstr ""
6136 #. type: Content of: <book><chapter><sect1><sect2><para>
6137 #: ../en/ch06-collab.xml:316
6138 msgid ""
6139 "At the center of the community sits Linus Torvalds, the creator of Linux. He "
6140 "publishes a single source repository that is considered the "
6141 "<quote>authoritative</quote> current tree by the entire developer community. "
6142 "Anyone can clone Linus's tree, but he is very choosy about whose trees he "
6143 "pulls from."
6144 msgstr ""
6146 #. type: Content of: <book><chapter><sect1><sect2><para>
6147 #: ../en/ch06-collab.xml:323
6148 msgid ""
6149 "Linus has a number of <quote>trusted lieutenants</quote>. As a general rule, "
6150 "he pulls whatever changes they publish, in most cases without even reviewing "
6151 "those changes. Some of those lieutenants are generally agreed to be "
6152 "<quote>maintainers</quote>, responsible for specific subsystems within the "
6153 "kernel. If a random kernel hacker wants to make a change to a subsystem that "
6154 "they want to end up in Linus's tree, they must find out who the subsystem's "
6155 "maintainer is, and ask that maintainer to take their change. If the "
6156 "maintainer reviews their changes and agrees to take them, they'll pass them "
6157 "along to Linus in due course."
6158 msgstr ""
6160 #. type: Content of: <book><chapter><sect1><sect2><para>
6161 #: ../en/ch06-collab.xml:335
6162 msgid ""
6163 "Individual lieutenants have their own approaches to reviewing, accepting, and "
6164 "publishing changes; and for deciding when to feed them to Linus. In "
6165 "addition, there are several well known branches that people use for different "
6166 "purposes. For example, a few people maintain <quote>stable</quote> "
6167 "repositories of older versions of the kernel, to which they apply critical "
6168 "fixes as needed. Some maintainers publish multiple trees: one for "
6169 "experimental changes; one for changes that they are about to feed upstream; "
6170 "and so on. Others just publish a single tree."
6171 msgstr ""
6173 #. type: Content of: <book><chapter><sect1><sect2><para>
6174 #: ../en/ch06-collab.xml:346
6175 msgid ""
6176 "This model has two notable features. The first is that it's <quote>pull "
6177 "only</quote>. You have to ask, convince, or beg another developer to take a "
6178 "change from you, because there are almost no trees to which more than one "
6179 "person can push, and there's no way to push changes into a tree that someone "
6180 "else controls."
6181 msgstr ""
6183 #. type: Content of: <book><chapter><sect1><sect2><para>
6184 #: ../en/ch06-collab.xml:353
6185 msgid ""
6186 "The second is that it's based on reputation and acclaim. If you're an "
6187 "unknown, Linus will probably ignore changes from you without even "
6188 "responding. But a subsystem maintainer will probably review them, and will "
6189 "likely take them if they pass their criteria for suitability. The more "
6190 "<quote>good</quote> changes you contribute to a maintainer, the more likely "
6191 "they are to trust your judgment and accept your changes. If you're well-"
6192 "known and maintain a long-lived branch for something Linus hasn't yet "
6193 "accepted, people with similar interests may pull your changes regularly to "
6194 "keep up with your work."
6195 msgstr ""
6197 #. type: Content of: <book><chapter><sect1><sect2><para>
6198 #: ../en/ch06-collab.xml:364
6199 msgid ""
6200 "Reputation and acclaim don't necessarily cross subsystem or <quote>people</"
6201 "quote> boundaries. If you're a respected but specialised storage hacker, and "
6202 "you try to fix a networking bug, that change will receive a level of scrutiny "
6203 "from a network maintainer comparable to a change from a complete stranger."
6204 msgstr ""
6206 #. type: Content of: <book><chapter><sect1><sect2><para>
6207 #: ../en/ch06-collab.xml:371
6208 msgid ""
6209 "To people who come from more orderly project backgrounds, the comparatively "
6210 "chaotic Linux kernel development process often seems completely insane. It's "
6211 "subject to the whims of individuals; people make sweeping changes whenever "
6212 "they deem it appropriate; and the pace of development is astounding. And yet "
6213 "Linux is a highly successful, well-regarded piece of software."
6214 msgstr ""
6216 #. type: Content of: <book><chapter><sect1><sect2><title>
6217 #: ../en/ch06-collab.xml:381
6218 msgid "Pull-only versus shared-push collaboration"
6219 msgstr "只读与共享写协作"
6221 #. type: Content of: <book><chapter><sect1><sect2><para>
6222 #: ../en/ch06-collab.xml:383
6223 msgid ""
6224 "A perpetual source of heat in the open source community is whether a "
6225 "development model in which people only ever pull changes from others is "
6226 "<quote>better than</quote> one in which multiple people can push changes to a "
6227 "shared repository."
6228 msgstr ""
6230 #. type: Content of: <book><chapter><sect1><sect2><para>
6231 #: ../en/ch06-collab.xml:389
6232 msgid ""
6233 "Typically, the backers of the shared-push model use tools that actively "
6234 "enforce this approach. If you're using a centralised revision control tool "
6235 "such as Subversion, there's no way to make a choice over which model you'll "
6236 "use: the tool gives you shared-push, and if you want to do anything else, "
6237 "you'll have to roll your own approach on top (such as applying a patch by "
6238 "hand)."
6239 msgstr ""
6241 #. type: Content of: <book><chapter><sect1><sect2><para>
6242 #: ../en/ch06-collab.xml:397
6243 msgid ""
6244 "A good distributed revision control tool, such as Mercurial, will support "
6245 "both models. You and your collaborators can then structure how you work "
6246 "together based on your own needs and preferences, not on what contortions "
6247 "your tools force you into."
6248 msgstr ""
6250 #. type: Content of: <book><chapter><sect1><sect2><title>
6251 #: ../en/ch06-collab.xml:405
6252 msgid "Where collaboration meets branch management"
6253 msgstr "协作与分支管理"
6255 #. type: Content of: <book><chapter><sect1><sect2><para>
6256 #: ../en/ch06-collab.xml:407
6257 msgid ""
6258 "Once you and your team set up some shared repositories and start propagating "
6259 "changes back and forth between local and shared repos, you begin to face a "
6260 "related, but slightly different challenge: that of managing the multiple "
6261 "directions in which your team may be moving at once. Even though this "
6262 "subject is intimately related to how your team collaborates, it's dense "
6263 "enough to merit treatment of its own, in chapter <xref linkend=\"chap.branch"
6264 "\"/>."
6265 msgstr ""
6267 #. type: Content of: <book><chapter><sect1><title>
6268 #: ../en/ch06-collab.xml:419
6269 msgid "The technical side of sharing"
6270 msgstr "共享的技术因素"
6272 #. type: Content of: <book><chapter><sect1><para>
6273 #: ../en/ch06-collab.xml:421
6274 msgid ""
6275 "The remainder of this chapter is devoted to the question of serving data to "
6276 "your collaborators."
6277 msgstr ""
6279 #. type: Content of: <book><chapter><sect1><title>
6280 #: ../en/ch06-collab.xml:426
6281 msgid "Informal sharing with <command role=\"hg-cmd\">hg serve</command>"
6282 msgstr "使用 <command role=\"hg-cmd\">hg serve</command> 进行非正式共享"
6284 #. type: Content of: <book><chapter><sect1><para>
6285 #: ../en/ch06-collab.xml:429
6286 msgid ""
6287 "Mercurial's <command role=\"hg-cmd\">hg serve</command> command is "
6288 "wonderfully suited to small, tight-knit, and fast-paced group environments. "
6289 "It also provides a great way to get a feel for using Mercurial commands over "
6290 "a network."
6291 msgstr ""
6293 #. type: Content of: <book><chapter><sect1><para>
6294 #: ../en/ch06-collab.xml:434
6295 msgid ""
6296 "Run <command role=\"hg-cmd\">hg serve</command> inside a repository, and in "
6297 "under a second it will bring up a specialised HTTP server; this will accept "
6298 "connections from any client, and serve up data for that repository until you "
6299 "terminate it. Anyone who knows the URL of the server you just started, and "
6300 "can talk to your computer over the network, can then use a web browser or "
6301 "Mercurial to read data from that repository. A URL for a <command role=\"hg-"
6302 "cmd\">hg serve</command> instance running on a laptop is likely to look "
6303 "something like <literal>http://my-laptop.local:8000/</literal>."
6304 msgstr ""
6306 #. type: Content of: <book><chapter><sect1><para>
6307 #: ../en/ch06-collab.xml:445
6308 msgid ""
6309 "The <command role=\"hg-cmd\">hg serve</command> command is <emphasis>not</"
6310 "emphasis> a general-purpose web server. It can do only two things:"
6311 msgstr ""
6313 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
6314 #: ../en/ch06-collab.xml:449
6315 msgid ""
6316 "Allow people to browse the history of the repository it's serving, from their "
6317 "normal web browsers."
6318 msgstr ""
6320 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
6321 #: ../en/ch06-collab.xml:453
6322 msgid ""
6323 "Speak Mercurial's wire protocol, so that people can <command role=\"hg-cmd"
6324 "\">hg clone</command> or <command role=\"hg-cmd\">hg pull</command> changes "
6325 "from that repository."
6326 msgstr ""
6328 #. type: Content of: <book><chapter><sect1><para>
6329 #: ../en/ch06-collab.xml:458
6330 msgid ""
6331 "In particular, <command role=\"hg-cmd\">hg serve</command> won't allow remote "
6332 "users to <emphasis>modify</emphasis> your repository. It's intended for read-"
6333 "only use."
6334 msgstr ""
6336 #. type: Content of: <book><chapter><sect1><para>
6337 #: ../en/ch06-collab.xml:462
6338 msgid ""
6339 "If you're getting started with Mercurial, there's nothing to prevent you from "
6340 "using <command role=\"hg-cmd\">hg serve</command> to serve up a repository on "
6341 "your own computer, then use commands like <command role=\"hg-cmd\">hg clone</"
6342 "command>, <command role=\"hg-cmd\">hg incoming</command>, and so on to talk "
6343 "to that server as if the repository was hosted remotely. This can help you to "
6344 "quickly get acquainted with using commands on network-hosted repositories."
6345 msgstr ""
6347 #. type: Content of: <book><chapter><sect1><sect2><title>
6348 #: ../en/ch06-collab.xml:472
6349 msgid "A few things to keep in mind"
6350 msgstr "要牢记的几件事"
6352 #. type: Content of: <book><chapter><sect1><sect2><para>
6353 #: ../en/ch06-collab.xml:474
6354 msgid ""
6355 "Because it provides unauthenticated read access to all clients, you should "
6356 "only use <command role=\"hg-cmd\">hg serve</command> in an environment where "
6357 "you either don't care, or have complete control over, who can access your "
6358 "network and pull data from your repository."
6359 msgstr ""
6361 #. type: Content of: <book><chapter><sect1><sect2><para>
6362 #: ../en/ch06-collab.xml:480
6363 msgid ""
6364 "The <command role=\"hg-cmd\">hg serve</command> command knows nothing about "
6365 "any firewall software you might have installed on your system or network. It "
6366 "cannot detect or control your firewall software. If other people are unable "
6367 "to talk to a running <command role=\"hg-cmd\">hg serve</command> instance, "
6368 "the second thing you should do (<emphasis>after</emphasis> you make sure that "
6369 "they're using the correct URL) is check your firewall configuration."
6370 msgstr ""
6372 #. type: Content of: <book><chapter><sect1><sect2><para>
6373 #: ../en/ch06-collab.xml:489
6374 msgid ""
6375 "By default, <command role=\"hg-cmd\">hg serve</command> listens for incoming "
6376 "connections on port 8000. If another process is already listening on the "
6377 "port you want to use, you can specify a different port to listen on using the "
6378 "<option role=\"hg-opt-serve\">-p</option> option."
6379 msgstr ""
6381 #. type: Content of: <book><chapter><sect1><sect2><para>
6382 #: ../en/ch06-collab.xml:495
6383 msgid ""
6384 "Normally, when <command role=\"hg-cmd\">hg serve</command> starts, it prints "
6385 "no output, which can be a bit unnerving. If you'd like to confirm that it is "
6386 "indeed running correctly, and find out what URL you should send to your "
6387 "collaborators, start it with the <option role=\"hg-opt-global\">-v</option> "
6388 "option."
6389 msgstr ""
6391 #. type: Content of: <book><chapter><sect1><title>
6392 #: ../en/ch06-collab.xml:505
6393 msgid "Using the Secure Shell (ssh) protocol"
6394 msgstr "使用 ssh 协议"
6396 #. type: Content of: <book><chapter><sect1><para>
6397 #: ../en/ch06-collab.xml:507
6398 msgid ""
6399 "You can pull and push changes securely over a network connection using the "
6400 "Secure Shell (<literal>ssh</literal>) protocol. To use this successfully, "
6401 "you may have to do a little bit of configuration on the client or server "
6402 "sides."
6403 msgstr ""
6405 #. type: Content of: <book><chapter><sect1><para>
6406 #: ../en/ch06-collab.xml:512
6407 msgid ""
6408 "If you're not familiar with ssh, it's a network protocol that lets you "
6409 "securely communicate with another computer. To use it with Mercurial, you'll "
6410 "be setting up one or more user accounts on a server so that remote users can "
6411 "log in and execute commands."
6412 msgstr ""
6414 #. type: Content of: <book><chapter><sect1><para>
6415 #: ../en/ch06-collab.xml:518
6416 msgid ""
6417 "(If you <emphasis>are</emphasis> familiar with ssh, you'll probably find some "
6418 "of the material that follows to be elementary in nature.)"
6419 msgstr ""
6421 #. type: Content of: <book><chapter><sect1><sect2><title>
6422 #: ../en/ch06-collab.xml:523
6423 msgid "How to read and write ssh URLs"
6424 msgstr "如何读写 ssh 路径"
6426 #. type: Content of: <book><chapter><sect1><sect2><para>
6427 #: ../en/ch06-collab.xml:525
6428 msgid "An ssh URL tends to look like this:"
6429 msgstr ""
6431 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
6432 #: ../en/ch06-collab.xml:528
6433 msgid ""
6434 "The <quote><literal>ssh://</literal></quote> part tells Mercurial to use the "
6435 "ssh protocol."
6436 msgstr ""
6438 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
6439 #: ../en/ch06-collab.xml:531
6440 msgid ""
6441 "The <quote><literal>bos@</literal></quote> component indicates what username "
6442 "to log into the server as. You can leave this out if the remote username is "
6443 "the same as your local username."
6444 msgstr ""
6446 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
6447 #: ../en/ch06-collab.xml:536
6448 msgid ""
6449 "The <quote><literal>hg.serpentine.com</literal></quote> gives the hostname of "
6450 "the server to log into."
6451 msgstr ""
6453 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
6454 #: ../en/ch06-collab.xml:540
6455 msgid ""
6456 "The <quote>:22</quote> identifies the port number to connect to the server "
6457 "on. The default port is 22, so you only need to specify this part if you're "
6458 "<emphasis>not</emphasis> using port 22."
6459 msgstr ""
6461 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
6462 #: ../en/ch06-collab.xml:545
6463 msgid ""
6464 "The remainder of the URL is the local path to the repository on the server."
6465 msgstr ""
6467 #. type: Content of: <book><chapter><sect1><sect2><para>
6468 #: ../en/ch06-collab.xml:549
6469 msgid ""
6470 "There's plenty of scope for confusion with the path component of ssh URLs, as "
6471 "there is no standard way for tools to interpret it. Some programs behave "
6472 "differently than others when dealing with these paths. This isn't an ideal "
6473 "situation, but it's unlikely to change. Please read the following paragraphs "
6474 "carefully."
6475 msgstr ""
6477 #. type: Content of: <book><chapter><sect1><sect2><para>
6478 #: ../en/ch06-collab.xml:556
6479 msgid ""
6480 "Mercurial treats the path to a repository on the server as relative to the "
6481 "remote user's home directory. For example, if user <literal>foo</literal> on "
6482 "the server has a home directory of <filename class=\"directory\">/home/foo</"
6483 "filename>, then an ssh URL that contains a path component of <filename class="
6484 "\"directory\">bar</filename> <emphasis>really</emphasis> refers to the "
6485 "directory <filename class=\"directory\">/home/foo/bar</filename>."
6486 msgstr ""
6488 #. type: Content of: <book><chapter><sect1><sect2><para>
6489 #: ../en/ch06-collab.xml:565
6490 msgid ""
6491 "If you want to specify a path relative to another user's home directory, you "
6492 "can use a path that starts with a tilde character followed by the user's name "
6493 "(let's call them <literal>otheruser</literal>), like this."
6494 msgstr ""
6496 #. type: Content of: <book><chapter><sect1><sect2><para>
6497 #: ../en/ch06-collab.xml:571
6498 msgid ""
6499 "And if you really want to specify an <emphasis>absolute</emphasis> path on "
6500 "the server, begin the path component with two slashes, as in this example."
6501 msgstr ""
6503 #. type: Content of: <book><chapter><sect1><sect2><title>
6504 #: ../en/ch06-collab.xml:578
6505 msgid "Finding an ssh client for your system"
6506 msgstr "为你的系统寻找 ssh 客户端"
6508 #. type: Content of: <book><chapter><sect1><sect2><para>
6509 #: ../en/ch06-collab.xml:580
6510 msgid ""
6511 "Almost every Unix-like system comes with OpenSSH preinstalled. If you're "
6512 "using such a system, run <literal>which ssh</literal> to find out if the "
6513 "<command>ssh</command> command is installed (it's usually in <filename class="
6514 "\"directory\">/usr/bin</filename>). In the unlikely event that it isn't "
6515 "present, take a look at your system documentation to figure out how to "
6516 "install it."
6517 msgstr ""
6519 #. type: Content of: <book><chapter><sect1><sect2><para>
6520 #: ../en/ch06-collab.xml:588
6521 msgid ""
6522 "On Windows, you'll first need to download a suitable ssh client. There are "
6523 "two alternatives."
6524 msgstr ""
6526 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
6527 #: ../en/ch06-collab.xml:591
6528 msgid ""
6529 "Simon Tatham's excellent PuTTY package <citation>web:putty</citation> "
6530 "provides a complete suite of ssh client commands."
6531 msgstr ""
6533 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
6534 #: ../en/ch06-collab.xml:595
6535 msgid ""
6536 "If you have a high tolerance for pain, you can use the Cygwin port of OpenSSH."
6537 msgstr ""
6539 #. type: Content of: <book><chapter><sect1><sect2><para>
6540 #: ../en/ch06-collab.xml:598
6541 msgid ""
6542 "In either case, you'll need to edit your \\hgini\\ file to tell Mercurial "
6543 "where to find the actual client command. For example, if you're using PuTTY, "
6544 "you'll need to use the <command>plink</command> command as a command-line ssh "
6545 "client."
6546 msgstr ""
6548 #. type: Content of: <book><chapter><sect1><sect2><note><para>
6549 #: ../en/ch06-collab.xml:607
6550 msgid ""
6551 "The path to <command>plink</command> shouldn't contain any whitespace "
6552 "characters, or Mercurial may not be able to run it correctly (so putting it "
6553 "in <filename class=\"directory\">C:\\\\Program Files</filename> is probably "
6554 "not a good idea)."
6555 msgstr ""
6557 #. type: Content of: <book><chapter><sect1><sect2><title>
6558 #: ../en/ch06-collab.xml:616
6559 msgid "Generating a key pair"
6560 msgstr "产生密钥对"
6562 #. type: Content of: <book><chapter><sect1><sect2><para>
6563 #: ../en/ch06-collab.xml:618
6564 msgid ""
6565 "To avoid the need to repetitively type a password every time you need to use "
6566 "your ssh client, I recommend generating a key pair. On a Unix-like system, "
6567 "the <command>ssh-keygen</command> command will do the trick. On Windows, if "
6568 "you're using PuTTY, the <command>puttygen</command> command is what you'll "
6569 "need."
6570 msgstr ""
6572 #. type: Content of: <book><chapter><sect1><sect2><para>
6573 #: ../en/ch06-collab.xml:626
6574 msgid ""
6575 "When you generate a key pair, it's usually <emphasis>highly</emphasis> "
6576 "advisable to protect it with a passphrase. (The only time that you might not "
6577 "want to do this is when you're using the ssh protocol for automated tasks on "
6578 "a secure network.)"
6579 msgstr ""
6581 #. type: Content of: <book><chapter><sect1><sect2><para>
6582 #: ../en/ch06-collab.xml:632
6583 msgid ""
6584 "Simply generating a key pair isn't enough, however. You'll need to add the "
6585 "public key to the set of authorised keys for whatever user you're logging in "
6586 "remotely as. For servers using OpenSSH (the vast majority), this will mean "
6587 "adding the public key to a list in a file called <filename role=\"special"
6588 "\">authorized_keys</filename> in their <filename role=\"special\" class="
6589 "\"directory\">.ssh</filename> directory."
6590 msgstr ""
6592 #. type: Content of: <book><chapter><sect1><sect2><para>
6593 #: ../en/ch06-collab.xml:641
6594 msgid ""
6595 "On a Unix-like system, your public key will have a <filename>.pub</filename> "
6596 "extension. If you're using <command>puttygen</command> on Windows, you can "
6597 "save the public key to a file of your choosing, or paste it from the window "
6598 "it's displayed in straight into the <filename role=\"special"
6599 "\">authorized_keys</filename> file."
6600 msgstr ""
6602 #. type: Content of: <book><chapter><sect1><sect2><title>
6603 #: ../en/ch06-collab.xml:650
6604 msgid "Using an authentication agent"
6605 msgstr "使用认证代理"
6607 #. type: Content of: <book><chapter><sect1><sect2><para>
6608 #: ../en/ch06-collab.xml:652
6609 msgid ""
6610 "An authentication agent is a daemon that stores passphrases in memory (so it "
6611 "will forget passphrases if you log out and log back in again). An ssh client "
6612 "will notice if it's running, and query it for a passphrase. If there's no "
6613 "authentication agent running, or the agent doesn't store the necessary "
6614 "passphrase, you'll have to type your passphrase every time Mercurial tries to "
6615 "communicate with a server on your behalf (e.g. whenever you pull or push "
6616 "changes)."
6617 msgstr ""
6619 #. type: Content of: <book><chapter><sect1><sect2><para>
6620 #: ../en/ch06-collab.xml:661
6621 msgid ""
6622 "The downside of storing passphrases in an agent is that it's possible for a "
6623 "well-prepared attacker to recover the plain text of your passphrases, in some "
6624 "cases even if your system has been power-cycled. You should make your own "
6625 "judgment as to whether this is an acceptable risk. It certainly saves a lot "
6626 "of repeated typing."
6627 msgstr ""
6629 #. type: Content of: <book><chapter><sect1><sect2><para>
6630 #: ../en/ch06-collab.xml:668
6631 msgid ""
6632 "On Unix-like systems, the agent is called <command>ssh-agent</command>, and "
6633 "it's often run automatically for you when you log in. You'll need to use the "
6634 "<command>ssh-add</command> command to add passphrases to the agent's store. "
6635 "On Windows, if you're using PuTTY, the <command>pageant</command> command "
6636 "acts as the agent. It adds an icon to your system tray that will let you "
6637 "manage stored passphrases."
6638 msgstr ""
6640 #. type: Content of: <book><chapter><sect1><sect2><title>
6641 #: ../en/ch06-collab.xml:679
6642 msgid "Configuring the server side properly"
6643 msgstr "正确配置服务器端"
6645 #. type: Content of: <book><chapter><sect1><sect2><para>
6646 #: ../en/ch06-collab.xml:681
6647 msgid ""
6648 "Because ssh can be fiddly to set up if you're new to it, there's a variety of "
6649 "things that can go wrong. Add Mercurial on top, and there's plenty more "
6650 "scope for head-scratching. Most of these potential problems occur on the "
6651 "server side, not the client side. The good news is that once you've gotten a "
6652 "configuration working, it will usually continue to work indefinitely."
6653 msgstr ""
6655 #. type: Content of: <book><chapter><sect1><sect2><para>
6656 #: ../en/ch06-collab.xml:689
6657 msgid ""
6658 "Before you try using Mercurial to talk to an ssh server, it's best to make "
6659 "sure that you can use the normal <command>ssh</command> or <command>putty</"
6660 "command> command to talk to the server first. If you run into problems with "
6661 "using these commands directly, Mercurial surely won't work. Worse, it will "
6662 "obscure the underlying problem. Any time you want to debug ssh-related "
6663 "Mercurial problems, you should drop back to making sure that plain ssh client "
6664 "commands work first, <emphasis>before</emphasis> you worry about whether "
6665 "there's a problem with Mercurial."
6666 msgstr ""
6668 #. type: Content of: <book><chapter><sect1><sect2><para>
6669 #: ../en/ch06-collab.xml:700
6670 msgid ""
6671 "The first thing to be sure of on the server side is that you can actually log "
6672 "in from another machine at all. If you can't use <command>ssh</command> or "
6673 "<command>putty</command> to log in, the error message you get may give you a "
6674 "few hints as to what's wrong. The most common problems are as follows."
6675 msgstr ""
6677 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
6678 #: ../en/ch06-collab.xml:707
6679 msgid ""
6680 "If you get a <quote>connection refused</quote> error, either there isn't an "
6681 "SSH daemon running on the server at all, or it's inaccessible due to firewall "
6682 "configuration."
6683 msgstr ""
6685 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
6686 #: ../en/ch06-collab.xml:712
6687 msgid ""
6688 "If you get a <quote>no route to host</quote> error, you either have an "
6689 "incorrect address for the server or a seriously locked down firewall that "
6690 "won't admit its existence at all."
6691 msgstr ""
6693 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
6694 #: ../en/ch06-collab.xml:717
6695 msgid ""
6696 "If you get a <quote>permission denied</quote> error, you may have mistyped "
6697 "the username on the server, or you could have mistyped your key's passphrase "
6698 "or the remote user's password."
6699 msgstr ""
6701 #. type: Content of: <book><chapter><sect1><sect2><para>
6702 #: ../en/ch06-collab.xml:722
6703 msgid ""
6704 "In summary, if you're having trouble talking to the server's ssh daemon, "
6705 "first make sure that one is running at all. On many systems it will be "
6706 "installed, but disabled, by default. Once you're done with this step, you "
6707 "should then check that the server's firewall is configured to allow incoming "
6708 "connections on the port the ssh daemon is listening on (usually 22). Don't "
6709 "worry about more exotic possibilities for misconfiguration until you've "
6710 "checked these two first."
6711 msgstr ""
6713 #. type: Content of: <book><chapter><sect1><sect2><para>
6714 #: ../en/ch06-collab.xml:732
6715 msgid ""
6716 "If you're using an authentication agent on the client side to store "
6717 "passphrases for your keys, you ought to be able to log into the server "
6718 "without being prompted for a passphrase or a password. If you're prompted "
6719 "for a passphrase, there are a few possible culprits."
6720 msgstr ""
6722 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
6723 #: ../en/ch06-collab.xml:738
6724 msgid ""
6725 "You might have forgotten to use <command>ssh-add</command> or "
6726 "<command>pageant</command> to store the passphrase."
6727 msgstr ""
6729 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
6730 #: ../en/ch06-collab.xml:742
6731 msgid "You might have stored the passphrase for the wrong key."
6732 msgstr ""
6734 #. type: Content of: <book><chapter><sect1><sect2><para>
6735 #: ../en/ch06-collab.xml:745
6736 msgid ""
6737 "If you're being prompted for the remote user's password, there are another "
6738 "few possible problems to check."
6739 msgstr ""
6741 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
6742 #: ../en/ch06-collab.xml:748
6743 msgid ""
6744 "Either the user's home directory or their <filename role=\"special\" class="
6745 "\"directory\">.ssh</filename> directory might have excessively liberal "
6746 "permissions. As a result, the ssh daemon will not trust or read their "
6747 "<filename role=\"special\">authorized_keys</filename> file. For example, a "
6748 "group-writable home or <filename role=\"special\" class=\"directory\">.ssh</"
6749 "filename> directory will often cause this symptom."
6750 msgstr ""
6752 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
6753 #: ../en/ch06-collab.xml:757
6754 msgid ""
6755 "The user's <filename role=\"special\">authorized_keys</filename> file may "
6756 "have a problem. If anyone other than the user owns or can write to that file, "
6757 "the ssh daemon will not trust or read it."
6758 msgstr ""
6760 #. type: Content of: <book><chapter><sect1><sect2><para>
6761 #: ../en/ch06-collab.xml:764
6762 msgid ""
6763 "In the ideal world, you should be able to run the following command "
6764 "successfully, and it should print exactly one line of output, the current "
6765 "date and time."
6766 msgstr ""
6768 #. type: Content of: <book><chapter><sect1><sect2><para>
6769 #: ../en/ch06-collab.xml:769
6770 msgid ""
6771 "If, on your server, you have login scripts that print banners or other junk "
6772 "even when running non-interactive commands like this, you should fix them "
6773 "before you continue, so that they only print output if they're run "
6774 "interactively. Otherwise these banners will at least clutter up Mercurial's "
6775 "output. Worse, they could potentially cause problems with running Mercurial "
6776 "commands remotely. Mercurial makes tries to detect and ignore banners in non-"
6777 "interactive <command>ssh</command> sessions, but it is not foolproof. (If "
6778 "you're editing your login scripts on your server, the usual way to see if a "
6779 "login script is running in an interactive shell is to check the return code "
6780 "from the command <literal>tty -s</literal>.)"
6781 msgstr ""
6783 #. type: Content of: <book><chapter><sect1><sect2><para>
6784 #: ../en/ch06-collab.xml:783
6785 msgid ""
6786 "Once you've verified that plain old ssh is working with your server, the next "
6787 "step is to ensure that Mercurial runs on the server. The following command "
6788 "should run successfully:"
6789 msgstr ""
6791 #. type: Content of: <book><chapter><sect1><sect2><para>
6792 #: ../en/ch06-collab.xml:788
6793 msgid ""
6794 "If you see an error message instead of normal <command role=\"hg-cmd\">hg "
6795 "version</command> output, this is usually because you haven't installed "
6796 "Mercurial to <filename class=\"directory\">/usr/bin</filename>. Don't worry "
6797 "if this is the case; you don't need to do that. But you should check for a "
6798 "few possible problems."
6799 msgstr ""
6801 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
6802 #: ../en/ch06-collab.xml:795
6803 msgid ""
6804 "Is Mercurial really installed on the server at all? I know this sounds "
6805 "trivial, but it's worth checking!"
6806 msgstr ""
6808 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
6809 #: ../en/ch06-collab.xml:799
6810 msgid ""
6811 "Maybe your shell's search path (usually set via the <envar>PATH</envar> "
6812 "environment variable) is simply misconfigured."
6813 msgstr ""
6815 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
6816 #: ../en/ch06-collab.xml:803
6817 msgid ""
6818 "Perhaps your <envar>PATH</envar> environment variable is only being set to "
6819 "point to the location of the <command>hg</command> executable if the login "
6820 "session is interactive. This can happen if you're setting the path in the "
6821 "wrong shell login script. See your shell's documentation for details."
6822 msgstr ""
6824 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
6825 #: ../en/ch06-collab.xml:810
6826 msgid ""
6827 "The <envar>PYTHONPATH</envar> environment variable may need to contain the "
6828 "path to the Mercurial Python modules. It might not be set at all; it could "
6829 "be incorrect; or it may be set only if the login is interactive."
6830 msgstr ""
6832 #. type: Content of: <book><chapter><sect1><sect2><para>
6833 #: ../en/ch06-collab.xml:817
6834 msgid ""
6835 "If you can run <command role=\"hg-cmd\">hg version</command> over an ssh "
6836 "connection, well done! You've got the server and client sorted out. You "
6837 "should now be able to use Mercurial to access repositories hosted by that "
6838 "username on that server. If you run into problems with Mercurial and ssh at "
6839 "this point, try using the <option role=\"hg-opt-global\">--debug</option> "
6840 "option to get a clearer picture of what's going on."
6841 msgstr ""
6843 #. type: Content of: <book><chapter><sect1><sect2><title>
6844 #: ../en/ch06-collab.xml:827
6845 msgid "Using compression with ssh"
6846 msgstr "通过 ssh 使用压缩"
6848 #. type: Content of: <book><chapter><sect1><sect2><para>
6849 #: ../en/ch06-collab.xml:829
6850 msgid ""
6851 "Mercurial does not compress data when it uses the ssh protocol, because the "
6852 "ssh protocol can transparently compress data. However, the default behaviour "
6853 "of ssh clients is <emphasis>not</emphasis> to request compression."
6854 msgstr ""
6856 #. type: Content of: <book><chapter><sect1><sect2><para>
6857 #: ../en/ch06-collab.xml:834
6858 msgid ""
6859 "Over any network other than a fast LAN (even a wireless network), using "
6860 "compression is likely to significantly speed up Mercurial's network "
6861 "operations. For example, over a WAN, someone measured compression as "
6862 "reducing the amount of time required to clone a particularly large repository "
6863 "from 51 minutes to 17 minutes."
6864 msgstr ""
6866 #. type: Content of: <book><chapter><sect1><sect2><para>
6867 #: ../en/ch06-collab.xml:841
6868 msgid ""
6869 "Both <command>ssh</command> and <command>plink</command> accept a <option "
6870 "role=\"cmd-opt-ssh\">-C</option> option which turns on compression. You can "
6871 "easily edit your <filename role=\"special\"> /.hgrc</filename>\\ to enable "
6872 "compression for all of Mercurial's uses of the ssh protocol."
6873 msgstr ""
6875 #. type: Content of: <book><chapter><sect1><sect2><para>
6876 #: ../en/ch06-collab.xml:848
6877 msgid ""
6878 "If you use <command>ssh</command>, you can configure it to always use "
6879 "compression when talking to your server. To do this, edit your <filename "
6880 "role=\"special\">.ssh/config</filename> file (which may not yet exist), as "
6881 "follows."
6882 msgstr ""
6884 #. type: Content of: <book><chapter><sect1><sect2><para>
6885 #: ../en/ch06-collab.xml:855
6886 msgid ""
6887 "This defines an alias, <literal>hg</literal>. When you use it on the "
6888 "<command>ssh</command> command line or in a Mercurial <literal>ssh</literal>-"
6889 "protocol URL, it will cause <command>ssh</command> to connect to <literal>hg."
6890 "example.com</literal> and use compression. This gives you both a shorter "
6891 "name to type and compression, each of which is a good thing in its own right."
6892 msgstr ""
6894 #. type: Content of: <book><chapter><sect1><title>
6895 #: ../en/ch06-collab.xml:866
6896 msgid "Serving over HTTP using CGI"
6897 msgstr "使用 CGI 通过 HTTP 提供服务"
6899 #. type: Content of: <book><chapter><sect1><para>
6900 #: ../en/ch06-collab.xml:868
6901 msgid ""
6902 "Depending on how ambitious you are, configuring Mercurial's CGI interface can "
6903 "take anything from a few moments to several hours."
6904 msgstr ""
6906 #. type: Content of: <book><chapter><sect1><para>
6907 #: ../en/ch06-collab.xml:872
6908 msgid ""
6909 "We'll begin with the simplest of examples, and work our way towards a more "
6910 "complex configuration. Even for the most basic case, you're almost certainly "
6911 "going to need to read and modify your web server's configuration."
6912 msgstr ""
6914 #. type: Content of: <book><chapter><sect1><note><para>
6915 #: ../en/ch06-collab.xml:878
6916 msgid ""
6917 "Configuring a web server is a complex, fiddly, and highly system-dependent "
6918 "activity. I can't possibly give you instructions that will cover anything "
6919 "like all of the cases you will encounter. Please use your discretion and "
6920 "judgment in following the sections below. Be prepared to make plenty of "
6921 "mistakes, and to spend a lot of time reading your server's error logs."
6922 msgstr ""
6924 #. type: Content of: <book><chapter><sect1><sect2><title>
6925 #: ../en/ch06-collab.xml:888
6926 msgid "Web server configuration checklist"
6927 msgstr "Web 服务器配置检查表"
6929 #. type: Content of: <book><chapter><sect1><sect2><para>
6930 #: ../en/ch06-collab.xml:890
6931 msgid ""
6932 "Before you continue, do take a few moments to check a few aspects of your "
6933 "system's setup."
6934 msgstr ""
6936 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
6937 #: ../en/ch06-collab.xml:894
6938 msgid ""
6939 "Do you have a web server installed at all? Mac OS X ships with Apache, but "
6940 "many other systems may not have a web server installed."
6941 msgstr ""
6943 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
6944 #: ../en/ch06-collab.xml:898
6945 msgid ""
6946 "If you have a web server installed, is it actually running? On most systems, "
6947 "even if one is present, it will be disabled by default."
6948 msgstr ""
6950 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
6951 #: ../en/ch06-collab.xml:902
6952 msgid ""
6953 "Is your server configured to allow you to run CGI programs in the directory "
6954 "where you plan to do so? Most servers default to explicitly disabling the "
6955 "ability to run CGI programs."
6956 msgstr ""
6958 #. type: Content of: <book><chapter><sect1><sect2><para>
6959 #: ../en/ch06-collab.xml:908
6960 msgid ""
6961 "If you don't have a web server installed, and don't have substantial "
6962 "experience configuring Apache, you should consider using the "
6963 "<literal>lighttpd</literal> web server instead of Apache. Apache has a well-"
6964 "deserved reputation for baroque and confusing configuration. While "
6965 "<literal>lighttpd</literal> is less capable in some ways than Apache, most of "
6966 "these capabilities are not relevant to serving Mercurial repositories. And "
6967 "<literal>lighttpd</literal> is undeniably <emphasis>much</emphasis> easier to "
6968 "get started with than Apache."
6969 msgstr ""
6971 #. type: Content of: <book><chapter><sect1><sect2><title>
6972 #: ../en/ch06-collab.xml:921
6973 msgid "Basic CGI configuration"
6974 msgstr "基本 CGI 配置"
6976 #. type: Content of: <book><chapter><sect1><sect2><para>
6977 #: ../en/ch06-collab.xml:923
6978 msgid ""
6979 "On Unix-like systems, it's common for users to have a subdirectory named "
6980 "something like <filename class=\"directory\">public_html</filename> in their "
6981 "home directory, from which they can serve up web pages. A file named "
6982 "<filename>foo</filename> in this directory will be accessible at a URL of the "
6983 "form <literal>http://www.example.com/\\ {</literal>username/foo}."
6984 msgstr ""
6986 #. type: Content of: <book><chapter><sect1><sect2><para>
6987 #: ../en/ch06-collab.xml:932
6988 msgid ""
6989 "To get started, find the <filename role=\"special\">hgweb.cgi</filename> "
6990 "script that should be present in your Mercurial installation. If you can't "
6991 "quickly find a local copy on your system, simply download one from the master "
6992 "Mercurial repository at <ulink url=\"http://www.selenic.com/repo/hg/raw-file/"
6993 "tip/hgweb.cgi\">http://www.selenic.com/repo/hg/raw-file/tip/hgweb.cgi</ulink>."
6994 msgstr ""
6996 #. type: Content of: <book><chapter><sect1><sect2><para>
6997 #: ../en/ch06-collab.xml:939 ../en/ch06-collab.xml:1112
6998 msgid ""
6999 "You'll need to copy this script into your <filename class=\"directory"
7000 "\">public_html</filename> directory, and ensure that it's executable."
7001 msgstr ""
7003 #. type: Content of: <book><chapter><sect1><sect2><para>
7004 #: ../en/ch06-collab.xml:944
7005 msgid ""
7006 "The <literal>755</literal> argument to <command>chmod</command> is a little "
7007 "more general than just making the script executable: it ensures that the "
7008 "script is executable by anyone, and that <quote>group</quote> and "
7009 "<quote>other</quote> write permissions are <emphasis>not</emphasis> set. If "
7010 "you were to leave those write permissions enabled, Apache's <literal>suexec</"
7011 "literal> subsystem would likely refuse to execute the script. In fact, "
7012 "<literal>suexec</literal> also insists that the <emphasis>directory</"
7013 "emphasis> in which the script resides must not be writable by others."
7014 msgstr ""
7016 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
7017 #: ../en/ch06-collab.xml:958
7018 msgid "What could <emphasis>possibly</emphasis> go wrong?"
7019 msgstr "什么<emphasis>可能</emphasis>会出错?"
7021 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7022 #: ../en/ch06-collab.xml:961
7023 msgid ""
7024 "Once you've copied the CGI script into place, go into a web browser, and try "
7025 "to open the URL <ulink url=\"http://myhostname/ myuser/hgweb.cgi\">http://"
7026 "myhostname/ myuser/hgweb.cgi</ulink>, <emphasis>but</emphasis> brace yourself "
7027 "for instant failure. There's a high probability that trying to visit this "
7028 "URL will fail, and there are many possible reasons for this. In fact, you're "
7029 "likely to stumble over almost every one of the possible errors below, so "
7030 "please read carefully. The following are all of the problems I ran into on a "
7031 "system running Fedora 7, with a fresh installation of Apache, and a user "
7032 "account that I created specially to perform this exercise."
7033 msgstr ""
7035 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7036 #: ../en/ch06-collab.xml:975
7037 msgid ""
7038 "Your web server may have per-user directories disabled. If you're using "
7039 "Apache, search your config file for a <literal>UserDir</literal> directive. "
7040 "If there's none present, per-user directories will be disabled. If one "
7041 "exists, but its value is <literal>disabled</literal>, then per-user "
7042 "directories will be disabled. Otherwise, the string after <literal>UserDir</"
7043 "literal> gives the name of the subdirectory that Apache will look in under "
7044 "your home directory, for example <filename class=\"directory\">public_html</"
7045 "filename>."
7046 msgstr ""
7048 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7049 #: ../en/ch06-collab.xml:986
7050 msgid ""
7051 "Your file access permissions may be too restrictive. The web server must be "
7052 "able to traverse your home directory and directories under your <filename "
7053 "class=\"directory\">public_html</filename> directory, and read files under "
7054 "the latter too. Here's a quick recipe to help you to make your permissions "
7055 "more appropriate."
7056 msgstr ""
7058 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7059 #: ../en/ch06-collab.xml:996
7060 msgid ""
7061 "The other possibility with permissions is that you might get a completely "
7062 "empty window when you try to load the script. In this case, it's likely that "
7063 "your access permissions are <emphasis>too permissive</emphasis>. Apache's "
7064 "<literal>suexec</literal> subsystem won't execute a script that's group- or "
7065 "world-writable, for example."
7066 msgstr ""
7068 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7069 #: ../en/ch06-collab.xml:1003
7070 msgid ""
7071 "Your web server may be configured to disallow execution of CGI programs in "
7072 "your per-user web directory. Here's Apache's default per-user configuration "
7073 "from my Fedora system."
7074 msgstr ""
7076 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7077 #: ../en/ch06-collab.xml:1014
7078 msgid ""
7079 "If you find a similar-looking <literal>Directory</literal> group in your "
7080 "Apache configuration, the directive to look at inside it is <literal>Options</"
7081 "literal>. Add <literal>ExecCGI</literal> to the end of this list if it's "
7082 "missing, and restart the web server."
7083 msgstr ""
7085 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7086 #: ../en/ch06-collab.xml:1021
7087 msgid ""
7088 "If you find that Apache serves you the text of the CGI script instead of "
7089 "executing it, you may need to either uncomment (if already present) or add a "
7090 "directive like this."
7091 msgstr ""
7093 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7094 #: ../en/ch06-collab.xml:1027
7095 msgid ""
7096 "The next possibility is that you might be served with a colourful Python "
7097 "backtrace claiming that it can't import a <literal>mercurial</literal>-"
7098 "related module. This is actually progress! The server is now capable of "
7099 "executing your CGI script. This error is only likely to occur if you're "
7100 "running a private installation of Mercurial, instead of a system-wide "
7101 "version. Remember that the web server runs the CGI program without any of "
7102 "the environment variables that you take for granted in an interactive "
7103 "session. If this error happens to you, edit your copy of <filename role="
7104 "\"special\">hgweb.cgi</filename> and follow the directions inside it to "
7105 "correctly set your <envar>PYTHONPATH</envar> environment variable."
7106 msgstr ""
7108 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7109 #: ../en/ch06-collab.xml:1041
7110 msgid ""
7111 "Finally, you are <emphasis>certain</emphasis> to by served with another "
7112 "colourful Python backtrace: this one will complain that it can't find "
7113 "<filename class=\"directory\">/path/to/repository</filename>. Edit your "
7114 "<filename role=\"special\">hgweb.cgi</filename> script and replace the "
7115 "<filename class=\"directory\">/path/to/repository</filename> string with the "
7116 "complete path to the repository you want to serve up."
7117 msgstr ""
7119 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7120 #: ../en/ch06-collab.xml:1051
7121 msgid ""
7122 "At this point, when you try to reload the page, you should be presented with "
7123 "a nice HTML view of your repository's history. Whew!"
7124 msgstr ""
7126 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
7127 #: ../en/ch06-collab.xml:1057
7128 msgid "Configuring lighttpd"
7129 msgstr "配置 lighttpd"
7131 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7132 #: ../en/ch06-collab.xml:1059
7133 msgid ""
7134 "To be exhaustive in my experiments, I tried configuring the increasingly "
7135 "popular <literal>lighttpd</literal> web server to serve the same repository "
7136 "as I described with Apache above. I had already overcome all of the problems "
7137 "I outlined with Apache, many of which are not server-specific. As a result, "
7138 "I was fairly sure that my file and directory permissions were good, and that "
7139 "my <filename role=\"special\">hgweb.cgi</filename> script was properly edited."
7140 msgstr ""
7142 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7143 #: ../en/ch06-collab.xml:1069
7144 msgid ""
7145 "Once I had Apache running, getting <literal>lighttpd</literal> to serve the "
7146 "repository was a snap (in other words, even if you're trying to use "
7147 "<literal>lighttpd</literal>, you should read the Apache section). I first "
7148 "had to edit the <literal>mod_access</literal> section of its config file to "
7149 "enable <literal>mod_cgi</literal> and <literal>mod_userdir</literal>, both of "
7150 "which were disabled by default on my system. I then added a few lines to the "
7151 "end of the config file, to configure these modules."
7152 msgstr ""
7154 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7155 #: ../en/ch06-collab.xml:1081
7156 msgid ""
7157 "With this done, <literal>lighttpd</literal> ran immediately for me. If I had "
7158 "configured <literal>lighttpd</literal> before Apache, I'd almost certainly "
7159 "have run into many of the same system-level configuration problems as I did "
7160 "with Apache. However, I found <literal>lighttpd</literal> to be noticeably "
7161 "easier to configure than Apache, even though I've used Apache for over a "
7162 "decade, and this was my first exposure to <literal>lighttpd</literal>."
7163 msgstr ""
7165 #. type: Content of: <book><chapter><sect1><sect2><title>
7166 #: ../en/ch06-collab.xml:1094
7167 msgid "Sharing multiple repositories with one CGI script"
7168 msgstr "使用一个 CGI 脚本共享多个版本库"
7170 #. type: Content of: <book><chapter><sect1><sect2><para>
7171 #: ../en/ch06-collab.xml:1096
7172 msgid ""
7173 "The <filename role=\"special\">hgweb.cgi</filename> script only lets you "
7174 "publish a single repository, which is an annoying restriction. If you want "
7175 "to publish more than one without wracking yourself with multiple copies of "
7176 "the same script, each with different names, a better choice is to use the "
7177 "<filename role=\"special\">hgwebdir.cgi</filename> script."
7178 msgstr ""
7180 #. type: Content of: <book><chapter><sect1><sect2><para>
7181 #: ../en/ch06-collab.xml:1104
7182 msgid ""
7183 "The procedure to configure <filename role=\"special\">hgwebdir.cgi</filename> "
7184 "is only a little more involved than for <filename role=\"special\">hgweb.cgi</"
7185 "filename>. First, you must obtain a copy of the script. If you don't have "
7186 "one handy, you can download a copy from the master Mercurial repository at "
7187 "<ulink url=\"http://www.selenic.com/repo/hg/raw-file/tip/hgwebdir.cgi"
7188 "\">http://www.selenic.com/repo/hg/raw-file/tip/hgwebdir.cgi</ulink>."
7189 msgstr ""
7191 #. type: Content of: <book><chapter><sect1><sect2><para>
7192 #: ../en/ch06-collab.xml:1117
7193 msgid ""
7194 "With basic configuration out of the way, try to visit <ulink url=\"http://"
7195 "myhostname/ myuser/hgwebdir.cgi\">http://myhostname/ myuser/hgwebdir.cgi</"
7196 "ulink> in your browser. It should display an empty list of repositories. If "
7197 "you get a blank window or error message, try walking through the list of "
7198 "potential problems in section <xref linkend=\"sec.collab.wtf\"/>."
7199 msgstr ""
7201 #. type: Content of: <book><chapter><sect1><sect2><para>
7202 #: ../en/ch06-collab.xml:1126
7203 msgid ""
7204 "The <filename role=\"special\">hgwebdir.cgi</filename> script relies on an "
7205 "external configuration file. By default, it searches for a file named "
7206 "<filename role=\"special\">hgweb.config</filename> in the same directory as "
7207 "itself. You'll need to create this file, and make it world-readable. The "
7208 "format of the file is similar to a Windows <quote>ini</quote> file, as "
7209 "understood by Python's <literal>ConfigParser</literal> <citation>web:"
7210 "configparser</citation> module."
7211 msgstr ""
7213 #. type: Content of: <book><chapter><sect1><sect2><para>
7214 #: ../en/ch06-collab.xml:1136
7215 msgid ""
7216 "The easiest way to configure <filename role=\"special\">hgwebdir.cgi</"
7217 "filename> is with a section named <literal>collections</literal>. This will "
7218 "automatically publish <emphasis>every</emphasis> repository under the "
7219 "directories you name. The section should look like this:"
7220 msgstr ""
7222 #. type: Content of: <book><chapter><sect1><sect2><para>
7223 #: ../en/ch06-collab.xml:1144
7224 msgid ""
7225 "Mercurial interprets this by looking at the directory name on the "
7226 "<emphasis>right</emphasis> hand side of the <quote><literal>=</literal></"
7227 "quote> sign; finding repositories in that directory hierarchy; and using the "
7228 "text on the <emphasis>left</emphasis> to strip off matching text from the "
7229 "names it will actually list in the web interface. The remaining component of "
7230 "a path after this stripping has occurred is called a <quote>virtual path</"
7231 "quote>."
7232 msgstr ""
7234 #. type: Content of: <book><chapter><sect1><sect2><para>
7235 #: ../en/ch06-collab.xml:1153
7236 msgid ""
7237 "Given the example above, if we have a repository whose local path is "
7238 "<filename class=\"directory\">/my/root/this/repo</filename>, the CGI script "
7239 "will strip the leading <filename class=\"directory\">/my/root</filename> from "
7240 "the name, and publish the repository with a virtual path of <filename class="
7241 "\"directory\">this/repo</filename>. If the base URL for our CGI script is "
7242 "<ulink url=\"http://myhostname/ myuser/hgwebdir.cgi\">http://myhostname/ "
7243 "myuser/hgwebdir.cgi</ulink>, the complete URL for that repository will be "
7244 "<ulink url=\"http://myhostname/ myuser/hgwebdir.cgi/this/repo\">http://"
7245 "myhostname/ myuser/hgwebdir.cgi/this/repo</ulink>."
7246 msgstr ""
7248 #. type: Content of: <book><chapter><sect1><sect2><para>
7249 #: ../en/ch06-collab.xml:1167
7250 msgid ""
7251 "If we replace <filename class=\"directory\">/my/root</filename> on the left "
7252 "hand side of this example with <filename class=\"directory\">/my</filename>, "
7253 "then <filename role=\"special\">hgwebdir.cgi</filename> will only strip off "
7254 "<filename class=\"directory\">/my</filename> from the repository name, and "
7255 "will give us a virtual path of <filename class=\"directory\">root/this/repo</"
7256 "filename> instead of <filename class=\"directory\">this/repo</filename>."
7257 msgstr ""
7259 #. type: Content of: <book><chapter><sect1><sect2><para>
7260 #: ../en/ch06-collab.xml:1177
7261 msgid ""
7262 "The <filename role=\"special\">hgwebdir.cgi</filename> script will "
7263 "recursively search each directory listed in the <literal>collections</"
7264 "literal> section of its configuration file, but it will <literal>not</"
7265 "literal> recurse into the repositories it finds."
7266 msgstr ""
7268 #. type: Content of: <book><chapter><sect1><sect2><para>
7269 #: ../en/ch06-collab.xml:1183
7270 msgid ""
7271 "The <literal>collections</literal> mechanism makes it easy to publish many "
7272 "repositories in a <quote>fire and forget</quote> manner. You only need to "
7273 "set up the CGI script and configuration file one time. Afterwards, you can "
7274 "publish or unpublish a repository at any time by simply moving it into, or "
7275 "out of, the directory hierarchy in which you've configured <filename role="
7276 "\"special\">hgwebdir.cgi</filename> to look."
7277 msgstr ""
7279 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
7280 #: ../en/ch06-collab.xml:1193
7281 msgid "Explicitly specifying which repositories to publish"
7282 msgstr "明确指出要发布的版本库"
7284 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7285 #: ../en/ch06-collab.xml:1196
7286 msgid ""
7287 "In addition to the <literal>collections</literal> mechanism, the <filename "
7288 "role=\"special\">hgwebdir.cgi</filename> script allows you to publish a "
7289 "specific list of repositories. To do so, create a <literal>paths</literal> "
7290 "section, with contents of the following form."
7291 msgstr ""
7293 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7294 #: ../en/ch06-collab.xml:1204
7295 msgid ""
7296 "In this case, the virtual path (the component that will appear in a URL) is "
7297 "on the left hand side of each definition, while the path to the repository is "
7298 "on the right. Notice that there does not need to be any relationship between "
7299 "the virtual path you choose and the location of a repository in your "
7300 "filesystem."
7301 msgstr ""
7303 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7304 #: ../en/ch06-collab.xml:1211
7305 msgid ""
7306 "If you wish, you can use both the <literal>collections</literal> and "
7307 "<literal>paths</literal> mechanisms simultaneously in a single configuration "
7308 "file."
7309 msgstr ""
7311 #. type: Content of: <book><chapter><sect1><sect2><sect3><note><para>
7312 #: ../en/ch06-collab.xml:1217
7313 msgid ""
7314 "If multiple repositories have the same virtual path, <filename role=\"special"
7315 "\">hgwebdir.cgi</filename> will not report an error. Instead, it will behave "
7316 "unpredictably."
7317 msgstr ""
7319 #. type: Content of: <book><chapter><sect1><sect2><title>
7320 #: ../en/ch06-collab.xml:1226
7321 msgid "Downloading source archives"
7322 msgstr "下载源代码档案包"
7324 #. type: Content of: <book><chapter><sect1><sect2><para>
7325 #: ../en/ch06-collab.xml:1228
7326 msgid ""
7327 "Mercurial's web interface lets users download an archive of any revision. "
7328 "This archive will contain a snapshot of the working directory as of that "
7329 "revision, but it will not contain a copy of the repository data."
7330 msgstr ""
7332 #. type: Content of: <book><chapter><sect1><sect2><para>
7333 #: ../en/ch06-collab.xml:1233
7334 msgid ""
7335 "By default, this feature is not enabled. To enable it, you'll need to add an "
7336 "<envar role=\"rc-item-web\">allow_archive</envar> item to the <literal role="
7337 "\"rc-web\">web</literal> section of your <filename role=\"special\"> /.hgrc</"
7338 "filename>."
7339 msgstr ""
7341 #. type: Content of: <book><chapter><sect1><sect2><title>
7342 #: ../en/ch06-collab.xml:1241
7343 msgid "Web configuration options"
7344 msgstr "Web 配置选项"
7346 #. type: Content of: <book><chapter><sect1><sect2><para>
7347 #: ../en/ch06-collab.xml:1243
7348 msgid ""
7349 "Mercurial's web interfaces (the <command role=\"hg-cmd\">hg serve</command> "
7350 "command, and the <filename role=\"special\">hgweb.cgi</filename> and "
7351 "<filename role=\"special\">hgwebdir.cgi</filename> scripts) have a number of "
7352 "configuration options that you can set. These belong in a section named "
7353 "<literal role=\"rc-web\">web</literal>."
7354 msgstr ""
7356 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
7357 #: ../en/ch06-collab.xml:1251
7358 msgid ""
7359 "<envar role=\"rc-item-web\">allow_archive</envar>: Determines which (if any) "
7360 "archive download mechanisms Mercurial supports. If you enable this feature, "
7361 "users of the web interface will be able to download an archive of whatever "
7362 "revision of a repository they are viewing. To enable the archive feature, "
7363 "this item must take the form of a sequence of words drawn from the list below."
7364 msgstr ""
7366 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
7367 #: ../en/ch06-collab.xml:1260
7368 msgid ""
7369 "<literal>bz2</literal>: A <command>tar</command> archive, compressed using "
7370 "<literal>bzip2</literal> compression. This has the best compression ratio, "
7371 "but uses the most CPU time on the server."
7372 msgstr ""
7374 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
7375 #: ../en/ch06-collab.xml:1266
7376 msgid ""
7377 "<literal>gz</literal>: A <command>tar</command> archive, compressed using "
7378 "<literal>gzip</literal> compression."
7379 msgstr ""
7381 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
7382 #: ../en/ch06-collab.xml:1270
7383 msgid ""
7384 "<literal>zip</literal>: A <command>zip</command> archive, compressed using "
7385 "LZW compression. This format has the worst compression ratio, but is widely "
7386 "used in the Windows world."
7387 msgstr ""
7389 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
7390 #: ../en/ch06-collab.xml:1276
7391 msgid ""
7392 "If you provide an empty list, or don't have an <envar role=\"rc-item-web"
7393 "\">allow_archive</envar> entry at all, this feature will be disabled. Here "
7394 "is an example of how to enable all three supported formats."
7395 msgstr ""
7397 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
7398 #: ../en/ch06-collab.xml:1283
7399 msgid ""
7400 "<envar role=\"rc-item-web\">allowpull</envar>: Boolean. Determines whether "
7401 "the web interface allows remote users to <command role=\"hg-cmd\">hg pull</"
7402 "command> and <command role=\"hg-cmd\">hg clone</command> this repository over "
7403 "HTTP. If set to <literal>no</literal> or <literal>false</literal>, only the "
7404 "<quote>human-oriented</quote> portion of the web interface is available."
7405 msgstr ""
7407 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
7408 #: ../en/ch06-collab.xml:1292
7409 msgid ""
7410 "<envar role=\"rc-item-web\">contact</envar>: String. A free-form (but "
7411 "preferably brief) string identifying the person or group in charge of the "
7412 "repository. This often contains the name and email address of a person or "
7413 "mailing list. It often makes sense to place this entry in a repository's own "
7414 "<filename role=\"special\">.hg/hgrc</filename> file, but it can make sense to "
7415 "use in a global <filename role=\"special\"> /.hgrc</filename>\\ if every "
7416 "repository has a single maintainer."
7417 msgstr ""
7419 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
7420 #: ../en/ch06-collab.xml:1303
7421 msgid ""
7422 "<envar role=\"rc-item-web\">maxchanges</envar>: Integer. The default maximum "
7423 "number of changesets to display in a single page of output."
7424 msgstr ""
7426 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
7427 #: ../en/ch06-collab.xml:1307
7428 msgid ""
7429 "<envar role=\"rc-item-web\">maxfiles</envar>: Integer. The default maximum "
7430 "number of modified files to display in a single page of output."
7431 msgstr ""
7433 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
7434 #: ../en/ch06-collab.xml:1311
7435 msgid ""
7436 "<envar role=\"rc-item-web\">stripes</envar>: Integer. If the web interface "
7437 "displays alternating <quote>stripes</quote> to make it easier to visually "
7438 "align rows when you are looking at a table, this number controls the number "
7439 "of rows in each stripe."
7440 msgstr ""
7442 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
7443 #: ../en/ch06-collab.xml:1317
7444 msgid ""
7445 "<envar role=\"rc-item-web\">style</envar>: Controls the template Mercurial "
7446 "uses to display the web interface. Mercurial ships with two web templates, "
7447 "named <literal>default</literal> and <literal>gitweb</literal> (the latter is "
7448 "much more visually attractive). You can also specify a custom template of "
7449 "your own; see chapter <xref linkend=\"chap.template\"/> for details. Here, "
7450 "you can see how to enable the <literal>gitweb</literal> style."
7451 msgstr ""
7453 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
7454 #: ../en/ch06-collab.xml:1328
7455 msgid ""
7456 "<envar role=\"rc-item-web\">templates</envar>: Path. The directory in which "
7457 "to search for template files. By default, Mercurial searches in the "
7458 "directory in which it was installed."
7459 msgstr ""
7461 #. type: Content of: <book><chapter><sect1><sect2><para>
7462 #: ../en/ch06-collab.xml:1333
7463 msgid ""
7464 "If you are using <filename role=\"special\">hgwebdir.cgi</filename>, you can "
7465 "place a few configuration items in a <literal role=\"rc-web\">web</literal> "
7466 "section of the <filename role=\"special\">hgweb.config</filename> file "
7467 "instead of a <filename role=\"special\"> /.hgrc</filename>\\ file, for "
7468 "convenience. These items are <envar role=\"rc-item-web\">motd</envar> and "
7469 "<envar role=\"rc-item-web\">style</envar>."
7470 msgstr ""
7472 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
7473 #: ../en/ch06-collab.xml:1344
7474 msgid "Options specific to an individual repository"
7475 msgstr "针对单个版本库的选项"
7477 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7478 #: ../en/ch06-collab.xml:1346
7479 msgid ""
7480 "A few <literal role=\"rc-web\">web</literal> configuration items ought to be "
7481 "placed in a repository's local <filename role=\"special\">.hg/hgrc</"
7482 "filename>, rather than a user's or global <filename role=\"special\"> /.hgrc</"
7483 "filename>."
7484 msgstr ""
7486 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
7487 #: ../en/ch06-collab.xml:1352
7488 msgid ""
7489 "<envar role=\"rc-item-web\">description</envar>: String. A free-form (but "
7490 "preferably brief) string that describes the contents or purpose of the "
7491 "repository."
7492 msgstr ""
7494 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
7495 #: ../en/ch06-collab.xml:1357
7496 msgid ""
7497 "<envar role=\"rc-item-web\">name</envar>: String. The name to use for the "
7498 "repository in the web interface. This overrides the default name, which is "
7499 "the last component of the repository's path."
7500 msgstr ""
7502 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
7503 #: ../en/ch06-collab.xml:1365
7504 msgid ""
7505 "Options specific to the <command role=\"hg-cmd\">hg serve</command> command"
7506 msgstr "命令 <command role=\"hg-cmd\">hg serve</command> 的选项"
7508 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7509 #: ../en/ch06-collab.xml:1368
7510 msgid ""
7511 "Some of the items in the <literal role=\"rc-web\">web</literal> section of a "
7512 "<filename role=\"special\"> /.hgrc</filename>\\ file are only for use with "
7513 "the <command role=\"hg-cmd\">hg serve</command> command."
7514 msgstr ""
7516 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
7517 #: ../en/ch06-collab.xml:1374
7518 msgid ""
7519 "<envar role=\"rc-item-web\">accesslog</envar>: Path. The name of a file into "
7520 "which to write an access log. By default, the <command role=\"hg-cmd\">hg "
7521 "serve</command> command writes this information to standard output, not to a "
7522 "file. Log entries are written in the standard <quote>combined</quote> file "
7523 "format used by almost all web servers."
7524 msgstr ""
7526 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
7527 #: ../en/ch06-collab.xml:1382
7528 msgid ""
7529 "<envar role=\"rc-item-web\">address</envar>: String. The local address on "
7530 "which the server should listen for incoming connections. By default, the "
7531 "server listens on all addresses."
7532 msgstr ""
7534 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
7535 #: ../en/ch06-collab.xml:1387
7536 msgid ""
7537 "<envar role=\"rc-item-web\">errorlog</envar>: Path. The name of a file into "
7538 "which to write an error log. By default, the <command role=\"hg-cmd\">hg "
7539 "serve</command> command writes this information to standard error, not to a "
7540 "file."
7541 msgstr ""
7543 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
7544 #: ../en/ch06-collab.xml:1393
7545 msgid ""
7546 "<envar role=\"rc-item-web\">ipv6</envar>: Boolean. Whether to use the IPv6 "
7547 "protocol. By default, IPv6 is not used."
7548 msgstr ""
7550 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
7551 #: ../en/ch06-collab.xml:1397
7552 msgid ""
7553 "<envar role=\"rc-item-web\">port</envar>: Integer. The TCP port number on "
7554 "which the server should listen. The default port number used is 8000."
7555 msgstr ""
7557 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
7558 #: ../en/ch06-collab.xml:1404
7559 msgid ""
7560 "Choosing the right <filename role=\"special\"> /.hgrc</filename>\\ file to "
7561 "add <literal role=\"rc-web\">web</literal> items to"
7562 msgstr ""
7563 "选择正确的 <filename role=\"special\"> /.hgrc</filename> 文件增加到 <literal "
7564 "role=\"rc-web\">web</literal> 条目"
7566 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7567 #: ../en/ch06-collab.xml:1408
7568 msgid ""
7569 "It is important to remember that a web server like Apache or "
7570 "<literal>lighttpd</literal> will run under a user ID that is different to "
7571 "yours. CGI scripts run by your server, such as <filename role=\"special"
7572 "\">hgweb.cgi</filename>, will usually also run under that user ID."
7573 msgstr ""
7575 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7576 #: ../en/ch06-collab.xml:1415
7577 msgid ""
7578 "If you add <literal role=\"rc-web\">web</literal> items to your own personal "
7579 "<filename role=\"special\"> /.hgrc</filename>\\ file, CGI scripts won't read "
7580 "that <filename role=\"special\"> /.hgrc</filename>\\ file. Those settings "
7581 "will thus only affect the behaviour of the <command role=\"hg-cmd\">hg serve</"
7582 "command> command when you run it. To cause CGI scripts to see your settings, "
7583 "either create a <filename role=\"special\"> /.hgrc</filename>\\ file in the "
7584 "home directory of the user ID that runs your web server, or add those "
7585 "settings to a system-wide <filename role=\"special\"> /.hgrc</filename>\\ "
7586 "file."
7587 msgstr ""
7589 #. type: Content of: <book><chapter><title>
7590 #: ../en/ch07-filenames.xml:5
7591 msgid "File names and pattern matching"
7592 msgstr "文件名称与模式匹配"
7594 #. type: Content of: <book><chapter><para>
7595 #: ../en/ch07-filenames.xml:7
7596 msgid ""
7597 "Mercurial provides mechanisms that let you work with file names in a "
7598 "consistent and expressive way."
7599 msgstr ""
7601 #. type: Content of: <book><chapter><sect1><title>
7602 #: ../en/ch07-filenames.xml:11
7603 msgid "Simple file naming"
7604 msgstr "简单文件名称"
7606 #. type: Content of: <book><chapter><sect1><para>
7607 #: ../en/ch07-filenames.xml:13
7608 msgid ""
7609 "Mercurial uses a unified piece of machinery <quote>under the hood</quote> to "
7610 "handle file names. Every command behaves uniformly with respect to file "
7611 "names. The way in which commands work with file names is as follows."
7612 msgstr ""
7614 #. type: Content of: <book><chapter><sect1><para>
7615 #: ../en/ch07-filenames.xml:18
7616 msgid ""
7617 "If you explicitly name real files on the command line, Mercurial works with "
7618 "exactly those files, as you would expect. &interaction.filenames.files;"
7619 msgstr ""
7622 #. type: Content of: <book><chapter><sect1><para>
7623 #: ../en/ch07-filenames.xml:22
7624 msgid ""
7625 "When you provide a directory name, Mercurial will interpret this as "
7626 "<quote>operate on every file in this directory and its subdirectories</"
7627 "quote>. Mercurial traverses the files and subdirectories in a directory in "
7628 "alphabetical order. When it encounters a subdirectory, it will traverse that "
7629 "subdirectory before continuing with the current directory."
7630 msgstr ""
7632 #. type: Content of: <book><chapter><sect1><title>
7633 #: ../en/ch07-filenames.xml:33
7634 msgid "Running commands without any file names"
7635 msgstr "不提供文件名称的执行命令"
7637 #. type: Content of: <book><chapter><sect1><para>
7638 #: ../en/ch07-filenames.xml:35
7639 msgid ""
7640 "Mercurial's commands that work with file names have useful default behaviours "
7641 "when you invoke them without providing any file names or patterns. What kind "
7642 "of behaviour you should expect depends on what the command does. Here are a "
7643 "few rules of thumb you can use to predict what a command is likely to do if "
7644 "you don't give it any names to work with."
7645 msgstr ""
7647 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
7648 #: ../en/ch07-filenames.xml:42
7649 msgid ""
7650 "Most commands will operate on the entire working directory. This is what the "
7651 "<command role=\"hg-cmd\">hg add</command> command does, for example."
7652 msgstr ""
7654 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
7655 #: ../en/ch07-filenames.xml:46
7656 msgid ""
7657 "If the command has effects that are difficult or impossible to reverse, it "
7658 "will force you to explicitly provide at least one name or pattern (see "
7659 "below). This protects you from accidentally deleting files by running "
7660 "<command role=\"hg-cmd\">hg remove</command> with no arguments, for example."
7661 msgstr ""
7664 #. type: Content of: <book><chapter><sect1><para>
7665 #: ../en/ch07-filenames.xml:54
7666 msgid ""
7667 "It's easy to work around these default behaviours if they don't suit you. If "
7668 "a command normally operates on the whole working directory, you can invoke it "
7669 "on just the current directory and its subdirectories by giving it the name "
7670 "<quote><filename class=\"directory\">.</filename></quote>."
7671 msgstr ""
7674 #. type: Content of: <book><chapter><sect1><para>
7675 #: ../en/ch07-filenames.xml:62
7676 msgid ""
7677 "Along the same lines, some commands normally print file names relative to the "
7678 "root of the repository, even if you're invoking them from a subdirectory. "
7679 "Such a command will print file names relative to your subdirectory if you "
7680 "give it explicit names. Here, we're going to run <command role=\"hg-cmd\">hg "
7681 "status</command> from a subdirectory, and get it to operate on the entire "
7682 "working directory while printing file names relative to our subdirectory, by "
7683 "passing it the output of the <command role=\"hg-cmd\">hg root</command> "
7684 "command."
7685 msgstr ""
7687 #. type: Content of: <book><chapter><sect1><title>
7688 #: ../en/ch07-filenames.xml:76
7689 msgid "Telling you what's going on"
7690 msgstr "告诉你正在做什么"
7692 #. type: Content of: <book><chapter><sect1><para>
7693 #: ../en/ch07-filenames.xml:78
7694 msgid ""
7695 "The <command role=\"hg-cmd\">hg add</command> example in the preceding "
7696 "section illustrates something else that's helpful about Mercurial commands. "
7697 "If a command operates on a file that you didn't name explicitly on the "
7698 "command line, it will usually print the name of the file, so that you will "
7699 "not be surprised what's going on."
7700 msgstr ""
7702 #. type: Content of: <book><chapter><sect1><para>
7703 #: ../en/ch07-filenames.xml:85
7704 msgid ""
7705 "The principle here is of <emphasis>least surprise</emphasis>. If you've "
7706 "exactly named a file on the command line, there's no point in repeating it "
7707 "back at you. If Mercurial is acting on a file <emphasis>implicitly</"
7708 "emphasis>, because you provided no names, or a directory, or a pattern (see "
7709 "below), it's safest to tell you what it's doing."
7710 msgstr ""
7712 #. type: Content of: <book><chapter><sect1><para>
7713 #: ../en/ch07-filenames.xml:92
7714 msgid ""
7715 "For commands that behave this way, you can silence them using the <option "
7716 "role=\"hg-opt-global\">-q</option> option. You can also get them to print "
7717 "the name of every file, even those you've named explicitly, using the <option "
7718 "role=\"hg-opt-global\">-v</option> option."
7719 msgstr ""
7721 #. type: Content of: <book><chapter><sect1><title>
7722 #: ../en/ch07-filenames.xml:100
7723 msgid "Using patterns to identify files"
7724 msgstr "使用模式标识文件"
7726 #. type: Content of: <book><chapter><sect1><para>
7727 #: ../en/ch07-filenames.xml:102
7728 msgid ""
7729 "In addition to working with file and directory names, Mercurial lets you use "
7730 "<emphasis>patterns</emphasis> to identify files. Mercurial's pattern "
7731 "handling is expressive."
7732 msgstr ""
7734 #. type: Content of: <book><chapter><sect1><para>
7735 #: ../en/ch07-filenames.xml:106
7736 msgid ""
7737 "On Unix-like systems (Linux, MacOS, etc.), the job of matching file names to "
7738 "patterns normally falls to the shell. On these systems, you must explicitly "
7739 "tell Mercurial that a name is a pattern. On Windows, the shell does not "
7740 "expand patterns, so Mercurial will automatically identify names that are "
7741 "patterns, and expand them for you."
7742 msgstr ""
7744 #. type: Content of: <book><chapter><sect1><para>
7745 #: ../en/ch07-filenames.xml:113
7746 msgid ""
7747 "To provide a pattern in place of a regular name on the command line, the "
7748 "mechanism is simple:"
7749 msgstr ""
7751 #. type: Content of: <book><chapter><sect1><para>
7752 #: ../en/ch07-filenames.xml:116
7753 msgid ""
7754 "That is, a pattern is identified by a short text string that says what kind "
7755 "of pattern this is, followed by a colon, followed by the actual pattern."
7756 msgstr ""
7758 #. type: Content of: <book><chapter><sect1><para>
7759 #: ../en/ch07-filenames.xml:120
7760 msgid ""
7761 "Mercurial supports two kinds of pattern syntax. The most frequently used is "
7762 "called <literal>glob</literal>; this is the same kind of pattern matching "
7763 "used by the Unix shell, and should be familiar to Windows command prompt "
7764 "users, too."
7765 msgstr ""
7767 #. type: Content of: <book><chapter><sect1><para>
7768 #: ../en/ch07-filenames.xml:125
7769 msgid ""
7770 "When Mercurial does automatic pattern matching on Windows, it uses "
7771 "<literal>glob</literal> syntax. You can thus omit the <quote><literal>glob:</"
7772 "literal></quote> prefix on Windows, but it's safe to use it, too."
7773 msgstr ""
7775 #. type: Content of: <book><chapter><sect1><para>
7776 #: ../en/ch07-filenames.xml:130
7777 msgid ""
7778 "The <literal>re</literal> syntax is more powerful; it lets you specify "
7779 "patterns using regular expressions, also known as regexps."
7780 msgstr ""
7782 #. type: Content of: <book><chapter><sect1><para>
7783 #: ../en/ch07-filenames.xml:134
7784 msgid ""
7785 "By the way, in the examples that follow, notice that I'm careful to wrap all "
7786 "of my patterns in quote characters, so that they won't get expanded by the "
7787 "shell before Mercurial sees them."
7788 msgstr ""
7790 #. type: Content of: <book><chapter><sect1><sect2><title>
7791 #: ../en/ch07-filenames.xml:140
7792 msgid "Shell-style <literal>glob</literal> patterns"
7793 msgstr "外壳风格的 <literal>glob</literal> 模式"
7795 #. type: Content of: <book><chapter><sect1><sect2><para>
7796 #: ../en/ch07-filenames.xml:142
7797 msgid ""
7798 "This is an overview of the kinds of patterns you can use when you're matching "
7799 "on glob patterns."
7800 msgstr ""
7803 #. type: Content of: <book><chapter><sect1><sect2><para>
7804 #: ../en/ch07-filenames.xml:145
7805 msgid ""
7806 "The <quote><literal>*</literal></quote> character matches any string, within "
7807 "a single directory."
7808 msgstr ""
7811 #. type: Content of: <book><chapter><sect1><sect2><para>
7812 #: ../en/ch07-filenames.xml:150
7813 msgid ""
7814 "The <quote><literal>**</literal></quote> pattern matches any string, and "
7815 "crosses directory boundaries. It's not a standard Unix glob token, but it's "
7816 "accepted by several popular Unix shells, and is very useful."
7817 msgstr ""
7820 #. type: Content of: <book><chapter><sect1><sect2><para>
7821 #: ../en/ch07-filenames.xml:157
7822 msgid ""
7823 "The <quote><literal>?</literal></quote> pattern matches any single character."
7824 msgstr ""
7826 #. type: Content of: <book><chapter><sect1><sect2><para>
7827 #: ../en/ch07-filenames.xml:162
7828 msgid ""
7829 "The <quote><literal>[</literal></quote> character begins a "
7830 "<emphasis>character class</emphasis>. This matches any single character "
7831 "within the class. The class ends with a <quote><literal>]</literal></quote> "
7832 "character. A class may contain multiple <emphasis>range</emphasis>s of the "
7833 "form <quote><literal>a-f</literal></quote>, which is shorthand for "
7834 "<quote><literal>abcdef</literal></quote>."
7835 msgstr ""
7837 #. type: Content of: <book><chapter><sect1><sect2><para>
7838 #: ../en/ch07-filenames.xml:172
7839 msgid ""
7840 "If the first character after the <quote><literal>[</literal></quote> in a "
7841 "character class is a <quote><literal>!</literal></quote>, it "
7842 "<emphasis>negates</emphasis> the class, making it match any single character "
7843 "not in the class."
7844 msgstr ""
7846 #. type: Content of: <book><chapter><sect1><sect2><para>
7847 #: ../en/ch07-filenames.xml:178
7848 msgid ""
7849 "A <quote><literal>{</literal></quote> begins a group of subpatterns, where "
7850 "the whole group matches if any subpattern in the group matches. The "
7851 "<quote><literal>,</literal></quote> character separates subpatterns, and "
7852 "<quote><literal>}</literal></quote> ends the group."
7853 msgstr ""
7855 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
7856 #: ../en/ch07-filenames.xml:187
7857 msgid "Watch out!"
7858 msgstr "千万小心!"
7861 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
7862 #: ../en/ch07-filenames.xml:189
7863 msgid ""
7864 "Don't forget that if you want to match a pattern in any directory, you should "
7865 "not be using the <quote><literal>*</literal></quote> match-any token, as this "
7866 "will only match within one directory. Instead, use the <quote><literal>**</"
7867 "literal></quote> token. This small example illustrates the difference "
7868 "between the two."
7869 msgstr ""
7871 #. type: Content of: <book><chapter><sect1><sect2><title>
7872 #: ../en/ch07-filenames.xml:201
7873 msgid "Regular expression matching with <literal>re</literal> patterns"
7874 msgstr "使用 <literal>re</literal> 模式的正则表达式匹配"
7876 #. type: Content of: <book><chapter><sect1><sect2><para>
7877 #: ../en/ch07-filenames.xml:204
7878 msgid ""
7879 "Mercurial accepts the same regular expression syntax as the Python "
7880 "programming language (it uses Python's regexp engine internally). This is "
7881 "based on the Perl language's regexp syntax, which is the most popular dialect "
7882 "in use (it's also used in Java, for example)."
7883 msgstr ""
7885 #. type: Content of: <book><chapter><sect1><sect2><para>
7886 #: ../en/ch07-filenames.xml:210
7887 msgid ""
7888 "I won't discuss Mercurial's regexp dialect in any detail here, as regexps are "
7889 "not often used. Perl-style regexps are in any case already exhaustively "
7890 "documented on a multitude of web sites, and in many books. Instead, I will "
7891 "focus here on a few things you should know if you find yourself needing to "
7892 "use regexps with Mercurial."
7893 msgstr ""
7895 #. type: Content of: <book><chapter><sect1><sect2><para>
7896 #: ../en/ch07-filenames.xml:217
7897 msgid ""
7898 "A regexp is matched against an entire file name, relative to the root of the "
7899 "repository. In other words, even if you're already in subbdirectory "
7900 "<filename class=\"directory\">foo</filename>, if you want to match files "
7901 "under this directory, your pattern must start with <quote><literal>foo/</"
7902 "literal></quote>."
7903 msgstr ""
7905 #. type: Content of: <book><chapter><sect1><sect2><para>
7906 #: ../en/ch07-filenames.xml:224
7907 msgid ""
7908 "One thing to note, if you're familiar with Perl-style regexps, is that "
7909 "Mercurial's are <emphasis>rooted</emphasis>. That is, a regexp starts "
7910 "matching against the beginning of a string; it doesn't look for a match "
7911 "anywhere within the string. To match anywhere in a string, start your "
7912 "pattern with <quote><literal>.*</literal></quote>."
7913 msgstr ""
7915 #. type: Content of: <book><chapter><sect1><title>
7916 #: ../en/ch07-filenames.xml:234
7917 msgid "Filtering files"
7918 msgstr "过滤文件"
7920 #. type: Content of: <book><chapter><sect1><para>
7921 #: ../en/ch07-filenames.xml:236
7922 msgid ""
7923 "Not only does Mercurial give you a variety of ways to specify files; it lets "
7924 "you further winnow those files using <emphasis>filters</emphasis>. Commands "
7925 "that work with file names accept two filtering options."
7926 msgstr ""
7928 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
7929 #: ../en/ch07-filenames.xml:241
7930 msgid ""
7931 "<option role=\"hg-opt-global\">-I</option>, or <option role=\"hg-opt-global"
7932 "\">--include</option>, lets you specify a pattern that file names must match "
7933 "in order to be processed."
7934 msgstr ""
7936 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
7937 #: ../en/ch07-filenames.xml:246
7938 msgid ""
7939 "<option role=\"hg-opt-global\">-X</option>, or <option role=\"hg-opt-global"
7940 "\">--exclude</option>, gives you a way to <emphasis>avoid</emphasis> "
7941 "processing files, if they match this pattern."
7942 msgstr ""
7944 #. type: Content of: <book><chapter><sect1><para>
7945 #: ../en/ch07-filenames.xml:251
7946 msgid ""
7947 "You can provide multiple <option role=\"hg-opt-global\">-I</option> and "
7948 "<option role=\"hg-opt-global\">-X</option> options on the command line, and "
7949 "intermix them as you please. Mercurial interprets the patterns you provide "
7950 "using glob syntax by default (but you can use regexps if you need to)."
7951 msgstr ""
7953 #. type: Content of: <book><chapter><sect1><para>
7954 #: ../en/ch07-filenames.xml:258
7955 msgid ""
7956 "You can read a <option role=\"hg-opt-global\">-I</option> filter as "
7957 "<quote>process only the files that match this filter</quote>."
7958 msgstr ""
7960 #. type: Content of: <book><chapter><sect1><para>
7961 #: ../en/ch07-filenames.xml:264
7962 msgid ""
7963 "The <option role=\"hg-opt-global\">-X</option> filter is best read as "
7964 "<quote>process only the files that don't match this pattern</quote>."
7965 msgstr ""
7967 #. type: Content of: <book><chapter><sect1><title>
7968 #: ../en/ch07-filenames.xml:272
7969 msgid "Ignoring unwanted files and directories"
7970 msgstr "忽略不需要的文件和目录"
7972 #. type: Content of: <book><chapter><sect1><para>
7973 #: ../en/ch07-filenames.xml:274
7974 msgid "XXX."
7975 msgstr ""
7977 #. type: Content of: <book><chapter><sect1><title>
7978 #: ../en/ch07-filenames.xml:278
7979 msgid "Case sensitivity"
7980 msgstr "大小写敏感性"
7982 #. type: Content of: <book><chapter><sect1><para>
7983 #: ../en/ch07-filenames.xml:280
7984 msgid ""
7985 "If you're working in a mixed development environment that contains both Linux "
7986 "(or other Unix) systems and Macs or Windows systems, you should keep in the "
7987 "back of your mind the knowledge that they treat the case (<quote>N</quote> "
7988 "versus <quote>n</quote>) of file names in incompatible ways. This is not "
7989 "very likely to affect you, and it's easy to deal with if it does, but it "
7990 "could surprise you if you don't know about it."
7991 msgstr ""
7993 #. type: Content of: <book><chapter><sect1><para>
7994 #: ../en/ch07-filenames.xml:289
7995 msgid ""
7996 "Operating systems and filesystems differ in the way they handle the "
7997 "<emphasis>case</emphasis> of characters in file and directory names. There "
7998 "are three common ways to handle case in names."
7999 msgstr ""
8001 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
8002 #: ../en/ch07-filenames.xml:294
8003 msgid ""
8004 "Completely case insensitive. Uppercase and lowercase versions of a letter "
8005 "are treated as identical, both when creating a file and during subsequent "
8006 "accesses. This is common on older DOS-based systems."
8007 msgstr ""
8009 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
8010 #: ../en/ch07-filenames.xml:299
8011 msgid ""
8012 "Case preserving, but insensitive. When a file or directory is created, the "
8013 "case of its name is stored, and can be retrieved and displayed by the "
8014 "operating system. When an existing file is being looked up, its case is "
8015 "ignored. This is the standard arrangement on Windows and MacOS. The names "
8016 "<filename>foo</filename> and <filename>FoO</filename> identify the same "
8017 "file. This treatment of uppercase and lowercase letters as interchangeable "
8018 "is also referred to as <emphasis>case folding</emphasis>."
8019 msgstr ""
8021 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
8022 #: ../en/ch07-filenames.xml:310
8023 msgid ""
8024 "Case sensitive. The case of a name is significant at all times. The names "
8025 "<filename>foo</filename> and {FoO} identify different files. This is the way "
8026 "Linux and Unix systems normally work."
8027 msgstr ""
8029 #. type: Content of: <book><chapter><sect1><para>
8030 #: ../en/ch07-filenames.xml:316
8031 msgid ""
8032 "On Unix-like systems, it is possible to have any or all of the above ways of "
8033 "handling case in action at once. For example, if you use a USB thumb drive "
8034 "formatted with a FAT32 filesystem on a Linux system, Linux will handle names "
8035 "on that filesystem in a case preserving, but insensitive, way."
8036 msgstr ""
8038 #. type: Content of: <book><chapter><sect1><sect2><title>
8039 #: ../en/ch07-filenames.xml:323
8040 msgid "Safe, portable repository storage"
8041 msgstr "安全,可移植的版本库存储"
8043 #. type: Content of: <book><chapter><sect1><sect2><para>
8044 #: ../en/ch07-filenames.xml:325
8045 msgid ""
8046 "Mercurial's repository storage mechanism is <emphasis>case safe</emphasis>. "
8047 "It translates file names so that they can be safely stored on both case "
8048 "sensitive and case insensitive filesystems. This means that you can use "
8049 "normal file copying tools to transfer a Mercurial repository onto, for "
8050 "example, a USB thumb drive, and safely move that drive and repository back "
8051 "and forth between a Mac, a PC running Windows, and a Linux box."
8052 msgstr ""
8054 #. type: Content of: <book><chapter><sect1><sect2><title>
8055 #: ../en/ch07-filenames.xml:336
8056 msgid "Detecting case conflicts"
8057 msgstr "检测大小写冲突"
8059 #. type: Content of: <book><chapter><sect1><sect2><para>
8060 #: ../en/ch07-filenames.xml:338
8061 msgid ""
8062 "When operating in the working directory, Mercurial honours the naming policy "
8063 "of the filesystem where the working directory is located. If the filesystem "
8064 "is case preserving, but insensitive, Mercurial will treat names that differ "
8065 "only in case as the same."
8066 msgstr ""
8068 #. type: Content of: <book><chapter><sect1><sect2><para>
8069 #: ../en/ch07-filenames.xml:344
8070 msgid ""
8071 "An important aspect of this approach is that it is possible to commit a "
8072 "changeset on a case sensitive (typically Linux or Unix) filesystem that will "
8073 "cause trouble for users on case insensitive (usually Windows and MacOS) "
8074 "users. If a Linux user commits changes to two files, one named "
8075 "<filename>myfile.c</filename> and the other named <filename>MyFile.C</"
8076 "filename>, they will be stored correctly in the repository. And in the "
8077 "working directories of other Linux users, they will be correctly represented "
8078 "as separate files."
8079 msgstr ""
8081 #. type: Content of: <book><chapter><sect1><sect2><para>
8082 #: ../en/ch07-filenames.xml:355
8083 msgid ""
8084 "If a Windows or Mac user pulls this change, they will not initially have a "
8085 "problem, because Mercurial's repository storage mechanism is case safe. "
8086 "However, once they try to <command role=\"hg-cmd\">hg update</command> the "
8087 "working directory to that changeset, or <command role=\"hg-cmd\">hg merge</"
8088 "command> with that changeset, Mercurial will spot the conflict between the "
8089 "two file names that the filesystem would treat as the same, and forbid the "
8090 "update or merge from occurring."
8091 msgstr ""
8093 #. type: Content of: <book><chapter><sect1><sect2><title>
8094 #: ../en/ch07-filenames.xml:367
8095 msgid "Fixing a case conflict"
8096 msgstr "修正大小写冲突"
8098 #. type: Content of: <book><chapter><sect1><sect2><para>
8099 #: ../en/ch07-filenames.xml:369
8100 msgid ""
8101 "If you are using Windows or a Mac in a mixed environment where some of your "
8102 "collaborators are using Linux or Unix, and Mercurial reports a case folding "
8103 "conflict when you try to <command role=\"hg-cmd\">hg update</command> or "
8104 "<command role=\"hg-cmd\">hg merge</command>, the procedure to fix the problem "
8105 "is simple."
8106 msgstr ""
8108 #. type: Content of: <book><chapter><sect1><sect2><para>
8109 #: ../en/ch07-filenames.xml:376
8110 msgid ""
8111 "Just find a nearby Linux or Unix box, clone the problem repository onto it, "
8112 "and use Mercurial's <command role=\"hg-cmd\">hg rename</command> command to "
8113 "change the names of any offending files or directories so that they will no "
8114 "longer cause case folding conflicts. Commit this change, <command role=\"hg-"
8115 "cmd\">hg pull</command> or <command role=\"hg-cmd\">hg push</command> it "
8116 "across to your Windows or MacOS system, and <command role=\"hg-cmd\">hg "
8117 "update</command> to the revision with the non-conflicting names."
8118 msgstr ""
8120 #. type: Content of: <book><chapter><sect1><sect2><para>
8121 #: ../en/ch07-filenames.xml:386
8122 msgid ""
8123 "The changeset with case-conflicting names will remain in your project's "
8124 "history, and you still won't be able to <command role=\"hg-cmd\">hg update</"
8125 "command> your working directory to that changeset on a Windows or MacOS "
8126 "system, but you can continue development unimpeded."
8127 msgstr ""
8129 #. type: Content of: <book><chapter><sect1><sect2><note><para>
8130 #: ../en/ch07-filenames.xml:393
8131 msgid ""
8132 "Prior to version 0.9.3, Mercurial did not use a case safe repository storage "
8133 "mechanism, and did not detect case folding conflicts. If you are using an "
8134 "older version of Mercurial on Windows or MacOS, I strongly recommend that you "
8135 "upgrade."
8136 msgstr ""
8138 #. type: Content of: <book><chapter><title>
8139 #: ../en/ch08-branch.xml:5
8140 msgid "Managing releases and branchy development"
8141 msgstr "发布管理与分支开发"
8143 #. type: Content of: <book><chapter><para>
8144 #: ../en/ch08-branch.xml:7
8145 msgid ""
8146 "Mercurial provides several mechanisms for you to manage a project that is "
8147 "making progress on multiple fronts at once. To understand these mechanisms, "
8148 "let's first take a brief look at a fairly normal software project structure."
8149 msgstr ""
8151 #. type: Content of: <book><chapter><para>
8152 #: ../en/ch08-branch.xml:12
8153 msgid ""
8154 "Many software projects issue periodic <quote>major</quote> releases that "
8155 "contain substantial new features. In parallel, they may issue <quote>minor</"
8156 "quote> releases. These are usually identical to the major releases off which "
8157 "they're based, but with a few bugs fixed."
8158 msgstr ""
8160 #. type: Content of: <book><chapter><para>
8161 #: ../en/ch08-branch.xml:18
8162 msgid ""
8163 "In this chapter, we'll start by talking about how to keep records of project "
8164 "milestones such as releases. We'll then continue on to talk about the flow "
8165 "of work between different phases of a project, and how Mercurial can help you "
8166 "to isolate and manage this work."
8167 msgstr ""
8169 #. type: Content of: <book><chapter><sect1><title>
8170 #: ../en/ch08-branch.xml:25
8171 msgid "Giving a persistent name to a revision"
8172 msgstr "给版本指定一个永久的名称"
8174 #. type: Content of: <book><chapter><sect1><para>
8175 #: ../en/ch08-branch.xml:27
8176 msgid ""
8177 "Once you decide that you'd like to call a particular revision a "
8178 "<quote>release</quote>, it's a good idea to record the identity of that "
8179 "revision. This will let you reproduce that release at a later date, for "
8180 "whatever purpose you might need at the time (reproducing a bug, porting to a "
8181 "new platform, etc). &interaction.tag.init;"
8182 msgstr ""
8185 #. type: Content of: <book><chapter><sect1><para>
8186 #: ../en/ch08-branch.xml:34
8187 msgid ""
8188 "Mercurial lets you give a permanent name to any revision using the <command "
8189 "role=\"hg-cmd\">hg tag</command> command. Not surprisingly, these names are "
8190 "called <quote>tags</quote>."
8191 msgstr ""
8193 #. type: Content of: <book><chapter><sect1><para>
8194 #: ../en/ch08-branch.xml:40
8195 msgid ""
8196 "A tag is nothing more than a <quote>symbolic name</quote> for a revision. "
8197 "Tags exist purely for your convenience, so that you have a handy permanent "
8198 "way to refer to a revision; Mercurial doesn't interpret the tag names you use "
8199 "in any way. Neither does Mercurial place any restrictions on the name of a "
8200 "tag, beyond a few that are necessary to ensure that a tag can be parsed "
8201 "unambiguously. A tag name cannot contain any of the following characters:"
8202 msgstr ""
8204 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
8205 #: ../en/ch08-branch.xml:49
8206 msgid "Colon (ASCII 58, <quote><literal>:</literal></quote>)"
8207 msgstr ""
8209 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
8210 #: ../en/ch08-branch.xml:52
8211 msgid "Carriage return (ASCII 13, <quote><literal>\\r</literal></quote>)"
8212 msgstr ""
8214 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
8215 #: ../en/ch08-branch.xml:55
8216 msgid "Newline (ASCII 10, <quote><literal>\\n</literal></quote>)"
8217 msgstr ""
8219 #. type: Content of: <book><chapter><sect1><para>
8220 #: ../en/ch08-branch.xml:59
8221 msgid ""
8222 "You can use the <command role=\"hg-cmd\">hg tags</command> command to display "
8223 "the tags present in your repository. In the output, each tagged revision is "
8224 "identified first by its name, then by revision number, and finally by the "
8225 "unique hash of the revision."
8226 msgstr ""
8228 #. type: Content of: <book><chapter><sect1><para>
8229 #: ../en/ch08-branch.xml:67
8230 msgid ""
8231 "Notice that <literal>tip</literal> is listed in the output of <command role="
8232 "\"hg-cmd\">hg tags</command>. The <literal>tip</literal> tag is a special "
8233 "<quote>floating</quote> tag, which always identifies the newest revision in "
8234 "the repository."
8235 msgstr ""
8237 #. type: Content of: <book><chapter><sect1><para>
8238 #: ../en/ch08-branch.xml:73
8239 msgid ""
8240 "In the output of the <command role=\"hg-cmd\">hg tags</command> command, tags "
8241 "are listed in reverse order, by revision number. This usually means that "
8242 "recent tags are listed before older tags. It also means that <literal>tip</"
8243 "literal> is always going to be the first tag listed in the output of <command "
8244 "role=\"hg-cmd\">hg tags</command>."
8245 msgstr ""
8247 #. type: Content of: <book><chapter><sect1><para>
8248 #: ../en/ch08-branch.xml:80
8249 msgid ""
8250 "When you run <command role=\"hg-cmd\">hg log</command>, if it displays a "
8251 "revision that has tags associated with it, it will print those tags."
8252 msgstr ""
8255 #. type: Content of: <book><chapter><sect1><para>
8256 #: ../en/ch08-branch.xml:86
8257 msgid ""
8258 "Any time you need to provide a revision ID to a Mercurial command, the "
8259 "command will accept a tag name in its place. Internally, Mercurial will "
8260 "translate your tag name into the corresponding revision ID, then use that."
8261 msgstr ""
8263 #. type: Content of: <book><chapter><sect1><para>
8264 #: ../en/ch08-branch.xml:93
8265 msgid ""
8266 "There's no limit on the number of tags you can have in a repository, or on "
8267 "the number of tags that a single revision can have. As a practical matter, "
8268 "it's not a great idea to have <quote>too many</quote> (a number which will "
8269 "vary from project to project), simply because tags are supposed to help you "
8270 "to find revisions. If you have lots of tags, the ease of using them to "
8271 "identify revisions diminishes rapidly."
8272 msgstr ""
8274 #. type: Content of: <book><chapter><sect1><para>
8275 #: ../en/ch08-branch.xml:101
8276 msgid ""
8277 "For example, if your project has milestones as frequent as every few days, "
8278 "it's perfectly reasonable to tag each one of those. But if you have a "
8279 "continuous build system that makes sure every revision can be built cleanly, "
8280 "you'd be introducing a lot of noise if you were to tag every clean build. "
8281 "Instead, you could tag failed builds (on the assumption that they're rare!), "
8282 "or simply not use tags to track buildability."
8283 msgstr ""
8285 #. type: Content of: <book><chapter><sect1><para>
8286 #: ../en/ch08-branch.xml:109
8287 msgid ""
8288 "If you want to remove a tag that you no longer want, use <command role=\"hg-"
8289 "cmd\">hg tag --remove</command>."
8290 msgstr ""
8292 #. type: Content of: <book><chapter><sect1><para>
8293 #: ../en/ch08-branch.xml:114
8294 msgid ""
8295 "You can also modify a tag at any time, so that it identifies a different "
8296 "revision, by simply issuing a new <command role=\"hg-cmd\">hg tag</command> "
8297 "command. You'll have to use the <option role=\"hg-opt-tag\">-f</option> "
8298 "option to tell Mercurial that you <emphasis>really</emphasis> want to update "
8299 "the tag."
8300 msgstr ""
8302 #. type: Content of: <book><chapter><sect1><para>
8303 #: ../en/ch08-branch.xml:123
8304 msgid ""
8305 "There will still be a permanent record of the previous identity of the tag, "
8306 "but Mercurial will no longer use it. There's thus no penalty to tagging the "
8307 "wrong revision; all you have to do is turn around and tag the correct "
8308 "revision once you discover your error."
8309 msgstr ""
8312 #. type: Content of: <book><chapter><sect1><para>
8313 #: ../en/ch08-branch.xml:129
8314 msgid ""
8315 "Mercurial stores tags in a normal revision-controlled file in your "
8316 "repository. If you've created any tags, you'll find them in a file named "
8317 "<filename role=\"special\">.hgtags</filename>. When you run the <command "
8318 "role=\"hg-cmd\">hg tag</command> command, Mercurial modifies this file, then "
8319 "automatically commits the change to it. This means that every time you run "
8320 "<command role=\"hg-cmd\">hg tag</command>, you'll see a corresponding "
8321 "changeset in the output of <command role=\"hg-cmd\">hg log</command>."
8322 msgstr ""
8324 #. type: Content of: <book><chapter><sect1><sect2><title>
8325 #: ../en/ch08-branch.xml:142
8326 msgid "Handling tag conflicts during a merge"
8327 msgstr "在合并期间处理标签冲突"
8329 #. type: Content of: <book><chapter><sect1><sect2><para>
8330 #: ../en/ch08-branch.xml:144
8331 msgid ""
8332 "You won't often need to care about the <filename role=\"special\">.hgtags</"
8333 "filename> file, but it sometimes makes its presence known during a merge. "
8334 "The format of the file is simple: it consists of a series of lines. Each "
8335 "line starts with a changeset hash, followed by a space, followed by the name "
8336 "of a tag."
8337 msgstr ""
8339 #. type: Content of: <book><chapter><sect1><sect2><para>
8340 #: ../en/ch08-branch.xml:151
8341 msgid ""
8342 "If you're resolving a conflict in the <filename role=\"special\">.hgtags</"
8343 "filename> file during a merge, there's one twist to modifying the <filename "
8344 "role=\"special\">.hgtags</filename> file: when Mercurial is parsing the tags "
8345 "in a repository, it <emphasis>never</emphasis> reads the working copy of the "
8346 "<filename role=\"special\">.hgtags</filename> file. Instead, it reads the "
8347 "<emphasis>most recently committed</emphasis> revision of the file."
8348 msgstr ""
8350 #. type: Content of: <book><chapter><sect1><sect2><para>
8351 #: ../en/ch08-branch.xml:161
8352 msgid ""
8353 "An unfortunate consequence of this design is that you can't actually verify "
8354 "that your merged <filename role=\"special\">.hgtags</filename> file is "
8355 "correct until <emphasis>after</emphasis> you've committed a change. So if "
8356 "you find yourself resolving a conflict on <filename role=\"special\">.hgtags</"
8357 "filename> during a merge, be sure to run <command role=\"hg-cmd\">hg tags</"
8358 "command> after you commit. If it finds an error in the <filename role="
8359 "\"special\">.hgtags</filename> file, it will report the location of the "
8360 "error, which you can then fix and commit. You should then run <command role="
8361 "\"hg-cmd\">hg tags</command> again, just to be sure that your fix is correct."
8362 msgstr ""
8364 #. type: Content of: <book><chapter><sect1><sect2><title>
8365 #: ../en/ch08-branch.xml:176
8366 msgid "Tags and cloning"
8367 msgstr "标签与克隆"
8369 #. type: Content of: <book><chapter><sect1><sect2><para>
8370 #: ../en/ch08-branch.xml:178
8371 msgid ""
8372 "You may have noticed that the <command role=\"hg-cmd\">hg clone</command> "
8373 "command has a <option role=\"hg-opt-clone\">-r</option> option that lets you "
8374 "clone an exact copy of the repository as of a particular changeset. The new "
8375 "clone will not contain any project history that comes after the revision you "
8376 "specified. This has an interaction with tags that can surprise the unwary."
8377 msgstr ""
8379 #. type: Content of: <book><chapter><sect1><sect2><para>
8380 #: ../en/ch08-branch.xml:186
8381 msgid ""
8382 "Recall that a tag is stored as a revision to the <filename role=\"special\">."
8383 "hgtags</filename> file, so that when you create a tag, the changeset in which "
8384 "it's recorded necessarily refers to an older changeset. When you run "
8385 "<command role=\"hg-cmd\">hg clone -r foo</command> to clone a repository as "
8386 "of tag <literal>foo</literal>, the new clone <emphasis>will not contain the "
8387 "history that created the tag</emphasis> that you used to clone the "
8388 "repository. The result is that you'll get exactly the right subset of the "
8389 "project's history in the new repository, but <emphasis>not</emphasis> the tag "
8390 "you might have expected."
8391 msgstr ""
8393 #. type: Content of: <book><chapter><sect1><sect2><title>
8394 #: ../en/ch08-branch.xml:201
8395 msgid "When permanent tags are too much"
8396 msgstr "当永久标签太多的时候"
8398 #. type: Content of: <book><chapter><sect1><sect2><para>
8399 #: ../en/ch08-branch.xml:203
8400 msgid ""
8401 "Since Mercurial's tags are revision controlled and carried around with a "
8402 "project's history, everyone you work with will see the tags you create. But "
8403 "giving names to revisions has uses beyond simply noting that revision "
8404 "<literal>4237e45506ee</literal> is really <literal>v2.0.2</literal>. If "
8405 "you're trying to track down a subtle bug, you might want a tag to remind you "
8406 "of something like <quote>Anne saw the symptoms with this revision</quote>."
8407 msgstr ""
8409 #. type: Content of: <book><chapter><sect1><sect2><para>
8410 #: ../en/ch08-branch.xml:213
8411 msgid ""
8412 "For cases like this, what you might want to use are <emphasis>local</"
8413 "emphasis> tags. You can create a local tag with the <option role=\"hg-opt-tag"
8414 "\">-l</option> option to the <command role=\"hg-cmd\">hg tag</command> "
8415 "command. This will store the tag in a file called <filename role=\"special"
8416 "\">.hg/localtags</filename>. Unlike <filename role=\"special\">.hgtags</"
8417 "filename>, <filename role=\"special\">.hg/localtags</filename> is not "
8418 "revision controlled. Any tags you create using <option role=\"hg-opt-tag\">-"
8419 "l</option> remain strictly local to the repository you're currently working "
8420 "in."
8421 msgstr ""
8423 #. type: Content of: <book><chapter><sect1><title>
8424 #: ../en/ch08-branch.xml:228
8425 msgid "The flow of changes&emdash;big picture vs. little"
8426 msgstr "修改流程&emdash;宏观与微观"
8428 #. type: Content of: <book><chapter><sect1><para>
8429 #: ../en/ch08-branch.xml:230
8430 msgid ""
8431 "To return to the outline I sketched at the beginning of a chapter, let's "
8432 "think about a project that has multiple concurrent pieces of work under "
8433 "development at once."
8434 msgstr ""
8436 #. type: Content of: <book><chapter><sect1><para>
8437 #: ../en/ch08-branch.xml:234
8438 msgid ""
8439 "There might be a push for a new <quote>main</quote> release; a new minor "
8440 "bugfix release to the last main release; and an unexpected <quote>hot fix</"
8441 "quote> to an old release that is now in maintenance mode."
8442 msgstr ""
8444 #. type: Content of: <book><chapter><sect1><para>
8445 #: ../en/ch08-branch.xml:239
8446 msgid ""
8447 "The usual way people refer to these different concurrent directions of "
8448 "development is as <quote>branches</quote>. However, we've already seen "
8449 "numerous times that Mercurial treats <emphasis>all of history</emphasis> as a "
8450 "series of branches and merges. Really, what we have here is two ideas that "
8451 "are peripherally related, but which happen to share a name."
8452 msgstr ""
8454 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
8455 #: ../en/ch08-branch.xml:246
8456 msgid ""
8457 "<quote>Big picture</quote> branches represent the sweep of a project's "
8458 "evolution; people give them names, and talk about them in conversation."
8459 msgstr ""
8461 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
8462 #: ../en/ch08-branch.xml:250
8463 msgid ""
8464 "<quote>Little picture</quote> branches are artefacts of the day-to-day "
8465 "activity of developing and merging changes. They expose the narrative of how "
8466 "the code was developed."
8467 msgstr ""
8469 #. type: Content of: <book><chapter><sect1><title>
8470 #: ../en/ch08-branch.xml:258
8471 msgid "Managing big-picture branches in repositories"
8472 msgstr "在版本库中管理分支"
8474 #. type: Content of: <book><chapter><sect1><para>
8475 #: ../en/ch08-branch.xml:260
8476 msgid ""
8477 "The easiest way to isolate a <quote>big picture</quote> branch in Mercurial "
8478 "is in a dedicated repository. If you have an existing shared "
8479 "repository&emdash;let's call it <literal>myproject</literal>&emdash;that "
8480 "reaches a <quote>1.0</quote> milestone, you can start to prepare for future "
8481 "maintenance releases on top of version 1.0 by tagging the revision from which "
8482 "you prepared the 1.0 release."
8483 msgstr ""
8485 #. type: Content of: <book><chapter><sect1><para>
8486 #: ../en/ch08-branch.xml:270
8487 msgid ""
8488 "You can then clone a new shared <literal>myproject-1.0.1</literal> repository "
8489 "as of that tag."
8490 msgstr ""
8492 #. type: Content of: <book><chapter><sect1><para>
8493 #: ../en/ch08-branch.xml:276
8494 msgid ""
8495 "Afterwards, if someone needs to work on a bug fix that ought to go into an "
8496 "upcoming 1.0.1 minor release, they clone the <literal>myproject-1.0.1</"
8497 "literal> repository, make their changes, and push them back."
8498 msgstr ""
8500 #. type: Content of: <book><chapter><sect1><para>
8501 #: ../en/ch08-branch.xml:283
8502 msgid ""
8503 "Meanwhile, development for the next major release can continue, isolated and "
8504 "unabated, in the <literal>myproject</literal> repository."
8505 msgstr ""
8507 #. type: Content of: <book><chapter><sect1><title>
8508 #: ../en/ch08-branch.xml:291
8509 msgid "Don't repeat yourself: merging across branches"
8510 msgstr "不要重复劳动:在分支间合并"
8512 #. type: Content of: <book><chapter><sect1><para>
8513 #: ../en/ch08-branch.xml:293
8514 msgid ""
8515 "In many cases, if you have a bug to fix on a maintenance branch, the chances "
8516 "are good that the bug exists on your project's main branch (and possibly "
8517 "other maintenance branches, too). It's a rare developer who wants to fix the "
8518 "same bug multiple times, so let's look at a few ways that Mercurial can help "
8519 "you to manage these bugfixes without duplicating your work."
8520 msgstr ""
8522 #. type: Content of: <book><chapter><sect1><para>
8523 #: ../en/ch08-branch.xml:301
8524 msgid ""
8525 "In the simplest instance, all you need to do is pull changes from your "
8526 "maintenance branch into your local clone of the target branch."
8527 msgstr ""
8529 #. type: Content of: <book><chapter><sect1><para>
8530 #: ../en/ch08-branch.xml:307
8531 msgid ""
8532 "You'll then need to merge the heads of the two branches, and push back to the "
8533 "main branch."
8534 msgstr ""
8536 #. type: Content of: <book><chapter><sect1><title>
8537 #: ../en/ch08-branch.xml:314
8538 msgid "Naming branches within one repository"
8539 msgstr "版本库中的命名分支"
8541 #. type: Content of: <book><chapter><sect1><para>
8542 #: ../en/ch08-branch.xml:316
8543 msgid ""
8544 "In most instances, isolating branches in repositories is the right approach. "
8545 "Its simplicity makes it easy to understand; and so it's hard to make "
8546 "mistakes. There's a one-to-one relationship between branches you're working "
8547 "in and directories on your system. This lets you use normal (non-Mercurial-"
8548 "aware) tools to work on files within a branch/repository."
8549 msgstr ""
8551 #. type: Content of: <book><chapter><sect1><para>
8552 #: ../en/ch08-branch.xml:323
8553 msgid ""
8554 "If you're more in the <quote>power user</quote> category (<emphasis>and</"
8555 "emphasis> your collaborators are too), there is an alternative way of "
8556 "handling branches that you can consider. I've already mentioned the human-"
8557 "level distinction between <quote>small picture</quote> and <quote>big "
8558 "picture</quote> branches. While Mercurial works with multiple <quote>small "
8559 "picture</quote> branches in a repository all the time (for example after you "
8560 "pull changes in, but before you merge them), it can <emphasis>also</emphasis> "
8561 "work with multiple <quote>big picture</quote> branches."
8562 msgstr ""
8564 #. type: Content of: <book><chapter><sect1><para>
8565 #: ../en/ch08-branch.xml:334
8566 msgid ""
8567 "The key to working this way is that Mercurial lets you assign a persistent "
8568 "<emphasis>name</emphasis> to a branch. There always exists a branch named "
8569 "<literal>default</literal>. Even before you start naming branches yourself, "
8570 "you can find traces of the <literal>default</literal> branch if you look for "
8571 "them."
8572 msgstr ""
8574 #. type: Content of: <book><chapter><sect1><para>
8575 #: ../en/ch08-branch.xml:341
8576 msgid ""
8577 "As an example, when you run the <command role=\"hg-cmd\">hg commit</command> "
8578 "command, and it pops up your editor so that you can enter a commit message, "
8579 "look for a line that contains the text <quote><literal>HG: branch default</"
8580 "literal></quote> at the bottom. This is telling you that your commit will "
8581 "occur on the branch named <literal>default</literal>."
8582 msgstr ""
8584 #. type: Content of: <book><chapter><sect1><para>
8585 #: ../en/ch08-branch.xml:348
8586 msgid ""
8587 "To start working with named branches, use the <command role=\"hg-cmd\">hg "
8588 "branches</command> command. This command lists the named branches already "
8589 "present in your repository, telling you which changeset is the tip of each."
8590 msgstr ""
8592 #. type: Content of: <book><chapter><sect1><para>
8593 #: ../en/ch08-branch.xml:355
8594 msgid ""
8595 "Since you haven't created any named branches yet, the only one that exists is "
8596 "<literal>default</literal>."
8597 msgstr ""
8599 #. type: Content of: <book><chapter><sect1><para>
8600 #: ../en/ch08-branch.xml:358
8601 msgid ""
8602 "To find out what the <quote>current</quote> branch is, run the <command role="
8603 "\"hg-cmd\">hg branch</command> command, giving it no arguments. This tells "
8604 "you what branch the parent of the current changeset is on."
8605 msgstr ""
8608 #. type: Content of: <book><chapter><sect1><para>
8609 #: ../en/ch08-branch.xml:365
8610 msgid ""
8611 "To create a new branch, run the <command role=\"hg-cmd\">hg branch</command> "
8612 "command again. This time, give it one argument: the name of the branch you "
8613 "want to create."
8614 msgstr ""
8616 #. type: Content of: <book><chapter><sect1><para>
8617 #: ../en/ch08-branch.xml:371
8618 msgid ""
8619 "After you've created a branch, you might wonder what effect the <command role="
8620 "\"hg-cmd\">hg branch</command> command has had. What do the <command role="
8621 "\"hg-cmd\">hg status</command> and <command role=\"hg-cmd\">hg tip</command> "
8622 "commands report?"
8623 msgstr ""
8625 #. type: Content of: <book><chapter><sect1><para>
8626 #: ../en/ch08-branch.xml:378
8627 msgid ""
8628 "Nothing has changed in the working directory, and there's been no new history "
8629 "created. As this suggests, running the <command role=\"hg-cmd\">hg branch</"
8630 "command> command has no permanent effect; it only tells Mercurial what branch "
8631 "name to use the <emphasis>next</emphasis> time you commit a changeset."
8632 msgstr ""
8634 #. type: Content of: <book><chapter><sect1><para>
8635 #: ../en/ch08-branch.xml:385
8636 msgid ""
8637 "When you commit a change, Mercurial records the name of the branch on which "
8638 "you committed. Once you've switched from the <literal>default</literal> "
8639 "branch to another and committed, you'll see the name of the new branch show "
8640 "up in the output of <command role=\"hg-cmd\">hg log</command>, <command role="
8641 "\"hg-cmd\">hg tip</command>, and other commands that display the same kind of "
8642 "output."
8643 msgstr ""
8645 #. type: Content of: <book><chapter><sect1><para>
8646 #: ../en/ch08-branch.xml:395
8647 msgid ""
8648 "The <command role=\"hg-cmd\">hg log</command>-like commands will print the "
8649 "branch name of every changeset that's not on the <literal>default</literal> "
8650 "branch. As a result, if you never use named branches, you'll never see this "
8651 "information."
8652 msgstr ""
8654 #. type: Content of: <book><chapter><sect1><para>
8655 #: ../en/ch08-branch.xml:400
8656 msgid ""
8657 "Once you've named a branch and committed a change with that name, every "
8658 "subsequent commit that descends from that change will inherit the same branch "
8659 "name. You can change the name of a branch at any time, using the <command "
8660 "role=\"hg-cmd\">hg branch</command> command."
8661 msgstr ""
8663 #. type: Content of: <book><chapter><sect1><para>
8664 #: ../en/ch08-branch.xml:408
8665 msgid ""
8666 "In practice, this is something you won't do very often, as branch names tend "
8667 "to have fairly long lifetimes. (This isn't a rule, just an observation.)"
8668 msgstr ""
8670 #. type: Content of: <book><chapter><sect1><title>
8671 #: ../en/ch08-branch.xml:414
8672 msgid "Dealing with multiple named branches in a repository"
8673 msgstr "在版本库中处理多个命名分支"
8675 #. type: Content of: <book><chapter><sect1><para>
8676 #: ../en/ch08-branch.xml:417
8677 msgid ""
8678 "If you have more than one named branch in a repository, Mercurial will "
8679 "remember the branch that your working directory on when you start a command "
8680 "like <command role=\"hg-cmd\">hg update</command> or <command role=\"hg-cmd"
8681 "\">hg pull -u</command>. It will update the working directory to the tip of "
8682 "this branch, no matter what the <quote>repo-wide</quote> tip is. To update "
8683 "to a revision that's on a different named branch, you may need to use the "
8684 "<option role=\"hg-opt-update\">-C</option> option to <command role=\"hg-cmd"
8685 "\">hg update</command>."
8686 msgstr ""
8688 #. type: Content of: <book><chapter><sect1><para>
8689 #: ../en/ch08-branch.xml:427
8690 msgid ""
8691 "This behaviour is a little subtle, so let's see it in action. First, let's "
8692 "remind ourselves what branch we're currently on, and what branches are in our "
8693 "repository."
8694 msgstr ""
8696 #. type: Content of: <book><chapter><sect1><para>
8697 #: ../en/ch08-branch.xml:433
8698 msgid ""
8699 "We're on the <literal>bar</literal> branch, but there also exists an older "
8700 "<command role=\"hg-cmd\">hg foo</command> branch."
8701 msgstr ""
8703 #. type: Content of: <book><chapter><sect1><para>
8704 #: ../en/ch08-branch.xml:437
8705 msgid ""
8706 "We can <command role=\"hg-cmd\">hg update</command> back and forth between "
8707 "the tips of the <literal>foo</literal> and <literal>bar</literal> branches "
8708 "without needing to use the <option role=\"hg-opt-update\">-C</option> option, "
8709 "because this only involves going backwards and forwards linearly through our "
8710 "change history."
8711 msgstr ""
8714 #. type: Content of: <book><chapter><sect1><para>
8715 #: ../en/ch08-branch.xml:446
8716 msgid ""
8717 "If we go back to the <literal>foo</literal> branch and then run <command role="
8718 "\"hg-cmd\">hg update</command>, it will keep us on <literal>foo</literal>, "
8719 "not move us to the tip of <literal>bar</literal>."
8720 msgstr ""
8723 #. type: Content of: <book><chapter><sect1><para>
8724 #: ../en/ch08-branch.xml:453
8725 msgid ""
8726 "Committing a new change on the <literal>foo</literal> branch introduces a new "
8727 "head."
8728 msgstr ""
8730 #. type: Content of: <book><chapter><sect1><title>
8731 #: ../en/ch08-branch.xml:460
8732 msgid "Branch names and merging"
8733 msgstr "分支名称与合并"
8735 #. type: Content of: <book><chapter><sect1><para>
8736 #: ../en/ch08-branch.xml:462
8737 msgid ""
8738 "As you've probably noticed, merges in Mercurial are not symmetrical. Let's "
8739 "say our repository has two heads, 17 and 23. If I <command role=\"hg-cmd"
8740 "\">hg update</command> to 17 and then <command role=\"hg-cmd\">hg merge</"
8741 "command> with 23, Mercurial records 17 as the first parent of the merge, and "
8742 "23 as the second. Whereas if I <command role=\"hg-cmd\">hg update</command> "
8743 "to 23 and then <command role=\"hg-cmd\">hg merge</command> with 17, it "
8744 "records 23 as the first parent, and 17 as the second."
8745 msgstr ""
8747 #. type: Content of: <book><chapter><sect1><para>
8748 #: ../en/ch08-branch.xml:472
8749 msgid ""
8750 "This affects Mercurial's choice of branch name when you merge. After a "
8751 "merge, Mercurial will retain the branch name of the first parent when you "
8752 "commit the result of the merge. If your first parent's branch name is "
8753 "<literal>foo</literal>, and you merge with <literal>bar</literal>, the branch "
8754 "name will still be <literal>foo</literal> after you merge."
8755 msgstr ""
8757 #. type: Content of: <book><chapter><sect1><para>
8758 #: ../en/ch08-branch.xml:479
8759 msgid ""
8760 "It's not unusual for a repository to contain multiple heads, each with the "
8761 "same branch name. Let's say I'm working on the <literal>foo</literal> "
8762 "branch, and so are you. We commit different changes; I pull your changes; I "
8763 "now have two heads, each claiming to be on the <literal>foo</literal> "
8764 "branch. The result of a merge will be a single head on the <literal>foo</"
8765 "literal> branch, as you might hope."
8766 msgstr ""
8769 #. type: Content of: <book><chapter><sect1><para>
8770 #: ../en/ch08-branch.xml:487
8771 msgid ""
8772 "But if I'm working on the <literal>bar</literal> branch, and I merge work "
8773 "from the <literal>foo</literal> branch, the result will remain on the "
8774 "<literal>bar</literal> branch."
8775 msgstr ""
8777 #. type: Content of: <book><chapter><sect1><para>
8778 #: ../en/ch08-branch.xml:493
8779 msgid ""
8780 "To give a more concrete example, if I'm working on the <literal>bleeding-"
8781 "edge</literal> branch, and I want to bring in the latest fixes from the "
8782 "<literal>stable</literal> branch, Mercurial will choose the <quote>right</"
8783 "quote> (<literal>bleeding-edge</literal>) branch name when I pull and merge "
8784 "from <literal>stable</literal>."
8785 msgstr ""
8787 #. type: Content of: <book><chapter><sect1><title>
8788 #: ../en/ch08-branch.xml:502
8789 msgid "Branch naming is generally useful"
8790 msgstr "分支名称通常都很有用"
8792 #. type: Content of: <book><chapter><sect1><para>
8793 #: ../en/ch08-branch.xml:504
8794 msgid ""
8795 "You shouldn't think of named branches as applicable only to situations where "
8796 "you have multiple long-lived branches cohabiting in a single repository. "
8797 "They're very useful even in the one-branch-per-repository case."
8798 msgstr ""
8800 #. type: Content of: <book><chapter><sect1><para>
8801 #: ../en/ch08-branch.xml:509
8802 msgid ""
8803 "In the simplest case, giving a name to each branch gives you a permanent "
8804 "record of which branch a changeset originated on. This gives you more "
8805 "context when you're trying to follow the history of a long-lived branchy "
8806 "project."
8807 msgstr ""
8809 #. type: Content of: <book><chapter><sect1><para>
8810 #: ../en/ch08-branch.xml:514
8811 msgid ""
8812 "If you're working with shared repositories, you can set up a <literal role="
8813 "\"hook\">pretxnchangegroup</literal> hook on each that will block incoming "
8814 "changes that have the <quote>wrong</quote> branch name. This provides a "
8815 "simple, but effective, defence against people accidentally pushing changes "
8816 "from a <quote>bleeding edge</quote> branch to a <quote>stable</quote> "
8817 "branch. Such a hook might look like this inside the shared repo's <filename "
8818 "role=\"special\"> /.hgrc</filename>."
8819 msgstr ""
8821 #. type: Content of: <book><chapter><title>
8822 #: ../en/ch09-undo.xml:5
8823 msgid "Finding and fixing mistakes"
8824 msgstr "查找和修改错误"
8826 #. type: Content of: <book><chapter><para>
8827 #: ../en/ch09-undo.xml:7
8828 msgid ""
8829 "To err might be human, but to really handle the consequences well takes a top-"
8830 "notch revision control system. In this chapter, we'll discuss some of the "
8831 "techniques you can use when you find that a problem has crept into your "
8832 "project. Mercurial has some highly capable features that will help you to "
8833 "isolate the sources of problems, and to handle them appropriately."
8834 msgstr ""
8836 #. type: Content of: <book><chapter><sect1><title>
8837 #: ../en/ch09-undo.xml:15
8838 msgid "Erasing local history"
8839 msgstr "销毁本地历史"
8841 #. type: Content of: <book><chapter><sect1><sect2><title>
8842 #: ../en/ch09-undo.xml:18
8843 msgid "The accidental commit"
8844 msgstr "意外的提交"
8846 #. type: Content of: <book><chapter><sect1><sect2><para>
8847 #: ../en/ch09-undo.xml:20
8848 msgid ""
8849 "I have the occasional but persistent problem of typing rather more quickly "
8850 "than I can think, which sometimes results in me committing a changeset that "
8851 "is either incomplete or plain wrong. In my case, the usual kind of "
8852 "incomplete changeset is one in which I've created a new source file, but "
8853 "forgotten to <command role=\"hg-cmd\">hg add</command> it. A <quote>plain "
8854 "wrong</quote> changeset is not as common, but no less annoying."
8855 msgstr ""
8857 #. type: Content of: <book><chapter><sect1><sect2><title>
8858 #: ../en/ch09-undo.xml:31
8859 msgid "Rolling back a transaction"
8860 msgstr "回滚一个事务"
8862 #. type: Content of: <book><chapter><sect1><sect2><para>
8863 #: ../en/ch09-undo.xml:33
8864 msgid ""
8865 "In section <xref linkend=\"sec.concepts.txn\"/>, I mentioned that Mercurial "
8866 "treats each modification of a repository as a <emphasis>transaction</"
8867 "emphasis>. Every time you commit a changeset or pull changes from another "
8868 "repository, Mercurial remembers what you did. You can undo, or "
8869 "<emphasis>roll back</emphasis>, exactly one of these actions using the "
8870 "<command role=\"hg-cmd\">hg rollback</command> command. (See section <xref "
8871 "linkend=\"sec.undo.rollback-after-push\"/> for an important caveat about the "
8872 "use of this command.)"
8873 msgstr ""
8875 #. type: Content of: <book><chapter><sect1><sect2><para>
8876 #: ../en/ch09-undo.xml:43
8877 msgid ""
8878 "Here's a mistake that I often find myself making: committing a change in "
8879 "which I've created a new file, but forgotten to <command role=\"hg-cmd\">hg "
8880 "add</command> it."
8881 msgstr ""
8883 #. type: Content of: <book><chapter><sect1><sect2><para>
8884 #: ../en/ch09-undo.xml:50
8885 msgid ""
8886 "Looking at the output of <command role=\"hg-cmd\">hg status</command> after "
8887 "the commit immediately confirms the error."
8888 msgstr ""
8890 #. type: Content of: <book><chapter><sect1><sect2><para>
8891 #: ../en/ch09-undo.xml:56
8892 msgid ""
8893 "The commit captured the changes to the file <filename>a</filename>, but not "
8894 "the new file <filename>b</filename>. If I were to push this changeset to a "
8895 "repository that I shared with a colleague, the chances are high that "
8896 "something in <filename>a</filename> would refer to <filename>b</filename>, "
8897 "which would not be present in their repository when they pulled my changes. "
8898 "I would thus become the object of some indignation."
8899 msgstr ""
8901 #. type: Content of: <book><chapter><sect1><sect2><para>
8902 #: ../en/ch09-undo.xml:65
8903 msgid ""
8904 "However, luck is with me&emdash;I've caught my error before I pushed the "
8905 "changeset. I use the <command role=\"hg-cmd\">hg rollback</command> command, "
8906 "and Mercurial makes that last changeset vanish."
8907 msgstr ""
8909 #. type: Content of: <book><chapter><sect1><sect2><para>
8910 #: ../en/ch09-undo.xml:72
8911 msgid ""
8912 "Notice that the changeset is no longer present in the repository's history, "
8913 "and the working directory once again thinks that the file <filename>a</"
8914 "filename> is modified. The commit and rollback have left the working "
8915 "directory exactly as it was prior to the commit; the changeset has been "
8916 "completely erased. I can now safely <command role=\"hg-cmd\">hg add</"
8917 "command> the file <filename>b</filename>, and rerun my commit."
8918 msgstr ""
8920 #. type: Content of: <book><chapter><sect1><sect2><title>
8921 #: ../en/ch09-undo.xml:85
8922 msgid "The erroneous pull"
8923 msgstr "错误的抓取"
8925 #. type: Content of: <book><chapter><sect1><sect2><para>
8926 #: ../en/ch09-undo.xml:87
8927 msgid ""
8928 "It's common practice with Mercurial to maintain separate development branches "
8929 "of a project in different repositories. Your development team might have one "
8930 "shared repository for your project's <quote>0.9</quote> release, and another, "
8931 "containing different changes, for the <quote>1.0</quote> release."
8932 msgstr ""
8934 #. type: Content of: <book><chapter><sect1><sect2><para>
8935 #: ../en/ch09-undo.xml:94
8936 msgid ""
8937 "Given this, you can imagine that the consequences could be messy if you had a "
8938 "local <quote>0.9</quote> repository, and accidentally pulled changes from the "
8939 "shared <quote>1.0</quote> repository into it. At worst, you could be paying "
8940 "insufficient attention, and push those changes into the shared <quote>0.9</"
8941 "quote> tree, confusing your entire team (but don't worry, we'll return to "
8942 "this horror scenario later). However, it's more likely that you'll notice "
8943 "immediately, because Mercurial will display the URL it's pulling from, or you "
8944 "will see it pull a suspiciously large number of changes into the repository."
8945 msgstr ""
8947 #. type: Content of: <book><chapter><sect1><sect2><para>
8948 #: ../en/ch09-undo.xml:106
8949 msgid ""
8950 "The <command role=\"hg-cmd\">hg rollback</command> command will work nicely "
8951 "to expunge all of the changesets that you just pulled. Mercurial groups all "
8952 "changes from one <command role=\"hg-cmd\">hg pull</command> into a single "
8953 "transaction, so one <command role=\"hg-cmd\">hg rollback</command> is all you "
8954 "need to undo this mistake."
8955 msgstr ""
8957 #. type: Content of: <book><chapter><sect1><sect2><title>
8958 #: ../en/ch09-undo.xml:115
8959 msgid "Rolling back is useless once you've pushed"
8960 msgstr "当完成推送后,回滚是无效的"
8962 #. type: Content of: <book><chapter><sect1><sect2><para>
8963 #: ../en/ch09-undo.xml:117
8964 msgid ""
8965 "The value of the <command role=\"hg-cmd\">hg rollback</command> command drops "
8966 "to zero once you've pushed your changes to another repository. Rolling back "
8967 "a change makes it disappear entirely, but <emphasis>only</emphasis> in the "
8968 "repository in which you perform the <command role=\"hg-cmd\">hg rollback</"
8969 "command>. Because a rollback eliminates history, there's no way for the "
8970 "disappearance of a change to propagate between repositories."
8971 msgstr ""
8973 #. type: Content of: <book><chapter><sect1><sect2><para>
8974 #: ../en/ch09-undo.xml:126
8975 msgid ""
8976 "If you've pushed a change to another repository&emdash;particularly if it's a "
8977 "shared repository&emdash;it has essentially <quote>escaped into the wild,</"
8978 "quote> and you'll have to recover from your mistake in a different way. What "
8979 "will happen if you push a changeset somewhere, then roll it back, then pull "
8980 "from the repository you pushed to, is that the changeset will reappear in "
8981 "your repository."
8982 msgstr ""
8984 #. type: Content of: <book><chapter><sect1><sect2><para>
8985 #: ../en/ch09-undo.xml:135
8986 msgid ""
8987 "(If you absolutely know for sure that the change you want to roll back is the "
8988 "most recent change in the repository that you pushed to, <emphasis>and</"
8989 "emphasis> you know that nobody else could have pulled it from that "
8990 "repository, you can roll back the changeset there, too, but you really should "
8991 "really not rely on this working reliably. If you do this, sooner or later a "
8992 "change really will make it into a repository that you don't directly control "
8993 "(or have forgotten about), and come back to bite you.)"
8994 msgstr ""
8996 #. type: Content of: <book><chapter><sect1><sect2><title>
8997 #: ../en/ch09-undo.xml:147
8998 msgid "You can only roll back once"
8999 msgstr "你只能回滚一次"
9001 #. type: Content of: <book><chapter><sect1><sect2><para>
9002 #: ../en/ch09-undo.xml:149
9003 msgid ""
9004 "Mercurial stores exactly one transaction in its transaction log; that "
9005 "transaction is the most recent one that occurred in the repository. This "
9006 "means that you can only roll back one transaction. If you expect to be able "
9007 "to roll back one transaction, then its predecessor, this is not the behaviour "
9008 "you will get."
9009 msgstr ""
9011 #. type: Content of: <book><chapter><sect1><sect2><para>
9012 #: ../en/ch09-undo.xml:158
9013 msgid ""
9014 "Once you've rolled back one transaction in a repository, you can't roll back "
9015 "again in that repository until you perform another commit or pull."
9016 msgstr ""
9018 #. type: Content of: <book><chapter><sect1><title>
9019 #: ../en/ch09-undo.xml:165
9020 msgid "Reverting the mistaken change"
9021 msgstr "撤销错误的修改"
9023 #. type: Content of: <book><chapter><sect1><para>
9024 #: ../en/ch09-undo.xml:167
9025 msgid ""
9026 "If you make a modification to a file, and decide that you really didn't want "
9027 "to change the file at all, and you haven't yet committed your changes, the "
9028 "<command role=\"hg-cmd\">hg revert</command> command is the one you'll need. "
9029 "It looks at the changeset that's the parent of the working directory, and "
9030 "restores the contents of the file to their state as of that changeset. "
9031 "(That's a long-winded way of saying that, in the normal case, it undoes your "
9032 "modifications.)"
9033 msgstr ""
9035 #. type: Content of: <book><chapter><sect1><para>
9036 #: ../en/ch09-undo.xml:176
9037 msgid ""
9038 "Let's illustrate how the <command role=\"hg-cmd\">hg revert</command> command "
9039 "works with yet another small example. We'll begin by modifying a file that "
9040 "Mercurial is already tracking."
9041 msgstr ""
9043 #. type: Content of: <book><chapter><sect1><para>
9044 #: ../en/ch09-undo.xml:183
9045 msgid ""
9046 "If we don't want that change, we can simply <command role=\"hg-cmd\">hg "
9047 "revert</command> the file."
9048 msgstr ""
9050 #. type: Content of: <book><chapter><sect1><para>
9051 #: ../en/ch09-undo.xml:189
9052 msgid ""
9053 "The <command role=\"hg-cmd\">hg revert</command> command provides us with an "
9054 "extra degree of safety by saving our modified file with a <filename>.orig</"
9055 "filename> extension."
9056 msgstr ""
9058 #. type: Content of: <book><chapter><sect1><para>
9059 #: ../en/ch09-undo.xml:196
9060 msgid ""
9061 "Here is a summary of the cases that the <command role=\"hg-cmd\">hg revert</"
9062 "command> command can deal with. We will describe each of these in more "
9063 "detail in the section that follows."
9064 msgstr ""
9066 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
9067 #: ../en/ch09-undo.xml:201
9068 msgid "If you modify a file, it will restore the file to its unmodified state."
9069 msgstr ""
9071 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
9072 #: ../en/ch09-undo.xml:204
9073 msgid ""
9074 "If you <command role=\"hg-cmd\">hg add</command> a file, it will undo the "
9075 "<quote>added</quote> state of the file, but leave the file itself untouched."
9076 msgstr ""
9078 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
9079 #: ../en/ch09-undo.xml:208
9080 msgid ""
9081 "If you delete a file without telling Mercurial, it will restore the file to "
9082 "its unmodified contents."
9083 msgstr ""
9085 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
9086 #: ../en/ch09-undo.xml:211
9087 msgid ""
9088 "If you use the <command role=\"hg-cmd\">hg remove</command> command to remove "
9089 "a file, it will undo the <quote>removed</quote> state of the file, and "
9090 "restore the file to its unmodified contents."
9091 msgstr ""
9093 #. type: Content of: <book><chapter><sect1><sect2><title>
9094 #: ../en/ch09-undo.xml:218
9095 msgid "File management errors"
9096 msgstr "文件管理错误"
9098 #. type: Content of: <book><chapter><sect1><sect2><para>
9099 #: ../en/ch09-undo.xml:220
9100 msgid ""
9101 "The <command role=\"hg-cmd\">hg revert</command> command is useful for more "
9102 "than just modified files. It lets you reverse the results of all of "
9103 "Mercurial's file management commands&emdash;<command role=\"hg-cmd\">hg add</"
9104 "command>, <command role=\"hg-cmd\">hg remove</command>, and so on."
9105 msgstr ""
9108 #. type: Content of: <book><chapter><sect1><sect2><para>
9109 #: ../en/ch09-undo.xml:226
9110 msgid ""
9111 "If you <command role=\"hg-cmd\">hg add</command> a file, then decide that in "
9112 "fact you don't want Mercurial to track it, use <command role=\"hg-cmd\">hg "
9113 "revert</command> to undo the add. Don't worry; Mercurial will not modify the "
9114 "file in any way. It will just <quote>unmark</quote> the file."
9115 msgstr ""
9117 #. type: Content of: <book><chapter><sect1><sect2><para>
9118 #: ../en/ch09-undo.xml:234
9119 msgid ""
9120 "Similarly, if you ask Mercurial to <command role=\"hg-cmd\">hg remove</"
9121 "command> a file, you can use <command role=\"hg-cmd\">hg revert</command> to "
9122 "restore it to the contents it had as of the parent of the working directory. "
9123 "&interaction.daily.revert.remove; This works just as well for a file that you "
9124 "deleted by hand, without telling Mercurial (recall that in Mercurial "
9125 "terminology, this kind of file is called <quote>missing</quote>)."
9126 msgstr ""
9129 #. type: Content of: <book><chapter><sect1><sect2><para>
9130 #: ../en/ch09-undo.xml:245
9131 msgid ""
9132 "If you revert a <command role=\"hg-cmd\">hg copy</command>, the copied-to "
9133 "file remains in your working directory afterwards, untracked. Since a copy "
9134 "doesn't affect the copied-from file in any way, Mercurial doesn't do anything "
9135 "with the copied-from file."
9136 msgstr ""
9138 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
9139 #: ../en/ch09-undo.xml:254
9140 msgid "A slightly special case: reverting a rename"
9141 msgstr "一个稍微特别的案例:撤销改名"
9143 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
9144 #: ../en/ch09-undo.xml:256
9145 msgid ""
9146 "If you <command role=\"hg-cmd\">hg rename</command> a file, there is one "
9147 "small detail that you should remember. When you <command role=\"hg-cmd\">hg "
9148 "revert</command> a rename, it's not enough to provide the name of the renamed-"
9149 "to file, as you can see here."
9150 msgstr ""
9152 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
9153 #: ../en/ch09-undo.xml:264
9154 msgid ""
9155 "As you can see from the output of <command role=\"hg-cmd\">hg status</"
9156 "command>, the renamed-to file is no longer identified as added, but the "
9157 "renamed-<emphasis>from</emphasis> file is still removed! This is counter-"
9158 "intuitive (at least to me), but at least it's easy to deal with."
9159 msgstr ""
9161 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
9162 #: ../en/ch09-undo.xml:273
9163 msgid ""
9164 "So remember, to revert a <command role=\"hg-cmd\">hg rename</command>, you "
9165 "must provide <emphasis>both</emphasis> the source and destination names."
9166 msgstr ""
9168 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
9169 #: ../en/ch09-undo.xml:278
9170 msgid "% TODO: the output doesn't look like it will be removed!"
9171 msgstr ""
9173 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
9174 #: ../en/ch09-undo.xml:281
9175 msgid ""
9176 "(By the way, if you rename a file, then modify the renamed-to file, then "
9177 "revert both components of the rename, when Mercurial restores the file that "
9178 "was removed as part of the rename, it will be unmodified. If you need the "
9179 "modifications in the renamed-to file to show up in the renamed-from file, "
9180 "don't forget to copy them over.)"
9181 msgstr ""
9183 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
9184 #: ../en/ch09-undo.xml:288
9185 msgid ""
9186 "These fiddly aspects of reverting a rename arguably constitute a small bug in "
9187 "Mercurial."
9188 msgstr ""
9190 #. type: Content of: <book><chapter><sect1><title>
9191 #: ../en/ch09-undo.xml:295
9192 msgid "Dealing with committed changes"
9193 msgstr "处理已经提交的修改"
9195 #. type: Content of: <book><chapter><sect1><para>
9196 #: ../en/ch09-undo.xml:297
9197 msgid ""
9198 "Consider a case where you have committed a change $a$, and another change $b$ "
9199 "on top of it; you then realise that change $a$ was incorrect. Mercurial lets "
9200 "you <quote>back out</quote> an entire changeset automatically, and building "
9201 "blocks that let you reverse part of a changeset by hand."
9202 msgstr ""
9204 #. type: Content of: <book><chapter><sect1><para>
9205 #: ../en/ch09-undo.xml:303
9206 msgid ""
9207 "Before you read this section, here's something to keep in mind: the <command "
9208 "role=\"hg-cmd\">hg backout</command> command undoes changes by "
9209 "<emphasis>adding</emphasis> history, not by modifying or erasing it. It's "
9210 "the right tool to use if you're fixing bugs, but not if you're trying to undo "
9211 "some change that has catastrophic consequences. To deal with those, see "
9212 "section <xref linkend=\"sec.undo.aaaiiieee\"/>."
9213 msgstr ""
9215 #. type: Content of: <book><chapter><sect1><sect2><title>
9216 #: ../en/ch09-undo.xml:312
9217 msgid "Backing out a changeset"
9218 msgstr "恢复一个修改集"
9220 #. type: Content of: <book><chapter><sect1><sect2><para>
9221 #: ../en/ch09-undo.xml:314
9222 msgid ""
9223 "The <command role=\"hg-cmd\">hg backout</command> command lets you "
9224 "<quote>undo</quote> the effects of an entire changeset in an automated "
9225 "fashion. Because Mercurial's history is immutable, this command "
9226 "<emphasis>does not</emphasis> get rid of the changeset you want to undo. "
9227 "Instead, it creates a new changeset that <emphasis>reverses</emphasis> the "
9228 "effect of the to-be-undone changeset."
9229 msgstr ""
9232 #. type: Content of: <book><chapter><sect1><sect2><para>
9233 #: ../en/ch09-undo.xml:323
9234 msgid ""
9235 "The operation of the <command role=\"hg-cmd\">hg backout</command> command is "
9236 "a little intricate, so let's illustrate it with some examples. First, we'll "
9237 "create a repository with some simple changes."
9238 msgstr ""
9240 #. type: Content of: <book><chapter><sect1><sect2><para>
9241 #: ../en/ch09-undo.xml:330
9242 msgid ""
9243 "The <command role=\"hg-cmd\">hg backout</command> command takes a single "
9244 "changeset ID as its argument; this is the changeset to back out. Normally, "
9245 "<command role=\"hg-cmd\">hg backout</command> will drop you into a text "
9246 "editor to write a commit message, so you can record why you're backing the "
9247 "change out. In this example, we provide a commit message on the command line "
9248 "using the <option role=\"hg-opt-backout\">-m</option> option."
9249 msgstr ""
9251 #. type: Content of: <book><chapter><sect1><sect2><title>
9252 #: ../en/ch09-undo.xml:341
9253 msgid "Backing out the tip changeset"
9254 msgstr "恢复顶点修改集"
9256 #. type: Content of: <book><chapter><sect1><sect2><para>
9257 #: ../en/ch09-undo.xml:343
9258 msgid "We're going to start by backing out the last changeset we committed."
9259 msgstr ""
9261 #. type: Content of: <book><chapter><sect1><sect2><para>
9262 #: ../en/ch09-undo.xml:348
9263 msgid ""
9264 "You can see that the second line from <filename>myfile</filename> is no "
9265 "longer present. Taking a look at the output of <command role=\"hg-cmd\">hg "
9266 "log</command> gives us an idea of what the <command role=\"hg-cmd\">hg "
9267 "backout</command> command has done. &interaction.backout.simple.log; Notice "
9268 "that the new changeset that <command role=\"hg-cmd\">hg backout</command> has "
9269 "created is a child of the changeset we backed out. It's easier to see this "
9270 "in figure <xref endterm=\"fig.undo.backout.caption\" linkend=\"fig.undo."
9271 "backout\"/>, which presents a graphical view of the change history. As you "
9272 "can see, the history is nice and linear."
9273 msgstr ""
9275 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
9276 #: ../en/ch09-undo.xml:364
9277 msgid ""
9278 "<imageobject><imagedata fileref=\"images/undo-simple.png\"/> </imageobject>"
9279 msgstr ""
9281 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
9282 #: ../en/ch09-undo.xml:367 ../en/ch09-undo.xml:486
9283 msgid ""
9284 "Backing out a change using the <command role=\"hg-cmd\">hg backout</command> "
9285 "command"
9286 msgstr ""
9288 #. type: Content of: <book><chapter><sect1><sect2><title>
9289 #: ../en/ch09-undo.xml:376
9290 msgid "Backing out a non-tip change"
9291 msgstr "恢复非顶点的修改"
9293 #. type: Content of: <book><chapter><sect1><sect2><para>
9294 #: ../en/ch09-undo.xml:378
9295 msgid ""
9296 "If you want to back out a change other than the last one you committed, pass "
9297 "the <option role=\"hg-opt-backout\">--merge</option> option to the <command "
9298 "role=\"hg-cmd\">hg backout</command> command."
9299 msgstr ""
9301 #. type: Content of: <book><chapter><sect1><sect2><para>
9302 #: ../en/ch09-undo.xml:385
9303 msgid ""
9304 "This makes backing out any changeset a <quote>one-shot</quote> operation "
9305 "that's usually simple and fast."
9306 msgstr ""
9308 #. type: Content of: <book><chapter><sect1><sect2><para>
9309 #: ../en/ch09-undo.xml:391
9310 msgid ""
9311 "If you take a look at the contents of <filename>myfile</filename> after the "
9312 "backout finishes, you'll see that the first and third changes are present, "
9313 "but not the second."
9314 msgstr ""
9316 #. type: Content of: <book><chapter><sect1><sect2><para>
9317 #: ../en/ch09-undo.xml:398
9318 msgid ""
9319 "As the graphical history in figure <xref endterm=\"fig.undo.backout-non-tip."
9320 "caption\" linkend=\"fig.undo.backout-non-tip\"/> illustrates, Mercurial "
9321 "actually commits <emphasis>two</emphasis> changes in this kind of situation "
9322 "(the box-shaped nodes are the ones that Mercurial commits automatically). "
9323 "Before Mercurial begins the backout process, it first remembers what the "
9324 "current parent of the working directory is. It then backs out the target "
9325 "changeset, and commits that as a changeset. Finally, it merges back to the "
9326 "previous parent of the working directory, and commits the result of the merge."
9327 msgstr ""
9329 #. type: Content of: <book><chapter><sect1><sect2><para>
9330 #: ../en/ch09-undo.xml:410
9331 msgid ""
9332 "% TODO: to me it looks like mercurial doesn't commit the second merge "
9333 "automatically!"
9334 msgstr ""
9336 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
9337 #: ../en/ch09-undo.xml:415
9338 msgid ""
9339 "<imageobject><imagedata fileref=\"images/undo-non-tip.png\"/> </imageobject>"
9340 msgstr ""
9342 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
9343 #: ../en/ch09-undo.xml:418
9344 msgid ""
9345 "Automated backout of a non-tip change using the <command role=\"hg-cmd\">hg "
9346 "backout</command> command"
9347 msgstr ""
9349 #. type: Content of: <book><chapter><sect1><sect2><para>
9350 #: ../en/ch09-undo.xml:424
9351 msgid ""
9352 "The result is that you end up <quote>back where you were</quote>, only with "
9353 "some extra history that undoes the effect of the changeset you wanted to back "
9354 "out."
9355 msgstr ""
9357 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
9358 #: ../en/ch09-undo.xml:429
9359 msgid "Always use the <option role=\"hg-opt-backout\">--merge</option> option"
9360 msgstr "始终使用选项 <option role=\"hg-opt-backout\">--merge</option>"
9362 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
9363 #: ../en/ch09-undo.xml:432
9364 msgid ""
9365 "In fact, since the <option role=\"hg-opt-backout\">--merge</option> option "
9366 "will do the <quote>right thing</quote> whether or not the changeset you're "
9367 "backing out is the tip (i.e. it won't try to merge if it's backing out the "
9368 "tip, since there's no need), you should <emphasis>always</emphasis> use this "
9369 "option when you run the <command role=\"hg-cmd\">hg backout</command> command."
9370 msgstr ""
9372 #. type: Content of: <book><chapter><sect1><sect2><title>
9373 #: ../en/ch09-undo.xml:443
9374 msgid "Gaining more control of the backout process"
9375 msgstr "在恢复处理中获得更多控制"
9377 #. type: Content of: <book><chapter><sect1><sect2><para>
9378 #: ../en/ch09-undo.xml:445
9379 msgid ""
9380 "While I've recommended that you always use the <option role=\"hg-opt-backout"
9381 "\">--merge</option> option when backing out a change, the <command role=\"hg-"
9382 "cmd\">hg backout</command> command lets you decide how to merge a backout "
9383 "changeset. Taking control of the backout process by hand is something you "
9384 "will rarely need to do, but it can be useful to understand what the <command "
9385 "role=\"hg-cmd\">hg backout</command> command is doing for you automatically. "
9386 "To illustrate this, let's clone our first repository, but omit the backout "
9387 "change that it contains."
9388 msgstr ""
9390 #. type: Content of: <book><chapter><sect1><sect2><para>
9391 #: ../en/ch09-undo.xml:458
9392 msgid ""
9393 "As with our earlier example, We'll commit a third changeset, then back out "
9394 "its parent, and see what happens."
9395 msgstr ""
9397 #. type: Content of: <book><chapter><sect1><sect2><para>
9398 #: ../en/ch09-undo.xml:464
9399 msgid ""
9400 "Our new changeset is again a descendant of the changeset we backout out; it's "
9401 "thus a new head, <emphasis>not</emphasis> a descendant of the changeset that "
9402 "was the tip. The <command role=\"hg-cmd\">hg backout</command> command was "
9403 "quite explicit in telling us this."
9404 msgstr ""
9406 #. type: Content of: <book><chapter><sect1><sect2><para>
9407 #: ../en/ch09-undo.xml:472
9408 msgid ""
9409 "Again, it's easier to see what has happened by looking at a graph of the "
9410 "revision history, in figure <xref endterm=\"fig.undo.backout-manual.caption\" "
9411 "linkend=\"fig.undo.backout-manual\"/>. This makes it clear that when we use "
9412 "<command role=\"hg-cmd\">hg backout</command> to back out a change other than "
9413 "the tip, Mercurial adds a new head to the repository (the change it committed "
9414 "is box-shaped)."
9415 msgstr ""
9417 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
9418 #: ../en/ch09-undo.xml:483
9419 msgid ""
9420 "<imageobject><imagedata fileref=\"images/undo-manual.png\"/> </imageobject>"
9421 msgstr ""
9423 #. type: Content of: <book><chapter><sect1><sect2><para>
9424 #: ../en/ch09-undo.xml:492
9425 msgid ""
9426 "After the <command role=\"hg-cmd\">hg backout</command> command has "
9427 "completed, it leaves the new <quote>backout</quote> changeset as the parent "
9428 "of the working directory."
9429 msgstr ""
9431 #. type: Content of: <book><chapter><sect1><sect2><para>
9432 #: ../en/ch09-undo.xml:499
9433 msgid "Now we have two isolated sets of changes."
9434 msgstr ""
9436 #. type: Content of: <book><chapter><sect1><sect2><para>
9437 #: ../en/ch09-undo.xml:503
9438 msgid ""
9439 "Let's think about what we expect to see as the contents of <filename>myfile</"
9440 "filename> now. The first change should be present, because we've never "
9441 "backed it out. The second change should be missing, as that's the change we "
9442 "backed out. Since the history graph shows the third change as a separate "
9443 "head, we <emphasis>don't</emphasis> expect to see the third change present in "
9444 "<filename>myfile</filename>."
9445 msgstr ""
9447 #. type: Content of: <book><chapter><sect1><sect2><para>
9448 #: ../en/ch09-undo.xml:513
9449 msgid ""
9450 "To get the third change back into the file, we just do a normal merge of our "
9451 "two heads."
9452 msgstr ""
9454 #. type: Content of: <book><chapter><sect1><sect2><para>
9455 #: ../en/ch09-undo.xml:518
9456 msgid ""
9457 "Afterwards, the graphical history of our repository looks like figure <xref "
9458 "endterm=\"fig.undo.backout-manual-merge.caption\" linkend=\"fig.undo.backout-"
9459 "manual-merge\"/>."
9460 msgstr ""
9462 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
9463 #: ../en/ch09-undo.xml:525
9464 msgid ""
9465 "<imageobject><imagedata fileref=\"images/undo-manual-merge.png\"/> </"
9466 "imageobject>"
9467 msgstr ""
9469 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
9470 #: ../en/ch09-undo.xml:528
9471 msgid "Manually merging a backout change"
9472 msgstr ""
9474 #. type: Content of: <book><chapter><sect1><sect2><title>
9475 #: ../en/ch09-undo.xml:535
9476 msgid "Why <command role=\"hg-cmd\">hg backout</command> works as it does"
9477 msgstr "<command role=\"hg-cmd\">hg backout</command> 的内幕"
9479 #. type: Content of: <book><chapter><sect1><sect2><para>
9480 #: ../en/ch09-undo.xml:538
9481 msgid ""
9482 "Here's a brief description of how the <command role=\"hg-cmd\">hg backout</"
9483 "command> command works."
9484 msgstr ""
9486 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
9487 #: ../en/ch09-undo.xml:541
9488 msgid ""
9489 "It ensures that the working directory is <quote>clean</quote>, i.e. that the "
9490 "output of <command role=\"hg-cmd\">hg status</command> would be empty."
9491 msgstr ""
9493 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
9494 #: ../en/ch09-undo.xml:545
9495 msgid ""
9496 "It remembers the current parent of the working directory. Let's call this "
9497 "changeset <literal>orig</literal>"
9498 msgstr ""
9500 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
9501 #: ../en/ch09-undo.xml:549
9502 msgid ""
9503 "It does the equivalent of a <command role=\"hg-cmd\">hg update</command> to "
9504 "sync the working directory to the changeset you want to back out. Let's call "
9505 "this changeset <literal>backout</literal>"
9506 msgstr ""
9508 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
9509 #: ../en/ch09-undo.xml:554
9510 msgid ""
9511 "It finds the parent of that changeset. Let's call that changeset "
9512 "<literal>parent</literal>."
9513 msgstr ""
9515 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
9516 #: ../en/ch09-undo.xml:557
9517 msgid ""
9518 "For each file that the <literal>backout</literal> changeset affected, it does "
9519 "the equivalent of a <command role=\"hg-cmd\">hg revert -r parent</command> on "
9520 "that file, to restore it to the contents it had before that changeset was "
9521 "committed."
9522 msgstr ""
9524 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
9525 #: ../en/ch09-undo.xml:564
9526 msgid ""
9527 "It commits the result as a new changeset. This changeset has "
9528 "<literal>backout</literal> as its parent."
9529 msgstr ""
9531 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
9532 #: ../en/ch09-undo.xml:568
9533 msgid ""
9534 "If you specify <option role=\"hg-opt-backout\">--merge</option> on the "
9535 "command line, it merges with <literal>orig</literal>, and commits the result "
9536 "of the merge."
9537 msgstr ""
9539 #. type: Content of: <book><chapter><sect1><sect2><para>
9540 #: ../en/ch09-undo.xml:574
9541 msgid ""
9542 "An alternative way to implement the <command role=\"hg-cmd\">hg backout</"
9543 "command> command would be to <command role=\"hg-cmd\">hg export</command> the "
9544 "to-be-backed-out changeset as a diff, then use the <option role=\"cmd-opt-"
9545 "patch\">--reverse</option> option to the <command>patch</command> command to "
9546 "reverse the effect of the change without fiddling with the working "
9547 "directory. This sounds much simpler, but it would not work nearly as well."
9548 msgstr ""
9550 #. type: Content of: <book><chapter><sect1><sect2><para>
9551 #: ../en/ch09-undo.xml:584
9552 msgid ""
9553 "The reason that <command role=\"hg-cmd\">hg backout</command> does an update, "
9554 "a commit, a merge, and another commit is to give the merge machinery the best "
9555 "chance to do a good job when dealing with all the changes <emphasis>between</"
9556 "emphasis> the change you're backing out and the current tip."
9557 msgstr ""
9559 #. type: Content of: <book><chapter><sect1><sect2><para>
9560 #: ../en/ch09-undo.xml:591
9561 msgid ""
9562 "If you're backing out a changeset that's 100 revisions back in your project's "
9563 "history, the chances that the <command>patch</command> command will be able "
9564 "to apply a reverse diff cleanly are not good, because intervening changes are "
9565 "likely to have <quote>broken the context</quote> that <command>patch</"
9566 "command> uses to determine whether it can apply a patch (if this sounds like "
9567 "gibberish, see <xref linkend=\"sec.mq.patch\"/> for a discussion of the "
9568 "<command>patch</command> command). Also, Mercurial's merge machinery will "
9569 "handle files and directories being renamed, permission changes, and "
9570 "modifications to binary files, none of which <command>patch</command> can "
9571 "deal with."
9572 msgstr ""
9574 #. type: Content of: <book><chapter><sect1><title>
9575 #: ../en/ch09-undo.xml:608
9576 msgid "Changes that should never have been"
9577 msgstr "不该发生的修改"
9579 #. type: Content of: <book><chapter><sect1><para>
9580 #: ../en/ch09-undo.xml:610
9581 msgid ""
9582 "Most of the time, the <command role=\"hg-cmd\">hg backout</command> command "
9583 "is exactly what you need if you want to undo the effects of a change. It "
9584 "leaves a permanent record of exactly what you did, both when committing the "
9585 "original changeset and when you cleaned up after it."
9586 msgstr ""
9588 #. type: Content of: <book><chapter><sect1><para>
9589 #: ../en/ch09-undo.xml:616
9590 msgid ""
9591 "On rare occasions, though, you may find that you've committed a change that "
9592 "really should not be present in the repository at all. For example, it would "
9593 "be very unusual, and usually considered a mistake, to commit a software "
9594 "project's object files as well as its source files. Object files have almost "
9595 "no intrinsic value, and they're <emphasis>big</emphasis>, so they increase "
9596 "the size of the repository and the amount of time it takes to clone or pull "
9597 "changes."
9598 msgstr ""
9600 #. type: Content of: <book><chapter><sect1><para>
9601 #: ../en/ch09-undo.xml:625
9602 msgid ""
9603 "Before I discuss the options that you have if you commit a <quote>brown paper "
9604 "bag</quote> change (the kind that's so bad that you want to pull a brown "
9605 "paper bag over your head), let me first discuss some approaches that probably "
9606 "won't work."
9607 msgstr ""
9609 #. type: Content of: <book><chapter><sect1><para>
9610 #: ../en/ch09-undo.xml:630
9611 msgid ""
9612 "Since Mercurial treats history as accumulative&emdash;every change builds on "
9613 "top of all changes that preceded it&emdash;you generally can't just make "
9614 "disastrous changes disappear. The one exception is when you've just "
9615 "committed a change, and it hasn't been pushed or pulled into another "
9616 "repository. That's when you can safely use the <command role=\"hg-cmd\">hg "
9617 "rollback</command> command, as I detailed in section <xref linkend=\"sec.undo."
9618 "rollback\"/>."
9619 msgstr ""
9621 #. type: Content of: <book><chapter><sect1><para>
9622 #: ../en/ch09-undo.xml:639
9623 msgid ""
9624 "After you've pushed a bad change to another repository, you <emphasis>could</"
9625 "emphasis> still use <command role=\"hg-cmd\">hg rollback</command> to make "
9626 "your local copy of the change disappear, but it won't have the consequences "
9627 "you want. The change will still be present in the remote repository, so it "
9628 "will reappear in your local repository the next time you pull."
9629 msgstr ""
9631 #. type: Content of: <book><chapter><sect1><para>
9632 #: ../en/ch09-undo.xml:647
9633 msgid ""
9634 "If a situation like this arises, and you know which repositories your bad "
9635 "change has propagated into, you can <emphasis>try</emphasis> to get rid of "
9636 "the changeefrom <emphasis>every</emphasis> one of those repositories. This "
9637 "is, of course, not a satisfactory solution: if you miss even a single "
9638 "repository while you're expunging, the change is still <quote>in the wild</"
9639 "quote>, and could propagate further."
9640 msgstr ""
9642 #. type: Content of: <book><chapter><sect1><para>
9643 #: ../en/ch09-undo.xml:655
9644 msgid ""
9645 "If you've committed one or more changes <emphasis>after</emphasis> the change "
9646 "that you'd like to see disappear, your options are further reduced. Mercurial "
9647 "doesn't provide a way to <quote>punch a hole</quote> in history, leaving "
9648 "changesets intact."
9649 msgstr ""
9651 #. type: Content of: <book><chapter><sect1><para>
9652 #: ../en/ch09-undo.xml:661
9653 msgid ""
9654 "XXX This needs filling out. The <literal>hg-replay</literal> script in the "
9655 "<literal>examples</literal> directory works, but doesn't handle merge "
9656 "changesets. Kind of an important omission."
9657 msgstr ""
9659 #. type: Content of: <book><chapter><sect1><sect2><title>
9660 #: ../en/ch09-undo.xml:667
9661 msgid "Protect yourself from <quote>escaped</quote> changes"
9662 msgstr "使用<quote>校验</quote>修改来保护你自己"
9664 #. type: Content of: <book><chapter><sect1><sect2><para>
9665 #: ../en/ch09-undo.xml:670
9666 msgid ""
9667 "If you've committed some changes to your local repository and they've been "
9668 "pushed or pulled somewhere else, this isn't necessarily a disaster. You can "
9669 "protect yourself ahead of time against some classes of bad changeset. This "
9670 "is particularly easy if your team usually pulls changes from a central "
9671 "repository."
9672 msgstr ""
9674 #. type: Content of: <book><chapter><sect1><sect2><para>
9675 #: ../en/ch09-undo.xml:677
9676 msgid ""
9677 "By configuring some hooks on that repository to validate incoming changesets "
9678 "(see chapter <xref linkend=\"chap.hook\"/>), you can automatically prevent "
9679 "some kinds of bad changeset from being pushed to the central repository at "
9680 "all. With such a configuration in place, some kinds of bad changeset will "
9681 "naturally tend to <quote>die out</quote> because they can't propagate into "
9682 "the central repository. Better yet, this happens without any need for "
9683 "explicit intervention."
9684 msgstr ""
9686 #. type: Content of: <book><chapter><sect1><sect2><para>
9687 #: ../en/ch09-undo.xml:687
9688 msgid ""
9689 "For instance, an incoming change hook that verifies that a changeset will "
9690 "actually compile can prevent people from inadvertantly <quote>breaking the "
9691 "build</quote>."
9692 msgstr ""
9694 #. type: Content of: <book><chapter><sect1><title>
9695 #: ../en/ch09-undo.xml:694
9696 msgid "Finding the source of a bug"
9697 msgstr "查找问题的根源"
9699 #. type: Content of: <book><chapter><sect1><para>
9700 #: ../en/ch09-undo.xml:696
9701 msgid ""
9702 "While it's all very well to be able to back out a changeset that introduced a "
9703 "bug, this requires that you know which changeset to back out. Mercurial "
9704 "provides an invaluable command, called <command role=\"hg-cmd\">hg bisect</"
9705 "command>, that helps you to automate this process and accomplish it very "
9706 "efficiently."
9707 msgstr ""
9709 #. type: Content of: <book><chapter><sect1><para>
9710 #: ../en/ch09-undo.xml:703
9711 msgid ""
9712 "The idea behind the <command role=\"hg-cmd\">hg bisect</command> command is "
9713 "that a changeset has introduced some change of behaviour that you can "
9714 "identify with a simple binary test. You don't know which piece of code "
9715 "introduced the change, but you know how to test for the presence of the bug. "
9716 "The <command role=\"hg-cmd\">hg bisect</command> command uses your test to "
9717 "direct its search for the changeset that introduced the code that caused the "
9718 "bug."
9719 msgstr ""
9721 #. type: Content of: <book><chapter><sect1><para>
9722 #: ../en/ch09-undo.xml:712
9723 msgid ""
9724 "Here are a few scenarios to help you understand how you might apply this "
9725 "command."
9726 msgstr ""
9728 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
9729 #: ../en/ch09-undo.xml:715
9730 msgid ""
9731 "The most recent version of your software has a bug that you remember wasn't "
9732 "present a few weeks ago, but you don't know when it was introduced. Here, "
9733 "your binary test checks for the presence of that bug."
9734 msgstr ""
9736 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
9737 #: ../en/ch09-undo.xml:720
9738 msgid ""
9739 "You fixed a bug in a rush, and now it's time to close the entry in your "
9740 "team's bug database. The bug database requires a changeset ID when you close "
9741 "an entry, but you don't remember which changeset you fixed the bug in. Once "
9742 "again, your binary test checks for the presence of the bug."
9743 msgstr ""
9745 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
9746 #: ../en/ch09-undo.xml:727
9747 msgid ""
9748 "Your software works correctly, but runs 15% slower than the last time you "
9749 "measured it. You want to know which changeset introduced the performance "
9750 "regression. In this case, your binary test measures the performance of your "
9751 "software, to see whether it's <quote>fast</quote> or <quote>slow</quote>."
9752 msgstr ""
9754 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
9755 #: ../en/ch09-undo.xml:734
9756 msgid ""
9757 "The sizes of the components of your project that you ship exploded recently, "
9758 "and you suspect that something changed in the way you build your project."
9759 msgstr ""
9761 #. type: Content of: <book><chapter><sect1><para>
9762 #: ../en/ch09-undo.xml:739
9763 msgid ""
9764 "From these examples, it should be clear that the <command role=\"hg-cmd\">hg "
9765 "bisect</command> command is not useful only for finding the sources of bugs. "
9766 "You can use it to find any <quote>emergent property</quote> of a repository "
9767 "(anything that you can't find from a simple text search of the files in the "
9768 "tree) for which you can write a binary test."
9769 msgstr ""
9771 #. type: Content of: <book><chapter><sect1><para>
9772 #: ../en/ch09-undo.xml:746
9773 msgid ""
9774 "We'll introduce a little bit of terminology here, just to make it clear which "
9775 "parts of the search process are your responsibility, and which are "
9776 "Mercurial's. A <emphasis>test</emphasis> is something that <emphasis>you</"
9777 "emphasis> run when <command role=\"hg-cmd\">hg bisect</command> chooses a "
9778 "changeset. A <emphasis>probe</emphasis> is what <command role=\"hg-cmd\">hg "
9779 "bisect</command> runs to tell whether a revision is good. Finally, we'll use "
9780 "the word <quote>bisect</quote>, as both a noun and a verb, to stand in for "
9781 "the phrase <quote>search using the <command role=\"hg-cmd\">hg bisect</"
9782 "command> command</quote>."
9783 msgstr ""
9785 #. type: Content of: <book><chapter><sect1><para>
9786 #: ../en/ch09-undo.xml:759
9787 msgid ""
9788 "One simple way to automate the searching process would be simply to probe "
9789 "every changeset. However, this scales poorly. If it took ten minutes to "
9790 "test a single changeset, and you had 10,000 changesets in your repository, "
9791 "the exhaustive approach would take on average 35 <emphasis>days</emphasis> to "
9792 "find the changeset that introduced a bug. Even if you knew that the bug was "
9793 "introduced by one of the last 500 changesets, and limited your search to "
9794 "those, you'd still be looking at over 40 hours to find the changeset that "
9795 "introduced your bug."
9796 msgstr ""
9798 #. type: Content of: <book><chapter><sect1><para>
9799 #: ../en/ch09-undo.xml:769
9800 msgid ""
9801 "What the <command role=\"hg-cmd\">hg bisect</command> command does is use its "
9802 "knowledge of the <quote>shape</quote> of your project's revision history to "
9803 "perform a search in time proportional to the <emphasis>logarithm</emphasis> "
9804 "of the number of changesets to check (the kind of search it performs is "
9805 "called a dichotomic search). With this approach, searching through 10,000 "
9806 "changesets will take less than three hours, even at ten minutes per test (the "
9807 "search will require about 14 tests). Limit your search to the last hundred "
9808 "changesets, and it will take only about an hour (roughly seven tests)."
9809 msgstr ""
9811 #. type: Content of: <book><chapter><sect1><para>
9812 #: ../en/ch09-undo.xml:780
9813 msgid ""
9814 "The <command role=\"hg-cmd\">hg bisect</command> command is aware of the "
9815 "<quote>branchy</quote> nature of a Mercurial project's revision history, so "
9816 "it has no problems dealing with branches, merges, or multiple heads in a "
9817 "repository. It can prune entire branches of history with a single probe, "
9818 "which is how it operates so efficiently."
9819 msgstr ""
9821 #. type: Content of: <book><chapter><sect1><sect2><title>
9822 #: ../en/ch09-undo.xml:788
9823 msgid "Using the <command role=\"hg-cmd\">hg bisect</command> command"
9824 msgstr "使用命令 <command role=\"hg-cmd\">hg bisect</command>"
9826 #. type: Content of: <book><chapter><sect1><sect2><para>
9827 #: ../en/ch09-undo.xml:791
9828 msgid ""
9829 "Here's an example of <command role=\"hg-cmd\">hg bisect</command> in action."
9830 msgstr ""
9832 #. type: Content of: <book><chapter><sect1><sect2><note><para>
9833 #: ../en/ch09-undo.xml:795
9834 msgid ""
9835 "In versions 0.9.5 and earlier of Mercurial, <command role=\"hg-cmd\">hg "
9836 "bisect</command> was not a core command: it was distributed with Mercurial as "
9837 "an extension. This section describes the built-in command, not the old "
9838 "extension."
9839 msgstr ""
9841 #. type: Content of: <book><chapter><sect1><sect2><para>
9842 #: ../en/ch09-undo.xml:802
9843 msgid ""
9844 "Now let's create a repository, so that we can try out the <command role=\"hg-"
9845 "cmd\">hg bisect</command> command in isolation."
9846 msgstr ""
9848 #. type: Content of: <book><chapter><sect1><sect2><para>
9849 #: ../en/ch09-undo.xml:808
9850 msgid ""
9851 "We'll simulate a project that has a bug in it in a simple-minded way: create "
9852 "trivial changes in a loop, and nominate one specific change that will have "
9853 "the <quote>bug</quote>. This loop creates 35 changesets, each adding a "
9854 "single file to the repository. We'll represent our <quote>bug</quote> with a "
9855 "file that contains the text <quote>i have a gub</quote>."
9856 msgstr ""
9858 #. type: Content of: <book><chapter><sect1><sect2><para>
9859 #: ../en/ch09-undo.xml:818
9860 msgid ""
9861 "The next thing that we'd like to do is figure out how to use the <command "
9862 "role=\"hg-cmd\">hg bisect</command> command. We can use Mercurial's normal "
9863 "built-in help mechanism for this."
9864 msgstr ""
9866 #. type: Content of: <book><chapter><sect1><sect2><para>
9867 #: ../en/ch09-undo.xml:825
9868 msgid ""
9869 "The <command role=\"hg-cmd\">hg bisect</command> command works in steps. "
9870 "Each step proceeds as follows."
9871 msgstr ""
9873 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
9874 #: ../en/ch09-undo.xml:828
9875 msgid "You run your binary test."
9876 msgstr ""
9878 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><itemizedlist><listitem><para>
9879 #: ../en/ch09-undo.xml:830
9880 msgid ""
9881 "If the test succeeded, you tell <command role=\"hg-cmd\">hg bisect</command> "
9882 "by running the <command role=\"hg-cmd\">hg bisect good</command> command."
9883 msgstr ""
9885 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><itemizedlist><listitem><para>
9886 #: ../en/ch09-undo.xml:835
9887 msgid ""
9888 "If it failed, run the <command role=\"hg-cmd\">hg bisect bad</command> "
9889 "command."
9890 msgstr ""
9892 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
9893 #: ../en/ch09-undo.xml:839
9894 msgid ""
9895 "The command uses your information to decide which changeset to test next."
9896 msgstr ""
9898 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
9899 #: ../en/ch09-undo.xml:842
9900 msgid ""
9901 "It updates the working directory to that changeset, and the process begins "
9902 "again."
9903 msgstr ""
9905 #. type: Content of: <book><chapter><sect1><sect2><para>
9906 #: ../en/ch09-undo.xml:845
9907 msgid ""
9908 "The process ends when <command role=\"hg-cmd\">hg bisect</command> identifies "
9909 "a unique changeset that marks the point where your test transitioned from "
9910 "<quote>succeeding</quote> to <quote>failing</quote>."
9911 msgstr ""
9914 #. type: Content of: <book><chapter><sect1><sect2><para>
9915 #: ../en/ch09-undo.xml:850
9916 msgid ""
9917 "To start the search, we must run the <command role=\"hg-cmd\">hg bisect --"
9918 "reset</command> command."
9919 msgstr ""
9921 #. type: Content of: <book><chapter><sect1><sect2><para>
9922 #: ../en/ch09-undo.xml:855
9923 msgid ""
9924 "In our case, the binary test we use is simple: we check to see if any file in "
9925 "the repository contains the string <quote>i have a gub</quote>. If it does, "
9926 "this changeset contains the change that <quote>caused the bug</quote>. By "
9927 "convention, a changeset that has the property we're searching for is "
9928 "<quote>bad</quote>, while one that doesn't is <quote>good</quote>."
9929 msgstr ""
9931 #. type: Content of: <book><chapter><sect1><sect2><para>
9932 #: ../en/ch09-undo.xml:863
9933 msgid ""
9934 "Most of the time, the revision to which the working directory is synced "
9935 "(usually the tip) already exhibits the problem introduced by the buggy "
9936 "change, so we'll mark it as <quote>bad</quote>."
9937 msgstr ""
9940 #. type: Content of: <book><chapter><sect1><sect2><para>
9941 #: ../en/ch09-undo.xml:870
9942 msgid ""
9943 "Our next task is to nominate a changeset that we know <emphasis>doesn't</"
9944 "emphasis> have the bug; the <command role=\"hg-cmd\">hg bisect</command> "
9945 "command will <quote>bracket</quote> its search between the first pair of good "
9946 "and bad changesets. In our case, we know that revision 10 didn't have the "
9947 "bug. (I'll have more words about choosing the first <quote>good</quote> "
9948 "changeset later.)"
9949 msgstr ""
9951 #. type: Content of: <book><chapter><sect1><sect2><para>
9952 #: ../en/ch09-undo.xml:880
9953 msgid "Notice that this command printed some output."
9954 msgstr ""
9956 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
9957 #: ../en/ch09-undo.xml:882
9958 msgid ""
9959 "It told us how many changesets it must consider before it can identify the "
9960 "one that introduced the bug, and how many tests that will require."
9961 msgstr ""
9963 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
9964 #: ../en/ch09-undo.xml:886
9965 msgid ""
9966 "It updated the working directory to the next changeset to test, and told us "
9967 "which changeset it's testing."
9968 msgstr ""
9970 #. type: Content of: <book><chapter><sect1><sect2><para>
9971 #: ../en/ch09-undo.xml:891
9972 msgid ""
9973 "We now run our test in the working directory. We use the <command>grep</"
9974 "command> command to see if our <quote>bad</quote> file is present in the "
9975 "working directory. If it is, this revision is bad; if not, this revision is "
9976 "good. &interaction.bisect.search.step1;"
9977 msgstr ""
9979 #. type: Content of: <book><chapter><sect1><sect2><para>
9980 #: ../en/ch09-undo.xml:897
9981 msgid ""
9982 "This test looks like a perfect candidate for automation, so let's turn it "
9983 "into a shell function."
9984 msgstr ""
9986 #. type: Content of: <book><chapter><sect1><sect2><para>
9987 #: ../en/ch09-undo.xml:901
9988 msgid ""
9989 "We can now run an entire test step with a single command, <literal>mytest</"
9990 "literal>."
9991 msgstr ""
9993 #. type: Content of: <book><chapter><sect1><sect2><para>
9994 #: ../en/ch09-undo.xml:906
9995 msgid "A few more invocations of our canned test step command, and we're done."
9996 msgstr ""
9998 #. type: Content of: <book><chapter><sect1><sect2><para>
9999 #: ../en/ch09-undo.xml:911
10000 msgid ""
10001 "Even though we had 40 changesets to search through, the <command role=\"hg-cmd"
10002 "\">hg bisect</command> command let us find the changeset that introduced our "
10003 "<quote>bug</quote> with only five tests. Because the number of tests that "
10004 "the <command role=\"hg-cmd\">hg bisect</command> command performs grows "
10005 "logarithmically with the number of changesets to search, the advantage that "
10006 "it has over the <quote>brute force</quote> search approach increases with "
10007 "every changeset you add."
10008 msgstr ""
10010 #. type: Content of: <book><chapter><sect1><sect2><title>
10011 #: ../en/ch09-undo.xml:922
10012 msgid "Cleaning up after your search"
10013 msgstr "搜索后的清理"
10016 #. type: Content of: <book><chapter><sect1><sect2><para>
10017 #: ../en/ch09-undo.xml:924
10018 msgid ""
10019 "When you're finished using the <command role=\"hg-cmd\">hg bisect</command> "
10020 "command in a repository, you can use the <command role=\"hg-cmd\">hg bisect "
10021 "reset</command> command to drop the information it was using to drive your "
10022 "search. The command doesn't use much space, so it doesn't matter if you "
10023 "forget to run this command. However, <command role=\"hg-cmd\">hg bisect</"
10024 "command> won't let you start a new search in that repository until you do a "
10025 "<command role=\"hg-cmd\">hg bisect reset</command>."
10026 msgstr ""
10028 #. type: Content of: <book><chapter><sect1><title>
10029 #: ../en/ch09-undo.xml:939
10030 msgid "Tips for finding bugs effectively"
10031 msgstr "有效查找问题的技巧"
10033 #. type: Content of: <book><chapter><sect1><sect2><title>
10034 #: ../en/ch09-undo.xml:942
10035 msgid "Give consistent input"
10036 msgstr "给出一致的输入"
10038 #. type: Content of: <book><chapter><sect1><sect2><para>
10039 #: ../en/ch09-undo.xml:944
10040 msgid ""
10041 "The <command role=\"hg-cmd\">hg bisect</command> command requires that you "
10042 "correctly report the result of every test you perform. If you tell it that a "
10043 "test failed when it really succeeded, it <emphasis>might</emphasis> be able "
10044 "to detect the inconsistency. If it can identify an inconsistency in your "
10045 "reports, it will tell you that a particular changeset is both good and bad. "
10046 "However, it can't do this perfectly; it's about as likely to report the wrong "
10047 "changeset as the source of the bug."
10048 msgstr ""
10050 #. type: Content of: <book><chapter><sect1><sect2><title>
10051 #: ../en/ch09-undo.xml:956
10052 msgid "Automate as much as possible"
10053 msgstr "尽量自动"
10055 #. type: Content of: <book><chapter><sect1><sect2><para>
10056 #: ../en/ch09-undo.xml:958
10057 msgid ""
10058 "When I started using the <command role=\"hg-cmd\">hg bisect</command> "
10059 "command, I tried a few times to run my tests by hand, on the command line. "
10060 "This is an approach that I, at least, am not suited to. After a few tries, I "
10061 "found that I was making enough mistakes that I was having to restart my "
10062 "searches several times before finally getting correct results."
10063 msgstr ""
10065 #. type: Content of: <book><chapter><sect1><sect2><para>
10066 #: ../en/ch09-undo.xml:966
10067 msgid ""
10068 "My initial problems with driving the <command role=\"hg-cmd\">hg bisect</"
10069 "command> command by hand occurred even with simple searches on small "
10070 "repositories; if the problem you're looking for is more subtle, or the number "
10071 "of tests that <command role=\"hg-cmd\">hg bisect</command> must perform "
10072 "increases, the likelihood of operator error ruining the search is much "
10073 "higher. Once I started automating my tests, I had much better results."
10074 msgstr ""
10076 #. type: Content of: <book><chapter><sect1><sect2><para>
10077 #: ../en/ch09-undo.xml:975
10078 msgid "The key to automated testing is twofold:"
10079 msgstr ""
10081 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
10082 #: ../en/ch09-undo.xml:977
10083 msgid "always test for the same symptom, and"
10084 msgstr ""
10086 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
10087 #: ../en/ch09-undo.xml:979
10088 msgid ""
10089 "always feed consistent input to the <command role=\"hg-cmd\">hg bisect</"
10090 "command> command."
10091 msgstr ""
10093 #. type: Content of: <book><chapter><sect1><sect2><para>
10094 #: ../en/ch09-undo.xml:982
10095 msgid ""
10096 "In my tutorial example above, the <command>grep</command> command tests for "
10097 "the symptom, and the <literal>if</literal> statement takes the result of this "
10098 "check and ensures that we always feed the same input to the <command role="
10099 "\"hg-cmd\">hg bisect</command> command. The <literal>mytest</literal> "
10100 "function marries these together in a reproducible way, so that every test is "
10101 "uniform and consistent."
10102 msgstr ""
10104 #. type: Content of: <book><chapter><sect1><sect2><title>
10105 #: ../en/ch09-undo.xml:992
10106 msgid "Check your results"
10107 msgstr "检查你的结果"
10109 #. type: Content of: <book><chapter><sect1><sect2><para>
10110 #: ../en/ch09-undo.xml:994
10111 msgid ""
10112 "Because the output of a <command role=\"hg-cmd\">hg bisect</command> search "
10113 "is only as good as the input you give it, don't take the changeset it reports "
10114 "as the absolute truth. A simple way to cross-check its report is to manually "
10115 "run your test at each of the following changesets:"
10116 msgstr ""
10118 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
10119 #: ../en/ch09-undo.xml:1000
10120 msgid ""
10121 "The changeset that it reports as the first bad revision. Your test should "
10122 "still report this as bad."
10123 msgstr ""
10125 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
10126 #: ../en/ch09-undo.xml:1004
10127 msgid ""
10128 "The parent of that changeset (either parent, if it's a merge). Your test "
10129 "should report this changeset as good."
10130 msgstr ""
10132 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
10133 #: ../en/ch09-undo.xml:1008
10134 msgid ""
10135 "A child of that changeset. Your test should report this changeset as bad."
10136 msgstr ""
10138 #. type: Content of: <book><chapter><sect1><sect2><title>
10139 #: ../en/ch09-undo.xml:1014
10140 msgid "Beware interference between bugs"
10141 msgstr "谨防问题之间的冲突"
10143 #. type: Content of: <book><chapter><sect1><sect2><para>
10144 #: ../en/ch09-undo.xml:1016
10145 msgid ""
10146 "It's possible that your search for one bug could be disrupted by the presence "
10147 "of another. For example, let's say your software crashes at revision 100, "
10148 "and worked correctly at revision 50. Unknown to you, someone else introduced "
10149 "a different crashing bug at revision 60, and fixed it at revision 80. This "
10150 "could distort your results in one of several ways."
10151 msgstr ""
10153 #. type: Content of: <book><chapter><sect1><sect2><para>
10154 #: ../en/ch09-undo.xml:1024
10155 msgid ""
10156 "It is possible that this other bug completely <quote>masks</quote> yours, "
10157 "which is to say that it occurs before your bug has a chance to manifest "
10158 "itself. If you can't avoid that other bug (for example, it prevents your "
10159 "project from building), and so can't tell whether your bug is present in a "
10160 "particular changeset, the <command role=\"hg-cmd\">hg bisect</command> "
10161 "command cannot help you directly. Instead, you can mark a changeset as "
10162 "untested by running <command role=\"hg-cmd\">hg bisect --skip</command>."
10163 msgstr ""
10165 #. type: Content of: <book><chapter><sect1><sect2><para>
10166 #: ../en/ch09-undo.xml:1034
10167 msgid ""
10168 "A different problem could arise if your test for a bug's presence is not "
10169 "specific enough. If you check for <quote>my program crashes</quote>, then "
10170 "both your crashing bug and an unrelated crashing bug that masks it will look "
10171 "like the same thing, and mislead <command role=\"hg-cmd\">hg bisect</command>."
10172 msgstr ""
10174 #. type: Content of: <book><chapter><sect1><sect2><para>
10175 #: ../en/ch09-undo.xml:1041
10176 msgid ""
10177 "Another useful situation in which to use <command role=\"hg-cmd\">hg bisect --"
10178 "skip</command> is if you can't test a revision because your project was in a "
10179 "broken and hence untestable state at that revision, perhaps because someone "
10180 "checked in a change that prevented the project from building."
10181 msgstr ""
10183 #. type: Content of: <book><chapter><sect1><sect2><title>
10184 #: ../en/ch09-undo.xml:1050
10185 msgid "Bracket your search lazily"
10186 msgstr "减少你的查找工作"
10188 #. type: Content of: <book><chapter><sect1><sect2><para>
10189 #: ../en/ch09-undo.xml:1052
10190 msgid ""
10191 "Choosing the first <quote>good</quote> and <quote>bad</quote> changesets that "
10192 "will mark the end points of your search is often easy, but it bears a little "
10193 "discussion nevertheless. From the perspective of <command role=\"hg-cmd\">hg "
10194 "bisect</command>, the <quote>newest</quote> changeset is conventionally "
10195 "<quote>bad</quote>, and the older changeset is <quote>good</quote>."
10196 msgstr ""
10198 #. type: Content of: <book><chapter><sect1><sect2><para>
10199 #: ../en/ch09-undo.xml:1060
10200 msgid ""
10201 "If you're having trouble remembering when a suitable <quote>good</quote> "
10202 "change was, so that you can tell <command role=\"hg-cmd\">hg bisect</"
10203 "command>, you could do worse than testing changesets at random. Just "
10204 "remember to eliminate contenders that can't possibly exhibit the bug (perhaps "
10205 "because the feature with the bug isn't present yet) and those where another "
10206 "problem masks the bug (as I discussed above)."
10207 msgstr ""
10209 #. type: Content of: <book><chapter><sect1><sect2><para>
10210 #: ../en/ch09-undo.xml:1069
10211 msgid ""
10212 "Even if you end up <quote>early</quote> by thousands of changesets or months "
10213 "of history, you will only add a handful of tests to the total number that "
10214 "<command role=\"hg-cmd\">hg bisect</command> must perform, thanks to its "
10215 "logarithmic behaviour."
10216 msgstr ""
10218 #. type: Content of: <book><chapter><title>
10219 #: ../en/ch10-hook.xml:5
10220 msgid "Handling repository events with hooks"
10221 msgstr "使用钩子处理版本库事件"
10223 #. type: Content of: <book><chapter><para>
10224 #: ../en/ch10-hook.xml:7
10225 msgid ""
10226 "Mercurial offers a powerful mechanism to let you perform automated actions in "
10227 "response to events that occur in a repository. In some cases, you can even "
10228 "control Mercurial's response to those events."
10229 msgstr ""
10231 #. type: Content of: <book><chapter><para>
10232 #: ../en/ch10-hook.xml:12
10233 msgid ""
10234 "The name Mercurial uses for one of these actions is a <emphasis>hook</"
10235 "emphasis>. Hooks are called <quote>triggers</quote> in some revision control "
10236 "systems, but the two names refer to the same idea."
10237 msgstr ""
10239 #. type: Content of: <book><chapter><sect1><title>
10240 #: ../en/ch10-hook.xml:18
10241 msgid "An overview of hooks in Mercurial"
10242 msgstr "Mercurial 钩子概述"
10244 #. type: Content of: <book><chapter><sect1><para>
10245 #: ../en/ch10-hook.xml:20
10246 msgid ""
10247 "Here is a brief list of the hooks that Mercurial supports. We will revisit "
10248 "each of these hooks in more detail later, in section <xref linkend=\"sec.hook."
10249 "ref\"/>."
10250 msgstr ""
10252 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
10253 #: ../en/ch10-hook.xml:25
10254 msgid ""
10255 "<literal role=\"hook\">changegroup</literal>: This is run after a group of "
10256 "changesets has been brought into the repository from elsewhere."
10257 msgstr ""
10259 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
10260 #: ../en/ch10-hook.xml:29
10261 msgid ""
10262 "<literal role=\"hook\">commit</literal>: This is run after a new changeset "
10263 "has been created in the local repository."
10264 msgstr ""
10266 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
10267 #: ../en/ch10-hook.xml:33
10268 msgid ""
10269 "<literal role=\"hook\">incoming</literal>: This is run once for each new "
10270 "changeset that is brought into the repository from elsewhere. Notice the "
10271 "difference from <literal role=\"hook\">changegroup</literal>, which is run "
10272 "once per <emphasis>group</emphasis> of changesets brought in."
10273 msgstr ""
10275 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
10276 #: ../en/ch10-hook.xml:40
10277 msgid ""
10278 "<literal role=\"hook\">outgoing</literal>: This is run after a group of "
10279 "changesets has been transmitted from this repository."
10280 msgstr ""
10282 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
10283 #: ../en/ch10-hook.xml:44
10284 msgid ""
10285 "<literal role=\"hook\">prechangegroup</literal>: This is run before starting "
10286 "to bring a group of changesets into the repository."
10287 msgstr ""
10289 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
10290 #: ../en/ch10-hook.xml:49
10291 msgid ""
10292 "<literal role=\"hook\">precommit</literal>: Controlling. This is run before "
10293 "starting a commit."
10294 msgstr ""
10296 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
10297 #: ../en/ch10-hook.xml:53
10298 msgid ""
10299 "<literal role=\"hook\">preoutgoing</literal>: Controlling. This is run before "
10300 "starting to transmit a group of changesets from this repository."
10301 msgstr ""
10303 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
10304 #: ../en/ch10-hook.xml:58
10305 msgid ""
10306 "<literal role=\"hook\">pretag</literal>: Controlling. This is run before "
10307 "creating a tag."
10308 msgstr ""
10310 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
10311 #: ../en/ch10-hook.xml:62
10312 msgid ""
10313 "<literal role=\"hook\">pretxnchangegroup</literal>: Controlling. This is run "
10314 "after a group of changesets has been brought into the local repository from "
10315 "another, but before the transaction completes that will make the changes "
10316 "permanent in the repository."
10317 msgstr ""
10319 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
10320 #: ../en/ch10-hook.xml:70
10321 msgid ""
10322 "<literal role=\"hook\">pretxncommit</literal>: Controlling. This is run after "
10323 "a new changeset has been created in the local repository, but before the "
10324 "transaction completes that will make it permanent."
10325 msgstr ""
10327 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
10328 #: ../en/ch10-hook.xml:76
10329 msgid ""
10330 "<literal role=\"hook\">preupdate</literal>: Controlling. This is run before "
10331 "starting an update or merge of the working directory."
10332 msgstr ""
10334 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
10335 #: ../en/ch10-hook.xml:81
10336 msgid ""
10337 "<literal role=\"hook\">tag</literal>: This is run after a tag is created."
10338 msgstr ""
10340 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
10341 #: ../en/ch10-hook.xml:85
10342 msgid ""
10343 "<literal role=\"hook\">update</literal>: This is run after an update or merge "
10344 "of the working directory has finished."
10345 msgstr ""
10347 #. type: Content of: <book><chapter><sect1><para>
10348 #: ../en/ch10-hook.xml:90
10349 msgid ""
10350 "Each of the hooks whose description begins with the word <quote>Controlling</"
10351 "quote> has the ability to determine whether an activity can proceed. If the "
10352 "hook succeeds, the activity may proceed; if it fails, the activity is either "
10353 "not permitted or undone, depending on the hook."
10354 msgstr ""
10356 #. type: Content of: <book><chapter><sect1><title>
10357 #: ../en/ch10-hook.xml:99
10358 msgid "Hooks and security"
10359 msgstr "钩子与安全性"
10361 #. type: Content of: <book><chapter><sect1><sect2><title>
10362 #: ../en/ch10-hook.xml:102
10363 msgid "Hooks are run with your privileges"
10364 msgstr "钩子以你的特权执行"
10366 #. type: Content of: <book><chapter><sect1><sect2><para>
10367 #: ../en/ch10-hook.xml:104
10368 msgid ""
10369 "When you run a Mercurial command in a repository, and the command causes a "
10370 "hook to run, that hook runs on <emphasis>your</emphasis> system, under "
10371 "<emphasis>your</emphasis> user account, with <emphasis>your</emphasis> "
10372 "privilege level. Since hooks are arbitrary pieces of executable code, you "
10373 "should treat them with an appropriate level of suspicion. Do not install a "
10374 "hook unless you are confident that you know who created it and what it does."
10375 msgstr ""
10377 #. type: Content of: <book><chapter><sect1><sect2><para>
10378 #: ../en/ch10-hook.xml:115
10379 msgid ""
10380 "In some cases, you may be exposed to hooks that you did not install "
10381 "yourself. If you work with Mercurial on an unfamiliar system, Mercurial will "
10382 "run hooks defined in that system's global <filename role=\"special\"> /.hgrc</"
10383 "filename>\\ file."
10384 msgstr ""
10386 #. type: Content of: <book><chapter><sect1><sect2><para>
10387 #: ../en/ch10-hook.xml:122
10388 msgid ""
10389 "If you are working with a repository owned by another user, Mercurial can run "
10390 "hooks defined in that user's repository, but it will still run them as "
10391 "<quote>you</quote>. For example, if you <command role=\"hg-cmd\">hg pull</"
10392 "command> from that repository, and its <filename role=\"special\">.hg/hgrc</"
10393 "filename> defines a local <literal role=\"hook\">outgoing</literal> hook, "
10394 "that hook will run under your user account, even though you don't own that "
10395 "repository."
10396 msgstr ""
10398 #. type: Content of: <book><chapter><sect1><sect2><note><para>
10399 #: ../en/ch10-hook.xml:134
10400 msgid ""
10401 "This only applies if you are pulling from a repository on a local or network "
10402 "filesystem. If you're pulling over http or ssh, any <literal role=\"hook"
10403 "\">outgoing</literal> hook will run under whatever account is executing the "
10404 "server process, on the server."
10405 msgstr ""
10407 #. type: Content of: <book><chapter><sect1><sect2><para>
10408 #: ../en/ch10-hook.xml:142
10409 msgid ""
10410 "XXX To see what hooks are defined in a repository, use the <command role=\"hg-"
10411 "cmd\">hg config hooks</command> command. If you are working in one "
10412 "repository, but talking to another that you do not own (e.g. using <command "
10413 "role=\"hg-cmd\">hg pull</command> or <command role=\"hg-cmd\">hg incoming</"
10414 "command>), remember that it is the other repository's hooks you should be "
10415 "checking, not your own."
10416 msgstr ""
10418 #. type: Content of: <book><chapter><sect1><sect2><title>
10419 #: ../en/ch10-hook.xml:153
10420 msgid "Hooks do not propagate"
10421 msgstr "钩子不会传播"
10423 #. type: Content of: <book><chapter><sect1><sect2><para>
10424 #: ../en/ch10-hook.xml:155
10425 msgid ""
10426 "In Mercurial, hooks are not revision controlled, and do not propagate when "
10427 "you clone, or pull from, a repository. The reason for this is simple: a hook "
10428 "is a completely arbitrary piece of executable code. It runs under your user "
10429 "identity, with your privilege level, on your machine."
10430 msgstr ""
10432 #. type: Content of: <book><chapter><sect1><sect2><para>
10433 #: ../en/ch10-hook.xml:162
10434 msgid ""
10435 "It would be extremely reckless for any distributed revision control system to "
10436 "implement revision-controlled hooks, as this would offer an easily "
10437 "exploitable way to subvert the accounts of users of the revision control "
10438 "system."
10439 msgstr ""
10441 #. type: Content of: <book><chapter><sect1><sect2><para>
10442 #: ../en/ch10-hook.xml:168
10443 msgid ""
10444 "Since Mercurial does not propagate hooks, if you are collaborating with other "
10445 "people on a common project, you should not assume that they are using the "
10446 "same Mercurial hooks as you are, or that theirs are correctly configured. "
10447 "You should document the hooks you expect people to use."
10448 msgstr ""
10450 #. type: Content of: <book><chapter><sect1><sect2><para>
10451 #: ../en/ch10-hook.xml:175
10452 msgid ""
10453 "In a corporate intranet, this is somewhat easier to control, as you can for "
10454 "example provide a <quote>standard</quote> installation of Mercurial on an NFS "
10455 "filesystem, and use a site-wide <filename role=\"special\"> /.hgrc</filename>"
10456 "\\ file to define hooks that all users will see. However, this too has its "
10457 "limits; see below."
10458 msgstr ""
10460 #. type: Content of: <book><chapter><sect1><sect2><title>
10461 #: ../en/ch10-hook.xml:185
10462 msgid "Hooks can be overridden"
10463 msgstr "钩子可以被覆盖"
10465 #. type: Content of: <book><chapter><sect1><sect2><para>
10466 #: ../en/ch10-hook.xml:187
10467 msgid ""
10468 "Mercurial allows you to override a hook definition by redefining the hook. "
10469 "You can disable it by setting its value to the empty string, or change its "
10470 "behaviour as you wish."
10471 msgstr ""
10473 #. type: Content of: <book><chapter><sect1><sect2><para>
10474 #: ../en/ch10-hook.xml:192
10475 msgid ""
10476 "If you deploy a system- or site-wide <filename role=\"special\"> /.hgrc</"
10477 "filename>\\ file that defines some hooks, you should thus understand that "
10478 "your users can disable or override those hooks."
10479 msgstr ""
10481 #. type: Content of: <book><chapter><sect1><sect2><title>
10482 #: ../en/ch10-hook.xml:200
10483 msgid "Ensuring that critical hooks are run"
10484 msgstr "确保关键钩子的执行"
10486 #. type: Content of: <book><chapter><sect1><sect2><para>
10487 #: ../en/ch10-hook.xml:202
10488 msgid ""
10489 "Sometimes you may want to enforce a policy that you do not want others to be "
10490 "able to work around. For example, you may have a requirement that every "
10491 "changeset must pass a rigorous set of tests. Defining this requirement via a "
10492 "hook in a site-wide <filename role=\"special\"> /.hgrc</filename>\\ won't "
10493 "work for remote users on laptops, and of course local users can subvert it at "
10494 "will by overriding the hook."
10495 msgstr ""
10497 #. type: Content of: <book><chapter><sect1><sect2><para>
10498 #: ../en/ch10-hook.xml:211
10499 msgid ""
10500 "Instead, you can set up your policies for use of Mercurial so that people are "
10501 "expected to propagate changes through a well-known <quote>canonical</quote> "
10502 "server that you have locked down and configured appropriately."
10503 msgstr ""
10505 #. type: Content of: <book><chapter><sect1><sect2><para>
10506 #: ../en/ch10-hook.xml:217
10507 msgid ""
10508 "One way to do this is via a combination of social engineering and "
10509 "technology. Set up a restricted-access account; users can push changes over "
10510 "the network to repositories managed by this account, but they cannot log into "
10511 "the account and run normal shell commands. In this scenario, a user can "
10512 "commit a changeset that contains any old garbage they want."
10513 msgstr ""
10515 #. type: Content of: <book><chapter><sect1><sect2><para>
10516 #: ../en/ch10-hook.xml:226
10517 msgid ""
10518 "When someone pushes a changeset to the server that everyone pulls from, the "
10519 "server will test the changeset before it accepts it as permanent, and reject "
10520 "it if it fails to pass the test suite. If people only pull changes from this "
10521 "filtering server, it will serve to ensure that all changes that people pull "
10522 "have been automatically vetted."
10523 msgstr ""
10525 #. type: Content of: <book><chapter><sect1><title>
10526 #: ../en/ch10-hook.xml:237
10527 msgid "Care with <literal>pretxn</literal> hooks in a shared-access repository"
10528 msgstr "在共享版本库中注意 <literal>pretxn</literal> 钩子"
10530 #. type: Content of: <book><chapter><sect1><para>
10531 #: ../en/ch10-hook.xml:240
10532 msgid ""
10533 "If you want to use hooks to do some automated work in a repository that a "
10534 "number of people have shared access to, you need to be careful in how you do "
10535 "this."
10536 msgstr ""
10538 #. type: Content of: <book><chapter><sect1><para>
10539 #: ../en/ch10-hook.xml:245
10540 msgid ""
10541 "Mercurial only locks a repository when it is writing to the repository, and "
10542 "only the parts of Mercurial that write to the repository pay attention to "
10543 "locks. Write locks are necessary to prevent multiple simultaneous writers "
10544 "from scribbling on each other's work, corrupting the repository."
10545 msgstr ""
10547 #. type: Content of: <book><chapter><sect1><para>
10548 #: ../en/ch10-hook.xml:252
10549 msgid ""
10550 "Because Mercurial is careful with the order in which it reads and writes "
10551 "data, it does not need to acquire a lock when it wants to read data from the "
10552 "repository. The parts of Mercurial that read from the repository never pay "
10553 "attention to locks. This lockless reading scheme greatly increases "
10554 "performance and concurrency."
10555 msgstr ""
10557 #. type: Content of: <book><chapter><sect1><para>
10558 #: ../en/ch10-hook.xml:260
10559 msgid ""
10560 "With great performance comes a trade-off, though, one which has the potential "
10561 "to cause you trouble unless you're aware of it. To describe this requires a "
10562 "little detail about how Mercurial adds changesets to a repository and reads "
10563 "those changes."
10564 msgstr ""
10566 #. type: Content of: <book><chapter><sect1><para>
10567 #: ../en/ch10-hook.xml:267
10568 msgid ""
10569 "When Mercurial <emphasis>writes</emphasis> metadata, it writes it straight "
10570 "into the destination file. It writes file data first, then manifest data "
10571 "(which contains pointers to the new file data), then changelog data (which "
10572 "contains pointers to the new manifest data). Before the first write to each "
10573 "file, it stores a record of where the end of the file was in its transaction "
10574 "log. If the transaction must be rolled back, Mercurial simply truncates each "
10575 "file back to the size it was before the transaction began."
10576 msgstr ""
10578 #. type: Content of: <book><chapter><sect1><para>
10579 #: ../en/ch10-hook.xml:278
10580 msgid ""
10581 "When Mercurial <emphasis>reads</emphasis> metadata, it reads the changelog "
10582 "first, then everything else. Since a reader will only access parts of the "
10583 "manifest or file metadata that it can see in the changelog, it can never see "
10584 "partially written data."
10585 msgstr ""
10587 #. type: Content of: <book><chapter><sect1><para>
10588 #: ../en/ch10-hook.xml:284
10589 msgid ""
10590 "Some controlling hooks (<literal role=\"hook\">pretxncommit</literal> and "
10591 "<literal role=\"hook\">pretxnchangegroup</literal>) run when a transaction is "
10592 "almost complete. All of the metadata has been written, but Mercurial can "
10593 "still roll the transaction back and cause the newly-written data to disappear."
10594 msgstr ""
10596 #. type: Content of: <book><chapter><sect1><para>
10597 #: ../en/ch10-hook.xml:292
10598 msgid ""
10599 "If one of these hooks runs for long, it opens a window of time during which a "
10600 "reader can see the metadata for changesets that are not yet permanent, and "
10601 "should not be thought of as <quote>really there</quote>. The longer the hook "
10602 "runs, the longer that window is open."
10603 msgstr ""
10605 #. type: Content of: <book><chapter><sect1><sect2><title>
10606 #: ../en/ch10-hook.xml:300
10607 msgid "The problem illustrated"
10608 msgstr "问题的演示"
10610 #. type: Content of: <book><chapter><sect1><sect2><para>
10611 #: ../en/ch10-hook.xml:302
10612 msgid ""
10613 "In principle, a good use for the <literal role=\"hook\">pretxnchangegroup</"
10614 "literal> hook would be to automatically build and test incoming changes "
10615 "before they are accepted into a central repository. This could let you "
10616 "guarantee that nobody can push changes to this repository that <quote>break "
10617 "the build</quote>. But if a client can pull changes while they're being "
10618 "tested, the usefulness of the test is zero; an unsuspecting someone can pull "
10619 "untested changes, potentially breaking their build."
10620 msgstr ""
10622 #. type: Content of: <book><chapter><sect1><sect2><para>
10623 #: ../en/ch10-hook.xml:313
10624 msgid ""
10625 "The safest technological answer to this challenge is to set up such a "
10626 "<quote>gatekeeper</quote> repository as <emphasis>unidirectional</emphasis>. "
10627 "Let it take changes pushed in from the outside, but do not allow anyone to "
10628 "pull changes from it (use the <literal role=\"hook\">preoutgoing</literal> "
10629 "hook to lock it down). Configure a <literal role=\"hook\">changegroup</"
10630 "literal> hook so that if a build or test succeeds, the hook will push the new "
10631 "changes out to another repository that people <emphasis>can</emphasis> pull "
10632 "from."
10633 msgstr ""
10635 #. type: Content of: <book><chapter><sect1><sect2><para>
10636 #: ../en/ch10-hook.xml:325
10637 msgid ""
10638 "In practice, putting a centralised bottleneck like this in place is not often "
10639 "a good idea, and transaction visibility has nothing to do with the problem. "
10640 "As the size of a project&emdash;and the time it takes to build and "
10641 "test&emdash;grows, you rapidly run into a wall with this <quote>try before "
10642 "you buy</quote> approach, where you have more changesets to test than time in "
10643 "which to deal with them. The inevitable result is frustration on the part of "
10644 "all involved."
10645 msgstr ""
10647 #. type: Content of: <book><chapter><sect1><sect2><para>
10648 #: ../en/ch10-hook.xml:336
10649 msgid ""
10650 "An approach that scales better is to get people to build and test before they "
10651 "push, then run automated builds and tests centrally <emphasis>after</"
10652 "emphasis> a push, to be sure all is well. The advantage of this approach is "
10653 "that it does not impose a limit on the rate at which the repository can "
10654 "accept changes."
10655 msgstr ""
10657 #. type: Content of: <book><chapter><sect1><title>
10658 #: ../en/ch10-hook.xml:347
10659 msgid "A short tutorial on using hooks"
10660 msgstr "使用钩子的简短指南"
10662 #. type: Content of: <book><chapter><sect1><para>
10663 #: ../en/ch10-hook.xml:349
10664 msgid ""
10665 "It is easy to write a Mercurial hook. Let's start with a hook that runs when "
10666 "you finish a <command role=\"hg-cmd\">hg commit</command>, and simply prints "
10667 "the hash of the changeset you just created. The hook is called <literal role="
10668 "\"hook\">commit</literal>."
10669 msgstr ""
10671 #. type: Content of: <book><chapter><sect1><para>
10672 #: ../en/ch10-hook.xml:356
10673 msgid "All hooks follow the pattern in this example."
10674 msgstr ""
10676 #. type: Content of: <book><chapter><sect1><para>
10677 #: ../en/ch10-hook.xml:360
10678 msgid ""
10679 "You add an entry to the <literal role=\"rc-hooks\">hooks</literal> section of "
10680 "your <filename role=\"special\"> /.hgrc</filename>. On the left is the name "
10681 "of the event to trigger on; on the right is the action to take. As you can "
10682 "see, you can run an arbitrary shell command in a hook. Mercurial passes "
10683 "extra information to the hook using environment variables (look for "
10684 "<envar>HG_NODE</envar> in the example)."
10685 msgstr ""
10687 #. type: Content of: <book><chapter><sect1><sect2><title>
10688 #: ../en/ch10-hook.xml:370
10689 msgid "Performing multiple actions per event"
10690 msgstr "每个事件执行多个操作"
10692 #. type: Content of: <book><chapter><sect1><sect2><para>
10693 #: ../en/ch10-hook.xml:372
10694 msgid ""
10695 "Quite often, you will want to define more than one hook for a particular kind "
10696 "of event, as shown below."
10697 msgstr ""
10699 #. type: Content of: <book><chapter><sect1><sect2><para>
10700 #: ../en/ch10-hook.xml:377
10701 msgid ""
10702 "Mercurial lets you do this by adding an <emphasis>extension</emphasis> to the "
10703 "end of a hook's name. You extend a hook's name by giving the name of the "
10704 "hook, followed by a full stop (the <quote><literal>.</literal></quote> "
10705 "character), followed by some more text of your choosing. For example, "
10706 "Mercurial will run both <literal>commit.foo</literal> and <literal>commit."
10707 "bar</literal> when the <literal>commit</literal> event occurs."
10708 msgstr ""
10710 #. type: Content of: <book><chapter><sect1><sect2><para>
10711 #: ../en/ch10-hook.xml:388
10712 msgid ""
10713 "To give a well-defined order of execution when there are multiple hooks "
10714 "defined for an event, Mercurial sorts hooks by extension, and executes the "
10715 "hook commands in this sorted order. In the above example, it will execute "
10716 "<literal>commit.bar</literal> before <literal>commit.foo</literal>, and "
10717 "<literal>commit</literal> before both."
10718 msgstr ""
10720 #. type: Content of: <book><chapter><sect1><sect2><para>
10721 #: ../en/ch10-hook.xml:397
10722 msgid ""
10723 "It is a good idea to use a somewhat descriptive extension when you define a "
10724 "new hook. This will help you to remember what the hook was for. If the hook "
10725 "fails, you'll get an error message that contains the hook name and extension, "
10726 "so using a descriptive extension could give you an immediate hint as to why "
10727 "the hook failed (see section <xref linkend=\"sec.hook.perm\"/> for an "
10728 "example)."
10729 msgstr ""
10731 #. type: Content of: <book><chapter><sect1><sect2><title>
10732 #: ../en/ch10-hook.xml:408
10733 msgid "Controlling whether an activity can proceed"
10734 msgstr "控制处理的活动"
10736 #. type: Content of: <book><chapter><sect1><sect2><para>
10737 #: ../en/ch10-hook.xml:410
10738 msgid ""
10739 "In our earlier examples, we used the <literal role=\"hook\">commit</literal> "
10740 "hook, which is run after a commit has completed. This is one of several "
10741 "Mercurial hooks that run after an activity finishes. Such hooks have no way "
10742 "of influencing the activity itself."
10743 msgstr ""
10745 #. type: Content of: <book><chapter><sect1><sect2><para>
10746 #: ../en/ch10-hook.xml:417
10747 msgid ""
10748 "Mercurial defines a number of events that occur before an activity starts; or "
10749 "after it starts, but before it finishes. Hooks that trigger on these events "
10750 "have the added ability to choose whether the activity can continue, or will "
10751 "abort."
10752 msgstr ""
10754 #. type: Content of: <book><chapter><sect1><sect2><para>
10755 #: ../en/ch10-hook.xml:423
10756 msgid ""
10757 "The <literal role=\"hook\">pretxncommit</literal> hook runs after a commit "
10758 "has all but completed. In other words, the metadata representing the "
10759 "changeset has been written out to disk, but the transaction has not yet been "
10760 "allowed to complete. The <literal role=\"hook\">pretxncommit</literal> hook "
10761 "has the ability to decide whether the transaction can complete, or must be "
10762 "rolled back."
10763 msgstr ""
10765 #. type: Content of: <book><chapter><sect1><sect2><para>
10766 #: ../en/ch10-hook.xml:432
10767 msgid ""
10768 "If the <literal role=\"hook\">pretxncommit</literal> hook exits with a status "
10769 "code of zero, the transaction is allowed to complete; the commit finishes; "
10770 "and the <literal role=\"hook\">commit</literal> hook is run. If the <literal "
10771 "role=\"hook\">pretxncommit</literal> hook exits with a non-zero status code, "
10772 "the transaction is rolled back; the metadata representing the changeset is "
10773 "erased; and the <literal role=\"hook\">commit</literal> hook is not run."
10774 msgstr ""
10776 #. type: Content of: <book><chapter><sect1><sect2><para>
10777 #: ../en/ch10-hook.xml:444
10778 msgid ""
10779 "The hook in the example above checks that a commit comment contains a bug "
10780 "ID. If it does, the commit can complete. If not, the commit is rolled back."
10781 msgstr ""
10783 #. type: Content of: <book><chapter><sect1><title>
10784 #: ../en/ch10-hook.xml:452
10785 msgid "Writing your own hooks"
10786 msgstr "编写钩子"
10788 #. type: Content of: <book><chapter><sect1><para>
10789 #: ../en/ch10-hook.xml:454
10790 msgid ""
10791 "When you are writing a hook, you might find it useful to run Mercurial either "
10792 "with the <option role=\"hg-opt-global\">-v</option> option, or the <envar "
10793 "role=\"rc-item-ui\">verbose</envar> config item set to <quote>true</quote>. "
10794 "When you do so, Mercurial will print a message before it calls each hook."
10795 msgstr ""
10797 #. type: Content of: <book><chapter><sect1><sect2><title>
10798 #: ../en/ch10-hook.xml:463
10799 msgid "Choosing how your hook should run"
10800 msgstr "选择钩子的执行方式"
10802 #. type: Content of: <book><chapter><sect1><sect2><para>
10803 #: ../en/ch10-hook.xml:465
10804 msgid ""
10805 "You can write a hook either as a normal program&emdash;typically a shell "
10806 "script&emdash;or as a Python function that is executed within the Mercurial "
10807 "process."
10808 msgstr ""
10810 #. type: Content of: <book><chapter><sect1><sect2><para>
10811 #: ../en/ch10-hook.xml:470
10812 msgid ""
10813 "Writing a hook as an external program has the advantage that it requires no "
10814 "knowledge of Mercurial's internals. You can call normal Mercurial commands "
10815 "to get any added information you need. The trade-off is that external hooks "
10816 "are slower than in-process hooks."
10817 msgstr ""
10819 #. type: Content of: <book><chapter><sect1><sect2><para>
10820 #: ../en/ch10-hook.xml:477
10821 msgid ""
10822 "An in-process Python hook has complete access to the Mercurial API, and does "
10823 "not <quote>shell out</quote> to another process, so it is inherently faster "
10824 "than an external hook. It is also easier to obtain much of the information "
10825 "that a hook requires by using the Mercurial API than by running Mercurial "
10826 "commands."
10827 msgstr ""
10829 #. type: Content of: <book><chapter><sect1><sect2><para>
10830 #: ../en/ch10-hook.xml:485
10831 msgid ""
10832 "If you are comfortable with Python, or require high performance, writing your "
10833 "hooks in Python may be a good choice. However, when you have a "
10834 "straightforward hook to write and you don't need to care about performance "
10835 "(probably the majority of hooks), a shell script is perfectly fine."
10836 msgstr ""
10838 #. type: Content of: <book><chapter><sect1><sect2><title>
10839 #: ../en/ch10-hook.xml:494
10840 msgid "Hook parameters"
10841 msgstr "钩子的参数"
10843 #. type: Content of: <book><chapter><sect1><sect2><para>
10844 #: ../en/ch10-hook.xml:496
10845 msgid ""
10846 "Mercurial calls each hook with a set of well-defined parameters. In Python, "
10847 "a parameter is passed as a keyword argument to your hook function. For an "
10848 "external program, a parameter is passed as an environment variable."
10849 msgstr ""
10851 #. type: Content of: <book><chapter><sect1><sect2><para>
10852 #: ../en/ch10-hook.xml:502
10853 msgid ""
10854 "Whether your hook is written in Python or as a shell script, the hook-"
10855 "specific parameter names and values will be the same. A boolean parameter "
10856 "will be represented as a boolean value in Python, but as the number 1 (for "
10857 "<quote>true</quote>) or 0 (for <quote>false</quote>) as an environment "
10858 "variable for an external hook. If a hook parameter is named <literal>foo</"
10859 "literal>, the keyword argument for a Python hook will also be named "
10860 "<literal>foo</literal>, while the environment variable for an external hook "
10861 "will be named <literal>HG_FOO</literal>."
10862 msgstr ""
10864 #. type: Content of: <book><chapter><sect1><sect2><title>
10865 #: ../en/ch10-hook.xml:516
10866 msgid "Hook return values and activity control"
10867 msgstr "钩子的返回值与活动控制"
10869 #. type: Content of: <book><chapter><sect1><sect2><para>
10870 #: ../en/ch10-hook.xml:518
10871 msgid ""
10872 "A hook that executes successfully must exit with a status of zero if "
10873 "external, or return boolean <quote>false</quote> if in-process. Failure is "
10874 "indicated with a non-zero exit status from an external hook, or an in-process "
10875 "hook returning boolean <quote>true</quote>. If an in-process hook raises an "
10876 "exception, the hook is considered to have failed."
10877 msgstr ""
10879 #. type: Content of: <book><chapter><sect1><sect2><para>
10880 #: ../en/ch10-hook.xml:526
10881 msgid ""
10882 "For a hook that controls whether an activity can proceed, zero/false means "
10883 "<quote>allow</quote>, while non-zero/true/exception means <quote>deny</quote>."
10884 msgstr ""
10886 #. type: Content of: <book><chapter><sect1><sect2><title>
10887 #: ../en/ch10-hook.xml:533
10888 msgid "Writing an external hook"
10889 msgstr "编写外部钩子"
10891 #. type: Content of: <book><chapter><sect1><sect2><para>
10892 #: ../en/ch10-hook.xml:535
10893 msgid ""
10894 "When you define an external hook in your <filename role=\"special\"> /.hgrc</"
10895 "filename>\\ and the hook is run, its value is passed to your shell, which "
10896 "interprets it. This means that you can use normal shell constructs in the "
10897 "body of the hook."
10898 msgstr ""
10900 #. type: Content of: <book><chapter><sect1><sect2><para>
10901 #: ../en/ch10-hook.xml:542
10902 msgid ""
10903 "An executable hook is always run with its current directory set to a "
10904 "repository's root directory."
10905 msgstr ""
10907 #. type: Content of: <book><chapter><sect1><sect2><para>
10908 #: ../en/ch10-hook.xml:546
10909 msgid ""
10910 "Each hook parameter is passed in as an environment variable; the name is "
10911 "upper-cased, and prefixed with the string <quote><literal>HG_</literal></"
10912 "quote>."
10913 msgstr ""
10915 #. type: Content of: <book><chapter><sect1><sect2><para>
10916 #: ../en/ch10-hook.xml:551
10917 msgid ""
10918 "With the exception of hook parameters, Mercurial does not set or modify any "
10919 "environment variables when running a hook. This is useful to remember if you "
10920 "are writing a site-wide hook that may be run by a number of different users "
10921 "with differing environment variables set. In multi-user situations, you "
10922 "should not rely on environment variables being set to the values you have in "
10923 "your environment when testing the hook."
10924 msgstr ""
10926 #. type: Content of: <book><chapter><sect1><sect2><title>
10927 #: ../en/ch10-hook.xml:562
10928 msgid "Telling Mercurial to use an in-process hook"
10929 msgstr "让 Mercurial 使用进程内钩子"
10931 #. type: Content of: <book><chapter><sect1><sect2><para>
10932 #: ../en/ch10-hook.xml:564
10933 msgid ""
10934 "The <filename role=\"special\"> /.hgrc</filename>\\ syntax for defining an in-"
10935 "process hook is slightly different than for an executable hook. The value of "
10936 "the hook must start with the text <quote><literal>python:</literal></quote>, "
10937 "and continue with the fully-qualified name of a callable object to use as the "
10938 "hook's value."
10939 msgstr ""
10941 #. type: Content of: <book><chapter><sect1><sect2><para>
10942 #: ../en/ch10-hook.xml:572
10943 msgid ""
10944 "The module in which a hook lives is automatically imported when a hook is "
10945 "run. So long as you have the module name and <envar>PYTHONPATH</envar> "
10946 "right, it should <quote>just work</quote>."
10947 msgstr ""
10949 #. type: Content of: <book><chapter><sect1><sect2><para>
10950 #: ../en/ch10-hook.xml:578
10951 msgid ""
10952 "The following <filename role=\"special\"> /.hgrc</filename>\\ example snippet "
10953 "illustrates the syntax and meaning of the notions we just described."
10954 msgstr ""
10956 #. type: Content of: <book><chapter><sect1><sect2><para>
10957 #: ../en/ch10-hook.xml:584
10958 msgid ""
10959 "When Mercurial runs the <literal>commit.example</literal> hook, it imports "
10960 "<literal>mymodule.submodule</literal>, looks for the callable object named "
10961 "<literal>myhook</literal>, and calls it."
10962 msgstr ""
10964 #. type: Content of: <book><chapter><sect1><sect2><title>
10965 #: ../en/ch10-hook.xml:592
10966 msgid "Writing an in-process hook"
10967 msgstr "编写进程内钩子"
10969 #. type: Content of: <book><chapter><sect1><sect2><para>
10970 #: ../en/ch10-hook.xml:594
10971 msgid ""
10972 "The simplest in-process hook does nothing, but illustrates the basic shape of "
10973 "the hook API:"
10974 msgstr ""
10976 #. type: Content of: <book><chapter><sect1><sect2><para>
10977 #: ../en/ch10-hook.xml:599
10978 msgid ""
10979 "The first argument to a Python hook is always a <literal role=\"py-mod-"
10980 "mercurial.ui\">ui</literal> object. The second is a repository object; at "
10981 "the moment, it is always an instance of <literal role=\"py-mod-mercurial."
10982 "localrepo\">localrepository</literal>. Following these two arguments are "
10983 "other keyword arguments. Which ones are passed in depends on the hook being "
10984 "called, but a hook can ignore arguments it doesn't care about by dropping "
10985 "them into a keyword argument dict, as with <literal>**kwargs</literal> above."
10986 msgstr ""
10988 #. type: Content of: <book><chapter><sect1><title>
10989 #: ../en/ch10-hook.xml:614
10990 msgid "Some hook examples"
10991 msgstr "钩子样例"
10993 #. type: Content of: <book><chapter><sect1><sect2><title>
10994 #: ../en/ch10-hook.xml:617
10995 msgid "Writing meaningful commit messages"
10996 msgstr "编写有意义的提交日志"
10998 #. type: Content of: <book><chapter><sect1><sect2><para>
10999 #: ../en/ch10-hook.xml:619
11000 msgid ""
11001 "It's hard to imagine a useful commit message being very short. The simple "
11002 "<literal role=\"hook\">pretxncommit</literal> hook of the example below will "
11003 "prevent you from committing a changeset with a message that is less than ten "
11004 "bytes long."
11005 msgstr ""
11007 #. type: Content of: <book><chapter><sect1><sect2><title>
11008 #: ../en/ch10-hook.xml:629
11009 msgid "Checking for trailing whitespace"
11010 msgstr "检查行尾空格"
11012 #. type: Content of: <book><chapter><sect1><sect2><para>
11013 #: ../en/ch10-hook.xml:631
11014 msgid ""
11015 "An interesting use of a commit-related hook is to help you to write cleaner "
11016 "code. A simple example of <quote>cleaner code</quote> is the dictum that a "
11017 "change should not add any new lines of text that contain <quote>trailing "
11018 "whitespace</quote>. Trailing whitespace is a series of space and tab "
11019 "characters at the end of a line of text. In most cases, trailing whitespace "
11020 "is unnecessary, invisible noise, but it is occasionally problematic, and "
11021 "people often prefer to get rid of it."
11022 msgstr ""
11024 #. type: Content of: <book><chapter><sect1><sect2><para>
11025 #: ../en/ch10-hook.xml:642
11026 msgid ""
11027 "You can use either the <literal role=\"hook\">precommit</literal> or <literal "
11028 "role=\"hook\">pretxncommit</literal> hook to tell whether you have a trailing "
11029 "whitespace problem. If you use the <literal role=\"hook\">precommit</"
11030 "literal> hook, the hook will not know which files you are committing, so it "
11031 "will have to check every modified file in the repository for trailing white "
11032 "space. If you want to commit a change to just the file <filename>foo</"
11033 "filename>, but the file <filename>bar</filename> contains trailing "
11034 "whitespace, doing a check in the <literal role=\"hook\">precommit</literal> "
11035 "hook will prevent you from committing <filename>foo</filename> due to the "
11036 "problem with <filename>bar</filename>. This doesn't seem right."
11037 msgstr ""
11039 #. type: Content of: <book><chapter><sect1><sect2><para>
11040 #: ../en/ch10-hook.xml:658
11041 msgid ""
11042 "Should you choose the <literal role=\"hook\">pretxncommit</literal> hook, the "
11043 "check won't occur until just before the transaction for the commit "
11044 "completes. This will allow you to check for problems only the exact files "
11045 "that are being committed. However, if you entered the commit message "
11046 "interactively and the hook fails, the transaction will roll back; you'll have "
11047 "to re-enter the commit message after you fix the trailing whitespace and run "
11048 "<command role=\"hg-cmd\">hg commit</command> again."
11049 msgstr ""
11051 #. type: Content of: <book><chapter><sect1><sect2><para>
11052 #: ../en/ch10-hook.xml:671
11053 msgid ""
11054 "In this example, we introduce a simple <literal role=\"hook\">pretxncommit</"
11055 "literal> hook that checks for trailing whitespace. This hook is short, but "
11056 "not very helpful. It exits with an error status if a change adds a line with "
11057 "trailing whitespace to any file, but does not print any information that "
11058 "might help us to identify the offending file or line. It also has the nice "
11059 "property of not paying attention to unmodified lines; only lines that "
11060 "introduce new trailing whitespace cause problems."
11061 msgstr ""
11063 #. type: Content of: <book><chapter><sect1><sect2><para>
11064 #: ../en/ch10-hook.xml:682
11065 msgid ""
11066 "The above version is much more complex, but also more useful. It parses a "
11067 "unified diff to see if any lines add trailing whitespace, and prints the name "
11068 "of the file and the line number of each such occurrence. Even better, if the "
11069 "change adds trailing whitespace, this hook saves the commit comment and "
11070 "prints the name of the save file before exiting and telling Mercurial to roll "
11071 "the transaction back, so you can use the <option role=\"hg-opt-commit\">-l "
11072 "filename</option> option to <command role=\"hg-cmd\">hg commit</command> to "
11073 "reuse the saved commit message once you've corrected the problem."
11074 msgstr ""
11076 #. type: Content of: <book><chapter><sect1><sect2><para>
11077 #: ../en/ch10-hook.xml:696
11078 msgid ""
11079 "As a final aside, note in the example above the use of <command>perl</"
11080 "command>'s in-place editing feature to get rid of trailing whitespace from a "
11081 "file. This is concise and useful enough that I will reproduce it here."
11082 msgstr ""
11084 #. type: Content of: <book><chapter><sect1><title>
11085 #: ../en/ch10-hook.xml:706
11086 msgid "Bundled hooks"
11087 msgstr "内置的钩子"
11089 #. type: Content of: <book><chapter><sect1><para>
11090 #: ../en/ch10-hook.xml:708
11091 msgid ""
11092 "Mercurial ships with several bundled hooks. You can find them in the "
11093 "<filename class=\"directory\">hgext</filename> directory of a Mercurial "
11094 "source tree. If you are using a Mercurial binary package, the hooks will be "
11095 "located in the <filename class=\"directory\">hgext</filename> directory of "
11096 "wherever your package installer put Mercurial."
11097 msgstr ""
11099 #. type: Content of: <book><chapter><sect1><sect2><title>
11100 #: ../en/ch10-hook.xml:717
11101 msgid ""
11102 "<literal role=\"hg-ext\">acl</literal>&emdash;access control for parts of a "
11103 "repository"
11104 msgstr "<literal role=\"hg-ext\">acl</literal>&emdash;版本库的访问控制"
11106 #. type: Content of: <book><chapter><sect1><sect2><para>
11107 #: ../en/ch10-hook.xml:720
11108 msgid ""
11109 "The <literal role=\"hg-ext\">acl</literal> extension lets you control which "
11110 "remote users are allowed to push changesets to a networked server. You can "
11111 "protect any portion of a repository (including the entire repo), so that a "
11112 "specific remote user can push changes that do not affect the protected "
11113 "portion."
11114 msgstr ""
11116 #. type: Content of: <book><chapter><sect1><sect2><para>
11117 #: ../en/ch10-hook.xml:728
11118 msgid ""
11119 "This extension implements access control based on the identity of the user "
11120 "performing a push, <emphasis>not</emphasis> on who committed the changesets "
11121 "they're pushing. It makes sense to use this hook only if you have a locked-"
11122 "down server environment that authenticates remote users, and you want to be "
11123 "sure that only specific users are allowed to push changes to that server."
11124 msgstr ""
11126 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
11127 #: ../en/ch10-hook.xml:738
11128 msgid "Configuring the <literal role=\"hook\">acl</literal> hook"
11129 msgstr "配置 <literal role=\"hook\">acl</literal> 钩子"
11131 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11132 #: ../en/ch10-hook.xml:741
11133 msgid ""
11134 "In order to manage incoming changesets, the <literal role=\"hg-ext\">acl</"
11135 "literal> hook must be used as a <literal role=\"hook\">pretxnchangegroup</"
11136 "literal> hook. This lets it see which files are modified by each incoming "
11137 "changeset, and roll back a group of changesets if they modify "
11138 "<quote>forbidden</quote> files. Example:"
11139 msgstr ""
11141 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11142 #: ../en/ch10-hook.xml:751
11143 msgid ""
11144 "The <literal role=\"hg-ext\">acl</literal> extension is configured using "
11145 "three sections."
11146 msgstr ""
11148 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11149 #: ../en/ch10-hook.xml:755
11150 msgid ""
11151 "The <literal role=\"rc-acl\">acl</literal> section has only one entry, <envar "
11152 "role=\"rc-item-acl\">sources</envar>, which lists the sources of incoming "
11153 "changesets that the hook should pay attention to. You don't normally need to "
11154 "configure this section."
11155 msgstr ""
11157 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11158 #: ../en/ch10-hook.xml:762
11159 msgid ""
11160 "<envar role=\"rc-item-acl\">serve</envar>: Control incoming changesets that "
11161 "are arriving from a remote repository over http or ssh. This is the default "
11162 "value of <envar role=\"rc-item-acl\">sources</envar>, and usually the only "
11163 "setting you'll need for this configuration item."
11164 msgstr ""
11166 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11167 #: ../en/ch10-hook.xml:770
11168 msgid ""
11169 "<envar role=\"rc-item-acl\">pull</envar>: Control incoming changesets that "
11170 "are arriving via a pull from a local repository."
11171 msgstr ""
11173 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11174 #: ../en/ch10-hook.xml:775
11175 msgid ""
11176 "<envar role=\"rc-item-acl\">push</envar>: Control incoming changesets that "
11177 "are arriving via a push from a local repository."
11178 msgstr ""
11180 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11181 #: ../en/ch10-hook.xml:780
11182 msgid ""
11183 "<envar role=\"rc-item-acl\">bundle</envar>: Control incoming changesets that "
11184 "are arriving from another repository via a bundle."
11185 msgstr ""
11187 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11188 #: ../en/ch10-hook.xml:786
11189 msgid ""
11190 "The <literal role=\"rc-acl.allow\">acl.allow</literal> section controls the "
11191 "users that are allowed to add changesets to the repository. If this section "
11192 "is not present, all users that are not explicitly denied are allowed. If "
11193 "this section is present, all users that are not explicitly allowed are denied "
11194 "(so an empty section means that all users are denied)."
11195 msgstr ""
11197 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11198 #: ../en/ch10-hook.xml:795
11199 msgid ""
11200 "The <literal role=\"rc-acl.deny\">acl.deny</literal> section determines which "
11201 "users are denied from adding changesets to the repository. If this section "
11202 "is not present or is empty, no users are denied."
11203 msgstr ""
11205 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11206 #: ../en/ch10-hook.xml:801
11207 msgid ""
11208 "The syntaxes for the <literal role=\"rc-acl.allow\">acl.allow</literal> and "
11209 "<literal role=\"rc-acl.deny\">acl.deny</literal> sections are identical. On "
11210 "the left of each entry is a glob pattern that matches files or directories, "
11211 "relative to the root of the repository; on the right, a user name."
11212 msgstr ""
11214 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11215 #: ../en/ch10-hook.xml:809
11216 msgid ""
11217 "In the following example, the user <literal>docwriter</literal> can only push "
11218 "changes to the <filename class=\"directory\">docs</filename> subtree of the "
11219 "repository, while <literal>intern</literal> can push changes to any file or "
11220 "directory except <filename class=\"directory\">source/sensitive</filename>."
11221 msgstr ""
11223 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
11224 #: ../en/ch10-hook.xml:821 ../en/ch10-hook.xml:1095 ../en/ch10-hook.xml:1308
11225 msgid "Testing and troubleshooting"
11226 msgstr "测试与问题处理"
11228 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11229 #: ../en/ch10-hook.xml:823
11230 msgid ""
11231 "If you want to test the <literal role=\"hg-ext\">acl</literal> hook, run it "
11232 "with Mercurial's debugging output enabled. Since you'll probably be running "
11233 "it on a server where it's not convenient (or sometimes possible) to pass in "
11234 "the <option role=\"hg-opt-global\">--debug</option> option, don't forget that "
11235 "you can enable debugging output in your <filename role=\"special\"> /.hgrc</"
11236 "filename>:"
11237 msgstr ""
11239 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11240 #: ../en/ch10-hook.xml:833
11241 msgid ""
11242 "With this enabled, the <literal role=\"hg-ext\">acl</literal> hook will print "
11243 "enough information to let you figure out why it is allowing or forbidding "
11244 "pushes from specific users."
11245 msgstr ""
11247 #. type: Content of: <book><chapter><sect1><sect2><title>
11248 #: ../en/ch10-hook.xml:842
11249 msgid ""
11250 "<literal role=\"hg-ext\">bugzilla</literal>&emdash;integration with Bugzilla"
11251 msgstr "<literal role=\"hg-ext\">bugzilla</literal>&emdash;与 Bugzilla 的集成"
11253 #. type: Content of: <book><chapter><sect1><sect2><para>
11254 #: ../en/ch10-hook.xml:846
11255 msgid ""
11256 "The <literal role=\"hg-ext\">bugzilla</literal> extension adds a comment to a "
11257 "Bugzilla bug whenever it finds a reference to that bug ID in a commit "
11258 "comment. You can install this hook on a shared server, so that any time a "
11259 "remote user pushes changes to this server, the hook gets run."
11260 msgstr ""
11262 #. type: Content of: <book><chapter><sect1><sect2><para>
11263 #: ../en/ch10-hook.xml:853
11264 msgid ""
11265 "It adds a comment to the bug that looks like this (you can configure the "
11266 "contents of the comment&emdash;see below):"
11267 msgstr ""
11269 #. type: Content of: <book><chapter><sect1><sect2><para>
11270 #: ../en/ch10-hook.xml:862
11271 msgid ""
11272 "The value of this hook is that it automates the process of updating a bug any "
11273 "time a changeset refers to it. If you configure the hook properly, it makes "
11274 "it easy for people to browse straight from a Bugzilla bug to a changeset that "
11275 "refers to that bug."
11276 msgstr ""
11278 #. type: Content of: <book><chapter><sect1><sect2><para>
11279 #: ../en/ch10-hook.xml:869
11280 msgid ""
11281 "You can use the code in this hook as a starting point for some more exotic "
11282 "Bugzilla integration recipes. Here are a few possibilities:"
11283 msgstr ""
11285 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
11286 #: ../en/ch10-hook.xml:874
11287 msgid ""
11288 "Require that every changeset pushed to the server have a valid bug ID in its "
11289 "commit comment. In this case, you'd want to configure the hook as a <literal "
11290 "role=\"hook\">pretxncommit</literal> hook. This would allow the hook to "
11291 "reject changes that didn't contain bug IDs."
11292 msgstr ""
11294 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
11295 #: ../en/ch10-hook.xml:882
11296 msgid ""
11297 "Allow incoming changesets to automatically modify the <emphasis>state</"
11298 "emphasis> of a bug, as well as simply adding a comment. For example, the "
11299 "hook could recognise the string <quote>fixed bug 31337</quote> as indicating "
11300 "that it should update the state of bug 31337 to <quote>requires testing</"
11301 "quote>."
11302 msgstr ""
11304 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
11305 #: ../en/ch10-hook.xml:892
11306 msgid "Configuring the <literal role=\"hook\">bugzilla</literal> hook"
11307 msgstr "配置 <literal role=\"hook\">bugzilla</literal> 钩子"
11309 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11310 #: ../en/ch10-hook.xml:895
11311 msgid ""
11312 "You should configure this hook in your server's <filename role=\"special\"> /."
11313 "hgrc</filename>\\ as an <literal role=\"hook\">incoming</literal> hook, for "
11314 "example as follows:"
11315 msgstr ""
11317 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11318 #: ../en/ch10-hook.xml:903
11319 msgid ""
11320 "Because of the specialised nature of this hook, and because Bugzilla was not "
11321 "written with this kind of integration in mind, configuring this hook is a "
11322 "somewhat involved process."
11323 msgstr ""
11325 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11326 #: ../en/ch10-hook.xml:909
11327 msgid ""
11328 "Before you begin, you must install the MySQL bindings for Python on the host"
11329 "(s) where you'll be running the hook. If this is not available as a binary "
11330 "package for your system, you can download it from <citation>web:mysql-python</"
11331 "citation>."
11332 msgstr ""
11334 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11335 #: ../en/ch10-hook.xml:916
11336 msgid ""
11337 "Configuration information for this hook lives in the <literal role=\"rc-"
11338 "bugzilla\">bugzilla</literal> section of your <filename role=\"special\"> /."
11339 "hgrc</filename>."
11340 msgstr ""
11342 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11343 #: ../en/ch10-hook.xml:921
11344 msgid ""
11345 "<envar role=\"rc-item-bugzilla\">version</envar>: The version of Bugzilla "
11346 "installed on the server. The database schema that Bugzilla uses changes "
11347 "occasionally, so this hook has to know exactly which schema to use. At the "
11348 "moment, the only version supported is <literal>2.16</literal>."
11349 msgstr ""
11351 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11352 #: ../en/ch10-hook.xml:930
11353 msgid ""
11354 "<envar role=\"rc-item-bugzilla\">host</envar>: The hostname of the MySQL "
11355 "server that stores your Bugzilla data. The database must be configured to "
11356 "allow connections from whatever host you are running the <literal role=\"hook"
11357 "\">bugzilla</literal> hook on."
11358 msgstr ""
11360 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11361 #: ../en/ch10-hook.xml:937
11362 msgid ""
11363 "<envar role=\"rc-item-bugzilla\">user</envar>: The username with which to "
11364 "connect to the MySQL server. The database must be configured to allow this "
11365 "user to connect from whatever host you are running the <literal role=\"hook"
11366 "\">bugzilla</literal> hook on. This user must be able to access and modify "
11367 "Bugzilla tables. The default value of this item is <literal>bugs</literal>, "
11368 "which is the standard name of the Bugzilla user in a MySQL database."
11369 msgstr ""
11371 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11372 #: ../en/ch10-hook.xml:948
11373 msgid ""
11374 "<envar role=\"rc-item-bugzilla\">password</envar>: The MySQL password for the "
11375 "user you configured above. This is stored as plain text, so you should make "
11376 "sure that unauthorised users cannot read the <filename role=\"special\"> /."
11377 "hgrc</filename>\\ file where you store this information."
11378 msgstr ""
11380 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11381 #: ../en/ch10-hook.xml:957
11382 msgid ""
11383 "<envar role=\"rc-item-bugzilla\">db</envar>: The name of the Bugzilla "
11384 "database on the MySQL server. The default value of this item is "
11385 "<literal>bugs</literal>, which is the standard name of the MySQL database "
11386 "where Bugzilla stores its data."
11387 msgstr ""
11389 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11390 #: ../en/ch10-hook.xml:964
11391 msgid ""
11392 "<envar role=\"rc-item-bugzilla\">notify</envar>: If you want Bugzilla to send "
11393 "out a notification email to subscribers after this hook has added a comment "
11394 "to a bug, you will need this hook to run a command whenever it updates the "
11395 "database. The command to run depends on where you have installed Bugzilla, "
11396 "but it will typically look something like this, if you have Bugzilla "
11397 "installed in <filename class=\"directory\">/var/www/html/bugzilla</filename>:"
11398 msgstr ""
11400 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11401 #: ../en/ch10-hook.xml:977
11402 msgid ""
11403 "The Bugzilla <literal>processmail</literal> program expects to be given a bug "
11404 "ID (the hook replaces <quote><literal>%s</literal></quote> with the bug ID) "
11405 "and an email address. It also expects to be able to write to some files in "
11406 "the directory that it runs in. If Bugzilla and this hook are not installed "
11407 "on the same machine, you will need to find a way to run <literal>processmail</"
11408 "literal> on the server where Bugzilla is installed."
11409 msgstr ""
11411 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
11412 #: ../en/ch10-hook.xml:992
11413 msgid "Mapping committer names to Bugzilla user names"
11414 msgstr "提交者的名称与 Bugzilla 用户名称的映射"
11416 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11417 #: ../en/ch10-hook.xml:994
11418 msgid ""
11419 "By default, the <literal role=\"hg-ext\">bugzilla</literal> hook tries to use "
11420 "the email address of a changeset's committer as the Bugzilla user name with "
11421 "which to update a bug. If this does not suit your needs, you can map "
11422 "committer email addresses to Bugzilla user names using a <literal role=\"rc-"
11423 "usermap\">usermap</literal> section."
11424 msgstr ""
11426 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11427 #: ../en/ch10-hook.xml:1003
11428 msgid ""
11429 "Each item in the <literal role=\"rc-usermap\">usermap</literal> section "
11430 "contains an email address on the left, and a Bugzilla user name on the right."
11431 msgstr ""
11433 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11434 #: ../en/ch10-hook.xml:1010
11435 msgid ""
11436 "You can either keep the <literal role=\"rc-usermap\">usermap</literal> data "
11437 "in a normal <filename role=\"special\">~/.hgrc</filename>, or tell the "
11438 "<literal role=\"hg-ext\">bugzilla</literal> hook to read the information from "
11439 "an external <filename>usermap</filename> file. In the latter case, you can "
11440 "store <filename>usermap</filename> data by itself in (for example) a user-"
11441 "modifiable repository. This makes it possible to let your users maintain "
11442 "their own <envar role=\"rc-item-bugzilla\">usermap</envar> entries. The main "
11443 "<filename role=\"special\"> /.hgrc</filename>\\ file might look like this:"
11444 msgstr ""
11446 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11447 #: ../en/ch10-hook.xml:1026
11448 msgid ""
11449 "While the <filename>usermap</filename> file that it refers to might look like "
11450 "this:"
11451 msgstr ""
11453 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
11454 #: ../en/ch10-hook.xml:1035
11455 msgid "Configuring the text that gets added to a bug"
11456 msgstr "配置增加到问题中的正文"
11458 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11459 #: ../en/ch10-hook.xml:1037
11460 msgid ""
11461 "You can configure the text that this hook adds as a comment; you specify it "
11462 "in the form of a Mercurial template. Several <filename role=\"special\"> /."
11463 "hgrc</filename>\\ entries (still in the <literal role=\"rc-bugzilla"
11464 "\">bugzilla</literal> section) control this behaviour."
11465 msgstr ""
11467 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11468 #: ../en/ch10-hook.xml:1044
11469 msgid ""
11470 "<literal>strip</literal>: The number of leading path elements to strip from a "
11471 "repository's path name to construct a partial path for a URL. For example, if "
11472 "the repositories on your server live under <filename class=\"directory\">/"
11473 "home/hg/repos</filename>, and you have a repository whose path is <filename "
11474 "class=\"directory\">/home/hg/repos/app/tests</filename>, then setting "
11475 "<literal>strip</literal> to <literal>4</literal> will give a partial path of "
11476 "<filename class=\"directory\">app/tests</filename>. The hook will make this "
11477 "partial path available when expanding a template, as <literal>webroot</"
11478 "literal>."
11479 msgstr ""
11481 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11482 #: ../en/ch10-hook.xml:1058
11483 msgid ""
11484 "<literal>template</literal>: The text of the template to use. In addition to "
11485 "the usual changeset-related variables, this template can use <literal>hgweb</"
11486 "literal> (the value of the <literal>hgweb</literal> configuration item above) "
11487 "and <literal>webroot</literal> (the path constructed using <literal>strip</"
11488 "literal> above)."
11489 msgstr ""
11491 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11492 #: ../en/ch10-hook.xml:1068
11493 msgid ""
11494 "In addition, you can add a <envar role=\"rc-item-web\">baseurl</envar> item "
11495 "to the <literal role=\"rc-web\">web</literal> section of your <filename role="
11496 "\"special\"> /.hgrc</filename>. The <literal role=\"hg-ext\">bugzilla</"
11497 "literal> hook will make this available when expanding a template, as the base "
11498 "string to use when constructing a URL that will let users browse from a "
11499 "Bugzilla comment to view a changeset. Example:"
11500 msgstr ""
11502 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11503 #: ../en/ch10-hook.xml:1080
11504 msgid ""
11505 "Here is an example set of <literal role=\"hg-ext\">bugzilla</literal> hook "
11506 "config information."
11507 msgstr ""
11509 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11510 #: ../en/ch10-hook.xml:1097
11511 msgid ""
11512 "The most common problems with configuring the <literal role=\"hg-ext"
11513 "\">bugzilla</literal> hook relate to running Bugzilla's "
11514 "<filename>processmail</filename> script and mapping committer names to user "
11515 "names."
11516 msgstr ""
11518 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11519 #: ../en/ch10-hook.xml:1103
11520 msgid ""
11521 "Recall from section <xref linkend=\"sec.hook.bugzilla.config\"/> above that "
11522 "the user that runs the Mercurial process on the server is also the one that "
11523 "will run the <filename>processmail</filename> script. The "
11524 "<filename>processmail</filename> script sometimes causes Bugzilla to write to "
11525 "files in its configuration directory, and Bugzilla's configuration files are "
11526 "usually owned by the user that your web server runs under."
11527 msgstr ""
11529 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11530 #: ../en/ch10-hook.xml:1114
11531 msgid ""
11532 "You can cause <filename>processmail</filename> to be run with the suitable "
11533 "user's identity using the <command>sudo</command> command. Here is an "
11534 "example entry for a <filename>sudoers</filename> file."
11535 msgstr ""
11537 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11538 #: ../en/ch10-hook.xml:1122
11539 msgid ""
11540 "This allows the <literal>hg_user</literal> user to run a "
11541 "<filename>processmail-wrapper</filename> program under the identity of "
11542 "<literal>httpd_user</literal>."
11543 msgstr ""
11545 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11546 #: ../en/ch10-hook.xml:1127
11547 msgid ""
11548 "This indirection through a wrapper script is necessary, because "
11549 "<filename>processmail</filename> expects to be run with its current directory "
11550 "set to wherever you installed Bugzilla; you can't specify that kind of "
11551 "constraint in a <filename>sudoers</filename> file. The contents of the "
11552 "wrapper script are simple:"
11553 msgstr ""
11555 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11556 #: ../en/ch10-hook.xml:1136
11557 msgid ""
11558 "It doesn't seem to matter what email address you pass to "
11559 "<filename>processmail</filename>."
11560 msgstr ""
11562 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11563 #: ../en/ch10-hook.xml:1140
11564 msgid ""
11565 "If your <literal role=\"rc-usermap\">usermap</literal> is not set up "
11566 "correctly, users will see an error message from the <literal role=\"hg-ext"
11567 "\">bugzilla</literal> hook when they push changes to the server. The error "
11568 "message will look like this:"
11569 msgstr ""
11571 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11572 #: ../en/ch10-hook.xml:1148
11573 msgid ""
11574 "What this means is that the committer's address, <literal>john.q."
11575 "public@example.com</literal>, is not a valid Bugzilla user name, nor does it "
11576 "have an entry in your <literal role=\"rc-usermap\">usermap</literal> that "
11577 "maps it to a valid Bugzilla user name."
11578 msgstr ""
11580 #. type: Content of: <book><chapter><sect1><sect2><title>
11581 #: ../en/ch10-hook.xml:1158
11582 msgid ""
11583 "<literal role=\"hg-ext\">notify</literal>&emdash;send email notifications"
11584 msgstr "<literal role=\"hg-ext\">notify</literal>&emdash;邮件通知"
11586 #. type: Content of: <book><chapter><sect1><sect2><para>
11587 #: ../en/ch10-hook.xml:1161
11588 msgid ""
11589 "Although Mercurial's built-in web server provides RSS feeds of changes in "
11590 "every repository, many people prefer to receive change notifications via "
11591 "email. The <literal role=\"hg-ext\">notify</literal> hook lets you send out "
11592 "notifications to a set of email addresses whenever changesets arrive that "
11593 "those subscribers are interested in."
11594 msgstr ""
11596 #. type: Content of: <book><chapter><sect1><sect2><para>
11597 #: ../en/ch10-hook.xml:1169
11598 msgid ""
11599 "As with the <literal role=\"hg-ext\">bugzilla</literal> hook, the <literal "
11600 "role=\"hg-ext\">notify</literal> hook is template-driven, so you can "
11601 "customise the contents of the notification messages that it sends."
11602 msgstr ""
11604 #. type: Content of: <book><chapter><sect1><sect2><para>
11605 #: ../en/ch10-hook.xml:1175
11606 msgid ""
11607 "By default, the <literal role=\"hg-ext\">notify</literal> hook includes a "
11608 "diff of every changeset that it sends out; you can limit the size of the "
11609 "diff, or turn this feature off entirely. It is useful for letting "
11610 "subscribers review changes immediately, rather than clicking to follow a URL."
11611 msgstr ""
11613 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
11614 #: ../en/ch10-hook.xml:1183
11615 msgid "Configuring the <literal role=\"hg-ext\">notify</literal> hook"
11616 msgstr "配置 <literal role=\"hg-ext\">notify</literal> 钩子"
11618 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11619 #: ../en/ch10-hook.xml:1186
11620 msgid ""
11621 "You can set up the <literal role=\"hg-ext\">notify</literal> hook to send one "
11622 "email message per incoming changeset, or one per incoming group of changesets "
11623 "(all those that arrived in a single pull or push)."
11624 msgstr ""
11626 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11627 #: ../en/ch10-hook.xml:1197
11628 msgid ""
11629 "Configuration information for this hook lives in the <literal role=\"rc-notify"
11630 "\">notify</literal> section of a <filename role=\"special\"> /.hgrc</filename>"
11631 "\\ file."
11632 msgstr ""
11634 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11635 #: ../en/ch10-hook.xml:1202
11636 msgid ""
11637 "<envar role=\"rc-item-notify\">test</envar>: By default, this hook does not "
11638 "send out email at all; instead, it prints the message that it "
11639 "<emphasis>would</emphasis> send. Set this item to <literal>false</literal> "
11640 "to allow email to be sent. The reason that sending of email is turned off by "
11641 "default is that it takes several tries to configure this extension exactly as "
11642 "you would like, and it would be bad form to spam subscribers with a number of "
11643 "<quote>broken</quote> notifications while you debug your configuration."
11644 msgstr ""
11646 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11647 #: ../en/ch10-hook.xml:1214
11648 msgid ""
11649 "<envar role=\"rc-item-notify\">config</envar>: The path to a configuration "
11650 "file that contains subscription information. This is kept separate from the "
11651 "main <filename role=\"special\"> /.hgrc</filename>\\ so that you can maintain "
11652 "it in a repository of its own. People can then clone that repository, update "
11653 "their subscriptions, and push the changes back to your server."
11654 msgstr ""
11656 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11657 #: ../en/ch10-hook.xml:1223
11658 msgid ""
11659 "<envar role=\"rc-item-notify\">strip</envar>: The number of leading path "
11660 "separator characters to strip from a repository's path, when deciding whether "
11661 "a repository has subscribers. For example, if the repositories on your "
11662 "server live in <filename class=\"directory\">/home/hg/repos</filename>, and "
11663 "<literal role=\"hg-ext\">notify</literal> is considering a repository named "
11664 "<filename class=\"directory\">/home/hg/repos/shared/test</filename>, setting "
11665 "<envar role=\"rc-item-notify\">strip</envar> to <literal>4</literal> will "
11666 "cause <literal role=\"hg-ext\">notify</literal> to trim the path it considers "
11667 "down to <filename class=\"directory\">shared/test</filename>, and it will "
11668 "match subscribers against that."
11669 msgstr ""
11671 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11672 #: ../en/ch10-hook.xml:1240
11673 msgid ""
11674 "<envar role=\"rc-item-notify\">template</envar>: The template text to use "
11675 "when sending messages. This specifies both the contents of the message "
11676 "header and its body."
11677 msgstr ""
11679 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11680 #: ../en/ch10-hook.xml:1246
11681 msgid ""
11682 "<envar role=\"rc-item-notify\">maxdiff</envar>: The maximum number of lines "
11683 "of diff data to append to the end of a message. If a diff is longer than "
11684 "this, it is truncated. By default, this is set to 300. Set this to "
11685 "<literal>0</literal> to omit diffs from notification emails."
11686 msgstr ""
11688 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11689 #: ../en/ch10-hook.xml:1255
11690 msgid ""
11691 "<envar role=\"rc-item-notify\">sources</envar>: A list of sources of "
11692 "changesets to consider. This lets you limit <literal role=\"hg-ext\">notify</"
11693 "literal> to only sending out email about changes that remote users pushed "
11694 "into this repository via a server, for example. See section <xref linkend="
11695 "\"sec.hook.sources\"/> for the sources you can specify here."
11696 msgstr ""
11698 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11699 #: ../en/ch10-hook.xml:1267
11700 msgid ""
11701 "If you set the <envar role=\"rc-item-web\">baseurl</envar> item in the "
11702 "<literal role=\"rc-web\">web</literal> section, you can use it in a template; "
11703 "it will be available as <literal>webroot</literal>."
11704 msgstr ""
11706 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11707 #: ../en/ch10-hook.xml:1273
11708 msgid ""
11709 "Here is an example set of <literal role=\"hg-ext\">notify</literal> "
11710 "configuration information."
11711 msgstr ""
11713 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11714 #: ../en/ch10-hook.xml:1289
11715 msgid "This will produce a message that looks like the following:"
11716 msgstr ""
11718 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11719 #: ../en/ch10-hook.xml:1310
11720 msgid ""
11721 "Do not forget that by default, the <literal role=\"hg-ext\">notify</literal> "
11722 "extension <emphasis>will not send any mail</emphasis> until you explicitly "
11723 "configure it to do so, by setting <envar role=\"rc-item-notify\">test</envar> "
11724 "to <literal>false</literal>. Until you do that, it simply prints the message "
11725 "it <emphasis>would</emphasis> send."
11726 msgstr ""
11728 #. type: Content of: <book><chapter><sect1><title>
11729 #: ../en/ch10-hook.xml:1322
11730 msgid "Information for writers of hooks"
11731 msgstr "编写钩子的信息"
11733 #. type: Content of: <book><chapter><sect1><sect2><title>
11734 #: ../en/ch10-hook.xml:1325
11735 msgid "In-process hook execution"
11736 msgstr "进程内钩子的执行"
11738 #. type: Content of: <book><chapter><sect1><sect2><para>
11739 #: ../en/ch10-hook.xml:1327
11740 msgid "An in-process hook is called with arguments of the following form:"
11741 msgstr ""
11743 #. type: Content of: <book><chapter><sect1><sect2><para>
11744 #: ../en/ch10-hook.xml:1333
11745 msgid ""
11746 "The <literal>ui</literal> parameter is a <literal role=\"py-mod-mercurial.ui"
11747 "\">ui</literal> object. The <literal>repo</literal> parameter is a <literal "
11748 "role=\"py-mod-mercurial.localrepo\">localrepository</literal> object. The "
11749 "names and values of the <literal>**kwargs</literal> parameters depend on the "
11750 "hook being invoked, with the following common features:"
11751 msgstr ""
11753 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
11754 #: ../en/ch10-hook.xml:1342
11755 msgid ""
11756 "If a parameter is named <literal>node</literal> or <literal>parentN</"
11757 "literal>, it will contain a hexadecimal changeset ID. The empty string is "
11758 "used to represent <quote>null changeset ID</quote> instead of a string of "
11759 "zeroes."
11760 msgstr ""
11762 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
11763 #: ../en/ch10-hook.xml:1349
11764 msgid ""
11765 "If a parameter is named <literal>url</literal>, it will contain the URL of a "
11766 "remote repository, if that can be determined."
11767 msgstr ""
11769 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
11770 #: ../en/ch10-hook.xml:1354
11771 msgid ""
11772 "Boolean-valued parameters are represented as Python <literal>bool</literal> "
11773 "objects."
11774 msgstr ""
11776 #. type: Content of: <book><chapter><sect1><sect2><para>
11777 #: ../en/ch10-hook.xml:1359
11778 msgid ""
11779 "An in-process hook is called without a change to the process's working "
11780 "directory (unlike external hooks, which are run in the root of the "
11781 "repository). It must not change the process's working directory, or it will "
11782 "cause any calls it makes into the Mercurial API to fail."
11783 msgstr ""
11785 #. type: Content of: <book><chapter><sect1><sect2><para>
11786 #: ../en/ch10-hook.xml:1366
11787 msgid ""
11788 "If a hook returns a boolean <quote>false</quote> value, it is considered to "
11789 "have succeeded. If it returns a boolean <quote>true</quote> value or raises "
11790 "an exception, it is considered to have failed. A useful way to think of the "
11791 "calling convention is <quote>tell me if you fail</quote>."
11792 msgstr ""
11794 #. type: Content of: <book><chapter><sect1><sect2><para>
11795 #: ../en/ch10-hook.xml:1373
11796 msgid ""
11797 "Note that changeset IDs are passed into Python hooks as hexadecimal strings, "
11798 "not the binary hashes that Mercurial's APIs normally use. To convert a hash "
11799 "from hex to binary, use the \\pymodfunc{mercurial.node}{bin} function."
11800 msgstr ""
11802 #. type: Content of: <book><chapter><sect1><sect2><title>
11803 #: ../en/ch10-hook.xml:1381
11804 msgid "External hook execution"
11805 msgstr "外部钩子的执行"
11807 #. type: Content of: <book><chapter><sect1><sect2><para>
11808 #: ../en/ch10-hook.xml:1383
11809 msgid ""
11810 "An external hook is passed to the shell of the user running Mercurial. "
11811 "Features of that shell, such as variable substitution and command "
11812 "redirection, are available. The hook is run in the root directory of the "
11813 "repository (unlike in-process hooks, which are run in the same directory that "
11814 "Mercurial was run in)."
11815 msgstr ""
11817 #. type: Content of: <book><chapter><sect1><sect2><para>
11818 #: ../en/ch10-hook.xml:1391
11819 msgid ""
11820 "Hook parameters are passed to the hook as environment variables. Each "
11821 "environment variable's name is converted in upper case and prefixed with the "
11822 "string <quote><literal>HG_</literal></quote>. For example, if the name of a "
11823 "parameter is <quote><literal>node</literal></quote>, the name of the "
11824 "environment variable representing that parameter will be "
11825 "<quote><literal>HG_NODE</literal></quote>."
11826 msgstr ""
11828 #. type: Content of: <book><chapter><sect1><sect2><para>
11829 #: ../en/ch10-hook.xml:1400
11830 msgid ""
11831 "A boolean parameter is represented as the string <quote><literal>1</literal></"
11832 "quote> for <quote>true</quote>, <quote><literal>0</literal></quote> for "
11833 "<quote>false</quote>. If an environment variable is named <envar>HG_NODE</"
11834 "envar>, <envar>HG_PARENT1</envar> or <envar>HG_PARENT2</envar>, it contains a "
11835 "changeset ID represented as a hexadecimal string. The empty string is used "
11836 "to represent <quote>null changeset ID</quote> instead of a string of zeroes. "
11837 "If an environment variable is named <envar>HG_URL</envar>, it will contain "
11838 "the URL of a remote repository, if that can be determined."
11839 msgstr ""
11841 #. type: Content of: <book><chapter><sect1><sect2><para>
11842 #: ../en/ch10-hook.xml:1412
11843 msgid ""
11844 "If a hook exits with a status of zero, it is considered to have succeeded. "
11845 "If it exits with a non-zero status, it is considered to have failed."
11846 msgstr ""
11848 #. type: Content of: <book><chapter><sect1><sect2><title>
11849 #: ../en/ch10-hook.xml:1419
11850 msgid "Finding out where changesets come from"
11851 msgstr "检查修改集来自何处"
11853 #. type: Content of: <book><chapter><sect1><sect2><para>
11854 #: ../en/ch10-hook.xml:1421
11855 msgid ""
11856 "A hook that involves the transfer of changesets between a local repository "
11857 "and another may be able to find out information about the <quote>far side</"
11858 "quote>. Mercurial knows <emphasis>how</emphasis> changes are being "
11859 "transferred, and in many cases <emphasis>where</emphasis> they are being "
11860 "transferred to or from."
11861 msgstr ""
11863 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
11864 #: ../en/ch10-hook.xml:1430
11865 msgid "Sources of changesets"
11866 msgstr "修改集的来源"
11868 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11869 #: ../en/ch10-hook.xml:1432
11870 msgid ""
11871 "Mercurial will tell a hook what means are, or were, used to transfer "
11872 "changesets between repositories. This is provided by Mercurial in a Python "
11873 "parameter named <literal>source</literal>, or an environment variable named "
11874 "<envar>HG_SOURCE</envar>."
11875 msgstr ""
11877 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11878 #: ../en/ch10-hook.xml:1440
11879 msgid ""
11880 "<literal>serve</literal>: Changesets are transferred to or from a remote "
11881 "repository over http or ssh."
11882 msgstr ""
11884 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11885 #: ../en/ch10-hook.xml:1445
11886 msgid ""
11887 "<literal>pull</literal>: Changesets are being transferred via a pull from one "
11888 "repository into another."
11889 msgstr ""
11891 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11892 #: ../en/ch10-hook.xml:1450
11893 msgid ""
11894 "<literal>push</literal>: Changesets are being transferred via a push from one "
11895 "repository into another."
11896 msgstr ""
11898 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11899 #: ../en/ch10-hook.xml:1455
11900 msgid ""
11901 "<literal>bundle</literal>: Changesets are being transferred to or from a "
11902 "bundle."
11903 msgstr ""
11905 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
11906 #: ../en/ch10-hook.xml:1462
11907 msgid "Where changes are going&emdash;remote repository URLs"
11908 msgstr "修改集要到哪里&emdash;远程版本库的地址"
11910 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11911 #: ../en/ch10-hook.xml:1465
11912 msgid ""
11913 "When possible, Mercurial will tell a hook the location of the <quote>far "
11914 "side</quote> of an activity that transfers changeset data between "
11915 "repositories. This is provided by Mercurial in a Python parameter named "
11916 "<literal>url</literal>, or an environment variable named <envar>HG_URL</"
11917 "envar>."
11918 msgstr ""
11920 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
11921 #: ../en/ch10-hook.xml:1473
11922 msgid ""
11923 "This information is not always known. If a hook is invoked in a repository "
11924 "that is being served via http or ssh, Mercurial cannot tell where the remote "
11925 "repository is, but it may know where the client is connecting from. In such "
11926 "cases, the URL will take one of the following forms:"
11927 msgstr ""
11929 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11930 #: ../en/ch10-hook.xml:1480
11931 msgid ""
11932 "<literal>remote:ssh:1.2.3.4</literal>&emdash;remote ssh client, at the IP "
11933 "address <literal>1.2.3.4</literal>."
11934 msgstr ""
11936 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11937 #: ../en/ch10-hook.xml:1485
11938 msgid ""
11939 "<literal>remote:http:1.2.3.4</literal>&emdash;remote http client, at the IP "
11940 "address <literal>1.2.3.4</literal>. If the client is using SSL, this will be "
11941 "of the form <literal>remote:https:1.2.3.4</literal>."
11942 msgstr ""
11944 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
11945 #: ../en/ch10-hook.xml:1492
11946 msgid "Empty&emdash;no information could be discovered about the remote client."
11947 msgstr ""
11949 #. type: Content of: <book><chapter><sect1><title>
11950 #: ../en/ch10-hook.xml:1501
11951 msgid "Hook reference"
11952 msgstr "钩子参考"
11954 #. type: Content of: <book><chapter><sect1><sect2><title>
11955 #: ../en/ch10-hook.xml:1504
11956 msgid ""
11957 "<literal role=\"hook\">changegroup</literal>&emdash;after remote changesets "
11958 "added"
11959 msgstr "<literal role=\"hook\">changegroup</literal>&emdash;增加远程修改集之后"
11961 #. type: Content of: <book><chapter><sect1><sect2><para>
11962 #: ../en/ch10-hook.xml:1507
11963 msgid ""
11964 "This hook is run after a group of pre-existing changesets has been added to "
11965 "the repository, for example via a <command role=\"hg-cmd\">hg pull</command> "
11966 "or <command role=\"hg-cmd\">hg unbundle</command>. This hook is run once per "
11967 "operation that added one or more changesets. This is in contrast to the "
11968 "<literal role=\"hook\">incoming</literal> hook, which is run once per "
11969 "changeset, regardless of whether the changesets arrive in a group."
11970 msgstr ""
11972 #. type: Content of: <book><chapter><sect1><sect2><para>
11973 #: ../en/ch10-hook.xml:1517
11974 msgid ""
11975 "Some possible uses for this hook include kicking off an automated build or "
11976 "test of the added changesets, updating a bug database, or notifying "
11977 "subscribers that a repository contains new changes."
11978 msgstr ""
11980 #. type: Content of: <book><chapter><sect1><sect2><para>
11981 #: ../en/ch10-hook.xml:1523 ../en/ch10-hook.xml:1564 ../en/ch10-hook.xml:1607
11982 #: ../en/ch10-hook.xml:1649 ../en/ch10-hook.xml:1704 ../en/ch10-hook.xml:1744
11983 #: ../en/ch10-hook.xml:1780 ../en/ch10-hook.xml:1815 ../en/ch10-hook.xml:1877
11984 #: ../en/ch10-hook.xml:1935 ../en/ch10-hook.xml:1969 ../en/ch10-hook.xml:1997
11985 msgid "Parameters to this hook:"
11986 msgstr ""
11988 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
11989 #: ../en/ch10-hook.xml:1526 ../en/ch10-hook.xml:1880
11990 msgid ""
11991 "<literal>node</literal>: A changeset ID. The changeset ID of the first "
11992 "changeset in the group that was added. All changesets between this and "
11993 "\\index{tags!<literal>tip</literal>}<literal>tip</literal>, inclusive, were "
11994 "added by a single <command role=\"hg-cmd\">hg pull</command>, <command role="
11995 "\"hg-cmd\">hg push</command> or <command role=\"hg-cmd\">hg unbundle</"
11996 "command>."
11997 msgstr ""
11999 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12000 #: ../en/ch10-hook.xml:1536 ../en/ch10-hook.xml:1614 ../en/ch10-hook.xml:1707
12001 #: ../en/ch10-hook.xml:1890
12002 msgid ""
12003 "<literal>source</literal>: A string. The source of these changes. See "
12004 "section <xref linkend=\"sec.hook.sources\"/> for details."
12005 msgstr ""
12007 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12008 #: ../en/ch10-hook.xml:1541 ../en/ch10-hook.xml:1619 ../en/ch10-hook.xml:1670
12009 #: ../en/ch10-hook.xml:1712 ../en/ch10-hook.xml:1794 ../en/ch10-hook.xml:1895
12010 msgid ""
12011 "<literal>url</literal>: A URL. The location of the remote repository, if "
12012 "known. See section <xref linkend=\"sec.hook.url\"/> for more information."
12013 msgstr ""
12015 #. type: Content of: <book><chapter><sect1><sect2><para>
12016 #: ../en/ch10-hook.xml:1548
12017 msgid ""
12018 "See also: <literal role=\"hook\">incoming</literal> (section <xref linkend="
12019 "\"sec.hook.incoming\"/>), <literal role=\"hook\">prechangegroup</literal> "
12020 "(section <xref linkend=\"sec.hook.prechangegroup\"/>), <literal role=\"hook"
12021 "\">pretxnchangegroup</literal> (section <xref linkend=\"sec.hook."
12022 "pretxnchangegroup\"/>)"
12023 msgstr ""
12025 #. type: Content of: <book><chapter><sect1><sect2><title>
12026 #: ../en/ch10-hook.xml:1558
12027 msgid ""
12028 "<literal role=\"hook\">commit</literal>&emdash;after a new changeset is "
12029 "created"
12030 msgstr "<literal role=\"hook\">commit</literal>&emdash;创建新修改集之后"
12032 #. type: Content of: <book><chapter><sect1><sect2><para>
12033 #: ../en/ch10-hook.xml:1561
12034 msgid "This hook is run after a new changeset has been created."
12035 msgstr ""
12037 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12038 #: ../en/ch10-hook.xml:1567 ../en/ch10-hook.xml:1938
12039 msgid ""
12040 "<literal>node</literal>: A changeset ID. The changeset ID of the newly "
12041 "committed changeset."
12042 msgstr ""
12044 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12045 #: ../en/ch10-hook.xml:1571 ../en/ch10-hook.xml:1942
12046 msgid ""
12047 "<literal>parent1</literal>: A changeset ID. The changeset ID of the first "
12048 "parent of the newly committed changeset."
12049 msgstr ""
12051 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12052 #: ../en/ch10-hook.xml:1576 ../en/ch10-hook.xml:1947
12053 msgid ""
12054 "<literal>parent2</literal>: A changeset ID. The changeset ID of the second "
12055 "parent of the newly committed changeset."
12056 msgstr ""
12058 #. type: Content of: <book><chapter><sect1><sect2><para>
12059 #: ../en/ch10-hook.xml:1582
12060 msgid ""
12061 "See also: <literal role=\"hook\">precommit</literal> (section <xref linkend="
12062 "\"sec.hook.precommit\"/>), <literal role=\"hook\">pretxncommit</literal> "
12063 "(section <xref linkend=\"sec.hook.pretxncommit\"/>)"
12064 msgstr ""
12066 #. type: Content of: <book><chapter><sect1><sect2><title>
12067 #: ../en/ch10-hook.xml:1590
12068 msgid ""
12069 "<literal role=\"hook\">incoming</literal>&emdash;after one remote changeset "
12070 "is added"
12071 msgstr "<literal role=\"hook\">incoming</literal>&emdash;增加远程修改集之后"
12073 #. type: Content of: <book><chapter><sect1><sect2><para>
12074 #: ../en/ch10-hook.xml:1593
12075 msgid ""
12076 "This hook is run after a pre-existing changeset has been added to the "
12077 "repository, for example via a <command role=\"hg-cmd\">hg push</command>. If "
12078 "a group of changesets was added in a single operation, this hook is called "
12079 "once for each added changeset."
12080 msgstr ""
12082 #. type: Content of: <book><chapter><sect1><sect2><para>
12083 #: ../en/ch10-hook.xml:1600
12084 msgid ""
12085 "You can use this hook for the same purposes as the <literal role=\"hook"
12086 "\">changegroup</literal> hook (section <xref linkend=\"sec.hook.changegroup\"/"
12087 ">); it's simply more convenient sometimes to run a hook once per group of "
12088 "changesets, while other times it's handier once per changeset."
12089 msgstr ""
12091 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12092 #: ../en/ch10-hook.xml:1610
12093 msgid ""
12094 "<literal>node</literal>: A changeset ID. The ID of the newly added changeset."
12095 msgstr ""
12097 #. type: Content of: <book><chapter><sect1><sect2><para>
12098 #: ../en/ch10-hook.xml:1626
12099 msgid ""
12100 "See also: <literal role=\"hook\">changegroup</literal> (section <xref linkend="
12101 "\"sec.hook.changegroup\"/>) <literal role=\"hook\">prechangegroup</literal> "
12102 "(section <xref linkend=\"sec.hook.prechangegroup\"/>), <literal role=\"hook"
12103 "\">pretxnchangegroup</literal> (section <xref linkend=\"sec.hook."
12104 "pretxnchangegroup\"/>)"
12105 msgstr ""
12107 #. type: Content of: <book><chapter><sect1><sect2><title>
12108 #: ../en/ch10-hook.xml:1636
12109 msgid ""
12110 "<literal role=\"hook\">outgoing</literal>&emdash;after changesets are "
12111 "propagated"
12112 msgstr "<literal role=\"hook\">outgoing</literal>&emdash;传播修改集之后"
12114 #. type: Content of: <book><chapter><sect1><sect2><para>
12115 #: ../en/ch10-hook.xml:1639
12116 msgid ""
12117 "This hook is run after a group of changesets has been propagated out of this "
12118 "repository, for example by a <command role=\"hg-cmd\">hg push</command> or "
12119 "<command role=\"hg-cmd\">hg bundle</command> command."
12120 msgstr ""
12122 #. type: Content of: <book><chapter><sect1><sect2><para>
12123 #: ../en/ch10-hook.xml:1645
12124 msgid ""
12125 "One possible use for this hook is to notify administrators that changes have "
12126 "been pulled."
12127 msgstr ""
12129 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12130 #: ../en/ch10-hook.xml:1652
12131 msgid ""
12132 "<literal>node</literal>: A changeset ID. The changeset ID of the first "
12133 "changeset of the group that was sent."
12134 msgstr ""
12136 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12137 #: ../en/ch10-hook.xml:1657
12138 msgid ""
12139 "<literal>source</literal>: A string. The source of the of the operation (see "
12140 "section <xref linkend=\"sec.hook.sources\"/>). If a remote client pulled "
12141 "changes from this repository, <literal>source</literal> will be "
12142 "<literal>serve</literal>. If the client that obtained changes from this "
12143 "repository was local, <literal>source</literal> will be <literal>bundle</"
12144 "literal>, <literal>pull</literal>, or <literal>push</literal>, depending on "
12145 "the operation the client performed."
12146 msgstr ""
12148 #. type: Content of: <book><chapter><sect1><sect2><para>
12149 #: ../en/ch10-hook.xml:1677
12150 msgid ""
12151 "See also: <literal role=\"hook\">preoutgoing</literal> (section <xref linkend="
12152 "\"sec.hook.preoutgoing\"/>)"
12153 msgstr ""
12155 #. type: Content of: <book><chapter><sect1><sect2><title>
12156 #: ../en/ch10-hook.xml:1683
12157 msgid ""
12158 "<literal role=\"hook\">prechangegroup</literal>&emdash;before starting to add "
12159 "remote changesets"
12160 msgstr ""
12161 "<literal role=\"hook\">prechangegroup</literal>&emdash;增加远程修改集之前"
12163 #. type: Content of: <book><chapter><sect1><sect2><para>
12164 #: ../en/ch10-hook.xml:1687
12165 msgid ""
12166 "This controlling hook is run before Mercurial begins to add a group of "
12167 "changesets from another repository."
12168 msgstr ""
12170 #. type: Content of: <book><chapter><sect1><sect2><para>
12171 #: ../en/ch10-hook.xml:1691
12172 msgid ""
12173 "This hook does not have any information about the changesets to be added, "
12174 "because it is run before transmission of those changesets is allowed to "
12175 "begin. If this hook fails, the changesets will not be transmitted."
12176 msgstr ""
12178 #. type: Content of: <book><chapter><sect1><sect2><para>
12179 #: ../en/ch10-hook.xml:1697
12180 msgid ""
12181 "One use for this hook is to prevent external changes from being added to a "
12182 "repository. For example, you could use this to <quote>freeze</quote> a "
12183 "server-hosted branch temporarily or permanently so that users cannot push to "
12184 "it, while still allowing a local administrator to modify the repository."
12185 msgstr ""
12187 #. type: Content of: <book><chapter><sect1><sect2><para>
12188 #: ../en/ch10-hook.xml:1719
12189 msgid ""
12190 "See also: <literal role=\"hook\">changegroup</literal> (section <xref linkend="
12191 "\"sec.hook.changegroup\"/>), <literal role=\"hook\">incoming</literal> "
12192 "(section <xref linkend=\"sec.hook.incoming\"/>), , <literal role=\"hook"
12193 "\">pretxnchangegroup</literal> (section <xref linkend=\"sec.hook."
12194 "pretxnchangegroup\"/>)"
12195 msgstr ""
12197 #. type: Content of: <book><chapter><sect1><sect2><title>
12198 #: ../en/ch10-hook.xml:1729
12199 msgid ""
12200 "<literal role=\"hook\">precommit</literal>&emdash;before starting to commit a "
12201 "changeset"
12202 msgstr "<literal role=\"hook\">precommit</literal>&emdash;提交修改集之前"
12204 #. type: Content of: <book><chapter><sect1><sect2><para>
12205 #: ../en/ch10-hook.xml:1732
12206 msgid ""
12207 "This hook is run before Mercurial begins to commit a new changeset. It is run "
12208 "before Mercurial has any of the metadata for the commit, such as the files to "
12209 "be committed, the commit message, or the commit date."
12210 msgstr ""
12212 #. type: Content of: <book><chapter><sect1><sect2><para>
12213 #: ../en/ch10-hook.xml:1738
12214 msgid ""
12215 "One use for this hook is to disable the ability to commit new changesets, "
12216 "while still allowing incoming changesets. Another is to run a build or test, "
12217 "and only allow the commit to begin if the build or test succeeds."
12218 msgstr ""
12220 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12221 #: ../en/ch10-hook.xml:1747
12222 msgid ""
12223 "<literal>parent1</literal>: A changeset ID. The changeset ID of the first "
12224 "parent of the working directory."
12225 msgstr ""
12227 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12228 #: ../en/ch10-hook.xml:1752
12229 msgid ""
12230 "<literal>parent2</literal>: A changeset ID. The changeset ID of the second "
12231 "parent of the working directory."
12232 msgstr ""
12234 #. type: Content of: <book><chapter><sect1><sect2><para>
12235 #: ../en/ch10-hook.xml:1757
12236 msgid ""
12237 "If the commit proceeds, the parents of the working directory will become the "
12238 "parents of the new changeset."
12239 msgstr ""
12241 #. type: Content of: <book><chapter><sect1><sect2><para>
12242 #: ../en/ch10-hook.xml:1761
12243 msgid ""
12244 "See also: <literal role=\"hook\">commit</literal> (section <xref linkend="
12245 "\"sec.hook.commit\"/>), <literal role=\"hook\">pretxncommit</literal> "
12246 "(section <xref linkend=\"sec.hook.pretxncommit\"/>)"
12247 msgstr ""
12249 #. type: Content of: <book><chapter><sect1><sect2><title>
12250 #: ../en/ch10-hook.xml:1769
12251 msgid ""
12252 "<literal role=\"hook\">preoutgoing</literal>&emdash;before starting to "
12253 "propagate changesets"
12254 msgstr "<literal role=\"hook\">preoutgoing</literal>&emdash;传播修改集之前"
12256 #. type: Content of: <book><chapter><sect1><sect2><para>
12257 #: ../en/ch10-hook.xml:1772
12258 msgid ""
12259 "This hook is invoked before Mercurial knows the identities of the changesets "
12260 "to be transmitted."
12261 msgstr ""
12263 #. type: Content of: <book><chapter><sect1><sect2><para>
12264 #: ../en/ch10-hook.xml:1776
12265 msgid ""
12266 "One use for this hook is to prevent changes from being transmitted to another "
12267 "repository."
12268 msgstr ""
12270 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12271 #: ../en/ch10-hook.xml:1783
12272 msgid ""
12273 "<literal>source</literal>: A string. The source of the operation that is "
12274 "attempting to obtain changes from this repository (see section <xref linkend="
12275 "\"sec.hook.sources\"/>). See the documentation for the <literal>source</"
12276 "literal> parameter to the <literal role=\"hook\">outgoing</literal> hook, in "
12277 "section <xref linkend=\"sec.hook.outgoing\"/>, for possible values of this "
12278 "parameter."
12279 msgstr ""
12281 #. type: Content of: <book><chapter><sect1><sect2><para>
12282 #: ../en/ch10-hook.xml:1801
12283 msgid ""
12284 "See also: <literal role=\"hook\">outgoing</literal> (section <xref linkend="
12285 "\"sec.hook.outgoing\"/>)"
12286 msgstr ""
12288 #. type: Content of: <book><chapter><sect1><sect2><title>
12289 #: ../en/ch10-hook.xml:1807
12290 msgid ""
12291 "<literal role=\"hook\">pretag</literal>&emdash;before tagging a changeset"
12292 msgstr "<literal role=\"hook\">pretag</literal>&emdash;创建标签之前"
12294 #. type: Content of: <book><chapter><sect1><sect2><para>
12295 #: ../en/ch10-hook.xml:1810
12296 msgid ""
12297 "This controlling hook is run before a tag is created. If the hook succeeds, "
12298 "creation of the tag proceeds. If the hook fails, the tag is not created."
12299 msgstr ""
12301 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12302 #: ../en/ch10-hook.xml:1818
12303 msgid ""
12304 "<literal>local</literal>: A boolean. Whether the tag is local to this "
12305 "repository instance (i.e. stored in <filename role=\"special\">.hg/localtags</"
12306 "filename>) or managed by Mercurial (stored in <filename role=\"special\">."
12307 "hgtags</filename>)."
12308 msgstr ""
12310 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12311 #: ../en/ch10-hook.xml:1825
12312 msgid ""
12313 "<literal>node</literal>: A changeset ID. The ID of the changeset to be "
12314 "tagged."
12315 msgstr ""
12317 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12318 #: ../en/ch10-hook.xml:1829
12319 msgid "<literal>tag</literal>: A string. The name of the tag to be created."
12320 msgstr ""
12322 #. type: Content of: <book><chapter><sect1><sect2><para>
12323 #: ../en/ch10-hook.xml:1834
12324 msgid ""
12325 "If the tag to be created is revision-controlled, the <literal role=\"hook"
12326 "\">precommit</literal> and <literal role=\"hook\">pretxncommit</literal> "
12327 "hooks (sections <xref linkend=\"sec.hook.commit\"/> and <xref linkend=\"sec."
12328 "hook.pretxncommit\"/>) will also be run."
12329 msgstr ""
12331 #. type: Content of: <book><chapter><sect1><sect2><para>
12332 #: ../en/ch10-hook.xml:1841
12333 msgid ""
12334 "See also: <literal role=\"hook\">tag</literal> (section <xref linkend=\"sec."
12335 "hook.tag\"/>)"
12336 msgstr ""
12338 #. type: Content of: <book><chapter><sect1><sect2><title>
12339 #: ../en/ch10-hook.xml:1846
12340 msgid ""
12341 "<literal role=\"hook\">pretxnchangegroup</literal>&emdash;before completing "
12342 "addition of remote changesets"
12343 msgstr ""
12344 "<literal role=\"hook\">pretxnchangegroup</literal>&emdash;完成增加远程修改集之"
12345 "前"
12347 #. type: Content of: <book><chapter><sect1><sect2><para>
12348 #: ../en/ch10-hook.xml:1850
12349 msgid ""
12350 "This controlling hook is run before a transaction&emdash;that manages the "
12351 "addition of a group of new changesets from outside the repository&emdash;"
12352 "completes. If the hook succeeds, the transaction completes, and all of the "
12353 "changesets become permanent within this repository. If the hook fails, the "
12354 "transaction is rolled back, and the data for the changesets is erased."
12355 msgstr ""
12357 #. type: Content of: <book><chapter><sect1><sect2><para>
12358 #: ../en/ch10-hook.xml:1859
12359 msgid ""
12360 "This hook can access the metadata associated with the almost-added "
12361 "changesets, but it should not do anything permanent with this data. It must "
12362 "also not modify the working directory."
12363 msgstr ""
12365 #. type: Content of: <book><chapter><sect1><sect2><para>
12366 #: ../en/ch10-hook.xml:1865
12367 msgid ""
12368 "While this hook is running, if other Mercurial processes access this "
12369 "repository, they will be able to see the almost-added changesets as if they "
12370 "are permanent. This may lead to race conditions if you do not take steps to "
12371 "avoid them."
12372 msgstr ""
12374 #. type: Content of: <book><chapter><sect1><sect2><para>
12375 #: ../en/ch10-hook.xml:1872
12376 msgid ""
12377 "This hook can be used to automatically vet a group of changesets. If the "
12378 "hook fails, all of the changesets are <quote>rejected</quote> when the "
12379 "transaction rolls back."
12380 msgstr ""
12382 #. type: Content of: <book><chapter><sect1><sect2><para>
12383 #: ../en/ch10-hook.xml:1902
12384 msgid ""
12385 "See also: <literal role=\"hook\">changegroup</literal> (section <xref linkend="
12386 "\"sec.hook.changegroup\"/>), <literal role=\"hook\">incoming</literal> "
12387 "(section <xref linkend=\"sec.hook.incoming\"/>), <literal role=\"hook"
12388 "\">prechangegroup</literal> (section <xref linkend=\"sec.hook.prechangegroup"
12389 "\"/>)"
12390 msgstr ""
12392 #. type: Content of: <book><chapter><sect1><sect2><title>
12393 #: ../en/ch10-hook.xml:1912
12394 msgid ""
12395 "<literal role=\"hook\">pretxncommit</literal>&emdash;before completing commit "
12396 "of new changeset"
12397 msgstr "<literal role=\"hook\">pretxncommit</literal>&emdash;完成提交之前"
12399 #. type: Content of: <book><chapter><sect1><sect2><para>
12400 #: ../en/ch10-hook.xml:1915
12401 msgid ""
12402 "This controlling hook is run before a transaction&emdash;that manages a new "
12403 "commit&emdash;completes. If the hook succeeds, the transaction completes and "
12404 "the changeset becomes permanent within this repository. If the hook fails, "
12405 "the transaction is rolled back, and the commit data is erased."
12406 msgstr ""
12408 #. type: Content of: <book><chapter><sect1><sect2><para>
12409 #: ../en/ch10-hook.xml:1923
12410 msgid ""
12411 "This hook can access the metadata associated with the almost-new changeset, "
12412 "but it should not do anything permanent with this data. It must also not "
12413 "modify the working directory."
12414 msgstr ""
12416 #. type: Content of: <book><chapter><sect1><sect2><para>
12417 #: ../en/ch10-hook.xml:1929
12418 msgid ""
12419 "While this hook is running, if other Mercurial processes access this "
12420 "repository, they will be able to see the almost-new changeset as if it is "
12421 "permanent. This may lead to race conditions if you do not take steps to "
12422 "avoid them."
12423 msgstr ""
12425 #. type: Content of: <book><chapter><sect1><sect2><para>
12426 #: ../en/ch10-hook.xml:1953
12427 msgid ""
12428 "See also: <literal role=\"hook\">precommit</literal> (section <xref linkend="
12429 "\"sec.hook.precommit\"/>)"
12430 msgstr ""
12432 #. type: Content of: <book><chapter><sect1><sect2><title>
12433 #: ../en/ch10-hook.xml:1959
12434 msgid ""
12435 "<literal role=\"hook\">preupdate</literal>&emdash;before updating or merging "
12436 "working directory"
12437 msgstr ""
12438 "<literal role=\"hook\">preupdate</literal>&emdash;更新或合并工作目录之前"
12440 #. type: Content of: <book><chapter><sect1><sect2><para>
12441 #: ../en/ch10-hook.xml:1962
12442 msgid ""
12443 "This controlling hook is run before an update or merge of the working "
12444 "directory begins. It is run only if Mercurial's normal pre-update checks "
12445 "determine that the update or merge can proceed. If the hook succeeds, the "
12446 "update or merge may proceed; if it fails, the update or merge does not start."
12447 msgstr ""
12449 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12450 #: ../en/ch10-hook.xml:1972
12451 msgid ""
12452 "<literal>parent1</literal>: A changeset ID. The ID of the parent that the "
12453 "working directory is to be updated to. If the working directory is being "
12454 "merged, it will not change this parent."
12455 msgstr ""
12457 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12458 #: ../en/ch10-hook.xml:1978
12459 msgid ""
12460 "<literal>parent2</literal>: A changeset ID. Only set if the working "
12461 "directory is being merged. The ID of the revision that the working directory "
12462 "is being merged with."
12463 msgstr ""
12465 #. type: Content of: <book><chapter><sect1><sect2><para>
12466 #: ../en/ch10-hook.xml:1985
12467 msgid ""
12468 "See also: <literal role=\"hook\">update</literal> (section <xref linkend="
12469 "\"sec.hook.update\"/>)"
12470 msgstr ""
12472 #. type: Content of: <book><chapter><sect1><sect2><title>
12473 #: ../en/ch10-hook.xml:1991
12474 msgid "<literal role=\"hook\">tag</literal>&emdash;after tagging a changeset"
12475 msgstr "<literal role=\"hook\">tag</literal>&emdash;创建标签之后"
12477 #. type: Content of: <book><chapter><sect1><sect2><para>
12478 #: ../en/ch10-hook.xml:1994
12479 msgid "This hook is run after a tag has been created."
12480 msgstr ""
12482 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12483 #: ../en/ch10-hook.xml:2000
12484 msgid ""
12485 "<literal>local</literal>: A boolean. Whether the new tag is local to this "
12486 "repository instance (i.e. stored in <filename role=\"special\">.hg/"
12487 "localtags</filename>) or managed by Mercurial (stored in <filename role="
12488 "\"special\">.hgtags</filename>)."
12489 msgstr ""
12491 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12492 #: ../en/ch10-hook.xml:2008
12493 msgid ""
12494 "<literal>node</literal>: A changeset ID. The ID of the changeset that was "
12495 "tagged."
12496 msgstr ""
12498 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12499 #: ../en/ch10-hook.xml:2012
12500 msgid "<literal>tag</literal>: A string. The name of the tag that was created."
12501 msgstr ""
12503 #. type: Content of: <book><chapter><sect1><sect2><para>
12504 #: ../en/ch10-hook.xml:2017
12505 msgid ""
12506 "If the created tag is revision-controlled, the <literal role=\"hook\">commit</"
12507 "literal> hook (section <xref linkend=\"sec.hook.commit\"/>) is run before "
12508 "this hook."
12509 msgstr ""
12511 #. type: Content of: <book><chapter><sect1><sect2><para>
12512 #: ../en/ch10-hook.xml:2022
12513 msgid ""
12514 "See also: <literal role=\"hook\">pretag</literal> (section <xref linkend="
12515 "\"sec.hook.pretag\"/>)"
12516 msgstr ""
12518 #. type: Content of: <book><chapter><sect1><sect2><title>
12519 #: ../en/ch10-hook.xml:2028
12520 msgid ""
12521 "<literal role=\"hook\">update</literal>&emdash;after updating or merging "
12522 "working directory"
12523 msgstr "<literal role=\"hook\">update</literal>&emdash;更新或合并工作目录之后"
12525 #. type: Content of: <book><chapter><sect1><sect2><para>
12526 #: ../en/ch10-hook.xml:2031
12527 msgid ""
12528 "This hook is run after an update or merge of the working directory "
12529 "completes. Since a merge can fail (if the external <command>hgmerge</"
12530 "command> command fails to resolve conflicts in a file), this hook "
12531 "communicates whether the update or merge completed cleanly."
12532 msgstr ""
12534 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12535 #: ../en/ch10-hook.xml:2039
12536 msgid ""
12537 "<literal>error</literal>: A boolean. Indicates whether the update or merge "
12538 "completed successfully."
12539 msgstr ""
12541 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12542 #: ../en/ch10-hook.xml:2044
12543 msgid ""
12544 "<literal>parent1</literal>: A changeset ID. The ID of the parent that the "
12545 "working directory was updated to. If the working directory was merged, it "
12546 "will not have changed this parent."
12547 msgstr ""
12549 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
12550 #: ../en/ch10-hook.xml:2050
12551 msgid ""
12552 "<literal>parent2</literal>: A changeset ID. Only set if the working "
12553 "directory was merged. The ID of the revision that the working directory was "
12554 "merged with."
12555 msgstr ""
12557 #. type: Content of: <book><chapter><sect1><sect2><para>
12558 #: ../en/ch10-hook.xml:2056
12559 msgid ""
12560 "See also: <literal role=\"hook\">preupdate</literal> (section <xref linkend="
12561 "\"sec.hook.preupdate\"/>)"
12562 msgstr ""
12564 #. type: Content of: <book><chapter><title>
12565 #: ../en/ch11-template.xml:5
12566 msgid "Customising the output of Mercurial"
12567 msgstr "定制 Mercurial 的输出"
12569 #. type: Content of: <book><chapter><para>
12570 #: ../en/ch11-template.xml:7
12571 msgid ""
12572 "Mercurial provides a powerful mechanism to let you control how it displays "
12573 "information. The mechanism is based on templates. You can use templates to "
12574 "generate specific output for a single command, or to customise the entire "
12575 "appearance of the built-in web interface."
12576 msgstr ""
12578 #. type: Content of: <book><chapter><sect1><title>
12579 #: ../en/ch11-template.xml:14
12580 msgid "Using precanned output styles"
12581 msgstr "使用预定义的输出样式"
12583 #. type: Content of: <book><chapter><sect1><para>
12584 #: ../en/ch11-template.xml:16
12585 msgid ""
12586 "Packaged with Mercurial are some output styles that you can use immediately. "
12587 "A style is simply a precanned template that someone wrote and installed "
12588 "somewhere that Mercurial can find."
12589 msgstr ""
12591 #. type: Content of: <book><chapter><sect1><para>
12592 #: ../en/ch11-template.xml:21
12593 msgid ""
12594 "Before we take a look at Mercurial's bundled styles, let's review its normal "
12595 "output."
12596 msgstr ""
12598 #. type: Content of: <book><chapter><sect1><para>
12599 #: ../en/ch11-template.xml:26
12600 msgid ""
12601 "This is somewhat informative, but it takes up a lot of space&emdash;five "
12602 "lines of output per changeset. The <literal>compact</literal> style reduces "
12603 "this to three lines, presented in a sparse manner."
12604 msgstr ""
12606 #. type: Content of: <book><chapter><sect1><para>
12607 #: ../en/ch11-template.xml:33
12608 msgid ""
12609 "The <literal>changelog</literal> style hints at the expressive power of "
12610 "Mercurial's templating engine. This style attempts to follow the GNU "
12611 "Project's changelog guidelines<citation>web:changelog</citation>."
12612 msgstr ""
12614 #. type: Content of: <book><chapter><sect1><para>
12615 #: ../en/ch11-template.xml:40
12616 msgid ""
12617 "You will not be shocked to learn that Mercurial's default output style is "
12618 "named <literal>default</literal>."
12619 msgstr ""
12621 #. type: Content of: <book><chapter><sect1><sect2><title>
12622 #: ../en/ch11-template.xml:44
12623 msgid "Setting a default style"
12624 msgstr "设置默认样式"
12626 #. type: Content of: <book><chapter><sect1><sect2><para>
12627 #: ../en/ch11-template.xml:46
12628 msgid ""
12629 "You can modify the output style that Mercurial will use for every command by "
12630 "editing your <filename role=\"special\"> /.hgrc</filename>\\ file, naming the "
12631 "style you would prefer to use."
12632 msgstr ""
12634 #. type: Content of: <book><chapter><sect1><sect2><para>
12635 #: ../en/ch11-template.xml:53
12636 msgid ""
12637 "If you write a style of your own, you can use it by either providing the path "
12638 "to your style file, or copying your style file into a location where "
12639 "Mercurial can find it (typically the <literal>templates</literal> "
12640 "subdirectory of your Mercurial install directory)."
12641 msgstr ""
12643 #. type: Content of: <book><chapter><sect1><title>
12644 #: ../en/ch11-template.xml:62
12645 msgid "Commands that support styles and templates"
12646 msgstr "支持样式和模版的命令"
12648 #. type: Content of: <book><chapter><sect1><para>
12649 #: ../en/ch11-template.xml:64
12650 msgid ""
12651 "All of Mercurial's <quote><literal>log</literal>-like</quote> commands let "
12652 "you use styles and templates: <command role=\"hg-cmd\">hg incoming</command>, "
12653 "<command role=\"hg-cmd\">hg log</command>, <command role=\"hg-cmd\">hg "
12654 "outgoing</command>, and <command role=\"hg-cmd\">hg tip</command>."
12655 msgstr ""
12657 #. type: Content of: <book><chapter><sect1><para>
12658 #: ../en/ch11-template.xml:71
12659 msgid ""
12660 "As I write this manual, these are so far the only commands that support "
12661 "styles and templates. Since these are the most important commands that need "
12662 "customisable output, there has been little pressure from the Mercurial user "
12663 "community to add style and template support to other commands."
12664 msgstr ""
12666 #. type: Content of: <book><chapter><sect1><title>
12667 #: ../en/ch11-template.xml:79
12668 msgid "The basics of templating"
12669 msgstr "模版基础"
12671 #. type: Content of: <book><chapter><sect1><para>
12672 #: ../en/ch11-template.xml:81
12673 msgid ""
12674 "At its simplest, a Mercurial template is a piece of text. Some of the text "
12675 "never changes, while other parts are <emphasis>expanded</emphasis>, or "
12676 "replaced with new text, when necessary."
12677 msgstr ""
12679 #. type: Content of: <book><chapter><sect1><para>
12680 #: ../en/ch11-template.xml:86
12681 msgid ""
12682 "Before we continue, let's look again at a simple example of Mercurial's "
12683 "normal output."
12684 msgstr ""
12686 #. type: Content of: <book><chapter><sect1><para>
12687 #: ../en/ch11-template.xml:91
12688 msgid ""
12689 "Now, let's run the same command, but using a template to change its output."
12690 msgstr ""
12692 #. type: Content of: <book><chapter><sect1><para>
12693 #: ../en/ch11-template.xml:96
12694 msgid ""
12695 "The example above illustrates the simplest possible template; it's just a "
12696 "piece of static text, printed once for each changeset. The <option role=\"hg-"
12697 "opt-log\">--template</option> option to the <command role=\"hg-cmd\">hg log</"
12698 "command> command tells Mercurial to use the given text as the template when "
12699 "printing each changeset."
12700 msgstr ""
12702 #. type: Content of: <book><chapter><sect1><para>
12703 #: ../en/ch11-template.xml:104
12704 msgid ""
12705 "Notice that the template string above ends with the text <quote><literal>\\n</"
12706 "literal></quote>. This is an <emphasis>escape sequence</emphasis>, telling "
12707 "Mercurial to print a newline at the end of each template item. If you omit "
12708 "this newline, Mercurial will run each piece of output together. See section "
12709 "<xref linkend=\"sec.template.escape\"/> for more details of escape sequences."
12710 msgstr ""
12712 #. type: Content of: <book><chapter><sect1><para>
12713 #: ../en/ch11-template.xml:112
12714 msgid ""
12715 "A template that prints a fixed string of text all the time isn't very useful; "
12716 "let's try something a bit more complex."
12717 msgstr ""
12719 #. type: Content of: <book><chapter><sect1><para>
12720 #: ../en/ch11-template.xml:118
12721 msgid ""
12722 "As you can see, the string <quote><literal>{desc}</literal></quote> in the "
12723 "template has been replaced in the output with the description of each "
12724 "changeset. Every time Mercurial finds text enclosed in curly braces "
12725 "(<quote><literal>{</literal></quote> and <quote><literal>}</literal></"
12726 "quote>), it will try to replace the braces and text with the expansion of "
12727 "whatever is inside. To print a literal curly brace, you must escape it, as "
12728 "described in section <xref linkend=\"sec.template.escape\"/>."
12729 msgstr ""
12731 #. type: Content of: <book><chapter><sect1><title>
12732 #: ../en/ch11-template.xml:131
12733 msgid "Common template keywords"
12734 msgstr "模版关键字"
12736 #. type: Content of: <book><chapter><sect1><para>
12737 #: ../en/ch11-template.xml:133
12738 msgid ""
12739 "You can start writing simple templates immediately using the keywords below."
12740 msgstr ""
12742 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12743 #: ../en/ch11-template.xml:137
12744 msgid ""
12745 "<literal role=\"template-keyword\">author</literal>: String. The unmodified "
12746 "author of the changeset."
12747 msgstr ""
12749 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12750 #: ../en/ch11-template.xml:141
12751 msgid ""
12752 "<literal role=\"template-keyword\">branches</literal>: String. The name of "
12753 "the branch on which the changeset was committed. Will be empty if the branch "
12754 "name was <literal>default</literal>."
12755 msgstr ""
12757 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12758 #: ../en/ch11-template.xml:147
12759 msgid ""
12760 "<literal role=\"template-keyword\">date</literal>: Date information. The "
12761 "date when the changeset was committed. This is <emphasis>not</emphasis> "
12762 "human-readable; you must pass it through a filter that will render it "
12763 "appropriately. See section <xref linkend=\"sec.template.filter\"/> for more "
12764 "information on filters. The date is expressed as a pair of numbers. The "
12765 "first number is a Unix UTC timestamp (seconds since January 1, 1970); the "
12766 "second is the offset of the committer's timezone from UTC, in seconds."
12767 msgstr ""
12769 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12770 #: ../en/ch11-template.xml:158
12771 msgid ""
12772 "<literal role=\"template-keyword\">desc</literal>: String. The text of the "
12773 "changeset description."
12774 msgstr ""
12776 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12777 #: ../en/ch11-template.xml:161
12778 msgid ""
12779 "<literal role=\"template-keyword\">files</literal>: List of strings. All "
12780 "files modified, added, or removed by this changeset."
12781 msgstr ""
12783 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12784 #: ../en/ch11-template.xml:166
12785 msgid ""
12786 "<literal role=\"template-keyword\">file_adds</literal>: List of strings. "
12787 "Files added by this changeset."
12788 msgstr ""
12790 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12791 #: ../en/ch11-template.xml:170
12792 msgid ""
12793 "<literal role=\"template-keyword\">file_dels</literal>: List of strings. "
12794 "Files removed by this changeset."
12795 msgstr ""
12797 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12798 #: ../en/ch11-template.xml:174
12799 msgid ""
12800 "<literal role=\"template-keyword\">node</literal>: String. The changeset "
12801 "identification hash, as a 40-character hexadecimal string."
12802 msgstr ""
12804 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12805 #: ../en/ch11-template.xml:178
12806 msgid ""
12807 "<literal role=\"template-keyword\">parents</literal>: List of strings. The "
12808 "parents of the changeset."
12809 msgstr ""
12811 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12812 #: ../en/ch11-template.xml:182
12813 msgid ""
12814 "<literal role=\"template-keyword\">rev</literal>: Integer. The repository-"
12815 "local changeset revision number."
12816 msgstr ""
12818 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12819 #: ../en/ch11-template.xml:186
12820 msgid ""
12821 "<literal role=\"template-keyword\">tags</literal>: List of strings. Any tags "
12822 "associated with the changeset."
12823 msgstr ""
12825 #. type: Content of: <book><chapter><sect1><para>
12826 #: ../en/ch11-template.xml:191
12827 msgid ""
12828 "A few simple experiments will show us what to expect when we use these "
12829 "keywords; you can see the results below."
12830 msgstr ""
12832 #. type: Content of: <book><chapter><sect1><para>
12833 #: ../en/ch11-template.xml:196
12834 msgid ""
12835 "As we noted above, the date keyword does not produce human-readable output, "
12836 "so we must treat it specially. This involves using a <emphasis>filter</"
12837 "emphasis>, about which more in section <xref linkend=\"sec.template.filter\"/"
12838 ">."
12839 msgstr ""
12841 #. type: Content of: <book><chapter><sect1><title>
12842 #: ../en/ch11-template.xml:206
12843 msgid "Escape sequences"
12844 msgstr "转义序列"
12846 #. type: Content of: <book><chapter><sect1><para>
12847 #: ../en/ch11-template.xml:208
12848 msgid ""
12849 "Mercurial's templating engine recognises the most commonly used escape "
12850 "sequences in strings. When it sees a backslash (<quote><literal>\\</"
12851 "literal></quote>) character, it looks at the following character and "
12852 "substitutes the two characters with a single replacement, as described below."
12853 msgstr ""
12855 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12856 #: ../en/ch11-template.xml:215
12857 msgid ""
12858 "<literal>\\textbackslash\\textbackslash</literal>: Backslash, <quote><literal>"
12859 "\\</literal></quote>, ASCII 134."
12860 msgstr ""
12862 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12863 #: ../en/ch11-template.xml:219
12864 msgid "<literal>\\textbackslash n</literal>: Newline, ASCII 12."
12865 msgstr ""
12867 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12868 #: ../en/ch11-template.xml:222
12869 msgid "<literal>\\textbackslash r</literal>: Carriage return, ASCII 15."
12870 msgstr ""
12872 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12873 #: ../en/ch11-template.xml:225
12874 msgid "<literal>\\textbackslash t</literal>: Tab, ASCII 11."
12875 msgstr ""
12877 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12878 #: ../en/ch11-template.xml:228
12879 msgid "<literal>\\textbackslash v</literal>: Vertical tab, ASCII 13."
12880 msgstr ""
12882 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12883 #: ../en/ch11-template.xml:231
12884 msgid ""
12885 "<literal>\\textbackslash {</literal>: Open curly brace, <quote><literal>{</"
12886 "literal></quote>, ASCII 173."
12887 msgstr ""
12889 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12890 #: ../en/ch11-template.xml:235
12891 msgid ""
12892 "<literal>\\textbackslash }</literal>: Close curly brace, <quote><literal>}</"
12893 "literal></quote>, ASCII 175."
12894 msgstr ""
12896 #. type: Content of: <book><chapter><sect1><para>
12897 #: ../en/ch11-template.xml:240
12898 msgid ""
12899 "As indicated above, if you want the expansion of a template to contain a "
12900 "literal <quote><literal>\\</literal></quote>, <quote><literal>{</literal></"
12901 "quote>, or <quote><literal>{</literal></quote> character, you must escape it."
12902 msgstr ""
12904 #. type: Content of: <book><chapter><sect1><title>
12905 #: ../en/ch11-template.xml:248
12906 msgid "Filtering keywords to change their results"
12907 msgstr "通过过滤关键字来修改输出结果"
12909 #. type: Content of: <book><chapter><sect1><para>
12910 #: ../en/ch11-template.xml:250
12911 msgid ""
12912 "Some of the results of template expansion are not immediately easy to use. "
12913 "Mercurial lets you specify an optional chain of <emphasis>filters</emphasis> "
12914 "to modify the result of expanding a keyword. You have already seen a common "
12915 "filter, <literal role=\"template-kw-filt-date\">isodate</literal>, in action "
12916 "above, to make a date readable."
12917 msgstr ""
12919 #. type: Content of: <book><chapter><sect1><para>
12920 #: ../en/ch11-template.xml:257
12921 msgid ""
12922 "Below is a list of the most commonly used filters that Mercurial supports. "
12923 "While some filters can be applied to any text, others can only be used in "
12924 "specific circumstances. The name of each filter is followed first by an "
12925 "indication of where it can be used, then a description of its effect."
12926 msgstr ""
12928 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12929 #: ../en/ch11-template.xml:264
12930 msgid ""
12931 "<literal role=\"template-filter\">addbreaks</literal>: Any text. Add an XHTML "
12932 "<quote><literal>&lt;br/&gt;</literal></quote> tag before the end of every "
12933 "line except the last. For example, <quote><literal>foo\\nbar</literal></"
12934 "quote> becomes <quote><literal>foo&lt;br/&gt;\\nbar</literal></quote>."
12935 msgstr ""
12937 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12938 #: ../en/ch11-template.xml:271
12939 msgid ""
12940 "<literal role=\"template-kw-filt-date\">age</literal>: <literal role="
12941 "\"template-keyword\">date</literal> keyword. Render the age of the date, "
12942 "relative to the current time. Yields a string like <quote><literal>10 "
12943 "minutes</literal></quote>."
12944 msgstr ""
12946 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12947 #: ../en/ch11-template.xml:278
12948 msgid ""
12949 "<literal role=\"template-filter\">basename</literal>: Any text, but most "
12950 "useful for the <literal role=\"template-keyword\">files</literal> keyword and "
12951 "its relatives. Treat the text as a path, and return the basename. For "
12952 "example, <quote><literal>foo/bar/baz</literal></quote> becomes "
12953 "<quote><literal>baz</literal></quote>."
12954 msgstr ""
12956 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12957 #: ../en/ch11-template.xml:287
12958 msgid ""
12959 "<literal role=\"template-kw-filt-date\">date</literal>: <literal role="
12960 "\"template-keyword\">date</literal> keyword. Render a date in a similar "
12961 "format to the Unix <literal role=\"template-keyword\">date</literal> command, "
12962 "but with timezone included. Yields a string like <quote><literal>Mon Sep 04 "
12963 "15:13:13 2006 -0700</literal></quote>."
12964 msgstr ""
12966 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12967 #: ../en/ch11-template.xml:295
12968 msgid ""
12969 "<literal role=\"template-kw-filt-author\">domain</literal>: Any text, but "
12970 "most useful for the <literal role=\"template-keyword\">author</literal> "
12971 "keyword. Finds the first string that looks like an email address, and "
12972 "extract just the domain component. For example, <quote><literal>Bryan "
12973 "O'Sullivan &lt;bos@serpentine.com&gt;</literal></quote> becomes "
12974 "<quote><literal>serpentine.com</literal></quote>."
12975 msgstr ""
12977 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12978 #: ../en/ch11-template.xml:305
12979 msgid ""
12980 "<literal role=\"template-kw-filt-author\">email</literal>: Any text, but most "
12981 "useful for the <literal role=\"template-keyword\">author</literal> keyword. "
12982 "Extract the first string that looks like an email address. For example, "
12983 "<quote><literal>Bryan O'Sullivan &lt;bos@serpentine.com&gt;</literal></quote> "
12984 "becomes <quote><literal>bos@serpentine.com</literal></quote>."
12985 msgstr ""
12987 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12988 #: ../en/ch11-template.xml:314
12989 msgid ""
12990 "<literal role=\"template-filter\">escape</literal>: Any text. Replace the "
12991 "special XML/XHTML characters <quote><literal>&amp;</literal></quote>, "
12992 "<quote><literal>&lt;</literal></quote> and <quote><literal>&gt;</literal></"
12993 "quote> with XML entities."
12994 msgstr ""
12996 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
12997 #: ../en/ch11-template.xml:322
12998 msgid ""
12999 "<literal role=\"template-filter\">fill68</literal>: Any text. Wrap the text "
13000 "to fit in 68 columns. This is useful before you pass text through the "
13001 "<literal role=\"template-filter\">tabindent</literal> filter, and still want "
13002 "it to fit in an 80-column fixed-font window."
13003 msgstr ""
13005 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
13006 #: ../en/ch11-template.xml:330
13007 msgid ""
13008 "<literal role=\"template-filter\">fill76</literal>: Any text. Wrap the text "
13009 "to fit in 76 columns."
13010 msgstr ""
13012 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
13013 #: ../en/ch11-template.xml:334
13014 msgid ""
13015 "<literal role=\"template-filter\">firstline</literal>: Any text. Yield the "
13016 "first line of text, without any trailing newlines."
13017 msgstr ""
13019 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
13020 #: ../en/ch11-template.xml:339
13021 msgid ""
13022 "<literal role=\"template-kw-filt-date\">hgdate</literal>: <literal role="
13023 "\"template-keyword\">date</literal> keyword. Render the date as a pair of "
13024 "readable numbers. Yields a string like <quote><literal>1157407993 25200</"
13025 "literal></quote>."
13026 msgstr ""
13028 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
13029 #: ../en/ch11-template.xml:346
13030 msgid ""
13031 "<literal role=\"template-kw-filt-date\">isodate</literal>: <literal role="
13032 "\"template-keyword\">date</literal> keyword. Render the date as a text "
13033 "string in ISO 8601 format. Yields a string like <quote><literal>2006-09-04 "
13034 "15:13:13 -0700</literal></quote>."
13035 msgstr ""
13037 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
13038 #: ../en/ch11-template.xml:353
13039 msgid ""
13040 "<literal role=\"template-filter\">obfuscate</literal>: Any text, but most "
13041 "useful for the <literal role=\"template-keyword\">author</literal> keyword. "
13042 "Yield the input text rendered as a sequence of XML entities. This helps to "
13043 "defeat some particularly stupid screen-scraping email harvesting spambots."
13044 msgstr ""
13046 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
13047 #: ../en/ch11-template.xml:361
13048 msgid ""
13049 "<literal role=\"template-kw-filt-author\">person</literal>: Any text, but "
13050 "most useful for the <literal role=\"template-keyword\">author</literal> "
13051 "keyword. Yield the text before an email address. For example, "
13052 "<quote><literal>Bryan O'Sullivan &lt;bos@serpentine.com&gt;</literal></quote> "
13053 "becomes <quote><literal>Bryan O'Sullivan</literal></quote>."
13054 msgstr ""
13056 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
13057 #: ../en/ch11-template.xml:370
13058 msgid ""
13059 "<literal role=\"template-kw-filt-date\">rfc822date</literal>: <literal role="
13060 "\"template-keyword\">date</literal> keyword. Render a date using the same "
13061 "format used in email headers. Yields a string like <quote><literal>Mon, 04 "
13062 "Sep 2006 15:13:13 -0700</literal></quote>."
13063 msgstr ""
13065 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
13066 #: ../en/ch11-template.xml:377
13067 msgid ""
13068 "<literal role=\"template-kw-filt-node\">short</literal>: Changeset hash. "
13069 "Yield the short form of a changeset hash, i.e. a 12-character hexadecimal "
13070 "string."
13071 msgstr ""
13073 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
13074 #: ../en/ch11-template.xml:382
13075 msgid ""
13076 "<literal role=\"template-kw-filt-date\">shortdate</literal>: <literal role="
13077 "\"template-keyword\">date</literal> keyword. Render the year, month, and day "
13078 "of the date. Yields a string like <quote><literal>2006-09-04</literal></"
13079 "quote>."
13080 msgstr ""
13082 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
13083 #: ../en/ch11-template.xml:388
13084 msgid ""
13085 "<literal role=\"template-filter\">strip</literal>: Any text. Strip all "
13086 "leading and trailing whitespace from the string."
13087 msgstr ""
13089 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
13090 #: ../en/ch11-template.xml:392
13091 msgid ""
13092 "<literal role=\"template-filter\">tabindent</literal>: Any text. Yield the "
13093 "text, with every line except the first starting with a tab character."
13094 msgstr ""
13096 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
13097 #: ../en/ch11-template.xml:397
13098 msgid ""
13099 "<literal role=\"template-filter\">urlescape</literal>: Any text. Escape all "
13100 "characters that are considered <quote>special</quote> by URL parsers. For "
13101 "example, <literal>foo bar</literal> becomes <literal>foo%20bar</literal>."
13102 msgstr ""
13104 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
13105 #: ../en/ch11-template.xml:404
13106 msgid ""
13107 "<literal role=\"template-kw-filt-author\">user</literal>: Any text, but most "
13108 "useful for the <literal role=\"template-keyword\">author</literal> keyword. "
13109 "Return the <quote>user</quote> portion of an email address. For example, "
13110 "<quote><literal>Bryan O'Sullivan &lt;bos@serpentine.com&gt;</literal></quote> "
13111 "becomes <quote><literal>bos</literal></quote>."
13112 msgstr ""
13114 #. type: Content of: <book><chapter><sect1><note><para>
13115 #: ../en/ch11-template.xml:417
13116 msgid ""
13117 "If you try to apply a filter to a piece of data that it cannot process, "
13118 "Mercurial will fail and print a Python exception. For example, trying to run "
13119 "the output of the <literal role=\"template-keyword\">desc</literal> keyword "
13120 "into the <literal role=\"template-kw-filt-date\">isodate</literal> filter is "
13121 "not a good idea."
13122 msgstr ""
13124 #. type: Content of: <book><chapter><sect1><sect2><title>
13125 #: ../en/ch11-template.xml:426
13126 msgid "Combining filters"
13127 msgstr "组合过滤器"
13129 #. type: Content of: <book><chapter><sect1><sect2><para>
13130 #: ../en/ch11-template.xml:428
13131 msgid ""
13132 "It is easy to combine filters to yield output in the form you would like. "
13133 "The following chain of filters tidies up a description, then makes sure that "
13134 "it fits cleanly into 68 columns, then indents it by a further 8 characters "
13135 "(at least on Unix-like systems, where a tab is conventionally 8 characters "
13136 "wide)."
13137 msgstr ""
13139 #. type: Content of: <book><chapter><sect1><sect2><para>
13140 #: ../en/ch11-template.xml:437
13141 msgid ""
13142 "Note the use of <quote><literal>\\t</literal></quote> (a tab character) in "
13143 "the template to force the first line to be indented; this is necessary since "
13144 "<literal role=\"template-keyword\">tabindent</literal> indents all lines "
13145 "<emphasis>except</emphasis> the first."
13146 msgstr ""
13148 #. type: Content of: <book><chapter><sect1><sect2><para>
13149 #: ../en/ch11-template.xml:443
13150 msgid ""
13151 "Keep in mind that the order of filters in a chain is significant. The first "
13152 "filter is applied to the result of the keyword; the second to the result of "
13153 "the first filter; and so on. For example, using <literal>fill68|tabindent</"
13154 "literal> gives very different results from <literal>tabindent|fill68</"
13155 "literal>."
13156 msgstr ""
13158 #. type: Content of: <book><chapter><sect1><title>
13159 #: ../en/ch11-template.xml:454
13160 msgid "From templates to styles"
13161 msgstr "从模版到样式"
13163 #. type: Content of: <book><chapter><sect1><para>
13164 #: ../en/ch11-template.xml:456
13165 msgid ""
13166 "A command line template provides a quick and simple way to format some "
13167 "output. Templates can become verbose, though, and it's useful to be able to "
13168 "give a template a name. A style file is a template with a name, stored in a "
13169 "file."
13170 msgstr ""
13172 #. type: Content of: <book><chapter><sect1><para>
13173 #: ../en/ch11-template.xml:461
13174 msgid ""
13175 "More than that, using a style file unlocks the power of Mercurial's "
13176 "templating engine in ways that are not possible using the command line "
13177 "<option role=\"hg-opt-log\">--template</option> option."
13178 msgstr ""
13180 #. type: Content of: <book><chapter><sect1><sect2><title>
13181 #: ../en/ch11-template.xml:467
13182 msgid "The simplest of style files"
13183 msgstr "最简单的样式文件"
13185 #. type: Content of: <book><chapter><sect1><sect2><para>
13186 #: ../en/ch11-template.xml:469
13187 msgid "Our simple style file contains just one line:"
13188 msgstr ""
13190 #. type: Content of: <book><chapter><sect1><sect2><para>
13191 #: ../en/ch11-template.xml:473
13192 msgid ""
13193 "This tells Mercurial, <quote>if you're printing a changeset, use the text on "
13194 "the right as the template</quote>."
13195 msgstr ""
13197 #. type: Content of: <book><chapter><sect1><sect2><title>
13198 #: ../en/ch11-template.xml:479
13199 msgid "Style file syntax"
13200 msgstr "样式文件语法"
13202 #. type: Content of: <book><chapter><sect1><sect2><para>
13203 #: ../en/ch11-template.xml:481
13204 msgid "The syntax rules for a style file are simple."
13205 msgstr ""
13207 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13208 #: ../en/ch11-template.xml:484
13209 msgid "The file is processed one line at a time."
13210 msgstr ""
13212 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13213 #: ../en/ch11-template.xml:487
13214 msgid "Leading and trailing white space are ignored."
13215 msgstr ""
13217 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13218 #: ../en/ch11-template.xml:490
13219 msgid "Empty lines are skipped."
13220 msgstr ""
13222 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13223 #: ../en/ch11-template.xml:492
13224 msgid ""
13225 "If a line starts with either of the characters <quote><literal>#</literal></"
13226 "quote> or <quote><literal>;</literal></quote>, the entire line is treated as "
13227 "a comment, and skipped as if empty."
13228 msgstr ""
13230 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13231 #: ../en/ch11-template.xml:497
13232 msgid ""
13233 "A line starts with a keyword. This must start with an alphabetic character "
13234 "or underscore, and can subsequently contain any alphanumeric character or "
13235 "underscore. (In regexp notation, a keyword must match <literal>[A-Za-z_][A-"
13236 "Za-z0-9_]*</literal>.)"
13237 msgstr ""
13239 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13240 #: ../en/ch11-template.xml:503
13241 msgid ""
13242 "The next element must be an <quote><literal>=</literal></quote> character, "
13243 "which can be preceded or followed by an arbitrary amount of white space."
13244 msgstr ""
13246 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13247 #: ../en/ch11-template.xml:508
13248 msgid ""
13249 "If the rest of the line starts and ends with matching quote characters "
13250 "(either single or double quote), it is treated as a template body."
13251 msgstr ""
13253 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13254 #: ../en/ch11-template.xml:512
13255 msgid ""
13256 "If the rest of the line <emphasis>does not</emphasis> start with a quote "
13257 "character, it is treated as the name of a file; the contents of this file "
13258 "will be read and used as a template body."
13259 msgstr ""
13261 #. type: Content of: <book><chapter><sect1><title>
13262 #: ../en/ch11-template.xml:521
13263 msgid "Style files by example"
13264 msgstr "样式文件例子"
13266 #. type: Content of: <book><chapter><sect1><para>
13267 #: ../en/ch11-template.xml:523
13268 msgid ""
13269 "To illustrate how to write a style file, we will construct a few by example. "
13270 "Rather than provide a complete style file and walk through it, we'll mirror "
13271 "the usual process of developing a style file by starting with something very "
13272 "simple, and walking through a series of successively more complete examples."
13273 msgstr ""
13275 #. type: Content of: <book><chapter><sect1><sect2><title>
13276 #: ../en/ch11-template.xml:530
13277 msgid "Identifying mistakes in style files"
13278 msgstr "在样式文件中定位错误"
13280 #. type: Content of: <book><chapter><sect1><sect2><para>
13281 #: ../en/ch11-template.xml:532
13282 msgid ""
13283 "If Mercurial encounters a problem in a style file you are working on, it "
13284 "prints a terse error message that, once you figure out what it means, is "
13285 "actually quite useful."
13286 msgstr ""
13288 #. type: Content of: <book><chapter><sect1><sect2><para>
13289 #: ../en/ch11-template.xml:538
13290 msgid ""
13291 "Notice that <filename>broken.style</filename> attempts to define a "
13292 "<literal>changeset</literal> keyword, but forgets to give any content for it. "
13293 "When instructed to use this style file, Mercurial promptly complains."
13294 msgstr ""
13296 #. type: Content of: <book><chapter><sect1><sect2><para>
13297 #: ../en/ch11-template.xml:545
13298 msgid "This error message looks intimidating, but it is not too hard to follow."
13299 msgstr ""
13301 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13302 #: ../en/ch11-template.xml:549
13303 msgid ""
13304 "The first component is simply Mercurial's way of saying <quote>I am giving "
13305 "up</quote>."
13306 msgstr ""
13308 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13309 #: ../en/ch11-template.xml:554
13310 msgid "Next comes the name of the style file that contains the error."
13311 msgstr ""
13313 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13314 #: ../en/ch11-template.xml:560
13315 msgid ""
13316 "Following the file name is the line number where the error was encountered."
13317 msgstr ""
13319 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13320 #: ../en/ch11-template.xml:565
13321 msgid "Finally, a description of what went wrong."
13322 msgstr ""
13324 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13325 #: ../en/ch11-template.xml:570
13326 msgid ""
13327 "The description of the problem is not always clear (as in this case), but "
13328 "even when it is cryptic, it is almost always trivial to visually inspect the "
13329 "offending line in the style file and see what is wrong."
13330 msgstr ""
13332 #. type: Content of: <book><chapter><sect1><sect2><title>
13333 #: ../en/ch11-template.xml:578
13334 msgid "Uniquely identifying a repository"
13335 msgstr "版本库的唯一标识"
13337 #. type: Content of: <book><chapter><sect1><sect2><para>
13338 #: ../en/ch11-template.xml:580
13339 msgid ""
13340 "If you would like to be able to identify a Mercurial repository <quote>fairly "
13341 "uniquely</quote> using a short string as an identifier, you can use the first "
13342 "revision in the repository."
13343 msgstr ""
13345 #. type: Content of: <book><chapter><sect1><sect2><para>
13346 #: ../en/ch11-template.xml:587
13347 msgid ""
13348 "This is not guaranteed to be unique, but it is nevertheless useful in many "
13349 "cases."
13350 msgstr ""
13352 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13353 #: ../en/ch11-template.xml:590
13354 msgid ""
13355 "It will not work in a completely empty repository, because such a repository "
13356 "does not have a revision zero."
13357 msgstr ""
13359 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13360 #: ../en/ch11-template.xml:594
13361 msgid ""
13362 "Neither will it work in the (extremely rare) case where a repository is a "
13363 "merge of two or more formerly independent repositories, and you still have "
13364 "those repositories around."
13365 msgstr ""
13367 #. type: Content of: <book><chapter><sect1><sect2><para>
13368 #: ../en/ch11-template.xml:599
13369 msgid "Here are some uses to which you could put this identifier:"
13370 msgstr ""
13372 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13373 #: ../en/ch11-template.xml:602
13374 msgid ""
13375 "As a key into a table for a database that manages repositories on a server."
13376 msgstr ""
13378 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13379 #: ../en/ch11-template.xml:605
13380 msgid ""
13381 "As half of a {<emphasis>repository ID</emphasis>, <emphasis>revision ID</"
13382 "emphasis>} tuple. Save this information away when you run an automated build "
13383 "or other activity, so that you can <quote>replay</quote> the build later if "
13384 "necessary."
13385 msgstr ""
13387 #. type: Content of: <book><chapter><sect1><sect2><title>
13388 #: ../en/ch11-template.xml:614
13389 msgid "Mimicking Subversion's output"
13390 msgstr "模仿 Subversion 的输出"
13393 #. type: Content of: <book><chapter><sect1><sect2><para>
13394 #: ../en/ch11-template.xml:616
13395 msgid ""
13396 "Let's try to emulate the default output format used by another revision "
13397 "control tool, Subversion."
13398 msgstr ""
13401 #. type: Content of: <book><chapter><sect1><sect2><para>
13402 #: ../en/ch11-template.xml:621
13403 msgid ""
13404 "Since Subversion's output style is fairly simple, it is easy to copy-and-"
13405 "paste a hunk of its output into a file, and replace the text produced above "
13406 "by Subversion with the template values we'd like to see expanded."
13407 msgstr ""
13409 #. type: Content of: <book><chapter><sect1><sect2><para>
13410 #: ../en/ch11-template.xml:628
13411 msgid ""
13412 "There are a few small ways in which this template deviates from the output "
13413 "produced by Subversion."
13414 msgstr ""
13416 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13417 #: ../en/ch11-template.xml:631
13418 msgid ""
13419 "Subversion prints a <quote>readable</quote> date (the <quote><literal>Wed, 27 "
13420 "Sep 2006</literal></quote> in the example output above) in parentheses. "
13421 "Mercurial's templating engine does not provide a way to display a date in "
13422 "this format without also printing the time and time zone."
13423 msgstr ""
13425 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13426 #: ../en/ch11-template.xml:638
13427 msgid ""
13428 "We emulate Subversion's printing of <quote>separator</quote> lines full of "
13429 "<quote><literal>-</literal></quote> characters by ending the template with "
13430 "such a line. We use the templating engine's <literal role=\"template-keyword"
13431 "\">header</literal> keyword to print a separator line as the first line of "
13432 "output (see below), thus achieving similar output to Subversion."
13433 msgstr ""
13435 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13436 #: ../en/ch11-template.xml:647
13437 msgid ""
13438 "Subversion's output includes a count in the header of the number of lines in "
13439 "the commit message. We cannot replicate this in Mercurial; the templating "
13440 "engine does not currently provide a filter that counts the number of lines "
13441 "the template generates."
13442 msgstr ""
13445 #. type: Content of: <book><chapter><sect1><sect2><para>
13446 #: ../en/ch11-template.xml:653
13447 msgid ""
13448 "It took me no more than a minute or two of work to replace literal text from "
13449 "an example of Subversion's output with some keywords and filters to give the "
13450 "template above. The style file simply refers to the template."
13451 msgstr ""
13453 #. type: Content of: <book><chapter><sect1><sect2><para>
13454 #: ../en/ch11-template.xml:660
13455 msgid ""
13456 "We could have included the text of the template file directly in the style "
13457 "file by enclosing it in quotes and replacing the newlines with "
13458 "<quote><literal>\\n</literal></quote> sequences, but it would have made the "
13459 "style file too difficult to read. Readability is a good guide when you're "
13460 "trying to decide whether some text belongs in a style file, or in a template "
13461 "file that the style file points to. If the style file will look too big or "
13462 "cluttered if you insert a literal piece of text, drop it into a template "
13463 "instead."
13464 msgstr ""
13466 #. type: Content of: <book><chapter><title>
13467 #: ../en/ch12-mq.xml:5
13468 msgid "Managing change with Mercurial Queues"
13469 msgstr "使用 MQ 管理修改"
13471 #. type: Content of: <book><chapter><sect1><title>
13472 #: ../en/ch12-mq.xml:8
13473 msgid "The patch management problem"
13474 msgstr "补丁的管理问题"
13476 #. type: Content of: <book><chapter><sect1><para>
13477 #: ../en/ch12-mq.xml:10
13478 msgid ""
13479 "Here is a common scenario: you need to install a software package from "
13480 "source, but you find a bug that you must fix in the source before you can "
13481 "start using the package. You make your changes, forget about the package for "
13482 "a while, and a few months later you need to upgrade to a newer version of the "
13483 "package. If the newer version of the package still has the bug, you must "
13484 "extract your fix from the older source tree and apply it against the newer "
13485 "version. This is a tedious task, and it's easy to make mistakes."
13486 msgstr ""
13488 #. type: Content of: <book><chapter><sect1><para>
13489 #: ../en/ch12-mq.xml:20
13490 msgid ""
13491 "This is a simple case of the <quote>patch management</quote> problem. You "
13492 "have an <quote>upstream</quote> source tree that you can't change; you need "
13493 "to make some local changes on top of the upstream tree; and you'd like to be "
13494 "able to keep those changes separate, so that you can apply them to newer "
13495 "versions of the upstream source."
13496 msgstr ""
13498 #. type: Content of: <book><chapter><sect1><para>
13499 #: ../en/ch12-mq.xml:27
13500 msgid ""
13501 "The patch management problem arises in many situations. Probably the most "
13502 "visible is that a user of an open source software project will contribute a "
13503 "bug fix or new feature to the project's maintainers in the form of a patch."
13504 msgstr ""
13506 #. type: Content of: <book><chapter><sect1><para>
13507 #: ../en/ch12-mq.xml:32
13508 msgid ""
13509 "Distributors of operating systems that include open source software often "
13510 "need to make changes to the packages they distribute so that they will build "
13511 "properly in their environments."
13512 msgstr ""
13514 #. type: Content of: <book><chapter><sect1><para>
13515 #: ../en/ch12-mq.xml:37
13516 msgid ""
13517 "When you have few changes to maintain, it is easy to manage a single patch "
13518 "using the standard <command>diff</command> and <command>patch</command> "
13519 "programs (see section <xref linkend=\"sec.mq.patch\"/> for a discussion of "
13520 "these tools). Once the number of changes grows, it starts to make sense to "
13521 "maintain patches as discrete <quote>chunks of work,</quote> so that for "
13522 "example a single patch will contain only one bug fix (the patch might modify "
13523 "several files, but it's doing <quote>only one thing</quote>), and you may "
13524 "have a number of such patches for different bugs you need fixed and local "
13525 "changes you require. In this situation, if you submit a bug fix patch to the "
13526 "upstream maintainers of a package and they include your fix in a subsequent "
13527 "release, you can simply drop that single patch when you're updating to the "
13528 "newer release."
13529 msgstr ""
13531 #. type: Content of: <book><chapter><sect1><para>
13532 #: ../en/ch12-mq.xml:52
13533 msgid ""
13534 "Maintaining a single patch against an upstream tree is a little tedious and "
13535 "error-prone, but not difficult. However, the complexity of the problem grows "
13536 "rapidly as the number of patches you have to maintain increases. With more "
13537 "than a tiny number of patches in hand, understanding which ones you have "
13538 "applied and maintaining them moves from messy to overwhelming."
13539 msgstr ""
13541 #. type: Content of: <book><chapter><sect1><para>
13542 #: ../en/ch12-mq.xml:59
13543 msgid ""
13544 "Fortunately, Mercurial includes a powerful extension, Mercurial Queues (or "
13545 "simply <quote>MQ</quote>), that massively simplifies the patch management "
13546 "problem."
13547 msgstr ""
13549 #. type: Content of: <book><chapter><sect1><title>
13550 #: ../en/ch12-mq.xml:65
13551 msgid "The prehistory of Mercurial Queues"
13552 msgstr "MQ 的历史"
13554 #. type: Content of: <book><chapter><sect1><para>
13555 #: ../en/ch12-mq.xml:67
13556 msgid ""
13557 "During the late 1990s, several Linux kernel developers started to maintain "
13558 "<quote>patch series</quote> that modified the behaviour of the Linux kernel. "
13559 "Some of these series were focused on stability, some on feature coverage, and "
13560 "others were more speculative."
13561 msgstr ""
13563 #. type: Content of: <book><chapter><sect1><para>
13564 #: ../en/ch12-mq.xml:73
13565 msgid ""
13566 "The sizes of these patch series grew rapidly. In 2002, Andrew Morton "
13567 "published some shell scripts he had been using to automate the task of "
13568 "managing his patch queues. Andrew was successfully using these scripts to "
13569 "manage hundreds (sometimes thousands) of patches on top of the Linux kernel."
13570 msgstr ""
13572 #. type: Content of: <book><chapter><sect1><sect2><title>
13573 #: ../en/ch12-mq.xml:80
13574 msgid "A patchwork quilt"
13575 msgstr ""
13577 #. type: Content of: <book><chapter><sect1><sect2><para>
13578 #: ../en/ch12-mq.xml:82
13579 msgid ""
13580 "In early 2003, Andreas Gruenbacher and Martin Quinson borrowed the approach "
13581 "of Andrew's scripts and published a tool called <quote>patchwork quilt</"
13582 "quote> <citation>web:quilt</citation>, or simply <quote>quilt</quote> (see "
13583 "<citation>gruenbacher:2005</citation> for a paper describing it). Because "
13584 "quilt substantially automated patch management, it rapidly gained a large "
13585 "following among open source software developers."
13586 msgstr ""
13588 #. type: Content of: <book><chapter><sect1><sect2><para>
13589 #: ../en/ch12-mq.xml:91
13590 msgid ""
13591 "Quilt manages a <emphasis>stack of patches</emphasis> on top of a directory "
13592 "tree. To begin, you tell quilt to manage a directory tree, and tell it which "
13593 "files you want to manage; it stores away the names and contents of those "
13594 "files. To fix a bug, you create a new patch (using a single command), edit "
13595 "the files you need to fix, then <quote>refresh</quote> the patch."
13596 msgstr ""
13598 #. type: Content of: <book><chapter><sect1><sect2><para>
13599 #: ../en/ch12-mq.xml:99
13600 msgid ""
13601 "The refresh step causes quilt to scan the directory tree; it updates the "
13602 "patch with all of the changes you have made. You can create another patch on "
13603 "top of the first, which will track the changes required to modify the tree "
13604 "from <quote>tree with one patch applied</quote> to <quote>tree with two "
13605 "patches applied</quote>."
13606 msgstr ""
13608 #. type: Content of: <book><chapter><sect1><sect2><para>
13609 #: ../en/ch12-mq.xml:106
13610 msgid ""
13611 "You can <emphasis>change</emphasis> which patches are applied to the tree. "
13612 "If you <quote>pop</quote> a patch, the changes made by that patch will vanish "
13613 "from the directory tree. Quilt remembers which patches you have popped, "
13614 "though, so you can <quote>push</quote> a popped patch again, and the "
13615 "directory tree will be restored to contain the modifications in the patch. "
13616 "Most importantly, you can run the <quote>refresh</quote> command at any time, "
13617 "and the topmost applied patch will be updated. This means that you can, at "
13618 "any time, change both which patches are applied and what modifications those "
13619 "patches make."
13620 msgstr ""
13622 #. type: Content of: <book><chapter><sect1><sect2><para>
13623 #: ../en/ch12-mq.xml:118
13624 msgid ""
13625 "Quilt knows nothing about revision control tools, so it works equally well on "
13626 "top of an unpacked tarball or a Subversion working copy."
13627 msgstr ""
13629 #. type: Content of: <book><chapter><sect1><sect2><title>
13630 #: ../en/ch12-mq.xml:124
13631 msgid "From patchwork quilt to Mercurial Queues"
13632 msgstr "从 patchwork quilt 到 MQ"
13634 #. type: Content of: <book><chapter><sect1><sect2><para>
13635 #: ../en/ch12-mq.xml:126
13636 msgid ""
13637 "In mid-2005, Chris Mason took the features of quilt and wrote an extension "
13638 "that he called Mercurial Queues, which added quilt-like behaviour to "
13639 "Mercurial."
13640 msgstr ""
13642 #. type: Content of: <book><chapter><sect1><sect2><para>
13643 #: ../en/ch12-mq.xml:130
13644 msgid ""
13645 "The key difference between quilt and MQ is that quilt knows nothing about "
13646 "revision control systems, while MQ is <emphasis>integrated</emphasis> into "
13647 "Mercurial. Each patch that you push is represented as a Mercurial "
13648 "changeset. Pop a patch, and the changeset goes away."
13649 msgstr ""
13651 #. type: Content of: <book><chapter><sect1><sect2><para>
13652 #: ../en/ch12-mq.xml:136
13653 msgid ""
13654 "Because quilt does not care about revision control tools, it is still a "
13655 "tremendously useful piece of software to know about for situations where you "
13656 "cannot use Mercurial and MQ."
13657 msgstr ""
13659 #. type: Content of: <book><chapter><sect1><title>
13660 #: ../en/ch12-mq.xml:144
13661 msgid "The huge advantage of MQ"
13662 msgstr "MQ 的巨大优势"
13664 #. type: Content of: <book><chapter><sect1><para>
13665 #: ../en/ch12-mq.xml:146
13666 msgid ""
13667 "I cannot overstate the value that MQ offers through the unification of "
13668 "patches and revision control."
13669 msgstr ""
13671 #. type: Content of: <book><chapter><sect1><para>
13672 #: ../en/ch12-mq.xml:149
13673 msgid ""
13674 "A major reason that patches have persisted in the free software and open "
13675 "source world&emdash;in spite of the availability of increasingly capable "
13676 "revision control tools over the years&emdash;is the <emphasis>agility</"
13677 "emphasis> they offer."
13678 msgstr ""
13680 #. type: Content of: <book><chapter><sect1><para>
13681 #: ../en/ch12-mq.xml:155
13682 msgid ""
13683 "Traditional revision control tools make a permanent, irreversible record of "
13684 "everything that you do. While this has great value, it's also somewhat "
13685 "stifling. If you want to perform a wild-eyed experiment, you have to be "
13686 "careful in how you go about it, or you risk leaving unneeded&emdash;or worse, "
13687 "misleading or destabilising&emdash;traces of your missteps and errors in the "
13688 "permanent revision record."
13689 msgstr ""
13691 #. type: Content of: <book><chapter><sect1><para>
13692 #: ../en/ch12-mq.xml:163
13693 msgid ""
13694 "By contrast, MQ's marriage of distributed revision control with patches makes "
13695 "it much easier to isolate your work. Your patches live on top of normal "
13696 "revision history, and you can make them disappear or reappear at will. If "
13697 "you don't like a patch, you can drop it. If a patch isn't quite as you want "
13698 "it to be, simply fix it&emdash;as many times as you need to, until you have "
13699 "refined it into the form you desire."
13700 msgstr ""
13702 #. type: Content of: <book><chapter><sect1><para>
13703 #: ../en/ch12-mq.xml:171
13704 msgid ""
13705 "As an example, the integration of patches with revision control makes "
13706 "understanding patches and debugging their effects&emdash;and their interplay "
13707 "with the code they're based on&emdash;<emphasis>enormously</emphasis> easier. "
13708 "Since every applied patch has an associated changeset, you can give <command "
13709 "role=\"hg-cmd\">hg log</command> a file name to see which changesets and "
13710 "patches affected the file. You can use the <command role=\"hg-cmd\">hg "
13711 "bisect</command> command to binary-search through all changesets and applied "
13712 "patches to see where a bug got introduced or fixed. You can use the <command "
13713 "role=\"hg-cmd\">hg annotate</command> command to see which changeset or patch "
13714 "modified a particular line of a source file. And so on."
13715 msgstr ""
13717 #. type: Content of: <book><chapter><sect1><title>
13718 #: ../en/ch12-mq.xml:187
13719 msgid "Understanding patches"
13720 msgstr "理解补丁"
13722 #. type: Content of: <book><chapter><sect1><para>
13723 #: ../en/ch12-mq.xml:189
13724 msgid ""
13725 "Because MQ doesn't hide its patch-oriented nature, it is helpful to "
13726 "understand what patches are, and a little about the tools that work with them."
13727 msgstr ""
13729 #. type: Content of: <book><chapter><sect1><para>
13730 #: ../en/ch12-mq.xml:193
13731 msgid ""
13732 "The traditional Unix <command>diff</command> command compares two files, and "
13733 "prints a list of differences between them. The <command>patch</command> "
13734 "command understands these differences as <emphasis>modifications</emphasis> "
13735 "to make to a file. Take a look below for a simple example of these commands "
13736 "in action."
13737 msgstr ""
13739 #. type: Content of: <book><chapter><sect1><para>
13740 #: ../en/ch12-mq.xml:202
13741 msgid ""
13742 "The type of file that <command>diff</command> generates (and <command>patch</"
13743 "command> takes as input) is called a <quote>patch</quote> or a <quote>diff</"
13744 "quote>; there is no difference between a patch and a diff. (We'll use the "
13745 "term <quote>patch</quote>, since it's more commonly used.)"
13746 msgstr ""
13748 #. type: Content of: <book><chapter><sect1><para>
13749 #: ../en/ch12-mq.xml:208
13750 msgid ""
13751 "A patch file can start with arbitrary text; the <command>patch</command> "
13752 "command ignores this text, but MQ uses it as the commit message when creating "
13753 "changesets. To find the beginning of the patch content, <command>patch</"
13754 "command> searches for the first line that starts with the string "
13755 "<quote><literal>diff -</literal></quote>."
13756 msgstr ""
13758 #. type: Content of: <book><chapter><sect1><para>
13759 #: ../en/ch12-mq.xml:215
13760 msgid ""
13761 "MQ works with <emphasis>unified</emphasis> diffs (<command>patch</command> "
13762 "can accept several other diff formats, but MQ doesn't). A unified diff "
13763 "contains two kinds of header. The <emphasis>file header</emphasis> describes "
13764 "the file being modified; it contains the name of the file to modify. When "
13765 "<command>patch</command> sees a new file header, it looks for a file with "
13766 "that name to start modifying."
13767 msgstr ""
13769 #. type: Content of: <book><chapter><sect1><para>
13770 #: ../en/ch12-mq.xml:223
13771 msgid ""
13772 "After the file header comes a series of <emphasis>hunks</emphasis>. Each "
13773 "hunk starts with a header; this identifies the range of line numbers within "
13774 "the file that the hunk should modify. Following the header, a hunk starts "
13775 "and ends with a few (usually three) lines of text from the unmodified file; "
13776 "these are called the <emphasis>context</emphasis> for the hunk. If there's "
13777 "only a small amount of context between successive hunks, <command>diff</"
13778 "command> doesn't print a new hunk header; it just runs the hunks together, "
13779 "with a few lines of context between modifications."
13780 msgstr ""
13782 #. type: Content of: <book><chapter><sect1><para>
13783 #: ../en/ch12-mq.xml:235
13784 msgid ""
13785 "Each line of context begins with a space character. Within the hunk, a line "
13786 "that begins with <quote><literal>-</literal></quote> means <quote>remove this "
13787 "line,</quote> while a line that begins with <quote><literal>+</literal></"
13788 "quote> means <quote>insert this line.</quote> For example, a line that is "
13789 "modified is represented by one deletion and one insertion."
13790 msgstr ""
13792 #. type: Content of: <book><chapter><sect1><para>
13793 #: ../en/ch12-mq.xml:243
13794 msgid ""
13795 "We will return to some of the more subtle aspects of patches later (in "
13796 "section <xref linkend=\"sec.mq.adv-patch\"/>), but you should have enough "
13797 "information now to use MQ."
13798 msgstr ""
13800 #. type: Content of: <book><chapter><sect1><title>
13801 #: ../en/ch12-mq.xml:250
13802 msgid "Getting started with Mercurial Queues"
13803 msgstr "开始使用 MQ"
13805 #. type: Content of: <book><chapter><sect1><para>
13806 #: ../en/ch12-mq.xml:252
13807 msgid ""
13808 "Because MQ is implemented as an extension, you must explicitly enable before "
13809 "you can use it. (You don't need to download anything; MQ ships with the "
13810 "standard Mercurial distribution.) To enable MQ, edit your <filename role="
13811 "\"home\">~/.hgrc</filename> file, and add the lines below."
13812 msgstr ""
13814 #. type: Content of: <book><chapter><sect1><para>
13815 #: ../en/ch12-mq.xml:261
13816 msgid ""
13817 "Once the extension is enabled, it will make a number of new commands "
13818 "available. To verify that the extension is working, you can use <command "
13819 "role=\"hg-cmd\">hg help</command> to see if the <command role=\"hg-ext-mq"
13820 "\">qinit</command> command is now available."
13821 msgstr ""
13823 #. type: Content of: <book><chapter><sect1><para>
13824 #: ../en/ch12-mq.xml:269
13825 msgid ""
13826 "You can use MQ with <emphasis>any</emphasis> Mercurial repository, and its "
13827 "commands only operate within that repository. To get started, simply prepare "
13828 "the repository using the <command role=\"hg-ext-mq\">qinit</command> command."
13829 msgstr ""
13831 #. type: Content of: <book><chapter><sect1><para>
13832 #: ../en/ch12-mq.xml:276
13833 msgid ""
13834 "This command creates an empty directory called <filename role=\"special\" "
13835 "class=\"directory\">.hg/patches</filename>, where MQ will keep its metadata. "
13836 "As with many Mercurial commands, the <command role=\"hg-ext-mq\">qinit</"
13837 "command> command prints nothing if it succeeds."
13838 msgstr ""
13840 #. type: Content of: <book><chapter><sect1><sect2><title>
13841 #: ../en/ch12-mq.xml:283
13842 msgid "Creating a new patch"
13843 msgstr "创建新补丁"
13845 #. type: Content of: <book><chapter><sect1><sect2><para>
13846 #: ../en/ch12-mq.xml:285
13847 msgid ""
13848 "To begin work on a new patch, use the <command role=\"hg-ext-mq\">qnew</"
13849 "command> command. This command takes one argument, the name of the patch to "
13850 "create."
13851 msgstr ""
13853 #. type: Content of: <book><chapter><sect1><sect2><para>
13854 #: ../en/ch12-mq.xml:289
13855 msgid ""
13856 "MQ will use this as the name of an actual file in the <filename role=\"special"
13857 "\" class=\"directory\">.hg/patches</filename> directory, as you can see below."
13858 msgstr ""
13860 #. type: Content of: <book><chapter><sect1><sect2><para>
13861 #: ../en/ch12-mq.xml:296
13862 msgid ""
13863 "Also newly present in the <filename role=\"special\" class=\"directory\">.hg/"
13864 "patches</filename> directory are two other files, <filename role=\"special"
13865 "\">series</filename> and <filename role=\"special\">status</filename>. The "
13866 "<filename role=\"special\">series</filename> file lists all of the patches "
13867 "that MQ knows about for this repository, with one patch per line. Mercurial "
13868 "uses the <filename role=\"special\">status</filename> file for internal book-"
13869 "keeping; it tracks all of the patches that MQ has <emphasis>applied</"
13870 "emphasis> in this repository."
13871 msgstr ""
13873 #. type: Content of: <book><chapter><sect1><sect2><note><para>
13874 #: ../en/ch12-mq.xml:308
13875 msgid ""
13876 "You may sometimes want to edit the <filename role=\"special\">series</"
13877 "filename> file by hand; for example, to change the sequence in which some "
13878 "patches are applied. However, manually editing the <filename role=\"special"
13879 "\">status</filename> file is almost always a bad idea, as it's easy to "
13880 "corrupt MQ's idea of what is happening."
13881 msgstr ""
13883 #. type: Content of: <book><chapter><sect1><sect2><para>
13884 #: ../en/ch12-mq.xml:317
13885 msgid ""
13886 "Once you have created your new patch, you can edit files in the working "
13887 "directory as you usually would. All of the normal Mercurial commands, such "
13888 "as <command role=\"hg-cmd\">hg diff</command> and <command role=\"hg-cmd\">hg "
13889 "annotate</command>, work exactly as they did before."
13890 msgstr ""
13892 #. type: Content of: <book><chapter><sect1><sect2><title>
13893 #: ../en/ch12-mq.xml:325
13894 msgid "Refreshing a patch"
13895 msgstr "刷新补丁"
13897 #. type: Content of: <book><chapter><sect1><sect2><para>
13898 #: ../en/ch12-mq.xml:327
13899 msgid ""
13900 "When you reach a point where you want to save your work, use the <command "
13901 "role=\"hg-ext-mq\">qrefresh</command> command to update the patch you are "
13902 "working on."
13903 msgstr ""
13905 #. type: Content of: <book><chapter><sect1><sect2><para>
13906 #: ../en/ch12-mq.xml:333
13907 msgid ""
13908 "This command folds the changes you have made in the working directory into "
13909 "your patch, and updates its corresponding changeset to contain those changes."
13910 msgstr ""
13912 #. type: Content of: <book><chapter><sect1><sect2><para>
13913 #: ../en/ch12-mq.xml:337
13914 msgid ""
13915 "You can run <command role=\"hg-ext-mq\">qrefresh</command> as often as you "
13916 "like, so it's a good way to <quote>checkpoint</quote> your work. Refresh "
13917 "your patch at an opportune time; try an experiment; and if the experiment "
13918 "doesn't work out, <command role=\"hg-cmd\">hg revert</command> your "
13919 "modifications back to the last time you refreshed."
13920 msgstr ""
13922 #. type: Content of: <book><chapter><sect1><sect2><title>
13923 #: ../en/ch12-mq.xml:348
13924 msgid "Stacking and tracking patches"
13925 msgstr "堆叠和跟踪补丁"
13927 #. type: Content of: <book><chapter><sect1><sect2><para>
13928 #: ../en/ch12-mq.xml:350
13929 msgid ""
13930 "Once you have finished working on a patch, or need to work on another, you "
13931 "can use the <command role=\"hg-ext-mq\">qnew</command> command again to "
13932 "create a new patch. Mercurial will apply this patch on top of your existing "
13933 "patch."
13934 msgstr ""
13936 #. type: Content of: <book><chapter><sect1><sect2><para>
13937 #: ../en/ch12-mq.xml:357
13938 msgid ""
13939 "Notice that the patch contains the changes in our prior patch as part of its "
13940 "context (you can see this more clearly in the output of <command role=\"hg-cmd"
13941 "\">hg annotate</command>)."
13942 msgstr ""
13944 #. type: Content of: <book><chapter><sect1><sect2><para>
13945 #: ../en/ch12-mq.xml:362
13946 msgid ""
13947 "So far, with the exception of <command role=\"hg-ext-mq\">qnew</command> and "
13948 "<command role=\"hg-ext-mq\">qrefresh</command>, we've been careful to only "
13949 "use regular Mercurial commands. However, MQ provides many commands that are "
13950 "easier to use when you are thinking about patches, as illustrated below."
13951 msgstr ""
13953 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13954 #: ../en/ch12-mq.xml:372
13955 msgid ""
13956 "The <command role=\"hg-ext-mq\">qseries</command> command lists every patch "
13957 "that MQ knows about in this repository, from oldest to newest (most recently "
13958 "<emphasis>created</emphasis>)."
13959 msgstr ""
13961 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
13962 #: ../en/ch12-mq.xml:378
13963 msgid ""
13964 "The <command role=\"hg-ext-mq\">qapplied</command> command lists every patch "
13965 "that MQ has <emphasis>applied</emphasis> in this repository, again from "
13966 "oldest to newest (most recently applied)."
13967 msgstr ""
13969 #. type: Content of: <book><chapter><sect1><sect2><title>
13970 #: ../en/ch12-mq.xml:387
13971 msgid "Manipulating the patch stack"
13972 msgstr "操作补丁堆栈"
13974 #. type: Content of: <book><chapter><sect1><sect2><para>
13975 #: ../en/ch12-mq.xml:389
13976 msgid ""
13977 "The previous discussion implied that there must be a difference between "
13978 "<quote>known</quote> and <quote>applied</quote> patches, and there is. MQ "
13979 "can manage a patch without it being applied in the repository."
13980 msgstr ""
13982 #. type: Content of: <book><chapter><sect1><sect2><para>
13983 #: ../en/ch12-mq.xml:394
13984 msgid ""
13985 "An <emphasis>applied</emphasis> patch has a corresponding changeset in the "
13986 "repository, and the effects of the patch and changeset are visible in the "
13987 "working directory. You can undo the application of a patch using the "
13988 "<command role=\"hg-ext-mq\">qpop</command> command. MQ still <emphasis>knows "
13989 "about</emphasis>, or manages, a popped patch, but the patch no longer has a "
13990 "corresponding changeset in the repository, and the working directory does not "
13991 "contain the changes made by the patch. Figure <xref endterm=\"fig.mq.stack."
13992 "caption\" linkend=\"fig.mq.stack\"/> illustrates the difference between "
13993 "applied and tracked patches."
13994 msgstr ""
13996 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject>
13997 #: ../en/ch12-mq.xml:408
13998 msgid "<imageobject><imagedata fileref=\"images/mq-stack.png\"/></imageobject>"
13999 msgstr ""
14001 #. type: Content of: <book><chapter><sect1><sect2><informalfigure><mediaobject><caption><para>
14002 #: ../en/ch12-mq.xml:410
14003 msgid "Applied and unapplied patches in the MQ patch stack"
14004 msgstr ""
14006 #. type: Content of: <book><chapter><sect1><sect2><para>
14007 #: ../en/ch12-mq.xml:415
14008 msgid ""
14009 "You can reapply an unapplied, or popped, patch using the <command role=\"hg-"
14010 "ext-mq\">qpush</command> command. This creates a new changeset to correspond "
14011 "to the patch, and the patch's changes once again become present in the "
14012 "working directory. See below for examples of <command role=\"hg-ext-mq"
14013 "\">qpop</command> and <command role=\"hg-ext-mq\">qpush</command> in action."
14014 msgstr ""
14016 #. type: Content of: <book><chapter><sect1><sect2><para>
14017 #: ../en/ch12-mq.xml:424
14018 msgid ""
14019 "Notice that once we have popped a patch or two patches, the output of "
14020 "<command role=\"hg-ext-mq\">qseries</command> remains the same, while that of "
14021 "<command role=\"hg-ext-mq\">qapplied</command> has changed."
14022 msgstr ""
14024 #. type: Content of: <book><chapter><sect1><sect2><title>
14025 #: ../en/ch12-mq.xml:432
14026 msgid "Pushing and popping many patches"
14027 msgstr "压入或弹出多个补丁"
14029 #. type: Content of: <book><chapter><sect1><sect2><para>
14030 #: ../en/ch12-mq.xml:434
14031 msgid ""
14032 "While <command role=\"hg-ext-mq\">qpush</command> and <command role=\"hg-ext-"
14033 "mq\">qpop</command> each operate on a single patch at a time by default, you "
14034 "can push and pop many patches in one go. The <option role=\"hg-ext-mq-cmd-"
14035 "qpush-opt\">hg -a</option> option to <command role=\"hg-ext-mq\">qpush</"
14036 "command> causes it to push all unapplied patches, while the <option role=\"hg-"
14037 "ext-mq-cmd-qpop-opt\">-a</option> option to <command role=\"hg-ext-mq\">qpop</"
14038 "command> causes it to pop all applied patches. (For some more ways to push "
14039 "and pop many patches, see section <xref linkend=\"sec.mq.perf\"/> below.)"
14040 msgstr ""
14042 #. type: Content of: <book><chapter><sect1><sect2><title>
14043 #: ../en/ch12-mq.xml:451
14044 msgid "Safety checks, and overriding them"
14045 msgstr "安全的检查,然后覆盖它们"
14047 #. type: Content of: <book><chapter><sect1><sect2><para>
14048 #: ../en/ch12-mq.xml:453
14049 msgid ""
14050 "Several MQ commands check the working directory before they do anything, and "
14051 "fail if they find any modifications. They do this to ensure that you won't "
14052 "lose any changes that you have made, but not yet incorporated into a patch. "
14053 "The example below illustrates this; the <command role=\"hg-ext-mq\">qnew</"
14054 "command> command will not create a new patch if there are outstanding "
14055 "changes, caused in this case by the <command role=\"hg-cmd\">hg add</command> "
14056 "of <filename>file3</filename>."
14057 msgstr ""
14059 #. type: Content of: <book><chapter><sect1><sect2><para>
14060 #: ../en/ch12-mq.xml:465
14061 msgid ""
14062 "Commands that check the working directory all take an <quote>I know what I'm "
14063 "doing</quote> option, which is always named <option>-f</option>. The exact "
14064 "meaning of <option>-f</option> depends on the command. For example, <command "
14065 "role=\"hg-cmd\">hg qnew <option role=\"hg-ext-mq-cmd-qnew-opt\">hg -f</"
14066 "option></command> will incorporate any outstanding changes into the new patch "
14067 "it creates, but <command role=\"hg-cmd\">hg qpop <option role=\"hg-ext-mq-cmd-"
14068 "qpop-opt\">hg -f</option></command> will revert modifications to any files "
14069 "affected by the patch that it is popping. Be sure to read the documentation "
14070 "for a command's <option>-f</option> option before you use it!"
14071 msgstr ""
14073 #. type: Content of: <book><chapter><sect1><sect2><title>
14074 #: ../en/ch12-mq.xml:480
14075 msgid "Working on several patches at once"
14076 msgstr "同时处理多个补丁"
14078 #. type: Content of: <book><chapter><sect1><sect2><para>
14079 #: ../en/ch12-mq.xml:482
14080 msgid ""
14081 "The <command role=\"hg-ext-mq\">qrefresh</command> command always refreshes "
14082 "the <emphasis>topmost</emphasis> applied patch. This means that you can "
14083 "suspend work on one patch (by refreshing it), pop or push to make a different "
14084 "patch the top, and work on <emphasis>that</emphasis> patch for a while."
14085 msgstr ""
14087 #. type: Content of: <book><chapter><sect1><sect2><para>
14088 #: ../en/ch12-mq.xml:489
14089 msgid ""
14090 "Here's an example that illustrates how you can use this ability. Let's say "
14091 "you're developing a new feature as two patches. The first is a change to the "
14092 "core of your software, and the second&emdash;layered on top of the "
14093 "first&emdash;changes the user interface to use the code you just added to the "
14094 "core. If you notice a bug in the core while you're working on the UI patch, "
14095 "it's easy to fix the core. Simply <command role=\"hg-ext-mq\">qrefresh</"
14096 "command> the UI patch to save your in-progress changes, and <command role="
14097 "\"hg-ext-mq\">qpop</command> down to the core patch. Fix the core bug, "
14098 "<command role=\"hg-ext-mq\">qrefresh</command> the core patch, and <command "
14099 "role=\"hg-ext-mq\">qpush</command> back to the UI patch to continue where you "
14100 "left off."
14101 msgstr ""
14103 #. type: Content of: <book><chapter><sect1><title>
14104 #: ../en/ch12-mq.xml:506
14105 msgid "More about patches"
14106 msgstr "关于补丁的更多信息"
14108 #. type: Content of: <book><chapter><sect1><para>
14109 #: ../en/ch12-mq.xml:508
14110 msgid ""
14111 "MQ uses the GNU <command>patch</command> command to apply patches, so it's "
14112 "helpful to know a few more detailed aspects of how <command>patch</command> "
14113 "works, and about patches themselves."
14114 msgstr ""
14116 #. type: Content of: <book><chapter><sect1><sect2><title>
14117 #: ../en/ch12-mq.xml:514
14118 msgid "The strip count"
14119 msgstr "修剪计数"
14121 #. type: Content of: <book><chapter><sect1><sect2><para>
14122 #: ../en/ch12-mq.xml:516
14123 msgid ""
14124 "If you look at the file headers in a patch, you will notice that the "
14125 "pathnames usually have an extra component on the front that isn't present in "
14126 "the actual path name. This is a holdover from the way that people used to "
14127 "generate patches (people still do this, but it's somewhat rare with modern "
14128 "revision control tools)."
14129 msgstr ""
14131 #. type: Content of: <book><chapter><sect1><sect2><para>
14132 #: ../en/ch12-mq.xml:523
14133 msgid ""
14134 "Alice would unpack a tarball, edit her files, then decide that she wanted to "
14135 "create a patch. So she'd rename her working directory, unpack the tarball "
14136 "again (hence the need for the rename), and use the <option role=\"cmd-opt-diff"
14137 "\">-r</option> and <option role=\"cmd-opt-diff\">-N</option> options to "
14138 "<command>diff</command> to recursively generate a patch between the "
14139 "unmodified directory and the modified one. The result would be that the name "
14140 "of the unmodified directory would be at the front of the left-hand path in "
14141 "every file header, and the name of the modified directory would be at the "
14142 "front of the right-hand path."
14143 msgstr ""
14145 #. type: Content of: <book><chapter><sect1><sect2><para>
14146 #: ../en/ch12-mq.xml:536
14147 msgid ""
14148 "Since someone receiving a patch from the Alices of the net would be unlikely "
14149 "to have unmodified and modified directories with exactly the same names, the "
14150 "<command>patch</command> command has a <option role=\"cmd-opt-patch\">-p</"
14151 "option> option that indicates the number of leading path name components to "
14152 "strip when trying to apply a patch. This number is called the "
14153 "<emphasis>strip count</emphasis>."
14154 msgstr ""
14156 #. type: Content of: <book><chapter><sect1><sect2><para>
14157 #: ../en/ch12-mq.xml:544
14158 msgid ""
14159 "An option of <quote><literal>-p1</literal></quote> means <quote>use a strip "
14160 "count of one</quote>. If <command>patch</command> sees a file name "
14161 "<filename>foo/bar/baz</filename> in a file header, it will strip "
14162 "<filename>foo</filename> and try to patch a file named <filename>bar/baz</"
14163 "filename>. (Strictly speaking, the strip count refers to the number of "
14164 "<emphasis>path separators</emphasis> (and the components that go with them ) "
14165 "to strip. A strip count of one will turn <filename>foo/bar</filename> into "
14166 "<filename>bar</filename>, but <filename>/foo/bar</filename> (notice the extra "
14167 "leading slash) into <filename>foo/bar</filename>.)"
14168 msgstr ""
14170 #. type: Content of: <book><chapter><sect1><sect2><para>
14171 #: ../en/ch12-mq.xml:557
14172 msgid ""
14173 "The <quote>standard</quote> strip count for patches is one; almost all "
14174 "patches contain one leading path name component that needs to be stripped. "
14175 "Mercurial's <command role=\"hg-cmd\">hg diff</command> command generates path "
14176 "names in this form, and the <command role=\"hg-cmd\">hg import</command> "
14177 "command and MQ expect patches to have a strip count of one."
14178 msgstr ""
14180 #. type: Content of: <book><chapter><sect1><sect2><para>
14181 #: ../en/ch12-mq.xml:565
14182 msgid ""
14183 "If you receive a patch from someone that you want to add to your patch queue, "
14184 "and the patch needs a strip count other than one, you cannot just <command "
14185 "role=\"hg-ext-mq\">qimport</command> the patch, because <command role=\"hg-"
14186 "ext-mq\">qimport</command> does not yet have a <literal>-p</literal> option "
14187 "(see <ulink role=\"hg-bug\" url=\"http://www.selenic.com/mercurial/bts/"
14188 "issue311\">issue 311</ulink>). Your best bet is to <command role=\"hg-ext-mq"
14189 "\">qnew</command> a patch of your own, then use <command>patch -pN</command> "
14190 "to apply their patch, followed by <command role=\"hg-cmd\">hg addremove</"
14191 "command> to pick up any files added or removed by the patch, followed by "
14192 "<command role=\"hg-ext-mq\">hg qrefresh</command>. This complexity may become "
14193 "unnecessary; see <ulink role=\"hg-bug\" url=\"http://www.selenic.com/"
14194 "mercurial/bts/issue311\">issue 311</ulink> for details."
14195 msgstr ""
14197 #. type: Content of: <book><chapter><sect1><sect2><title>
14198 #: ../en/ch12-mq.xml:584
14199 msgid "Strategies for applying a patch"
14200 msgstr "应用补丁的策略"
14202 #. type: Content of: <book><chapter><sect1><sect2><para>
14203 #: ../en/ch12-mq.xml:586
14204 msgid ""
14205 "When <command>patch</command> applies a hunk, it tries a handful of "
14206 "successively less accurate strategies to try to make the hunk apply. This "
14207 "falling-back technique often makes it possible to take a patch that was "
14208 "generated against an old version of a file, and apply it against a newer "
14209 "version of that file."
14210 msgstr ""
14212 #. type: Content of: <book><chapter><sect1><sect2><para>
14213 #: ../en/ch12-mq.xml:593
14214 msgid ""
14215 "First, <command>patch</command> tries an exact match, where the line numbers, "
14216 "the context, and the text to be modified must apply exactly. If it cannot "
14217 "make an exact match, it tries to find an exact match for the context, without "
14218 "honouring the line numbering information. If this succeeds, it prints a line "
14219 "of output saying that the hunk was applied, but at some <emphasis>offset</"
14220 "emphasis> from the original line number."
14221 msgstr ""
14223 #. type: Content of: <book><chapter><sect1><sect2><para>
14224 #: ../en/ch12-mq.xml:602
14225 msgid ""
14226 "If a context-only match fails, <command>patch</command> removes the first and "
14227 "last lines of the context, and tries a <emphasis>reduced</emphasis> context-"
14228 "only match. If the hunk with reduced context succeeds, it prints a message "
14229 "saying that it applied the hunk with a <emphasis>fuzz factor</emphasis> (the "
14230 "number after the fuzz factor indicates how many lines of context "
14231 "<command>patch</command> had to trim before the patch applied)."
14232 msgstr ""
14234 #. type: Content of: <book><chapter><sect1><sect2><para>
14235 #: ../en/ch12-mq.xml:611
14236 msgid ""
14237 "When neither of these techniques works, <command>patch</command> prints a "
14238 "message saying that the hunk in question was rejected. It saves rejected "
14239 "hunks (also simply called <quote>rejects</quote>) to a file with the same "
14240 "name, and an added <filename role=\"special\">.rej</filename> extension. It "
14241 "also saves an unmodified copy of the file with a <filename role=\"special\">."
14242 "orig</filename> extension; the copy of the file without any extensions will "
14243 "contain any changes made by hunks that <emphasis>did</emphasis> apply "
14244 "cleanly. If you have a patch that modifies <filename>foo</filename> with six "
14245 "hunks, and one of them fails to apply, you will have: an unmodified "
14246 "<filename>foo.orig</filename>, a <filename>foo.rej</filename> containing one "
14247 "hunk, and <filename>foo</filename>, containing the changes made by the five "
14248 "successful hunks."
14249 msgstr ""
14251 #. type: Content of: <book><chapter><sect1><sect2><title>
14252 #: ../en/ch12-mq.xml:629
14253 msgid "Some quirks of patch representation"
14254 msgstr "补丁的一些特性"
14256 #. type: Content of: <book><chapter><sect1><sect2><para>
14257 #: ../en/ch12-mq.xml:631
14258 msgid ""
14259 "There are a few useful things to know about how <command>patch</command> "
14260 "works with files."
14261 msgstr ""
14263 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
14264 #: ../en/ch12-mq.xml:634
14265 msgid ""
14266 "This should already be obvious, but <command>patch</command> cannot handle "
14267 "binary files."
14268 msgstr ""
14270 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
14271 #: ../en/ch12-mq.xml:638
14272 msgid ""
14273 "Neither does it care about the executable bit; it creates new files as "
14274 "readable, but not executable."
14275 msgstr ""
14277 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
14278 #: ../en/ch12-mq.xml:642
14279 msgid ""
14280 "<command>patch</command> treats the removal of a file as a diff between the "
14281 "file to be removed and the empty file. So your idea of <quote>I deleted this "
14282 "file</quote> looks like <quote>every line of this file was deleted</quote> in "
14283 "a patch."
14284 msgstr ""
14286 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
14287 #: ../en/ch12-mq.xml:648
14288 msgid ""
14289 "It treats the addition of a file as a diff between the empty file and the "
14290 "file to be added. So in a patch, your idea of <quote>I added this file</"
14291 "quote> looks like <quote>every line of this file was added</quote>."
14292 msgstr ""
14294 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
14295 #: ../en/ch12-mq.xml:654
14296 msgid ""
14297 "It treats a renamed file as the removal of the old name, and the addition of "
14298 "the new name. This means that renamed files have a big footprint in "
14299 "patches. (Note also that Mercurial does not currently try to infer when "
14300 "files have been renamed or copied in a patch.)"
14301 msgstr ""
14303 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
14304 #: ../en/ch12-mq.xml:660
14305 msgid ""
14306 "<command>patch</command> cannot represent empty files, so you cannot use a "
14307 "patch to represent the notion <quote>I added this empty file to the tree</"
14308 "quote>."
14309 msgstr ""
14311 #. type: Content of: <book><chapter><sect1><sect2><title>
14312 #: ../en/ch12-mq.xml:667
14313 msgid "Beware the fuzz"
14314 msgstr "当心毛刺"
14316 #. type: Content of: <book><chapter><sect1><sect2><para>
14317 #: ../en/ch12-mq.xml:669
14318 msgid ""
14319 "While applying a hunk at an offset, or with a fuzz factor, will often be "
14320 "completely successful, these inexact techniques naturally leave open the "
14321 "possibility of corrupting the patched file. The most common cases typically "
14322 "involve applying a patch twice, or at an incorrect location in the file. If "
14323 "<command>patch</command> or <command role=\"hg-ext-mq\">qpush</command> ever "
14324 "mentions an offset or fuzz factor, you should make sure that the modified "
14325 "files are correct afterwards."
14326 msgstr ""
14328 #. type: Content of: <book><chapter><sect1><sect2><para>
14329 #: ../en/ch12-mq.xml:679
14330 msgid ""
14331 "It's often a good idea to refresh a patch that has applied with an offset or "
14332 "fuzz factor; refreshing the patch generates new context information that will "
14333 "make it apply cleanly. I say <quote>often,</quote> not <quote>always,</"
14334 "quote> because sometimes refreshing a patch will make it fail to apply "
14335 "against a different revision of the underlying files. In some cases, such as "
14336 "when you're maintaining a patch that must sit on top of multiple versions of "
14337 "a source tree, it's acceptable to have a patch apply with some fuzz, provided "
14338 "you've verified the results of the patching process in such cases."
14339 msgstr ""
14341 #. type: Content of: <book><chapter><sect1><sect2><title>
14342 #: ../en/ch12-mq.xml:692
14343 msgid "Handling rejection"
14344 msgstr "处理拒绝"
14346 #. type: Content of: <book><chapter><sect1><sect2><para>
14347 #: ../en/ch12-mq.xml:694
14348 msgid ""
14349 "If <command role=\"hg-ext-mq\">qpush</command> fails to apply a patch, it "
14350 "will print an error message and exit. If it has left <filename role=\"special"
14351 "\">.rej</filename> files behind, it is usually best to fix up the rejected "
14352 "hunks before you push more patches or do any further work."
14353 msgstr ""
14355 #. type: Content of: <book><chapter><sect1><sect2><para>
14356 #: ../en/ch12-mq.xml:700
14357 msgid ""
14358 "If your patch <emphasis>used to</emphasis> apply cleanly, and no longer does "
14359 "because you've changed the underlying code that your patches are based on, "
14360 "Mercurial Queues can help; see section <xref linkend=\"sec.mq.merge\"/> for "
14361 "details."
14362 msgstr ""
14364 #. type: Content of: <book><chapter><sect1><sect2><para>
14365 #: ../en/ch12-mq.xml:706
14366 msgid ""
14367 "Unfortunately, there aren't any great techniques for dealing with rejected "
14368 "hunks. Most often, you'll need to view the <filename role=\"special\">.rej</"
14369 "filename> file and edit the target file, applying the rejected hunks by hand."
14370 msgstr ""
14372 #. type: Content of: <book><chapter><sect1><sect2><para>
14373 #: ../en/ch12-mq.xml:711
14374 msgid ""
14375 "If you're feeling adventurous, Neil Brown, a Linux kernel hacker, wrote a "
14376 "tool called <command>wiggle</command> <citation>web:wiggle</citation>, which "
14377 "is more vigorous than <command>patch</command> in its attempts to make a "
14378 "patch apply."
14379 msgstr ""
14381 #. type: Content of: <book><chapter><sect1><sect2><para>
14382 #: ../en/ch12-mq.xml:717
14383 msgid ""
14384 "Another Linux kernel hacker, Chris Mason (the author of Mercurial Queues), "
14385 "wrote a similar tool called <command>mpatch</command> <citation>web:mpatch</"
14386 "citation>, which takes a simple approach to automating the application of "
14387 "hunks rejected by <command>patch</command>. The <command>mpatch</command> "
14388 "command can help with four common reasons that a hunk may be rejected:"
14389 msgstr ""
14391 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
14392 #: ../en/ch12-mq.xml:726
14393 msgid "The context in the middle of a hunk has changed."
14394 msgstr ""
14396 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
14397 #: ../en/ch12-mq.xml:729
14398 msgid "A hunk is missing some context at the beginning or end."
14399 msgstr ""
14401 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
14402 #: ../en/ch12-mq.xml:732
14403 msgid ""
14404 "A large hunk might apply better&emdash;either entirely or in part&emdash;if "
14405 "it was broken up into smaller hunks."
14406 msgstr ""
14408 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
14409 #: ../en/ch12-mq.xml:736
14410 msgid ""
14411 "A hunk removes lines with slightly different content than those currently "
14412 "present in the file."
14413 msgstr ""
14415 #. type: Content of: <book><chapter><sect1><sect2><para>
14416 #: ../en/ch12-mq.xml:740
14417 msgid ""
14418 "If you use <command>wiggle</command> or <command>mpatch</command>, you should "
14419 "be doubly careful to check your results when you're done. In fact, "
14420 "<command>mpatch</command> enforces this method of double-checking the tool's "
14421 "output, by automatically dropping you into a merge program when it has done "
14422 "its job, so that you can verify its work and finish off any remaining merges."
14423 msgstr ""
14425 #. type: Content of: <book><chapter><sect1><title>
14426 #: ../en/ch12-mq.xml:752
14427 msgid "Getting the best performance out of MQ"
14428 msgstr "MQ 的性能"
14430 #. type: Content of: <book><chapter><sect1><para>
14431 #: ../en/ch12-mq.xml:754
14432 msgid ""
14433 "MQ is very efficient at handling a large number of patches. I ran some "
14434 "performance experiments in mid-2006 for a talk that I gave at the 2006 "
14435 "EuroPython conference <citation>web:europython</citation>. I used as my data "
14436 "set the Linux 2.6.17-mm1 patch series, which consists of 1,738 patches. I "
14437 "applied these on top of a Linux kernel repository containing all 27,472 "
14438 "revisions between Linux 2.6.12-rc2 and Linux 2.6.17."
14439 msgstr ""
14441 #. type: Content of: <book><chapter><sect1><para>
14442 #: ../en/ch12-mq.xml:763
14443 msgid ""
14444 "On my old, slow laptop, I was able to <command role=\"hg-cmd\">hg qpush "
14445 "<option role=\"hg-ext-mq-cmd-qpush-opt\">hg -a</option></command> all 1,738 "
14446 "patches in 3.5 minutes, and <command role=\"hg-cmd\">hg qpop <option role="
14447 "\"hg-ext-mq-cmd-qpop-opt\">hg -a</option></command> them all in 30 seconds. "
14448 "(On a newer laptop, the time to push all patches dropped to two minutes.) I "
14449 "could <command role=\"hg-ext-mq\">qrefresh</command> one of the biggest "
14450 "patches (which made 22,779 lines of changes to 287 files) in 6.6 seconds."
14451 msgstr ""
14453 #. type: Content of: <book><chapter><sect1><para>
14454 #: ../en/ch12-mq.xml:774
14455 msgid ""
14456 "Clearly, MQ is well suited to working in large trees, but there are a few "
14457 "tricks you can use to get the best performance of it."
14458 msgstr ""
14460 #. type: Content of: <book><chapter><sect1><para>
14461 #: ../en/ch12-mq.xml:778
14462 msgid ""
14463 "First of all, try to <quote>batch</quote> operations together. Every time "
14464 "you run <command role=\"hg-ext-mq\">qpush</command> or <command role=\"hg-ext-"
14465 "mq\">qpop</command>, these commands scan the working directory once to make "
14466 "sure you haven't made some changes and then forgotten to run <command role="
14467 "\"hg-ext-mq\">qrefresh</command>. On a small tree, the time that this scan "
14468 "takes is unnoticeable. However, on a medium-sized tree (containing tens of "
14469 "thousands of files), it can take a second or more."
14470 msgstr ""
14472 #. type: Content of: <book><chapter><sect1><para>
14473 #: ../en/ch12-mq.xml:789
14474 msgid ""
14475 "The <command role=\"hg-ext-mq\">qpush</command> and <command role=\"hg-ext-mq"
14476 "\">qpop</command> commands allow you to push and pop multiple patches at a "
14477 "time. You can identify the <quote>destination patch</quote> that you want to "
14478 "end up at. When you <command role=\"hg-ext-mq\">qpush</command> with a "
14479 "destination specified, it will push patches until that patch is at the top of "
14480 "the applied stack. When you <command role=\"hg-ext-mq\">qpop</command> to a "
14481 "destination, MQ will pop patches until the destination patch is at the top."
14482 msgstr ""
14484 #. type: Content of: <book><chapter><sect1><para>
14485 #: ../en/ch12-mq.xml:799
14486 msgid ""
14487 "You can identify a destination patch using either the name of the patch, or "
14488 "by number. If you use numeric addressing, patches are counted from zero; "
14489 "this means that the first patch is zero, the second is one, and so on."
14490 msgstr ""
14492 #. type: Content of: <book><chapter><sect1><title>
14493 #: ../en/ch12-mq.xml:806
14494 msgid "Updating your patches when the underlying code changes"
14495 msgstr "当基础代码改变时,更新补丁的方法"
14497 #. type: Content of: <book><chapter><sect1><para>
14498 #: ../en/ch12-mq.xml:809
14499 msgid ""
14500 "It's common to have a stack of patches on top of an underlying repository "
14501 "that you don't modify directly. If you're working on changes to third-party "
14502 "code, or on a feature that is taking longer to develop than the rate of "
14503 "change of the code beneath, you will often need to sync up with the "
14504 "underlying code, and fix up any hunks in your patches that no longer apply. "
14505 "This is called <emphasis>rebasing</emphasis> your patch series."
14506 msgstr ""
14508 #. type: Content of: <book><chapter><sect1><para>
14509 #: ../en/ch12-mq.xml:818
14510 msgid ""
14511 "The simplest way to do this is to <command role=\"hg-cmd\">hg qpop <option "
14512 "role=\"hg-ext-mq-cmd-qpop-opt\">hg -a</option></command> your patches, then "
14513 "<command role=\"hg-cmd\">hg pull</command> changes into the underlying "
14514 "repository, and finally <command role=\"hg-cmd\">hg qpush <option role=\"hg-"
14515 "ext-mq-cmd-qpop-opt\">hg -a</option></command> your patches again. MQ will "
14516 "stop pushing any time it runs across a patch that fails to apply during "
14517 "conflicts, allowing you to fix your conflicts, <command role=\"hg-ext-mq"
14518 "\">qrefresh</command> the affected patch, and continue pushing until you have "
14519 "fixed your entire stack."
14520 msgstr ""
14522 #. type: Content of: <book><chapter><sect1><para>
14523 #: ../en/ch12-mq.xml:830
14524 msgid ""
14525 "This approach is easy to use and works well if you don't expect changes to "
14526 "the underlying code to affect how well your patches apply. If your patch "
14527 "stack touches code that is modified frequently or invasively in the "
14528 "underlying repository, however, fixing up rejected hunks by hand quickly "
14529 "becomes tiresome."
14530 msgstr ""
14532 #. type: Content of: <book><chapter><sect1><para>
14533 #: ../en/ch12-mq.xml:837
14534 msgid ""
14535 "It's possible to partially automate the rebasing process. If your patches "
14536 "apply cleanly against some revision of the underlying repo, MQ can use this "
14537 "information to help you to resolve conflicts between your patches and a "
14538 "different revision."
14539 msgstr ""
14541 #. type: Content of: <book><chapter><sect1><para>
14542 #: ../en/ch12-mq.xml:843
14543 msgid "The process is a little involved."
14544 msgstr ""
14546 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
14547 #: ../en/ch12-mq.xml:845
14548 msgid ""
14549 "To begin, <command role=\"hg-cmd\">hg qpush -a</command> all of your patches "
14550 "on top of the revision where you know that they apply cleanly."
14551 msgstr ""
14553 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
14554 #: ../en/ch12-mq.xml:849
14555 msgid ""
14556 "Save a backup copy of your patch directory using <command role=\"hg-cmd\">hg "
14557 "qsave <option role=\"hg-ext-mq-cmd-qsave-opt\">hg -e</option> <option role="
14558 "\"hg-ext-mq-cmd-qsave-opt\">hg -c</option></command>. This prints the name "
14559 "of the directory that it has saved the patches in. It will save the patches "
14560 "to a directory called <filename role=\"special\" class=\"directory\">.hg/"
14561 "patches.N</filename>, where <literal>N</literal> is a small integer. It also "
14562 "commits a <quote>save changeset</quote> on top of your applied patches; this "
14563 "is for internal book-keeping, and records the states of the <filename role="
14564 "\"special\">series</filename> and <filename role=\"special\">status</"
14565 "filename> files."
14566 msgstr ""
14568 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
14569 #: ../en/ch12-mq.xml:863
14570 msgid ""
14571 "Use <command role=\"hg-cmd\">hg pull</command> to bring new changes into the "
14572 "underlying repository. (Don't run <command role=\"hg-cmd\">hg pull -u</"
14573 "command>; see below for why.)"
14574 msgstr ""
14576 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
14577 #: ../en/ch12-mq.xml:868
14578 msgid ""
14579 "Update to the new tip revision, using <command role=\"hg-cmd\">hg update "
14580 "<option role=\"hg-opt-update\">-C</option></command> to override the patches "
14581 "you have pushed."
14582 msgstr ""
14584 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
14585 #: ../en/ch12-mq.xml:873
14586 msgid ""
14587 "Merge all patches using \\hgcmdargs{qpush}{<option role=\"hg-ext-mq-cmd-qpush-"
14588 "opt\">hg -m</option> <option role=\"hg-ext-mq-cmd-qpush-opt\">hg -a</"
14589 "option>}. The <option role=\"hg-ext-mq-cmd-qpush-opt\">hg -m</option> option "
14590 "to <command role=\"hg-ext-mq\">qpush</command> tells MQ to perform a three-"
14591 "way merge if the patch fails to apply."
14592 msgstr ""
14594 #. type: Content of: <book><chapter><sect1><para>
14595 #: ../en/ch12-mq.xml:883
14596 msgid ""
14597 "During the <command role=\"hg-cmd\">hg qpush <option role=\"hg-ext-mq-cmd-"
14598 "qpush-opt\">hg -m</option></command>, each patch in the <filename role="
14599 "\"special\">series</filename> file is applied normally. If a patch applies "
14600 "with fuzz or rejects, MQ looks at the queue you <command role=\"hg-ext-mq"
14601 "\">qsave</command>d, and performs a three-way merge with the corresponding "
14602 "changeset. This merge uses Mercurial's normal merge machinery, so it may pop "
14603 "up a GUI merge tool to help you to resolve problems."
14604 msgstr ""
14606 #. type: Content of: <book><chapter><sect1><para>
14607 #: ../en/ch12-mq.xml:893
14608 msgid ""
14609 "When you finish resolving the effects of a patch, MQ refreshes your patch "
14610 "based on the result of the merge."
14611 msgstr ""
14613 #. type: Content of: <book><chapter><sect1><para>
14614 #: ../en/ch12-mq.xml:896
14615 msgid ""
14616 "At the end of this process, your repository will have one extra head from the "
14617 "old patch queue, and a copy of the old patch queue will be in <filename role="
14618 "\"special\" class=\"directory\">.hg/patches.N</filename>. You can remove the "
14619 "extra head using <command role=\"hg-cmd\">hg qpop -a -n patches.N</command> "
14620 "or <command role=\"hg-cmd\">hg strip</command>. You can delete <filename "
14621 "role=\"special\" class=\"directory\">.hg/patches.N</filename> once you are "
14622 "sure that you no longer need it as a backup."
14623 msgstr ""
14625 #. type: Content of: <book><chapter><sect1><title>
14626 #: ../en/ch12-mq.xml:908
14627 msgid "Identifying patches"
14628 msgstr "标识补丁"
14630 #. type: Content of: <book><chapter><sect1><para>
14631 #: ../en/ch12-mq.xml:910
14632 msgid ""
14633 "MQ commands that work with patches let you refer to a patch either by using "
14634 "its name or by a number. By name is obvious enough; pass the name "
14635 "<filename>foo.patch</filename> to <command role=\"hg-ext-mq\">qpush</"
14636 "command>, for example, and it will push patches until <filename>foo.patch</"
14637 "filename> is applied."
14638 msgstr ""
14640 #. type: Content of: <book><chapter><sect1><para>
14641 #: ../en/ch12-mq.xml:917
14642 msgid ""
14643 "As a shortcut, you can refer to a patch using both a name and a numeric "
14644 "offset; <literal>foo.patch-2</literal> means <quote>two patches before "
14645 "<literal>foo.patch</literal></quote>, while <literal>bar.patch+4</literal> "
14646 "means <quote>four patches after <literal>bar.patch</literal></quote>."
14647 msgstr ""
14649 #. type: Content of: <book><chapter><sect1><para>
14650 #: ../en/ch12-mq.xml:923
14651 msgid ""
14652 "Referring to a patch by index isn't much different. The first patch printed "
14653 "in the output of <command role=\"hg-ext-mq\">qseries</command> is patch zero "
14654 "(yes, it's one of those start-at-zero counting systems); the second is patch "
14655 "one; and so on."
14656 msgstr ""
14658 #. type: Content of: <book><chapter><sect1><para>
14659 #: ../en/ch12-mq.xml:929
14660 msgid ""
14661 "MQ also makes it easy to work with patches when you are using normal "
14662 "Mercurial commands. Every command that accepts a changeset ID will also "
14663 "accept the name of an applied patch. MQ augments the tags normally in the "
14664 "repository with an eponymous one for each applied patch. In addition, the "
14665 "special tags \\index{tags!special tag names!<literal>qbase</literal>}"
14666 "<literal>qbase</literal> and \\index{tags!special tag names!<literal>qtip</"
14667 "literal>}<literal>qtip</literal> identify the <quote>bottom-most</quote> and "
14668 "topmost applied patches, respectively."
14669 msgstr ""
14671 #. type: Content of: <book><chapter><sect1><para>
14672 #: ../en/ch12-mq.xml:941
14673 msgid ""
14674 "These additions to Mercurial's normal tagging capabilities make dealing with "
14675 "patches even more of a breeze."
14676 msgstr ""
14678 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
14679 #: ../en/ch12-mq.xml:944
14680 msgid "Want to patchbomb a mailing list with your latest series of changes?"
14681 msgstr ""
14683 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
14684 #: ../en/ch12-mq.xml:948
14685 msgid ""
14686 "(Don't know what <quote>patchbombing</quote> is? See section <xref linkend="
14687 "\"sec.hgext.patchbomb\"/>.)"
14688 msgstr ""
14690 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
14691 #: ../en/ch12-mq.xml:951
14692 msgid ""
14693 "Need to see all of the patches since <literal>foo.patch</literal> that have "
14694 "touched files in a subdirectory of your tree?"
14695 msgstr ""
14697 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><programlisting><emphasis>
14698 #: ../en/ch12-mq.xml:955
14699 msgid "subdir"
14700 msgstr ""
14702 #. type: Content of: <book><chapter><sect1><para>
14703 #: ../en/ch12-mq.xml:960
14704 msgid ""
14705 "Because MQ makes the names of patches available to the rest of Mercurial "
14706 "through its normal internal tag machinery, you don't need to type in the "
14707 "entire name of a patch when you want to identify it by name."
14708 msgstr ""
14710 #. type: Content of: <book><chapter><sect1><para>
14711 #: ../en/ch12-mq.xml:965
14712 msgid ""
14713 "Another nice consequence of representing patch names as tags is that when you "
14714 "run the <command role=\"hg-cmd\">hg log</command> command, it will display a "
14715 "patch's name as a tag, simply as part of its normal output. This makes it "
14716 "easy to visually distinguish applied patches from underlying <quote>normal</"
14717 "quote> revisions. The following example shows a few normal Mercurial "
14718 "commands in use with applied patches."
14719 msgstr ""
14721 #. type: Content of: <book><chapter><sect1><title>
14722 #: ../en/ch12-mq.xml:978
14723 msgid "Useful things to know about"
14724 msgstr "其它需要了解的东西"
14726 #. type: Content of: <book><chapter><sect1><para>
14727 #: ../en/ch12-mq.xml:980
14728 msgid ""
14729 "There are a number of aspects of MQ usage that don't fit tidily into sections "
14730 "of their own, but that are good to know. Here they are, in one place."
14731 msgstr ""
14733 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
14734 #: ../en/ch12-mq.xml:985
14735 msgid ""
14736 "Normally, when you <command role=\"hg-ext-mq\">qpop</command> a patch and "
14737 "<command role=\"hg-ext-mq\">qpush</command> it again, the changeset that "
14738 "represents the patch after the pop/push will have a <emphasis>different "
14739 "identity</emphasis> than the changeset that represented the hash beforehand. "
14740 "See section <xref linkend=\"sec.mqref.cmd.qpush\"/> for information as to why "
14741 "this is."
14742 msgstr ""
14744 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
14745 #: ../en/ch12-mq.xml:994
14746 msgid ""
14747 "It's not a good idea to <command role=\"hg-cmd\">hg merge</command> changes "
14748 "from another branch with a patch changeset, at least if you want to maintain "
14749 "the <quote>patchiness</quote> of that changeset and changesets below it on "
14750 "the patch stack. If you try to do this, it will appear to succeed, but MQ "
14751 "will become confused."
14752 msgstr ""
14754 #. type: Content of: <book><chapter><sect1><title>
14755 #: ../en/ch12-mq.xml:1005
14756 msgid "Managing patches in a repository"
14757 msgstr "在版本库管理补丁"
14759 #. type: Content of: <book><chapter><sect1><para>
14760 #: ../en/ch12-mq.xml:1007
14761 msgid ""
14762 "Because MQ's <filename role=\"special\" class=\"directory\">.hg/patches</"
14763 "filename> directory resides outside a Mercurial repository's working "
14764 "directory, the <quote>underlying</quote> Mercurial repository knows nothing "
14765 "about the management or presence of patches."
14766 msgstr ""
14768 #. type: Content of: <book><chapter><sect1><para>
14769 #: ../en/ch12-mq.xml:1013
14770 msgid ""
14771 "This presents the interesting possibility of managing the contents of the "
14772 "patch directory as a Mercurial repository in its own right. This can be a "
14773 "useful way to work. For example, you can work on a patch for a while, "
14774 "<command role=\"hg-ext-mq\">qrefresh</command> it, then <command role=\"hg-cmd"
14775 "\">hg commit</command> the current state of the patch. This lets you "
14776 "<quote>roll back</quote> to that version of the patch later on."
14777 msgstr ""
14779 #. type: Content of: <book><chapter><sect1><para>
14780 #: ../en/ch12-mq.xml:1022
14781 msgid ""
14782 "You can then share different versions of the same patch stack among multiple "
14783 "underlying repositories. I use this when I am developing a Linux kernel "
14784 "feature. I have a pristine copy of my kernel sources for each of several CPU "
14785 "architectures, and a cloned repository under each that contains the patches I "
14786 "am working on. When I want to test a change on a different architecture, I "
14787 "push my current patches to the patch repository associated with that kernel "
14788 "tree, pop and push all of my patches, and build and test that kernel."
14789 msgstr ""
14791 #. type: Content of: <book><chapter><sect1><para>
14792 #: ../en/ch12-mq.xml:1032
14793 msgid ""
14794 "Managing patches in a repository makes it possible for multiple developers to "
14795 "work on the same patch series without colliding with each other, all on top "
14796 "of an underlying source base that they may or may not control."
14797 msgstr ""
14799 #. type: Content of: <book><chapter><sect1><sect2><title>
14800 #: ../en/ch12-mq.xml:1038
14801 msgid "MQ support for patch repositories"
14802 msgstr "MQ 支持补丁版本库"
14804 #. type: Content of: <book><chapter><sect1><sect2><para>
14805 #: ../en/ch12-mq.xml:1040
14806 msgid ""
14807 "MQ helps you to work with the <filename role=\"special\" class=\"directory\">."
14808 "hg/patches</filename> directory as a repository; when you prepare a "
14809 "repository for working with patches using <command role=\"hg-ext-mq\">qinit</"
14810 "command>, you can pass the <option role=\"hg-ext-mq-cmd-qinit-opt\">hg -c</"
14811 "option> option to create the <filename role=\"special\" class=\"directory\">."
14812 "hg/patches</filename> directory as a Mercurial repository."
14813 msgstr ""
14815 #. type: Content of: <book><chapter><sect1><sect2><note><para>
14816 #: ../en/ch12-mq.xml:1050
14817 msgid ""
14818 "If you forget to use the <option role=\"hg-ext-mq-cmd-qinit-opt\">hg -c</"
14819 "option> option, you can simply go into the <filename role=\"special\" class="
14820 "\"directory\">.hg/patches</filename> directory at any time and run <command "
14821 "role=\"hg-cmd\">hg init</command>. Don't forget to add an entry for the "
14822 "<filename role=\"special\">status</filename> file to the <filename role="
14823 "\"special\">.hgignore</filename> file, though"
14824 msgstr ""
14826 #. type: Content of: <book><chapter><sect1><sect2><note><para>
14827 #: ../en/ch12-mq.xml:1059
14828 msgid ""
14829 "(<command role=\"hg-cmd\">hg qinit <option role=\"hg-ext-mq-cmd-qinit-opt"
14830 "\">hg -c</option></command> does this for you automatically); you "
14831 "<emphasis>really</emphasis> don't want to manage the <filename role=\"special"
14832 "\">status</filename> file."
14833 msgstr ""
14835 #. type: Content of: <book><chapter><sect1><sect2><para>
14836 #: ../en/ch12-mq.xml:1066
14837 msgid ""
14838 "As a convenience, if MQ notices that the <filename class=\"directory\">.hg/"
14839 "patches</filename> directory is a repository, it will automatically <command "
14840 "role=\"hg-cmd\">hg add</command> every patch that you create and import."
14841 msgstr ""
14843 #. type: Content of: <book><chapter><sect1><sect2><para>
14844 #: ../en/ch12-mq.xml:1071
14845 msgid ""
14846 "MQ provides a shortcut command, <command role=\"hg-ext-mq\">qcommit</"
14847 "command>, that runs <command role=\"hg-cmd\">hg commit</command> in the "
14848 "<filename role=\"special\" class=\"directory\">.hg/patches</filename> "
14849 "directory. This saves some bothersome typing."
14850 msgstr ""
14852 #. type: Content of: <book><chapter><sect1><sect2><para>
14853 #: ../en/ch12-mq.xml:1077
14854 msgid ""
14855 "Finally, as a convenience to manage the patch directory, you can define the "
14856 "alias <command>mq</command> on Unix systems. For example, on Linux systems "
14857 "using the <command>bash</command> shell, you can include the following "
14858 "snippet in your <filename role=\"home\">~/.bashrc</filename>."
14859 msgstr ""
14861 #. type: Content of: <book><chapter><sect1><sect2><para>
14862 #: ../en/ch12-mq.xml:1087
14863 msgid ""
14864 "You can then issue commands of the form <command>mq pull</command> from the "
14865 "main repository."
14866 msgstr ""
14868 #. type: Content of: <book><chapter><sect1><sect2><title>
14869 #: ../en/ch12-mq.xml:1092
14870 msgid "A few things to watch out for"
14871 msgstr "需要注意的事情"
14873 #. type: Content of: <book><chapter><sect1><sect2><para>
14874 #: ../en/ch12-mq.xml:1094
14875 msgid ""
14876 "MQ's support for working with a repository full of patches is limited in a "
14877 "few small respects."
14878 msgstr ""
14880 #. type: Content of: <book><chapter><sect1><sect2><para>
14881 #: ../en/ch12-mq.xml:1097
14882 msgid ""
14883 "MQ cannot automatically detect changes that you make to the patch directory. "
14884 "If you <command role=\"hg-cmd\">hg pull</command>, manually edit, or <command "
14885 "role=\"hg-cmd\">hg update</command> changes to patches or the <filename role="
14886 "\"special\">series</filename> file, you will have to <command role=\"hg-cmd"
14887 "\">hg qpop <option role=\"hg-ext-mq-cmd-qpop-opt\">hg -a</option></command> "
14888 "and then <command role=\"hg-cmd\">hg qpush <option role=\"hg-ext-mq-cmd-qpush-"
14889 "opt\">hg -a</option></command> in the underlying repository to see those "
14890 "changes show up there. If you forget to do this, you can confuse MQ's idea "
14891 "of which patches are applied."
14892 msgstr ""
14894 #. type: Content of: <book><chapter><sect1><title>
14895 #: ../en/ch12-mq.xml:1113
14896 msgid "Third party tools for working with patches"
14897 msgstr "操作补丁的第三方工具"
14899 #. type: Content of: <book><chapter><sect1><para>
14900 #: ../en/ch12-mq.xml:1115
14901 msgid ""
14902 "Once you've been working with patches for a while, you'll find yourself "
14903 "hungry for tools that will help you to understand and manipulate the patches "
14904 "you're dealing with."
14905 msgstr ""
14907 #. type: Content of: <book><chapter><sect1><para>
14908 #: ../en/ch12-mq.xml:1119
14909 msgid ""
14910 "The <command>diffstat</command> command <citation>web:diffstat</citation> "
14911 "generates a histogram of the modifications made to each file in a patch. It "
14912 "provides a good way to <quote>get a sense of</quote> a patch&emdash;which "
14913 "files it affects, and how much change it introduces to each file and as a "
14914 "whole. (I find that it's a good idea to use <command>diffstat</command>'s "
14915 "<option role=\"cmd-opt-diffstat\">-p</option> option as a matter of course, "
14916 "as otherwise it will try to do clever things with prefixes of file names that "
14917 "inevitably confuse at least me.)"
14918 msgstr ""
14920 #. type: Content of: <book><chapter><sect1><para>
14921 #: ../en/ch12-mq.xml:1133
14922 msgid ""
14923 "The <literal role=\"package\">patchutils</literal> package <citation>web:"
14924 "patchutils</citation> is invaluable. It provides a set of small utilities "
14925 "that follow the <quote>Unix philosophy;</quote> each does one useful thing "
14926 "with a patch. The <literal role=\"package\">patchutils</literal> command I "
14927 "use most is <command>filterdiff</command>, which extracts subsets from a "
14928 "patch file. For example, given a patch that modifies hundreds of files "
14929 "across dozens of directories, a single invocation of <command>filterdiff</"
14930 "command> can generate a smaller patch that only touches files whose names "
14931 "match a particular glob pattern. See section <xref linkend=\"mq-collab.tips."
14932 "interdiff\"/> for another example."
14933 msgstr ""
14935 #. type: Content of: <book><chapter><sect1><title>
14936 #: ../en/ch12-mq.xml:1149
14937 msgid "Good ways to work with patches"
14938 msgstr "操作补丁的好习惯"
14940 #. type: Content of: <book><chapter><sect1><para>
14941 #: ../en/ch12-mq.xml:1151
14942 msgid ""
14943 "Whether you are working on a patch series to submit to a free software or "
14944 "open source project, or a series that you intend to treat as a sequence of "
14945 "regular changesets when you're done, you can use some simple techniques to "
14946 "keep your work well organised."
14947 msgstr ""
14949 #. type: Content of: <book><chapter><sect1><para>
14950 #: ../en/ch12-mq.xml:1157
14951 msgid ""
14952 "Give your patches descriptive names. A good name for a patch might be "
14953 "<filename>rework-device-alloc.patch</filename>, because it will immediately "
14954 "give you a hint what the purpose of the patch is. Long names shouldn't be a "
14955 "problem; you won't be typing the names often, but you <emphasis>will</"
14956 "emphasis> be running commands like <command role=\"hg-ext-mq\">qapplied</"
14957 "command> and <command role=\"hg-ext-mq\">qtop</command> over and over. Good "
14958 "naming becomes especially important when you have a number of patches to work "
14959 "with, or if you are juggling a number of different tasks and your patches "
14960 "only get a fraction of your attention."
14961 msgstr ""
14963 #. type: Content of: <book><chapter><sect1><para>
14964 #: ../en/ch12-mq.xml:1169
14965 msgid ""
14966 "Be aware of what patch you're working on. Use the <command role=\"hg-ext-mq"
14967 "\">qtop</command> command and skim over the text of your patches "
14968 "frequently&emdash;for example, using <command role=\"hg-cmd\">hg tip <option "
14969 "role=\"hg-opt-tip\">-p</option></command>)&emdash;to be sure of where you "
14970 "stand. I have several times worked on and <command role=\"hg-ext-mq"
14971 "\">qrefresh</command>ed a patch other than the one I intended, and it's often "
14972 "tricky to migrate changes into the right patch after making them in the wrong "
14973 "one."
14974 msgstr ""
14976 #. type: Content of: <book><chapter><sect1><para>
14977 #: ../en/ch12-mq.xml:1179
14978 msgid ""
14979 "For this reason, it is very much worth investing a little time to learn how "
14980 "to use some of the third-party tools I described in section <xref linkend="
14981 "\"sec.mq.tools\"/>, particularly <command>diffstat</command> and "
14982 "<command>filterdiff</command>. The former will give you a quick idea of what "
14983 "changes your patch is making, while the latter makes it easy to splice hunks "
14984 "selectively out of one patch and into another."
14985 msgstr ""
14987 #. type: Content of: <book><chapter><sect1><title>
14988 #: ../en/ch12-mq.xml:1190
14989 msgid "MQ cookbook"
14990 msgstr "MQ 手册"
14992 #. type: Content of: <book><chapter><sect1><sect2><title>
14993 #: ../en/ch12-mq.xml:1193
14994 msgid "Manage <quote>trivial</quote> patches"
14995 msgstr "管理<quote>琐碎的</quote>补丁"
14997 #. type: Content of: <book><chapter><sect1><sect2><para>
14998 #: ../en/ch12-mq.xml:1195
14999 msgid ""
15000 "Because the overhead of dropping files into a new Mercurial repository is so "
15001 "low, it makes a lot of sense to manage patches this way even if you simply "
15002 "want to make a few changes to a source tarball that you downloaded."
15003 msgstr ""
15006 #. type: Content of: <book><chapter><sect1><sect2><para>
15007 #: ../en/ch12-mq.xml:1200
15008 msgid ""
15009 "Begin by downloading and unpacking the source tarball, and turning it into a "
15010 "Mercurial repository."
15011 msgstr ""
15013 #. type: Content of: <book><chapter><sect1><sect2><para>
15014 #: ../en/ch12-mq.xml:1205
15015 msgid "Continue by creating a patch stack and making your changes."
15016 msgstr ""
15018 #. type: Content of: <book><chapter><sect1><sect2><para>
15019 #: ../en/ch12-mq.xml:1210
15020 msgid ""
15021 "Let's say a few weeks or months pass, and your package author releases a new "
15022 "version. First, bring their changes into the repository."
15023 msgstr ""
15025 #. type: Content of: <book><chapter><sect1><sect2><para>
15026 #: ../en/ch12-mq.xml:1216
15027 msgid ""
15028 "The pipeline starting with <command role=\"hg-cmd\">hg locate</command> above "
15029 "deletes all files in the working directory, so that <command role=\"hg-cmd"
15030 "\">hg commit</command>'s <option role=\"hg-opt-commit\">--addremove</option> "
15031 "option can actually tell which files have really been removed in the newer "
15032 "version of the source."
15033 msgstr ""
15035 #. type: Content of: <book><chapter><sect1><sect2><para>
15036 #: ../en/ch12-mq.xml:1224
15037 msgid "Finally, you can apply your patches on top of the new tree."
15038 msgstr ""
15040 #. type: Content of: <book><chapter><sect1><sect2><title>
15041 #: ../en/ch12-mq.xml:1231
15042 msgid "Combining entire patches"
15043 msgstr "组合全部的补丁"
15045 #. type: Content of: <book><chapter><sect1><sect2><para>
15046 #: ../en/ch12-mq.xml:1233
15047 msgid ""
15048 "MQ provides a command, <command role=\"hg-ext-mq\">qfold</command> that lets "
15049 "you combine entire patches. This <quote>folds</quote> the patches you name, "
15050 "in the order you name them, into the topmost applied patch, and concatenates "
15051 "their descriptions onto the end of its description. The patches that you "
15052 "fold must be unapplied before you fold them."
15053 msgstr ""
15055 #. type: Content of: <book><chapter><sect1><sect2><para>
15056 #: ../en/ch12-mq.xml:1241
15057 msgid ""
15058 "The order in which you fold patches matters. If your topmost applied patch "
15059 "is <literal>foo</literal>, and you <command role=\"hg-ext-mq\">qfold</"
15060 "command> <literal>bar</literal> and <literal>quux</literal> into it, you will "
15061 "end up with a patch that has the same effect as if you applied first "
15062 "<literal>foo</literal>, then <literal>bar</literal>, followed by "
15063 "<literal>quux</literal>."
15064 msgstr ""
15066 #. type: Content of: <book><chapter><sect1><sect2><title>
15067 #: ../en/ch12-mq.xml:1252
15068 msgid "Merging part of one patch into another"
15069 msgstr "合并补丁的部分内容到其它补丁"
15071 #. type: Content of: <book><chapter><sect1><sect2><para>
15072 #: ../en/ch12-mq.xml:1254
15073 msgid ""
15074 "Merging <emphasis>part</emphasis> of one patch into another is more difficult "
15075 "than combining entire patches."
15076 msgstr ""
15078 #. type: Content of: <book><chapter><sect1><sect2><para>
15079 #: ../en/ch12-mq.xml:1258
15080 msgid ""
15081 "If you want to move changes to entire files, you can use <command>filterdiff</"
15082 "command>'s <option role=\"cmd-opt-filterdiff\">-i</option> and <option role="
15083 "\"cmd-opt-filterdiff\">-x</option> options to choose the modifications to "
15084 "snip out of one patch, concatenating its output onto the end of the patch you "
15085 "want to merge into. You usually won't need to modify the patch you've merged "
15086 "the changes from. Instead, MQ will report some rejected hunks when you "
15087 "<command role=\"hg-ext-mq\">qpush</command> it (from the hunks you moved into "
15088 "the other patch), and you can simply <command role=\"hg-ext-mq\">qrefresh</"
15089 "command> the patch to drop the duplicate hunks."
15090 msgstr ""
15092 #. type: Content of: <book><chapter><sect1><sect2><para>
15093 #: ../en/ch12-mq.xml:1271
15094 msgid ""
15095 "If you have a patch that has multiple hunks modifying a file, and you only "
15096 "want to move a few of those hunks, the job becomes more messy, but you can "
15097 "still partly automate it. Use <command>lsdiff -nvv</command> to print some "
15098 "metadata about the patch."
15099 msgstr ""
15101 #. type: Content of: <book><chapter><sect1><sect2><para>
15102 #: ../en/ch12-mq.xml:1279
15103 msgid "This command prints three different kinds of number:"
15104 msgstr ""
15106 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
15107 #: ../en/ch12-mq.xml:1282
15108 msgid ""
15109 "(in the first column) a <emphasis>file number</emphasis> to identify each "
15110 "file modified in the patch;"
15111 msgstr ""
15113 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
15114 #: ../en/ch12-mq.xml:1286
15115 msgid ""
15116 "(on the next line, indented) the line number within a modified file where a "
15117 "hunk starts; and"
15118 msgstr ""
15120 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
15121 #: ../en/ch12-mq.xml:1289
15122 msgid ""
15123 "(on the same line) a <emphasis>hunk number</emphasis> to identify that hunk."
15124 msgstr ""
15126 #. type: Content of: <book><chapter><sect1><sect2><para>
15127 #: ../en/ch12-mq.xml:1293
15128 msgid ""
15129 "You'll have to use some visual inspection, and reading of the patch, to "
15130 "identify the file and hunk numbers you'll want, but you can then pass them to "
15131 "to <command>filterdiff</command>'s <option role=\"cmd-opt-filterdiff\">--"
15132 "files</option> and <option role=\"cmd-opt-filterdiff\">--hunks</option> "
15133 "options, to select exactly the file and hunk you want to extract."
15134 msgstr ""
15136 #. type: Content of: <book><chapter><sect1><sect2><para>
15137 #: ../en/ch12-mq.xml:1301
15138 msgid ""
15139 "Once you have this hunk, you can concatenate it onto the end of your "
15140 "destination patch and continue with the remainder of section <xref linkend="
15141 "\"sec.mq.combine\"/>."
15142 msgstr ""
15144 #. type: Content of: <book><chapter><sect1><title>
15145 #: ../en/ch12-mq.xml:1308
15146 msgid "Differences between quilt and MQ"
15147 msgstr "MQ 与 quilt 的区别"
15149 #. type: Content of: <book><chapter><sect1><para>
15150 #: ../en/ch12-mq.xml:1310
15151 msgid ""
15152 "If you are already familiar with quilt, MQ provides a similar command set. "
15153 "There are a few differences in the way that it works."
15154 msgstr ""
15156 #. type: Content of: <book><chapter><sect1><para>
15157 #: ../en/ch12-mq.xml:1314
15158 msgid ""
15159 "You will already have noticed that most quilt commands have MQ counterparts "
15160 "that simply begin with a <quote><literal>q</literal></quote>. The exceptions "
15161 "are quilt's <literal>add</literal> and <literal>remove</literal> commands, "
15162 "the counterparts for which are the normal Mercurial <command role=\"hg-cmd"
15163 "\">hg add</command> and <command role=\"hg-cmd\">hg remove</command> "
15164 "commands. There is no MQ equivalent of the quilt <literal>edit</literal> "
15165 "command."
15166 msgstr ""
15168 #. type: Content of: <book><chapter><title>
15169 #: ../en/ch13-mq-collab.xml:5
15170 msgid "Advanced uses of Mercurial Queues"
15171 msgstr "MQ 的高级用法"
15173 #. type: Content of: <book><chapter><para>
15174 #: ../en/ch13-mq-collab.xml:7
15175 msgid ""
15176 "While it's easy to pick up straightforward uses of Mercurial Queues, use of a "
15177 "little discipline and some of MQ's less frequently used capabilities makes it "
15178 "possible to work in complicated development environments."
15179 msgstr ""
15181 #. type: Content of: <book><chapter><para>
15182 #: ../en/ch13-mq-collab.xml:12
15183 msgid ""
15184 "In this chapter, I will use as an example a technique I have used to manage "
15185 "the development of an Infiniband device driver for the Linux kernel. The "
15186 "driver in question is large (at least as drivers go), with 25,000 lines of "
15187 "code spread across 35 source files. It is maintained by a small team of "
15188 "developers."
15189 msgstr ""
15191 #. type: Content of: <book><chapter><para>
15192 #: ../en/ch13-mq-collab.xml:18
15193 msgid ""
15194 "While much of the material in this chapter is specific to Linux, the same "
15195 "principles apply to any code base for which you're not the primary owner, and "
15196 "upon which you need to do a lot of development."
15197 msgstr ""
15199 #. type: Content of: <book><chapter><sect1><title>
15200 #: ../en/ch13-mq-collab.xml:24
15201 msgid "The problem of many targets"
15202 msgstr "多个目标的问题"
15204 #. type: Content of: <book><chapter><sect1><para>
15205 #: ../en/ch13-mq-collab.xml:26
15206 msgid ""
15207 "The Linux kernel changes rapidly, and has never been internally stable; "
15208 "developers frequently make drastic changes between releases. This means that "
15209 "a version of the driver that works well with a particular released version of "
15210 "the kernel will not even <emphasis>compile</emphasis> correctly against, "
15211 "typically, any other version."
15212 msgstr ""
15214 #. type: Content of: <book><chapter><sect1><para>
15215 #: ../en/ch13-mq-collab.xml:33
15216 msgid ""
15217 "To maintain a driver, we have to keep a number of distinct versions of Linux "
15218 "in mind."
15219 msgstr ""
15221 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
15222 #: ../en/ch13-mq-collab.xml:36
15223 msgid ""
15224 "One target is the main Linux kernel development tree. Maintenance of the code "
15225 "is in this case partly shared by other developers in the kernel community, "
15226 "who make <quote>drive-by</quote> modifications to the driver as they develop "
15227 "and refine kernel subsystems."
15228 msgstr ""
15230 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
15231 #: ../en/ch13-mq-collab.xml:42
15232 msgid ""
15233 "We also maintain a number of <quote>backports</quote> to older versions of "
15234 "the Linux kernel, to support the needs of customers who are running older "
15235 "Linux distributions that do not incorporate our drivers. (To "
15236 "<emphasis>backport</emphasis> a piece of code is to modify it to work in an "
15237 "older version of its target environment than the version it was developed "
15238 "for.)"
15239 msgstr ""
15241 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
15242 #: ../en/ch13-mq-collab.xml:50
15243 msgid ""
15244 "Finally, we make software releases on a schedule that is necessarily not "
15245 "aligned with those used by Linux distributors and kernel developers, so that "
15246 "we can deliver new features to customers without forcing them to upgrade "
15247 "their entire kernels or distributions."
15248 msgstr ""
15250 #. type: Content of: <book><chapter><sect1><sect2><title>
15251 #: ../en/ch13-mq-collab.xml:58
15252 msgid "Tempting approaches that don't work well"
15253 msgstr "工作不好的诱人方法"
15255 #. type: Content of: <book><chapter><sect1><sect2><para>
15256 #: ../en/ch13-mq-collab.xml:60
15257 msgid ""
15258 "There are two <quote>standard</quote> ways to maintain a piece of software "
15259 "that has to target many different environments."
15260 msgstr ""
15262 #. type: Content of: <book><chapter><sect1><sect2><para>
15263 #: ../en/ch13-mq-collab.xml:64
15264 msgid ""
15265 "The first is to maintain a number of branches, each intended for a single "
15266 "target. The trouble with this approach is that you must maintain iron "
15267 "discipline in the flow of changes between repositories. A new feature or bug "
15268 "fix must start life in a <quote>pristine</quote> repository, then percolate "
15269 "out to every backport repository. Backport changes are more limited in the "
15270 "branches they should propagate to; a backport change that is applied to a "
15271 "branch where it doesn't belong will probably stop the driver from compiling."
15272 msgstr ""
15274 #. type: Content of: <book><chapter><sect1><sect2><para>
15275 #: ../en/ch13-mq-collab.xml:74
15276 msgid ""
15277 "The second is to maintain a single source tree filled with conditional "
15278 "statements that turn chunks of code on or off depending on the intended "
15279 "target. Because these <quote>ifdefs</quote> are not allowed in the Linux "
15280 "kernel tree, a manual or automatic process must be followed to strip them out "
15281 "and yield a clean tree. A code base maintained in this fashion rapidly "
15282 "becomes a rat's nest of conditional blocks that are difficult to understand "
15283 "and maintain."
15284 msgstr ""
15286 #. type: Content of: <book><chapter><sect1><sect2><para>
15287 #: ../en/ch13-mq-collab.xml:83
15288 msgid ""
15289 "Neither of these approaches is well suited to a situation where you don't "
15290 "<quote>own</quote> the canonical copy of a source tree. In the case of a "
15291 "Linux driver that is distributed with the standard kernel, Linus's tree "
15292 "contains the copy of the code that will be treated by the world as "
15293 "canonical. The upstream version of <quote>my</quote> driver can be modified "
15294 "by people I don't know, without me even finding out about it until after the "
15295 "changes show up in Linus's tree."
15296 msgstr ""
15298 #. type: Content of: <book><chapter><sect1><sect2><para>
15299 #: ../en/ch13-mq-collab.xml:93
15300 msgid ""
15301 "These approaches have the added weakness of making it difficult to generate "
15302 "well-formed patches to submit upstream."
15303 msgstr ""
15305 #. type: Content of: <book><chapter><sect1><sect2><para>
15306 #: ../en/ch13-mq-collab.xml:97
15307 msgid ""
15308 "In principle, Mercurial Queues seems like a good candidate to manage a "
15309 "development scenario such as the above. While this is indeed the case, MQ "
15310 "contains a few added features that make the job more pleasant."
15311 msgstr ""
15313 #. type: Content of: <book><chapter><sect1><title>
15314 #: ../en/ch13-mq-collab.xml:105
15315 msgid "Conditionally applying patches with guards"
15316 msgstr "有条件的应用补丁"
15318 #. type: Content of: <book><chapter><sect1><para>
15319 #: ../en/ch13-mq-collab.xml:107
15320 msgid ""
15321 "Perhaps the best way to maintain sanity with so many targets is to be able to "
15322 "choose specific patches to apply for a given situation. MQ provides a "
15323 "feature called <quote>guards</quote> (which originates with quilt's "
15324 "<literal>guards</literal> command) that does just this. To start off, let's "
15325 "create a simple repository for experimenting in."
15326 msgstr ""
15328 #. type: Content of: <book><chapter><sect1><para>
15329 #: ../en/ch13-mq-collab.xml:116
15330 msgid ""
15331 "This gives us a tiny repository that contains two patches that don't have any "
15332 "dependencies on each other, because they touch different files."
15333 msgstr ""
15335 #. type: Content of: <book><chapter><sect1><para>
15336 #: ../en/ch13-mq-collab.xml:120
15337 msgid ""
15338 "The idea behind conditional application is that you can <quote>tag</quote> a "
15339 "patch with a <emphasis>guard</emphasis>, which is simply a text string of "
15340 "your choosing, then tell MQ to select specific guards to use when applying "
15341 "patches. MQ will then either apply, or skip over, a guarded patch, depending "
15342 "on the guards that you have selected."
15343 msgstr ""
15345 #. type: Content of: <book><chapter><sect1><para>
15346 #: ../en/ch13-mq-collab.xml:127
15347 msgid ""
15348 "A patch can have an arbitrary number of guards; each one is "
15349 "<emphasis>positive</emphasis> (<quote>apply this patch if this guard is "
15350 "selected</quote>) or <emphasis>negative</emphasis> (<quote>skip this patch if "
15351 "this guard is selected</quote>). A patch with no guards is always applied."
15352 msgstr ""
15354 #. type: Content of: <book><chapter><sect1><title>
15355 #: ../en/ch13-mq-collab.xml:135
15356 msgid "Controlling the guards on a patch"
15357 msgstr "控制补丁的应用条件"
15359 #. type: Content of: <book><chapter><sect1><para>
15360 #: ../en/ch13-mq-collab.xml:137
15361 msgid ""
15362 "The <command role=\"hg-ext-mq\">qguard</command> command lets you determine "
15363 "which guards should apply to a patch, or display the guards that are already "
15364 "in effect. Without any arguments, it displays the guards on the current "
15365 "topmost patch."
15366 msgstr ""
15368 #. type: Content of: <book><chapter><sect1><para>
15369 #: ../en/ch13-mq-collab.xml:144
15370 msgid ""
15371 "To set a positive guard on a patch, prefix the name of the guard with a "
15372 "<quote><literal>+</literal></quote>."
15373 msgstr ""
15375 #. type: Content of: <book><chapter><sect1><para>
15376 #: ../en/ch13-mq-collab.xml:149
15377 msgid ""
15378 "To set a negative guard on a patch, prefix the name of the guard with a "
15379 "<quote><literal>-</literal></quote>."
15380 msgstr ""
15382 #. type: Content of: <book><chapter><sect1><note><para>
15383 #: ../en/ch13-mq-collab.xml:156
15384 msgid ""
15385 "The <command role=\"hg-ext-mq\">qguard</command> command <emphasis>sets</"
15386 "emphasis> the guards on a patch; it doesn't <emphasis>modify</emphasis> "
15387 "them. What this means is that if you run <command role=\"hg-cmd\">hg qguard "
15388 "+a +b</command> on a patch, then <command role=\"hg-cmd\">hg qguard +c</"
15389 "command> on the same patch, the <emphasis>only</emphasis> guard that will be "
15390 "set on it afterwards is <literal>+c</literal>."
15391 msgstr ""
15394 #. type: Content of: <book><chapter><sect1><para>
15395 #: ../en/ch13-mq-collab.xml:165
15396 msgid ""
15397 "Mercurial stores guards in the <filename role=\"special\">series</filename> "
15398 "file; the form in which they are stored is easy both to understand and to "
15399 "edit by hand. (In other words, you don't have to use the <command role=\"hg-"
15400 "ext-mq\">qguard</command> command if you don't want to; it's okay to simply "
15401 "edit the <filename role=\"special\">series</filename> file.)"
15402 msgstr ""
15404 #. type: Content of: <book><chapter><sect1><title>
15405 #: ../en/ch13-mq-collab.xml:177
15406 msgid "Selecting the guards to use"
15407 msgstr "选择使用的条件"
15409 #. type: Content of: <book><chapter><sect1><para>
15410 #: ../en/ch13-mq-collab.xml:179
15411 msgid ""
15412 "The <command role=\"hg-ext-mq\">qselect</command> command determines which "
15413 "guards are active at a given time. The effect of this is to determine which "
15414 "patches MQ will apply the next time you run <command role=\"hg-ext-mq"
15415 "\">qpush</command>. It has no other effect; in particular, it doesn't do "
15416 "anything to patches that are already applied."
15417 msgstr ""
15419 #. type: Content of: <book><chapter><sect1><para>
15420 #: ../en/ch13-mq-collab.xml:186
15421 msgid ""
15422 "With no arguments, the <command role=\"hg-ext-mq\">qselect</command> command "
15423 "lists the guards currently in effect, one per line of output. Each argument "
15424 "is treated as the name of a guard to apply."
15425 msgstr ""
15427 #. type: Content of: <book><chapter><sect1><para>
15428 #: ../en/ch13-mq-collab.xml:193
15429 msgid ""
15430 "In case you're interested, the currently selected guards are stored in the "
15431 "<filename role=\"special\">guards</filename> file."
15432 msgstr ""
15434 #. type: Content of: <book><chapter><sect1><para>
15435 #: ../en/ch13-mq-collab.xml:198
15436 msgid ""
15437 "We can see the effect the selected guards have when we run <command role=\"hg-"
15438 "ext-mq\">qpush</command>."
15439 msgstr ""
15441 #. type: Content of: <book><chapter><sect1><para>
15442 #: ../en/ch13-mq-collab.xml:203
15443 msgid ""
15444 "A guard cannot start with a <quote><literal>+</literal></quote> or "
15445 "<quote><literal>-</literal></quote> character. The name of a guard must not "
15446 "contain white space, but most other characters are acceptable. If you try to "
15447 "use a guard with an invalid name, MQ will complain:"
15448 msgstr ""
15450 #. type: Content of: <book><chapter><sect1><para>
15451 #: ../en/ch13-mq-collab.xml:212
15452 msgid "Changing the selected guards changes the patches that are applied."
15453 msgstr ""
15455 #. type: Content of: <book><chapter><sect1><para>
15456 #: ../en/ch13-mq-collab.xml:217
15457 msgid ""
15458 "You can see in the example below that negative guards take precedence over "
15459 "positive guards."
15460 msgstr ""
15462 #. type: Content of: <book><chapter><sect1><title>
15463 #: ../en/ch13-mq-collab.xml:224
15464 msgid "MQ's rules for applying patches"
15465 msgstr "MQ 应用补丁的规则"
15467 #. type: Content of: <book><chapter><sect1><para>
15468 #: ../en/ch13-mq-collab.xml:226
15469 msgid ""
15470 "The rules that MQ uses when deciding whether to apply a patch are as follows."
15471 msgstr ""
15473 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
15474 #: ../en/ch13-mq-collab.xml:229
15475 msgid "A patch that has no guards is always applied."
15476 msgstr ""
15478 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
15479 #: ../en/ch13-mq-collab.xml:232
15480 msgid ""
15481 "If the patch has any negative guard that matches any currently selected "
15482 "guard, the patch is skipped."
15483 msgstr ""
15485 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
15486 #: ../en/ch13-mq-collab.xml:235
15487 msgid ""
15488 "If the patch has any positive guard that matches any currently selected "
15489 "guard, the patch is applied."
15490 msgstr ""
15492 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
15493 #: ../en/ch13-mq-collab.xml:238
15494 msgid ""
15495 "If the patch has positive or negative guards, but none matches any currently "
15496 "selected guard, the patch is skipped."
15497 msgstr ""
15499 #. type: Content of: <book><chapter><sect1><title>
15500 #: ../en/ch13-mq-collab.xml:245
15501 msgid "Trimming the work environment"
15502 msgstr "修剪工作环境"
15504 #. type: Content of: <book><chapter><sect1><para>
15505 #: ../en/ch13-mq-collab.xml:247
15506 msgid ""
15507 "In working on the device driver I mentioned earlier, I don't apply the "
15508 "patches to a normal Linux kernel tree. Instead, I use a repository that "
15509 "contains only a snapshot of the source files and headers that are relevant to "
15510 "Infiniband development. This repository is 1% the size of a kernel "
15511 "repository, so it's easier to work with."
15512 msgstr ""
15514 #. type: Content of: <book><chapter><sect1><para>
15515 #: ../en/ch13-mq-collab.xml:254
15516 msgid ""
15517 "I then choose a <quote>base</quote> version on top of which the patches are "
15518 "applied. This is a snapshot of the Linux kernel tree as of a revision of my "
15519 "choosing. When I take the snapshot, I record the changeset ID from the "
15520 "kernel repository in the commit message. Since the snapshot preserves the "
15521 "<quote>shape</quote> and content of the relevant parts of the kernel tree, I "
15522 "can apply my patches on top of either my tiny repository or a normal kernel "
15523 "tree."
15524 msgstr ""
15526 #. type: Content of: <book><chapter><sect1><para>
15527 #: ../en/ch13-mq-collab.xml:263
15528 msgid ""
15529 "Normally, the base tree atop which the patches apply should be a snapshot of "
15530 "a very recent upstream tree. This best facilitates the development of "
15531 "patches that can easily be submitted upstream with few or no modifications."
15532 msgstr ""
15534 #. type: Content of: <book><chapter><sect1><title>
15535 #: ../en/ch13-mq-collab.xml:270
15536 msgid "Dividing up the <filename role=\"special\">series</filename> file"
15537 msgstr "分类补丁<filename role=\"special\">系列</filename>"
15539 #. type: Content of: <book><chapter><sect1><para>
15540 #: ../en/ch13-mq-collab.xml:273
15541 msgid ""
15542 "I categorise the patches in the <filename role=\"special\">series</filename> "
15543 "file into a number of logical groups. Each section of like patches begins "
15544 "with a block of comments that describes the purpose of the patches that "
15545 "follow."
15546 msgstr ""
15548 #. type: Content of: <book><chapter><sect1><para>
15549 #: ../en/ch13-mq-collab.xml:279
15550 msgid ""
15551 "The sequence of patch groups that I maintain follows. The ordering of these "
15552 "groups is important; I'll describe why after I introduce the groups."
15553 msgstr ""
15555 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
15556 #: ../en/ch13-mq-collab.xml:283
15557 msgid ""
15558 "The <quote>accepted</quote> group. Patches that the development team has "
15559 "submitted to the maintainer of the Infiniband subsystem, and which he has "
15560 "accepted, but which are not present in the snapshot that the tiny repository "
15561 "is based on. These are <quote>read only</quote> patches, present only to "
15562 "transform the tree into a similar state as it is in the upstream maintainer's "
15563 "repository."
15564 msgstr ""
15566 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
15567 #: ../en/ch13-mq-collab.xml:291
15568 msgid ""
15569 "The <quote>rework</quote> group. Patches that I have submitted, but that the "
15570 "upstream maintainer has requested modifications to before he will accept them."
15571 msgstr ""
15573 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
15574 #: ../en/ch13-mq-collab.xml:296
15575 msgid ""
15576 "The <quote>pending</quote> group. Patches that I have not yet submitted to "
15577 "the upstream maintainer, but which we have finished working on. These will be "
15578 "<quote>read only</quote> for a while. If the upstream maintainer accepts "
15579 "them upon submission, I'll move them to the end of the <quote>accepted</"
15580 "quote> group. If he requests that I modify any, I'll move them to the "
15581 "beginning of the <quote>rework</quote> group."
15582 msgstr ""
15584 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
15585 #: ../en/ch13-mq-collab.xml:305
15586 msgid ""
15587 "The <quote>in progress</quote> group. Patches that are actively being "
15588 "developed, and should not be submitted anywhere yet."
15589 msgstr ""
15591 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
15592 #: ../en/ch13-mq-collab.xml:309
15593 msgid ""
15594 "The <quote>backport</quote> group. Patches that adapt the source tree to "
15595 "older versions of the kernel tree."
15596 msgstr ""
15598 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
15599 #: ../en/ch13-mq-collab.xml:313
15600 msgid ""
15601 "The <quote>do not ship</quote> group. Patches that for some reason should "
15602 "never be submitted upstream. For example, one such patch might change "
15603 "embedded driver identification strings to make it easier to distinguish, in "
15604 "the field, between an out-of-tree version of the driver and a version shipped "
15605 "by a distribution vendor."
15606 msgstr ""
15608 #. type: Content of: <book><chapter><sect1><para>
15609 #: ../en/ch13-mq-collab.xml:321
15610 msgid ""
15611 "Now to return to the reasons for ordering groups of patches in this way. We "
15612 "would like the lowest patches in the stack to be as stable as possible, so "
15613 "that we will not need to rework higher patches due to changes in context. "
15614 "Putting patches that will never be changed first in the <filename role="
15615 "\"special\">series</filename> file serves this purpose."
15616 msgstr ""
15618 #. type: Content of: <book><chapter><sect1><para>
15619 #: ../en/ch13-mq-collab.xml:329
15620 msgid ""
15621 "We would also like the patches that we know we'll need to modify to be "
15622 "applied on top of a source tree that resembles the upstream tree as closely "
15623 "as possible. This is why we keep accepted patches around for a while."
15624 msgstr ""
15626 #. type: Content of: <book><chapter><sect1><para>
15627 #: ../en/ch13-mq-collab.xml:334
15628 msgid ""
15629 "The <quote>backport</quote> and <quote>do not ship</quote> patches float at "
15630 "the end of the <filename role=\"special\">series</filename> file. The "
15631 "backport patches must be applied on top of all other patches, and the "
15632 "<quote>do not ship</quote> patches might as well stay out of harm's way."
15633 msgstr ""
15635 #. type: Content of: <book><chapter><sect1><title>
15636 #: ../en/ch13-mq-collab.xml:343
15637 msgid "Maintaining the patch series"
15638 msgstr "维护补丁系列"
15640 #. type: Content of: <book><chapter><sect1><para>
15641 #: ../en/ch13-mq-collab.xml:345
15642 msgid ""
15643 "In my work, I use a number of guards to control which patches are to be "
15644 "applied."
15645 msgstr ""
15647 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
15648 #: ../en/ch13-mq-collab.xml:349
15649 msgid ""
15650 "<quote>Accepted</quote> patches are guarded with <literal>accepted</"
15651 "literal>. I enable this guard most of the time. When I'm applying the "
15652 "patches on top of a tree where the patches are already present, I can turn "
15653 "this patch off, and the patches that follow it will apply cleanly."
15654 msgstr ""
15656 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
15657 #: ../en/ch13-mq-collab.xml:356
15658 msgid ""
15659 "Patches that are <quote>finished</quote>, but not yet submitted, have no "
15660 "guards. If I'm applying the patch stack to a copy of the upstream tree, I "
15661 "don't need to enable any guards in order to get a reasonably safe source tree."
15662 msgstr ""
15664 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
15665 #: ../en/ch13-mq-collab.xml:362
15666 msgid ""
15667 "Those patches that need reworking before being resubmitted are guarded with "
15668 "<literal>rework</literal>."
15669 msgstr ""
15671 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
15672 #: ../en/ch13-mq-collab.xml:366
15673 msgid ""
15674 "For those patches that are still under development, I use <literal>devel</"
15675 "literal>."
15676 msgstr ""
15678 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
15679 #: ../en/ch13-mq-collab.xml:369
15680 msgid ""
15681 "A backport patch may have several guards, one for each version of the kernel "
15682 "to which it applies. For example, a patch that backports a piece of code to "
15683 "2.6.9 will have a <literal>2.6.9</literal> guard."
15684 msgstr ""
15686 #. type: Content of: <book><chapter><sect1><para>
15687 #: ../en/ch13-mq-collab.xml:374
15688 msgid ""
15689 "This variety of guards gives me considerable flexibility in determining what "
15690 "kind of source tree I want to end up with. For most situations, the "
15691 "selection of appropriate guards is automated during the build process, but I "
15692 "can manually tune the guards to use for less common circumstances."
15693 msgstr ""
15695 #. type: Content of: <book><chapter><sect1><sect2><title>
15696 #: ../en/ch13-mq-collab.xml:381
15697 msgid "The art of writing backport patches"
15698 msgstr "编写向后移植补丁的艺术"
15700 #. type: Content of: <book><chapter><sect1><sect2><para>
15701 #: ../en/ch13-mq-collab.xml:383
15702 msgid ""
15703 "Using MQ, writing a backport patch is a simple process. All such a patch has "
15704 "to do is modify a piece of code that uses a kernel feature not present in the "
15705 "older version of the kernel, so that the driver continues to work correctly "
15706 "under that older version."
15707 msgstr ""
15709 #. type: Content of: <book><chapter><sect1><sect2><para>
15710 #: ../en/ch13-mq-collab.xml:389
15711 msgid ""
15712 "A useful goal when writing a good backport patch is to make your code look as "
15713 "if it was written for the older version of the kernel you're targeting. The "
15714 "less obtrusive the patch, the easier it will be to understand and maintain. "
15715 "If you're writing a collection of backport patches to avoid the <quote>rat's "
15716 "nest</quote> effect of lots of <literal>#ifdef</literal>s (hunks of source "
15717 "code that are only used conditionally) in your code, don't introduce version-"
15718 "dependent <literal>#ifdef</literal>s into the patches. Instead, write "
15719 "several patches, each of which makes unconditional changes, and control their "
15720 "application using guards."
15721 msgstr ""
15723 #. type: Content of: <book><chapter><sect1><sect2><para>
15724 #: ../en/ch13-mq-collab.xml:402
15725 msgid ""
15726 "There are two reasons to divide backport patches into a distinct group, away "
15727 "from the <quote>regular</quote> patches whose effects they modify. The first "
15728 "is that intermingling the two makes it more difficult to use a tool like the "
15729 "<literal role=\"hg-ext\">patchbomb</literal> extension to automate the "
15730 "process of submitting the patches to an upstream maintainer. The second is "
15731 "that a backport patch could perturb the context in which a subsequent regular "
15732 "patch is applied, making it impossible to apply the regular patch cleanly "
15733 "<emphasis>without</emphasis> the earlier backport patch already being applied."
15734 msgstr ""
15736 #. type: Content of: <book><chapter><sect1><title>
15737 #: ../en/ch13-mq-collab.xml:417
15738 msgid "Useful tips for developing with MQ"
15739 msgstr "使用 MQ 开发的技巧"
15741 #. type: Content of: <book><chapter><sect1><sect2><title>
15742 #: ../en/ch13-mq-collab.xml:420
15743 msgid "Organising patches in directories"
15744 msgstr "将补丁放到几个目录中"
15746 #. type: Content of: <book><chapter><sect1><sect2><para>
15747 #: ../en/ch13-mq-collab.xml:422
15748 msgid ""
15749 "If you're working on a substantial project with MQ, it's not difficult to "
15750 "accumulate a large number of patches. For example, I have one patch "
15751 "repository that contains over 250 patches."
15752 msgstr ""
15754 #. type: Content of: <book><chapter><sect1><sect2><para>
15755 #: ../en/ch13-mq-collab.xml:427
15756 msgid ""
15757 "If you can group these patches into separate logical categories, you can if "
15758 "you like store them in different directories; MQ has no problems with patch "
15759 "names that contain path separators."
15760 msgstr ""
15762 #. type: Content of: <book><chapter><sect1><sect2><title>
15763 #: ../en/ch13-mq-collab.xml:434
15764 msgid "Viewing the history of a patch"
15765 msgstr "察看补丁的历史"
15767 #. type: Content of: <book><chapter><sect1><sect2><para>
15768 #: ../en/ch13-mq-collab.xml:436
15769 msgid ""
15770 "If you're developing a set of patches over a long time, it's a good idea to "
15771 "maintain them in a repository, as discussed in section <xref linkend=\"sec.mq."
15772 "repo\"/>. If you do so, you'll quickly discover that using the <command role="
15773 "\"hg-cmd\">hg diff</command> command to look at the history of changes to a "
15774 "patch is unworkable. This is in part because you're looking at the second "
15775 "derivative of the real code (a diff of a diff), but also because MQ adds "
15776 "noise to the process by modifying time stamps and directory names when it "
15777 "updates a patch."
15778 msgstr ""
15780 #. type: Content of: <book><chapter><sect1><sect2><para>
15781 #: ../en/ch13-mq-collab.xml:448
15782 msgid ""
15783 "However, you can use the <literal role=\"hg-ext\">extdiff</literal> "
15784 "extension, which is bundled with Mercurial, to turn a diff of two versions of "
15785 "a patch into something readable. To do this, you will need a third-party "
15786 "package called <literal role=\"package\">patchutils</literal> <citation>web:"
15787 "patchutils</citation>. This provides a command named <command>interdiff</"
15788 "command>, which shows the differences between two diffs as a diff. Used on "
15789 "two versions of the same diff, it generates a diff that represents the diff "
15790 "from the first to the second version."
15791 msgstr ""
15793 #. type: Content of: <book><chapter><sect1><sect2><para>
15794 #: ../en/ch13-mq-collab.xml:459
15795 msgid ""
15796 "You can enable the <literal role=\"hg-ext\">extdiff</literal> extension in "
15797 "the usual way, by adding a line to the <literal role=\"rc-extensions"
15798 "\">extensions</literal> section of your <filename role=\"special\"> /.hgrc</"
15799 "filename>."
15800 msgstr ""
15803 #. &example.hg-interdiff;
15804 #. type: Content of: <book><chapter><sect1><sect2><para>
15805 #: ../en/ch13-mq-collab.xml:465
15806 msgid ""
15807 "The <command>interdiff</command> command expects to be passed the names of "
15808 "two files, but the <literal role=\"hg-ext\">extdiff</literal> extension "
15809 "passes the program it runs a pair of directories, each of which can contain "
15810 "an arbitrary number of files. We thus need a small program that will run "
15811 "<command>interdiff</command> on each pair of files in these two directories. "
15812 "This program is available as <filename role=\"special\">hg-interdiff</"
15813 "filename> in the <filename class=\"directory\">examples</filename> directory "
15814 "of the source code repository that accompanies this book."
15815 msgstr ""
15817 #. type: Content of: <book><chapter><sect1><sect2><para>
15818 #: ../en/ch13-mq-collab.xml:477
15819 msgid ""
15820 "With the <filename role=\"special\">hg-interdiff</filename> program in your "
15821 "shell's search path, you can run it as follows, from inside an MQ patch "
15822 "directory:"
15823 msgstr ""
15825 #. type: Content of: <book><chapter><sect1><sect2><para>
15826 #: ../en/ch13-mq-collab.xml:482
15827 msgid ""
15828 "Since you'll probably want to use this long-winded command a lot, you can get "
15829 "<literal role=\"hg-ext\">hgext</literal> to make it available as a normal "
15830 "Mercurial command, again by editing your <filename role=\"special\"> /.hgrc</"
15831 "filename>."
15832 msgstr ""
15834 #. type: Content of: <book><chapter><sect1><sect2><para>
15835 #: ../en/ch13-mq-collab.xml:489
15836 msgid ""
15837 "This directs <literal role=\"hg-ext\">hgext</literal> to make an "
15838 "<literal>interdiff</literal> command available, so you can now shorten the "
15839 "previous invocation of <command role=\"hg-ext-extdiff\">extdiff</command> to "
15840 "something a little more wieldy."
15841 msgstr ""
15843 #. type: Content of: <book><chapter><sect1><sect2><note><para>
15844 #: ../en/ch13-mq-collab.xml:498
15845 msgid ""
15846 "The <command>interdiff</command> command works well only if the underlying "
15847 "files against which versions of a patch are generated remain the same. If "
15848 "you create a patch, modify the underlying files, and then regenerate the "
15849 "patch, <command>interdiff</command> may not produce useful output."
15850 msgstr ""
15852 #. type: Content of: <book><chapter><sect1><sect2><para>
15853 #: ../en/ch13-mq-collab.xml:506
15854 msgid ""
15855 "The <literal role=\"hg-ext\">extdiff</literal> extension is useful for more "
15856 "than merely improving the presentation of MQ patches. To read more about it, "
15857 "go to section <xref linkend=\"sec.hgext.extdiff\"/>."
15858 msgstr ""
15860 #. type: Content of: <book><chapter><title>
15861 #: ../en/ch14-hgext.xml:5
15862 msgid "Adding functionality with extensions"
15863 msgstr "使用扩展增加功能"
15865 #. type: Content of: <book><chapter><para>
15866 #: ../en/ch14-hgext.xml:7
15867 msgid ""
15868 "While the core of Mercurial is quite complete from a functionality "
15869 "standpoint, it's deliberately shorn of fancy features. This approach of "
15870 "preserving simplicity keeps the software easy to deal with for both "
15871 "maintainers and users."
15872 msgstr ""
15874 #. type: Content of: <book><chapter><para>
15875 #: ../en/ch14-hgext.xml:12
15876 msgid ""
15877 "However, Mercurial doesn't box you in with an inflexible command set: you can "
15878 "add features to it as <emphasis>extensions</emphasis> (sometimes known as "
15879 "<emphasis>plugins</emphasis>). We've already discussed a few of these "
15880 "extensions in earlier chapters."
15881 msgstr ""
15883 #. type: Content of: <book><chapter><itemizedlist><listitem><para>
15884 #: ../en/ch14-hgext.xml:18
15885 msgid ""
15886 "Section <xref linkend=\"sec.tour-merge.fetch\"/> covers the <literal role="
15887 "\"hg-ext\">fetch</literal> extension; this combines pulling new changes and "
15888 "merging them with local changes into a single command, <command role=\"hg-ext-"
15889 "fetch\">fetch</command>."
15890 msgstr ""
15892 #. type: Content of: <book><chapter><itemizedlist><listitem><para>
15893 #: ../en/ch14-hgext.xml:24
15894 msgid ""
15895 "In chapter <xref linkend=\"chap.hook\"/>, we covered several extensions that "
15896 "are useful for hook-related functionality: <literal role=\"hg-ext\">acl</"
15897 "literal> adds access control lists; <literal role=\"hg-ext\">bugzilla</"
15898 "literal> adds integration with the Bugzilla bug tracking system; and <literal "
15899 "role=\"hg-ext\">notify</literal> sends notification emails on new changes."
15900 msgstr ""
15902 #. type: Content of: <book><chapter><itemizedlist><listitem><para>
15903 #: ../en/ch14-hgext.xml:33
15904 msgid ""
15905 "The Mercurial Queues patch management extension is so invaluable that it "
15906 "merits two chapters and an appendix all to itself. Chapter <xref linkend="
15907 "\"chap.mq\"/> covers the basics; chapter <xref linkend=\"chap.mq-collab\"/> "
15908 "discusses advanced topics; and appendix <xref linkend=\"chap.mqref\"/> goes "
15909 "into detail on each command."
15910 msgstr ""
15912 #. type: Content of: <book><chapter><para>
15913 #: ../en/ch14-hgext.xml:43
15914 msgid ""
15915 "In this chapter, we'll cover some of the other extensions that are available "
15916 "for Mercurial, and briefly touch on some of the machinery you'll need to know "
15917 "about if you want to write an extension of your own."
15918 msgstr ""
15920 #. type: Content of: <book><chapter><itemizedlist><listitem><para>
15921 #: ../en/ch14-hgext.xml:48
15922 msgid ""
15923 "In section <xref linkend=\"sec.hgext.inotify\"/>, we'll discuss the "
15924 "possibility of <emphasis>huge</emphasis> performance improvements using the "
15925 "<literal role=\"hg-ext\">inotify</literal> extension."
15926 msgstr ""
15928 #. type: Content of: <book><chapter><sect1><title>
15929 #: ../en/ch14-hgext.xml:55
15930 msgid ""
15931 "Improve performance with the <literal role=\"hg-ext\">inotify</literal> "
15932 "extension"
15933 msgstr "使用扩展 <literal role=\"hg-ext\">inotify</literal> 以提高性能"
15935 #. type: Content of: <book><chapter><sect1><para>
15936 #: ../en/ch14-hgext.xml:58
15937 msgid ""
15938 "Are you interested in having some of the most common Mercurial operations run "
15939 "as much as a hundred times faster? Read on!"
15940 msgstr ""
15942 #. type: Content of: <book><chapter><sect1><para>
15943 #: ../en/ch14-hgext.xml:62
15944 msgid ""
15945 "Mercurial has great performance under normal circumstances. For example, "
15946 "when you run the <command role=\"hg-cmd\">hg status</command> command, "
15947 "Mercurial has to scan almost every directory and file in your repository so "
15948 "that it can display file status. Many other Mercurial commands need to do "
15949 "the same work behind the scenes; for example, the <command role=\"hg-cmd\">hg "
15950 "diff</command> command uses the status machinery to avoid doing an expensive "
15951 "comparison operation on files that obviously haven't changed."
15952 msgstr ""
15954 #. type: Content of: <book><chapter><sect1><para>
15955 #: ../en/ch14-hgext.xml:72
15956 msgid ""
15957 "Because obtaining file status is crucial to good performance, the authors of "
15958 "Mercurial have optimised this code to within an inch of its life. However, "
15959 "there's no avoiding the fact that when you run <command role=\"hg-cmd\">hg "
15960 "status</command>, Mercurial is going to have to perform at least one "
15961 "expensive system call for each managed file to determine whether it's changed "
15962 "since the last time Mercurial checked. For a sufficiently large repository, "
15963 "this can take a long time."
15964 msgstr ""
15966 #. type: Content of: <book><chapter><sect1><para>
15967 #: ../en/ch14-hgext.xml:82
15968 msgid ""
15969 "To put a number on the magnitude of this effect, I created a repository "
15970 "containing 150,000 managed files. I timed <command role=\"hg-cmd\">hg "
15971 "status</command> as taking ten seconds to run, even when <emphasis>none</"
15972 "emphasis> of those files had been modified."
15973 msgstr ""
15975 #. type: Content of: <book><chapter><sect1><para>
15976 #: ../en/ch14-hgext.xml:88
15977 msgid ""
15978 "Many modern operating systems contain a file notification facility. If a "
15979 "program signs up to an appropriate service, the operating system will notify "
15980 "it every time a file of interest is created, modified, or deleted. On Linux "
15981 "systems, the kernel component that does this is called <literal>inotify</"
15982 "literal>."
15983 msgstr ""
15985 #. type: Content of: <book><chapter><sect1><para>
15986 #: ../en/ch14-hgext.xml:95
15987 msgid ""
15988 "Mercurial's <literal role=\"hg-ext\">inotify</literal> extension talks to the "
15989 "kernel's <literal>inotify</literal> component to optimise <command role=\"hg-"
15990 "cmd\">hg status</command> commands. The extension has two components. A "
15991 "daemon sits in the background and receives notifications from the "
15992 "<literal>inotify</literal> subsystem. It also listens for connections from a "
15993 "regular Mercurial command. The extension modifies Mercurial's behaviour so "
15994 "that instead of scanning the filesystem, it queries the daemon. Since the "
15995 "daemon has perfect information about the state of the repository, it can "
15996 "respond with a result instantaneously, avoiding the need to scan every "
15997 "directory and file in the repository."
15998 msgstr ""
16000 #. type: Content of: <book><chapter><sect1><para>
16001 #: ../en/ch14-hgext.xml:108
16002 msgid ""
16003 "Recall the ten seconds that I measured plain Mercurial as taking to run "
16004 "<command role=\"hg-cmd\">hg status</command> on a 150,000 file repository. "
16005 "With the <literal role=\"hg-ext\">inotify</literal> extension enabled, the "
16006 "time dropped to 0.1 seconds, a factor of <emphasis>one hundred</emphasis> "
16007 "faster."
16008 msgstr ""
16010 #. type: Content of: <book><chapter><sect1><para>
16011 #: ../en/ch14-hgext.xml:115
16012 msgid "Before we continue, please pay attention to some caveats."
16013 msgstr ""
16015 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
16016 #: ../en/ch14-hgext.xml:118
16017 msgid ""
16018 "The <literal role=\"hg-ext\">inotify</literal> extension is Linux-specific. "
16019 "Because it interfaces directly to the Linux kernel's <literal>inotify</"
16020 "literal> subsystem, it does not work on other operating systems."
16021 msgstr ""
16023 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
16024 #: ../en/ch14-hgext.xml:123
16025 msgid ""
16026 "It should work on any Linux distribution that was released after early 2005. "
16027 "Older distributions are likely to have a kernel that lacks <literal>inotify</"
16028 "literal>, or a version of <literal>glibc</literal> that does not have the "
16029 "necessary interfacing support."
16030 msgstr ""
16032 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
16033 #: ../en/ch14-hgext.xml:130
16034 msgid ""
16035 "Not all filesystems are suitable for use with the <literal role=\"hg-ext"
16036 "\">inotify</literal> extension. Network filesystems such as NFS are a non-"
16037 "starter, for example, particularly if you're running Mercurial on several "
16038 "systems, all mounting the same network filesystem. The kernel's "
16039 "<literal>inotify</literal> system has no way of knowing about changes made on "
16040 "another system. Most local filesystems (e.g. ext3, XFS, ReiserFS) should "
16041 "work fine."
16042 msgstr ""
16044 #. type: Content of: <book><chapter><sect1><para>
16045 #: ../en/ch14-hgext.xml:141
16046 msgid ""
16047 "The <literal role=\"hg-ext\">inotify</literal> extension is not yet shipped "
16048 "with Mercurial as of May 2007, so it's a little more involved to set up than "
16049 "other extensions. But the performance improvement is worth it!"
16050 msgstr ""
16052 #. type: Content of: <book><chapter><sect1><para>
16053 #: ../en/ch14-hgext.xml:146
16054 msgid ""
16055 "The extension currently comes in two parts: a set of patches to the Mercurial "
16056 "source code, and a library of Python bindings to the <literal>inotify</"
16057 "literal> subsystem."
16058 msgstr ""
16060 #. type: Content of: <book><chapter><sect1><note><para>
16061 #: ../en/ch14-hgext.xml:150
16062 msgid ""
16063 "There are <emphasis>two</emphasis> Python <literal>inotify</literal> binding "
16064 "libraries. One of them is called <literal>pyinotify</literal>, and is "
16065 "packaged by some Linux distributions as <literal>python-inotify</literal>. "
16066 "This is <emphasis>not</emphasis> the one you'll need, as it is too buggy and "
16067 "inefficient to be practical."
16068 msgstr ""
16070 #. type: Content of: <book><chapter><sect1><para>
16071 #: ../en/ch14-hgext.xml:157
16072 msgid ""
16073 "To get going, it's best to already have a functioning copy of Mercurial "
16074 "installed."
16075 msgstr ""
16077 #. type: Content of: <book><chapter><sect1><note><para>
16078 #: ../en/ch14-hgext.xml:160
16079 msgid ""
16080 "If you follow the instructions below, you'll be <emphasis>replacing</"
16081 "emphasis> and overwriting any existing installation of Mercurial that you "
16082 "might already have, using the latest <quote>bleeding edge</quote> Mercurial "
16083 "code. Don't say you weren't warned!"
16084 msgstr ""
16086 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
16087 #: ../en/ch14-hgext.xml:167
16088 msgid ""
16089 "Clone the Python <literal>inotify</literal> binding repository. Build and "
16090 "install it."
16091 msgstr ""
16093 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
16094 #: ../en/ch14-hgext.xml:175
16095 msgid ""
16096 "Clone the <filename class=\"directory\">crew</filename> Mercurial "
16097 "repository. Clone the <literal role=\"hg-ext\">inotify</literal> patch "
16098 "repository so that Mercurial Queues will be able to apply patches to your "
16099 "cope of the <filename class=\"directory\">crew</filename> repository."
16100 msgstr ""
16102 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
16103 #: ../en/ch14-hgext.xml:188
16104 msgid ""
16105 "Make sure that you have the Mercurial Queues extension, <literal role=\"hg-ext"
16106 "\">mq</literal>, enabled. If you've never used MQ, read section <xref "
16107 "linkend=\"sec.mq.start\"/> to get started quickly."
16108 msgstr ""
16110 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
16111 #: ../en/ch14-hgext.xml:194
16112 msgid ""
16113 "Go into the <filename class=\"directory\">inotify</filename> repo, and apply "
16114 "all of the <literal role=\"hg-ext\">inotify</literal> patches using the "
16115 "<option role=\"hg-ext-mq-cmd-qpush-opt\">hg -a</option> option to the "
16116 "<command role=\"hg-ext-mq\">qpush</command> command."
16117 msgstr ""
16119 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
16120 #: ../en/ch14-hgext.xml:204
16121 msgid ""
16122 "If you get an error message from <command role=\"hg-ext-mq\">qpush</command>, "
16123 "you should not continue. Instead, ask for help."
16124 msgstr ""
16126 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
16127 #: ../en/ch14-hgext.xml:208
16128 msgid "Build and install the patched version of Mercurial."
16129 msgstr ""
16131 #. type: Content of: <book><chapter><sect1><para>
16132 #: ../en/ch14-hgext.xml:216
16133 msgid ""
16134 "Once you've build a suitably patched version of Mercurial, all you need to do "
16135 "to enable the <literal role=\"hg-ext\">inotify</literal> extension is add an "
16136 "entry to your <filename role=\"special\"> /.hgrc</filename>."
16137 msgstr ""
16139 #. type: Content of: <book><chapter><sect1><para>
16140 #: ../en/ch14-hgext.xml:221
16141 msgid ""
16142 "When the <literal role=\"hg-ext\">inotify</literal> extension is enabled, "
16143 "Mercurial will automatically and transparently start the status daemon the "
16144 "first time you run a command that needs status in a repository. It runs one "
16145 "status daemon per repository."
16146 msgstr ""
16148 #. type: Content of: <book><chapter><sect1><para>
16149 #: ../en/ch14-hgext.xml:227
16150 msgid ""
16151 "The status daemon is started silently, and runs in the background. If you "
16152 "look at a list of running processes after you've enabled the <literal role="
16153 "\"hg-ext\">inotify</literal> extension and run a few commands in different "
16154 "repositories, you'll thus see a few <literal>hg</literal> processes sitting "
16155 "around, waiting for updates from the kernel and queries from Mercurial."
16156 msgstr ""
16158 #. type: Content of: <book><chapter><sect1><para>
16159 #: ../en/ch14-hgext.xml:235
16160 msgid ""
16161 "The first time you run a Mercurial command in a repository when you have the "
16162 "<literal role=\"hg-ext\">inotify</literal> extension enabled, it will run "
16163 "with about the same performance as a normal Mercurial command. This is "
16164 "because the status daemon needs to perform a normal status scan so that it "
16165 "has a baseline against which to apply later updates from the kernel. "
16166 "However, <emphasis>every</emphasis> subsequent command that does any kind of "
16167 "status check should be noticeably faster on repositories of even fairly "
16168 "modest size. Better yet, the bigger your repository is, the greater a "
16169 "performance advantage you'll see. The <literal role=\"hg-ext\">inotify</"
16170 "literal> daemon makes status operations almost instantaneous on repositories "
16171 "of all sizes!"
16172 msgstr ""
16174 #. type: Content of: <book><chapter><sect1><para>
16175 #: ../en/ch14-hgext.xml:249
16176 msgid ""
16177 "If you like, you can manually start a status daemon using the <command role="
16178 "\"hg-ext-inotify\">inserve</command> command. This gives you slightly finer "
16179 "control over how the daemon ought to run. This command will of course only "
16180 "be available when the <literal role=\"hg-ext\">inotify</literal> extension is "
16181 "enabled."
16182 msgstr ""
16184 #. type: Content of: <book><chapter><sect1><para>
16185 #: ../en/ch14-hgext.xml:256
16186 msgid ""
16187 "When you're using the <literal role=\"hg-ext\">inotify</literal> extension, "
16188 "you should notice <emphasis>no difference at all</emphasis> in Mercurial's "
16189 "behaviour, with the sole exception of status-related commands running a whole "
16190 "lot faster than they used to. You should specifically expect that commands "
16191 "will not print different output; neither should they give different results. "
16192 "If either of these situations occurs, please report a bug."
16193 msgstr ""
16195 #. type: Content of: <book><chapter><sect1><title>
16196 #: ../en/ch14-hgext.xml:267
16197 msgid ""
16198 "Flexible diff support with the <literal role=\"hg-ext\">extdiff</literal> "
16199 "extension"
16200 msgstr "使用扩展 <literal role=\"hg-ext\">extdiff</literal> 以扩展差异支持"
16202 #. type: Content of: <book><chapter><sect1><para>
16203 #: ../en/ch14-hgext.xml:270
16204 msgid ""
16205 "Mercurial's built-in <command role=\"hg-cmd\">hg diff</command> command "
16206 "outputs plaintext unified diffs."
16207 msgstr ""
16208 "Mercurial 内置命令 <command role=\"hg-cmd\">hg diff</command> 的输出与统一差异"
16209 "不同。"
16211 #. type: Content of: <book><chapter><sect1><para>
16212 #: ../en/ch14-hgext.xml:275
16213 msgid ""
16214 "If you would like to use an external tool to display modifications, you'll "
16215 "want to use the <literal role=\"hg-ext\">extdiff</literal> extension. This "
16216 "will let you use, for example, a graphical diff tool."
16217 msgstr ""
16219 #. type: Content of: <book><chapter><sect1><para>
16220 #: ../en/ch14-hgext.xml:280
16221 msgid ""
16222 "The <literal role=\"hg-ext\">extdiff</literal> extension is bundled with "
16223 "Mercurial, so it's easy to set up. In the <literal role=\"rc-extensions"
16224 "\">extensions</literal> section of your <filename role=\"special\"> /.hgrc</"
16225 "filename>, simply add a one-line entry to enable the extension."
16226 msgstr ""
16228 #. type: Content of: <book><chapter><sect1><para>
16229 #: ../en/ch14-hgext.xml:286
16230 msgid ""
16231 "This introduces a command named <command role=\"hg-ext-extdiff\">extdiff</"
16232 "command>, which by default uses your system's <command>diff</command> command "
16233 "to generate a unified diff in the same form as the built-in <command role="
16234 "\"hg-cmd\">hg diff</command> command."
16235 msgstr ""
16237 #. type: Content of: <book><chapter><sect1><para>
16238 #: ../en/ch14-hgext.xml:294
16239 msgid ""
16240 "The result won't be exactly the same as with the built-in <command role=\"hg-"
16241 "cmd\">hg diff</command> variations, because the output of <command>diff</"
16242 "command> varies from one system to another, even when passed the same options."
16243 msgstr ""
16245 #. type: Content of: <book><chapter><sect1><para>
16246 #: ../en/ch14-hgext.xml:299
16247 msgid ""
16248 "As the <quote><literal>making snapshot</literal></quote> lines of output "
16249 "above imply, the <command role=\"hg-ext-extdiff\">extdiff</command> command "
16250 "works by creating two snapshots of your source tree. The first snapshot is "
16251 "of the source revision; the second, of the target revision or working "
16252 "directory. The <command role=\"hg-ext-extdiff\">extdiff</command> command "
16253 "generates these snapshots in a temporary directory, passes the name of each "
16254 "directory to an external diff viewer, then deletes the temporary directory. "
16255 "For efficiency, it only snapshots the directories and files that have changed "
16256 "between the two revisions."
16257 msgstr ""
16259 #. type: Content of: <book><chapter><sect1><para>
16260 #: ../en/ch14-hgext.xml:312
16261 msgid ""
16262 "Snapshot directory names have the same base name as your repository. If your "
16263 "repository path is <filename class=\"directory\">/quux/bar/foo</filename>, "
16264 "then <filename class=\"directory\">foo</filename> will be the name of each "
16265 "snapshot directory. Each snapshot directory name has its changeset ID "
16266 "appended, if appropriate. If a snapshot is of revision "
16267 "<literal>a631aca1083f</literal>, the directory will be named <filename class="
16268 "\"directory\">foo.a631aca1083f</filename>. A snapshot of the working "
16269 "directory won't have a changeset ID appended, so it would just be <filename "
16270 "class=\"directory\">foo</filename> in this example. To see what this looks "
16271 "like in practice, look again at the <command role=\"hg-ext-extdiff\">extdiff</"
16272 "command> example above. Notice that the diff has the snapshot directory "
16273 "names embedded in its header."
16274 msgstr ""
16276 #. type: Content of: <book><chapter><sect1><para>
16277 #: ../en/ch14-hgext.xml:328
16278 msgid ""
16279 "The <command role=\"hg-ext-extdiff\">extdiff</command> command accepts two "
16280 "important options. The <option role=\"hg-ext-extdiff-cmd-extdiff-opt\">hg -p</"
16281 "option> option lets you choose a program to view differences with, instead of "
16282 "<command>diff</command>. With the <option role=\"hg-ext-extdiff-cmd-extdiff-"
16283 "opt\">hg -o</option> option, you can change the options that <command role="
16284 "\"hg-ext-extdiff\">extdiff</command> passes to the program (by default, these "
16285 "options are <quote><literal>-Npru</literal></quote>, which only make sense if "
16286 "you're running <command>diff</command>). In other respects, the <command "
16287 "role=\"hg-ext-extdiff\">extdiff</command> command acts similarly to the built-"
16288 "in <command role=\"hg-cmd\">hg diff</command> command: you use the same "
16289 "option names, syntax, and arguments to specify the revisions you want, the "
16290 "files you want, and so on."
16291 msgstr ""
16294 #. type: Content of: <book><chapter><sect1><para>
16295 #: ../en/ch14-hgext.xml:345
16296 msgid ""
16297 "As an example, here's how to run the normal system <command>diff</command> "
16298 "command, getting it to generate context diffs (using the <option role=\"cmd-"
16299 "opt-diff\">-c</option> option) instead of unified diffs, and five lines of "
16300 "context instead of the default three (passing <literal>5</literal> as the "
16301 "argument to the <option role=\"cmd-opt-diff\">-C</option> option)."
16302 msgstr ""
16304 #. type: Content of: <book><chapter><sect1><para>
16305 #: ../en/ch14-hgext.xml:354
16306 msgid ""
16307 "Launching a visual diff tool is just as easy. Here's how to launch the "
16308 "<command>kdiff3</command> viewer."
16309 msgstr ""
16311 #. type: Content of: <book><chapter><sect1><para>
16312 #: ../en/ch14-hgext.xml:358
16313 msgid ""
16314 "If your diff viewing command can't deal with directories, you can easily work "
16315 "around this with a little scripting. For an example of such scripting in "
16316 "action with the <literal role=\"hg-ext\">mq</literal> extension and the "
16317 "<command>interdiff</command> command, see section <xref linkend=\"mq-collab."
16318 "tips.interdiff\"/>."
16319 msgstr ""
16321 #. type: Content of: <book><chapter><sect1><sect2><title>
16322 #: ../en/ch14-hgext.xml:366
16323 msgid "Defining command aliases"
16324 msgstr "定义命令的别名"
16326 #. type: Content of: <book><chapter><sect1><sect2><para>
16327 #: ../en/ch14-hgext.xml:368
16328 msgid ""
16329 "It can be cumbersome to remember the options to both the <command role=\"hg-"
16330 "ext-extdiff\">extdiff</command> command and the diff viewer you want to use, "
16331 "so the <literal role=\"hg-ext\">extdiff</literal> extension lets you define "
16332 "<emphasis>new</emphasis> commands that will invoke your diff viewer with "
16333 "exactly the right options."
16334 msgstr ""
16336 #. type: Content of: <book><chapter><sect1><sect2><para>
16337 #: ../en/ch14-hgext.xml:375
16338 msgid ""
16339 "All you need to do is edit your <filename role=\"special\"> /.hgrc</"
16340 "filename>, and add a section named <literal role=\"rc-extdiff\">extdiff</"
16341 "literal>. Inside this section, you can define multiple commands. Here's how "
16342 "to add a <literal>kdiff3</literal> command. Once you've defined this, you "
16343 "can type <quote><literal>hg kdiff3</literal></quote> and the <literal role="
16344 "\"hg-ext\">extdiff</literal> extension will run <command>kdiff3</command> for "
16345 "you."
16346 msgstr ""
16348 #. type: Content of: <book><chapter><sect1><sect2><para>
16349 #: ../en/ch14-hgext.xml:384
16350 msgid ""
16351 "If you leave the right hand side of the definition empty, as above, the "
16352 "<literal role=\"hg-ext\">extdiff</literal> extension uses the name of the "
16353 "command you defined as the name of the external program to run. But these "
16354 "names don't have to be the same. Here, we define a command named "
16355 "<quote><literal>hg wibble</literal></quote>, which runs <command>kdiff3</"
16356 "command>."
16357 msgstr ""
16359 #. type: Content of: <book><chapter><sect1><sect2><para>
16360 #: ../en/ch14-hgext.xml:393
16361 msgid ""
16362 "You can also specify the default options that you want to invoke your diff "
16363 "viewing program with. The prefix to use is <quote><literal>opts.</literal></"
16364 "quote>, followed by the name of the command to which the options apply. This "
16365 "example defines a <quote><literal>hg vimdiff</literal></quote> command that "
16366 "runs the <command>vim</command> editor's <literal>DirDiff</literal> extension."
16367 msgstr ""
16369 #. type: Content of: <book><chapter><sect1><title>
16370 #: ../en/ch14-hgext.xml:406
16371 msgid ""
16372 "Cherrypicking changes with the <literal role=\"hg-ext\">transplant</literal> "
16373 "extension"
16374 msgstr "使用扩展 <literal role=\"hg-ext\">transplant</literal> 以挑选修改"
16376 #. type: Content of: <book><chapter><sect1><para>
16377 #: ../en/ch14-hgext.xml:409
16378 msgid "Need to have a long chat with Brendan about this."
16379 msgstr ""
16381 #. type: Content of: <book><chapter><sect1><title>
16382 #: ../en/ch14-hgext.xml:413
16383 msgid ""
16384 "Send changes via email with the <literal role=\"hg-ext\">patchbomb</literal> "
16385 "extension"
16386 msgstr ""
16387 "使用扩展 <literal role=\"hg-ext\">patchbomb</literal> 通过 email 发送修改"
16389 #. type: Content of: <book><chapter><sect1><para>
16390 #: ../en/ch14-hgext.xml:416
16391 msgid ""
16392 "Many projects have a culture of <quote>change review</quote>, in which people "
16393 "send their modifications to a mailing list for others to read and comment on "
16394 "before they commit the final version to a shared repository. Some projects "
16395 "have people who act as gatekeepers; they apply changes from other people to a "
16396 "repository to which those others don't have access."
16397 msgstr ""
16399 #. type: Content of: <book><chapter><sect1><para>
16400 #: ../en/ch14-hgext.xml:424
16401 msgid ""
16402 "Mercurial makes it easy to send changes over email for review or application, "
16403 "via its <literal role=\"hg-ext\">patchbomb</literal> extension. The "
16404 "extension is so named because changes are formatted as patches, and it's "
16405 "usual to send one changeset per email message. Sending a long series of "
16406 "changes by email is thus much like <quote>bombing</quote> the recipient's "
16407 "inbox, hence <quote>patchbomb</quote>."
16408 msgstr ""
16410 #. type: Content of: <book><chapter><sect1><para>
16411 #: ../en/ch14-hgext.xml:432
16412 msgid ""
16413 "As usual, the basic configuration of the <literal role=\"hg-ext\">patchbomb</"
16414 "literal> extension takes just one or two lines in your <filename role="
16415 "\"special\"> /.hgrc</filename>."
16416 msgstr ""
16418 #. type: Content of: <book><chapter><sect1><para>
16419 #: ../en/ch14-hgext.xml:437
16420 msgid ""
16421 "Once you've enabled the extension, you will have a new command available, "
16422 "named <command role=\"hg-ext-patchbomb\">email</command>."
16423 msgstr ""
16425 #. type: Content of: <book><chapter><sect1><para>
16426 #: ../en/ch14-hgext.xml:441
16427 msgid ""
16428 "The safest and best way to invoke the <command role=\"hg-ext-patchbomb"
16429 "\">email</command> command is to <emphasis>always</emphasis> run it first "
16430 "with the <option role=\"hg-ext-patchbomb-cmd-email-opt\">hg -n</option> "
16431 "option. This will show you what the command <emphasis>would</emphasis> send, "
16432 "without actually sending anything. Once you've had a quick glance over the "
16433 "changes and verified that you are sending the right ones, you can rerun the "
16434 "same command, with the <option role=\"hg-ext-patchbomb-cmd-email-opt\">hg -n</"
16435 "option> option removed."
16436 msgstr ""
16438 #. type: Content of: <book><chapter><sect1><para>
16439 #: ../en/ch14-hgext.xml:452
16440 msgid ""
16441 "The <command role=\"hg-ext-patchbomb\">email</command> command accepts the "
16442 "same kind of revision syntax as every other Mercurial command. For example, "
16443 "this command will send every revision between 7 and <literal>tip</literal>, "
16444 "inclusive."
16445 msgstr ""
16447 #. type: Content of: <book><chapter><sect1><para>
16448 #: ../en/ch14-hgext.xml:457
16449 msgid ""
16450 "You can also specify a <emphasis>repository</emphasis> to compare with. If "
16451 "you provide a repository but no revisions, the <command role=\"hg-ext-"
16452 "patchbomb\">email</command> command will send all revisions in the local "
16453 "repository that are not present in the remote repository. If you "
16454 "additionally specify revisions or a branch name (the latter using the <option "
16455 "role=\"hg-ext-patchbomb-cmd-email-opt\">hg -b</option> option), this will "
16456 "constrain the revisions sent."
16457 msgstr ""
16459 #. type: Content of: <book><chapter><sect1><para>
16460 #: ../en/ch14-hgext.xml:466
16461 msgid ""
16462 "It's perfectly safe to run the <command role=\"hg-ext-patchbomb\">email</"
16463 "command> command without the names of the people you want to send to: if you "
16464 "do this, it will just prompt you for those values interactively. (If you're "
16465 "using a Linux or Unix-like system, you should have enhanced "
16466 "<literal>readline</literal>-style editing capabilities when entering those "
16467 "headers, too, which is useful.)"
16468 msgstr ""
16470 #. type: Content of: <book><chapter><sect1><para>
16471 #: ../en/ch14-hgext.xml:474
16472 msgid ""
16473 "When you are sending just one revision, the <command role=\"hg-ext-patchbomb"
16474 "\">email</command> command will by default use the first line of the "
16475 "changeset description as the subject of the single email message it sends."
16476 msgstr ""
16478 #. type: Content of: <book><chapter><sect1><para>
16479 #: ../en/ch14-hgext.xml:479
16480 msgid ""
16481 "If you send multiple revisions, the <command role=\"hg-ext-patchbomb\">email</"
16482 "command> command will usually send one message per changeset. It will "
16483 "preface the series with an introductory message, in which you should describe "
16484 "the purpose of the series of changes you're sending."
16485 msgstr ""
16487 #. type: Content of: <book><chapter><sect1><sect2><title>
16488 #: ../en/ch14-hgext.xml:486
16489 msgid "Changing the behaviour of patchbombs"
16490 msgstr "修改 patchbomb 的行为"
16492 #. type: Content of: <book><chapter><sect1><sect2><para>
16493 #: ../en/ch14-hgext.xml:488
16494 msgid ""
16495 "Not every project has exactly the same conventions for sending changes in "
16496 "email; the <literal role=\"hg-ext\">patchbomb</literal> extension tries to "
16497 "accommodate a number of variations through command line options."
16498 msgstr ""
16500 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
16501 #: ../en/ch14-hgext.xml:494
16502 msgid ""
16503 "You can write a subject for the introductory message on the command line "
16504 "using the <option role=\"hg-ext-patchbomb-cmd-email-opt\">hg -s</option> "
16505 "option. This takes one argument, the text of the subject to use."
16506 msgstr ""
16508 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
16509 #: ../en/ch14-hgext.xml:500
16510 msgid ""
16511 "To change the email address from which the messages originate, use the "
16512 "<option role=\"hg-ext-patchbomb-cmd-email-opt\">hg -f</option> option. This "
16513 "takes one argument, the email address to use."
16514 msgstr ""
16516 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
16517 #: ../en/ch14-hgext.xml:506
16518 msgid ""
16519 "The default behaviour is to send unified diffs (see section <xref linkend="
16520 "\"sec.mq.patch\"/> for a description of the format), one per message. You "
16521 "can send a binary bundle instead with the <option role=\"hg-ext-patchbomb-cmd-"
16522 "email-opt\">hg -b</option> option."
16523 msgstr ""
16525 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
16526 #: ../en/ch14-hgext.xml:514
16527 msgid ""
16528 "Unified diffs are normally prefaced with a metadata header. You can omit "
16529 "this, and send unadorned diffs, with the <option role=\"hg-ext-patchbomb-cmd-"
16530 "email-opt\">hg --plain</option> option."
16531 msgstr ""
16533 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
16534 #: ../en/ch14-hgext.xml:520
16535 msgid ""
16536 "Diffs are normally sent <quote>inline</quote>, in the same body part as the "
16537 "description of a patch. This makes it easiest for the largest number of "
16538 "readers to quote and respond to parts of a diff, as some mail clients will "
16539 "only quote the first MIME body part in a message. If you'd prefer to send the "
16540 "description and the diff in separate body parts, use the <option role=\"hg-"
16541 "ext-patchbomb-cmd-email-opt\">hg -a</option> option."
16542 msgstr ""
16544 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
16545 #: ../en/ch14-hgext.xml:530
16546 msgid ""
16547 "Instead of sending mail messages, you can write them to an <literal>mbox</"
16548 "literal>-format mail folder using the <option role=\"hg-ext-patchbomb-cmd-"
16549 "email-opt\">hg -m</option> option. That option takes one argument, the name "
16550 "of the file to write to."
16551 msgstr ""
16553 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
16554 #: ../en/ch14-hgext.xml:537
16555 msgid ""
16556 "If you would like to add a <command>diffstat</command>-format summary to each "
16557 "patch, and one to the introductory message, use the <option role=\"hg-ext-"
16558 "patchbomb-cmd-email-opt\">hg -d</option> option. The <command>diffstat</"
16559 "command> command displays a table containing the name of each file patched, "
16560 "the number of lines affected, and a histogram showing how much each file is "
16561 "modified. This gives readers a qualitative glance at how complex a patch is."
16562 msgstr ""