rev |
line source |
dongsheng@627
|
1 #
|
dongsheng@627
|
2 # Simplified Chinese translation for hgbook
|
dongsheng@627
|
3 # This file is distributed under the same license as the hgbook.
|
dongsheng@627
|
4 #
|
dongsheng@627
|
5 # Authors:
|
dongsheng@627
|
6 # Dongsheng Song <dongsheng.song@gmail.com>, 2009
|
dongsheng@627
|
7 #
|
dongsheng@627
|
8 # Check translation:
|
dongsheng@627
|
9 # msgfmt --statistics -c -o zh.mo zh.po
|
dongsheng@627
|
10 #
|
dongsheng@627
|
11 # Please format your translation before commit:
|
dongsheng@627
|
12 # msgcat --sort-by-file --width=80 -o zh_new.po zh.po
|
dongsheng@627
|
13 # mv -f zh_new.po zh.po
|
dongsheng@627
|
14 #
|
dongsheng@627
|
15 # Dictionary:
|
dongsheng@627
|
16 # blame 追溯
|
dongsheng@627
|
17 # branch 分支
|
dongsheng@627
|
18 # changes 修改
|
dongsheng@627
|
19 # changeset 修改集
|
dongsheng@627
|
20 # checkout 检出
|
dongsheng@627
|
21 # remove 移除(从版本库删除)
|
dongsheng@627
|
22 # delete 删除(只从文件系统删除)
|
dongsheng@660
|
23 # filelog 文件日志
|
dongsheng@627
|
24 # patchset 补丁集
|
dongsheng@627
|
25 # pushing to 推到
|
dongsheng@635
|
26 # pulling from 拉自,抓取
|
dongsheng@627
|
27 # rename 改名
|
dongsheng@627
|
28 # repository 版本库
|
dongsheng@627
|
29 # revert 恢复
|
dongsheng@627
|
30 # revision 版本
|
dongsheng@660
|
31 # revlog 版本日志
|
dongsheng@627
|
32 # tag 标签
|
dongsheng@627
|
33 # tip 顶点
|
dongsheng@627
|
34 # undo 撤销
|
dongsheng@627
|
35 # unversioned 未版本控制
|
dongsheng@660
|
36 # updated 更新到,同步到(适用于旧版本)
|
dongsheng@627
|
37 # versioned 受版本控制
|
dongsheng@627
|
38 # working copy 工作副本
|
dongsheng@627
|
39 # ...
|
dongsheng@627
|
40 #
|
dongsheng@627
|
41 msgid ""
|
dongsheng@627
|
42 msgstr ""
|
dongsheng@627
|
43 "Project-Id-Version: hgbook 1.2\n"
|
dongsheng@1034
|
44 "POT-Creation-Date: 2009-11-04 14:06+0800\n"
|
dongsheng@876
|
45 "PO-Revision-Date: 2009-10-21 16:42+0800\n"
|
songdongsheng@668
|
46 "Last-Translator: 宋冬生 <songdonogsheng@live.cn>\n"
|
dongsheng@627
|
47 "Language-Team: Simplified Chinese <i18n-zh@googlegroups.com >\n"
|
dongsheng@627
|
48 "MIME-Version: 1.0\n"
|
dongsheng@627
|
49 "Content-Type: text/plain; charset=UTF-8\n"
|
dongsheng@627
|
50 "Content-Transfer-Encoding: 8bit\n"
|
dongsheng@627
|
51 "X-Poedit-Language: Chinese\n"
|
dongsheng@627
|
52 "X-Poedit-Country: CHINA\n"
|
dongsheng@627
|
53 "X-Poedit-SourceCharset: utf-8\n"
|
dongsheng@627
|
54
|
dongsheng@627
|
55 #. type: Content of: <book><title>
|
dongsheng@714
|
56 #: ../en/00book.xml:42
|
dongsheng@627
|
57 msgid "Mercurial: The Definitive Guide"
|
dongsheng@627
|
58 msgstr "Mercurial 权威指南"
|
dongsheng@627
|
59
|
dongsheng@627
|
60 #. type: Content of: <book><subtitle>
|
dongsheng@714
|
61 #: ../en/00book.xml:47
|
dongsheng@627
|
62 msgid "Compiled from $rev_id$"
|
dongsheng@627
|
63 msgstr "编译自 $rev_id$"
|
dongsheng@627
|
64
|
songdongsheng@667
|
65 #. type: Content of: <book><bookinfo>
|
dongsheng@714
|
66 #: ../en/00book.xml:49
|
songdongsheng@667
|
67 msgid "<edition>1</edition> <isbn>9780596800673</isbn>"
|
songdongsheng@668
|
68 msgstr "<edition>1</edition> <isbn>9780596800673</isbn>"
|
songdongsheng@667
|
69
|
dongsheng@627
|
70 #. type: Content of: <book><bookinfo><authorgroup><author><firstname>
|
dongsheng@714
|
71 #: ../en/00book.xml:53
|
dongsheng@627
|
72 msgid "Bryan"
|
dongsheng@643
|
73 msgstr "Bryan"
|
dongsheng@627
|
74
|
dongsheng@627
|
75 #. type: Content of: <book><bookinfo><authorgroup><author><surname>
|
dongsheng@714
|
76 #: ../en/00book.xml:54
|
dongsheng@627
|
77 msgid "O'Sullivan"
|
dongsheng@643
|
78 msgstr "O'Sullivan"
|
dongsheng@627
|
79
|
dongsheng@627
|
80 #. type: Content of: <book><bookinfo>
|
dongsheng@714
|
81 #: ../en/00book.xml:58
|
dongsheng@627
|
82 msgid ""
|
dongsheng@627
|
83 "<editor> <firstname>Mike</firstname> <surname>Loukides</surname> </editor> "
|
dongsheng@627
|
84 "<copyright> <year>2006</year> <year>2007</year> <year>2008</year> <year>2009</"
|
dongsheng@627
|
85 "year> <holder>Bryan O'Sullivan</holder> </copyright>"
|
dongsheng@627
|
86 msgstr ""
|
dongsheng@643
|
87 "<editor> <firstname>Mike</firstname> <surname>Loukides</surname> </editor> "
|
dongsheng@643
|
88 "<copyright> <year>2006</year> <year>2007</year> <year>2008</year> <year>2009</"
|
dongsheng@643
|
89 "year> <holder>Bryan O'Sullivan</holder> </copyright>"
|
dongsheng@627
|
90
|
dongsheng@627
|
91 #. type: Content of: <book><appendix><title>
|
dongsheng@714
|
92 #: ../en/appA-svn.xml:5
|
dongsheng@714
|
93 msgid "Migrating to Mercurial"
|
dongsheng@715
|
94 msgstr "迁移到 Mercurial"
|
dongsheng@714
|
95
|
dongsheng@714
|
96 #. type: Content of: <book><appendix><para>
|
dongsheng@714
|
97 #: ../en/appA-svn.xml:7
|
dongsheng@714
|
98 msgid ""
|
dongsheng@714
|
99 "A common way to test the waters with a new revision control tool is to "
|
dongsheng@714
|
100 "experiment with switching an existing project, rather than starting a new "
|
dongsheng@714
|
101 "project from scratch."
|
dongsheng@714
|
102 msgstr ""
|
dongsheng@714
|
103
|
dongsheng@714
|
104 #. type: Content of: <book><appendix><para>
|
dongsheng@714
|
105 #: ../en/appA-svn.xml:11
|
dongsheng@714
|
106 msgid ""
|
dongsheng@714
|
107 "In this appendix, we discuss how to import a project's history into "
|
dongsheng@714
|
108 "Mercurial, and what to look out for if you are used to a different revision "
|
dongsheng@714
|
109 "control system."
|
dongsheng@714
|
110 msgstr ""
|
dongsheng@714
|
111
|
dongsheng@714
|
112 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@714
|
113 #: ../en/appA-svn.xml:16
|
dongsheng@714
|
114 msgid "Importing history from another system"
|
dongsheng@716
|
115 msgstr "从其它版本控制系统导入历史"
|
dongsheng@714
|
116
|
dongsheng@714
|
117 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@714
|
118 #: ../en/appA-svn.xml:18
|
dongsheng@714
|
119 msgid ""
|
dongsheng@714
|
120 "Mercurial ships with an extension named <literal>convert</literal>, which can "
|
dongsheng@714
|
121 "import project history from most popular revision control systems. At the "
|
dongsheng@714
|
122 "time this book was written, it could import history from the following "
|
dongsheng@714
|
123 "systems:"
|
dongsheng@714
|
124 msgstr ""
|
dongsheng@714
|
125
|
dongsheng@714
|
126 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><thead><row><entry>
|
dongsheng@714
|
127 #: ../en/appA-svn.xml:25 ../en/appA-svn.xml:369 ../en/ch01-intro.xml:416
|
dongsheng@714
|
128 #: ../en/ch01-intro.xml:627
|
dongsheng@714
|
129 msgid "Subversion"
|
dongsheng@715
|
130 msgstr "Subversion"
|
dongsheng@714
|
131
|
dongsheng@714
|
132 #. type: Content of: <book><appendix><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
133 #: ../en/appA-svn.xml:28 ../en/ch01-intro.xml:532 ../en/ch01-intro.xml:628
|
dongsheng@714
|
134 msgid "CVS"
|
dongsheng@714
|
135 msgstr "CVS"
|
dongsheng@714
|
136
|
dongsheng@714
|
137 #. type: Content of: <book><appendix><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
138 #: ../en/appA-svn.xml:31
|
dongsheng@714
|
139 msgid "git"
|
dongsheng@715
|
140 msgstr "git"
|
dongsheng@714
|
141
|
dongsheng@714
|
142 #. type: Content of: <book><appendix><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
143 #: ../en/appA-svn.xml:34 ../en/ch01-intro.xml:630
|
dongsheng@714
|
144 msgid "Darcs"
|
dongsheng@714
|
145 msgstr "Darcs"
|
dongsheng@714
|
146
|
dongsheng@714
|
147 #. type: Content of: <book><appendix><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
148 #: ../en/appA-svn.xml:37
|
dongsheng@714
|
149 msgid "Bazaar"
|
dongsheng@715
|
150 msgstr "Bazaar"
|
dongsheng@714
|
151
|
dongsheng@714
|
152 #. type: Content of: <book><appendix><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
153 #: ../en/appA-svn.xml:40
|
dongsheng@714
|
154 msgid "Monotone"
|
dongsheng@715
|
155 msgstr "Monotone"
|
dongsheng@714
|
156
|
dongsheng@714
|
157 #. type: Content of: <book><appendix><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
158 #: ../en/appA-svn.xml:43
|
dongsheng@714
|
159 msgid "GNU Arch"
|
dongsheng@715
|
160 msgstr "GNU Arch"
|
dongsheng@714
|
161
|
dongsheng@714
|
162 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><thead><row><entry>
|
dongsheng@714
|
163 #: ../en/appA-svn.xml:46 ../en/appA-svn.xml:370
|
dongsheng@714
|
164 msgid "Mercurial"
|
dongsheng@715
|
165 msgstr "Mercurial"
|
dongsheng@714
|
166
|
dongsheng@714
|
167 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@714
|
168 #: ../en/appA-svn.xml:50
|
dongsheng@714
|
169 msgid ""
|
dongsheng@714
|
170 "(To see why Mercurial itself is supported as a source, see <xref linkend="
|
dongsheng@714
|
171 "\"svn.filemap\"/>.)"
|
dongsheng@714
|
172 msgstr ""
|
dongsheng@714
|
173
|
dongsheng@714
|
174 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@714
|
175 #: ../en/appA-svn.xml:53
|
dongsheng@714
|
176 msgid ""
|
dongsheng@714
|
177 "You can enable the extension in the usual way, by editing your <filename>~/."
|
dongsheng@714
|
178 "hgrc</filename> file."
|
dongsheng@714
|
179 msgstr ""
|
zhaopingsun@1036
|
180 "你可以通过常用的方式,编辑<filename>~./hgrc</filename>文件来使用这个扩展。"
|
dongsheng@714
|
181
|
dongsheng@714
|
182 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@714
|
183 #: ../en/appA-svn.xml:59
|
dongsheng@714
|
184 msgid ""
|
dongsheng@714
|
185 "This will make a <command>hg convert</command> command available. The "
|
dongsheng@714
|
186 "command is easy to use. For instance, this command will import the "
|
dongsheng@714
|
187 "Subversion history for the Nose unit testing framework into Mercurial."
|
dongsheng@714
|
188 msgstr ""
|
dongsheng@714
|
189
|
dongsheng@714
|
190 #. type: Content of: <book><appendix><sect1><screen><prompt>
|
dongsheng@714
|
191 #: ../en/appA-svn.xml:64 ../en/appA-svn.xml:207 ../en/appA-svn.xml:212
|
dongsheng@714
|
192 #: ../en/appA-svn.xml:213 ../en/appA-svn.xml:218 ../en/appA-svn.xml:224
|
dongsheng@714
|
193 #: ../en/appA-svn.xml:229 ../en/appA-svn.xml:532
|
dongsheng@714
|
194 msgid "$"
|
dongsheng@715
|
195 msgstr "$"
|
dongsheng@714
|
196
|
dongsheng@714
|
197 #. type: Content of: <book><appendix><sect1><screen><userinput>
|
dongsheng@714
|
198 #: ../en/appA-svn.xml:64
|
dongsheng@714
|
199 msgid "hg convert http://python-nose.googlecode.com/svn/trunk"
|
dongsheng@714
|
200 msgstr ""
|
dongsheng@714
|
201
|
dongsheng@714
|
202 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@714
|
203 #: ../en/appA-svn.xml:66
|
dongsheng@714
|
204 msgid ""
|
dongsheng@714
|
205 "The <literal>convert</literal> extension operates incrementally. In other "
|
dongsheng@714
|
206 "words, after you have run <command>hg convert</command> once, running it "
|
dongsheng@714
|
207 "again will import any new revisions committed after the first run began. "
|
dongsheng@714
|
208 "Incremental conversion will only work if you run <command>hg convert</"
|
dongsheng@714
|
209 "command> in the same Mercurial repository that you originally used, because "
|
dongsheng@714
|
210 "the <literal>convert</literal> extension saves some private metadata in a non-"
|
dongsheng@714
|
211 "revision-controlled file named <filename>.hg/shamap</filename> inside the "
|
dongsheng@714
|
212 "target repository."
|
dongsheng@714
|
213 msgstr ""
|
dongsheng@714
|
214
|
dongsheng@714
|
215 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@714
|
216 #: ../en/appA-svn.xml:78
|
dongsheng@714
|
217 msgid ""
|
dongsheng@714
|
218 "When you want to start making changes using Mercurial, it's best to clone the "
|
dongsheng@714
|
219 "tree in which you are doing your conversions, and leave the original tree for "
|
dongsheng@714
|
220 "future incremental conversions. This is the safest way to let you pull and "
|
dongsheng@714
|
221 "merge future commits from the source revision control system into your newly "
|
dongsheng@714
|
222 "active Mercurial project."
|
dongsheng@714
|
223 msgstr ""
|
dongsheng@714
|
224
|
dongsheng@714
|
225 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
226 #: ../en/appA-svn.xml:86
|
dongsheng@714
|
227 msgid "Converting multiple branches"
|
dongsheng@715
|
228 msgstr "转换多个分支"
|
dongsheng@714
|
229
|
dongsheng@714
|
230 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
231 #: ../en/appA-svn.xml:88
|
dongsheng@714
|
232 msgid ""
|
dongsheng@714
|
233 "The <command>hg convert</command> command given above converts only the "
|
dongsheng@714
|
234 "history of the <literal>trunk</literal> branch of the Subversion repository. "
|
dongsheng@714
|
235 "If we instead use the URL <literal>http://python-nose.googlecode.com/svn</"
|
dongsheng@714
|
236 "literal>, Mercurial will automatically detect the <literal>trunk</literal>, "
|
dongsheng@714
|
237 "<literal>tags</literal> and <literal>branches</literal> layout that "
|
dongsheng@714
|
238 "Subversion projects usually use, and it will import each as a separate "
|
dongsheng@714
|
239 "Mercurial branch."
|
dongsheng@714
|
240 msgstr ""
|
dongsheng@714
|
241
|
dongsheng@714
|
242 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
243 #: ../en/appA-svn.xml:98
|
dongsheng@714
|
244 msgid ""
|
dongsheng@714
|
245 "By default, each Subversion branch imported into Mercurial is given a branch "
|
dongsheng@714
|
246 "name. After the conversion completes, you can get a list of the active "
|
dongsheng@714
|
247 "branch names in the Mercurial repository using <command>hg branches -a</"
|
dongsheng@714
|
248 "command>. If you would prefer to import the Subversion branches without "
|
dongsheng@714
|
249 "names, pass the <option>--config convert.hg.usebranchnames=false</option> "
|
dongsheng@714
|
250 "option to <command>hg convert</command>."
|
dongsheng@714
|
251 msgstr ""
|
dongsheng@714
|
252
|
dongsheng@714
|
253 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
254 #: ../en/appA-svn.xml:107
|
dongsheng@714
|
255 msgid ""
|
dongsheng@714
|
256 "Once you have converted your tree, if you want to follow the usual Mercurial "
|
dongsheng@714
|
257 "practice of working in a tree that contains a single branch, you can clone "
|
dongsheng@714
|
258 "that single branch using <command>hg clone -r mybranchname</command>."
|
dongsheng@714
|
259 msgstr ""
|
dongsheng@714
|
260
|
dongsheng@714
|
261 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
262 #: ../en/appA-svn.xml:114
|
dongsheng@714
|
263 msgid "Mapping user names"
|
dongsheng@715
|
264 msgstr "映射用户名称"
|
dongsheng@714
|
265
|
dongsheng@714
|
266 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
267 #: ../en/appA-svn.xml:116
|
dongsheng@714
|
268 msgid ""
|
dongsheng@714
|
269 "Some revision control tools save only short usernames with commits, and these "
|
dongsheng@714
|
270 "can be difficult to interpret. The norm with Mercurial is to save a "
|
dongsheng@714
|
271 "committer's name and email address, which is much more useful for talking to "
|
dongsheng@714
|
272 "them after the fact."
|
dongsheng@714
|
273 msgstr ""
|
dongsheng@714
|
274
|
dongsheng@714
|
275 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
276 #: ../en/appA-svn.xml:122
|
dongsheng@714
|
277 msgid ""
|
dongsheng@714
|
278 "If you are converting a tree from a revision control system that uses short "
|
dongsheng@714
|
279 "names, you can map those names to longer equivalents by passing a <option>--"
|
dongsheng@714
|
280 "authors</option> option to <command>hg convert</command>. This option "
|
dongsheng@714
|
281 "accepts a file name that should contain entries of the following form."
|
dongsheng@714
|
282 msgstr ""
|
dongsheng@714
|
283
|
dongsheng@714
|
284 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
285 #: ../en/appA-svn.xml:132
|
dongsheng@714
|
286 msgid ""
|
dongsheng@714
|
287 "Whenever <literal>convert</literal> encounters a commit with the username "
|
dongsheng@714
|
288 "<literal>arist</literal> in the source repository, it will use the name "
|
dongsheng@714
|
289 "<literal>Aristotle <aristotle@phil.example.gr></literal> in the "
|
dongsheng@714
|
290 "converted Mercurial revision. If no match is found for a name, it is used "
|
dongsheng@714
|
291 "verbatim."
|
dongsheng@714
|
292 msgstr ""
|
dongsheng@714
|
293
|
dongsheng@714
|
294 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
295 #: ../en/appA-svn.xml:141
|
dongsheng@714
|
296 msgid "Tidying up the tree"
|
dongsheng@716
|
297 msgstr "清理目录树"
|
dongsheng@714
|
298
|
dongsheng@714
|
299 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
300 #: ../en/appA-svn.xml:143
|
dongsheng@714
|
301 msgid ""
|
dongsheng@714
|
302 "Not all projects have pristine history. There may be a directory that should "
|
dongsheng@714
|
303 "never have been checked in, a file that is too big, or a whole hierarchy that "
|
dongsheng@714
|
304 "needs to be refactored."
|
dongsheng@714
|
305 msgstr ""
|
dongsheng@714
|
306
|
dongsheng@714
|
307 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
308 #: ../en/appA-svn.xml:148
|
dongsheng@714
|
309 msgid ""
|
dongsheng@714
|
310 "The <literal>convert</literal> extension supports the idea of a <quote>file "
|
dongsheng@714
|
311 "map</quote> that can reorganize the files and directories in a project as it "
|
dongsheng@714
|
312 "imports the project's history. This is useful not only when importing "
|
dongsheng@714
|
313 "history from other revision control systems, but also to prune or refactor a "
|
dongsheng@714
|
314 "Mercurial tree."
|
dongsheng@714
|
315 msgstr ""
|
dongsheng@714
|
316
|
dongsheng@714
|
317 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
318 #: ../en/appA-svn.xml:155
|
dongsheng@714
|
319 msgid ""
|
dongsheng@714
|
320 "To specify a file map, use the <option>--filemap</option> option and supply a "
|
dongsheng@714
|
321 "file name. A file map contains lines of the following forms."
|
dongsheng@714
|
322 msgstr ""
|
dongsheng@714
|
323
|
dongsheng@714
|
324 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
325 #: ../en/appA-svn.xml:169
|
dongsheng@714
|
326 msgid ""
|
dongsheng@714
|
327 "The <literal>include</literal> directive causes a file, or all files under a "
|
dongsheng@714
|
328 "directory, to be included in the destination repository. This also excludes "
|
dongsheng@714
|
329 "all other files and dirs not explicitely included. The <literal>exclude</"
|
dongsheng@714
|
330 "literal> directive causes files or directories to be omitted, and others not "
|
dongsheng@714
|
331 "explicitly mentioned to be included."
|
dongsheng@714
|
332 msgstr ""
|
dongsheng@714
|
333
|
dongsheng@714
|
334 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
335 #: ../en/appA-svn.xml:176
|
dongsheng@714
|
336 msgid ""
|
dongsheng@714
|
337 "To move a file or directory from one location to another, use the "
|
dongsheng@714
|
338 "<literal>rename</literal> directive. If you need to move a file or directory "
|
dongsheng@714
|
339 "from a subdirectory into the root of the repository, use <literal>.</literal> "
|
dongsheng@714
|
340 "as the second argument to the <literal>rename</literal> directive."
|
dongsheng@714
|
341 msgstr ""
|
dongsheng@714
|
342
|
dongsheng@714
|
343 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
344 #: ../en/appA-svn.xml:184
|
dongsheng@714
|
345 msgid "Improving Subversion conversion performance"
|
dongsheng@716
|
346 msgstr "改进 Subversion 的转换性能"
|
dongsheng@714
|
347
|
dongsheng@714
|
348 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
349 #: ../en/appA-svn.xml:186
|
dongsheng@714
|
350 msgid ""
|
dongsheng@714
|
351 "You will often need several attempts before you hit the perfect combination "
|
dongsheng@714
|
352 "of user map, file map, and other conversion parameters. Converting a "
|
dongsheng@714
|
353 "Subversion repository over an access protocol like <literal>ssh</literal> or "
|
dongsheng@714
|
354 "<literal>http</literal> can proceed thousands of times more slowly than "
|
dongsheng@714
|
355 "Mercurial is capable of actually operating, due to network delays. This can "
|
dongsheng@714
|
356 "make tuning that perfect conversion recipe very painful."
|
dongsheng@714
|
357 msgstr ""
|
dongsheng@714
|
358
|
dongsheng@714
|
359 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
360 #: ../en/appA-svn.xml:195
|
dongsheng@714
|
361 msgid ""
|
dongsheng@714
|
362 "The <ulink url=\"http://svn.collab.net/repos/svn/trunk/notes/svnsync.txt"
|
dongsheng@714
|
363 "\"><command>svnsync</command></ulink> command can greatly speed up the "
|
dongsheng@714
|
364 "conversion of a Subversion repository. It is a read-only mirroring program "
|
dongsheng@714
|
365 "for Subversion repositories. The idea is that you create a local mirror of "
|
dongsheng@714
|
366 "your Subversion tree, then convert the mirror into a Mercurial repository."
|
dongsheng@714
|
367 msgstr ""
|
dongsheng@714
|
368
|
dongsheng@714
|
369 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
370 #: ../en/appA-svn.xml:203
|
dongsheng@714
|
371 msgid ""
|
dongsheng@714
|
372 "Suppose we want to convert the Subversion repository for the popular "
|
dongsheng@714
|
373 "Memcached project into a Mercurial tree. First, we create a local Subversion "
|
dongsheng@714
|
374 "repository."
|
dongsheng@714
|
375 msgstr ""
|
dongsheng@714
|
376
|
dongsheng@714
|
377 #. type: Content of: <book><appendix><sect1><sect2><screen><userinput>
|
dongsheng@714
|
378 #: ../en/appA-svn.xml:207
|
dongsheng@714
|
379 msgid "svnadmin create memcached-mirror"
|
dongsheng@715
|
380 msgstr "svnadmin create memcached-mirror"
|
dongsheng@714
|
381
|
dongsheng@714
|
382 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
383 #: ../en/appA-svn.xml:209
|
dongsheng@714
|
384 msgid "Next, we set up a Subversion hook that <command>svnsync</command> needs."
|
dongsheng@714
|
385 msgstr ""
|
dongsheng@714
|
386
|
dongsheng@714
|
387 #. type: Content of: <book><appendix><sect1><sect2><screen><userinput>
|
dongsheng@714
|
388 #: ../en/appA-svn.xml:212
|
dongsheng@714
|
389 msgid "echo '#!/bin/sh' > memcached-mirror/hooks/pre-revprop-change"
|
dongsheng@715
|
390 msgstr "echo '#!/bin/sh' > memcached-mirror/hooks/pre-revprop-change"
|
dongsheng@714
|
391
|
dongsheng@714
|
392 #. type: Content of: <book><appendix><sect1><sect2><screen><userinput>
|
dongsheng@714
|
393 #: ../en/appA-svn.xml:213
|
dongsheng@714
|
394 msgid "chmod +x memcached-mirror/hooks/pre-revprop-change"
|
dongsheng@715
|
395 msgstr "chmod +x memcached-mirror/hooks/pre-revprop-change"
|
dongsheng@714
|
396
|
dongsheng@714
|
397 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
398 #: ../en/appA-svn.xml:215
|
dongsheng@714
|
399 msgid "We then initialize <command>svnsync</command> in this repository."
|
dongsheng@714
|
400 msgstr ""
|
dongsheng@714
|
401
|
dongsheng@714
|
402 #. type: Content of: <book><appendix><sect1><sect2><screen><userinput>
|
dongsheng@714
|
403 #: ../en/appA-svn.xml:218
|
dongsheng@714
|
404 msgid ""
|
dongsheng@714
|
405 "svnsync --init file://`pwd`/memcached-mirror \\ http://code.sixapart.com/svn/"
|
dongsheng@714
|
406 "memcached"
|
dongsheng@714
|
407 msgstr ""
|
dongsheng@715
|
408 "svnsync --init file://`pwd`/memcached-mirror \\ http://code.sixapart.com/svn/"
|
dongsheng@715
|
409 "memcached"
|
dongsheng@714
|
410
|
dongsheng@714
|
411 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
412 #: ../en/appA-svn.xml:221
|
dongsheng@714
|
413 msgid ""
|
dongsheng@714
|
414 "Our next step is to begin the <command>svnsync</command> mirroring process."
|
dongsheng@714
|
415 msgstr ""
|
dongsheng@714
|
416
|
dongsheng@714
|
417 #. type: Content of: <book><appendix><sect1><sect2><screen><userinput>
|
dongsheng@714
|
418 #: ../en/appA-svn.xml:224
|
dongsheng@714
|
419 msgid "svnsync sync file://`pwd`/memcached-mirror"
|
dongsheng@715
|
420 msgstr "svnsync sync file://`pwd`/memcached-mirror"
|
dongsheng@714
|
421
|
dongsheng@714
|
422 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
423 #: ../en/appA-svn.xml:226
|
dongsheng@714
|
424 msgid ""
|
dongsheng@714
|
425 "Finally, we import the history of our local Subversion mirror into Mercurial."
|
dongsheng@714
|
426 msgstr ""
|
dongsheng@714
|
427
|
dongsheng@714
|
428 #. type: Content of: <book><appendix><sect1><sect2><screen><userinput>
|
dongsheng@714
|
429 #: ../en/appA-svn.xml:229
|
dongsheng@714
|
430 msgid "hg convert memcached-mirror"
|
dongsheng@714
|
431 msgstr ""
|
dongsheng@714
|
432
|
dongsheng@714
|
433 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
434 #: ../en/appA-svn.xml:231
|
dongsheng@714
|
435 msgid ""
|
dongsheng@714
|
436 "We can use this process incrementally if the Subversion repository is still "
|
dongsheng@714
|
437 "in use. We run <command>svnsync</command> to pull new changes into our "
|
dongsheng@714
|
438 "mirror, then <command>hg convert</command> to import them into our Mercurial "
|
dongsheng@714
|
439 "tree."
|
dongsheng@714
|
440 msgstr ""
|
dongsheng@714
|
441
|
dongsheng@714
|
442 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
443 #: ../en/appA-svn.xml:237
|
dongsheng@714
|
444 msgid ""
|
dongsheng@714
|
445 "There are two advantages to doing a two-stage import with <command>svnsync</"
|
dongsheng@714
|
446 "command>. The first is that it uses more efficient Subversion network "
|
dongsheng@714
|
447 "syncing code than <command>hg convert</command>, so it transfers less data "
|
dongsheng@714
|
448 "over the network. The second is that the import from a local Subversion tree "
|
dongsheng@714
|
449 "is so fast that you can tweak your conversion setup repeatedly without having "
|
dongsheng@714
|
450 "to sit through a painfully slow network-based conversion process each time."
|
dongsheng@714
|
451 msgstr ""
|
dongsheng@714
|
452
|
dongsheng@714
|
453 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@714
|
454 #: ../en/appA-svn.xml:249
|
dongsheng@714
|
455 msgid "Migrating from Subversion"
|
dongsheng@715
|
456 msgstr "从 Subversion 迁移"
|
dongsheng@714
|
457
|
dongsheng@714
|
458 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@714
|
459 #: ../en/appA-svn.xml:251
|
dongsheng@714
|
460 msgid ""
|
dongsheng@714
|
461 "Subversion is currently the most popular open source revision control system. "
|
dongsheng@714
|
462 "Although there are many differences between Mercurial and Subversion, making "
|
dongsheng@714
|
463 "the transition from Subversion to Mercurial is not particularly difficult. "
|
dongsheng@714
|
464 "The two have similar command sets and generally uniform interfaces."
|
dongsheng@714
|
465 msgstr ""
|
dongsheng@714
|
466
|
dongsheng@714
|
467 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
468 #: ../en/appA-svn.xml:259
|
dongsheng@714
|
469 msgid "Philosophical differences"
|
dongsheng@716
|
470 msgstr "哲学的差别"
|
dongsheng@714
|
471
|
dongsheng@714
|
472 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
473 #: ../en/appA-svn.xml:261
|
dongsheng@714
|
474 msgid ""
|
dongsheng@714
|
475 "The fundamental difference between Subversion and Mercurial is of course that "
|
dongsheng@714
|
476 "Subversion is centralized, while Mercurial is distributed. Since Mercurial "
|
dongsheng@714
|
477 "stores all of a project's history on your local drive, it only needs to "
|
dongsheng@714
|
478 "perform a network access when you want to explicitly communicate with another "
|
dongsheng@714
|
479 "repository. In contrast, Subversion stores very little information locally, "
|
dongsheng@714
|
480 "and the client must thus contact its server for many common operations."
|
dongsheng@714
|
481 msgstr ""
|
dongsheng@714
|
482
|
dongsheng@714
|
483 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
484 #: ../en/appA-svn.xml:270
|
dongsheng@714
|
485 msgid ""
|
dongsheng@714
|
486 "Subversion more or less gets away without a well-defined notion of a branch: "
|
dongsheng@714
|
487 "which portion of a server's namespace qualifies as a branch is a matter of "
|
dongsheng@714
|
488 "convention, with the software providing no enforcement. Mercurial treats a "
|
dongsheng@714
|
489 "repository as the unit of branch management."
|
dongsheng@714
|
490 msgstr ""
|
dongsheng@714
|
491
|
dongsheng@714
|
492 #. type: Content of: <book><appendix><sect1><sect2><sect3><title>
|
dongsheng@714
|
493 #: ../en/appA-svn.xml:277
|
dongsheng@714
|
494 msgid "Scope of commands"
|
dongsheng@715
|
495 msgstr "命令作用域"
|
dongsheng@714
|
496
|
dongsheng@714
|
497 #. type: Content of: <book><appendix><sect1><sect2><sect3><para>
|
dongsheng@714
|
498 #: ../en/appA-svn.xml:279
|
dongsheng@714
|
499 msgid ""
|
dongsheng@714
|
500 "Since Subversion doesn't know what parts of its namespace are really "
|
dongsheng@714
|
501 "branches, it treats most commands as requests to operate at and below "
|
dongsheng@714
|
502 "whatever directory you are currently visiting. For instance, if you run "
|
dongsheng@714
|
503 "<command>svn log</command>, you'll get the history of whatever part of the "
|
dongsheng@714
|
504 "tree you're looking at, not the tree as a whole."
|
dongsheng@714
|
505 msgstr ""
|
dongsheng@714
|
506
|
dongsheng@714
|
507 #. type: Content of: <book><appendix><sect1><sect2><sect3><para>
|
dongsheng@714
|
508 #: ../en/appA-svn.xml:286
|
dongsheng@714
|
509 msgid ""
|
dongsheng@714
|
510 "Mercurial's commands behave differently, by defaulting to operating over an "
|
dongsheng@714
|
511 "entire repository. Run <command>hg log</command> and it will tell you the "
|
dongsheng@714
|
512 "history of the entire tree, no matter what part of the working directory "
|
dongsheng@714
|
513 "you're visiting at the time. If you want the history of just a particular "
|
dongsheng@714
|
514 "file or directory, simply supply it by name, e.g. <command>hg log src</"
|
dongsheng@714
|
515 "command>."
|
dongsheng@714
|
516 msgstr ""
|
dongsheng@714
|
517
|
dongsheng@714
|
518 #. type: Content of: <book><appendix><sect1><sect2><sect3><para>
|
dongsheng@714
|
519 #: ../en/appA-svn.xml:294
|
dongsheng@714
|
520 msgid ""
|
dongsheng@714
|
521 "From my own experience, this difference in default behaviors is probably the "
|
dongsheng@714
|
522 "most likely to trip you up if you have to switch back and forth frequently "
|
dongsheng@714
|
523 "between the two tools."
|
dongsheng@714
|
524 msgstr ""
|
dongsheng@714
|
525
|
dongsheng@714
|
526 #. type: Content of: <book><appendix><sect1><sect2><sect3><title>
|
dongsheng@714
|
527 #: ../en/appA-svn.xml:301
|
dongsheng@714
|
528 msgid "Multi-user operation and safety"
|
dongsheng@716
|
529 msgstr "多用户操作与安全"
|
dongsheng@714
|
530
|
dongsheng@714
|
531 #. type: Content of: <book><appendix><sect1><sect2><sect3><para>
|
dongsheng@714
|
532 #: ../en/appA-svn.xml:303
|
dongsheng@714
|
533 msgid ""
|
dongsheng@714
|
534 "With Subversion, it is normal (though slightly frowned upon) for multiple "
|
dongsheng@714
|
535 "people to collaborate in a single branch. If Alice and Bob are working "
|
dongsheng@714
|
536 "together, and Alice commits some changes to their shared branch, Bob must "
|
dongsheng@714
|
537 "update his client's view of the branch before he can commit. Since at this "
|
dongsheng@714
|
538 "time he has no permanent record of the changes he has made, he can corrupt or "
|
dongsheng@714
|
539 "lose his modifications during and after his update."
|
dongsheng@714
|
540 msgstr ""
|
dongsheng@714
|
541
|
dongsheng@714
|
542 #. type: Content of: <book><appendix><sect1><sect2><sect3><para>
|
dongsheng@714
|
543 #: ../en/appA-svn.xml:312
|
dongsheng@714
|
544 msgid ""
|
dongsheng@714
|
545 "Mercurial encourages a commit-then-merge model instead. Bob commits his "
|
dongsheng@714
|
546 "changes locally before pulling changes from, or pushing them to, the server "
|
dongsheng@714
|
547 "that he shares with Alice. If Alice pushed her changes before Bob tries to "
|
dongsheng@714
|
548 "push his, he will not be able to push his changes until he pulls hers, merges "
|
dongsheng@714
|
549 "with them, and commits the result of the merge. If he makes a mistake during "
|
dongsheng@714
|
550 "the merge, he still has the option of reverting to the commit that recorded "
|
dongsheng@714
|
551 "his changes."
|
dongsheng@714
|
552 msgstr ""
|
dongsheng@714
|
553
|
dongsheng@714
|
554 #. type: Content of: <book><appendix><sect1><sect2><sect3><para>
|
dongsheng@714
|
555 #: ../en/appA-svn.xml:321
|
dongsheng@714
|
556 msgid ""
|
dongsheng@714
|
557 "It is worth emphasizing that these are the common ways of working with these "
|
dongsheng@714
|
558 "tools. Subversion supports a safer work-in-your-own-branch model, but it is "
|
dongsheng@714
|
559 "cumbersome enough in practice to not be widely used. Mercurial can support "
|
dongsheng@714
|
560 "the less safe mode of allowing changes to be pulled in and merged on top of "
|
dongsheng@714
|
561 "uncommitted edits, but this is considered highly unusual."
|
dongsheng@714
|
562 msgstr ""
|
dongsheng@714
|
563
|
dongsheng@714
|
564 #. type: Content of: <book><appendix><sect1><sect2><sect3><title>
|
dongsheng@714
|
565 #: ../en/appA-svn.xml:331
|
dongsheng@714
|
566 msgid "Published vs local changes"
|
dongsheng@716
|
567 msgstr "已发布的修改与本地修改"
|
dongsheng@714
|
568
|
dongsheng@714
|
569 #. type: Content of: <book><appendix><sect1><sect2><sect3><para>
|
dongsheng@714
|
570 #: ../en/appA-svn.xml:333
|
dongsheng@714
|
571 msgid ""
|
dongsheng@714
|
572 "A Subversion <command>svn commit</command> command immediately publishes "
|
dongsheng@714
|
573 "changes to a server, where they can be seen by everyone who has read access."
|
dongsheng@714
|
574 msgstr ""
|
dongsheng@714
|
575
|
dongsheng@714
|
576 #. type: Content of: <book><appendix><sect1><sect2><sect3><para>
|
dongsheng@714
|
577 #: ../en/appA-svn.xml:337
|
dongsheng@714
|
578 msgid ""
|
dongsheng@714
|
579 "With Mercurial, commits are always local, and must be published via a "
|
dongsheng@714
|
580 "<command>hg push</command> command afterwards."
|
dongsheng@714
|
581 msgstr ""
|
dongsheng@714
|
582
|
dongsheng@714
|
583 #. type: Content of: <book><appendix><sect1><sect2><sect3><para>
|
dongsheng@714
|
584 #: ../en/appA-svn.xml:341
|
dongsheng@714
|
585 msgid ""
|
dongsheng@714
|
586 "Each approach has its advantages and disadvantages. The Subversion model "
|
dongsheng@714
|
587 "means that changes are published, and hence reviewable and usable, "
|
dongsheng@714
|
588 "immediately. On the other hand, this means that a user must have commit "
|
dongsheng@714
|
589 "access to a repository in order to use the software in a normal way, and "
|
dongsheng@714
|
590 "commit access is not lightly given out by most open source projects."
|
dongsheng@714
|
591 msgstr ""
|
dongsheng@714
|
592
|
dongsheng@714
|
593 #. type: Content of: <book><appendix><sect1><sect2><sect3><para>
|
dongsheng@714
|
594 #: ../en/appA-svn.xml:349
|
dongsheng@714
|
595 msgid ""
|
dongsheng@714
|
596 "The Mercurial approach allows anyone who can clone a repository to commit "
|
dongsheng@714
|
597 "changes without the need for someone else's permission, and they can then "
|
dongsheng@714
|
598 "publish their changes and continue to participate however they see fit. The "
|
dongsheng@714
|
599 "distinction between committing and pushing does open up the possibility of "
|
dongsheng@714
|
600 "someone committing changes to their laptop and walking away for a few days "
|
dongsheng@714
|
601 "having forgotten to push them, which in rare cases might leave collaborators "
|
dongsheng@714
|
602 "temporarily stuck."
|
dongsheng@714
|
603 msgstr ""
|
dongsheng@714
|
604
|
dongsheng@714
|
605 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
606 #: ../en/appA-svn.xml:362
|
dongsheng@714
|
607 msgid "Quick reference"
|
dongsheng@715
|
608 msgstr "快速参考"
|
dongsheng@714
|
609
|
dongsheng@714
|
610 #. type: Content of: <book><appendix><sect1><sect2><table><title>
|
dongsheng@714
|
611 #: ../en/appA-svn.xml:365
|
dongsheng@714
|
612 msgid "Subversion commands and Mercurial equivalents"
|
dongsheng@715
|
613 msgstr "Subversion 命令与 Mercurial 对照表"
|
dongsheng@714
|
614
|
dongsheng@714
|
615 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><thead><row><entry>
|
dongsheng@714
|
616 #: ../en/appA-svn.xml:371
|
dongsheng@714
|
617 msgid "Notes"
|
dongsheng@715
|
618 msgstr "备注"
|
dongsheng@714
|
619
|
dongsheng@714
|
620 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
621 #: ../en/appA-svn.xml:376
|
dongsheng@714
|
622 msgid "<command>svn add</command>"
|
dongsheng@715
|
623 msgstr "<command>svn add</command>"
|
dongsheng@714
|
624
|
dongsheng@714
|
625 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
626 #: ../en/appA-svn.xml:377
|
dongsheng@714
|
627 msgid "<command>hg add</command>"
|
dongsheng@715
|
628 msgstr "<command>hg add</command>"
|
dongsheng@714
|
629
|
dongsheng@714
|
630 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
631 #: ../en/appA-svn.xml:381
|
dongsheng@714
|
632 msgid "<command>svn blame</command>"
|
dongsheng@715
|
633 msgstr "<command>svn blame</command>"
|
dongsheng@714
|
634
|
dongsheng@714
|
635 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
636 #: ../en/appA-svn.xml:382
|
dongsheng@714
|
637 msgid "<command>hg annotate</command>"
|
dongsheng@715
|
638 msgstr "<command>hg annotate</command>"
|
dongsheng@714
|
639
|
dongsheng@714
|
640 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
641 #: ../en/appA-svn.xml:386
|
dongsheng@714
|
642 msgid "<command>svn cat</command>"
|
dongsheng@715
|
643 msgstr "<command>svn cat</command>"
|
dongsheng@714
|
644
|
dongsheng@714
|
645 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
646 #: ../en/appA-svn.xml:387
|
dongsheng@714
|
647 msgid "<command>hg cat</command>"
|
dongsheng@715
|
648 msgstr "<command>hg cat</command>"
|
dongsheng@714
|
649
|
dongsheng@714
|
650 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
651 #: ../en/appA-svn.xml:391
|
dongsheng@714
|
652 msgid "<command>svn checkout</command>"
|
dongsheng@715
|
653 msgstr "<command>svn checkout</command>"
|
dongsheng@714
|
654
|
dongsheng@714
|
655 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
656 #: ../en/appA-svn.xml:392 ../en/appA-svn.xml:409
|
dongsheng@714
|
657 msgid "<command>hg clone</command>"
|
dongsheng@715
|
658 msgstr "<command>hg clone</command>"
|
dongsheng@714
|
659
|
dongsheng@714
|
660 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
661 #: ../en/appA-svn.xml:396
|
dongsheng@714
|
662 msgid "<command>svn cleanup</command>"
|
dongsheng@715
|
663 msgstr "<command>svn cleanup</command>"
|
dongsheng@714
|
664
|
dongsheng@714
|
665 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
666 #: ../en/appA-svn.xml:397 ../en/appA-svn.xml:472
|
dongsheng@714
|
667 msgid "n/a"
|
dongsheng@715
|
668 msgstr "n/a"
|
dongsheng@714
|
669
|
dongsheng@714
|
670 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
671 #: ../en/appA-svn.xml:398
|
dongsheng@714
|
672 msgid "No cleanup needed"
|
dongsheng@715
|
673 msgstr "不需要清理"
|
dongsheng@714
|
674
|
dongsheng@714
|
675 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
676 #: ../en/appA-svn.xml:401
|
dongsheng@714
|
677 msgid "<command>svn commit</command>"
|
dongsheng@715
|
678 msgstr "<command>svn commit</command>"
|
dongsheng@714
|
679
|
dongsheng@714
|
680 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
681 #: ../en/appA-svn.xml:402
|
dongsheng@714
|
682 msgid "<command>hg commit</command>; <command>hg push</command>"
|
dongsheng@715
|
683 msgstr "<command>hg commit</command>; <command>hg push</command>"
|
dongsheng@714
|
684
|
dongsheng@714
|
685 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
686 #: ../en/appA-svn.xml:404
|
dongsheng@714
|
687 msgid "<command>hg push</command> publishes after commit"
|
dongsheng@715
|
688 msgstr "提交后使用 <command>hg push</command> 发布"
|
dongsheng@714
|
689
|
dongsheng@714
|
690 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
691 #: ../en/appA-svn.xml:408 ../en/appA-svn.xml:413
|
dongsheng@714
|
692 msgid "<command>svn copy</command>"
|
dongsheng@715
|
693 msgstr "<command>svn copy</command>"
|
dongsheng@714
|
694
|
dongsheng@714
|
695 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
696 #: ../en/appA-svn.xml:410
|
dongsheng@714
|
697 msgid "To create a new branch"
|
dongsheng@714
|
698 msgstr "创建新补丁"
|
dongsheng@714
|
699
|
dongsheng@714
|
700 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
701 #: ../en/appA-svn.xml:414
|
dongsheng@714
|
702 msgid "<command>hg copy</command>"
|
dongsheng@715
|
703 msgstr "<command>hg copy</command>"
|
dongsheng@714
|
704
|
dongsheng@714
|
705 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
706 #: ../en/appA-svn.xml:415
|
dongsheng@714
|
707 msgid "To copy files or directories"
|
dongsheng@715
|
708 msgstr "复制文件或目录"
|
dongsheng@714
|
709
|
dongsheng@714
|
710 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
711 #: ../en/appA-svn.xml:418
|
dongsheng@714
|
712 msgid "<command>svn delete</command> (<command>svn remove</command>)"
|
dongsheng@715
|
713 msgstr "<command>svn delete</command> (<command>svn remove</command>)"
|
dongsheng@714
|
714
|
dongsheng@714
|
715 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
716 #: ../en/appA-svn.xml:420
|
dongsheng@714
|
717 msgid "<command>hg remove</command>"
|
dongsheng@715
|
718 msgstr "<command>hg remove</command>"
|
dongsheng@714
|
719
|
dongsheng@714
|
720 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
721 #: ../en/appA-svn.xml:424
|
dongsheng@714
|
722 msgid "<command>svn diff</command>"
|
dongsheng@715
|
723 msgstr "<command>svn diff</command>"
|
dongsheng@714
|
724
|
dongsheng@714
|
725 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
726 #: ../en/appA-svn.xml:425
|
dongsheng@714
|
727 msgid "<command>hg diff</command>"
|
dongsheng@715
|
728 msgstr "<command>hg diff</command>"
|
dongsheng@714
|
729
|
dongsheng@714
|
730 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
731 #: ../en/appA-svn.xml:429
|
dongsheng@714
|
732 msgid "<command>svn export</command>"
|
dongsheng@715
|
733 msgstr "<command>svn export</command>"
|
dongsheng@714
|
734
|
dongsheng@714
|
735 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
736 #: ../en/appA-svn.xml:430
|
dongsheng@714
|
737 msgid "<command>hg archive</command>"
|
dongsheng@715
|
738 msgstr "<command>hg archive</command>"
|
dongsheng@714
|
739
|
dongsheng@714
|
740 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
741 #: ../en/appA-svn.xml:434
|
dongsheng@714
|
742 msgid "<command>svn help</command>"
|
dongsheng@715
|
743 msgstr "<command>svn help</command>"
|
dongsheng@714
|
744
|
dongsheng@714
|
745 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
746 #: ../en/appA-svn.xml:435
|
dongsheng@714
|
747 msgid "<command>hg help</command>"
|
dongsheng@715
|
748 msgstr "<command>hg help</command>"
|
dongsheng@714
|
749
|
dongsheng@714
|
750 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
751 #: ../en/appA-svn.xml:439
|
dongsheng@714
|
752 msgid "<command>svn import</command>"
|
dongsheng@715
|
753 msgstr "<command>svn import</command>"
|
dongsheng@714
|
754
|
dongsheng@714
|
755 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
756 #: ../en/appA-svn.xml:440
|
dongsheng@714
|
757 msgid "<command>hg addremove</command>; <command>hg commit</command>"
|
dongsheng@715
|
758 msgstr "<command>hg addremove</command>; <command>hg commit</command>"
|
dongsheng@714
|
759
|
dongsheng@714
|
760 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
761 #: ../en/appA-svn.xml:445 ../en/appA-svn.xml:450
|
dongsheng@714
|
762 msgid "<command>svn info</command>"
|
dongsheng@715
|
763 msgstr "<command>svn info</command>"
|
dongsheng@714
|
764
|
dongsheng@714
|
765 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
766 #: ../en/appA-svn.xml:446
|
dongsheng@714
|
767 msgid "<command>hg parents</command>"
|
dongsheng@715
|
768 msgstr "<command>hg parents</command>"
|
dongsheng@714
|
769
|
dongsheng@714
|
770 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
771 #: ../en/appA-svn.xml:447
|
dongsheng@714
|
772 msgid "Shows what revision is checked out"
|
dongsheng@715
|
773 msgstr "显示检出的版本信息"
|
dongsheng@714
|
774
|
dongsheng@714
|
775 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
776 #: ../en/appA-svn.xml:451
|
dongsheng@714
|
777 msgid "<command>hg showconfig paths.parent</command>"
|
dongsheng@715
|
778 msgstr "<command>hg showconfig paths.parent</command>"
|
dongsheng@714
|
779
|
dongsheng@714
|
780 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
781 #: ../en/appA-svn.xml:453
|
dongsheng@714
|
782 msgid "Shows what URL is checked out"
|
dongsheng@715
|
783 msgstr "显示检出的 URL"
|
dongsheng@714
|
784
|
dongsheng@714
|
785 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
786 #: ../en/appA-svn.xml:456
|
dongsheng@714
|
787 msgid "<command>svn list</command>"
|
dongsheng@715
|
788 msgstr "<command>svn list</command>"
|
dongsheng@714
|
789
|
dongsheng@714
|
790 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
791 #: ../en/appA-svn.xml:457
|
dongsheng@714
|
792 msgid "<command>hg manifest</command>"
|
dongsheng@715
|
793 msgstr "<command>hg manifest</command>"
|
dongsheng@714
|
794
|
dongsheng@714
|
795 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
796 #: ../en/appA-svn.xml:461
|
dongsheng@714
|
797 msgid "<command>svn log</command>"
|
dongsheng@715
|
798 msgstr "<command>svn log</command>"
|
dongsheng@714
|
799
|
dongsheng@714
|
800 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
801 #: ../en/appA-svn.xml:462
|
dongsheng@714
|
802 msgid "<command>hg log</command>"
|
dongsheng@715
|
803 msgstr "<command>hg log</command>"
|
dongsheng@714
|
804
|
dongsheng@714
|
805 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
806 #: ../en/appA-svn.xml:466
|
dongsheng@714
|
807 msgid "<command>svn merge</command>"
|
dongsheng@714
|
808 msgstr ""
|
dongsheng@714
|
809
|
dongsheng@714
|
810 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
811 #: ../en/appA-svn.xml:467
|
dongsheng@714
|
812 msgid "<command>hg merge</command>"
|
dongsheng@715
|
813 msgstr "<command>hg merge</command>"
|
dongsheng@714
|
814
|
dongsheng@714
|
815 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
816 #: ../en/appA-svn.xml:471
|
dongsheng@714
|
817 msgid "<command>svn mkdir</command>"
|
dongsheng@715
|
818 msgstr "<command>svn mkdir</command>"
|
dongsheng@714
|
819
|
dongsheng@714
|
820 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
821 #: ../en/appA-svn.xml:473
|
dongsheng@714
|
822 msgid "Mercurial does not track directories"
|
dongsheng@715
|
823 msgstr "Mercurial 不跟踪目录"
|
dongsheng@714
|
824
|
dongsheng@714
|
825 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
826 #: ../en/appA-svn.xml:476
|
dongsheng@714
|
827 msgid "<command>svn move</command> (<command>svn rename</command>)"
|
dongsheng@715
|
828 msgstr "<command>svn move</command> (<command>svn rename</command>)"
|
dongsheng@714
|
829
|
dongsheng@714
|
830 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
831 #: ../en/appA-svn.xml:478
|
dongsheng@714
|
832 msgid "<command>hg rename</command>"
|
dongsheng@715
|
833 msgstr "<command>hg rename</command>"
|
dongsheng@714
|
834
|
dongsheng@714
|
835 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
836 #: ../en/appA-svn.xml:482
|
dongsheng@714
|
837 msgid "<command>svn resolved</command>"
|
dongsheng@715
|
838 msgstr "<command>svn resolved</command>"
|
dongsheng@714
|
839
|
dongsheng@714
|
840 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
841 #: ../en/appA-svn.xml:483
|
dongsheng@714
|
842 msgid "<command>hg resolve -m</command>"
|
dongsheng@715
|
843 msgstr "<command>hg resolve -m</command>"
|
dongsheng@714
|
844
|
dongsheng@714
|
845 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
846 #: ../en/appA-svn.xml:487
|
dongsheng@714
|
847 msgid "<command>svn revert</command>"
|
dongsheng@715
|
848 msgstr "<command>svn revert</command>"
|
dongsheng@714
|
849
|
dongsheng@714
|
850 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
851 #: ../en/appA-svn.xml:488
|
dongsheng@714
|
852 msgid "<command>hg revert</command>"
|
dongsheng@715
|
853 msgstr "<command>hg revert</command>"
|
dongsheng@714
|
854
|
dongsheng@714
|
855 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
856 #: ../en/appA-svn.xml:492
|
dongsheng@714
|
857 msgid "<command>svn status</command>"
|
dongsheng@715
|
858 msgstr "<command>svn status</command>"
|
dongsheng@714
|
859
|
dongsheng@714
|
860 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
861 #: ../en/appA-svn.xml:493
|
dongsheng@714
|
862 msgid "<command>hg status</command>"
|
dongsheng@715
|
863 msgstr "<command>hg status</command>"
|
dongsheng@714
|
864
|
dongsheng@714
|
865 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
866 #: ../en/appA-svn.xml:497
|
dongsheng@714
|
867 msgid "<command>svn update</command>"
|
dongsheng@715
|
868 msgstr "<command>svn update</command>"
|
dongsheng@714
|
869
|
dongsheng@714
|
870 #. type: Content of: <book><appendix><sect1><sect2><table><tgroup><tbody><row><entry>
|
dongsheng@714
|
871 #: ../en/appA-svn.xml:498
|
dongsheng@714
|
872 msgid "<command>hg pull -u</command>"
|
dongsheng@715
|
873 msgstr "<command>hg pull -u</command>"
|
dongsheng@714
|
874
|
dongsheng@714
|
875 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@714
|
876 #: ../en/appA-svn.xml:508
|
dongsheng@714
|
877 msgid "Useful tips for newcomers"
|
dongsheng@715
|
878 msgstr "新手需要了解的技巧"
|
dongsheng@714
|
879
|
dongsheng@714
|
880 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@714
|
881 #: ../en/appA-svn.xml:510
|
dongsheng@714
|
882 msgid ""
|
dongsheng@714
|
883 "Under some revision control systems, printing a diff for a single committed "
|
dongsheng@714
|
884 "revision can be painful. For instance, with Subversion, to see what changed "
|
dongsheng@714
|
885 "in revision 104654, you must type <command>svn diff -r104653:104654</"
|
dongsheng@714
|
886 "command>. Mercurial eliminates the need to type the revision ID twice in this "
|
dongsheng@714
|
887 "common case. For a plain diff, <command>hg export 104654</command>. For a log "
|
dongsheng@714
|
888 "message followed by a diff, <command>hg log -r104654 -p</command>."
|
dongsheng@714
|
889 msgstr ""
|
dongsheng@714
|
890
|
dongsheng@714
|
891 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@714
|
892 #: ../en/appA-svn.xml:519
|
dongsheng@714
|
893 msgid ""
|
dongsheng@714
|
894 "When you run <command>hg status</command> without any arguments, it prints "
|
dongsheng@714
|
895 "the status of the entire tree, with paths relative to the root of the "
|
dongsheng@714
|
896 "repository. This makes it tricky to copy a file name from the output of "
|
dongsheng@714
|
897 "<command>hg status</command> into the command line. If you supply a file or "
|
dongsheng@714
|
898 "directory name to <command>hg status</command>, it will print paths relative "
|
dongsheng@714
|
899 "to your current location instead. So to get tree-wide status from "
|
dongsheng@714
|
900 "<command>hg status</command>, with paths that are relative to your current "
|
dongsheng@714
|
901 "directory and not the root of the repository, feed the output of <command>hg "
|
dongsheng@714
|
902 "root</command> into <command>hg status</command>. You can easily do this as "
|
dongsheng@714
|
903 "follows on a Unix-like system:"
|
dongsheng@714
|
904 msgstr ""
|
dongsheng@714
|
905
|
dongsheng@714
|
906 #. type: Content of: <book><appendix><sect1><screen><userinput>
|
dongsheng@714
|
907 #: ../en/appA-svn.xml:532
|
dongsheng@714
|
908 msgid "hg status `hg root`"
|
dongsheng@715
|
909 msgstr "hg status `hg root`"
|
dongsheng@714
|
910
|
dongsheng@714
|
911 #. type: Content of: <book><appendix><title>
|
dongsheng@627
|
912 #: ../en/appB-mq-ref.xml:5
|
dongsheng@627
|
913 msgid "Mercurial Queues reference"
|
dongsheng@627
|
914 msgstr "Mercurial 队列参考"
|
dongsheng@627
|
915
|
dongsheng@627
|
916 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@627
|
917 #: ../en/appB-mq-ref.xml:8
|
dongsheng@627
|
918 msgid "MQ command reference"
|
dongsheng@627
|
919 msgstr "MQ 命令参考"
|
dongsheng@627
|
920
|
dongsheng@627
|
921 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
922 #: ../en/appB-mq-ref.xml:10
|
dongsheng@627
|
923 msgid ""
|
dongsheng@627
|
924 "For an overview of the commands provided by MQ, use the command <command role="
|
dongsheng@627
|
925 "\"hg-cmd\">hg help mq</command>."
|
dongsheng@627
|
926 msgstr ""
|
dongsheng@627
|
927
|
dongsheng@627
|
928 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
929 #: ../en/appB-mq-ref.xml:14
|
songdongsheng@668
|
930 msgid ""
|
songdongsheng@668
|
931 "<command role=\"hg-ext-mq\">qapplied</command>&emdash;print applied patches"
|
dongsheng@661
|
932 msgstr "<command role=\"hg-ext-mq\">qapplied</command>—显示已应用的补丁"
|
dongsheng@627
|
933
|
dongsheng@627
|
934 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
935 #: ../en/appB-mq-ref.xml:17
|
dongsheng@627
|
936 msgid ""
|
dongsheng@627
|
937 "The <command role=\"hg-ext-mq\">qapplied</command> command prints the current "
|
dongsheng@627
|
938 "stack of applied patches. Patches are printed in oldest-to-newest order, so "
|
dongsheng@627
|
939 "the last patch in the list is the <quote>top</quote> patch."
|
dongsheng@627
|
940 msgstr ""
|
dongsheng@627
|
941
|
dongsheng@627
|
942 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@627
|
943 #: ../en/appB-mq-ref.xml:24
|
songdongsheng@668
|
944 msgid ""
|
songdongsheng@668
|
945 "<command role=\"hg-ext-mq\">qcommit</command>&emdash;commit changes in the "
|
songdongsheng@668
|
946 "queue repository"
|
dongsheng@661
|
947 msgstr "<command role=\"hg-ext-mq\">qcommit</command>—提交队列中的修改"
|
dongsheng@627
|
948
|
dongsheng@627
|
949 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
950 #: ../en/appB-mq-ref.xml:27
|
dongsheng@627
|
951 msgid ""
|
dongsheng@627
|
952 "The <command role=\"hg-ext-mq\">qcommit</command> command commits any "
|
dongsheng@627
|
953 "outstanding changes in the <filename role=\"special\" class=\"directory\">.hg/"
|
dongsheng@627
|
954 "patches</filename> repository. This command only works if the <filename role="
|
dongsheng@627
|
955 "\"special\" class=\"directory\">.hg/patches</filename> directory is a "
|
dongsheng@627
|
956 "repository, i.e. you created the directory using <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
957 "qinit <option role=\"hg-ext-mq-cmd-qinit-opt\">-c</option></command> or ran "
|
dongsheng@627
|
958 "<command role=\"hg-cmd\">hg init</command> in the directory after running "
|
dongsheng@627
|
959 "<command role=\"hg-ext-mq\">qinit</command>."
|
dongsheng@627
|
960 msgstr ""
|
dongsheng@627
|
961
|
dongsheng@627
|
962 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@627
|
963 #: ../en/appB-mq-ref.xml:39
|
dongsheng@627
|
964 msgid ""
|
dongsheng@627
|
965 "This command is shorthand for <command role=\"hg-cmd\">hg commit --cwd .hg/"
|
dongsheng@627
|
966 "patches</command>."
|
dongsheng@627
|
967 msgstr ""
|
dongsheng@627
|
968
|
dongsheng@650
|
969 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@650
|
970 #: ../en/appB-mq-ref.xml:43
|
songdongsheng@668
|
971 msgid ""
|
songdongsheng@668
|
972 "<command role=\"hg-ext-mq\">qdelete</command>&emdash;delete a patch from the "
|
dongsheng@653
|
973 "<filename role=\"special\">series</filename> file"
|
dongsheng@653
|
974 msgstr ""
|
dongsheng@661
|
975 "<command role=\"hg-ext-mq\">qdelete</command>—从文件 <filename role=\"special"
|
dongsheng@661
|
976 "\">series</filename> 中删除补丁"
|
dongsheng@650
|
977
|
dongsheng@627
|
978 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@650
|
979 #: ../en/appB-mq-ref.xml:48
|
dongsheng@627
|
980 msgid ""
|
dongsheng@627
|
981 "The <command role=\"hg-ext-mq\">qdelete</command> command removes the entry "
|
dongsheng@627
|
982 "for a patch from the <filename role=\"special\">series</filename> file in the "
|
dongsheng@627
|
983 "<filename role=\"special\" class=\"directory\">.hg/patches</filename> "
|
dongsheng@627
|
984 "directory. It does not pop the patch if the patch is already applied. By "
|
dongsheng@627
|
985 "default, it does not delete the patch file; use the <option role=\"hg-ext-mq-"
|
dongsheng@627
|
986 "cmd-qdel-opt\">-f</option> option to do that."
|
dongsheng@627
|
987 msgstr ""
|
dongsheng@627
|
988
|
dongsheng@627
|
989 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
990 #: ../en/appB-mq-ref.xml:57 ../en/appB-mq-ref.xml:109 ../en/appB-mq-ref.xml:167
|
dongsheng@714
|
991 #: ../en/appB-mq-ref.xml:207 ../en/appB-mq-ref.xml:274
|
dongsheng@714
|
992 #: ../en/appB-mq-ref.xml:345 ../en/appB-mq-ref.xml:414
|
dongsheng@714
|
993 #: ../en/appB-mq-ref.xml:492
|
dongsheng@627
|
994 msgid "Options:"
|
songdongsheng@668
|
995 msgstr "选项:"
|
dongsheng@627
|
996
|
dongsheng@627
|
997 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@650
|
998 #: ../en/appB-mq-ref.xml:59
|
dongsheng@627
|
999 msgid ""
|
dongsheng@627
|
1000 "<option role=\"hg-ext-mq-cmd-qdel-opt\">-f</option>: Delete the patch file."
|
dongsheng@627
|
1001 msgstr ""
|
dongsheng@627
|
1002
|
dongsheng@627
|
1003 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@650
|
1004 #: ../en/appB-mq-ref.xml:66
|
songdongsheng@668
|
1005 msgid ""
|
songdongsheng@668
|
1006 "<command role=\"hg-ext-mq\">qdiff</command>&emdash;print a diff of the "
|
songdongsheng@668
|
1007 "topmost applied patch"
|
dongsheng@661
|
1008 msgstr "<command role=\"hg-ext-mq\">qdiff</command>—显示最新应用补丁的差异"
|
dongsheng@627
|
1009
|
dongsheng@627
|
1010 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@650
|
1011 #: ../en/appB-mq-ref.xml:69
|
dongsheng@627
|
1012 msgid ""
|
dongsheng@627
|
1013 "The <command role=\"hg-ext-mq\">qdiff</command> command prints a diff of the "
|
dongsheng@627
|
1014 "topmost applied patch. It is equivalent to <command role=\"hg-cmd\">hg diff -"
|
dongsheng@627
|
1015 "r-2:-1</command>."
|
dongsheng@627
|
1016 msgstr ""
|
dongsheng@627
|
1017
|
dongsheng@627
|
1018 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@650
|
1019 #: ../en/appB-mq-ref.xml:75
|
dongsheng@714
|
1020 msgid ""
|
dongsheng@714
|
1021 "<command role=\"hg-ext-mq\">qfold</command>&emdash;move applied patches into "
|
dongsheng@714
|
1022 "repository history"
|
dongsheng@715
|
1023 msgstr ""
|
dongsheng@715
|
1024 "<command role=\"hg-ext-mq\">qfold</command>&emdash;将已应用的补丁提交到版本库"
|
dongsheng@714
|
1025
|
dongsheng@714
|
1026 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1027 #: ../en/appB-mq-ref.xml:78
|
dongsheng@714
|
1028 msgid ""
|
dongsheng@714
|
1029 "The <command>hg qfinish</command> command converts the specified applied "
|
dongsheng@714
|
1030 "patches into permanent changes by moving them out of MQ's control so that "
|
dongsheng@714
|
1031 "they will be treated as normal repository history."
|
dongsheng@714
|
1032 msgstr ""
|
dongsheng@714
|
1033
|
dongsheng@714
|
1034 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
1035 #: ../en/appB-mq-ref.xml:85
|
songdongsheng@668
|
1036 msgid ""
|
songdongsheng@668
|
1037 "<command role=\"hg-ext-mq\">qfold</command>&emdash;merge (<quote>fold</"
|
songdongsheng@668
|
1038 "quote>) several patches into one"
|
dongsheng@661
|
1039 msgstr ""
|
dongsheng@661
|
1040 "<command role=\"hg-ext-mq\">qfold</command>—将多个补丁合并(<quote>折叠</"
|
dongsheng@661
|
1041 "quote>)成一个"
|
dongsheng@627
|
1042
|
dongsheng@627
|
1043 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1044 #: ../en/appB-mq-ref.xml:88
|
dongsheng@627
|
1045 msgid ""
|
dongsheng@627
|
1046 "The <command role=\"hg-ext-mq\">qfold</command> command merges multiple "
|
dongsheng@627
|
1047 "patches into the topmost applied patch, so that the topmost applied patch "
|
dongsheng@627
|
1048 "makes the union of all of the changes in the patches in question."
|
dongsheng@627
|
1049 msgstr ""
|
dongsheng@627
|
1050
|
dongsheng@627
|
1051 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1052 #: ../en/appB-mq-ref.xml:93
|
dongsheng@627
|
1053 msgid ""
|
dongsheng@627
|
1054 "The patches to fold must not be applied; <command role=\"hg-ext-mq\">qfold</"
|
dongsheng@627
|
1055 "command> will exit with an error if any is. The order in which patches are "
|
dongsheng@627
|
1056 "folded is significant; <command role=\"hg-cmd\">hg qfold a b</command> means "
|
dongsheng@627
|
1057 "<quote>apply the current topmost patch, followed by <literal>a</literal>, "
|
dongsheng@627
|
1058 "followed by <literal>b</literal></quote>."
|
dongsheng@627
|
1059 msgstr ""
|
dongsheng@627
|
1060
|
dongsheng@627
|
1061 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1062 #: ../en/appB-mq-ref.xml:101
|
dongsheng@627
|
1063 msgid ""
|
dongsheng@627
|
1064 "The comments from the folded patches are appended to the comments of the "
|
dongsheng@627
|
1065 "destination patch, with each block of comments separated by three asterisk "
|
dongsheng@627
|
1066 "(<quote><literal>*</literal></quote>) characters. Use the <option role=\"hg-"
|
dongsheng@627
|
1067 "ext-mq-cmd-qfold-opt\">-e</option> option to edit the commit message for the "
|
dongsheng@627
|
1068 "combined patch/changeset after the folding has completed."
|
dongsheng@627
|
1069 msgstr ""
|
dongsheng@627
|
1070
|
dongsheng@627
|
1071 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1072 #: ../en/appB-mq-ref.xml:111
|
dongsheng@627
|
1073 msgid ""
|
dongsheng@627
|
1074 "<option role=\"hg-ext-mq-cmd-qfold-opt\">-e</option>: Edit the commit message "
|
dongsheng@627
|
1075 "and patch description for the newly folded patch."
|
dongsheng@627
|
1076 msgstr ""
|
zhaopingsun@1036
|
1077 "<option role=\"hg-ext-mq-cmd-qfold-opt\">-e</option>:为新创建的补丁编辑提交信"
|
zhaopingsun@1036
|
1078 "息和补丁说明。"
|
dongsheng@627
|
1079
|
dongsheng@627
|
1080 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1081 #: ../en/appB-mq-ref.xml:116
|
dongsheng@627
|
1082 msgid ""
|
dongsheng@627
|
1083 "<option role=\"hg-ext-mq-cmd-qfold-opt\">-l</option>: Use the contents of the "
|
dongsheng@627
|
1084 "given file as the new commit message and patch description for the folded "
|
dongsheng@627
|
1085 "patch."
|
dongsheng@627
|
1086 msgstr ""
|
zhaopingsun@1036
|
1087 "<option role=\"hg-ext-mq-cmd-qfold-opt\">-l</option>: 使用给定文件的内容作为创"
|
zhaopingsun@1036
|
1088 "建补丁新的提交信息和补丁说明。"
|
dongsheng@627
|
1089
|
dongsheng@627
|
1090 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1091 #: ../en/appB-mq-ref.xml:121
|
dongsheng@627
|
1092 msgid ""
|
dongsheng@627
|
1093 "<option role=\"hg-ext-mq-cmd-qfold-opt\">-m</option>: Use the given text as "
|
dongsheng@627
|
1094 "the new commit message and patch description for the folded patch."
|
dongsheng@627
|
1095 msgstr ""
|
dongsheng@627
|
1096
|
dongsheng@627
|
1097 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
1098 #: ../en/appB-mq-ref.xml:129
|
songdongsheng@668
|
1099 msgid ""
|
songdongsheng@668
|
1100 "<command role=\"hg-ext-mq\">qheader</command>&emdash;display the header/"
|
songdongsheng@668
|
1101 "description of a patch"
|
dongsheng@661
|
1102 msgstr "<command role=\"hg-ext-mq\">qheader</command>—显示补丁头部描述"
|
dongsheng@627
|
1103
|
dongsheng@627
|
1104 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1105 #: ../en/appB-mq-ref.xml:133
|
dongsheng@627
|
1106 msgid ""
|
dongsheng@627
|
1107 "The <command role=\"hg-ext-mq\">qheader</command> command prints the header, "
|
dongsheng@627
|
1108 "or description, of a patch. By default, it prints the header of the topmost "
|
dongsheng@627
|
1109 "applied patch. Given an argument, it prints the header of the named patch."
|
dongsheng@627
|
1110 msgstr ""
|
dongsheng@627
|
1111
|
dongsheng@627
|
1112 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
1113 #: ../en/appB-mq-ref.xml:140
|
songdongsheng@668
|
1114 msgid ""
|
songdongsheng@668
|
1115 "<command role=\"hg-ext-mq\">qimport</command>&emdash;import a third-party "
|
songdongsheng@668
|
1116 "patch into the queue"
|
dongsheng@661
|
1117 msgstr "<command role=\"hg-ext-mq\">qimport</command>—将第三方补丁导入队列"
|
dongsheng@627
|
1118
|
dongsheng@627
|
1119 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1120 #: ../en/appB-mq-ref.xml:143
|
dongsheng@627
|
1121 msgid ""
|
dongsheng@627
|
1122 "The <command role=\"hg-ext-mq\">qimport</command> command adds an entry for "
|
dongsheng@627
|
1123 "an external patch to the <filename role=\"special\">series</filename> file, "
|
dongsheng@627
|
1124 "and copies the patch into the <filename role=\"special\" class=\"directory\">."
|
dongsheng@627
|
1125 "hg/patches</filename> directory. It adds the entry immediately after the "
|
dongsheng@627
|
1126 "topmost applied patch, but does not push the patch."
|
dongsheng@627
|
1127 msgstr ""
|
dongsheng@627
|
1128
|
dongsheng@627
|
1129 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1130 #: ../en/appB-mq-ref.xml:151
|
dongsheng@627
|
1131 msgid ""
|
dongsheng@627
|
1132 "If the <filename role=\"special\" class=\"directory\">.hg/patches</filename> "
|
dongsheng@627
|
1133 "directory is a repository, <command role=\"hg-ext-mq\">qimport</command> "
|
dongsheng@627
|
1134 "automatically does an <command role=\"hg-cmd\">hg add</command> of the "
|
dongsheng@627
|
1135 "imported patch."
|
dongsheng@627
|
1136 msgstr ""
|
dongsheng@627
|
1137
|
dongsheng@627
|
1138 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
1139 #: ../en/appB-mq-ref.xml:159
|
songdongsheng@668
|
1140 msgid ""
|
songdongsheng@668
|
1141 "<command role=\"hg-ext-mq\">qinit</command>&emdash;prepare a repository to "
|
songdongsheng@668
|
1142 "work with MQ"
|
dongsheng@661
|
1143 msgstr "<command role=\"hg-ext-mq\">qinit</command>—为使用 MQ 配置版本库"
|
dongsheng@627
|
1144
|
dongsheng@627
|
1145 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1146 #: ../en/appB-mq-ref.xml:162
|
dongsheng@627
|
1147 msgid ""
|
dongsheng@627
|
1148 "The <command role=\"hg-ext-mq\">qinit</command> command prepares a repository "
|
dongsheng@627
|
1149 "to work with MQ. It creates a directory called <filename role=\"special\" "
|
dongsheng@627
|
1150 "class=\"directory\">.hg/patches</filename>."
|
dongsheng@627
|
1151 msgstr ""
|
dongsheng@627
|
1152
|
dongsheng@627
|
1153 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1154 #: ../en/appB-mq-ref.xml:169
|
dongsheng@627
|
1155 msgid ""
|
dongsheng@627
|
1156 "<option role=\"hg-ext-mq-cmd-qinit-opt\">-c</option>: Create <filename role="
|
dongsheng@627
|
1157 "\"special\" class=\"directory\">.hg/patches</filename> as a repository in its "
|
dongsheng@627
|
1158 "own right. Also creates a <filename role=\"special\">.hgignore</filename> "
|
dongsheng@627
|
1159 "file that will ignore the <filename role=\"special\">status</filename> file."
|
dongsheng@627
|
1160 msgstr ""
|
dongsheng@627
|
1161
|
dongsheng@627
|
1162 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1163 #: ../en/appB-mq-ref.xml:179
|
dongsheng@627
|
1164 msgid ""
|
dongsheng@627
|
1165 "When the <filename role=\"special\" class=\"directory\">.hg/patches</"
|
dongsheng@627
|
1166 "filename> directory is a repository, the <command role=\"hg-ext-mq\">qimport</"
|
dongsheng@627
|
1167 "command> and <command role=\"hg-ext-mq\">qnew</command> commands "
|
dongsheng@627
|
1168 "automatically <command role=\"hg-cmd\">hg add</command> new patches."
|
dongsheng@627
|
1169 msgstr ""
|
dongsheng@627
|
1170
|
dongsheng@627
|
1171 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
1172 #: ../en/appB-mq-ref.xml:188
|
songdongsheng@668
|
1173 msgid "<command role=\"hg-ext-mq\">qnew</command>&emdash;create a new patch"
|
dongsheng@661
|
1174 msgstr "<command role=\"hg-ext-mq\">qnew</command>—创建新补丁"
|
dongsheng@627
|
1175
|
dongsheng@627
|
1176 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1177 #: ../en/appB-mq-ref.xml:191
|
dongsheng@627
|
1178 msgid ""
|
dongsheng@627
|
1179 "The <command role=\"hg-ext-mq\">qnew</command> command creates a new patch. "
|
dongsheng@627
|
1180 "It takes one mandatory argument, the name to use for the patch file. The "
|
dongsheng@627
|
1181 "newly created patch is created empty by default. It is added to the "
|
dongsheng@627
|
1182 "<filename role=\"special\">series</filename> file after the current topmost "
|
dongsheng@627
|
1183 "applied patch, and is immediately pushed on top of that patch."
|
dongsheng@627
|
1184 msgstr ""
|
dongsheng@627
|
1185
|
dongsheng@627
|
1186 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1187 #: ../en/appB-mq-ref.xml:199
|
dongsheng@627
|
1188 msgid ""
|
dongsheng@627
|
1189 "If <command role=\"hg-ext-mq\">qnew</command> finds modified files in the "
|
dongsheng@627
|
1190 "working directory, it will refuse to create a new patch unless the <option "
|
dongsheng@627
|
1191 "role=\"hg-ext-mq-cmd-qnew-opt\">-f</option> option is used (see below). This "
|
songdongsheng@710
|
1192 "behavior allows you to <command role=\"hg-ext-mq\">qrefresh</command> your "
|
dongsheng@627
|
1193 "topmost applied patch before you apply a new patch on top of it."
|
dongsheng@627
|
1194 msgstr ""
|
dongsheng@627
|
1195
|
dongsheng@627
|
1196 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1197 #: ../en/appB-mq-ref.xml:209
|
dongsheng@627
|
1198 msgid ""
|
dongsheng@627
|
1199 "<option role=\"hg-ext-mq-cmd-qnew-opt\">-f</option>: Create a new patch if "
|
dongsheng@627
|
1200 "the contents of the working directory are modified. Any outstanding "
|
dongsheng@627
|
1201 "modifications are added to the newly created patch, so after this command "
|
dongsheng@627
|
1202 "completes, the working directory will no longer be modified."
|
dongsheng@627
|
1203 msgstr ""
|
dongsheng@627
|
1204
|
dongsheng@627
|
1205 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1206 #: ../en/appB-mq-ref.xml:216
|
dongsheng@627
|
1207 msgid ""
|
dongsheng@627
|
1208 "<option role=\"hg-ext-mq-cmd-qnew-opt\">-m</option>: Use the given text as "
|
dongsheng@627
|
1209 "the commit message. This text will be stored at the beginning of the patch "
|
dongsheng@627
|
1210 "file, before the patch data."
|
dongsheng@627
|
1211 msgstr ""
|
dongsheng@627
|
1212
|
dongsheng@627
|
1213 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
1214 #: ../en/appB-mq-ref.xml:225
|
songdongsheng@668
|
1215 msgid ""
|
songdongsheng@668
|
1216 "<command role=\"hg-ext-mq\">qnext</command>&emdash;print the name of the next "
|
songdongsheng@668
|
1217 "patch"
|
dongsheng@661
|
1218 msgstr "<command role=\"hg-ext-mq\">qnext</command>—显示下个补丁的名称"
|
dongsheng@627
|
1219
|
dongsheng@627
|
1220 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1221 #: ../en/appB-mq-ref.xml:228
|
dongsheng@627
|
1222 msgid ""
|
dongsheng@627
|
1223 "The <command role=\"hg-ext-mq\">qnext</command> command prints the name name "
|
dongsheng@627
|
1224 "of the next patch in the <filename role=\"special\">series</filename> file "
|
dongsheng@627
|
1225 "after the topmost applied patch. This patch will become the topmost applied "
|
dongsheng@627
|
1226 "patch if you run <command role=\"hg-ext-mq\">qpush</command>."
|
dongsheng@627
|
1227 msgstr ""
|
dongsheng@627
|
1228
|
dongsheng@627
|
1229 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
1230 #: ../en/appB-mq-ref.xml:237
|
songdongsheng@668
|
1231 msgid ""
|
songdongsheng@668
|
1232 "<command role=\"hg-ext-mq\">qpop</command>&emdash;pop patches off the stack"
|
dongsheng@661
|
1233 msgstr "<command role=\"hg-ext-mq\">qpop</command>—删除堆栈顶部的补丁"
|
dongsheng@627
|
1234
|
dongsheng@627
|
1235 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1236 #: ../en/appB-mq-ref.xml:240
|
dongsheng@627
|
1237 msgid ""
|
dongsheng@627
|
1238 "The <command role=\"hg-ext-mq\">qpop</command> command removes applied "
|
dongsheng@627
|
1239 "patches from the top of the stack of applied patches. By default, it removes "
|
dongsheng@627
|
1240 "only one patch."
|
dongsheng@627
|
1241 msgstr ""
|
dongsheng@627
|
1242
|
dongsheng@627
|
1243 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1244 #: ../en/appB-mq-ref.xml:244
|
dongsheng@627
|
1245 msgid ""
|
dongsheng@627
|
1246 "This command removes the changesets that represent the popped patches from "
|
dongsheng@627
|
1247 "the repository, and updates the working directory to undo the effects of the "
|
dongsheng@627
|
1248 "patches."
|
dongsheng@627
|
1249 msgstr ""
|
dongsheng@627
|
1250
|
dongsheng@627
|
1251 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1252 #: ../en/appB-mq-ref.xml:248
|
dongsheng@627
|
1253 msgid ""
|
dongsheng@627
|
1254 "This command takes an optional argument, which it uses as the name or index "
|
dongsheng@627
|
1255 "of the patch to pop to. If given a name, it will pop patches until the named "
|
dongsheng@627
|
1256 "patch is the topmost applied patch. If given a number, <command role=\"hg-"
|
dongsheng@627
|
1257 "ext-mq\">qpop</command> treats the number as an index into the entries in the "
|
dongsheng@627
|
1258 "series file, counting from zero (empty lines and lines containing only "
|
dongsheng@627
|
1259 "comments do not count). It pops patches until the patch identified by the "
|
dongsheng@627
|
1260 "given index is the topmost applied patch."
|
dongsheng@627
|
1261 msgstr ""
|
dongsheng@627
|
1262
|
dongsheng@627
|
1263 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1264 #: ../en/appB-mq-ref.xml:258
|
dongsheng@627
|
1265 msgid ""
|
dongsheng@627
|
1266 "The <command role=\"hg-ext-mq\">qpop</command> command does not read or write "
|
dongsheng@627
|
1267 "patches or the <filename role=\"special\">series</filename> file. It is thus "
|
dongsheng@627
|
1268 "safe to <command role=\"hg-ext-mq\">qpop</command> a patch that you have "
|
dongsheng@627
|
1269 "removed from the <filename role=\"special\">series</filename> file, or a "
|
dongsheng@627
|
1270 "patch that you have renamed or deleted entirely. In the latter two cases, "
|
dongsheng@627
|
1271 "use the name of the patch as it was when you applied it."
|
dongsheng@627
|
1272 msgstr ""
|
dongsheng@627
|
1273
|
dongsheng@627
|
1274 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1275 #: ../en/appB-mq-ref.xml:267
|
dongsheng@627
|
1276 msgid ""
|
dongsheng@627
|
1277 "By default, the <command role=\"hg-ext-mq\">qpop</command> command will not "
|
dongsheng@627
|
1278 "pop any patches if the working directory has been modified. You can override "
|
songdongsheng@710
|
1279 "this behavior using the <option role=\"hg-ext-mq-cmd-qpop-opt\">-f</option> "
|
dongsheng@627
|
1280 "option, which reverts all modifications in the working directory."
|
dongsheng@627
|
1281 msgstr ""
|
dongsheng@627
|
1282
|
dongsheng@627
|
1283 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1284 #: ../en/appB-mq-ref.xml:276
|
dongsheng@627
|
1285 msgid ""
|
dongsheng@627
|
1286 "<option role=\"hg-ext-mq-cmd-qpop-opt\">-a</option>: Pop all applied "
|
dongsheng@627
|
1287 "patches. This returns the repository to its state before you applied any "
|
dongsheng@627
|
1288 "patches."
|
dongsheng@627
|
1289 msgstr ""
|
dongsheng@627
|
1290
|
dongsheng@627
|
1291 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1292 #: ../en/appB-mq-ref.xml:281
|
dongsheng@627
|
1293 msgid ""
|
dongsheng@627
|
1294 "<option role=\"hg-ext-mq-cmd-qpop-opt\">-f</option>: Forcibly revert any "
|
dongsheng@627
|
1295 "modifications to the working directory when popping."
|
dongsheng@627
|
1296 msgstr ""
|
dongsheng@627
|
1297
|
dongsheng@627
|
1298 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1299 #: ../en/appB-mq-ref.xml:286
|
dongsheng@627
|
1300 msgid ""
|
dongsheng@627
|
1301 "<option role=\"hg-ext-mq-cmd-qpop-opt\">-n</option>: Pop a patch from the "
|
dongsheng@627
|
1302 "named queue."
|
dongsheng@627
|
1303 msgstr ""
|
dongsheng@627
|
1304
|
dongsheng@627
|
1305 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1306 #: ../en/appB-mq-ref.xml:291
|
dongsheng@627
|
1307 msgid ""
|
dongsheng@627
|
1308 "The <command role=\"hg-ext-mq\">qpop</command> command removes one line from "
|
dongsheng@627
|
1309 "the end of the <filename role=\"special\">status</filename> file for each "
|
dongsheng@627
|
1310 "patch that it pops."
|
dongsheng@627
|
1311 msgstr ""
|
dongsheng@627
|
1312
|
dongsheng@627
|
1313 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
1314 #: ../en/appB-mq-ref.xml:298
|
songdongsheng@668
|
1315 msgid ""
|
songdongsheng@668
|
1316 "<command role=\"hg-ext-mq\">qprev</command>&emdash;print the name of the "
|
songdongsheng@668
|
1317 "previous patch"
|
dongsheng@661
|
1318 msgstr "<command role=\"hg-ext-mq\">qprev</command>—显示上个补丁的名称"
|
dongsheng@627
|
1319
|
dongsheng@627
|
1320 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1321 #: ../en/appB-mq-ref.xml:301
|
dongsheng@627
|
1322 msgid ""
|
dongsheng@627
|
1323 "The <command role=\"hg-ext-mq\">qprev</command> command prints the name of "
|
dongsheng@627
|
1324 "the patch in the <filename role=\"special\">series</filename> file that comes "
|
dongsheng@627
|
1325 "before the topmost applied patch. This will become the topmost applied patch "
|
dongsheng@627
|
1326 "if you run <command role=\"hg-ext-mq\">qpop</command>."
|
dongsheng@627
|
1327 msgstr ""
|
dongsheng@627
|
1328
|
dongsheng@627
|
1329 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
1330 #: ../en/appB-mq-ref.xml:310
|
songdongsheng@668
|
1331 msgid ""
|
songdongsheng@668
|
1332 "<command role=\"hg-ext-mq\">qpush</command>&emdash;push patches onto the stack"
|
dongsheng@661
|
1333 msgstr "<command role=\"hg-ext-mq\">qpush</command>—增加补丁到堆栈"
|
dongsheng@627
|
1334
|
dongsheng@627
|
1335 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1336 #: ../en/appB-mq-ref.xml:313
|
dongsheng@627
|
1337 msgid ""
|
dongsheng@627
|
1338 "The <command role=\"hg-ext-mq\">qpush</command> command adds patches onto the "
|
dongsheng@627
|
1339 "applied stack. By default, it adds only one patch."
|
dongsheng@627
|
1340 msgstr ""
|
dongsheng@627
|
1341
|
dongsheng@627
|
1342 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1343 #: ../en/appB-mq-ref.xml:317
|
dongsheng@627
|
1344 msgid ""
|
dongsheng@627
|
1345 "This command creates a new changeset to represent each applied patch, and "
|
dongsheng@627
|
1346 "updates the working directory to apply the effects of the patches."
|
dongsheng@627
|
1347 msgstr ""
|
dongsheng@627
|
1348
|
dongsheng@627
|
1349 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1350 #: ../en/appB-mq-ref.xml:321
|
dongsheng@627
|
1351 msgid "The default data used when creating a changeset are as follows:"
|
dongsheng@627
|
1352 msgstr ""
|
dongsheng@627
|
1353
|
dongsheng@627
|
1354 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1355 #: ../en/appB-mq-ref.xml:324
|
dongsheng@627
|
1356 msgid ""
|
dongsheng@627
|
1357 "The commit date and time zone are the current date and time zone. Because "
|
dongsheng@627
|
1358 "these data are used to compute the identity of a changeset, this means that "
|
dongsheng@627
|
1359 "if you <command role=\"hg-ext-mq\">qpop</command> a patch and <command role="
|
dongsheng@627
|
1360 "\"hg-ext-mq\">qpush</command> it again, the changeset that you push will have "
|
dongsheng@627
|
1361 "a different identity than the changeset you popped."
|
dongsheng@627
|
1362 msgstr ""
|
dongsheng@627
|
1363
|
dongsheng@627
|
1364 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1365 #: ../en/appB-mq-ref.xml:332
|
dongsheng@627
|
1366 msgid ""
|
dongsheng@627
|
1367 "The author is the same as the default used by the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
1368 "commit</command> command."
|
dongsheng@627
|
1369 msgstr ""
|
dongsheng@627
|
1370
|
dongsheng@627
|
1371 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1372 #: ../en/appB-mq-ref.xml:336
|
dongsheng@627
|
1373 msgid ""
|
dongsheng@627
|
1374 "The commit message is any text from the patch file that comes before the "
|
dongsheng@627
|
1375 "first diff header. If there is no such text, a default commit message is "
|
dongsheng@627
|
1376 "used that identifies the name of the patch."
|
dongsheng@627
|
1377 msgstr ""
|
dongsheng@627
|
1378
|
dongsheng@627
|
1379 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1380 #: ../en/appB-mq-ref.xml:341
|
dongsheng@714
|
1381 msgid ""
|
dongsheng@714
|
1382 "If a patch contains a Mercurial patch header, the information in the patch "
|
dongsheng@714
|
1383 "header overrides these defaults."
|
dongsheng@627
|
1384 msgstr ""
|
dongsheng@627
|
1385
|
dongsheng@627
|
1386 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1387 #: ../en/appB-mq-ref.xml:347
|
dongsheng@627
|
1388 msgid ""
|
dongsheng@627
|
1389 "<option role=\"hg-ext-mq-cmd-qpush-opt\">-a</option>: Push all unapplied "
|
dongsheng@627
|
1390 "patches from the <filename role=\"special\">series</filename> file until "
|
dongsheng@627
|
1391 "there are none left to push."
|
dongsheng@627
|
1392 msgstr ""
|
dongsheng@627
|
1393
|
dongsheng@627
|
1394 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1395 #: ../en/appB-mq-ref.xml:353
|
dongsheng@627
|
1396 msgid ""
|
dongsheng@627
|
1397 "<option role=\"hg-ext-mq-cmd-qpush-opt\">-l</option>: Add the name of the "
|
dongsheng@627
|
1398 "patch to the end of the commit message."
|
dongsheng@627
|
1399 msgstr ""
|
dongsheng@627
|
1400
|
dongsheng@627
|
1401 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1402 #: ../en/appB-mq-ref.xml:357
|
dongsheng@627
|
1403 msgid ""
|
dongsheng@627
|
1404 "<option role=\"hg-ext-mq-cmd-qpush-opt\">-m</option>: If a patch fails to "
|
dongsheng@627
|
1405 "apply cleanly, use the entry for the patch in another saved queue to compute "
|
dongsheng@627
|
1406 "the parameters for a three-way merge, and perform a three-way merge using the "
|
dongsheng@627
|
1407 "normal Mercurial merge machinery. Use the resolution of the merge as the new "
|
dongsheng@627
|
1408 "patch content."
|
dongsheng@627
|
1409 msgstr ""
|
dongsheng@627
|
1410
|
dongsheng@627
|
1411 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1412 #: ../en/appB-mq-ref.xml:365
|
dongsheng@627
|
1413 msgid ""
|
dongsheng@627
|
1414 "<option role=\"hg-ext-mq-cmd-qpush-opt\">-n</option>: Use the named queue if "
|
dongsheng@627
|
1415 "merging while pushing."
|
dongsheng@627
|
1416 msgstr ""
|
dongsheng@627
|
1417
|
dongsheng@627
|
1418 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1419 #: ../en/appB-mq-ref.xml:370
|
dongsheng@627
|
1420 msgid ""
|
dongsheng@627
|
1421 "The <command role=\"hg-ext-mq\">qpush</command> command reads, but does not "
|
dongsheng@627
|
1422 "modify, the <filename role=\"special\">series</filename> file. It appends "
|
dongsheng@627
|
1423 "one line to the <command role=\"hg-cmd\">hg status</command> file for each "
|
dongsheng@627
|
1424 "patch that it pushes."
|
dongsheng@627
|
1425 msgstr ""
|
dongsheng@627
|
1426
|
dongsheng@627
|
1427 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
1428 #: ../en/appB-mq-ref.xml:378
|
songdongsheng@668
|
1429 msgid ""
|
songdongsheng@668
|
1430 "<command role=\"hg-ext-mq\">qrefresh</command>&emdash;update the topmost "
|
songdongsheng@668
|
1431 "applied patch"
|
dongsheng@661
|
1432 msgstr "<command role=\"hg-ext-mq\">qrefresh</command>—更新最新的补丁"
|
dongsheng@627
|
1433
|
dongsheng@627
|
1434 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1435 #: ../en/appB-mq-ref.xml:382
|
dongsheng@627
|
1436 msgid ""
|
dongsheng@627
|
1437 "The <command role=\"hg-ext-mq\">qrefresh</command> command updates the "
|
dongsheng@627
|
1438 "topmost applied patch. It modifies the patch, removes the old changeset that "
|
dongsheng@627
|
1439 "represented the patch, and creates a new changeset to represent the modified "
|
dongsheng@627
|
1440 "patch."
|
dongsheng@627
|
1441 msgstr ""
|
dongsheng@627
|
1442
|
dongsheng@627
|
1443 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1444 #: ../en/appB-mq-ref.xml:388
|
dongsheng@627
|
1445 msgid ""
|
dongsheng@627
|
1446 "The <command role=\"hg-ext-mq\">qrefresh</command> command looks for the "
|
dongsheng@627
|
1447 "following modifications:"
|
dongsheng@627
|
1448 msgstr ""
|
dongsheng@627
|
1449
|
dongsheng@627
|
1450 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1451 #: ../en/appB-mq-ref.xml:391
|
dongsheng@627
|
1452 msgid ""
|
dongsheng@627
|
1453 "Changes to the commit message, i.e. the text before the first diff header in "
|
dongsheng@627
|
1454 "the patch file, are reflected in the new changeset that represents the patch."
|
dongsheng@627
|
1455 msgstr ""
|
dongsheng@627
|
1456
|
dongsheng@627
|
1457 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1458 #: ../en/appB-mq-ref.xml:396
|
dongsheng@627
|
1459 msgid ""
|
dongsheng@627
|
1460 "Modifications to tracked files in the working directory are added to the "
|
dongsheng@627
|
1461 "patch."
|
dongsheng@627
|
1462 msgstr ""
|
dongsheng@627
|
1463
|
dongsheng@627
|
1464 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1465 #: ../en/appB-mq-ref.xml:399
|
dongsheng@627
|
1466 msgid ""
|
dongsheng@627
|
1467 "Changes to the files tracked using <command role=\"hg-cmd\">hg add</command>, "
|
dongsheng@627
|
1468 "<command role=\"hg-cmd\">hg copy</command>, <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
1469 "remove</command>, or <command role=\"hg-cmd\">hg rename</command>. Added "
|
dongsheng@627
|
1470 "files and copy and rename destinations are added to the patch, while removed "
|
dongsheng@627
|
1471 "files and rename sources are removed."
|
dongsheng@627
|
1472 msgstr ""
|
dongsheng@627
|
1473
|
dongsheng@627
|
1474 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1475 #: ../en/appB-mq-ref.xml:408
|
dongsheng@627
|
1476 msgid ""
|
dongsheng@627
|
1477 "Even if <command role=\"hg-ext-mq\">qrefresh</command> detects no changes, it "
|
dongsheng@627
|
1478 "still recreates the changeset that represents the patch. This causes the "
|
dongsheng@627
|
1479 "identity of the changeset to differ from the previous changeset that "
|
dongsheng@627
|
1480 "identified the patch."
|
dongsheng@627
|
1481 msgstr ""
|
dongsheng@627
|
1482
|
dongsheng@627
|
1483 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1484 #: ../en/appB-mq-ref.xml:416
|
dongsheng@627
|
1485 msgid ""
|
dongsheng@627
|
1486 "<option role=\"hg-ext-mq-cmd-qrefresh-opt\">-e</option>: Modify the commit "
|
dongsheng@627
|
1487 "and patch description, using the preferred text editor."
|
dongsheng@627
|
1488 msgstr ""
|
dongsheng@627
|
1489
|
dongsheng@627
|
1490 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1491 #: ../en/appB-mq-ref.xml:421
|
dongsheng@627
|
1492 msgid ""
|
dongsheng@627
|
1493 "<option role=\"hg-ext-mq-cmd-qrefresh-opt\">-m</option>: Modify the commit "
|
dongsheng@627
|
1494 "message and patch description, using the given text."
|
dongsheng@627
|
1495 msgstr ""
|
dongsheng@627
|
1496
|
dongsheng@627
|
1497 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1498 #: ../en/appB-mq-ref.xml:426
|
dongsheng@627
|
1499 msgid ""
|
dongsheng@627
|
1500 "<option role=\"hg-ext-mq-cmd-qrefresh-opt\">-l</option>: Modify the commit "
|
dongsheng@627
|
1501 "message and patch description, using text from the given file."
|
dongsheng@627
|
1502 msgstr ""
|
dongsheng@627
|
1503
|
dongsheng@627
|
1504 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
1505 #: ../en/appB-mq-ref.xml:434
|
songdongsheng@668
|
1506 msgid "<command role=\"hg-ext-mq\">qrename</command>&emdash;rename a patch"
|
dongsheng@661
|
1507 msgstr "<command role=\"hg-ext-mq\">qrename</command>—改名补丁"
|
dongsheng@627
|
1508
|
dongsheng@627
|
1509 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1510 #: ../en/appB-mq-ref.xml:437
|
dongsheng@627
|
1511 msgid ""
|
dongsheng@627
|
1512 "The <command role=\"hg-ext-mq\">qrename</command> command renames a patch, "
|
dongsheng@627
|
1513 "and changes the entry for the patch in the <filename role=\"special\">series</"
|
dongsheng@627
|
1514 "filename> file."
|
dongsheng@627
|
1515 msgstr ""
|
dongsheng@627
|
1516
|
dongsheng@627
|
1517 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1518 #: ../en/appB-mq-ref.xml:441
|
dongsheng@627
|
1519 msgid ""
|
dongsheng@627
|
1520 "With a single argument, <command role=\"hg-ext-mq\">qrename</command> renames "
|
dongsheng@627
|
1521 "the topmost applied patch. With two arguments, it renames its first argument "
|
dongsheng@627
|
1522 "to its second."
|
dongsheng@627
|
1523 msgstr ""
|
dongsheng@627
|
1524
|
dongsheng@627
|
1525 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
1526 #: ../en/appB-mq-ref.xml:448
|
songdongsheng@668
|
1527 msgid ""
|
songdongsheng@668
|
1528 "<command role=\"hg-ext-mq\">qseries</command>&emdash;print the entire patch "
|
songdongsheng@668
|
1529 "series"
|
dongsheng@661
|
1530 msgstr "<command role=\"hg-ext-mq\">qseries</command>—显示补丁序列"
|
dongsheng@627
|
1531
|
dongsheng@627
|
1532 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1533 #: ../en/appB-mq-ref.xml:451
|
dongsheng@627
|
1534 msgid ""
|
dongsheng@627
|
1535 "The <command role=\"hg-ext-mq\">qseries</command> command prints the entire "
|
dongsheng@627
|
1536 "patch series from the <filename role=\"special\">series</filename> file. It "
|
dongsheng@627
|
1537 "prints only patch names, not empty lines or comments. It prints in order "
|
dongsheng@627
|
1538 "from first to be applied to last."
|
dongsheng@627
|
1539 msgstr ""
|
dongsheng@627
|
1540
|
dongsheng@627
|
1541 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
1542 #: ../en/appB-mq-ref.xml:459
|
songdongsheng@668
|
1543 msgid ""
|
songdongsheng@668
|
1544 "<command role=\"hg-ext-mq\">qtop</command>&emdash;print the name of the "
|
songdongsheng@668
|
1545 "current patch"
|
dongsheng@661
|
1546 msgstr "<command role=\"hg-ext-mq\">qtop</command>—显示当前补丁的名称"
|
dongsheng@627
|
1547
|
dongsheng@627
|
1548 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1549 #: ../en/appB-mq-ref.xml:462
|
dongsheng@627
|
1550 msgid ""
|
dongsheng@627
|
1551 "The <command role=\"hg-ext-mq\">qtop</command> prints the name of the topmost "
|
dongsheng@627
|
1552 "currently applied patch."
|
dongsheng@627
|
1553 msgstr ""
|
dongsheng@627
|
1554
|
dongsheng@627
|
1555 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
1556 #: ../en/appB-mq-ref.xml:467
|
songdongsheng@668
|
1557 msgid ""
|
songdongsheng@668
|
1558 "<command role=\"hg-ext-mq\">qunapplied</command>&emdash;print patches not yet "
|
songdongsheng@668
|
1559 "applied"
|
dongsheng@661
|
1560 msgstr "<command role=\"hg-ext-mq\">qunapplied</command>—显示尚未应用的补丁"
|
dongsheng@627
|
1561
|
dongsheng@627
|
1562 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1563 #: ../en/appB-mq-ref.xml:471
|
dongsheng@627
|
1564 msgid ""
|
dongsheng@627
|
1565 "The <command role=\"hg-ext-mq\">qunapplied</command> command prints the names "
|
dongsheng@627
|
1566 "of patches from the <filename role=\"special\">series</filename> file that "
|
dongsheng@627
|
1567 "are not yet applied. It prints them in order from the next patch that will "
|
dongsheng@627
|
1568 "be pushed to the last."
|
dongsheng@627
|
1569 msgstr ""
|
dongsheng@627
|
1570
|
dongsheng@627
|
1571 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
1572 #: ../en/appB-mq-ref.xml:479
|
songdongsheng@668
|
1573 msgid ""
|
songdongsheng@668
|
1574 "<command role=\"hg-cmd\">hg strip</command>&emdash;remove a revision and "
|
songdongsheng@668
|
1575 "descendants"
|
dongsheng@661
|
1576 msgstr "<command role=\"hg-cmd\">hg strip</command>—删除一个版本及其后继"
|
dongsheng@627
|
1577
|
dongsheng@627
|
1578 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1579 #: ../en/appB-mq-ref.xml:482
|
dongsheng@627
|
1580 msgid ""
|
dongsheng@627
|
1581 "The <command role=\"hg-cmd\">hg strip</command> command removes a revision, "
|
dongsheng@627
|
1582 "and all of its descendants, from the repository. It undoes the effects of "
|
dongsheng@627
|
1583 "the removed revisions from the repository, and updates the working directory "
|
dongsheng@627
|
1584 "to the first parent of the removed revision."
|
dongsheng@627
|
1585 msgstr ""
|
dongsheng@627
|
1586
|
dongsheng@627
|
1587 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1588 #: ../en/appB-mq-ref.xml:488
|
dongsheng@627
|
1589 msgid ""
|
dongsheng@627
|
1590 "The <command role=\"hg-cmd\">hg strip</command> command saves a backup of the "
|
dongsheng@627
|
1591 "removed changesets in a bundle, so that they can be reapplied if removed in "
|
dongsheng@627
|
1592 "error."
|
dongsheng@627
|
1593 msgstr ""
|
dongsheng@627
|
1594
|
dongsheng@627
|
1595 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1596 #: ../en/appB-mq-ref.xml:494
|
dongsheng@627
|
1597 msgid ""
|
dongsheng@627
|
1598 "<option role=\"hg-opt-strip\">-b</option>: Save unrelated changesets that are "
|
dongsheng@627
|
1599 "intermixed with the stripped changesets in the backup bundle."
|
dongsheng@627
|
1600 msgstr ""
|
dongsheng@627
|
1601
|
dongsheng@627
|
1602 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1603 #: ../en/appB-mq-ref.xml:498
|
dongsheng@627
|
1604 msgid ""
|
dongsheng@627
|
1605 "<option role=\"hg-opt-strip\">-f</option>: If a branch has multiple heads, "
|
dongsheng@714
|
1606 "remove all heads."
|
dongsheng@627
|
1607 msgstr ""
|
dongsheng@627
|
1608
|
dongsheng@627
|
1609 #. type: Content of: <book><appendix><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
1610 #: ../en/appB-mq-ref.xml:501
|
dongsheng@714
|
1611 msgid "<option role=\"hg-opt-strip\">-n</option>: Do not save a backup bundle."
|
dongsheng@714
|
1612 msgstr ""
|
dongsheng@714
|
1613
|
dongsheng@714
|
1614 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@650
|
1615 #: ../en/appB-mq-ref.xml:508
|
dongsheng@627
|
1616 msgid "MQ file reference"
|
dongsheng@627
|
1617 msgstr "MQ 文件参考"
|
dongsheng@627
|
1618
|
dongsheng@627
|
1619 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
1620 #: ../en/appB-mq-ref.xml:511
|
dongsheng@627
|
1621 msgid "The <filename role=\"special\">series</filename> file"
|
dongsheng@627
|
1622 msgstr "<filename role=\"special\">序列</filename>文件"
|
dongsheng@627
|
1623
|
dongsheng@627
|
1624 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1625 #: ../en/appB-mq-ref.xml:514
|
dongsheng@627
|
1626 msgid ""
|
dongsheng@627
|
1627 "The <filename role=\"special\">series</filename> file contains a list of the "
|
dongsheng@627
|
1628 "names of all patches that MQ can apply. It is represented as a list of "
|
dongsheng@627
|
1629 "names, with one name saved per line. Leading and trailing white space in "
|
dongsheng@627
|
1630 "each line are ignored."
|
dongsheng@627
|
1631 msgstr ""
|
dongsheng@627
|
1632
|
dongsheng@627
|
1633 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1634 #: ../en/appB-mq-ref.xml:520
|
dongsheng@627
|
1635 msgid ""
|
dongsheng@627
|
1636 "Lines may contain comments. A comment begins with the <quote><literal>#</"
|
dongsheng@627
|
1637 "literal></quote> character, and extends to the end of the line. Empty lines, "
|
dongsheng@627
|
1638 "and lines that contain only comments, are ignored."
|
dongsheng@627
|
1639 msgstr ""
|
dongsheng@627
|
1640
|
dongsheng@627
|
1641 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1642 #: ../en/appB-mq-ref.xml:525
|
dongsheng@627
|
1643 msgid ""
|
dongsheng@627
|
1644 "You will often need to edit the <filename role=\"special\">series</filename> "
|
dongsheng@627
|
1645 "file by hand, hence the support for comments and empty lines noted above. "
|
dongsheng@627
|
1646 "For example, you can comment out a patch temporarily, and <command role=\"hg-"
|
dongsheng@627
|
1647 "ext-mq\">qpush</command> will skip over that patch when applying patches. "
|
dongsheng@627
|
1648 "You can also change the order in which patches are applied by reordering "
|
dongsheng@627
|
1649 "their entries in the <filename role=\"special\">series</filename> file."
|
dongsheng@627
|
1650 msgstr ""
|
dongsheng@627
|
1651
|
dongsheng@627
|
1652 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1653 #: ../en/appB-mq-ref.xml:534
|
dongsheng@627
|
1654 msgid ""
|
dongsheng@627
|
1655 "Placing the <filename role=\"special\">series</filename> file under revision "
|
dongsheng@627
|
1656 "control is also supported; it is a good idea to place all of the patches that "
|
dongsheng@627
|
1657 "it refers to under revision control, as well. If you create a patch "
|
dongsheng@627
|
1658 "directory using the <option role=\"hg-ext-mq-cmd-qinit-opt\">-c</option> "
|
dongsheng@627
|
1659 "option to <command role=\"hg-ext-mq\">qinit</command>, this will be done for "
|
dongsheng@627
|
1660 "you automatically."
|
dongsheng@627
|
1661 msgstr ""
|
dongsheng@627
|
1662
|
dongsheng@627
|
1663 #. type: Content of: <book><appendix><sect1><sect2><title>
|
dongsheng@714
|
1664 #: ../en/appB-mq-ref.xml:544
|
dongsheng@627
|
1665 msgid "The <filename role=\"special\">status</filename> file"
|
dongsheng@627
|
1666 msgstr "<filename role=\"special\">状态</filename>文件"
|
dongsheng@627
|
1667
|
dongsheng@627
|
1668 #. type: Content of: <book><appendix><sect1><sect2><para>
|
dongsheng@714
|
1669 #: ../en/appB-mq-ref.xml:547
|
dongsheng@627
|
1670 msgid ""
|
dongsheng@627
|
1671 "The <filename role=\"special\">status</filename> file contains the names and "
|
dongsheng@627
|
1672 "changeset hashes of all patches that MQ currently has applied. Unlike the "
|
dongsheng@627
|
1673 "<filename role=\"special\">series</filename> file, this file is not intended "
|
dongsheng@627
|
1674 "for editing. You should not place this file under revision control, or "
|
dongsheng@627
|
1675 "modify it in any way. It is used by MQ strictly for internal book-keeping."
|
dongsheng@627
|
1676 msgstr ""
|
dongsheng@627
|
1677
|
dongsheng@627
|
1678 #. type: Content of: <book><appendix><title>
|
dongsheng@627
|
1679 #: ../en/appC-srcinstall.xml:5
|
dongsheng@627
|
1680 msgid "Installing Mercurial from source"
|
dongsheng@627
|
1681 msgstr "从源代码安装 Mercurial"
|
dongsheng@627
|
1682
|
dongsheng@627
|
1683 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@627
|
1684 #: ../en/appC-srcinstall.xml:8
|
dongsheng@627
|
1685 msgid "On a Unix-like system"
|
dongsheng@627
|
1686 msgstr "类 Unix 系统"
|
dongsheng@627
|
1687
|
dongsheng@627
|
1688 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1689 #: ../en/appC-srcinstall.xml:10
|
dongsheng@627
|
1690 msgid ""
|
dongsheng@627
|
1691 "If you are using a Unix-like system that has a sufficiently recent version of "
|
dongsheng@627
|
1692 "Python (2.3 or newer) available, it is easy to install Mercurial from source."
|
dongsheng@627
|
1693 msgstr ""
|
songdongsheng@711
|
1694 "如果你使用类 Unix 系统,并且有足够新的 Python (2.3 更新),从源代码安装 "
|
songdongsheng@711
|
1695 "Mercurial 就很容易了。"
|
dongsheng@627
|
1696
|
dongsheng@627
|
1697 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1698 #: ../en/appC-srcinstall.xml:14
|
dongsheng@627
|
1699 msgid ""
|
dongsheng@627
|
1700 "Download a recent source tarball from <ulink url=\"http://www.selenic.com/"
|
dongsheng@627
|
1701 "mercurial/download\">http://www.selenic.com/mercurial/download</ulink>."
|
dongsheng@627
|
1702 msgstr ""
|
songdongsheng@711
|
1703 "从 <ulink url=\"http://www.selenic.com/mercurial/download\">http://www."
|
songdongsheng@711
|
1704 "selenic.com/mercurial/download</ulink> 下载最新的源代码。"
|
dongsheng@627
|
1705
|
dongsheng@627
|
1706 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1707 #: ../en/appC-srcinstall.xml:17
|
dongsheng@627
|
1708 msgid "Unpack the tarball:"
|
songdongsheng@711
|
1709 msgstr "解压:"
|
dongsheng@627
|
1710
|
dongsheng@627
|
1711 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1712 #: ../en/appC-srcinstall.xml:20
|
dongsheng@627
|
1713 msgid ""
|
dongsheng@627
|
1714 "Go into the source directory and run the installer script. This will build "
|
dongsheng@627
|
1715 "Mercurial and install it in your home directory."
|
songdongsheng@711
|
1716 msgstr "进入源代码目录,执行安装教本。这会构建 Mercurial,安装到你的家目录。"
|
dongsheng@627
|
1717
|
dongsheng@627
|
1718 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1719 #: ../en/appC-srcinstall.xml:27
|
dongsheng@627
|
1720 msgid ""
|
dongsheng@627
|
1721 "Once the install finishes, Mercurial will be in the <literal>bin</literal> "
|
dongsheng@627
|
1722 "subdirectory of your home directory. Don't forget to make sure that this "
|
dongsheng@627
|
1723 "directory is present in your shell's search path."
|
dongsheng@627
|
1724 msgstr ""
|
songdongsheng@711
|
1725 "安装完成后,Mercurial 就位于家目录的 <literal>bin</literal> 子目录。不要忘记将"
|
songdongsheng@711
|
1726 "这个目录加入到你的可执行文件搜索路径中。"
|
dongsheng@627
|
1727
|
dongsheng@627
|
1728 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1729 #: ../en/appC-srcinstall.xml:32
|
dongsheng@627
|
1730 msgid ""
|
dongsheng@627
|
1731 "You will probably need to set the <envar>PYTHONPATH</envar> environment "
|
dongsheng@627
|
1732 "variable so that the Mercurial executable can find the rest of the Mercurial "
|
dongsheng@627
|
1733 "packages. For example, on my laptop, I have set it to <literal>/home/bos/lib/"
|
dongsheng@627
|
1734 "python</literal>. The exact path that you will need to use depends on how "
|
dongsheng@627
|
1735 "Python was built for your system, but should be easy to figure out. If "
|
dongsheng@627
|
1736 "you're uncertain, look through the output of the installer script above, and "
|
dongsheng@627
|
1737 "see where the contents of the <literal>mercurial</literal> directory were "
|
dongsheng@627
|
1738 "installed to."
|
dongsheng@627
|
1739 msgstr ""
|
songdongsheng@711
|
1740 "你可能需要设置环境变量 <envar>PYTHONPATH</envar>,以便 Mercurial 可执行文件能"
|
songdongsheng@711
|
1741 "找到 Mercurial 包。例如,在我的笔记本电脑中,必须设置为 <literal>/home/bos/"
|
songdongsheng@711
|
1742 "lib/python</literal>。你需要使用的路径依赖于 Python 的构建方式,这很容易找出"
|
songdongsheng@711
|
1743 "来。如果你不确定,仔细察看上面的安装脚本输出,检查包含 <literal>mercurial</"
|
songdongsheng@711
|
1744 "literal> 目录的内容的安装位置。"
|
dongsheng@627
|
1745
|
dongsheng@627
|
1746 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@627
|
1747 #: ../en/appC-srcinstall.xml:44
|
dongsheng@627
|
1748 msgid "On Windows"
|
dongsheng@627
|
1749 msgstr "Windows 系统"
|
dongsheng@627
|
1750
|
dongsheng@627
|
1751 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1752 #: ../en/appC-srcinstall.xml:46
|
dongsheng@627
|
1753 msgid ""
|
dongsheng@627
|
1754 "Building and installing Mercurial on Windows requires a variety of tools, a "
|
dongsheng@627
|
1755 "fair amount of technical knowledge, and considerable patience. I very much "
|
dongsheng@627
|
1756 "<emphasis>do not recommend</emphasis> this route if you are a <quote>casual "
|
dongsheng@627
|
1757 "user</quote>. Unless you intend to hack on Mercurial, I strongly suggest "
|
dongsheng@627
|
1758 "that you use a binary package instead."
|
dongsheng@627
|
1759 msgstr ""
|
songdongsheng@711
|
1760 "在 Windows 中构建和安装 Mercurial 需要各种工具,相当多的技术背景,以及足够的耐"
|
songdongsheng@711
|
1761 "心。如果你是一个<quote>初级用户</quote>,我<emphasis>很不赞成</emphasis>这个方"
|
songdongsheng@711
|
1762 "法。我强烈建议你使用二进制安装包,除非你想深入研究 Mercurial 本身。"
|
dongsheng@627
|
1763
|
dongsheng@627
|
1764 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1765 #: ../en/appC-srcinstall.xml:53
|
dongsheng@627
|
1766 msgid ""
|
dongsheng@627
|
1767 "If you are intent on building Mercurial from source on Windows, follow the "
|
dongsheng@627
|
1768 "<quote>hard way</quote> directions on the Mercurial wiki at <ulink url="
|
dongsheng@627
|
1769 "\"http://www.selenic.com/mercurial/wiki/index.cgi/WindowsInstall\">http://www."
|
dongsheng@627
|
1770 "selenic.com/mercurial/wiki/index.cgi/WindowsInstall</ulink>, and expect the "
|
dongsheng@627
|
1771 "process to involve a lot of fiddly work."
|
dongsheng@627
|
1772 msgstr ""
|
songdongsheng@711
|
1773 "If you are intent on building Mercurial from source on Windows, follow the "
|
songdongsheng@711
|
1774 "<quote>hard way</quote> directions on the Mercurial wiki at <ulink url="
|
songdongsheng@711
|
1775 "\"http://www.selenic.com/mercurial/wiki/index.cgi/WindowsInstall\">http://www."
|
songdongsheng@711
|
1776 "selenic.com/mercurial/wiki/index.cgi/WindowsInstall</ulink>, and expect the "
|
songdongsheng@711
|
1777 "process to involve a lot of fiddly work."
|
dongsheng@627
|
1778
|
dongsheng@627
|
1779 #. type: Content of: <book><appendix><title>
|
dongsheng@627
|
1780 #: ../en/appD-license.xml:5
|
dongsheng@627
|
1781 msgid "Open Publication License"
|
songdongsheng@711
|
1782 msgstr "开放出版协议"
|
dongsheng@627
|
1783
|
dongsheng@627
|
1784 #. type: Content of: <book><appendix><para>
|
dongsheng@627
|
1785 #: ../en/appD-license.xml:7
|
dongsheng@627
|
1786 msgid "Version 1.0, 8 June 1999"
|
songdongsheng@711
|
1787 msgstr "版本 1.0,1999 年 6 月 8 日。"
|
dongsheng@627
|
1788
|
dongsheng@627
|
1789 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@627
|
1790 #: ../en/appD-license.xml:10
|
dongsheng@627
|
1791 msgid "Requirements on both unmodified and modified versions"
|
dongsheng@627
|
1792 msgstr ""
|
dongsheng@627
|
1793
|
dongsheng@627
|
1794 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1795 #: ../en/appD-license.xml:13
|
dongsheng@627
|
1796 msgid ""
|
dongsheng@627
|
1797 "The Open Publication works may be reproduced and distributed in whole or in "
|
dongsheng@627
|
1798 "part, in any medium physical or electronic, provided that the terms of this "
|
dongsheng@627
|
1799 "license are adhered to, and that this license or an incorporation of it by "
|
dongsheng@627
|
1800 "reference (with any options elected by the author(s) and/or publisher) is "
|
dongsheng@627
|
1801 "displayed in the reproduction."
|
dongsheng@627
|
1802 msgstr ""
|
dongsheng@627
|
1803
|
dongsheng@627
|
1804 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1805 #: ../en/appD-license.xml:20
|
dongsheng@627
|
1806 msgid "Proper form for an incorporation by reference is as follows:"
|
dongsheng@627
|
1807 msgstr ""
|
dongsheng@627
|
1808
|
dongsheng@627
|
1809 #. type: Content of: <book><appendix><sect1><blockquote><para>
|
dongsheng@627
|
1810 #: ../en/appD-license.xml:24
|
dongsheng@627
|
1811 msgid ""
|
dongsheng@627
|
1812 "Copyright (c) <emphasis>year</emphasis> by <emphasis>author's name or "
|
dongsheng@627
|
1813 "designee</emphasis>. This material may be distributed only subject to the "
|
dongsheng@627
|
1814 "terms and conditions set forth in the Open Publication License, v<emphasis>x."
|
dongsheng@627
|
1815 "y</emphasis> or later (the latest version is presently available at <ulink "
|
dongsheng@627
|
1816 "url=\"http://www.opencontent.org/openpub/\">http://www.opencontent.org/"
|
dongsheng@627
|
1817 "openpub/</ulink>)."
|
dongsheng@627
|
1818 msgstr ""
|
dongsheng@627
|
1819
|
dongsheng@627
|
1820 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1821 #: ../en/appD-license.xml:33
|
dongsheng@627
|
1822 msgid ""
|
dongsheng@627
|
1823 "The reference must be immediately followed with any options elected by the "
|
songdongsheng@658
|
1824 "author(s) and/or publisher of the document (see <xref linkend=\"sec:opl:"
|
songdongsheng@658
|
1825 "options\"/>)."
|
dongsheng@627
|
1826 msgstr ""
|
dongsheng@627
|
1827
|
dongsheng@627
|
1828 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1829 #: ../en/appD-license.xml:37
|
dongsheng@627
|
1830 msgid ""
|
dongsheng@627
|
1831 "Commercial redistribution of Open Publication-licensed material is permitted."
|
dongsheng@627
|
1832 msgstr ""
|
dongsheng@627
|
1833
|
dongsheng@627
|
1834 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1835 #: ../en/appD-license.xml:40
|
dongsheng@627
|
1836 msgid ""
|
dongsheng@627
|
1837 "Any publication in standard (paper) book form shall require the citation of "
|
dongsheng@627
|
1838 "the original publisher and author. The publisher and author's names shall "
|
dongsheng@627
|
1839 "appear on all outer surfaces of the book. On all outer surfaces of the book "
|
dongsheng@627
|
1840 "the original publisher's name shall be as large as the title of the work and "
|
dongsheng@627
|
1841 "cited as possessive with respect to the title."
|
dongsheng@627
|
1842 msgstr ""
|
dongsheng@627
|
1843
|
dongsheng@627
|
1844 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@627
|
1845 #: ../en/appD-license.xml:49
|
dongsheng@627
|
1846 msgid "Copyright"
|
dongsheng@627
|
1847 msgstr ""
|
dongsheng@627
|
1848
|
dongsheng@627
|
1849 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1850 #: ../en/appD-license.xml:51
|
dongsheng@627
|
1851 msgid ""
|
dongsheng@627
|
1852 "The copyright to each Open Publication is owned by its author(s) or designee."
|
dongsheng@627
|
1853 msgstr ""
|
dongsheng@627
|
1854
|
dongsheng@627
|
1855 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@627
|
1856 #: ../en/appD-license.xml:56
|
dongsheng@627
|
1857 msgid "Scope of license"
|
dongsheng@627
|
1858 msgstr ""
|
dongsheng@627
|
1859
|
dongsheng@627
|
1860 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1861 #: ../en/appD-license.xml:58
|
dongsheng@627
|
1862 msgid ""
|
dongsheng@627
|
1863 "The following license terms apply to all Open Publication works, unless "
|
dongsheng@627
|
1864 "otherwise explicitly stated in the document."
|
dongsheng@627
|
1865 msgstr ""
|
dongsheng@627
|
1866
|
dongsheng@627
|
1867 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1868 #: ../en/appD-license.xml:62
|
dongsheng@627
|
1869 msgid ""
|
dongsheng@627
|
1870 "Mere aggregation of Open Publication works or a portion of an Open "
|
dongsheng@627
|
1871 "Publication work with other works or programs on the same media shall not "
|
dongsheng@627
|
1872 "cause this license to apply to those other works. The aggregate work shall "
|
dongsheng@627
|
1873 "contain a notice specifying the inclusion of the Open Publication material "
|
dongsheng@627
|
1874 "and appropriate copyright notice."
|
dongsheng@627
|
1875 msgstr ""
|
dongsheng@627
|
1876
|
dongsheng@627
|
1877 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1878 #: ../en/appD-license.xml:69
|
dongsheng@627
|
1879 msgid ""
|
dongsheng@627
|
1880 "<emphasis role=\"bold\">Severability</emphasis>. If any part of this license "
|
dongsheng@627
|
1881 "is found to be unenforceable in any jurisdiction, the remaining portions of "
|
dongsheng@627
|
1882 "the license remain in force."
|
dongsheng@627
|
1883 msgstr ""
|
dongsheng@627
|
1884
|
dongsheng@627
|
1885 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1886 #: ../en/appD-license.xml:74
|
dongsheng@627
|
1887 msgid ""
|
dongsheng@627
|
1888 "<emphasis role=\"bold\">No warranty</emphasis>. Open Publication works are "
|
dongsheng@627
|
1889 "licensed and provided <quote>as is</quote> without warranty of any kind, "
|
dongsheng@627
|
1890 "express or implied, including, but not limited to, the implied warranties of "
|
dongsheng@627
|
1891 "merchantability and fitness for a particular purpose or a warranty of non-"
|
dongsheng@627
|
1892 "infringement."
|
dongsheng@627
|
1893 msgstr ""
|
dongsheng@627
|
1894
|
dongsheng@627
|
1895 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@627
|
1896 #: ../en/appD-license.xml:83
|
dongsheng@627
|
1897 msgid "Requirements on modified works"
|
dongsheng@627
|
1898 msgstr ""
|
dongsheng@627
|
1899
|
dongsheng@627
|
1900 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1901 #: ../en/appD-license.xml:85
|
dongsheng@627
|
1902 msgid ""
|
dongsheng@627
|
1903 "All modified versions of documents covered by this license, including "
|
dongsheng@627
|
1904 "translations, anthologies, compilations and partial documents, must meet the "
|
dongsheng@627
|
1905 "following requirements:"
|
dongsheng@627
|
1906 msgstr ""
|
dongsheng@627
|
1907
|
dongsheng@627
|
1908 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1909 #: ../en/appD-license.xml:90
|
dongsheng@627
|
1910 msgid "The modified version must be labeled as such."
|
dongsheng@627
|
1911 msgstr ""
|
dongsheng@627
|
1912
|
dongsheng@627
|
1913 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1914 #: ../en/appD-license.xml:93
|
dongsheng@627
|
1915 msgid ""
|
dongsheng@627
|
1916 "The person making the modifications must be identified and the modifications "
|
dongsheng@627
|
1917 "dated."
|
dongsheng@627
|
1918 msgstr ""
|
dongsheng@627
|
1919
|
dongsheng@627
|
1920 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1921 #: ../en/appD-license.xml:96
|
dongsheng@627
|
1922 msgid ""
|
dongsheng@627
|
1923 "Acknowledgement of the original author and publisher if applicable must be "
|
dongsheng@627
|
1924 "retained according to normal academic citation practices."
|
dongsheng@627
|
1925 msgstr ""
|
dongsheng@627
|
1926
|
dongsheng@627
|
1927 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1928 #: ../en/appD-license.xml:100
|
dongsheng@627
|
1929 msgid "The location of the original unmodified document must be identified."
|
dongsheng@627
|
1930 msgstr ""
|
dongsheng@627
|
1931
|
dongsheng@627
|
1932 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1933 #: ../en/appD-license.xml:103
|
dongsheng@627
|
1934 msgid ""
|
dongsheng@627
|
1935 "The original author's (or authors') name(s) may not be used to assert or "
|
dongsheng@627
|
1936 "imply endorsement of the resulting document without the original author's (or "
|
dongsheng@627
|
1937 "authors') permission."
|
dongsheng@627
|
1938 msgstr ""
|
dongsheng@627
|
1939
|
dongsheng@627
|
1940 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@627
|
1941 #: ../en/appD-license.xml:111
|
dongsheng@627
|
1942 msgid "Good-practice recommendations"
|
dongsheng@627
|
1943 msgstr ""
|
dongsheng@627
|
1944
|
dongsheng@627
|
1945 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1946 #: ../en/appD-license.xml:113
|
dongsheng@627
|
1947 msgid ""
|
dongsheng@627
|
1948 "In addition to the requirements of this license, it is requested from and "
|
dongsheng@627
|
1949 "strongly recommended of redistributors that:"
|
dongsheng@627
|
1950 msgstr ""
|
dongsheng@627
|
1951
|
dongsheng@627
|
1952 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1953 #: ../en/appD-license.xml:118
|
dongsheng@627
|
1954 msgid ""
|
dongsheng@627
|
1955 "If you are distributing Open Publication works on hardcopy or CD-ROM, you "
|
dongsheng@627
|
1956 "provide email notification to the authors of your intent to redistribute at "
|
dongsheng@627
|
1957 "least thirty days before your manuscript or media freeze, to give the authors "
|
dongsheng@627
|
1958 "time to provide updated documents. This notification should describe "
|
dongsheng@627
|
1959 "modifications, if any, made to the document."
|
dongsheng@627
|
1960 msgstr ""
|
dongsheng@627
|
1961
|
dongsheng@627
|
1962 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1963 #: ../en/appD-license.xml:125
|
dongsheng@627
|
1964 msgid ""
|
dongsheng@627
|
1965 "All substantive modifications (including deletions) be either clearly marked "
|
dongsheng@627
|
1966 "up in the document or else described in an attachment to the document."
|
dongsheng@627
|
1967 msgstr ""
|
dongsheng@627
|
1968
|
dongsheng@627
|
1969 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1970 #: ../en/appD-license.xml:129
|
dongsheng@627
|
1971 msgid ""
|
dongsheng@627
|
1972 "Finally, while it is not mandatory under this license, it is considered good "
|
dongsheng@627
|
1973 "form to offer a free copy of any hardcopy and CD-ROM expression of an Open "
|
dongsheng@627
|
1974 "Publication-licensed work to its author(s)."
|
dongsheng@627
|
1975 msgstr ""
|
dongsheng@627
|
1976
|
dongsheng@627
|
1977 #. type: Content of: <book><appendix><sect1><title>
|
dongsheng@627
|
1978 #: ../en/appD-license.xml:137
|
dongsheng@627
|
1979 msgid "License options"
|
dongsheng@627
|
1980 msgstr ""
|
dongsheng@627
|
1981
|
dongsheng@627
|
1982 #. type: Content of: <book><appendix><sect1><para>
|
dongsheng@627
|
1983 #: ../en/appD-license.xml:139
|
dongsheng@627
|
1984 msgid ""
|
dongsheng@627
|
1985 "The author(s) and/or publisher of an Open Publication-licensed document may "
|
dongsheng@627
|
1986 "elect certain options by appending language to the reference to or copy of "
|
dongsheng@627
|
1987 "the license. These options are considered part of the license instance and "
|
dongsheng@627
|
1988 "must be included with the license (or its incorporation by reference) in "
|
dongsheng@627
|
1989 "derived works."
|
dongsheng@627
|
1990 msgstr ""
|
dongsheng@627
|
1991
|
dongsheng@627
|
1992 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
1993 #: ../en/appD-license.xml:147
|
dongsheng@627
|
1994 msgid ""
|
dongsheng@627
|
1995 "To prohibit distribution of substantively modified versions without the "
|
dongsheng@627
|
1996 "explicit permission of the author(s). <quote>Substantive modification</quote> "
|
dongsheng@627
|
1997 "is defined as a change to the semantic content of the document, and excludes "
|
dongsheng@627
|
1998 "mere changes in format or typographical corrections."
|
dongsheng@627
|
1999 msgstr ""
|
dongsheng@627
|
2000
|
dongsheng@627
|
2001 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
2002 #: ../en/appD-license.xml:154
|
dongsheng@627
|
2003 msgid ""
|
dongsheng@627
|
2004 "To accomplish this, add the phrase <quote>Distribution of substantively "
|
dongsheng@627
|
2005 "modified versions of this document is prohibited without the explicit "
|
dongsheng@627
|
2006 "permission of the copyright holder.</quote> to the license reference or copy."
|
dongsheng@627
|
2007 msgstr ""
|
dongsheng@627
|
2008
|
dongsheng@627
|
2009 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
2010 #: ../en/appD-license.xml:160
|
dongsheng@627
|
2011 msgid ""
|
dongsheng@627
|
2012 "To prohibit any publication of this work or derivative works in whole or in "
|
dongsheng@627
|
2013 "part in standard (paper) book form for commercial purposes is prohibited "
|
dongsheng@627
|
2014 "unless prior permission is obtained from the copyright holder."
|
dongsheng@627
|
2015 msgstr ""
|
dongsheng@627
|
2016
|
dongsheng@627
|
2017 #. type: Content of: <book><appendix><sect1><orderedlist><listitem><para>
|
dongsheng@627
|
2018 #: ../en/appD-license.xml:165
|
dongsheng@627
|
2019 msgid ""
|
dongsheng@627
|
2020 "To accomplish this, add the phrase <quote>Distribution of the work or "
|
dongsheng@627
|
2021 "derivative of the work in any standard (paper) book form is prohibited unless "
|
dongsheng@627
|
2022 "prior permission is obtained from the copyright holder.</quote> to the "
|
dongsheng@627
|
2023 "license reference or copy."
|
dongsheng@627
|
2024 msgstr ""
|
dongsheng@627
|
2025
|
dongsheng@653
|
2026 #. type: Content of: <book><preface><title>
|
dongsheng@653
|
2027 #: ../en/ch00-preface.xml:5
|
dongsheng@653
|
2028 msgid "Preface"
|
dongsheng@653
|
2029 msgstr "序言"
|
dongsheng@653
|
2030
|
dongsheng@653
|
2031 #. type: Content of: <book><preface><sect1><title>
|
dongsheng@653
|
2032 #: ../en/ch00-preface.xml:8
|
dongsheng@714
|
2033 msgid "Technical storytelling"
|
dongsheng@715
|
2034 msgstr "技术背景"
|
dongsheng@714
|
2035
|
dongsheng@714
|
2036 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2037 #: ../en/ch00-preface.xml:10
|
dongsheng@714
|
2038 msgid ""
|
dongsheng@714
|
2039 "A few years ago, when I wanted to explain why I believed that distributed "
|
dongsheng@714
|
2040 "revision control is important, the field was then so new that there was "
|
dongsheng@714
|
2041 "almost no published literature to refer people to."
|
dongsheng@714
|
2042 msgstr ""
|
zhaopingsun@1036
|
2043 "数年之前,当我想解释为什么我相信分布式版本控制非常重要的时候,这个领域实在太新"
|
zhaopingsun@1036
|
2044 "了,几乎没有公开的文献供人们参考。"
|
dongsheng@714
|
2045
|
dongsheng@714
|
2046 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2047 #: ../en/ch00-preface.xml:15
|
dongsheng@714
|
2048 msgid ""
|
dongsheng@714
|
2049 "Although at that time I spent some time working on the internals of Mercurial "
|
dongsheng@714
|
2050 "itself, I switched to writing this book because that seemed like the most "
|
dongsheng@714
|
2051 "effective way to help the software to reach a wide audience, along with the "
|
dongsheng@714
|
2052 "idea that revision control ought to be distributed in nature. I publish the "
|
dongsheng@714
|
2053 "book online under a liberal license for the same reason: to get the word out."
|
dongsheng@714
|
2054 msgstr ""
|
zhaopingsun@1036
|
2055 "虽然在那个时候,我已经在Mercurial的内核上花了一些时间,我转而写这本书是因为我"
|
zhaopingsun@1036
|
2056 "发现这可能是帮助软件吸引更多用户,和让大家接受版本控制本质上就应该是分布式的最"
|
zhaopingsun@1036
|
2057 "有效的方式,我把这本书在网上以自由许可的方式发布也是基于同样的原因:让大家都了"
|
zhaopingsun@1036
|
2058 "解。"
|
dongsheng@714
|
2059
|
dongsheng@714
|
2060 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2061 #: ../en/ch00-preface.xml:23
|
dongsheng@714
|
2062 msgid ""
|
dongsheng@714
|
2063 "There's a familiar rhythm to a good software book that closely resembles "
|
dongsheng@714
|
2064 "telling a story: What is this thing? Why does it matter? How will it help me? "
|
dongsheng@714
|
2065 "How do I use it? In this book, I try to answer those questions for "
|
dongsheng@714
|
2066 "distributed revision control in general, and for Mercurial in particular."
|
dongsheng@714
|
2067 msgstr ""
|
zhaopingsun@1036
|
2068 "一本好的关于软件的书应该和讲故事类似:这是个什么东西?为什么需要它?它会怎样帮"
|
zhaopingsun@1036
|
2069 "助我?我怎么使用它?本书中,我会为分布式版本控制回答这些问题,特别是"
|
zhaopingsun@1036
|
2070 "Mercurial。"
|
dongsheng@714
|
2071
|
dongsheng@714
|
2072 #. type: Content of: <book><preface><sect1><title>
|
dongsheng@714
|
2073 #: ../en/ch00-preface.xml:31
|
dongsheng@714
|
2074 msgid "Thank you for supporting Mercurial"
|
dongsheng@716
|
2075 msgstr "谢谢你支持 Mercurial"
|
dongsheng@714
|
2076
|
dongsheng@714
|
2077 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2078 #: ../en/ch00-preface.xml:33
|
dongsheng@714
|
2079 msgid ""
|
dongsheng@714
|
2080 "By purchasing a copy of this book, you are supporting the continued "
|
dongsheng@714
|
2081 "development and freedom of Mercurial in particular, and of open source and "
|
dongsheng@714
|
2082 "free software in general. O'Reilly Media and I are donating my royalties on "
|
dongsheng@714
|
2083 "the sales of this book to the Software Freedom Conservancy (<ulink url="
|
dongsheng@714
|
2084 "\"http://www.softwarefreedom.org/\">http://www.softwarefreedom.org/</ulink>) "
|
dongsheng@714
|
2085 "which provides clerical and legal support to Mercurial and a number of other "
|
dongsheng@714
|
2086 "prominent and worthy open source software projects."
|
dongsheng@714
|
2087 msgstr ""
|
zhaopingsun@1036
|
2088 "通过购买此书,你支持了开源和自由软件的持续发展和自由,特别是Mercurial。"
|
zhaopingsun@1036
|
2089 "O'Reilly Media和我将本书的收入捐献给Software Freedom Conservancy (<ulink url="
|
zhaopingsun@1036
|
2090 "\"http://www.softwarefreedom.org/\">http://www.softwarefreedom.org/</ulink>) ,"
|
zhaopingsun@1036
|
2091 "这个组织为Mercurial和其他一些有潜力和价值的开源软件项目提供了办公和法律支持。"
|
dongsheng@714
|
2092
|
dongsheng@714
|
2093 #. type: Content of: <book><preface><sect1><title>
|
dongsheng@714
|
2094 #: ../en/ch00-preface.xml:45
|
dongsheng@714
|
2095 msgid "Acknowledgments"
|
dongsheng@716
|
2096 msgstr "致谢"
|
dongsheng@714
|
2097
|
dongsheng@714
|
2098 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2099 #: ../en/ch00-preface.xml:47
|
dongsheng@714
|
2100 msgid ""
|
dongsheng@714
|
2101 "This book would not exist were it not for the efforts of Matt Mackall, the "
|
dongsheng@714
|
2102 "author and project lead of Mercurial. He is ably assisted by hundreds of "
|
dongsheng@714
|
2103 "volunteer contributors across the world."
|
dongsheng@714
|
2104 msgstr ""
|
zhaopingsun@1036
|
2105 "没有Matt Mackall,Mercurial项目的开发者和领导的努力,这本书不可能存在。他得到"
|
zhaopingsun@1036
|
2106 "了全球数以百计的志愿者的帮助。"
|
dongsheng@714
|
2107
|
dongsheng@714
|
2108 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2109 #: ../en/ch00-preface.xml:52
|
dongsheng@714
|
2110 msgid ""
|
dongsheng@714
|
2111 "My children, Cian and Ruairi, always stood ready to help me to unwind with "
|
dongsheng@714
|
2112 "wonderful, madcap little-boy games. I'd also like to thank my ex-wife, "
|
dongsheng@714
|
2113 "Shannon, for her support."
|
dongsheng@714
|
2114 msgstr ""
|
dongsheng@714
|
2115
|
dongsheng@714
|
2116 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2117 #: ../en/ch00-preface.xml:56
|
dongsheng@714
|
2118 msgid ""
|
dongsheng@714
|
2119 "My colleagues and friends provided help and support in innumerable ways. "
|
dongsheng@714
|
2120 "This list of people is necessarily very incomplete: Stephen Hahn, Karyn "
|
dongsheng@714
|
2121 "Ritter, Bonnie Corwin, James Vasile, Matt Norwood, Eben Moglen, Bradley Kuhn, "
|
dongsheng@714
|
2122 "Robert Walsh, Jeremy Fitzhardinge, Rachel Chalmers."
|
dongsheng@714
|
2123 msgstr ""
|
zhaopingsun@1036
|
2124 "我的同事和朋友以各种方式提供了帮助和支持,这里的名单非常不全:Stephen Hahn, "
|
zhaopingsun@1036
|
2125 "Karyn Ritter, Bonnie Corwin, James Vasile, Matt Norwood, Eben Moglen, Bradley "
|
zhaopingsun@1036
|
2126 "Kuhn, Robert Walsh, Jeremy Fitzhardinge, Rachel Chalmers."
|
dongsheng@714
|
2127
|
dongsheng@714
|
2128 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2129 #: ../en/ch00-preface.xml:62
|
dongsheng@714
|
2130 msgid ""
|
dongsheng@714
|
2131 "I developed this book in the open, posting drafts of chapters to the book web "
|
dongsheng@714
|
2132 "site as I completed them. Readers then submitted feedback using a web "
|
dongsheng@714
|
2133 "application that I developed. By the time I finished writing the book, more "
|
dongsheng@714
|
2134 "than 100 people had submitted comments, an amazing number considering that "
|
dongsheng@714
|
2135 "the comment system was live for only about two months towards the end of the "
|
dongsheng@714
|
2136 "writing process."
|
dongsheng@714
|
2137 msgstr ""
|
zhaopingsun@1036
|
2138 "我以开放的方式完成了本书,当我完成各章的草稿后,就将其放在了网上。读者可以使用"
|
zhaopingsun@1036
|
2139 "我开发的一个网络程序提交反馈。到我完成本书时,有100多人提交了评论。考虑到评论"
|
zhaopingsun@1036
|
2140 "系统是在写作完成之前两个月才开放的,这是一个惊人的数字。"
|
dongsheng@714
|
2141
|
dongsheng@714
|
2142 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2143 #: ../en/ch00-preface.xml:70
|
dongsheng@714
|
2144 msgid ""
|
dongsheng@714
|
2145 "I would particularly like to recognize the following people, who between them "
|
dongsheng@714
|
2146 "contributed over a third of the total number of comments. I would like to "
|
dongsheng@714
|
2147 "thank them for their care and effort in providing so much detailed feedback."
|
dongsheng@714
|
2148 msgstr ""
|
zhaopingsun@1036
|
2149 "我特别希望认识以下人员,他们中有的人提交了超过总数三分之一的评论。我要感谢他们"
|
zhaopingsun@1036
|
2150 "的关心和努力,提供了那么多详细的反馈。"
|
dongsheng@714
|
2151
|
dongsheng@714
|
2152 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2153 #: ../en/ch00-preface.xml:75
|
dongsheng@714
|
2154 msgid ""
|
dongsheng@714
|
2155 "Martin Geisler, Damien Cassou, Alexey Bakhirkin, Till Plewe, Dan Himes, Paul "
|
dongsheng@714
|
2156 "Sargent, Gokberk Hamurcu, Matthijs van der Vleuten, Michael Chermside, John "
|
dongsheng@714
|
2157 "Mulligan, Jordi Fita, Jon Parise."
|
dongsheng@714
|
2158 msgstr ""
|
dongsheng@714
|
2159
|
dongsheng@714
|
2160 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2161 #: ../en/ch00-preface.xml:80
|
dongsheng@714
|
2162 msgid ""
|
dongsheng@714
|
2163 "I also want to acknowledge the help of the many people who caught errors and "
|
dongsheng@714
|
2164 "provided helpful suggestions throughout the book."
|
zhaopingsun@1036
|
2165 msgstr "我同样要感谢许多在书中找出错误和提供了有帮助的建议的人。"
|
dongsheng@714
|
2166
|
dongsheng@714
|
2167 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2168 #: ../en/ch00-preface.xml:84
|
dongsheng@714
|
2169 msgid ""
|
dongsheng@714
|
2170 "Jeremy W. Sherman, Brian Mearns, Vincent Furia, Iwan Luijks, Billy Edwards, "
|
dongsheng@714
|
2171 "Andreas Sliwka, Paweł Sołyga, Eric Hanchrow, Steve Nicolai, Michał Masłowski, "
|
dongsheng@714
|
2172 "Kevin Fitch, Johan Holmberg, Hal Wine, Volker Simonis, Thomas P Jakobsen, Ted "
|
dongsheng@714
|
2173 "Stresen-Reuter, Stephen Rasku, Raphael Das Gupta, Ned Batchelder, Lou Keeble, "
|
dongsheng@714
|
2174 "Li Linxiao, Kao Cardoso Félix, Joseph Wecker, Jon Prescot, Jon Maken, John "
|
dongsheng@714
|
2175 "Yeary, Jason Harris, Geoffrey Zheng, Fredrik Jonson, Ed Davies, David "
|
dongsheng@714
|
2176 "Zumbrunnen, David Mercer, David Cabana, Ben Karel, Alan Franzoni, Yousry "
|
dongsheng@714
|
2177 "Abdallah, Whitney Young, Vinay Sajip, Tom Towle, Tim Ottinger, Thomas "
|
dongsheng@714
|
2178 "Schraitle, Tero Saarni, Ted Mielczarek, Svetoslav Agafonkin, Shaun Rowland, "
|
dongsheng@714
|
2179 "Rocco Rutte, Polo-Francois Poli, Philip Jenvey, Petr Tesałék, Peter R. "
|
dongsheng@714
|
2180 "Annema, Paul Bonser, Olivier Scherler, Olivier Fournier, Nick Parker, Nick "
|
dongsheng@714
|
2181 "Fabry, Nicholas Guarracino, Mike Driscoll, Mike Coleman, Mietek Bák, Michael "
|
dongsheng@714
|
2182 "Maloney, László Nagy, Kent Johnson, Julio Nobrega, Jord Fita, Jonathan March, "
|
dongsheng@714
|
2183 "Jonas Nockert, Jim Tittsler, Jeduan Cornejo Legorreta, Jan Larres, James "
|
dongsheng@714
|
2184 "Murphy, Henri Wiechers, Hagen Möbius, Gábor Farkas, Fabien Engels, Evert Rol, "
|
dongsheng@714
|
2185 "Evan Willms, Eduardo Felipe Castegnaro, Dennis Decker Jensen, Deniz Dogan, "
|
dongsheng@714
|
2186 "David Smith, Daed Lee, Christine Slotty, Charles Merriam, Guillaume Catto, "
|
dongsheng@714
|
2187 "Brian Dorsey, Bob Nystrom, Benoit Boissinot, Avi Rosenschein, Andrew Watts, "
|
dongsheng@714
|
2188 "Andrew Donkin, Alexey Rodriguez, Ahmed Chaudhary."
|
dongsheng@714
|
2189 msgstr ""
|
dongsheng@714
|
2190
|
dongsheng@714
|
2191 #. type: Content of: <book><preface><sect1><title>
|
dongsheng@714
|
2192 #: ../en/ch00-preface.xml:111
|
dongsheng@714
|
2193 msgid "Conventions Used in This Book"
|
dongsheng@716
|
2194 msgstr "本书的约定"
|
dongsheng@714
|
2195
|
dongsheng@714
|
2196 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2197 #: ../en/ch00-preface.xml:113
|
dongsheng@714
|
2198 msgid "The following typographical conventions are used in this book:"
|
dongsheng@716
|
2199 msgstr "本书使用如下的印刷约定:"
|
dongsheng@714
|
2200
|
dongsheng@714
|
2201 #. type: Content of: <book><preface><sect1><variablelist><varlistentry><term>
|
dongsheng@714
|
2202 #: ../en/ch00-preface.xml:118
|
dongsheng@714
|
2203 msgid "Italic"
|
dongsheng@716
|
2204 msgstr "斜体"
|
dongsheng@714
|
2205
|
dongsheng@714
|
2206 #. type: Content of: <book><preface><sect1><variablelist><varlistentry><listitem><para>
|
dongsheng@714
|
2207 #: ../en/ch00-preface.xml:121
|
dongsheng@714
|
2208 msgid ""
|
dongsheng@714
|
2209 "Indicates new terms, URLs, email addresses, filenames, and file extensions."
|
dongsheng@716
|
2210 msgstr "标识新术语,URL,电子邮件地址,文件名称与扩展名。"
|
dongsheng@714
|
2211
|
dongsheng@714
|
2212 #. type: Content of: <book><preface><sect1><variablelist><varlistentry><term>
|
dongsheng@714
|
2213 #: ../en/ch00-preface.xml:127
|
dongsheng@714
|
2214 msgid "<literal>Constant width</literal>"
|
dongsheng@716
|
2215 msgstr "<literal>等宽</literal>"
|
dongsheng@714
|
2216
|
dongsheng@714
|
2217 #. type: Content of: <book><preface><sect1><variablelist><varlistentry><listitem><para>
|
dongsheng@714
|
2218 #: ../en/ch00-preface.xml:130
|
dongsheng@714
|
2219 msgid ""
|
dongsheng@714
|
2220 "Used for program listings, as well as within paragraphs to refer to program "
|
dongsheng@714
|
2221 "elements such as variable or function names, databases, data types, "
|
dongsheng@714
|
2222 "environment variables, statements, and keywords."
|
dongsheng@714
|
2223 msgstr ""
|
dongsheng@716
|
2224 "用于程序列表,以及段内引用的程序元素,例如变量、函数名称、数据库、数据类型、环"
|
dongsheng@716
|
2225 "境变量、声明和关键字。"
|
dongsheng@714
|
2226
|
dongsheng@714
|
2227 #. type: Content of: <book><preface><sect1><variablelist><varlistentry><term>
|
dongsheng@714
|
2228 #: ../en/ch00-preface.xml:138
|
dongsheng@714
|
2229 msgid "<userinput>Constant width bold</userinput>"
|
dongsheng@716
|
2230 msgstr "<userinput>等宽粗体</userinput>"
|
dongsheng@714
|
2231
|
dongsheng@714
|
2232 #. type: Content of: <book><preface><sect1><variablelist><varlistentry><listitem><para>
|
dongsheng@714
|
2233 #: ../en/ch00-preface.xml:141
|
dongsheng@714
|
2234 msgid "Shows commands or other text that should be typed literally by the user."
|
dongsheng@716
|
2235 msgstr "标识命令或者其它用户应该逐字输入的文本。"
|
dongsheng@714
|
2236
|
dongsheng@714
|
2237 #. type: Content of: <book><preface><sect1><variablelist><varlistentry><term>
|
dongsheng@714
|
2238 #: ../en/ch00-preface.xml:147
|
dongsheng@714
|
2239 msgid "<replaceable>Constant width italic</replaceable>"
|
dongsheng@716
|
2240 msgstr "<replaceable>等宽斜体</replaceable>"
|
dongsheng@714
|
2241
|
dongsheng@714
|
2242 #. type: Content of: <book><preface><sect1><variablelist><varlistentry><listitem><para>
|
dongsheng@714
|
2243 #: ../en/ch00-preface.xml:150
|
dongsheng@714
|
2244 msgid ""
|
dongsheng@714
|
2245 "Shows text that should be replaced with user-supplied values or by values "
|
dongsheng@714
|
2246 "determined by context."
|
dongsheng@716
|
2247 msgstr "标识应该被用户提供的值或者取决于上下文的值替换的文本。"
|
dongsheng@714
|
2248
|
dongsheng@714
|
2249 #. type: Content of: <book><preface><sect1><tip><para>
|
dongsheng@714
|
2250 #: ../en/ch00-preface.xml:157
|
dongsheng@714
|
2251 msgid "This icon signifies a tip, suggestion, or general note."
|
dongsheng@716
|
2252 msgstr "此图标表示提示,建议或者一般的的注释。"
|
dongsheng@714
|
2253
|
dongsheng@714
|
2254 #. type: Content of: <book><preface><sect1><caution><para>
|
dongsheng@714
|
2255 #: ../en/ch00-preface.xml:162
|
dongsheng@714
|
2256 msgid "This icon indicates a warning or caution."
|
dongsheng@716
|
2257 msgstr "此图标表示警告。"
|
dongsheng@714
|
2258
|
dongsheng@714
|
2259 #. type: Content of: <book><preface><sect1><title>
|
dongsheng@714
|
2260 #: ../en/ch00-preface.xml:167
|
dongsheng@714
|
2261 msgid "Using Code Examples"
|
dongsheng@716
|
2262 msgstr "使用样例代码"
|
dongsheng@714
|
2263
|
dongsheng@714
|
2264 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2265 #: ../en/ch00-preface.xml:169
|
dongsheng@714
|
2266 msgid ""
|
dongsheng@714
|
2267 "This book is here to help you get your job done. In general, you may use the "
|
dongsheng@714
|
2268 "code in this book in your programs and documentation. You do not need to "
|
dongsheng@714
|
2269 "contact us for permission unless you’re reproducing a significant portion of "
|
dongsheng@714
|
2270 "the code. For example, writing a program that uses several chunks of code "
|
dongsheng@714
|
2271 "from this book does not require permission. Selling or distributing a CD-ROM "
|
dongsheng@714
|
2272 "of examples from O’Reilly books does require permission. Answering a "
|
dongsheng@714
|
2273 "question by citing this book and quoting example code does not require "
|
dongsheng@714
|
2274 "permission. Incorporating a significant amount of example code from this book "
|
dongsheng@714
|
2275 "into your product’s documentation does require permission."
|
dongsheng@714
|
2276 msgstr ""
|
dongsheng@714
|
2277
|
dongsheng@714
|
2278 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2279 #: ../en/ch00-preface.xml:181
|
dongsheng@714
|
2280 msgid ""
|
dongsheng@714
|
2281 "We appreciate, but do not require, attribution. An attribution usually "
|
dongsheng@714
|
2282 "includes the title, author, publisher, and ISBN. For example: “<emphasis>Book "
|
dongsheng@714
|
2283 "Title</emphasis> by Some Author. Copyright 2008 O’Reilly Media, Inc., 978-0-"
|
dongsheng@714
|
2284 "596-xxxx-x.”"
|
dongsheng@714
|
2285 msgstr ""
|
dongsheng@714
|
2286
|
dongsheng@714
|
2287 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2288 #: ../en/ch00-preface.xml:187
|
dongsheng@714
|
2289 msgid ""
|
dongsheng@714
|
2290 "If you feel your use of code examples falls outside fair use or the "
|
dongsheng@714
|
2291 "permission given above, feel free to contact us at <email>permissions@oreilly."
|
dongsheng@714
|
2292 "com</email>."
|
dongsheng@714
|
2293 msgstr ""
|
dongsheng@714
|
2294
|
dongsheng@714
|
2295 #. type: Content of: <book><preface><sect1><title>
|
dongsheng@714
|
2296 #: ../en/ch00-preface.xml:193
|
dongsheng@714
|
2297 msgid "Safari® Books Online"
|
dongsheng@716
|
2298 msgstr "Safari® 在线书库"
|
dongsheng@714
|
2299
|
dongsheng@714
|
2300 #. type: Content of: <book><preface><sect1><note><para>
|
dongsheng@714
|
2301 #: ../en/ch00-preface.xml:196
|
dongsheng@714
|
2302 msgid ""
|
dongsheng@714
|
2303 "When you see a Safari® Books Online icon on the cover of your favorite "
|
dongsheng@714
|
2304 "technology book, that means the book is available online through the O’Reilly "
|
dongsheng@714
|
2305 "Network Safari Bookshelf."
|
dongsheng@714
|
2306 msgstr ""
|
dongsheng@714
|
2307
|
dongsheng@714
|
2308 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2309 #: ../en/ch00-preface.xml:202
|
dongsheng@714
|
2310 msgid ""
|
dongsheng@714
|
2311 "Safari offers a solution that’s better than e-books. It’s a virtual library "
|
dongsheng@714
|
2312 "that lets you easily search thousands of top tech books, cut and paste code "
|
dongsheng@714
|
2313 "samples, download chapters, and find quick answers when you need the most "
|
dongsheng@714
|
2314 "accurate, current information. Try it for free at <ulink role=\"orm:hideurl:"
|
dongsheng@714
|
2315 "ital\" url=\"http://my.safaribooksonline.com/?portal=oreilly\">http://my."
|
dongsheng@714
|
2316 "safaribooksonline.com</ulink>."
|
dongsheng@714
|
2317 msgstr ""
|
dongsheng@714
|
2318
|
dongsheng@714
|
2319 #. type: Content of: <book><preface><sect1><title>
|
dongsheng@714
|
2320 #: ../en/ch00-preface.xml:211
|
dongsheng@714
|
2321 msgid "How to Contact Us"
|
dongsheng@716
|
2322 msgstr "联系我们"
|
dongsheng@714
|
2323
|
dongsheng@714
|
2324 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2325 #: ../en/ch00-preface.xml:213
|
dongsheng@714
|
2326 msgid ""
|
dongsheng@714
|
2327 "Please address comments and questions concerning this book to the publisher:"
|
dongsheng@714
|
2328 msgstr ""
|
dongsheng@714
|
2329
|
dongsheng@714
|
2330 #. type: Content of: <book><preface><sect1><simplelist><member>
|
dongsheng@714
|
2331 #: ../en/ch00-preface.xml:217
|
dongsheng@714
|
2332 msgid "O’Reilly Media, Inc."
|
dongsheng@714
|
2333 msgstr ""
|
dongsheng@714
|
2334
|
dongsheng@714
|
2335 #. type: Content of: <book><preface><sect1><simplelist><member>
|
dongsheng@714
|
2336 #: ../en/ch00-preface.xml:219
|
dongsheng@714
|
2337 msgid "1005 Gravenstein Highway North"
|
dongsheng@714
|
2338 msgstr ""
|
dongsheng@714
|
2339
|
dongsheng@714
|
2340 #. type: Content of: <book><preface><sect1><simplelist><member>
|
dongsheng@714
|
2341 #: ../en/ch00-preface.xml:221
|
dongsheng@714
|
2342 msgid "Sebastopol, CA 95472"
|
dongsheng@714
|
2343 msgstr ""
|
dongsheng@714
|
2344
|
dongsheng@714
|
2345 #. type: Content of: <book><preface><sect1><simplelist><member>
|
dongsheng@714
|
2346 #: ../en/ch00-preface.xml:223
|
dongsheng@714
|
2347 msgid "800-998-9938 (in the United States or Canada)"
|
dongsheng@714
|
2348 msgstr ""
|
dongsheng@714
|
2349
|
dongsheng@714
|
2350 #. type: Content of: <book><preface><sect1><simplelist><member>
|
dongsheng@714
|
2351 #: ../en/ch00-preface.xml:225
|
dongsheng@714
|
2352 msgid "707-829-0515 (international or local)"
|
dongsheng@714
|
2353 msgstr ""
|
dongsheng@714
|
2354
|
dongsheng@714
|
2355 #. type: Content of: <book><preface><sect1><simplelist><member>
|
dongsheng@714
|
2356 #: ../en/ch00-preface.xml:227
|
dongsheng@714
|
2357 msgid "707 829-0104 (fax)"
|
dongsheng@714
|
2358 msgstr ""
|
dongsheng@714
|
2359
|
dongsheng@714
|
2360 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2361 #: ../en/ch00-preface.xml:230
|
dongsheng@714
|
2362 msgid ""
|
dongsheng@714
|
2363 "We have a web page for this book, where we list errata, examples, and any "
|
dongsheng@714
|
2364 "additional information. You can access this page at:"
|
dongsheng@714
|
2365 msgstr ""
|
dongsheng@714
|
2366
|
dongsheng@714
|
2367 #. type: Content of: <book><preface><sect1><simplelist><member>
|
dongsheng@714
|
2368 #: ../en/ch00-preface.xml:235
|
dongsheng@714
|
2369 msgid ""
|
dongsheng@714
|
2370 "<ulink url=\"http://www.oreilly.com/catalog/<catalog page>\"></ulink>"
|
dongsheng@714
|
2371 msgstr ""
|
dongsheng@714
|
2372
|
dongsheng@714
|
2373 #. type: Content of: <book><preface><sect1><remark>
|
dongsheng@714
|
2374 #: ../en/ch00-preface.xml:239
|
dongsheng@714
|
2375 msgid "Don’t forget to update the <url> attribute, too."
|
dongsheng@714
|
2376 msgstr ""
|
dongsheng@714
|
2377
|
dongsheng@714
|
2378 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2379 #: ../en/ch00-preface.xml:242
|
dongsheng@714
|
2380 msgid "To comment or ask technical questions about this book, send email to:"
|
dongsheng@714
|
2381 msgstr ""
|
dongsheng@714
|
2382
|
dongsheng@714
|
2383 #. type: Content of: <book><preface><sect1><simplelist><member>
|
dongsheng@714
|
2384 #: ../en/ch00-preface.xml:246
|
dongsheng@714
|
2385 msgid "<email>bookquestions@oreilly.com</email>"
|
dongsheng@715
|
2386 msgstr "<email>bookquestions@oreilly.com</email>"
|
dongsheng@714
|
2387
|
dongsheng@714
|
2388 #. type: Content of: <book><preface><sect1><para>
|
dongsheng@714
|
2389 #: ../en/ch00-preface.xml:249
|
dongsheng@714
|
2390 msgid ""
|
dongsheng@714
|
2391 "For more information about our books, conferences, Resource Centers, and the "
|
dongsheng@714
|
2392 "O’Reilly Network, see our web site at:"
|
dongsheng@714
|
2393 msgstr ""
|
dongsheng@714
|
2394
|
dongsheng@714
|
2395 #. type: Content of: <book><preface><sect1><simplelist><member>
|
dongsheng@714
|
2396 #: ../en/ch00-preface.xml:253
|
dongsheng@714
|
2397 msgid "<ulink url=\"http://www.oreilly.com\"></ulink>"
|
dongsheng@715
|
2398 msgstr "<ulink url=\"http://www.oreilly.com\"></ulink>"
|
dongsheng@714
|
2399
|
dongsheng@714
|
2400 #. type: Content of: <book><chapter><title>
|
dongsheng@714
|
2401 #: ../en/ch01-intro.xml:5
|
dongsheng@714
|
2402 msgid "How did we get here?"
|
dongsheng@876
|
2403 msgstr "写在前面"
|
dongsheng@714
|
2404
|
dongsheng@714
|
2405 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
2406 #: ../en/ch01-intro.xml:8
|
dongsheng@653
|
2407 msgid "Why revision control? Why Mercurial?"
|
dongsheng@653
|
2408 msgstr "为什么使用版本控制? 为什么使用 Mercurial?"
|
dongsheng@653
|
2409
|
dongsheng@714
|
2410 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
2411 #: ../en/ch01-intro.xml:10
|
dongsheng@653
|
2412 msgid ""
|
dongsheng@653
|
2413 "Revision control is the process of managing multiple versions of a piece of "
|
dongsheng@653
|
2414 "information. In its simplest form, this is something that many people do by "
|
dongsheng@653
|
2415 "hand: every time you modify a file, save it under a new name that contains a "
|
dongsheng@653
|
2416 "number, each one higher than the number of the preceding version."
|
dongsheng@653
|
2417 msgstr ""
|
zhaopingsun@1036
|
2418 "版本控制是管理一些信息的多个版本的过程。它最简单的形式莫过于:每次你修改一个文"
|
zhaopingsun@1036
|
2419 "件后都重新命名保存,文件名中包含一个数字,每次修改后这个数字都增加。这通常是许"
|
zhaopingsun@1036
|
2420 "多人手工完成的。"
|
dongsheng@653
|
2421
|
dongsheng@714
|
2422 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
2423 #: ../en/ch01-intro.xml:16
|
dongsheng@653
|
2424 msgid ""
|
dongsheng@653
|
2425 "Manually managing multiple versions of even a single file is an error-prone "
|
dongsheng@653
|
2426 "task, though, so software tools to help automate this process have long been "
|
dongsheng@653
|
2427 "available. The earliest automated revision control tools were intended to "
|
dongsheng@653
|
2428 "help a single user to manage revisions of a single file. Over the past few "
|
dongsheng@653
|
2429 "decades, the scope of revision control tools has expanded greatly; they now "
|
dongsheng@653
|
2430 "manage multiple files, and help multiple people to work together. The best "
|
dongsheng@653
|
2431 "modern revision control tools have no problem coping with thousands of people "
|
dongsheng@653
|
2432 "working together on projects that consist of hundreds of thousands of files."
|
dongsheng@653
|
2433 msgstr ""
|
zhaopingsun@1036
|
2434 "然而,手工管理即使是一个文件的多个版本也是很容易出错的,所以很早就有软件工具来"
|
zhaopingsun@1036
|
2435 "使这个过程自动化。最早的自动化软件管理工具的目标是帮助一个用户管理一个文件的版"
|
zhaopingsun@1036
|
2436 "本。在过去的几十年里,版本控制工具的范围得到极大扩展;现在它们可以管理多个文"
|
zhaopingsun@1036
|
2437 "件,帮助许多人一起工作。最新的版本控制工具可以支持上包含成数十万个文件,几千个"
|
zhaopingsun@1036
|
2438 "人一起工作的项目。"
|
dongsheng@653
|
2439
|
dongsheng@714
|
2440 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
2441 #: ../en/ch01-intro.xml:27
|
dongsheng@653
|
2442 msgid ""
|
dongsheng@653
|
2443 "The arrival of distributed revision control is relatively recent, and so far "
|
dongsheng@653
|
2444 "this new field has grown due to people's willingness to explore ill-charted "
|
dongsheng@653
|
2445 "territory."
|
dongsheng@653
|
2446 msgstr ""
|
zhaopingsun@1036
|
2447 "分布式版本控制是最近才出现的,但是由于人们愿意探索新的疆域,目前这一新的领域已"
|
zhaopingsun@1036
|
2448 "经得到了长足的发展"
|
dongsheng@653
|
2449
|
dongsheng@714
|
2450 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
2451 #: ../en/ch01-intro.xml:31
|
dongsheng@653
|
2452 msgid ""
|
dongsheng@653
|
2453 "I am writing a book about distributed revision control because I believe that "
|
dongsheng@653
|
2454 "it is an important subject that deserves a field guide. I chose to write "
|
dongsheng@653
|
2455 "about Mercurial because it is the easiest tool to learn the terrain with, and "
|
dongsheng@653
|
2456 "yet it scales to the demands of real, challenging environments where many "
|
dongsheng@653
|
2457 "other revision control tools buckle."
|
dongsheng@653
|
2458 msgstr ""
|
zhaopingsun@1036
|
2459 "我写这本关于分布式版本控制的书是因为我相信这个领域应该有一个指南。我选择"
|
zhaopingsun@1036
|
2460 "Mercurial是因为它是在这个领域中学习最容易上手的工具,并且它能够满足真实的,挑"
|
zhaopingsun@1036
|
2461 "战性的环境的要求,而其他版本控制工具只能望而兴叹。"
|
dongsheng@653
|
2462
|
dongsheng@714
|
2463 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
2464 #: ../en/ch01-intro.xml:39
|
dongsheng@653
|
2465 msgid "Why use revision control?"
|
dongsheng@653
|
2466 msgstr "为什么使用版本控制?"
|
dongsheng@653
|
2467
|
dongsheng@714
|
2468 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
2469 #: ../en/ch01-intro.xml:41
|
dongsheng@653
|
2470 msgid ""
|
dongsheng@653
|
2471 "There are a number of reasons why you or your team might want to use an "
|
dongsheng@653
|
2472 "automated revision control tool for a project."
|
dongsheng@653
|
2473 msgstr ""
|
zhaopingsun@1036
|
2474 "为什么你或者你的团队可能需要在项目中使用自动化版本控制工具呢?有很多理由。"
|
dongsheng@653
|
2475
|
dongsheng@714
|
2476 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
2477 #: ../en/ch01-intro.xml:46
|
dongsheng@653
|
2478 msgid ""
|
dongsheng@653
|
2479 "It will track the history and evolution of your project, so you don't have "
|
dongsheng@653
|
2480 "to. For every change, you'll have a log of <emphasis>who</emphasis> made it; "
|
dongsheng@653
|
2481 "<emphasis>why</emphasis> they made it; <emphasis>when</emphasis> they made "
|
dongsheng@653
|
2482 "it; and <emphasis>what</emphasis> the change was."
|
dongsheng@653
|
2483 msgstr ""
|
zhaopingsun@1036
|
2484 "因为它能记录你的项目的历史和演化,所以你不必再给每个变更都记录日志,<emphasis>"
|
zhaopingsun@1036
|
2485 "谁</emphasis>做的;<emphasis>为什么</emphasis>他们这样做;<emphasis>什么时候</"
|
zhaopingsun@1036
|
2486 "emphasis>做的;做了<emphasis>什么</emphasis>修改。"
|
dongsheng@653
|
2487
|
dongsheng@714
|
2488 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
2489 #: ../en/ch01-intro.xml:53
|
dongsheng@653
|
2490 msgid ""
|
dongsheng@653
|
2491 "When you're working with other people, revision control software makes it "
|
dongsheng@653
|
2492 "easier for you to collaborate. For example, when people more or less "
|
dongsheng@653
|
2493 "simultaneously make potentially incompatible changes, the software will help "
|
dongsheng@653
|
2494 "you to identify and resolve those conflicts."
|
dongsheng@653
|
2495 msgstr ""
|
zhaopingsun@1036
|
2496 "当你和其他人一起工作的时候,版本控制工具让你合作的更容易。例如,当许多人或多或"
|
zhaopingsun@1036
|
2497 "少的同时进行有可能冲突的修改的时候,软件可以帮助你确定和解决这些冲突。"
|
dongsheng@653
|
2498
|
dongsheng@714
|
2499 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
2500 #: ../en/ch01-intro.xml:59
|
dongsheng@653
|
2501 msgid ""
|
dongsheng@653
|
2502 "It can help you to recover from mistakes. If you make a change that later "
|
dongsheng@653
|
2503 "turns out to be in error, you can revert to an earlier version of one or more "
|
dongsheng@653
|
2504 "files. In fact, a <emphasis>really</emphasis> good revision control tool "
|
dongsheng@653
|
2505 "will even help you to efficiently figure out exactly when a problem was "
|
songdongsheng@658
|
2506 "introduced (see <xref linkend=\"sec:undo:bisect\"/> for details)."
|
dongsheng@653
|
2507 msgstr ""
|
zhaopingsun@1036
|
2508 "它能帮助你修正错误。如果你做了一个修改,但是后来发现这是个错误,你能恢复到一个"
|
zhaopingsun@1036
|
2509 "或者多个文件以前的版本。实际上,一个<emphasis>相当</emphasis>好的版本控制工具"
|
zhaopingsun@1036
|
2510 "甚至会帮助你找出什么什么是时候引入的这个问题(详细信息参考<xref linkend=\"sec:"
|
zhaopingsun@1036
|
2511 "undo:bisect\"/>)。 "
|
dongsheng@653
|
2512
|
dongsheng@714
|
2513 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
2514 #: ../en/ch01-intro.xml:66
|
dongsheng@653
|
2515 msgid ""
|
dongsheng@653
|
2516 "It will help you to work simultaneously on, and manage the drift between, "
|
dongsheng@653
|
2517 "multiple versions of your project."
|
zhaopingsun@1036
|
2518 msgstr "它能帮助你同时工作于项目的多个版本,并管理它们的差异。"
|
dongsheng@653
|
2519
|
dongsheng@714
|
2520 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
2521 #: ../en/ch01-intro.xml:71
|
dongsheng@653
|
2522 msgid ""
|
songdongsheng@668
|
2523 "Most of these reasons are equally valid&emdash;at least in theory&emdash;"
|
songdongsheng@668
|
2524 "whether you're working on a project by yourself, or with a hundred other "
|
songdongsheng@668
|
2525 "people."
|
dongsheng@653
|
2526 msgstr ""
|
zhaopingsun@1036
|
2527 "大多数这些理由都是等效的&emdash;至少在理论上&emdash;不管你是一个人做项目还是和"
|
zhaopingsun@1036
|
2528 "几百个人一起。"
|
dongsheng@653
|
2529
|
dongsheng@714
|
2530 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
2531 #: ../en/ch01-intro.xml:76
|
dongsheng@653
|
2532 msgid ""
|
dongsheng@653
|
2533 "A key question about the practicality of revision control at these two "
|
dongsheng@653
|
2534 "different scales (<quote>lone hacker</quote> and <quote>huge team</quote>) is "
|
dongsheng@653
|
2535 "how its <emphasis>benefits</emphasis> compare to its <emphasis>costs</"
|
dongsheng@653
|
2536 "emphasis>. A revision control tool that's difficult to understand or use is "
|
dongsheng@653
|
2537 "going to impose a high cost."
|
dongsheng@653
|
2538 msgstr ""
|
zhaopingsun@1036
|
2539 "版本控制在在不同尺度上(<quote>单个黑客</quote>和<quote>一个大项目组</quote>)"
|
zhaopingsun@1036
|
2540 "实践的一个关键问题是它的<emphasis>性价</emphasis>比怎么样。一个很难理解和使用"
|
zhaopingsun@1036
|
2541 "的版本控制工具会让你的代价很高。"
|
dongsheng@653
|
2542
|
dongsheng@714
|
2543 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
2544 #: ../en/ch01-intro.xml:84
|
dongsheng@653
|
2545 msgid ""
|
dongsheng@653
|
2546 "A five-hundred-person project is likely to collapse under its own weight "
|
dongsheng@653
|
2547 "almost immediately without a revision control tool and process. In this case, "
|
dongsheng@653
|
2548 "the cost of using revision control might hardly seem worth considering, since "
|
dongsheng@653
|
2549 "<emphasis>without</emphasis> it, failure is almost guaranteed."
|
dongsheng@653
|
2550 msgstr ""
|
zhaopingsun@1036
|
2551 "如果没有版本控制工具和过程,一个五百人的项目很快就可能就将自己压垮。在这种情况"
|
zhaopingsun@1036
|
2552 "下,版本控制的代价基本上不用考虑,因为没有它,失败几乎是一定的。"
|
dongsheng@653
|
2553
|
dongsheng@714
|
2554 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
2555 #: ../en/ch01-intro.xml:91
|
dongsheng@653
|
2556 msgid ""
|
dongsheng@653
|
2557 "On the other hand, a one-person <quote>quick hack</quote> might seem like a "
|
dongsheng@653
|
2558 "poor place to use a revision control tool, because surely the cost of using "
|
dongsheng@653
|
2559 "one must be close to the overall cost of the project. Right?"
|
dongsheng@653
|
2560 msgstr ""
|
zhaopingsun@1036
|
2561 "另一方面,一个人的<quote>快速编程</quote>看起来并不适合使用版本控制工具,因为"
|
zhaopingsun@1036
|
2562 "使用一个版本控制工具的代价就是整个项目的代价,对吧?"
|
dongsheng@653
|
2563
|
dongsheng@714
|
2564 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
2565 #: ../en/ch01-intro.xml:96
|
dongsheng@653
|
2566 msgid ""
|
dongsheng@653
|
2567 "Mercurial uniquely supports <emphasis>both</emphasis> of these scales of "
|
dongsheng@653
|
2568 "development. You can learn the basics in just a few minutes, and due to its "
|
dongsheng@653
|
2569 "low overhead, you can apply revision control to the smallest of projects with "
|
dongsheng@653
|
2570 "ease. Its simplicity means you won't have a lot of abstruse concepts or "
|
dongsheng@653
|
2571 "command sequences competing for mental space with whatever you're "
|
dongsheng@653
|
2572 "<emphasis>really</emphasis> trying to do. At the same time, Mercurial's high "
|
dongsheng@653
|
2573 "performance and peer-to-peer nature let you scale painlessly to handle large "
|
dongsheng@653
|
2574 "projects."
|
dongsheng@653
|
2575 msgstr ""
|
zhaopingsun@1036
|
2576 "Mercurial的独特之处就是它<emphasis>同时</emphasis>支持这两种尺度的开发。你可以"
|
zhaopingsun@1036
|
2577 "在几分钟之内学会基本的使用,因为代价很小,你可以很方便的在最小的项目上应用版本"
|
zhaopingsun@1036
|
2578 "管理。它的简洁性意味着不会有很多艰深的概念和命令干扰你<emphasis>真正</"
|
zhaopingsun@1036
|
2579 "emphasis>的工作。同时,Mercurial高性能和点对点的特性可以让你轻易的应对大的项"
|
zhaopingsun@1036
|
2580 "目。"
|
dongsheng@653
|
2581
|
dongsheng@714
|
2582 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
2583 #: ../en/ch01-intro.xml:106
|
dongsheng@653
|
2584 msgid ""
|
dongsheng@653
|
2585 "No revision control tool can rescue a poorly run project, but a good choice "
|
dongsheng@653
|
2586 "of tools can make a huge difference to the fluidity with which you can work "
|
dongsheng@653
|
2587 "on a project."
|
dongsheng@653
|
2588 msgstr ""
|
zhaopingsun@1036
|
2589 "没有一个版本控制工具能拯救一个糟糕的项目,但是在项目中选择好的工具会大大的提高"
|
zhaopingsun@1036
|
2590 "效率,正是工欲善其事,必先利其器。"
|
dongsheng@653
|
2591
|
dongsheng@714
|
2592 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
2593 #: ../en/ch01-intro.xml:113
|
dongsheng@653
|
2594 msgid "The many names of revision control"
|
dongsheng@653
|
2595 msgstr "版本控制的别名"
|
dongsheng@653
|
2596
|
dongsheng@714
|
2597 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
2598 #: ../en/ch01-intro.xml:115
|
dongsheng@653
|
2599 msgid ""
|
dongsheng@653
|
2600 "Revision control is a diverse field, so much so that it is referred to by "
|
dongsheng@653
|
2601 "many names and acronyms. Here are a few of the more common variations you'll "
|
dongsheng@653
|
2602 "encounter:"
|
dongsheng@653
|
2603 msgstr ""
|
zhaopingsun@1036
|
2604 "版本控制是一个各自为政的领域,以至于有很多名称和缩略语,下面是你可能遇到的一些"
|
zhaopingsun@1036
|
2605 "常用的术语:"
|
dongsheng@653
|
2606
|
dongsheng@714
|
2607 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
2608 #: ../en/ch01-intro.xml:119
|
dongsheng@653
|
2609 msgid "Revision control (RCS)"
|
dongsheng@653
|
2610 msgstr "版本控制(RCS)"
|
dongsheng@653
|
2611
|
dongsheng@714
|
2612 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
2613 #: ../en/ch01-intro.xml:120
|
dongsheng@653
|
2614 msgid "Software configuration management (SCM), or configuration management"
|
dongsheng@653
|
2615 msgstr "软件配置管理(SCM),或配置管理"
|
dongsheng@653
|
2616
|
dongsheng@714
|
2617 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
2618 #: ../en/ch01-intro.xml:122
|
dongsheng@653
|
2619 msgid "Source code management"
|
dongsheng@653
|
2620 msgstr "源代码管理"
|
dongsheng@653
|
2621
|
dongsheng@714
|
2622 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
2623 #: ../en/ch01-intro.xml:123
|
dongsheng@653
|
2624 msgid "Source code control, or source control"
|
dongsheng@653
|
2625 msgstr "源代码控制,或源控制"
|
dongsheng@653
|
2626
|
dongsheng@714
|
2627 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
2628 #: ../en/ch01-intro.xml:125
|
dongsheng@653
|
2629 msgid "Version control (VCS)"
|
dongsheng@653
|
2630 msgstr "版本控制(VCS)"
|
dongsheng@653
|
2631
|
dongsheng@714
|
2632 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
2633 #: ../en/ch01-intro.xml:127
|
dongsheng@653
|
2634 msgid ""
|
dongsheng@653
|
2635 "Some people claim that these terms actually have different meanings, but in "
|
dongsheng@653
|
2636 "practice they overlap so much that there's no agreed or even useful way to "
|
dongsheng@653
|
2637 "tease them apart."
|
dongsheng@653
|
2638 msgstr ""
|
zhaopingsun@1036
|
2639 "有些人声称这些术语有不同的含义,但实际上它们的含义太重叠了,根本没有一致的,甚"
|
zhaopingsun@1036
|
2640 "至有用的方式来区别它们。"
|
dongsheng@653
|
2641
|
dongsheng@714
|
2642 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
2643 #: ../en/ch01-intro.xml:135
|
dongsheng@653
|
2644 msgid "About the examples in this book"
|
dongsheng@653
|
2645 msgstr "本书的例子"
|
dongsheng@653
|
2646
|
dongsheng@714
|
2647 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
2648 #: ../en/ch01-intro.xml:137
|
dongsheng@653
|
2649 msgid ""
|
dongsheng@653
|
2650 "This book takes an unusual approach to code samples. Every example is "
|
songdongsheng@668
|
2651 "<quote>live</quote>&emdash;each one is actually the result of a shell script "
|
songdongsheng@668
|
2652 "that executes the Mercurial commands you see. Every time an image of the "
|
songdongsheng@668
|
2653 "book is built from its sources, all the example scripts are automatically "
|
songdongsheng@668
|
2654 "run, and their current results compared against their expected results."
|
dongsheng@653
|
2655 msgstr ""
|
dongsheng@653
|
2656
|
dongsheng@714
|
2657 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
2658 #: ../en/ch01-intro.xml:144
|
dongsheng@653
|
2659 msgid ""
|
dongsheng@653
|
2660 "The advantage of this approach is that the examples are always accurate; they "
|
songdongsheng@710
|
2661 "describe <emphasis>exactly</emphasis> the behavior of the version of "
|
dongsheng@653
|
2662 "Mercurial that's mentioned at the front of the book. If I update the version "
|
dongsheng@653
|
2663 "of Mercurial that I'm documenting, and the output of some command changes, "
|
dongsheng@653
|
2664 "the build fails."
|
dongsheng@653
|
2665 msgstr ""
|
dongsheng@653
|
2666
|
dongsheng@714
|
2667 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
2668 #: ../en/ch01-intro.xml:151
|
dongsheng@653
|
2669 msgid ""
|
dongsheng@653
|
2670 "There is a small disadvantage to this approach, which is that the dates and "
|
dongsheng@653
|
2671 "times you'll see in examples tend to be <quote>squashed</quote> together in a "
|
dongsheng@653
|
2672 "way that they wouldn't be if the same commands were being typed by a human. "
|
dongsheng@653
|
2673 "Where a human can issue no more than one command every few seconds, with any "
|
dongsheng@653
|
2674 "resulting timestamps correspondingly spread out, my automated example scripts "
|
dongsheng@653
|
2675 "run many commands in one second."
|
dongsheng@653
|
2676 msgstr ""
|
dongsheng@653
|
2677
|
dongsheng@714
|
2678 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
2679 #: ../en/ch01-intro.xml:159
|
dongsheng@653
|
2680 msgid ""
|
dongsheng@653
|
2681 "As an instance of this, several consecutive commits in an example can show up "
|
dongsheng@653
|
2682 "as having occurred during the same second. You can see this occur in the "
|
songdongsheng@658
|
2683 "<literal role=\"hg-ext\">bisect</literal> example in <xref linkend=\"sec:undo:"
|
songdongsheng@658
|
2684 "bisect\"/>, for instance."
|
dongsheng@653
|
2685 msgstr ""
|
dongsheng@653
|
2686
|
dongsheng@714
|
2687 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
2688 #: ../en/ch01-intro.xml:165
|
dongsheng@653
|
2689 msgid ""
|
dongsheng@653
|
2690 "So when you're reading examples, don't place too much weight on the dates or "
|
dongsheng@653
|
2691 "times you see in the output of commands. But <emphasis>do</emphasis> be "
|
songdongsheng@710
|
2692 "confident that the behavior you're seeing is consistent and reproducible."
|
dongsheng@653
|
2693 msgstr ""
|
zhaopingsun@1036
|
2694 "所以当你研究这些例子的时候,不要太注意命令输出的日期和时间。但是<emphasis>要</"
|
zhaopingsun@1036
|
2695 "emphasis>保证你看到的行为是一致的和可以再现的。"
|
dongsheng@653
|
2696
|
dongsheng@714
|
2697 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
2698 #: ../en/ch01-intro.xml:173
|
dongsheng@653
|
2699 msgid "Trends in the field"
|
dongsheng@653
|
2700 msgstr "版本控制的发展趋势"
|
dongsheng@653
|
2701
|
dongsheng@714
|
2702 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
2703 #: ../en/ch01-intro.xml:175
|
dongsheng@653
|
2704 msgid ""
|
dongsheng@653
|
2705 "There has been an unmistakable trend in the development and use of revision "
|
dongsheng@653
|
2706 "control tools over the past four decades, as people have become familiar with "
|
dongsheng@653
|
2707 "the capabilities of their tools and constrained by their limitations."
|
dongsheng@653
|
2708 msgstr ""
|
zhaopingsun@1036
|
2709 "在过去的四十年中,随着人们越来越熟悉他们的工具的能力和限制,开发和使用版本控制"
|
zhaopingsun@1036
|
2710 "工具出现了明确的趋势。 "
|
dongsheng@653
|
2711
|
dongsheng@714
|
2712 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
2713 #: ../en/ch01-intro.xml:180
|
dongsheng@653
|
2714 msgid ""
|
dongsheng@653
|
2715 "The first generation began by managing single files on individual computers. "
|
dongsheng@653
|
2716 "Although these tools represented a huge advance over ad-hoc manual revision "
|
dongsheng@653
|
2717 "control, their locking model and reliance on a single computer limited them "
|
dongsheng@653
|
2718 "to small, tightly-knit teams."
|
dongsheng@653
|
2719 msgstr ""
|
zhaopingsun@1036
|
2720 "在第一代软件开始于在个人计算机上管理单个文件。虽然这些工具比手工管理版本有了巨"
|
zhaopingsun@1036
|
2721 "大的飞跃。但是加锁模型和依赖于单个计算机限制了他们之能用于小的,组织严密的团"
|
zhaopingsun@1036
|
2722 "队。"
|
dongsheng@653
|
2723
|
dongsheng@714
|
2724 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
2725 #: ../en/ch01-intro.xml:186
|
dongsheng@653
|
2726 msgid ""
|
dongsheng@653
|
2727 "The second generation loosened these constraints by moving to network-"
|
dongsheng@653
|
2728 "centered architectures, and managing entire projects at a time. As projects "
|
dongsheng@653
|
2729 "grew larger, they ran into new problems. With clients needing to talk to "
|
dongsheng@653
|
2730 "servers very frequently, server scaling became an issue for large projects. "
|
dongsheng@653
|
2731 "An unreliable network connection could prevent remote users from being able "
|
dongsheng@653
|
2732 "to talk to the server at all. As open source projects started making read-"
|
dongsheng@653
|
2733 "only access available anonymously to anyone, people without commit privileges "
|
dongsheng@653
|
2734 "found that they could not use the tools to interact with a project in a "
|
dongsheng@653
|
2735 "natural way, as they could not record their changes."
|
dongsheng@653
|
2736 msgstr ""
|
zhaopingsun@1036
|
2737 "第二代软件因为采用以网络为中心的结构,一次性管理整个项目而放松了这些限制。随着"
|
zhaopingsun@1036
|
2738 "项目增长,又出现了新的问题。客户需要频繁的和服务器交互,服务器的可伸缩性成为大"
|
zhaopingsun@1036
|
2739 "项目的主要问题。不可靠的网络会妨碍客户和服务器的交互。随着开源项目开始开放只读"
|
zhaopingsun@1036
|
2740 "权限给匿名用户,没有提交权限的用户发现他们不能以自然的方式使用工具和项目交互,"
|
zhaopingsun@1036
|
2741 "因为他们不能记录他们的修改。"
|
dongsheng@653
|
2742
|
dongsheng@714
|
2743 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
2744 #: ../en/ch01-intro.xml:198
|
dongsheng@653
|
2745 msgid ""
|
dongsheng@653
|
2746 "The current generation of revision control tools is peer-to-peer in nature. "
|
dongsheng@653
|
2747 "All of these systems have dropped the dependency on a single central server, "
|
dongsheng@653
|
2748 "and allow people to distribute their revision control data to where it's "
|
dongsheng@653
|
2749 "actually needed. Collaboration over the Internet has moved from constrained "
|
dongsheng@653
|
2750 "by technology to a matter of choice and consensus. Modern tools can operate "
|
dongsheng@653
|
2751 "offline indefinitely and autonomously, with a network connection only needed "
|
dongsheng@653
|
2752 "when syncing changes with another repository."
|
dongsheng@653
|
2753 msgstr ""
|
zhaopingsun@1036
|
2754 "新一代的版本控制工具本质上是点对点的。所有的这些系统都抛弃了对单个中央服务器的"
|
zhaopingsun@1036
|
2755 "依赖,允许用户发布他们的版本控制数据到任何需要的地方。通过互联网的协作摆脱了技"
|
zhaopingsun@1036
|
2756 "术的限制,走向选择和审查。现代的工具可以进行自治的,不受限制的离线操作。只需要"
|
zhaopingsun@1037
|
2757 "在有网络的时候和其他的版本库同步即可。"
|
dongsheng@653
|
2758
|
dongsheng@714
|
2759 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
2760 #: ../en/ch01-intro.xml:210
|
dongsheng@653
|
2761 msgid "A few of the advantages of distributed revision control"
|
dongsheng@653
|
2762 msgstr "分布版本控制的优点"
|
dongsheng@653
|
2763
|
dongsheng@714
|
2764 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
2765 #: ../en/ch01-intro.xml:213
|
dongsheng@653
|
2766 msgid ""
|
dongsheng@653
|
2767 "Even though distributed revision control tools have for several years been as "
|
dongsheng@653
|
2768 "robust and usable as their previous-generation counterparts, people using "
|
dongsheng@653
|
2769 "older tools have not yet necessarily woken up to their advantages. There are "
|
dongsheng@653
|
2770 "a number of ways in which distributed tools shine relative to centralised "
|
dongsheng@653
|
2771 "ones."
|
dongsheng@653
|
2772 msgstr ""
|
zhaopingsun@1035
|
2773 "与他们的上一代竞争者相比,虽然分布式版本控制工具多年来已经很稳定和实用了,但是"
|
zhaopingsun@1035
|
2774 "使用旧的工具的人们还没有完全了解它们的优点,分布式的工具在很多方面明显由于集中"
|
zhaopingsun@1035
|
2775 "式的工具。"
|
dongsheng@653
|
2776
|
dongsheng@714
|
2777 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
2778 #: ../en/ch01-intro.xml:220
|
dongsheng@653
|
2779 msgid ""
|
dongsheng@653
|
2780 "For an individual developer, distributed tools are almost always much faster "
|
dongsheng@653
|
2781 "than centralised tools. This is for a simple reason: a centralised tool "
|
dongsheng@653
|
2782 "needs to talk over the network for many common operations, because most "
|
dongsheng@653
|
2783 "metadata is stored in a single copy on the central server. A distributed "
|
dongsheng@653
|
2784 "tool stores all of its metadata locally. All else being equal, talking over "
|
dongsheng@653
|
2785 "the network adds overhead to a centralised tool. Don't underestimate the "
|
dongsheng@653
|
2786 "value of a snappy, responsive tool: you're going to spend a lot of time "
|
dongsheng@653
|
2787 "interacting with your revision control software."
|
dongsheng@653
|
2788 msgstr ""
|
zhaopingsun@1035
|
2789 "对于个人开发者,分布式工具几乎永远比集中式工具快的多。原因很简单:集中式工具的"
|
zhaopingsun@1035
|
2790 "很多操作需要网络交互,因为大部分元数据都只在中央服务器上有一份拷贝。而一个分布"
|
zhaopingsun@1035
|
2791 "式工具将所有的元数据保存在本地。其他的相同,通过网络的交互增加了集中式工具的负"
|
zhaopingsun@1035
|
2792 "担。不要低估了反应迅速的工具的价值:你要花很多时间和你的版本控制软件交互。"
|
dongsheng@653
|
2793
|
dongsheng@714
|
2794 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
2795 #: ../en/ch01-intro.xml:231
|
dongsheng@653
|
2796 msgid ""
|
dongsheng@653
|
2797 "Distributed tools are indifferent to the vagaries of your server "
|
dongsheng@653
|
2798 "infrastructure, again because they replicate metadata to so many locations. "
|
dongsheng@653
|
2799 "If you use a centralised system and your server catches fire, you'd better "
|
dongsheng@653
|
2800 "hope that your backup media are reliable, and that your last backup was "
|
dongsheng@653
|
2801 "recent and actually worked. With a distributed tool, you have many backups "
|
dongsheng@653
|
2802 "available on every contributor's computer."
|
dongsheng@653
|
2803 msgstr ""
|
zhaopingsun@1035
|
2804 "分布式工具对你的服务器结构并不感冒,因为他们在将元数据复制到很多地方。如果你的"
|
zhaopingsun@1035
|
2805 "集中式系统和你的服务器着火了,你最好希望你的备份介质是可靠的,同时你最后的备份"
|
zhaopingsun@1035
|
2806 "是最近的,而且还能用。而对于分布式工具,你在贡献者的计算机上有很多备份。"
|
dongsheng@653
|
2807
|
dongsheng@714
|
2808 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
2809 #: ../en/ch01-intro.xml:239
|
dongsheng@653
|
2810 msgid ""
|
dongsheng@653
|
2811 "The reliability of your network will affect distributed tools far less than "
|
dongsheng@653
|
2812 "it will centralised tools. You can't even use a centralised tool without a "
|
dongsheng@653
|
2813 "network connection, except for a few highly constrained commands. With a "
|
dongsheng@653
|
2814 "distributed tool, if your network connection goes down while you're working, "
|
dongsheng@653
|
2815 "you may not even notice. The only thing you won't be able to do is talk to "
|
dongsheng@653
|
2816 "repositories on other computers, something that is relatively rare compared "
|
dongsheng@653
|
2817 "with local operations. If you have a far-flung team of collaborators, this "
|
dongsheng@653
|
2818 "may be significant."
|
dongsheng@653
|
2819 msgstr ""
|
zhaopingsun@1035
|
2820 "网络的可靠性对分布式工具的影响要远远小于集中式工具。如果没有网络你根本不能使用"
|
zhaopingsun@1035
|
2821 "集中式工具,除了少数几个功能有限命令。而对于分布式工具,即使在你工作的时候网络"
|
zhaopingsun@1037
|
2822 "瘫痪了,你可能根本不会注意到。你不能做的事情仅仅是不能和其它计算机上的版本库交"
|
zhaopingsun@1037
|
2823 "互了,这种事在本地操作相当罕见。而如果你的团队有异地的人员,那这就很有可能了。"
|
dongsheng@653
|
2824
|
dongsheng@714
|
2825 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
2826 #: ../en/ch01-intro.xml:250
|
dongsheng@653
|
2827 msgid "Advantages for open source projects"
|
dongsheng@653
|
2828 msgstr "开源项目的优点"
|
dongsheng@653
|
2829
|
dongsheng@714
|
2830 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
2831 #: ../en/ch01-intro.xml:252
|
dongsheng@653
|
2832 msgid ""
|
dongsheng@653
|
2833 "If you take a shine to an open source project and decide that you would like "
|
dongsheng@653
|
2834 "to start hacking on it, and that project uses a distributed revision control "
|
dongsheng@653
|
2835 "tool, you are at once a peer with the people who consider themselves the "
|
dongsheng@653
|
2836 "<quote>core</quote> of that project. If they publish their repositories, you "
|
dongsheng@653
|
2837 "can immediately copy their project history, start making changes, and record "
|
dongsheng@653
|
2838 "your work, using the same tools in the same ways as insiders. By contrast, "
|
dongsheng@653
|
2839 "with a centralised tool, you must use the software in a <quote>read only</"
|
dongsheng@653
|
2840 "quote> mode unless someone grants you permission to commit changes to their "
|
dongsheng@653
|
2841 "central server. Until then, you won't be able to record changes, and your "
|
dongsheng@653
|
2842 "local modifications will be at risk of corruption any time you try to update "
|
dongsheng@653
|
2843 "your client's view of the repository."
|
dongsheng@653
|
2844 msgstr ""
|
zhaopingsun@1037
|
2845 "如果你喜欢一个开源项目并且决定准备开始改进它,同时这个项目使用分布式版本控制工"
|
zhaopingsun@1037
|
2846 "具的话,你立刻可以和其他人一样认为自己成为项目的<quote>核心</quote>。如果他们"
|
zhaopingsun@1037
|
2847 "发布了他们的版本库,你可以立即拷贝他们的项目。开始修改,记录你自己的工作,和内"
|
zhaopingsun@1037
|
2848 "部人员一样使用同样的工具。相比之下,如果使用集中式工具,除非有人给你向中央服务"
|
zhaopingsun@1037
|
2849 "器提交修改的权限,你只能用只读的方式使用软件。这样,你就不能记录你的修改,而且"
|
zhaopingsun@1037
|
2850 "当你从版本库更新的时候,本地的修改随时有崩溃的可能。 "
|
dongsheng@653
|
2851
|
dongsheng@714
|
2852 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
2853 #: ../en/ch01-intro.xml:268
|
dongsheng@653
|
2854 msgid "The forking non-problem"
|
dongsheng@660
|
2855 msgstr "分叉不是问题"
|
dongsheng@653
|
2856
|
dongsheng@714
|
2857 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
2858 #: ../en/ch01-intro.xml:270
|
dongsheng@653
|
2859 msgid ""
|
dongsheng@653
|
2860 "It has been suggested that distributed revision control tools pose some sort "
|
dongsheng@653
|
2861 "of risk to open source projects because they make it easy to <quote>fork</"
|
dongsheng@653
|
2862 "quote> the development of a project. A fork happens when there are "
|
dongsheng@653
|
2863 "differences in opinion or attitude between groups of developers that cause "
|
dongsheng@653
|
2864 "them to decide that they can't work together any longer. Each side takes a "
|
dongsheng@653
|
2865 "more or less complete copy of the project's source code, and goes off in its "
|
dongsheng@653
|
2866 "own direction."
|
dongsheng@653
|
2867 msgstr ""
|
dongsheng@653
|
2868
|
dongsheng@714
|
2869 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
2870 #: ../en/ch01-intro.xml:280
|
dongsheng@653
|
2871 msgid ""
|
dongsheng@653
|
2872 "Sometimes the camps in a fork decide to reconcile their differences. With a "
|
dongsheng@653
|
2873 "centralised revision control system, the <emphasis>technical</emphasis> "
|
dongsheng@653
|
2874 "process of reconciliation is painful, and has to be performed largely by "
|
dongsheng@653
|
2875 "hand. You have to decide whose revision history is going to <quote>win</"
|
dongsheng@653
|
2876 "quote>, and graft the other team's changes into the tree somehow. This "
|
dongsheng@653
|
2877 "usually loses some or all of one side's revision history."
|
dongsheng@653
|
2878 msgstr ""
|
dongsheng@653
|
2879
|
dongsheng@714
|
2880 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
2881 #: ../en/ch01-intro.xml:289
|
dongsheng@653
|
2882 msgid ""
|
dongsheng@653
|
2883 "What distributed tools do with respect to forking is they make forking the "
|
dongsheng@653
|
2884 "<emphasis>only</emphasis> way to develop a project. Every single change that "
|
dongsheng@653
|
2885 "you make is potentially a fork point. The great strength of this approach is "
|
dongsheng@653
|
2886 "that a distributed revision control tool has to be really good at "
|
dongsheng@653
|
2887 "<emphasis>merging</emphasis> forks, because forks are absolutely fundamental: "
|
dongsheng@653
|
2888 "they happen all the time."
|
dongsheng@653
|
2889 msgstr ""
|
dongsheng@653
|
2890
|
dongsheng@714
|
2891 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
2892 #: ../en/ch01-intro.xml:298
|
dongsheng@653
|
2893 msgid ""
|
dongsheng@653
|
2894 "If every piece of work that everybody does, all the time, is framed in terms "
|
dongsheng@653
|
2895 "of forking and merging, then what the open source world refers to as a "
|
dongsheng@653
|
2896 "<quote>fork</quote> becomes <emphasis>purely</emphasis> a social issue. If "
|
dongsheng@653
|
2897 "anything, distributed tools <emphasis>lower</emphasis> the likelihood of a "
|
dongsheng@653
|
2898 "fork:"
|
dongsheng@653
|
2899 msgstr ""
|
dongsheng@653
|
2900
|
dongsheng@714
|
2901 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
2902 #: ../en/ch01-intro.xml:305
|
dongsheng@653
|
2903 msgid ""
|
dongsheng@653
|
2904 "They eliminate the social distinction that centralised tools impose: that "
|
dongsheng@653
|
2905 "between insiders (people with commit access) and outsiders (people without)."
|
dongsheng@653
|
2906 msgstr ""
|
dongsheng@653
|
2907
|
dongsheng@714
|
2908 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
2909 #: ../en/ch01-intro.xml:309
|
dongsheng@653
|
2910 msgid ""
|
dongsheng@653
|
2911 "They make it easier to reconcile after a social fork, because all that's "
|
dongsheng@653
|
2912 "involved from the perspective of the revision control software is just "
|
dongsheng@653
|
2913 "another merge."
|
dongsheng@653
|
2914 msgstr ""
|
dongsheng@653
|
2915
|
dongsheng@714
|
2916 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
2917 #: ../en/ch01-intro.xml:314
|
dongsheng@653
|
2918 msgid ""
|
dongsheng@653
|
2919 "Some people resist distributed tools because they want to retain tight "
|
dongsheng@653
|
2920 "control over their projects, and they believe that centralised tools give "
|
dongsheng@653
|
2921 "them this control. However, if you're of this belief, and you publish your "
|
dongsheng@653
|
2922 "CVS or Subversion repositories publicly, there are plenty of tools available "
|
dongsheng@653
|
2923 "that can pull out your entire project's history (albeit slowly) and recreate "
|
dongsheng@653
|
2924 "it somewhere that you don't control. So while your control in this case is "
|
dongsheng@653
|
2925 "illusory, you are forgoing the ability to fluidly collaborate with whatever "
|
dongsheng@653
|
2926 "people feel compelled to mirror and fork your history."
|
dongsheng@653
|
2927 msgstr ""
|
zhaopingsun@1038
|
2928 "有些人拒绝分布式工具因为他们想保持对项目的控制,他们相信集中式工具会给他们这种"
|
zhaopingsun@1038
|
2929 "控制。如果你这种想法,并你将CVS或者Subversion版本库向大众发布了,那么别人可用"
|
zhaopingsun@1038
|
2930 "现有的很多工具将整个项目的历史抓取出来(可能很慢),在其它你控制不了的地方重建"
|
zhaopingsun@1038
|
2931 "版本库。这时你的控制只不过是一种幻觉罢了,一些人被迫从你的版本库创建映像和分"
|
zhaopingsun@1038
|
2932 "支,而你失去了和他们协作的机会。"
|
dongsheng@653
|
2933
|
dongsheng@714
|
2934 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
2935 #: ../en/ch01-intro.xml:329
|
dongsheng@653
|
2936 msgid "Advantages for commercial projects"
|
dongsheng@653
|
2937 msgstr "商业项目的优点"
|
dongsheng@653
|
2938
|
dongsheng@714
|
2939 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
2940 #: ../en/ch01-intro.xml:331
|
dongsheng@653
|
2941 msgid ""
|
dongsheng@653
|
2942 "Many commercial projects are undertaken by teams that are scattered across "
|
dongsheng@653
|
2943 "the globe. Contributors who are far from a central server will see slower "
|
dongsheng@653
|
2944 "command execution and perhaps less reliability. Commercial revision control "
|
dongsheng@653
|
2945 "systems attempt to ameliorate these problems with remote-site replication add-"
|
dongsheng@653
|
2946 "ons that are typically expensive to buy and cantankerous to administer. A "
|
dongsheng@653
|
2947 "distributed system doesn't suffer from these problems in the first place. "
|
dongsheng@653
|
2948 "Better yet, you can easily set up multiple authoritative servers, say one per "
|
dongsheng@653
|
2949 "site, so that there's no redundant communication between repositories over "
|
dongsheng@653
|
2950 "expensive long-haul network links."
|
dongsheng@653
|
2951 msgstr ""
|
zhaopingsun@1038
|
2952 "遍布全球的团队正在进行许多商业项目。远离中央服务器的贡献者会发现执行命令速度很"
|
zhaopingsun@1038
|
2953 "慢同时不怎么可靠。商业的版本控制系统改善这个问题的办法就是让你购买远程复制插"
|
zhaopingsun@1038
|
2954 "件,这通常很昂贵,并且很难管理。分布式系统首先不会有这样的问题。其次,你可以很"
|
zhaopingsun@1038
|
2955 "容易的建立多个授权服务器,假设每个站点一个,这样可以避免在昂贵的长途线路上的冗"
|
zhaopingsun@1038
|
2956 "余的通讯。"
|
dongsheng@653
|
2957
|
dongsheng@714
|
2958 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
2959 #: ../en/ch01-intro.xml:343
|
dongsheng@653
|
2960 msgid ""
|
dongsheng@653
|
2961 "Centralised revision control systems tend to have relatively low "
|
dongsheng@653
|
2962 "scalability. It's not unusual for an expensive centralised system to fall "
|
dongsheng@653
|
2963 "over under the combined load of just a few dozen concurrent users. Once "
|
dongsheng@653
|
2964 "again, the typical response tends to be an expensive and clunky replication "
|
songdongsheng@668
|
2965 "facility. Since the load on a central server&emdash;if you have one at "
|
songdongsheng@668
|
2966 "all&emdash;is many times lower with a distributed tool (because all of the "
|
songdongsheng@668
|
2967 "data is replicated everywhere), a single cheap server can handle the needs of "
|
songdongsheng@668
|
2968 "a much larger team, and replication to balance load becomes a simple matter "
|
songdongsheng@668
|
2969 "of scripting."
|
dongsheng@653
|
2970 msgstr ""
|
zhaopingsun@1038
|
2971 "集中式的版本控制系统的扩展性相对较低。只要不多的并行用户的组合负载就可以将一个"
|
zhaopingsun@1038
|
2972 "昂贵的中央服务器压垮。同样,典型的反应就是昂贵笨重的复制设备。因为中央服务器的"
|
zhaopingsun@1038
|
2973 "最大负载&emdash;如果你有的话&emdash;比分布式工具低很多(因为所有的数据要北复制"
|
zhaopingsun@1038
|
2974 "到其它地方),一个廉价的服务器就可以满足一个相当大的团队的要求,为平衡负载而进"
|
zhaopingsun@1038
|
2975 "行的复制只需要简单的脚本就够了。"
|
dongsheng@653
|
2976
|
dongsheng@714
|
2977 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
2978 #: ../en/ch01-intro.xml:355
|
dongsheng@653
|
2979 msgid ""
|
dongsheng@653
|
2980 "If you have an employee in the field, troubleshooting a problem at a "
|
dongsheng@653
|
2981 "customer's site, they'll benefit from distributed revision control. The tool "
|
dongsheng@653
|
2982 "will let them generate custom builds, try different fixes in isolation from "
|
dongsheng@653
|
2983 "each other, and search efficiently through history for the sources of bugs "
|
dongsheng@653
|
2984 "and regressions in the customer's environment, all without needing to connect "
|
dongsheng@653
|
2985 "to your company's network."
|
dongsheng@653
|
2986 msgstr ""
|
zhaopingsun@1038
|
2987 "如果你有员工需要在客户方解决问题,那么他们会受益于分布式版本控制。工具允许他们"
|
zhaopingsun@1039
|
2988 "创建定制的环境,互相独立的尝试不同的解决方案。并且可以高效的从历史代码中查找"
|
zhaopingsun@1039
|
2989 "bug的根源,在客户环境中进行回归,所有的这些都不需要连接公司的网络。"
|
dongsheng@653
|
2990
|
dongsheng@714
|
2991 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
2992 #: ../en/ch01-intro.xml:366
|
dongsheng@653
|
2993 msgid "Why choose Mercurial?"
|
dongsheng@653
|
2994 msgstr "为什么选择 Mercurial?"
|
dongsheng@653
|
2995
|
dongsheng@714
|
2996 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
2997 #: ../en/ch01-intro.xml:368
|
dongsheng@653
|
2998 msgid ""
|
dongsheng@653
|
2999 "Mercurial has a unique set of properties that make it a particularly good "
|
dongsheng@653
|
3000 "choice as a revision control system."
|
zhaopingsun@1039
|
3001 msgstr "Mercurial是一个非常好的版本控制系统,因为它有很多独一无二的特点。"
|
dongsheng@653
|
3002
|
dongsheng@714
|
3003 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
3004 #: ../en/ch01-intro.xml:371
|
dongsheng@653
|
3005 msgid "It is easy to learn and use."
|
zhaopingsun@1039
|
3006 msgstr "它易学易用。"
|
dongsheng@653
|
3007
|
dongsheng@714
|
3008 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
3009 #: ../en/ch01-intro.xml:372
|
songdongsheng@667
|
3010 msgid "It is lightweight."
|
zhaopingsun@1039
|
3011 msgstr "它轻量级。"
|
dongsheng@653
|
3012
|
dongsheng@714
|
3013 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
3014 #: ../en/ch01-intro.xml:373
|
songdongsheng@667
|
3015 msgid "It scales excellently."
|
zhaopingsun@1039
|
3016 msgstr "它扩展性很好。"
|
songdongsheng@667
|
3017
|
dongsheng@714
|
3018 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
3019 #: ../en/ch01-intro.xml:374
|
dongsheng@653
|
3020 msgid "It is easy to customise."
|
zhaopingsun@1039
|
3021 msgstr "它很容易定制。"
|
dongsheng@653
|
3022
|
dongsheng@714
|
3023 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3024 #: ../en/ch01-intro.xml:377
|
dongsheng@653
|
3025 msgid ""
|
dongsheng@653
|
3026 "If you are at all familiar with revision control systems, you should be able "
|
dongsheng@653
|
3027 "to get up and running with Mercurial in less than five minutes. Even if not, "
|
dongsheng@653
|
3028 "it will take no more than a few minutes longer. Mercurial's command and "
|
dongsheng@653
|
3029 "feature sets are generally uniform and consistent, so you can keep track of a "
|
dongsheng@653
|
3030 "few general rules instead of a host of exceptions."
|
dongsheng@653
|
3031 msgstr ""
|
zhaopingsun@1039
|
3032 "如果你熟悉版本控制系统,你在五分钟之内只能就可以使用Mercurial工作了。即使你不"
|
zhaopingsun@1039
|
3033 "熟悉,也不过是再多花几分钟。Mercurial的命令和功能集非常统一一致,你只要遵守几"
|
zhaopingsun@1039
|
3034 "个通用的规则就够了,很少有例外。"
|
dongsheng@653
|
3035
|
dongsheng@714
|
3036 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3037 #: ../en/ch01-intro.xml:384
|
dongsheng@653
|
3038 msgid ""
|
dongsheng@653
|
3039 "On a small project, you can start working with Mercurial in moments. Creating "
|
dongsheng@653
|
3040 "new changes and branches; transferring changes around (whether locally or "
|
dongsheng@653
|
3041 "over a network); and history and status operations are all fast. Mercurial "
|
dongsheng@653
|
3042 "attempts to stay nimble and largely out of your way by combining low "
|
dongsheng@653
|
3043 "cognitive overhead with blazingly fast operations."
|
dongsheng@653
|
3044 msgstr ""
|
zhaopingsun@1040
|
3045 "在很小的项目上,你马上就可以使用Mercurial开始工作。创建新的修改和分支;到处交"
|
zhaopingsun@1040
|
3046 "换修改(不管本机还是通过网络);获取历史和状态数据非常快。Mercurial努力保持小"
|
zhaopingsun@1040
|
3047 "巧灵活,在眨眼之间就能完成操作。"
|
dongsheng@653
|
3048
|
dongsheng@714
|
3049 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3050 #: ../en/ch01-intro.xml:391
|
dongsheng@653
|
3051 msgid ""
|
dongsheng@653
|
3052 "The usefulness of Mercurial is not limited to small projects: it is used by "
|
dongsheng@653
|
3053 "projects with hundreds to thousands of contributors, each containing tens of "
|
dongsheng@653
|
3054 "thousands of files and hundreds of megabytes of source code."
|
dongsheng@653
|
3055 msgstr ""
|
zhaopingsun@1040
|
3056 "不仅小的项目可以使用Mercurial:有成百上千的贡献者的项目也在使用它,这些项目每"
|
zhaopingsun@1040
|
3057 "个都有上万个文件和几百兆的源码。"
|
dongsheng@653
|
3058
|
dongsheng@714
|
3059 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3060 #: ../en/ch01-intro.xml:396
|
dongsheng@653
|
3061 msgid ""
|
dongsheng@653
|
3062 "If the core functionality of Mercurial is not enough for you, it's easy to "
|
dongsheng@653
|
3063 "build on. Mercurial is well suited to scripting tasks, and its clean "
|
dongsheng@653
|
3064 "internals and implementation in Python make it easy to add features in the "
|
dongsheng@653
|
3065 "form of extensions. There are a number of popular and useful extensions "
|
dongsheng@653
|
3066 "already available, ranging from helping to identify bugs to improving "
|
dongsheng@653
|
3067 "performance."
|
dongsheng@653
|
3068 msgstr ""
|
zhaopingsun@1040
|
3069 "如果觉得Mercurial的核心功能不能满足要求,你很容易在现有基础上开发。Mercurial非"
|
zhaopingsun@1040
|
3070 "常适合于脚本任务,它的核心简洁,并且用Python实现,用扩展的方式增加新的功能非常"
|
zhaopingsun@1040
|
3071 "方便,现在已经有很多流行和有用的扩展了,像帮助你确定bug或者提高性能等。"
|
dongsheng@653
|
3072
|
dongsheng@714
|
3073 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
3074 #: ../en/ch01-intro.xml:406
|
dongsheng@653
|
3075 msgid "Mercurial compared with other tools"
|
dongsheng@653
|
3076 msgstr "Mercurial 与其它工具的比较"
|
dongsheng@653
|
3077
|
dongsheng@714
|
3078 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3079 #: ../en/ch01-intro.xml:408
|
dongsheng@653
|
3080 msgid ""
|
dongsheng@653
|
3081 "Before you read on, please understand that this section necessarily reflects "
|
dongsheng@653
|
3082 "my own experiences, interests, and (dare I say it) biases. I have used every "
|
dongsheng@653
|
3083 "one of the revision control tools listed below, in most cases for several "
|
dongsheng@653
|
3084 "years at a time."
|
dongsheng@653
|
3085 msgstr ""
|
dongsheng@653
|
3086
|
dongsheng@714
|
3087 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3088 #: ../en/ch01-intro.xml:418
|
dongsheng@653
|
3089 msgid ""
|
dongsheng@653
|
3090 "Subversion is a popular revision control tool, developed to replace CVS. It "
|
dongsheng@653
|
3091 "has a centralised client/server architecture."
|
dongsheng@653
|
3092 msgstr ""
|
dongsheng@653
|
3093
|
dongsheng@714
|
3094 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3095 #: ../en/ch01-intro.xml:422
|
dongsheng@653
|
3096 msgid ""
|
dongsheng@653
|
3097 "Subversion and Mercurial have similarly named commands for performing the "
|
dongsheng@653
|
3098 "same operations, so if you're familiar with one, it is easy to learn to use "
|
dongsheng@653
|
3099 "the other. Both tools are portable to all popular operating systems."
|
dongsheng@653
|
3100 msgstr ""
|
dongsheng@653
|
3101
|
dongsheng@714
|
3102 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3103 #: ../en/ch01-intro.xml:427
|
dongsheng@653
|
3104 msgid ""
|
dongsheng@653
|
3105 "Prior to version 1.5, Subversion had no useful support for merges. At the "
|
dongsheng@653
|
3106 "time of writing, its merge tracking capability is new, and known to be <ulink "
|
dongsheng@653
|
3107 "url=\"http://svnbook.red-bean.com/nightly/en/svn.branchmerge.advanced."
|
dongsheng@653
|
3108 "html#svn.branchmerge.advanced.finalword\">complicated and buggy</ulink>."
|
dongsheng@653
|
3109 msgstr ""
|
dongsheng@653
|
3110
|
dongsheng@714
|
3111 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3112 #: ../en/ch01-intro.xml:433
|
dongsheng@653
|
3113 msgid ""
|
dongsheng@653
|
3114 "Mercurial has a substantial performance advantage over Subversion on every "
|
dongsheng@653
|
3115 "revision control operation I have benchmarked. I have measured its advantage "
|
dongsheng@653
|
3116 "as ranging from a factor of two to a factor of six when compared with "
|
dongsheng@653
|
3117 "Subversion 1.4.3's <emphasis>ra_local</emphasis> file store, which is the "
|
dongsheng@653
|
3118 "fastest access method available. In more realistic deployments involving a "
|
dongsheng@653
|
3119 "network-based store, Subversion will be at a substantially larger "
|
dongsheng@653
|
3120 "disadvantage. Because many Subversion commands must talk to the server and "
|
dongsheng@653
|
3121 "Subversion does not have useful replication facilities, server capacity and "
|
dongsheng@653
|
3122 "network bandwidth become bottlenecks for modestly large projects."
|
dongsheng@653
|
3123 msgstr ""
|
dongsheng@653
|
3124
|
dongsheng@714
|
3125 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3126 #: ../en/ch01-intro.xml:446
|
dongsheng@653
|
3127 msgid ""
|
dongsheng@653
|
3128 "Additionally, Subversion incurs substantial storage overhead to avoid network "
|
dongsheng@653
|
3129 "transactions for a few common operations, such as finding modified files "
|
dongsheng@653
|
3130 "(<literal>status</literal>) and displaying modifications against the current "
|
dongsheng@653
|
3131 "revision (<literal>diff</literal>). As a result, a Subversion working copy "
|
dongsheng@653
|
3132 "is often the same size as, or larger than, a Mercurial repository and working "
|
dongsheng@653
|
3133 "directory, even though the Mercurial repository contains a complete history "
|
dongsheng@653
|
3134 "of the project."
|
dongsheng@653
|
3135 msgstr ""
|
dongsheng@653
|
3136
|
dongsheng@714
|
3137 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3138 #: ../en/ch01-intro.xml:456
|
dongsheng@653
|
3139 msgid ""
|
dongsheng@653
|
3140 "Subversion is widely supported by third party tools. Mercurial currently "
|
dongsheng@653
|
3141 "lags considerably in this area. This gap is closing, however, and indeed "
|
dongsheng@653
|
3142 "some of Mercurial's GUI tools now outshine their Subversion equivalents. "
|
dongsheng@653
|
3143 "Like Mercurial, Subversion has an excellent user manual."
|
dongsheng@653
|
3144 msgstr ""
|
dongsheng@653
|
3145
|
dongsheng@714
|
3146 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3147 #: ../en/ch01-intro.xml:462
|
dongsheng@653
|
3148 msgid ""
|
dongsheng@653
|
3149 "Because Subversion doesn't store revision history on the client, it is well "
|
dongsheng@653
|
3150 "suited to managing projects that deal with lots of large, opaque binary "
|
dongsheng@653
|
3151 "files. If you check in fifty revisions to an incompressible 10MB file, "
|
dongsheng@653
|
3152 "Subversion's client-side space usage stays constant The space used by any "
|
dongsheng@653
|
3153 "distributed SCM will grow rapidly in proportion to the number of revisions, "
|
dongsheng@653
|
3154 "because the differences between each revision are large."
|
dongsheng@653
|
3155 msgstr ""
|
dongsheng@653
|
3156
|
dongsheng@714
|
3157 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3158 #: ../en/ch01-intro.xml:471
|
dongsheng@653
|
3159 msgid ""
|
dongsheng@653
|
3160 "In addition, it's often difficult or, more usually, impossible to merge "
|
dongsheng@653
|
3161 "different versions of a binary file. Subversion's ability to let a user lock "
|
dongsheng@653
|
3162 "a file, so that they temporarily have the exclusive right to commit changes "
|
dongsheng@653
|
3163 "to it, can be a significant advantage to a project where binary files are "
|
dongsheng@653
|
3164 "widely used."
|
dongsheng@653
|
3165 msgstr ""
|
dongsheng@653
|
3166
|
dongsheng@714
|
3167 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3168 #: ../en/ch01-intro.xml:478
|
dongsheng@653
|
3169 msgid ""
|
dongsheng@653
|
3170 "Mercurial can import revision history from a Subversion repository. It can "
|
dongsheng@653
|
3171 "also export revision history to a Subversion repository. This makes it easy "
|
dongsheng@653
|
3172 "to <quote>test the waters</quote> and use Mercurial and Subversion in "
|
dongsheng@653
|
3173 "parallel before deciding to switch. History conversion is incremental, so "
|
dongsheng@653
|
3174 "you can perform an initial conversion, then small additional conversions "
|
dongsheng@653
|
3175 "afterwards to bring in new changes."
|
dongsheng@653
|
3176 msgstr ""
|
dongsheng@653
|
3177
|
dongsheng@714
|
3178 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
3179 #: ../en/ch01-intro.xml:490 ../en/ch01-intro.xml:629
|
dongsheng@653
|
3180 msgid "Git"
|
songdongsheng@668
|
3181 msgstr "Git"
|
dongsheng@653
|
3182
|
dongsheng@714
|
3183 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3184 #: ../en/ch01-intro.xml:492
|
dongsheng@653
|
3185 msgid ""
|
dongsheng@653
|
3186 "Git is a distributed revision control tool that was developed for managing "
|
dongsheng@653
|
3187 "the Linux kernel source tree. Like Mercurial, its early design was somewhat "
|
dongsheng@653
|
3188 "influenced by Monotone."
|
dongsheng@653
|
3189 msgstr ""
|
dongsheng@653
|
3190
|
dongsheng@714
|
3191 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3192 #: ../en/ch01-intro.xml:497
|
dongsheng@653
|
3193 msgid ""
|
dongsheng@653
|
3194 "Git has a very large command set, with version 1.5.0 providing 139 individual "
|
dongsheng@653
|
3195 "commands. It has something of a reputation for being difficult to learn. "
|
dongsheng@653
|
3196 "Compared to Git, Mercurial has a strong focus on simplicity."
|
dongsheng@653
|
3197 msgstr ""
|
dongsheng@653
|
3198
|
dongsheng@714
|
3199 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3200 #: ../en/ch01-intro.xml:502
|
dongsheng@653
|
3201 msgid ""
|
dongsheng@653
|
3202 "In terms of performance, Git is extremely fast. In several cases, it is "
|
dongsheng@653
|
3203 "faster than Mercurial, at least on Linux, while Mercurial performs better on "
|
dongsheng@653
|
3204 "other operations. However, on Windows, the performance and general level of "
|
dongsheng@653
|
3205 "support that Git provides is, at the time of writing, far behind that of "
|
dongsheng@653
|
3206 "Mercurial."
|
dongsheng@653
|
3207 msgstr ""
|
dongsheng@653
|
3208
|
dongsheng@714
|
3209 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3210 #: ../en/ch01-intro.xml:509
|
dongsheng@653
|
3211 msgid ""
|
dongsheng@653
|
3212 "While a Mercurial repository needs no maintenance, a Git repository requires "
|
dongsheng@653
|
3213 "frequent manual <quote>repacks</quote> of its metadata. Without these, "
|
dongsheng@653
|
3214 "performance degrades, while space usage grows rapidly. A server that "
|
dongsheng@653
|
3215 "contains many Git repositories that are not rigorously and frequently "
|
dongsheng@653
|
3216 "repacked will become heavily disk-bound during backups, and there have been "
|
dongsheng@653
|
3217 "instances of daily backups taking far longer than 24 hours as a result. A "
|
dongsheng@653
|
3218 "freshly packed Git repository is slightly smaller than a Mercurial "
|
dongsheng@653
|
3219 "repository, but an unpacked repository is several orders of magnitude larger."
|
dongsheng@653
|
3220 msgstr ""
|
dongsheng@653
|
3221
|
dongsheng@714
|
3222 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3223 #: ../en/ch01-intro.xml:520
|
dongsheng@653
|
3224 msgid ""
|
dongsheng@653
|
3225 "The core of Git is written in C. Many Git commands are implemented as shell "
|
dongsheng@653
|
3226 "or Perl scripts, and the quality of these scripts varies widely. I have "
|
dongsheng@653
|
3227 "encountered several instances where scripts charged along blindly in the "
|
dongsheng@653
|
3228 "presence of errors that should have been fatal."
|
dongsheng@653
|
3229 msgstr ""
|
dongsheng@653
|
3230
|
dongsheng@714
|
3231 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3232 #: ../en/ch01-intro.xml:526
|
dongsheng@653
|
3233 msgid "Mercurial can import revision history from a Git repository."
|
dongsheng@653
|
3234 msgstr ""
|
dongsheng@653
|
3235
|
dongsheng@714
|
3236 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3237 #: ../en/ch01-intro.xml:534
|
dongsheng@653
|
3238 msgid ""
|
dongsheng@653
|
3239 "CVS is probably the most widely used revision control tool in the world. Due "
|
dongsheng@653
|
3240 "to its age and internal untidiness, it has been only lightly maintained for "
|
dongsheng@653
|
3241 "many years."
|
dongsheng@653
|
3242 msgstr ""
|
dongsheng@653
|
3243
|
dongsheng@714
|
3244 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3245 #: ../en/ch01-intro.xml:538
|
dongsheng@653
|
3246 msgid ""
|
dongsheng@653
|
3247 "It has a centralised client/server architecture. It does not group related "
|
dongsheng@653
|
3248 "file changes into atomic commits, making it easy for people to <quote>break "
|
dongsheng@653
|
3249 "the build</quote>: one person can successfully commit part of a change and "
|
dongsheng@653
|
3250 "then be blocked by the need for a merge, causing other people to see only a "
|
dongsheng@653
|
3251 "portion of the work they intended to do. This also affects how you work with "
|
dongsheng@653
|
3252 "project history. If you want to see all of the modifications someone made as "
|
dongsheng@653
|
3253 "part of a task, you will need to manually inspect the descriptions and "
|
dongsheng@653
|
3254 "timestamps of the changes made to each file involved (if you even know what "
|
dongsheng@653
|
3255 "those files were)."
|
dongsheng@653
|
3256 msgstr ""
|
dongsheng@653
|
3257
|
dongsheng@714
|
3258 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3259 #: ../en/ch01-intro.xml:550
|
dongsheng@653
|
3260 msgid ""
|
dongsheng@653
|
3261 "CVS has a muddled notion of tags and branches that I will not attempt to even "
|
dongsheng@653
|
3262 "describe. It does not support renaming of files or directories well, making "
|
dongsheng@653
|
3263 "it easy to corrupt a repository. It has almost no internal consistency "
|
dongsheng@653
|
3264 "checking capabilities, so it is usually not even possible to tell whether or "
|
dongsheng@653
|
3265 "how a repository is corrupt. I would not recommend CVS for any project, "
|
dongsheng@653
|
3266 "existing or new."
|
dongsheng@653
|
3267 msgstr ""
|
dongsheng@653
|
3268
|
dongsheng@714
|
3269 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3270 #: ../en/ch01-intro.xml:558
|
dongsheng@653
|
3271 msgid ""
|
dongsheng@653
|
3272 "Mercurial can import CVS revision history. However, there are a few caveats "
|
dongsheng@653
|
3273 "that apply; these are true of every other revision control tool's CVS "
|
dongsheng@653
|
3274 "importer, too. Due to CVS's lack of atomic changes and unversioned "
|
dongsheng@653
|
3275 "filesystem hierarchy, it is not possible to reconstruct CVS history "
|
dongsheng@653
|
3276 "completely accurately; some guesswork is involved, and renames will usually "
|
dongsheng@653
|
3277 "not show up. Because a lot of advanced CVS administration has to be done by "
|
dongsheng@653
|
3278 "hand and is hence error-prone, it's common for CVS importers to run into "
|
dongsheng@653
|
3279 "multiple problems with corrupted repositories (completely bogus revision "
|
dongsheng@653
|
3280 "timestamps and files that have remained locked for over a decade are just two "
|
dongsheng@653
|
3281 "of the less interesting problems I can recall from personal experience)."
|
dongsheng@653
|
3282 msgstr ""
|
dongsheng@653
|
3283
|
dongsheng@714
|
3284 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3285 #: ../en/ch01-intro.xml:572
|
dongsheng@653
|
3286 msgid "Mercurial can import revision history from a CVS repository."
|
dongsheng@653
|
3287 msgstr ""
|
dongsheng@653
|
3288
|
dongsheng@714
|
3289 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
3290 #: ../en/ch01-intro.xml:578
|
dongsheng@653
|
3291 msgid "Commercial tools"
|
dongsheng@653
|
3292 msgstr "商业工具"
|
dongsheng@653
|
3293
|
dongsheng@714
|
3294 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3295 #: ../en/ch01-intro.xml:580
|
dongsheng@653
|
3296 msgid ""
|
dongsheng@653
|
3297 "Perforce has a centralised client/server architecture, with no client-side "
|
dongsheng@653
|
3298 "caching of any data. Unlike modern revision control tools, Perforce requires "
|
dongsheng@653
|
3299 "that a user run a command to inform the server about every file they intend "
|
dongsheng@653
|
3300 "to edit."
|
dongsheng@653
|
3301 msgstr ""
|
dongsheng@653
|
3302
|
dongsheng@714
|
3303 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3304 #: ../en/ch01-intro.xml:586
|
dongsheng@653
|
3305 msgid ""
|
dongsheng@653
|
3306 "The performance of Perforce is quite good for small teams, but it falls off "
|
dongsheng@653
|
3307 "rapidly as the number of users grows beyond a few dozen. Modestly large "
|
dongsheng@653
|
3308 "Perforce installations require the deployment of proxies to cope with the "
|
dongsheng@653
|
3309 "load their users generate."
|
dongsheng@653
|
3310 msgstr ""
|
dongsheng@653
|
3311
|
dongsheng@714
|
3312 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
3313 #: ../en/ch01-intro.xml:595
|
dongsheng@653
|
3314 msgid "Choosing a revision control tool"
|
dongsheng@653
|
3315 msgstr "选择版本控制工具"
|
dongsheng@653
|
3316
|
dongsheng@714
|
3317 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3318 #: ../en/ch01-intro.xml:597
|
dongsheng@653
|
3319 msgid ""
|
dongsheng@653
|
3320 "With the exception of CVS, all of the tools listed above have unique "
|
dongsheng@653
|
3321 "strengths that suit them to particular styles of work. There is no single "
|
dongsheng@653
|
3322 "revision control tool that is best in all situations."
|
dongsheng@653
|
3323 msgstr ""
|
dongsheng@653
|
3324
|
dongsheng@714
|
3325 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3326 #: ../en/ch01-intro.xml:602
|
dongsheng@653
|
3327 msgid ""
|
dongsheng@653
|
3328 "As an example, Subversion is a good choice for working with frequently edited "
|
dongsheng@653
|
3329 "binary files, due to its centralised nature and support for file locking."
|
dongsheng@653
|
3330 msgstr ""
|
dongsheng@653
|
3331
|
dongsheng@714
|
3332 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3333 #: ../en/ch01-intro.xml:606
|
dongsheng@653
|
3334 msgid ""
|
dongsheng@653
|
3335 "I personally find Mercurial's properties of simplicity, performance, and good "
|
dongsheng@653
|
3336 "merge support to be a compelling combination that has served me well for "
|
dongsheng@653
|
3337 "several years."
|
dongsheng@653
|
3338 msgstr ""
|
dongsheng@653
|
3339
|
dongsheng@714
|
3340 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
3341 #: ../en/ch01-intro.xml:614
|
dongsheng@653
|
3342 msgid "Switching from another tool to Mercurial"
|
dongsheng@653
|
3343 msgstr "从其它工具切换到 Mercurial"
|
dongsheng@653
|
3344
|
dongsheng@714
|
3345 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3346 #: ../en/ch01-intro.xml:616
|
dongsheng@653
|
3347 msgid ""
|
dongsheng@653
|
3348 "Mercurial is bundled with an extension named <literal role=\"hg-ext"
|
dongsheng@653
|
3349 "\">convert</literal>, which can incrementally import revision history from "
|
dongsheng@653
|
3350 "several other revision control tools. By <quote>incremental</quote>, I mean "
|
dongsheng@653
|
3351 "that you can convert all of a project's history to date in one go, then rerun "
|
dongsheng@653
|
3352 "the conversion later to obtain new changes that happened after the initial "
|
dongsheng@653
|
3353 "conversion."
|
dongsheng@653
|
3354 msgstr ""
|
dongsheng@653
|
3355
|
dongsheng@714
|
3356 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3357 #: ../en/ch01-intro.xml:624
|
dongsheng@653
|
3358 msgid ""
|
dongsheng@653
|
3359 "The revision control tools supported by <literal role=\"hg-ext\">convert</"
|
dongsheng@653
|
3360 "literal> are as follows:"
|
dongsheng@653
|
3361 msgstr "<literal role=\"hg-ext\">convert</literal> 支持的版本控制工具有:"
|
dongsheng@653
|
3362
|
dongsheng@714
|
3363 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3364 #: ../en/ch01-intro.xml:632
|
dongsheng@653
|
3365 msgid ""
|
dongsheng@653
|
3366 "In addition, <literal role=\"hg-ext\">convert</literal> can export changes "
|
dongsheng@653
|
3367 "from Mercurial to Subversion. This makes it possible to try Subversion and "
|
dongsheng@653
|
3368 "Mercurial in parallel before committing to a switchover, without risking the "
|
dongsheng@653
|
3369 "loss of any work."
|
dongsheng@653
|
3370 msgstr ""
|
dongsheng@653
|
3371
|
dongsheng@714
|
3372 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3373 #: ../en/ch01-intro.xml:638
|
dongsheng@653
|
3374 msgid ""
|
dongsheng@653
|
3375 "The <command role=\"hg-ext-convert\">convert</command> command is easy to "
|
dongsheng@653
|
3376 "use. Simply point it at the path or URL of the source repository, optionally "
|
dongsheng@653
|
3377 "give it the name of the destination repository, and it will start working. "
|
dongsheng@653
|
3378 "After the initial conversion, just run the same command again to import new "
|
dongsheng@653
|
3379 "changes."
|
dongsheng@653
|
3380 msgstr ""
|
dongsheng@653
|
3381
|
dongsheng@714
|
3382 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
3383 #: ../en/ch01-intro.xml:647
|
dongsheng@653
|
3384 msgid "A short history of revision control"
|
dongsheng@653
|
3385 msgstr "版本控制简史"
|
dongsheng@653
|
3386
|
dongsheng@714
|
3387 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3388 #: ../en/ch01-intro.xml:649
|
dongsheng@653
|
3389 msgid ""
|
dongsheng@653
|
3390 "The best known of the old-time revision control tools is SCCS (Source Code "
|
dongsheng@653
|
3391 "Control System), which Marc Rochkind wrote at Bell Labs, in the early 1970s. "
|
dongsheng@653
|
3392 "SCCS operated on individual files, and required every person working on a "
|
dongsheng@653
|
3393 "project to have access to a shared workspace on a single system. Only one "
|
dongsheng@653
|
3394 "person could modify a file at any time; arbitration for access to files was "
|
dongsheng@653
|
3395 "via locks. It was common for people to lock files, and later forget to "
|
dongsheng@653
|
3396 "unlock them, preventing anyone else from modifying those files without the "
|
dongsheng@653
|
3397 "help of an administrator."
|
dongsheng@653
|
3398 msgstr ""
|
dongsheng@653
|
3399
|
dongsheng@714
|
3400 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3401 #: ../en/ch01-intro.xml:660
|
dongsheng@653
|
3402 msgid ""
|
dongsheng@653
|
3403 "Walter Tichy developed a free alternative to SCCS in the early 1980s; he "
|
dongsheng@653
|
3404 "called his program RCS (Revision Control System). Like SCCS, RCS required "
|
dongsheng@653
|
3405 "developers to work in a single shared workspace, and to lock files to prevent "
|
dongsheng@653
|
3406 "multiple people from modifying them simultaneously."
|
dongsheng@653
|
3407 msgstr ""
|
dongsheng@653
|
3408
|
dongsheng@714
|
3409 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3410 #: ../en/ch01-intro.xml:666
|
dongsheng@653
|
3411 msgid ""
|
dongsheng@653
|
3412 "Later in the 1980s, Dick Grune used RCS as a building block for a set of "
|
dongsheng@653
|
3413 "shell scripts he initially called cmt, but then renamed to CVS (Concurrent "
|
dongsheng@653
|
3414 "Versions System). The big innovation of CVS was that it let developers work "
|
dongsheng@653
|
3415 "simultaneously and somewhat independently in their own personal workspaces. "
|
dongsheng@653
|
3416 "The personal workspaces prevented developers from stepping on each other's "
|
dongsheng@653
|
3417 "toes all the time, as was common with SCCS and RCS. Each developer had a copy "
|
dongsheng@653
|
3418 "of every project file, and could modify their copies independently. They had "
|
dongsheng@653
|
3419 "to merge their edits prior to committing changes to the central repository."
|
dongsheng@653
|
3420 msgstr ""
|
dongsheng@653
|
3421
|
dongsheng@714
|
3422 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3423 #: ../en/ch01-intro.xml:677
|
dongsheng@653
|
3424 msgid ""
|
dongsheng@653
|
3425 "Brian Berliner took Grune's original scripts and rewrote them in C, releasing "
|
dongsheng@653
|
3426 "in 1989 the code that has since developed into the modern version of CVS. "
|
dongsheng@653
|
3427 "CVS subsequently acquired the ability to operate over a network connection, "
|
dongsheng@653
|
3428 "giving it a client/server architecture. CVS's architecture is centralised; "
|
dongsheng@653
|
3429 "only the server has a copy of the history of the project. Client workspaces "
|
dongsheng@653
|
3430 "just contain copies of recent versions of the project's files, and a little "
|
dongsheng@653
|
3431 "metadata to tell them where the server is. CVS has been enormously "
|
dongsheng@653
|
3432 "successful; it is probably the world's most widely used revision control "
|
dongsheng@653
|
3433 "system."
|
dongsheng@653
|
3434 msgstr ""
|
dongsheng@653
|
3435
|
dongsheng@714
|
3436 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3437 #: ../en/ch01-intro.xml:688
|
dongsheng@653
|
3438 msgid ""
|
dongsheng@653
|
3439 "In the early 1990s, Sun Microsystems developed an early distributed revision "
|
dongsheng@653
|
3440 "control system, called TeamWare. A TeamWare workspace contains a complete "
|
dongsheng@653
|
3441 "copy of the project's history. TeamWare has no notion of a central "
|
dongsheng@653
|
3442 "repository. (CVS relied upon RCS for its history storage; TeamWare used "
|
dongsheng@653
|
3443 "SCCS.)"
|
dongsheng@653
|
3444 msgstr ""
|
dongsheng@653
|
3445
|
dongsheng@714
|
3446 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3447 #: ../en/ch01-intro.xml:695
|
dongsheng@653
|
3448 msgid ""
|
dongsheng@653
|
3449 "As the 1990s progressed, awareness grew of a number of problems with CVS. It "
|
dongsheng@653
|
3450 "records simultaneous changes to multiple files individually, instead of "
|
dongsheng@653
|
3451 "grouping them together as a single logically atomic operation. It does not "
|
dongsheng@653
|
3452 "manage its file hierarchy well; it is easy to make a mess of a repository by "
|
dongsheng@653
|
3453 "renaming files and directories. Worse, its source code is difficult to read "
|
dongsheng@653
|
3454 "and maintain, which made the <quote>pain level</quote> of fixing these "
|
dongsheng@653
|
3455 "architectural problems prohibitive."
|
dongsheng@653
|
3456 msgstr ""
|
dongsheng@653
|
3457
|
dongsheng@714
|
3458 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3459 #: ../en/ch01-intro.xml:705
|
dongsheng@653
|
3460 msgid ""
|
dongsheng@653
|
3461 "In 2001, Jim Blandy and Karl Fogel, two developers who had worked on CVS, "
|
dongsheng@653
|
3462 "started a project to replace it with a tool that would have a better "
|
dongsheng@653
|
3463 "architecture and cleaner code. The result, Subversion, does not stray from "
|
dongsheng@653
|
3464 "CVS's centralised client/server model, but it adds multi-file atomic commits, "
|
dongsheng@653
|
3465 "better namespace management, and a number of other features that make it a "
|
dongsheng@653
|
3466 "generally better tool than CVS. Since its initial release, it has rapidly "
|
dongsheng@653
|
3467 "grown in popularity."
|
dongsheng@653
|
3468 msgstr ""
|
dongsheng@653
|
3469
|
dongsheng@714
|
3470 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3471 #: ../en/ch01-intro.xml:714
|
dongsheng@653
|
3472 msgid ""
|
dongsheng@653
|
3473 "More or less simultaneously, Graydon Hoare began working on an ambitious "
|
dongsheng@653
|
3474 "distributed revision control system that he named Monotone. While Monotone "
|
dongsheng@653
|
3475 "addresses many of CVS's design flaws and has a peer-to-peer architecture, it "
|
dongsheng@653
|
3476 "goes beyond earlier (and subsequent) revision control tools in a number of "
|
dongsheng@653
|
3477 "innovative ways. It uses cryptographic hashes as identifiers, and has an "
|
dongsheng@653
|
3478 "integral notion of <quote>trust</quote> for code from different sources."
|
dongsheng@653
|
3479 msgstr ""
|
dongsheng@653
|
3480
|
dongsheng@714
|
3481 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3482 #: ../en/ch01-intro.xml:723
|
dongsheng@653
|
3483 msgid ""
|
dongsheng@653
|
3484 "Mercurial began life in 2005. While a few aspects of its design are "
|
dongsheng@653
|
3485 "influenced by Monotone, Mercurial focuses on ease of use, high performance, "
|
dongsheng@653
|
3486 "and scalability to very large projects."
|
dongsheng@653
|
3487 msgstr ""
|
dongsheng@653
|
3488
|
dongsheng@627
|
3489 #. type: Content of: <book><chapter><title>
|
dongsheng@714
|
3490 #: ../en/ch02-tour-basic.xml:5
|
dongsheng@627
|
3491 msgid "A tour of Mercurial: the basics"
|
dongsheng@627
|
3492 msgstr "Mercurial 教程: 基础知识"
|
dongsheng@627
|
3493
|
dongsheng@627
|
3494 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
3495 #: ../en/ch02-tour-basic.xml:8
|
dongsheng@627
|
3496 msgid "Installing Mercurial on your system"
|
dongsheng@627
|
3497 msgstr "安装 Mercurial"
|
dongsheng@627
|
3498
|
dongsheng@627
|
3499 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3500 #: ../en/ch02-tour-basic.xml:10
|
dongsheng@627
|
3501 msgid ""
|
dongsheng@627
|
3502 "Prebuilt binary packages of Mercurial are available for every popular "
|
dongsheng@627
|
3503 "operating system. These make it easy to start using Mercurial on your "
|
dongsheng@627
|
3504 "computer immediately."
|
dongsheng@627
|
3505 msgstr ""
|
dongsheng@644
|
3506 "对于每种流行的操作系统,都有已经构建的二进制软件包。这让在你的计算机上开始使"
|
dongsheng@644
|
3507 "用 Mercurial 变得很容易。"
|
dongsheng@627
|
3508
|
dongsheng@627
|
3509 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
3510 #: ../en/ch02-tour-basic.xml:15
|
songdongsheng@667
|
3511 msgid "Windows"
|
songdongsheng@668
|
3512 msgstr "Windows"
|
songdongsheng@667
|
3513
|
songdongsheng@667
|
3514 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3515 #: ../en/ch02-tour-basic.xml:17
|
songdongsheng@667
|
3516 msgid ""
|
songdongsheng@667
|
3517 "The best version of Mercurial for Windows is TortoiseHg, which can be found "
|
songdongsheng@667
|
3518 "at <ulink url=\"http://bitbucket.org/tortoisehg/stable/wiki/Home\">http://"
|
songdongsheng@667
|
3519 "bitbucket.org/tortoisehg/stable/wiki/Home</ulink>. This package has no "
|
songdongsheng@667
|
3520 "external dependencies; it <quote>just works</quote>. It provides both "
|
songdongsheng@667
|
3521 "command line and graphical user interfaces."
|
songdongsheng@667
|
3522 msgstr ""
|
songdongsheng@711
|
3523 "Windows 中最好的 Mercurial 版本是TortoiseHg,它的主页地址是 <ulink url="
|
songdongsheng@711
|
3524 "\"http://bitbucket.org/tortoisehg/stable/wiki/Home\">http://bitbucket.org/"
|
songdongsheng@711
|
3525 "tortoisehg/stable/wiki/Home</ulink>。这个软件没有外部依赖,它可以<quote>独立工"
|
songdongsheng@711
|
3526 "作</quote>,同时提供了命令行和图形用户界面。"
|
songdongsheng@667
|
3527
|
songdongsheng@667
|
3528 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
3529 #: ../en/ch02-tour-basic.xml:27
|
songdongsheng@667
|
3530 msgid "Mac OS X"
|
songdongsheng@667
|
3531 msgstr "Mac OS X"
|
songdongsheng@667
|
3532
|
songdongsheng@667
|
3533 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3534 #: ../en/ch02-tour-basic.xml:29
|
songdongsheng@667
|
3535 msgid ""
|
songdongsheng@667
|
3536 "Lee Cantey publishes an installer of Mercurial for Mac OS X at <ulink url="
|
songdongsheng@667
|
3537 "\"http://mercurial.berkwood.com\">http://mercurial.berkwood.com</ulink>."
|
songdongsheng@667
|
3538 msgstr ""
|
songdongsheng@711
|
3539 "Lee Cantey 为 Mac OS X 在 <ulink url=\"http://mercurial.berkwood.com"
|
songdongsheng@711
|
3540 "\">http://mercurial.berkwood.com</ulink> 发布了 Mercurial 安装程序。"
|
songdongsheng@667
|
3541
|
songdongsheng@667
|
3542 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
3543 #: ../en/ch02-tour-basic.xml:35
|
dongsheng@627
|
3544 msgid "Linux"
|
dongsheng@644
|
3545 msgstr "Linux"
|
dongsheng@627
|
3546
|
dongsheng@627
|
3547 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3548 #: ../en/ch02-tour-basic.xml:37
|
dongsheng@627
|
3549 msgid ""
|
dongsheng@627
|
3550 "Because each Linux distribution has its own packaging tools, policies, and "
|
dongsheng@627
|
3551 "rate of development, it's difficult to give a comprehensive set of "
|
dongsheng@627
|
3552 "instructions on how to install Mercurial binaries. The version of Mercurial "
|
dongsheng@627
|
3553 "that you will end up with can vary depending on how active the person is who "
|
dongsheng@627
|
3554 "maintains the package for your distribution."
|
dongsheng@627
|
3555 msgstr ""
|
dongsheng@644
|
3556 "由于每种 Linux 发行版都有自己的包管理工具,开发策略和进度,从而很难给出安装 "
|
dongsheng@644
|
3557 "Mercurial 二进制包的全面说明。你安装的 Mercurial 版本,在很大程度上依赖于你所"
|
dongsheng@644
|
3558 "使用的发行版的 Mercurial 维护者的活跃程度。"
|
dongsheng@627
|
3559
|
dongsheng@627
|
3560 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3561 #: ../en/ch02-tour-basic.xml:44
|
dongsheng@627
|
3562 msgid ""
|
dongsheng@627
|
3563 "To keep things simple, I will focus on installing Mercurial from the command "
|
dongsheng@627
|
3564 "line under the most popular Linux distributions. Most of these distributions "
|
dongsheng@627
|
3565 "provide graphical package managers that will let you install Mercurial with a "
|
dongsheng@627
|
3566 "single click; the package name to look for is <literal>mercurial</literal>."
|
dongsheng@627
|
3567 msgstr ""
|
dongsheng@644
|
3568 "为了让事情简单,我会致力于说明在最流行的 Linux 发行版中,从命令行安装 "
|
dongsheng@644
|
3569 "Mercurial 的方法。这些发行版都提供了图形界面的包管理器,让你通过点击鼠标安装 "
|
dongsheng@644
|
3570 "Mercurial;寻找的包名称是 <literal>mercurial</literal>。"
|
dongsheng@627
|
3571
|
dongsheng@627
|
3572 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
3573 #: ../en/ch02-tour-basic.xml:52
|
songdongsheng@667
|
3574 msgid "Ubuntu and Debian:"
|
songdongsheng@668
|
3575 msgstr "Ubuntu 与 Debian:"
|
dongsheng@627
|
3576
|
dongsheng@627
|
3577 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
3578 #: ../en/ch02-tour-basic.xml:54
|
dongsheng@714
|
3579 msgid "Fedora:"
|
dongsheng@715
|
3580 msgstr "Fedora:"
|
dongsheng@714
|
3581
|
dongsheng@714
|
3582 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
3583 #: ../en/ch02-tour-basic.xml:56
|
dongsheng@714
|
3584 msgid "OpenSUSE:"
|
dongsheng@715
|
3585 msgstr "OpenSUSE:"
|
dongsheng@627
|
3586
|
dongsheng@627
|
3587 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
3588 #: ../en/ch02-tour-basic.xml:58
|
dongsheng@627
|
3589 msgid "Gentoo:"
|
dongsheng@644
|
3590 msgstr "Gentoo:"
|
dongsheng@627
|
3591
|
dongsheng@646
|
3592 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
3593 #: ../en/ch02-tour-basic.xml:64
|
dongsheng@627
|
3594 msgid "Solaris"
|
dongsheng@646
|
3595 msgstr "Solaris"
|
dongsheng@646
|
3596
|
dongsheng@646
|
3597 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3598 #: ../en/ch02-tour-basic.xml:66
|
dongsheng@627
|
3599 msgid ""
|
dongsheng@627
|
3600 "SunFreeWare, at <ulink url=\"http://www.sunfreeware.com\">http://www."
|
songdongsheng@667
|
3601 "sunfreeware.com</ulink>, provides prebuilt packages of Mercurial."
|
dongsheng@627
|
3602 msgstr ""
|
dongsheng@646
|
3603 "位于 <ulink url=\"http://www.sunfreeware.com\">http://www.sunfreeware.com</"
|
songdongsheng@668
|
3604 "ulink> 的 SunFreeWare 提供了 Mercurial 的二进制安装包。"
|
dongsheng@646
|
3605
|
dongsheng@627
|
3606 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
3607 #: ../en/ch02-tour-basic.xml:75
|
dongsheng@627
|
3608 msgid "Getting started"
|
dongsheng@627
|
3609 msgstr "开始"
|
dongsheng@627
|
3610
|
dongsheng@627
|
3611 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3612 #: ../en/ch02-tour-basic.xml:77
|
dongsheng@627
|
3613 msgid ""
|
dongsheng@627
|
3614 "To begin, we'll use the <command role=\"hg-cmd\">hg version</command> command "
|
dongsheng@714
|
3615 "to find out whether Mercurial is installed properly. The actual version "
|
dongsheng@714
|
3616 "information that it prints isn't so important; we simply care whether the "
|
dongsheng@714
|
3617 "command runs and prints anything at all."
|
dongsheng@627
|
3618 msgstr ""
|
songdongsheng@711
|
3619 "首先,我们使用 <command role=\"hg-cmd\">hg version</command> 命令检查 "
|
dongsheng@715
|
3620 "Mercurial 是否已经正确安装。它打印出来的实际版本信息并不重要;我们只关心它是否"
|
dongsheng@715
|
3621 "能够运行,打印出信息。"
|
dongsheng@627
|
3622
|
dongsheng@627
|
3623 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
3624 #: ../en/ch02-tour-basic.xml:86
|
dongsheng@627
|
3625 msgid "Built-in help"
|
dongsheng@627
|
3626 msgstr "内置帮助"
|
dongsheng@627
|
3627
|
dongsheng@627
|
3628 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3629 #: ../en/ch02-tour-basic.xml:88
|
dongsheng@627
|
3630 msgid ""
|
dongsheng@627
|
3631 "Mercurial provides a built-in help system. This is invaluable for those "
|
dongsheng@627
|
3632 "times when you find yourself stuck trying to remember how to run a command. "
|
dongsheng@627
|
3633 "If you are completely stuck, simply run <command role=\"hg-cmd\">hg help</"
|
dongsheng@627
|
3634 "command>; it will print a brief list of commands, along with a description of "
|
dongsheng@627
|
3635 "what each does. If you ask for help on a specific command (as below), it "
|
dongsheng@627
|
3636 "prints more detailed information."
|
dongsheng@627
|
3637 msgstr ""
|
songdongsheng@711
|
3638 "Mercurial 内置了帮助系统。当你不记得如何执行一个命令时,它会给你重要的帮助。如"
|
songdongsheng@711
|
3639 "果你完全没有头绪,那就直接运行 <command role=\"hg-cmd\">hg help</command>;它"
|
songdongsheng@711
|
3640 "会给出命令的简短列表,还描述了每个命令的作用。如果你需要具体命令的帮助(下述),"
|
songdongsheng@711
|
3641 "它会给出更详细的信息。"
|
dongsheng@627
|
3642
|
dongsheng@627
|
3643 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3644 #: ../en/ch02-tour-basic.xml:99
|
dongsheng@627
|
3645 msgid ""
|
dongsheng@627
|
3646 "For a more impressive level of detail (which you won't usually need) run "
|
dongsheng@627
|
3647 "<command role=\"hg-cmd\">hg help <option role=\"hg-opt-global\">-v</option></"
|
dongsheng@627
|
3648 "command>. The <option role=\"hg-opt-global\">-v</option> option is short for "
|
dongsheng@627
|
3649 "<option role=\"hg-opt-global\">--verbose</option>, and tells Mercurial to "
|
dongsheng@627
|
3650 "print more information than it usually would."
|
dongsheng@627
|
3651 msgstr ""
|
songdongsheng@711
|
3652 "要获得更多的详细信息(通常不需要),可以执行 <command role=\"hg-cmd\">hg help "
|
songdongsheng@711
|
3653 "<option role=\"hg-opt-global\">-v</option></command>。选项 <option role=\"hg-"
|
songdongsheng@711
|
3654 "opt-global\">-v</option> 是 <option role=\"hg-opt-global\">--verbose</option> "
|
songdongsheng@711
|
3655 "的短格式,告诉 Mercurial 要打印通常不需要的更多信息。"
|
dongsheng@627
|
3656
|
dongsheng@627
|
3657 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
3658 #: ../en/ch02-tour-basic.xml:110
|
dongsheng@627
|
3659 msgid "Working with a repository"
|
dongsheng@627
|
3660 msgstr "使用版本库"
|
dongsheng@627
|
3661
|
dongsheng@627
|
3662 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3663 #: ../en/ch02-tour-basic.xml:112
|
dongsheng@627
|
3664 msgid ""
|
dongsheng@627
|
3665 "In Mercurial, everything happens inside a <emphasis>repository</emphasis>. "
|
dongsheng@627
|
3666 "The repository for a project contains all of the files that <quote>belong to</"
|
dongsheng@627
|
3667 "quote> that project, along with a historical record of the project's files."
|
dongsheng@627
|
3668 msgstr ""
|
dongsheng@627
|
3669
|
dongsheng@627
|
3670 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3671 #: ../en/ch02-tour-basic.xml:118
|
dongsheng@627
|
3672 msgid ""
|
dongsheng@627
|
3673 "There's nothing particularly magical about a repository; it is simply a "
|
dongsheng@627
|
3674 "directory tree in your filesystem that Mercurial treats as special. You can "
|
dongsheng@627
|
3675 "rename or delete a repository any time you like, using either the command "
|
dongsheng@627
|
3676 "line or your file browser."
|
dongsheng@627
|
3677 msgstr ""
|
dongsheng@627
|
3678
|
dongsheng@627
|
3679 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
3680 #: ../en/ch02-tour-basic.xml:125
|
dongsheng@627
|
3681 msgid "Making a local copy of a repository"
|
dongsheng@627
|
3682 msgstr "创建版本库的工作副本"
|
dongsheng@627
|
3683
|
dongsheng@627
|
3684 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3685 #: ../en/ch02-tour-basic.xml:127
|
dongsheng@627
|
3686 msgid ""
|
dongsheng@627
|
3687 "<emphasis>Copying</emphasis> a repository is just a little bit special. "
|
dongsheng@627
|
3688 "While you could use a normal file copying command to make a copy of a "
|
dongsheng@627
|
3689 "repository, it's best to use a built-in command that Mercurial provides. "
|
dongsheng@627
|
3690 "This command is called <command role=\"hg-cmd\">hg clone</command>, because "
|
songdongsheng@667
|
3691 "it makes an identical copy of an existing repository."
|
songdongsheng@667
|
3692 msgstr ""
|
songdongsheng@667
|
3693
|
songdongsheng@667
|
3694 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3695 #: ../en/ch02-tour-basic.xml:136
|
songdongsheng@667
|
3696 msgid ""
|
songdongsheng@667
|
3697 "One advantage of using <command role=\"hg-cmd\">hg clone</command> is that, "
|
songdongsheng@667
|
3698 "as we can see above, it lets us clone repositories over the network. Another "
|
songdongsheng@667
|
3699 "is that it remembers where we cloned from, which we'll find useful soon when "
|
songdongsheng@667
|
3700 "we want to fetch new changes from another repository."
|
songdongsheng@667
|
3701 msgstr ""
|
songdongsheng@667
|
3702
|
songdongsheng@667
|
3703 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3704 #: ../en/ch02-tour-basic.xml:142
|
dongsheng@627
|
3705 msgid ""
|
dongsheng@627
|
3706 "If our clone succeeded, we should now have a local directory called <filename "
|
dongsheng@627
|
3707 "class=\"directory\">hello</filename>. This directory will contain some files."
|
dongsheng@627
|
3708 msgstr ""
|
dongsheng@627
|
3709
|
dongsheng@627
|
3710 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3711 #: ../en/ch02-tour-basic.xml:148
|
dongsheng@627
|
3712 msgid ""
|
dongsheng@627
|
3713 "These files have the same contents and history in our repository as they do "
|
dongsheng@627
|
3714 "in the repository we cloned."
|
dongsheng@627
|
3715 msgstr ""
|
dongsheng@627
|
3716
|
dongsheng@627
|
3717 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3718 #: ../en/ch02-tour-basic.xml:151
|
dongsheng@627
|
3719 msgid ""
|
dongsheng@627
|
3720 "Every Mercurial repository is complete, self-contained, and independent. It "
|
songdongsheng@667
|
3721 "contains its own private copy of a project's files and history. As we just "
|
songdongsheng@667
|
3722 "mentioned, a cloned repository remembers the location of the repository it "
|
songdongsheng@667
|
3723 "was cloned from, but Mercurial will not communicate with that repository, or "
|
songdongsheng@667
|
3724 "any other, unless you tell it to."
|
songdongsheng@667
|
3725 msgstr ""
|
songdongsheng@667
|
3726
|
songdongsheng@667
|
3727 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3728 #: ../en/ch02-tour-basic.xml:158
|
dongsheng@627
|
3729 msgid ""
|
dongsheng@627
|
3730 "What this means for now is that we're free to experiment with our repository, "
|
dongsheng@627
|
3731 "safe in the knowledge that it's a private <quote>sandbox</quote> that won't "
|
dongsheng@627
|
3732 "affect anyone else."
|
dongsheng@627
|
3733 msgstr ""
|
dongsheng@627
|
3734
|
dongsheng@627
|
3735 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
3736 #: ../en/ch02-tour-basic.xml:164
|
dongsheng@627
|
3737 msgid "What's in a repository?"
|
dongsheng@627
|
3738 msgstr "什么是版本库?"
|
dongsheng@627
|
3739
|
dongsheng@627
|
3740 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3741 #: ../en/ch02-tour-basic.xml:166
|
dongsheng@627
|
3742 msgid ""
|
dongsheng@627
|
3743 "When we take a more detailed look inside a repository, we can see that it "
|
dongsheng@627
|
3744 "contains a directory named <filename class=\"directory\">.hg</filename>. "
|
dongsheng@627
|
3745 "This is where Mercurial keeps all of its metadata for the repository."
|
dongsheng@627
|
3746 msgstr ""
|
dongsheng@627
|
3747
|
dongsheng@627
|
3748 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3749 #: ../en/ch02-tour-basic.xml:173
|
dongsheng@627
|
3750 msgid ""
|
dongsheng@627
|
3751 "The contents of the <filename class=\"directory\">.hg</filename> directory "
|
dongsheng@627
|
3752 "and its subdirectories are private to Mercurial. Every other file and "
|
dongsheng@627
|
3753 "directory in the repository is yours to do with as you please."
|
dongsheng@627
|
3754 msgstr ""
|
dongsheng@627
|
3755
|
dongsheng@627
|
3756 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3757 #: ../en/ch02-tour-basic.xml:179
|
dongsheng@627
|
3758 msgid ""
|
dongsheng@627
|
3759 "To introduce a little terminology, the <filename class=\"directory\">.hg</"
|
dongsheng@627
|
3760 "filename> directory is the <quote>real</quote> repository, and all of the "
|
dongsheng@627
|
3761 "files and directories that coexist with it are said to live in the "
|
dongsheng@627
|
3762 "<emphasis>working directory</emphasis>. An easy way to remember the "
|
dongsheng@627
|
3763 "distinction is that the <emphasis>repository</emphasis> contains the "
|
dongsheng@627
|
3764 "<emphasis>history</emphasis> of your project, while the <emphasis>working "
|
dongsheng@627
|
3765 "directory</emphasis> contains a <emphasis>snapshot</emphasis> of your project "
|
dongsheng@627
|
3766 "at a particular point in history."
|
dongsheng@627
|
3767 msgstr ""
|
dongsheng@627
|
3768
|
dongsheng@627
|
3769 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
3770 #: ../en/ch02-tour-basic.xml:194
|
dongsheng@627
|
3771 msgid "A tour through history"
|
dongsheng@627
|
3772 msgstr "回溯历史"
|
dongsheng@627
|
3773
|
dongsheng@627
|
3774 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3775 #: ../en/ch02-tour-basic.xml:196
|
dongsheng@627
|
3776 msgid ""
|
dongsheng@627
|
3777 "One of the first things we might want to do with a new, unfamiliar repository "
|
dongsheng@627
|
3778 "is understand its history. The <command role=\"hg-cmd\">hg log</command> "
|
songdongsheng@667
|
3779 "command gives us a view of the history of changes in the repository."
|
songdongsheng@667
|
3780 msgstr ""
|
songdongsheng@667
|
3781
|
songdongsheng@667
|
3782 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3783 #: ../en/ch02-tour-basic.xml:203
|
dongsheng@627
|
3784 msgid ""
|
dongsheng@627
|
3785 "By default, this command prints a brief paragraph of output for each change "
|
dongsheng@627
|
3786 "to the project that was recorded. In Mercurial terminology, we call each of "
|
dongsheng@627
|
3787 "these recorded events a <emphasis>changeset</emphasis>, because it can "
|
dongsheng@627
|
3788 "contain a record of changes to several files."
|
dongsheng@627
|
3789 msgstr ""
|
dongsheng@627
|
3790
|
dongsheng@627
|
3791 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3792 #: ../en/ch02-tour-basic.xml:209
|
dongsheng@627
|
3793 msgid ""
|
dongsheng@627
|
3794 "The fields in a record of output from <command role=\"hg-cmd\">hg log</"
|
dongsheng@627
|
3795 "command> are as follows."
|
dongsheng@627
|
3796 msgstr ""
|
dongsheng@627
|
3797
|
dongsheng@627
|
3798 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
3799 #: ../en/ch02-tour-basic.xml:213
|
dongsheng@627
|
3800 msgid ""
|
dongsheng@627
|
3801 "<literal>changeset</literal>: This field has the format of a number, followed "
|
songdongsheng@667
|
3802 "by a colon, followed by a hexadecimal (or <emphasis>hex</emphasis>) string. "
|
songdongsheng@667
|
3803 "These are <emphasis>identifiers</emphasis> for the changeset. The hex string "
|
songdongsheng@667
|
3804 "is a unique identifier: the same hex string will always refer to the same "
|
dongsheng@714
|
3805 "changeset in every copy of this repository. The number is shorter and easier "
|
dongsheng@714
|
3806 "to type than the hex string, but it isn't unique: the same number in two "
|
dongsheng@714
|
3807 "different clones of a repository may identify different changesets."
|
dongsheng@627
|
3808 msgstr ""
|
dongsheng@627
|
3809
|
dongsheng@627
|
3810 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
3811 #: ../en/ch02-tour-basic.xml:224
|
dongsheng@627
|
3812 msgid ""
|
dongsheng@627
|
3813 "<literal>user</literal>: The identity of the person who created the "
|
dongsheng@627
|
3814 "changeset. This is a free-form field, but it most often contains a person's "
|
dongsheng@627
|
3815 "name and email address."
|
dongsheng@627
|
3816 msgstr ""
|
dongsheng@627
|
3817
|
dongsheng@627
|
3818 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
3819 #: ../en/ch02-tour-basic.xml:228
|
dongsheng@627
|
3820 msgid ""
|
dongsheng@627
|
3821 "<literal>date</literal>: The date and time on which the changeset was "
|
dongsheng@627
|
3822 "created, and the timezone in which it was created. (The date and time are "
|
dongsheng@627
|
3823 "local to that timezone; they display what time and date it was for the person "
|
dongsheng@627
|
3824 "who created the changeset.)"
|
dongsheng@627
|
3825 msgstr ""
|
dongsheng@627
|
3826
|
dongsheng@627
|
3827 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
3828 #: ../en/ch02-tour-basic.xml:233
|
dongsheng@627
|
3829 msgid ""
|
dongsheng@627
|
3830 "<literal>summary</literal>: The first line of the text message that the "
|
dongsheng@627
|
3831 "creator of the changeset entered to describe the changeset."
|
dongsheng@627
|
3832 msgstr ""
|
dongsheng@627
|
3833
|
songdongsheng@667
|
3834 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
3835 #: ../en/ch02-tour-basic.xml:237
|
songdongsheng@667
|
3836 msgid ""
|
songdongsheng@667
|
3837 "Some changesets, such as the first in the list above, have a <literal>tag</"
|
songdongsheng@667
|
3838 "literal> field. A tag is another way to identify a changeset, by giving it "
|
songdongsheng@667
|
3839 "an easy-to-remember name. (The tag named <literal>tip</literal> is special: "
|
songdongsheng@667
|
3840 "it always refers to the newest change in a repository.)"
|
songdongsheng@667
|
3841 msgstr ""
|
songdongsheng@667
|
3842
|
songdongsheng@667
|
3843 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3844 #: ../en/ch02-tour-basic.xml:245
|
dongsheng@627
|
3845 msgid ""
|
dongsheng@627
|
3846 "The default output printed by <command role=\"hg-cmd\">hg log</command> is "
|
dongsheng@627
|
3847 "purely a summary; it is missing a lot of detail."
|
dongsheng@627
|
3848 msgstr ""
|
dongsheng@627
|
3849
|
dongsheng@627
|
3850 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
3851 #: ../en/ch02-tour-basic.xml:249
|
dongsheng@627
|
3852 msgid ""
|
songdongsheng@658
|
3853 "<xref linkend=\"fig:tour-basic:history\"/> provides a graphical "
|
songdongsheng@658
|
3854 "representation of the history of the <filename class=\"directory\">hello</"
|
songdongsheng@658
|
3855 "filename> repository, to make it a little easier to see which direction "
|
songdongsheng@658
|
3856 "history is <quote>flowing</quote> in. We'll be returning to this figure "
|
songdongsheng@658
|
3857 "several times in this chapter and the chapter that follows."
|
songdongsheng@658
|
3858 msgstr ""
|
songdongsheng@658
|
3859
|
songdongsheng@658
|
3860 #. type: Content of: <book><chapter><sect1><figure><title>
|
dongsheng@714
|
3861 #: ../en/ch02-tour-basic.xml:258
|
dongsheng@627
|
3862 msgid ""
|
dongsheng@627
|
3863 "Graphical history of the <filename class=\"directory\">hello</filename> "
|
dongsheng@627
|
3864 "repository"
|
dongsheng@660
|
3865 msgstr "版本库 <filename class=\"directory\">hello</filename> 的历史图"
|
dongsheng@627
|
3866
|
songdongsheng@658
|
3867 #. type: Content of: <book><chapter><sect1><figure>
|
dongsheng@714
|
3868 #: ../en/ch02-tour-basic.xml:260 ../en/ch03-tour-merge.xml:61
|
dongsheng@714
|
3869 #: ../en/ch03-tour-merge.xml:207 ../en/ch04-concepts.xml:290
|
songdongsheng@658
|
3870 msgid "<placeholder type=\"mediaobject\" id=\"0\"/>"
|
songdongsheng@658
|
3871 msgstr ""
|
songdongsheng@658
|
3872
|
songdongsheng@658
|
3873 #. type: Content of: <book><chapter><sect1><figure><mediaobject>
|
dongsheng@714
|
3874 #: ../en/ch02-tour-basic.xml:261
|
songdongsheng@658
|
3875 msgid ""
|
songdongsheng@658
|
3876 "<imageobject><imagedata fileref=\"figs/tour-history.png\"/></imageobject>"
|
songdongsheng@658
|
3877 msgstr ""
|
songdongsheng@658
|
3878
|
songdongsheng@658
|
3879 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject><textobject><phrase>
|
dongsheng@714
|
3880 #: ../en/ch02-tour-basic.xml:262 ../en/ch03-tour-merge.xml:63
|
dongsheng@714
|
3881 #: ../en/ch03-tour-merge.xml:95 ../en/ch03-tour-merge.xml:182
|
dongsheng@714
|
3882 #: ../en/ch03-tour-merge.xml:209 ../en/ch03-tour-merge.xml:279
|
dongsheng@714
|
3883 #: ../en/ch04-concepts.xml:59 ../en/ch04-concepts.xml:108
|
dongsheng@714
|
3884 #: ../en/ch04-concepts.xml:198 ../en/ch04-concepts.xml:292
|
dongsheng@714
|
3885 #: ../en/ch04-concepts.xml:347 ../en/ch04-concepts.xml:362
|
dongsheng@714
|
3886 #: ../en/ch04-concepts.xml:403 ../en/ch04-concepts.xml:423
|
dongsheng@714
|
3887 #: ../en/ch04-concepts.xml:469 ../en/ch06-collab.xml:316
|
dongsheng@714
|
3888 #: ../en/ch09-undo.xml:344 ../en/ch09-undo.xml:391 ../en/ch09-undo.xml:464
|
dongsheng@714
|
3889 #: ../en/ch09-undo.xml:502 ../en/ch09-undo.xml:658 ../en/ch09-undo.xml:682
|
dongsheng@714
|
3890 #: ../en/ch09-undo.xml:700 ../en/ch09-undo.xml:714 ../en/ch09-undo.xml:727
|
dongsheng@714
|
3891 #: ../en/ch12-mq.xml:413
|
songdongsheng@658
|
3892 msgid "XXX add text"
|
songdongsheng@658
|
3893 msgstr ""
|
songdongsheng@658
|
3894
|
dongsheng@627
|
3895 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
3896 #: ../en/ch02-tour-basic.xml:267
|
dongsheng@627
|
3897 msgid "Changesets, revisions, and talking to other people"
|
songdongsheng@665
|
3898 msgstr "修改集,版本,与其它用户交互"
|
dongsheng@627
|
3899
|
dongsheng@627
|
3900 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3901 #: ../en/ch02-tour-basic.xml:270
|
dongsheng@627
|
3902 msgid ""
|
dongsheng@627
|
3903 "As English is a notoriously sloppy language, and computer science has a "
|
dongsheng@627
|
3904 "hallowed history of terminological confusion (why use one term when four will "
|
dongsheng@627
|
3905 "do?), revision control has a variety of words and phrases that mean the same "
|
dongsheng@627
|
3906 "thing. If you are talking about Mercurial history with other people, you "
|
dongsheng@627
|
3907 "will find that the word <quote>changeset</quote> is often compressed to "
|
dongsheng@627
|
3908 "<quote>change</quote> or (when written) <quote>cset</quote>, and sometimes a "
|
dongsheng@627
|
3909 "changeset is referred to as a <quote>revision</quote> or a <quote>rev</quote>."
|
dongsheng@627
|
3910 msgstr ""
|
dongsheng@627
|
3911
|
dongsheng@627
|
3912 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3913 #: ../en/ch02-tour-basic.xml:280
|
dongsheng@627
|
3914 msgid ""
|
dongsheng@627
|
3915 "While it doesn't matter what <emphasis>word</emphasis> you use to refer to "
|
dongsheng@627
|
3916 "the concept of <quote>a changeset</quote>, the <emphasis>identifier</"
|
dongsheng@627
|
3917 "emphasis> that you use to refer to <quote>a <emphasis>specific</emphasis> "
|
dongsheng@627
|
3918 "changeset</quote> is of great importance. Recall that the <literal>changeset</"
|
dongsheng@627
|
3919 "literal> field in the output from <command role=\"hg-cmd\">hg log</command> "
|
dongsheng@627
|
3920 "identifies a changeset using both a number and a hexadecimal string."
|
dongsheng@627
|
3921 msgstr ""
|
dongsheng@627
|
3922
|
dongsheng@627
|
3923 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
3924 #: ../en/ch02-tour-basic.xml:289
|
songdongsheng@667
|
3925 msgid ""
|
songdongsheng@667
|
3926 "The revision number is a handy notation that is <emphasis>only valid in that "
|
songdongsheng@667
|
3927 "repository</emphasis>."
|
songdongsheng@658
|
3928 msgstr ""
|
songdongsheng@658
|
3929
|
songdongsheng@658
|
3930 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
3931 #: ../en/ch02-tour-basic.xml:292
|
dongsheng@627
|
3932 msgid ""
|
songdongsheng@667
|
3933 "The hexadecimal string is the <emphasis>permanent, unchanging identifier</"
|
dongsheng@627
|
3934 "emphasis> that will always identify that exact changeset in <emphasis>every</"
|
dongsheng@627
|
3935 "emphasis> copy of the repository."
|
dongsheng@627
|
3936 msgstr ""
|
dongsheng@627
|
3937
|
dongsheng@627
|
3938 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3939 #: ../en/ch02-tour-basic.xml:298
|
dongsheng@627
|
3940 msgid ""
|
dongsheng@627
|
3941 "This distinction is important. If you send someone an email talking about "
|
dongsheng@627
|
3942 "<quote>revision 33</quote>, there's a high likelihood that their revision 33 "
|
dongsheng@627
|
3943 "will <emphasis>not be the same</emphasis> as yours. The reason for this is "
|
dongsheng@627
|
3944 "that a revision number depends on the order in which changes arrived in a "
|
dongsheng@627
|
3945 "repository, and there is no guarantee that the same changes will happen in "
|
songdongsheng@667
|
3946 "the same order in different repositories. Three changes <literal>a,b,c</"
|
songdongsheng@667
|
3947 "literal> can easily appear in one repository as <literal>0,1,2</literal>, "
|
songdongsheng@667
|
3948 "while in another as <literal>0,2,1</literal>."
|
songdongsheng@667
|
3949 msgstr ""
|
songdongsheng@667
|
3950
|
songdongsheng@667
|
3951 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3952 #: ../en/ch02-tour-basic.xml:310
|
dongsheng@627
|
3953 msgid ""
|
dongsheng@627
|
3954 "Mercurial uses revision numbers purely as a convenient shorthand. If you "
|
dongsheng@627
|
3955 "need to discuss a changeset with someone, or make a record of a changeset for "
|
dongsheng@627
|
3956 "some other reason (for example, in a bug report), use the hexadecimal "
|
dongsheng@627
|
3957 "identifier."
|
dongsheng@627
|
3958 msgstr ""
|
dongsheng@627
|
3959
|
dongsheng@627
|
3960 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
3961 #: ../en/ch02-tour-basic.xml:318
|
dongsheng@627
|
3962 msgid "Viewing specific revisions"
|
dongsheng@627
|
3963 msgstr "察看指定版本"
|
dongsheng@627
|
3964
|
dongsheng@627
|
3965 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3966 #: ../en/ch02-tour-basic.xml:320
|
dongsheng@627
|
3967 msgid ""
|
dongsheng@627
|
3968 "To narrow the output of <command role=\"hg-cmd\">hg log</command> down to a "
|
dongsheng@627
|
3969 "single revision, use the <option role=\"hg-opt-log\">-r</option> (or <option "
|
dongsheng@627
|
3970 "role=\"hg-opt-log\">--rev</option>) option. You can use either a revision "
|
songdongsheng@667
|
3971 "number or a hexadecimal identifier, and you can provide as many revisions as "
|
songdongsheng@667
|
3972 "you want."
|
songdongsheng@667
|
3973 msgstr ""
|
songdongsheng@667
|
3974
|
songdongsheng@667
|
3975 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3976 #: ../en/ch02-tour-basic.xml:329
|
dongsheng@627
|
3977 msgid ""
|
dongsheng@627
|
3978 "If you want to see the history of several revisions without having to list "
|
dongsheng@627
|
3979 "each one, you can use <emphasis>range notation</emphasis>; this lets you "
|
dongsheng@627
|
3980 "express the idea <quote>I want all revisions between <literal>abc</literal> "
|
dongsheng@627
|
3981 "and <literal>def</literal>, inclusive</quote>."
|
dongsheng@627
|
3982 msgstr ""
|
dongsheng@627
|
3983
|
dongsheng@627
|
3984 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3985 #: ../en/ch02-tour-basic.xml:337
|
dongsheng@627
|
3986 msgid ""
|
dongsheng@627
|
3987 "Mercurial also honours the order in which you specify revisions, so <command "
|
dongsheng@627
|
3988 "role=\"hg-cmd\">hg log -r 2:4</command> prints 2, 3, and 4. while <command "
|
dongsheng@627
|
3989 "role=\"hg-cmd\">hg log -r 4:2</command> prints 4, 3, and 2."
|
dongsheng@627
|
3990 msgstr ""
|
dongsheng@627
|
3991
|
dongsheng@627
|
3992 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
3993 #: ../en/ch02-tour-basic.xml:344
|
dongsheng@627
|
3994 msgid "More detailed information"
|
dongsheng@627
|
3995 msgstr "更详细的信息"
|
dongsheng@627
|
3996
|
dongsheng@627
|
3997 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
3998 #: ../en/ch02-tour-basic.xml:346
|
dongsheng@627
|
3999 msgid ""
|
dongsheng@627
|
4000 "While the summary information printed by <command role=\"hg-cmd\">hg log</"
|
dongsheng@627
|
4001 "command> is useful if you already know what you're looking for, you may need "
|
dongsheng@627
|
4002 "to see a complete description of the change, or a list of the files changed, "
|
dongsheng@627
|
4003 "if you're trying to decide whether a changeset is the one you're looking for. "
|
dongsheng@627
|
4004 "The <command role=\"hg-cmd\">hg log</command> command's <option role=\"hg-opt-"
|
dongsheng@627
|
4005 "global\">-v</option> (or <option role=\"hg-opt-global\">--verbose</option>) "
|
dongsheng@627
|
4006 "option gives you this extra detail."
|
dongsheng@627
|
4007 msgstr ""
|
dongsheng@627
|
4008
|
dongsheng@627
|
4009 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4010 #: ../en/ch02-tour-basic.xml:358
|
dongsheng@627
|
4011 msgid ""
|
dongsheng@627
|
4012 "If you want to see both the description and content of a change, add the "
|
dongsheng@627
|
4013 "<option role=\"hg-opt-log\">-p</option> (or <option role=\"hg-opt-log\">--"
|
dongsheng@627
|
4014 "patch</option>) option. This displays the content of a change as a "
|
dongsheng@627
|
4015 "<emphasis>unified diff</emphasis> (if you've never seen a unified diff "
|
songdongsheng@658
|
4016 "before, see <xref linkend=\"sec:mq:patch\"/> for an overview)."
|
dongsheng@627
|
4017 msgstr ""
|
dongsheng@627
|
4018
|
songdongsheng@667
|
4019 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4020 #: ../en/ch02-tour-basic.xml:368
|
songdongsheng@667
|
4021 msgid ""
|
songdongsheng@667
|
4022 "The <option role=\"hg-opt-log\">-p</option> option is tremendously useful, so "
|
songdongsheng@667
|
4023 "it's well worth remembering."
|
songdongsheng@667
|
4024 msgstr ""
|
songdongsheng@667
|
4025
|
dongsheng@627
|
4026 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
4027 #: ../en/ch02-tour-basic.xml:375
|
dongsheng@627
|
4028 msgid "All about command options"
|
dongsheng@627
|
4029 msgstr "命令选项"
|
dongsheng@627
|
4030
|
dongsheng@627
|
4031 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4032 #: ../en/ch02-tour-basic.xml:377
|
dongsheng@627
|
4033 msgid ""
|
dongsheng@627
|
4034 "Let's take a brief break from exploring Mercurial commands to discuss a "
|
dongsheng@627
|
4035 "pattern in the way that they work; you may find this useful to keep in mind "
|
dongsheng@627
|
4036 "as we continue our tour."
|
dongsheng@627
|
4037 msgstr ""
|
dongsheng@627
|
4038
|
dongsheng@627
|
4039 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4040 #: ../en/ch02-tour-basic.xml:381
|
dongsheng@627
|
4041 msgid ""
|
dongsheng@627
|
4042 "Mercurial has a consistent and straightforward approach to dealing with the "
|
dongsheng@627
|
4043 "options that you can pass to commands. It follows the conventions for "
|
dongsheng@627
|
4044 "options that are common to modern Linux and Unix systems."
|
dongsheng@627
|
4045 msgstr ""
|
dongsheng@627
|
4046
|
dongsheng@627
|
4047 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
4048 #: ../en/ch02-tour-basic.xml:388
|
dongsheng@627
|
4049 msgid ""
|
dongsheng@627
|
4050 "Every option has a long name. For example, as we've already seen, the "
|
dongsheng@627
|
4051 "<command role=\"hg-cmd\">hg log</command> command accepts a <option role=\"hg-"
|
dongsheng@627
|
4052 "opt-log\">--rev</option> option."
|
dongsheng@627
|
4053 msgstr ""
|
dongsheng@627
|
4054
|
dongsheng@627
|
4055 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
4056 #: ../en/ch02-tour-basic.xml:394
|
dongsheng@627
|
4057 msgid ""
|
dongsheng@627
|
4058 "Most options have short names, too. Instead of <option role=\"hg-opt-log\">--"
|
dongsheng@627
|
4059 "rev</option>, we can use <option role=\"hg-opt-log\">-r</option>. (The "
|
dongsheng@627
|
4060 "reason that some options don't have short names is that the options in "
|
dongsheng@627
|
4061 "question are rarely used.)"
|
dongsheng@627
|
4062 msgstr ""
|
dongsheng@627
|
4063
|
dongsheng@627
|
4064 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
4065 #: ../en/ch02-tour-basic.xml:401
|
songdongsheng@667
|
4066 msgid ""
|
songdongsheng@667
|
4067 "Long options start with two dashes (e.g. <option role=\"hg-opt-log\">--rev</"
|
dongsheng@627
|
4068 "option>), while short options start with one (e.g. <option role=\"hg-opt-log"
|
dongsheng@627
|
4069 "\">-r</option>)."
|
dongsheng@627
|
4070 msgstr ""
|
dongsheng@627
|
4071
|
dongsheng@627
|
4072 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
4073 #: ../en/ch02-tour-basic.xml:407
|
dongsheng@627
|
4074 msgid ""
|
dongsheng@627
|
4075 "Option naming and usage is consistent across commands. For example, every "
|
dongsheng@627
|
4076 "command that lets you specify a changeset ID or revision number accepts both "
|
dongsheng@627
|
4077 "<option role=\"hg-opt-log\">-r</option> and <option role=\"hg-opt-log\">--"
|
dongsheng@627
|
4078 "rev</option> arguments."
|
dongsheng@627
|
4079 msgstr ""
|
dongsheng@627
|
4080
|
songdongsheng@667
|
4081 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
4082 #: ../en/ch02-tour-basic.xml:414
|
songdongsheng@667
|
4083 msgid ""
|
songdongsheng@667
|
4084 "If you are using short options, you can save typing by running them together. "
|
songdongsheng@667
|
4085 "For example, the command <command role=\"hg-cmd\">hg log -v -p -r 2</command> "
|
songdongsheng@667
|
4086 "can be written as <command role=\"hg-cmd\">hg log -vpr2</command>."
|
songdongsheng@667
|
4087 msgstr ""
|
songdongsheng@667
|
4088
|
songdongsheng@667
|
4089 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4090 #: ../en/ch02-tour-basic.xml:421
|
dongsheng@714
|
4091 msgid ""
|
dongsheng@714
|
4092 "In the examples throughout this book, I usually use short options instead of "
|
dongsheng@714
|
4093 "long. This simply reflects my own preference, so don't read anything "
|
dongsheng@714
|
4094 "significant into it."
|
dongsheng@714
|
4095 msgstr ""
|
dongsheng@714
|
4096
|
dongsheng@714
|
4097 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4098 #: ../en/ch02-tour-basic.xml:425
|
dongsheng@627
|
4099 msgid ""
|
dongsheng@627
|
4100 "Most commands that print output of some kind will print more output when "
|
dongsheng@627
|
4101 "passed a <option role=\"hg-opt-global\">-v</option> (or <option role=\"hg-opt-"
|
dongsheng@627
|
4102 "global\">--verbose</option>) option, and less when passed <option role=\"hg-"
|
dongsheng@627
|
4103 "opt-global\">-q</option> (or <option role=\"hg-opt-global\">--quiet</option>)."
|
dongsheng@627
|
4104 msgstr ""
|
dongsheng@627
|
4105
|
songdongsheng@667
|
4106 #. type: Content of: <book><chapter><sect1><note><title>
|
dongsheng@714
|
4107 #: ../en/ch02-tour-basic.xml:432
|
songdongsheng@667
|
4108 msgid "Option naming consistency"
|
songdongsheng@667
|
4109 msgstr ""
|
songdongsheng@667
|
4110
|
songdongsheng@667
|
4111 #. type: Content of: <book><chapter><sect1><note><para>
|
dongsheng@714
|
4112 #: ../en/ch02-tour-basic.xml:434
|
songdongsheng@667
|
4113 msgid ""
|
songdongsheng@667
|
4114 "Almost always, Mercurial commands use consistent option names to refer to the "
|
songdongsheng@667
|
4115 "same concepts. For instance, if a command deals with changesets, you'll "
|
songdongsheng@667
|
4116 "always identify them with <option role=\"hg-opt-log\">--rev</option> or "
|
songdongsheng@667
|
4117 "<option role=\"hg-opt-log\">-r</option>. This consistent use of option names "
|
songdongsheng@667
|
4118 "makes it easier to remember what options a particular command takes."
|
songdongsheng@667
|
4119 msgstr ""
|
songdongsheng@667
|
4120
|
dongsheng@627
|
4121 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
4122 #: ../en/ch02-tour-basic.xml:445
|
dongsheng@627
|
4123 msgid "Making and reviewing changes"
|
dongsheng@627
|
4124 msgstr "创建和复审修改"
|
dongsheng@627
|
4125
|
dongsheng@627
|
4126 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4127 #: ../en/ch02-tour-basic.xml:447
|
dongsheng@627
|
4128 msgid ""
|
dongsheng@627
|
4129 "Now that we have a grasp of viewing history in Mercurial, let's take a look "
|
dongsheng@627
|
4130 "at making some changes and examining them."
|
dongsheng@627
|
4131 msgstr ""
|
dongsheng@627
|
4132
|
dongsheng@627
|
4133 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4134 #: ../en/ch02-tour-basic.xml:451
|
dongsheng@627
|
4135 msgid ""
|
dongsheng@627
|
4136 "The first thing we'll do is isolate our experiment in a repository of its "
|
dongsheng@627
|
4137 "own. We use the <command role=\"hg-cmd\">hg clone</command> command, but we "
|
dongsheng@627
|
4138 "don't need to clone a copy of the remote repository. Since we already have a "
|
dongsheng@627
|
4139 "copy of it locally, we can just clone that instead. This is much faster than "
|
dongsheng@627
|
4140 "cloning over the network, and cloning a local repository uses less disk space "
|
songdongsheng@667
|
4141 "in most cases, too<placeholder type=\"footnote\" id=\"0\"/>."
|
songdongsheng@667
|
4142 msgstr ""
|
songdongsheng@667
|
4143
|
songdongsheng@667
|
4144 #. type: Content of: <book><chapter><sect1><para><footnote><para>
|
dongsheng@714
|
4145 #: ../en/ch02-tour-basic.xml:458
|
songdongsheng@667
|
4146 msgid ""
|
songdongsheng@667
|
4147 "The saving of space arises when source and destination repositories are on "
|
songdongsheng@667
|
4148 "the same filesystem, in which case Mercurial will use hardlinks to do copy-on-"
|
songdongsheng@667
|
4149 "write sharing of its internal metadata. If that explanation meant nothing to "
|
songdongsheng@667
|
4150 "you, don't worry: everything happens transparently and automatically, and you "
|
songdongsheng@667
|
4151 "don't need to understand it."
|
songdongsheng@667
|
4152 msgstr ""
|
songdongsheng@667
|
4153
|
songdongsheng@667
|
4154 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4155 #: ../en/ch02-tour-basic.xml:468
|
dongsheng@627
|
4156 msgid ""
|
dongsheng@627
|
4157 "As an aside, it's often good practice to keep a <quote>pristine</quote> copy "
|
dongsheng@627
|
4158 "of a remote repository around, which you can then make temporary clones of to "
|
dongsheng@627
|
4159 "create sandboxes for each task you want to work on. This lets you work on "
|
dongsheng@627
|
4160 "multiple tasks in parallel, each isolated from the others until it's complete "
|
dongsheng@627
|
4161 "and you're ready to integrate it back. Because local clones are so cheap, "
|
dongsheng@627
|
4162 "there's almost no overhead to cloning and destroying repositories whenever "
|
dongsheng@627
|
4163 "you want."
|
dongsheng@627
|
4164 msgstr ""
|
dongsheng@627
|
4165
|
dongsheng@627
|
4166 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4167 #: ../en/ch02-tour-basic.xml:477
|
dongsheng@627
|
4168 msgid ""
|
dongsheng@627
|
4169 "In our <filename class=\"directory\">my-hello</filename> repository, we have "
|
dongsheng@627
|
4170 "a file <filename>hello.c</filename> that contains the classic <quote>hello, "
|
songdongsheng@667
|
4171 "world</quote> program."
|
songdongsheng@667
|
4172 msgstr ""
|
songdongsheng@667
|
4173
|
songdongsheng@667
|
4174 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4175 #: ../en/ch02-tour-basic.xml:483
|
songdongsheng@667
|
4176 msgid "Let's edit this file so that it prints a second line of output."
|
songdongsheng@667
|
4177 msgstr ""
|
songdongsheng@667
|
4178
|
songdongsheng@667
|
4179 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4180 #: ../en/ch02-tour-basic.xml:488
|
dongsheng@627
|
4181 msgid ""
|
dongsheng@627
|
4182 "Mercurial's <command role=\"hg-cmd\">hg status</command> command will tell us "
|
dongsheng@627
|
4183 "what Mercurial knows about the files in the repository."
|
dongsheng@627
|
4184 msgstr ""
|
dongsheng@627
|
4185
|
dongsheng@627
|
4186 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4187 #: ../en/ch02-tour-basic.xml:494
|
dongsheng@627
|
4188 msgid ""
|
dongsheng@627
|
4189 "The <command role=\"hg-cmd\">hg status</command> command prints no output for "
|
dongsheng@627
|
4190 "some files, but a line starting with <quote><literal>M</literal></quote> for "
|
dongsheng@627
|
4191 "<filename>hello.c</filename>. Unless you tell it to, <command role=\"hg-cmd"
|
dongsheng@627
|
4192 "\">hg status</command> will not print any output for files that have not been "
|
dongsheng@627
|
4193 "modified."
|
dongsheng@627
|
4194 msgstr ""
|
dongsheng@627
|
4195
|
dongsheng@627
|
4196 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4197 #: ../en/ch02-tour-basic.xml:501
|
dongsheng@627
|
4198 msgid ""
|
dongsheng@627
|
4199 "The <quote><literal>M</literal></quote> indicates that Mercurial has noticed "
|
dongsheng@627
|
4200 "that we modified <filename>hello.c</filename>. We didn't need to "
|
dongsheng@627
|
4201 "<emphasis>inform</emphasis> Mercurial that we were going to modify the file "
|
dongsheng@627
|
4202 "before we started, or that we had modified the file after we were done; it "
|
dongsheng@627
|
4203 "was able to figure this out itself."
|
dongsheng@627
|
4204 msgstr ""
|
dongsheng@627
|
4205
|
dongsheng@627
|
4206 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4207 #: ../en/ch02-tour-basic.xml:509
|
songdongsheng@667
|
4208 msgid ""
|
songdongsheng@667
|
4209 "It's somewhat helpful to know that we've modified <filename>hello.c</"
|
dongsheng@627
|
4210 "filename>, but we might prefer to know exactly <emphasis>what</emphasis> "
|
dongsheng@627
|
4211 "changes we've made to it. To do this, we use the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
4212 "diff</command> command."
|
dongsheng@627
|
4213 msgstr ""
|
dongsheng@627
|
4214
|
dongsheng@627
|
4215 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
4216 #: ../en/ch02-tour-basic.xml:518 ../en/ch12-mq.xml:187
|
songdongsheng@667
|
4217 msgid "Understanding patches"
|
songdongsheng@667
|
4218 msgstr "理解补丁"
|
songdongsheng@667
|
4219
|
songdongsheng@667
|
4220 #. type: Content of: <book><chapter><sect1><tip><para>
|
dongsheng@714
|
4221 #: ../en/ch02-tour-basic.xml:520
|
songdongsheng@667
|
4222 msgid ""
|
songdongsheng@667
|
4223 "Remember to take a look at <xref linkend=\"sec:mq:patch\"/> if you don't know "
|
songdongsheng@667
|
4224 "how to read output above."
|
songdongsheng@667
|
4225 msgstr ""
|
songdongsheng@667
|
4226
|
songdongsheng@667
|
4227 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
4228 #: ../en/ch02-tour-basic.xml:526
|
dongsheng@627
|
4229 msgid "Recording changes in a new changeset"
|
dongsheng@627
|
4230 msgstr "在新修改集中记录修改"
|
dongsheng@627
|
4231
|
dongsheng@627
|
4232 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4233 #: ../en/ch02-tour-basic.xml:528
|
dongsheng@627
|
4234 msgid ""
|
dongsheng@627
|
4235 "We can modify files, build and test our changes, and use <command role=\"hg-"
|
dongsheng@627
|
4236 "cmd\">hg status</command> and <command role=\"hg-cmd\">hg diff</command> to "
|
dongsheng@627
|
4237 "review our changes, until we're satisfied with what we've done and arrive at "
|
dongsheng@627
|
4238 "a natural stopping point where we want to record our work in a new changeset."
|
dongsheng@627
|
4239 msgstr ""
|
dongsheng@627
|
4240
|
dongsheng@627
|
4241 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4242 #: ../en/ch02-tour-basic.xml:535
|
dongsheng@627
|
4243 msgid ""
|
dongsheng@627
|
4244 "The <command role=\"hg-cmd\">hg commit</command> command lets us create a new "
|
dongsheng@627
|
4245 "changeset; we'll usually refer to this as <quote>making a commit</quote> or "
|
dongsheng@627
|
4246 "<quote>committing</quote>."
|
dongsheng@627
|
4247 msgstr ""
|
dongsheng@627
|
4248
|
dongsheng@627
|
4249 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
4250 #: ../en/ch02-tour-basic.xml:541
|
dongsheng@627
|
4251 msgid "Setting up a username"
|
dongsheng@627
|
4252 msgstr "配置用户名称"
|
dongsheng@627
|
4253
|
dongsheng@627
|
4254 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4255 #: ../en/ch02-tour-basic.xml:543
|
dongsheng@627
|
4256 msgid ""
|
dongsheng@627
|
4257 "When you try to run <command role=\"hg-cmd\">hg commit</command> for the "
|
dongsheng@627
|
4258 "first time, it is not guaranteed to succeed. Mercurial records your name and "
|
dongsheng@627
|
4259 "address with each change that you commit, so that you and others will later "
|
dongsheng@627
|
4260 "be able to tell who made each change. Mercurial tries to automatically "
|
dongsheng@627
|
4261 "figure out a sensible username to commit the change with. It will attempt "
|
dongsheng@627
|
4262 "each of the following methods, in order:"
|
dongsheng@627
|
4263 msgstr ""
|
dongsheng@627
|
4264
|
dongsheng@627
|
4265 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
4266 #: ../en/ch02-tour-basic.xml:552
|
dongsheng@627
|
4267 msgid ""
|
dongsheng@627
|
4268 "If you specify a <option role=\"hg-opt-commit\">-u</option> option to the "
|
dongsheng@627
|
4269 "<command role=\"hg-cmd\">hg commit</command> command on the command line, "
|
dongsheng@627
|
4270 "followed by a username, this is always given the highest precedence."
|
dongsheng@627
|
4271 msgstr ""
|
dongsheng@627
|
4272
|
dongsheng@627
|
4273 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
4274 #: ../en/ch02-tour-basic.xml:557
|
dongsheng@627
|
4275 msgid ""
|
dongsheng@627
|
4276 "If you have set the <envar>HGUSER</envar> environment variable, this is "
|
dongsheng@627
|
4277 "checked next."
|
dongsheng@627
|
4278 msgstr ""
|
dongsheng@627
|
4279
|
dongsheng@627
|
4280 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
4281 #: ../en/ch02-tour-basic.xml:560
|
dongsheng@627
|
4282 msgid ""
|
dongsheng@627
|
4283 "If you create a file in your home directory called <filename role=\"special"
|
dongsheng@627
|
4284 "\">.hgrc</filename>, with a <envar role=\"rc-item-ui\">username</envar> "
|
dongsheng@627
|
4285 "entry, that will be used next. To see what the contents of this file should "
|
songdongsheng@658
|
4286 "look like, refer to <xref linkend=\"sec:tour-basic:username\"/> below."
|
dongsheng@627
|
4287 msgstr ""
|
dongsheng@627
|
4288
|
dongsheng@627
|
4289 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
4290 #: ../en/ch02-tour-basic.xml:568
|
dongsheng@627
|
4291 msgid ""
|
dongsheng@627
|
4292 "If you have set the <envar>EMAIL</envar> environment variable, this will be "
|
dongsheng@627
|
4293 "used next."
|
dongsheng@627
|
4294 msgstr ""
|
dongsheng@627
|
4295
|
dongsheng@627
|
4296 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
4297 #: ../en/ch02-tour-basic.xml:571
|
dongsheng@627
|
4298 msgid ""
|
dongsheng@627
|
4299 "Mercurial will query your system to find out your local user name and host "
|
dongsheng@627
|
4300 "name, and construct a username from these components. Since this often "
|
dongsheng@627
|
4301 "results in a username that is not very useful, it will print a warning if it "
|
dongsheng@627
|
4302 "has to do this."
|
dongsheng@627
|
4303 msgstr ""
|
dongsheng@627
|
4304
|
dongsheng@627
|
4305 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4306 #: ../en/ch02-tour-basic.xml:578
|
dongsheng@627
|
4307 msgid ""
|
dongsheng@627
|
4308 "If all of these mechanisms fail, Mercurial will fail, printing an error "
|
dongsheng@627
|
4309 "message. In this case, it will not let you commit until you set up a "
|
dongsheng@627
|
4310 "username."
|
dongsheng@627
|
4311 msgstr ""
|
dongsheng@627
|
4312
|
dongsheng@627
|
4313 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4314 #: ../en/ch02-tour-basic.xml:582
|
dongsheng@627
|
4315 msgid ""
|
dongsheng@627
|
4316 "You should think of the <envar>HGUSER</envar> environment variable and the "
|
dongsheng@627
|
4317 "<option role=\"hg-opt-commit\">-u</option> option to the <command role=\"hg-"
|
dongsheng@627
|
4318 "cmd\">hg commit</command> command as ways to <emphasis>override</emphasis> "
|
dongsheng@627
|
4319 "Mercurial's default selection of username. For normal use, the simplest and "
|
dongsheng@627
|
4320 "most robust way to set a username for yourself is by creating a <filename "
|
dongsheng@627
|
4321 "role=\"special\">.hgrc</filename> file; see below for details."
|
dongsheng@627
|
4322 msgstr ""
|
dongsheng@627
|
4323
|
dongsheng@627
|
4324 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
4325 #: ../en/ch02-tour-basic.xml:591
|
dongsheng@627
|
4326 msgid "Creating a Mercurial configuration file"
|
dongsheng@627
|
4327 msgstr "创建 Mercurial 的配置文件"
|
dongsheng@627
|
4328
|
dongsheng@627
|
4329 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
4330 #: ../en/ch02-tour-basic.xml:593
|
dongsheng@627
|
4331 msgid ""
|
songdongsheng@710
|
4332 "To set a user name, use your favorite editor to create a file called "
|
dongsheng@627
|
4333 "<filename role=\"special\">.hgrc</filename> in your home directory. "
|
dongsheng@627
|
4334 "Mercurial will use this file to look up your personalised configuration "
|
dongsheng@627
|
4335 "settings. The initial contents of your <filename role=\"special\">.hgrc</"
|
dongsheng@627
|
4336 "filename> should look like this."
|
dongsheng@627
|
4337 msgstr ""
|
dongsheng@627
|
4338
|
dongsheng@714
|
4339 #. type: Content of: <book><chapter><sect1><sect2><sect3><tip><title>
|
dongsheng@714
|
4340 #: ../en/ch02-tour-basic.xml:602
|
dongsheng@714
|
4341 msgid "<quote>Home directory</quote> on Windows"
|
dongsheng@714
|
4342 msgstr ""
|
dongsheng@714
|
4343
|
dongsheng@714
|
4344 #. type: Content of: <book><chapter><sect1><sect2><sect3><tip><para>
|
dongsheng@714
|
4345 #: ../en/ch02-tour-basic.xml:604
|
dongsheng@714
|
4346 msgid ""
|
dongsheng@714
|
4347 "When we refer to your home directory, on an English language installation of "
|
dongsheng@714
|
4348 "Windows this will usually be a folder named after your user name in "
|
dongsheng@714
|
4349 "<filename>C:\\Documents and Settings</filename>. You can find out the exact "
|
dongsheng@714
|
4350 "name of your home directory by opening a command prompt window and running "
|
dongsheng@714
|
4351 "the following command."
|
dongsheng@714
|
4352 msgstr ""
|
dongsheng@714
|
4353
|
dongsheng@714
|
4354 #. type: Content of: <book><chapter><sect1><sect2><sect3><tip><screen><prompt>
|
dongsheng@714
|
4355 #: ../en/ch02-tour-basic.xml:612
|
dongsheng@714
|
4356 msgid "C:\\>"
|
dongsheng@715
|
4357 msgstr "C:\\>"
|
dongsheng@714
|
4358
|
dongsheng@714
|
4359 #. type: Content of: <book><chapter><sect1><sect2><sect3><tip><screen><userinput>
|
dongsheng@714
|
4360 #: ../en/ch02-tour-basic.xml:612
|
dongsheng@714
|
4361 msgid "echo %UserProfile%"
|
dongsheng@715
|
4362 msgstr "echo %UserProfile%"
|
songdongsheng@667
|
4363
|
dongsheng@627
|
4364 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
4365 #: ../en/ch02-tour-basic.xml:619
|
dongsheng@627
|
4366 msgid ""
|
dongsheng@627
|
4367 "The <quote><literal>[ui]</literal></quote> line begins a <emphasis>section</"
|
dongsheng@627
|
4368 "emphasis> of the config file, so you can read the <quote><literal>username "
|
dongsheng@627
|
4369 "= ...</literal></quote> line as meaning <quote>set the value of the "
|
dongsheng@627
|
4370 "<literal>username</literal> item in the <literal>ui</literal> section</"
|
dongsheng@627
|
4371 "quote>. A section continues until a new section begins, or the end of the "
|
dongsheng@627
|
4372 "file. Mercurial ignores empty lines and treats any text from "
|
dongsheng@627
|
4373 "<quote><literal>#</literal></quote> to the end of a line as a comment."
|
dongsheng@627
|
4374 msgstr ""
|
dongsheng@627
|
4375
|
dongsheng@627
|
4376 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
4377 #: ../en/ch02-tour-basic.xml:632
|
dongsheng@627
|
4378 msgid "Choosing a user name"
|
dongsheng@627
|
4379 msgstr "选择用户名称"
|
dongsheng@627
|
4380
|
dongsheng@627
|
4381 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
4382 #: ../en/ch02-tour-basic.xml:634
|
dongsheng@627
|
4383 msgid ""
|
dongsheng@627
|
4384 "You can use any text you like as the value of the <literal>username</literal> "
|
songdongsheng@667
|
4385 "config item, since this information is for reading by other people, but will "
|
songdongsheng@667
|
4386 "not be interpreted by Mercurial. The convention that most people follow is "
|
songdongsheng@667
|
4387 "to use their name and email address, as in the example above."
|
dongsheng@627
|
4388 msgstr ""
|
dongsheng@627
|
4389
|
dongsheng@627
|
4390 #. type: Content of: <book><chapter><sect1><sect2><sect3><note><para>
|
dongsheng@714
|
4391 #: ../en/ch02-tour-basic.xml:641
|
dongsheng@627
|
4392 msgid ""
|
dongsheng@627
|
4393 "Mercurial's built-in web server obfuscates email addresses, to make it more "
|
dongsheng@627
|
4394 "difficult for the email harvesting tools that spammers use. This reduces the "
|
dongsheng@627
|
4395 "likelihood that you'll start receiving more junk email if you publish a "
|
dongsheng@627
|
4396 "Mercurial repository on the web."
|
dongsheng@627
|
4397 msgstr ""
|
dongsheng@627
|
4398
|
dongsheng@627
|
4399 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
4400 #: ../en/ch02-tour-basic.xml:650
|
dongsheng@627
|
4401 msgid "Writing a commit message"
|
dongsheng@627
|
4402 msgstr "写提交日志"
|
dongsheng@627
|
4403
|
dongsheng@627
|
4404 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4405 #: ../en/ch02-tour-basic.xml:652
|
dongsheng@627
|
4406 msgid ""
|
dongsheng@627
|
4407 "When we commit a change, Mercurial drops us into a text editor, to enter a "
|
dongsheng@627
|
4408 "message that will describe the modifications we've made in this changeset. "
|
dongsheng@627
|
4409 "This is called the <emphasis>commit message</emphasis>. It will be a record "
|
dongsheng@627
|
4410 "for readers of what we did and why, and it will be printed by <command role="
|
dongsheng@627
|
4411 "\"hg-cmd\">hg log</command> after we've finished committing."
|
dongsheng@627
|
4412 msgstr ""
|
dongsheng@627
|
4413
|
dongsheng@627
|
4414 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4415 #: ../en/ch02-tour-basic.xml:662
|
dongsheng@627
|
4416 msgid ""
|
dongsheng@627
|
4417 "The editor that the <command role=\"hg-cmd\">hg commit</command> command "
|
songdongsheng@667
|
4418 "drops us into will contain an empty line or two, followed by a number of "
|
songdongsheng@667
|
4419 "lines starting with <quote><literal>HG:</literal></quote>."
|
songdongsheng@667
|
4420 msgstr ""
|
songdongsheng@667
|
4421
|
songdongsheng@667
|
4422 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4423 #: ../en/ch02-tour-basic.xml:676
|
dongsheng@627
|
4424 msgid ""
|
dongsheng@627
|
4425 "Mercurial ignores the lines that start with <quote><literal>HG:</literal></"
|
dongsheng@627
|
4426 "quote>; it uses them only to tell us which files it's recording changes to. "
|
dongsheng@627
|
4427 "Modifying or deleting these lines has no effect."
|
dongsheng@627
|
4428 msgstr ""
|
dongsheng@627
|
4429
|
dongsheng@627
|
4430 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
4431 #: ../en/ch02-tour-basic.xml:682
|
dongsheng@627
|
4432 msgid "Writing a good commit message"
|
dongsheng@627
|
4433 msgstr "写好提交日志"
|
dongsheng@627
|
4434
|
dongsheng@627
|
4435 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4436 #: ../en/ch02-tour-basic.xml:684
|
dongsheng@627
|
4437 msgid ""
|
dongsheng@627
|
4438 "Since <command role=\"hg-cmd\">hg log</command> only prints the first line of "
|
dongsheng@627
|
4439 "a commit message by default, it's best to write a commit message whose first "
|
dongsheng@627
|
4440 "line stands alone. Here's a real example of a commit message that "
|
dongsheng@627
|
4441 "<emphasis>doesn't</emphasis> follow this guideline, and hence has a summary "
|
dongsheng@627
|
4442 "that is not readable."
|
dongsheng@627
|
4443 msgstr ""
|
dongsheng@627
|
4444
|
dongsheng@627
|
4445 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4446 #: ../en/ch02-tour-basic.xml:697
|
dongsheng@627
|
4447 msgid ""
|
dongsheng@627
|
4448 "As far as the remainder of the contents of the commit message are concerned, "
|
dongsheng@627
|
4449 "there are no hard-and-fast rules. Mercurial itself doesn't interpret or care "
|
dongsheng@627
|
4450 "about the contents of the commit message, though your project may have "
|
dongsheng@627
|
4451 "policies that dictate a certain kind of formatting."
|
dongsheng@627
|
4452 msgstr ""
|
dongsheng@627
|
4453
|
dongsheng@627
|
4454 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4455 #: ../en/ch02-tour-basic.xml:702
|
dongsheng@627
|
4456 msgid ""
|
dongsheng@627
|
4457 "My personal preference is for short, but informative, commit messages that "
|
dongsheng@627
|
4458 "tell me something that I can't figure out with a quick glance at the output "
|
dongsheng@627
|
4459 "of <command role=\"hg-cmd\">hg log --patch</command>."
|
dongsheng@627
|
4460 msgstr ""
|
dongsheng@627
|
4461
|
dongsheng@714
|
4462 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4463 #: ../en/ch02-tour-basic.xml:706
|
dongsheng@714
|
4464 msgid ""
|
dongsheng@714
|
4465 "If we run the <command role=\"hg-cmd\">hg commit</command> command without "
|
dongsheng@714
|
4466 "any arguments, it records all of the changes we've made, as reported by "
|
dongsheng@714
|
4467 "<command role=\"hg-cmd\">hg status</command> and <command role=\"hg-cmd\">hg "
|
dongsheng@714
|
4468 "diff</command>."
|
dongsheng@714
|
4469 msgstr ""
|
dongsheng@714
|
4470
|
dongsheng@714
|
4471 #. type: Content of: <book><chapter><sect1><sect2><note><title>
|
dongsheng@714
|
4472 #: ../en/ch02-tour-basic.xml:713
|
dongsheng@714
|
4473 msgid "A surprise for Subversion users"
|
dongsheng@714
|
4474 msgstr ""
|
dongsheng@714
|
4475
|
dongsheng@714
|
4476 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@714
|
4477 #: ../en/ch02-tour-basic.xml:715
|
dongsheng@714
|
4478 msgid ""
|
dongsheng@714
|
4479 "Like other Mercurial commands, if we don't supply explicit names to commit to "
|
dongsheng@714
|
4480 "the <command role=\"hg-cmd\">hg commit</command>, it will operate across a "
|
dongsheng@714
|
4481 "repository's entire working directory. Be wary of this if you're coming from "
|
dongsheng@714
|
4482 "the Subversion or CVS world, since you might expect it to operate only on the "
|
dongsheng@714
|
4483 "current directory that you happen to be visiting and its subdirectories."
|
dongsheng@714
|
4484 msgstr ""
|
dongsheng@714
|
4485
|
dongsheng@627
|
4486 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
4487 #: ../en/ch02-tour-basic.xml:726
|
dongsheng@627
|
4488 msgid "Aborting a commit"
|
dongsheng@627
|
4489 msgstr "终止提交"
|
dongsheng@627
|
4490
|
dongsheng@627
|
4491 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4492 #: ../en/ch02-tour-basic.xml:728
|
dongsheng@627
|
4493 msgid ""
|
dongsheng@627
|
4494 "If you decide that you don't want to commit while in the middle of editing a "
|
dongsheng@627
|
4495 "commit message, simply exit from your editor without saving the file that "
|
dongsheng@627
|
4496 "it's editing. This will cause nothing to happen to either the repository or "
|
dongsheng@627
|
4497 "the working directory."
|
dongsheng@627
|
4498 msgstr ""
|
dongsheng@627
|
4499
|
dongsheng@627
|
4500 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
4501 #: ../en/ch02-tour-basic.xml:736
|
dongsheng@627
|
4502 msgid "Admiring our new handiwork"
|
songdongsheng@665
|
4503 msgstr "欣赏我们的成果"
|
dongsheng@627
|
4504
|
dongsheng@627
|
4505 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4506 #: ../en/ch02-tour-basic.xml:738
|
dongsheng@627
|
4507 msgid ""
|
dongsheng@627
|
4508 "Once we've finished the commit, we can use the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
4509 "tip</command> command to display the changeset we just created. This command "
|
dongsheng@627
|
4510 "produces output that is identical to <command role=\"hg-cmd\">hg log</"
|
dongsheng@627
|
4511 "command>, but it only displays the newest revision in the repository."
|
dongsheng@627
|
4512 msgstr ""
|
dongsheng@627
|
4513
|
dongsheng@627
|
4514 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4515 #: ../en/ch02-tour-basic.xml:746
|
songdongsheng@667
|
4516 msgid ""
|
songdongsheng@667
|
4517 "We refer to the newest revision in the repository as the <emphasis>tip "
|
songdongsheng@667
|
4518 "revision</emphasis>, or simply the <emphasis>tip</emphasis>."
|
songdongsheng@667
|
4519 msgstr ""
|
songdongsheng@667
|
4520
|
songdongsheng@667
|
4521 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4522 #: ../en/ch02-tour-basic.xml:750
|
songdongsheng@667
|
4523 msgid ""
|
songdongsheng@667
|
4524 "By the way, the <command role=\"hg-cmd\">hg tip</command> command accepts "
|
songdongsheng@667
|
4525 "many of the same options as <command role=\"hg-cmd\">hg log</command>, so "
|
songdongsheng@667
|
4526 "<option role=\"hg-opt-global\">-v</option> above indicates <quote>be verbose</"
|
songdongsheng@667
|
4527 "quote>, <option role=\"hg-opt-tip\">-p</option> specifies <quote>print a "
|
songdongsheng@667
|
4528 "patch</quote>. The use of <option role=\"hg-opt-tip\">-p</option> to print "
|
songdongsheng@667
|
4529 "patches is another example of the consistent naming we mentioned earlier."
|
dongsheng@627
|
4530 msgstr ""
|
dongsheng@627
|
4531
|
dongsheng@627
|
4532 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
4533 #: ../en/ch02-tour-basic.xml:762
|
dongsheng@627
|
4534 msgid "Sharing changes"
|
dongsheng@627
|
4535 msgstr "共享修改"
|
dongsheng@627
|
4536
|
dongsheng@627
|
4537 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4538 #: ../en/ch02-tour-basic.xml:764
|
dongsheng@627
|
4539 msgid ""
|
dongsheng@627
|
4540 "We mentioned earlier that repositories in Mercurial are self-contained. This "
|
dongsheng@627
|
4541 "means that the changeset we just created exists only in our <filename class="
|
dongsheng@627
|
4542 "\"directory\">my-hello</filename> repository. Let's look at a few ways that "
|
dongsheng@627
|
4543 "we can propagate this change into other repositories."
|
dongsheng@627
|
4544 msgstr ""
|
dongsheng@627
|
4545
|
dongsheng@627
|
4546 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
4547 #: ../en/ch02-tour-basic.xml:772
|
dongsheng@627
|
4548 msgid "Pulling changes from another repository"
|
dongsheng@627
|
4549 msgstr "从其它版本库取得修改"
|
dongsheng@627
|
4550
|
dongsheng@627
|
4551 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4552 #: ../en/ch02-tour-basic.xml:774
|
dongsheng@627
|
4553 msgid ""
|
dongsheng@627
|
4554 "To get started, let's clone our original <filename class=\"directory\">hello</"
|
dongsheng@627
|
4555 "filename> repository, which does not contain the change we just committed. "
|
dongsheng@627
|
4556 "We'll call our temporary repository <filename class=\"directory\">hello-pull</"
|
dongsheng@627
|
4557 "filename>."
|
dongsheng@627
|
4558 msgstr ""
|
dongsheng@627
|
4559
|
dongsheng@627
|
4560 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4561 #: ../en/ch02-tour-basic.xml:782
|
dongsheng@627
|
4562 msgid ""
|
dongsheng@627
|
4563 "We'll use the <command role=\"hg-cmd\">hg pull</command> command to bring "
|
dongsheng@627
|
4564 "changes from <filename class=\"directory\">my-hello</filename> into <filename "
|
dongsheng@627
|
4565 "class=\"directory\">hello-pull</filename>. However, blindly pulling unknown "
|
dongsheng@627
|
4566 "changes into a repository is a somewhat scary prospect. Mercurial provides "
|
dongsheng@627
|
4567 "the <command role=\"hg-cmd\">hg incoming</command> command to tell us what "
|
dongsheng@627
|
4568 "changes the <command role=\"hg-cmd\">hg pull</command> command "
|
dongsheng@627
|
4569 "<emphasis>would</emphasis> pull into the repository, without actually pulling "
|
dongsheng@627
|
4570 "the changes in."
|
dongsheng@627
|
4571 msgstr ""
|
dongsheng@627
|
4572
|
dongsheng@627
|
4573 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4574 #: ../en/ch02-tour-basic.xml:795
|
dongsheng@714
|
4575 msgid ""
|
dongsheng@714
|
4576 "Bringing changes into a repository is a simple matter of running the <command "
|
dongsheng@714
|
4577 "role=\"hg-cmd\">hg pull</command> command, and optionally telling it which "
|
dongsheng@714
|
4578 "repository to pull from."
|
dongsheng@714
|
4579 msgstr ""
|
dongsheng@714
|
4580
|
dongsheng@714
|
4581 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4582 #: ../en/ch02-tour-basic.xml:801
|
dongsheng@714
|
4583 msgid ""
|
dongsheng@714
|
4584 "As you can see from the before-and-after output of <command role=\"hg-cmd"
|
dongsheng@714
|
4585 "\">hg tip</command>, we have successfully pulled changes into our "
|
dongsheng@714
|
4586 "repository. However, Mercurial separates pulling changes in from updating "
|
dongsheng@714
|
4587 "the working directory. There remains one step before we will see the changes "
|
dongsheng@714
|
4588 "that we just pulled appear in the working directory."
|
dongsheng@714
|
4589 msgstr ""
|
dongsheng@714
|
4590
|
dongsheng@714
|
4591 #. type: Content of: <book><chapter><sect1><sect2><tip><title>
|
dongsheng@714
|
4592 #: ../en/ch02-tour-basic.xml:810
|
dongsheng@714
|
4593 msgid "Pulling specific changes"
|
dongsheng@715
|
4594 msgstr "提取指定的修改"
|
dongsheng@714
|
4595
|
dongsheng@714
|
4596 #. type: Content of: <book><chapter><sect1><sect2><tip><para>
|
dongsheng@714
|
4597 #: ../en/ch02-tour-basic.xml:812
|
dongsheng@714
|
4598 msgid ""
|
dongsheng@714
|
4599 "It is possible that due to the delay between running <command role=\"hg-cmd"
|
dongsheng@714
|
4600 "\">hg incoming</command> and <command role=\"hg-cmd\">hg pull</command>, you "
|
dongsheng@714
|
4601 "may not see all changesets that will be brought from the other repository. "
|
songdongsheng@667
|
4602 "Suppose you're pulling changes from a repository on the network somewhere. "
|
songdongsheng@667
|
4603 "While you are looking at the <command role=\"hg-cmd\">hg incoming</command> "
|
songdongsheng@667
|
4604 "output, and before you pull those changes, someone might have committed "
|
songdongsheng@667
|
4605 "something in the remote repository. This means that it's possible to pull "
|
songdongsheng@667
|
4606 "more changes than you saw when using <command role=\"hg-cmd\">hg incoming</"
|
songdongsheng@667
|
4607 "command>."
|
songdongsheng@667
|
4608 msgstr ""
|
songdongsheng@667
|
4609
|
dongsheng@714
|
4610 #. type: Content of: <book><chapter><sect1><sect2><tip><para>
|
dongsheng@714
|
4611 #: ../en/ch02-tour-basic.xml:824
|
dongsheng@714
|
4612 msgid ""
|
dongsheng@714
|
4613 "If you only want to pull precisely the changes that were listed by <command "
|
dongsheng@714
|
4614 "role=\"hg-cmd\">hg incoming</command>, or you have some other reason to pull "
|
dongsheng@714
|
4615 "a subset of changes, simply identify the change that you want to pull by its "
|
dongsheng@714
|
4616 "changeset ID, e.g. <command>hg pull -r7e95bb</command>."
|
dongsheng@627
|
4617 msgstr ""
|
dongsheng@627
|
4618
|
dongsheng@627
|
4619 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
4620 #: ../en/ch02-tour-basic.xml:834
|
dongsheng@627
|
4621 msgid "Updating the working directory"
|
dongsheng@627
|
4622 msgstr "更新工作目录"
|
dongsheng@627
|
4623
|
dongsheng@627
|
4624 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4625 #: ../en/ch02-tour-basic.xml:836
|
dongsheng@627
|
4626 msgid ""
|
dongsheng@627
|
4627 "We have so far glossed over the relationship between a repository and its "
|
dongsheng@627
|
4628 "working directory. The <command role=\"hg-cmd\">hg pull</command> command "
|
songdongsheng@658
|
4629 "that we ran in <xref linkend=\"sec:tour:pull\"/> brought changes into the "
|
songdongsheng@658
|
4630 "repository, but if we check, there's no sign of those changes in the working "
|
songdongsheng@658
|
4631 "directory. This is because <command role=\"hg-cmd\">hg pull</command> does "
|
songdongsheng@658
|
4632 "not (by default) touch the working directory. Instead, we use the <command "
|
songdongsheng@658
|
4633 "role=\"hg-cmd\">hg update</command> command to do this."
|
songdongsheng@658
|
4634 msgstr ""
|
songdongsheng@658
|
4635
|
songdongsheng@658
|
4636 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4637 #: ../en/ch02-tour-basic.xml:848
|
dongsheng@627
|
4638 msgid ""
|
dongsheng@627
|
4639 "It might seem a bit strange that <command role=\"hg-cmd\">hg pull</command> "
|
dongsheng@627
|
4640 "doesn't update the working directory automatically. There's actually a good "
|
dongsheng@627
|
4641 "reason for this: you can use <command role=\"hg-cmd\">hg update</command> to "
|
dongsheng@627
|
4642 "update the working directory to the state it was in at <emphasis>any "
|
dongsheng@627
|
4643 "revision</emphasis> in the history of the repository. If you had the working "
|
songdongsheng@668
|
4644 "directory updated to an old revision&emdash;to hunt down the origin of a bug, "
|
songdongsheng@668
|
4645 "say&emdash;and ran a <command role=\"hg-cmd\">hg pull</command> which "
|
songdongsheng@668
|
4646 "automatically updated the working directory to a new revision, you might not "
|
songdongsheng@668
|
4647 "be terribly happy."
|
songdongsheng@667
|
4648 msgstr ""
|
songdongsheng@667
|
4649
|
songdongsheng@667
|
4650 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4651 #: ../en/ch02-tour-basic.xml:860
|
dongsheng@714
|
4652 msgid ""
|
dongsheng@714
|
4653 "Since pull-then-update is such a common sequence of operations, Mercurial "
|
dongsheng@714
|
4654 "lets you combine the two by passing the <option role=\"hg-opt-pull\">-u</"
|
dongsheng@714
|
4655 "option> option to <command role=\"hg-cmd\">hg pull</command>."
|
dongsheng@714
|
4656 msgstr ""
|
dongsheng@714
|
4657
|
dongsheng@714
|
4658 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4659 #: ../en/ch02-tour-basic.xml:865
|
dongsheng@627
|
4660 msgid ""
|
dongsheng@627
|
4661 "If you look back at the output of <command role=\"hg-cmd\">hg pull</command> "
|
songdongsheng@658
|
4662 "in <xref linkend=\"sec:tour:pull\"/> when we ran it without <option role=\"hg-"
|
songdongsheng@658
|
4663 "opt-pull\">-u</option>, you can see that it printed a helpful reminder that "
|
dongsheng@714
|
4664 "we'd have to take an explicit step to update the working directory."
|
dongsheng@714
|
4665 msgstr ""
|
dongsheng@714
|
4666
|
dongsheng@714
|
4667 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4668 #: ../en/ch02-tour-basic.xml:872
|
dongsheng@627
|
4669 msgid ""
|
dongsheng@627
|
4670 "To find out what revision the working directory is at, use the <command role="
|
dongsheng@627
|
4671 "\"hg-cmd\">hg parents</command> command."
|
dongsheng@627
|
4672 msgstr ""
|
dongsheng@627
|
4673
|
dongsheng@627
|
4674 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4675 #: ../en/ch02-tour-basic.xml:878
|
songdongsheng@658
|
4676 msgid ""
|
songdongsheng@658
|
4677 "If you look back at <xref linkend=\"fig:tour-basic:history\"/>, you'll see "
|
songdongsheng@658
|
4678 "arrows connecting each changeset. The node that the arrow leads "
|
songdongsheng@658
|
4679 "<emphasis>from</emphasis> in each case is a parent, and the node that the "
|
songdongsheng@658
|
4680 "arrow leads <emphasis>to</emphasis> is its child. The working directory has "
|
songdongsheng@658
|
4681 "a parent in just the same way; this is the changeset that the working "
|
songdongsheng@658
|
4682 "directory currently contains."
|
songdongsheng@658
|
4683 msgstr ""
|
songdongsheng@658
|
4684
|
songdongsheng@658
|
4685 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4686 #: ../en/ch02-tour-basic.xml:887
|
dongsheng@627
|
4687 msgid ""
|
dongsheng@627
|
4688 "To update the working directory to a particular revision, give a revision "
|
dongsheng@627
|
4689 "number or changeset ID to the <command role=\"hg-cmd\">hg update</command> "
|
dongsheng@627
|
4690 "command."
|
dongsheng@627
|
4691 msgstr ""
|
dongsheng@627
|
4692
|
dongsheng@627
|
4693 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4694 #: ../en/ch02-tour-basic.xml:893
|
dongsheng@627
|
4695 msgid ""
|
dongsheng@627
|
4696 "If you omit an explicit revision, <command role=\"hg-cmd\">hg update</"
|
dongsheng@627
|
4697 "command> will update to the tip revision, as shown by the second call to "
|
dongsheng@627
|
4698 "<command role=\"hg-cmd\">hg update</command> in the example above."
|
dongsheng@627
|
4699 msgstr ""
|
dongsheng@627
|
4700
|
dongsheng@627
|
4701 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
4702 #: ../en/ch02-tour-basic.xml:901
|
dongsheng@627
|
4703 msgid "Pushing changes to another repository"
|
dongsheng@627
|
4704 msgstr "发布修改到其它版本库"
|
dongsheng@627
|
4705
|
dongsheng@627
|
4706 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4707 #: ../en/ch02-tour-basic.xml:903
|
dongsheng@627
|
4708 msgid ""
|
dongsheng@627
|
4709 "Mercurial lets us push changes to another repository, from the repository "
|
dongsheng@714
|
4710 "we're currently visiting. As with the example of <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
4711 "pull</command> above, we'll create a temporary repository to push our changes "
|
dongsheng@627
|
4712 "into."
|
dongsheng@627
|
4713 msgstr ""
|
dongsheng@627
|
4714
|
dongsheng@627
|
4715 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4716 #: ../en/ch02-tour-basic.xml:911
|
dongsheng@627
|
4717 msgid ""
|
dongsheng@627
|
4718 "The <command role=\"hg-cmd\">hg outgoing</command> command tells us what "
|
dongsheng@627
|
4719 "changes would be pushed into another repository."
|
dongsheng@627
|
4720 msgstr ""
|
dongsheng@627
|
4721
|
dongsheng@627
|
4722 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4723 #: ../en/ch02-tour-basic.xml:917
|
dongsheng@627
|
4724 msgid ""
|
dongsheng@627
|
4725 "And the <command role=\"hg-cmd\">hg push</command> command does the actual "
|
dongsheng@627
|
4726 "push."
|
dongsheng@627
|
4727 msgstr ""
|
dongsheng@627
|
4728
|
dongsheng@627
|
4729 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4730 #: ../en/ch02-tour-basic.xml:922
|
dongsheng@627
|
4731 msgid ""
|
dongsheng@627
|
4732 "As with <command role=\"hg-cmd\">hg pull</command>, the <command role=\"hg-cmd"
|
dongsheng@627
|
4733 "\">hg push</command> command does not update the working directory in the "
|
songdongsheng@667
|
4734 "repository that it's pushing changes into. Unlike <command role=\"hg-cmd\">hg "
|
songdongsheng@667
|
4735 "pull</command>, <command role=\"hg-cmd\">hg push</command> does not provide a "
|
songdongsheng@667
|
4736 "<literal>-u</literal> option that updates the other repository's working "
|
songdongsheng@667
|
4737 "directory. This asymmetry is deliberate: the repository we're pushing to "
|
songdongsheng@667
|
4738 "might be on a remote server and shared between several people. If we were to "
|
songdongsheng@667
|
4739 "update its working directory while someone was working in it, their work "
|
songdongsheng@667
|
4740 "would be disrupted."
|
songdongsheng@667
|
4741 msgstr ""
|
songdongsheng@667
|
4742
|
songdongsheng@667
|
4743 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4744 #: ../en/ch02-tour-basic.xml:934
|
dongsheng@627
|
4745 msgid ""
|
dongsheng@627
|
4746 "What happens if we try to pull or push changes and the receiving repository "
|
dongsheng@627
|
4747 "already has those changes? Nothing too exciting."
|
dongsheng@627
|
4748 msgstr ""
|
dongsheng@627
|
4749
|
dongsheng@627
|
4750 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
4751 #: ../en/ch02-tour-basic.xml:942
|
dongsheng@714
|
4752 msgid "Default locations"
|
dongsheng@716
|
4753 msgstr "默认位置"
|
dongsheng@714
|
4754
|
dongsheng@714
|
4755 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4756 #: ../en/ch02-tour-basic.xml:944
|
dongsheng@714
|
4757 msgid ""
|
dongsheng@714
|
4758 "When we clone a repository, Mercurial records the location of the repository "
|
dongsheng@714
|
4759 "we cloned in the <filename>.hg/hgrc</filename> file of the new repository. "
|
dongsheng@714
|
4760 "If we don't supply a location to <command>hg pull</command> from or "
|
dongsheng@714
|
4761 "<command>hg push</command> to, those commands will use this location as a "
|
dongsheng@714
|
4762 "default. The <command>hg incoming</command> and <command>hg outgoing</"
|
dongsheng@714
|
4763 "command> commands do so too."
|
dongsheng@714
|
4764 msgstr ""
|
dongsheng@714
|
4765
|
dongsheng@714
|
4766 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4767 #: ../en/ch02-tour-basic.xml:952
|
dongsheng@714
|
4768 msgid ""
|
dongsheng@714
|
4769 "If you open a repository's <filename>.hg/hgrc</filename> file in a text "
|
dongsheng@714
|
4770 "editor, you will see contents like the following."
|
dongsheng@714
|
4771 msgstr ""
|
dongsheng@714
|
4772
|
dongsheng@714
|
4773 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4774 #: ../en/ch02-tour-basic.xml:959
|
dongsheng@714
|
4775 msgid ""
|
dongsheng@714
|
4776 "It is possible&emdash;and often useful&emdash;to have the default location "
|
dongsheng@714
|
4777 "for <command>hg push</command> and <command>hg outgoing</command> be "
|
dongsheng@714
|
4778 "different from those for <command>hg pull</command> and <command>hg incoming</"
|
dongsheng@714
|
4779 "command>. We can do this by adding a <literal>default-push</literal> entry "
|
dongsheng@714
|
4780 "to the <literal>[paths]</literal> section of the <filename>.hg/hgrc</"
|
dongsheng@714
|
4781 "filename> file, as follows."
|
dongsheng@714
|
4782 msgstr ""
|
dongsheng@714
|
4783
|
dongsheng@714
|
4784 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
4785 #: ../en/ch02-tour-basic.xml:973
|
dongsheng@627
|
4786 msgid "Sharing changes over a network"
|
dongsheng@627
|
4787 msgstr "通过网络共享修改"
|
dongsheng@627
|
4788
|
dongsheng@627
|
4789 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4790 #: ../en/ch02-tour-basic.xml:975
|
dongsheng@627
|
4791 msgid ""
|
dongsheng@627
|
4792 "The commands we have covered in the previous few sections are not limited to "
|
dongsheng@627
|
4793 "working with local repositories. Each works in exactly the same fashion over "
|
dongsheng@627
|
4794 "a network connection; simply pass in a URL instead of a local path."
|
dongsheng@627
|
4795 msgstr ""
|
dongsheng@627
|
4796
|
dongsheng@627
|
4797 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4798 #: ../en/ch02-tour-basic.xml:983
|
dongsheng@627
|
4799 msgid ""
|
dongsheng@627
|
4800 "In this example, we can see what changes we could push to the remote "
|
dongsheng@627
|
4801 "repository, but the repository is understandably not set up to let anonymous "
|
dongsheng@627
|
4802 "users push to it."
|
dongsheng@627
|
4803 msgstr ""
|
dongsheng@627
|
4804
|
dongsheng@714
|
4805 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
4806 #: ../en/ch02-tour-basic.xml:993
|
dongsheng@714
|
4807 msgid "Starting a new project"
|
dongsheng@715
|
4808 msgstr "开始新项目"
|
dongsheng@714
|
4809
|
dongsheng@714
|
4810 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4811 #: ../en/ch02-tour-basic.xml:995
|
dongsheng@714
|
4812 msgid ""
|
dongsheng@714
|
4813 "It is just as easy to begin a new project as to work on one that already "
|
dongsheng@714
|
4814 "exists. The <command>hg init</command> command creates a new, empty "
|
dongsheng@714
|
4815 "Mercurial repository."
|
dongsheng@714
|
4816 msgstr ""
|
dongsheng@714
|
4817
|
dongsheng@714
|
4818 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4819 #: ../en/ch02-tour-basic.xml:1001
|
dongsheng@714
|
4820 msgid ""
|
dongsheng@714
|
4821 "This simply creates a repository named <filename>myproject</filename> in the "
|
dongsheng@714
|
4822 "current directory."
|
dongsheng@714
|
4823 msgstr ""
|
dongsheng@714
|
4824
|
dongsheng@714
|
4825 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4826 #: ../en/ch02-tour-basic.xml:1006
|
dongsheng@714
|
4827 msgid ""
|
dongsheng@714
|
4828 "We can tell that <filename>myproject</filename> is a Mercurial repository, "
|
dongsheng@714
|
4829 "because it contains a <filename>.hg</filename> directory."
|
dongsheng@714
|
4830 msgstr ""
|
dongsheng@714
|
4831
|
dongsheng@714
|
4832 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4833 #: ../en/ch02-tour-basic.xml:1012
|
dongsheng@714
|
4834 msgid ""
|
dongsheng@714
|
4835 "If we want to add some pre-existing files to the repository, we copy them "
|
dongsheng@714
|
4836 "into place, and tell Mercurial to start tracking them using the <command>hg "
|
dongsheng@714
|
4837 "add</command> command."
|
dongsheng@714
|
4838 msgstr ""
|
dongsheng@714
|
4839
|
dongsheng@714
|
4840 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4841 #: ../en/ch02-tour-basic.xml:1018
|
dongsheng@714
|
4842 msgid ""
|
dongsheng@714
|
4843 "Once we are satisfied that our project looks right, we commit our changes."
|
dongsheng@714
|
4844 msgstr ""
|
dongsheng@714
|
4845
|
dongsheng@714
|
4846 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4847 #: ../en/ch02-tour-basic.xml:1023
|
dongsheng@714
|
4848 msgid ""
|
dongsheng@714
|
4849 "It takes just a few moments to start using Mercurial on a new project, which "
|
dongsheng@714
|
4850 "is part of its appeal. Revision control is now so easy to work with, we can "
|
dongsheng@714
|
4851 "use it on the smallest of projects that we might not have considered with a "
|
dongsheng@714
|
4852 "more complicated tool."
|
dongsheng@714
|
4853 msgstr ""
|
dongsheng@714
|
4854
|
dongsheng@627
|
4855 #. type: Content of: <book><chapter><title>
|
dongsheng@714
|
4856 #: ../en/ch03-tour-merge.xml:5
|
dongsheng@627
|
4857 msgid "A tour of Mercurial: merging work"
|
dongsheng@627
|
4858 msgstr "Mercurial 教程: 合并工作"
|
dongsheng@627
|
4859
|
dongsheng@627
|
4860 #. type: Content of: <book><chapter><para>
|
dongsheng@714
|
4861 #: ../en/ch03-tour-merge.xml:7
|
dongsheng@627
|
4862 msgid ""
|
dongsheng@627
|
4863 "We've now covered cloning a repository, making changes in a repository, and "
|
dongsheng@627
|
4864 "pulling or pushing changes from one repository into another. Our next step "
|
dongsheng@627
|
4865 "is <emphasis>merging</emphasis> changes from separate repositories."
|
dongsheng@627
|
4866 msgstr ""
|
dongsheng@627
|
4867
|
dongsheng@627
|
4868 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
4869 #: ../en/ch03-tour-merge.xml:13
|
dongsheng@627
|
4870 msgid "Merging streams of work"
|
dongsheng@627
|
4871 msgstr "合并的流程"
|
dongsheng@627
|
4872
|
dongsheng@627
|
4873 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4874 #: ../en/ch03-tour-merge.xml:15
|
dongsheng@627
|
4875 msgid ""
|
dongsheng@627
|
4876 "Merging is a fundamental part of working with a distributed revision control "
|
dongsheng@714
|
4877 "tool. Here are a few cases in which the need to merge work arises."
|
dongsheng@627
|
4878 msgstr ""
|
dongsheng@627
|
4879
|
dongsheng@627
|
4880 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
4881 #: ../en/ch03-tour-merge.xml:20
|
dongsheng@627
|
4882 msgid ""
|
dongsheng@627
|
4883 "Alice and Bob each have a personal copy of a repository for a project they're "
|
dongsheng@627
|
4884 "collaborating on. Alice fixes a bug in her repository; Bob adds a new "
|
dongsheng@627
|
4885 "feature in his. They want the shared repository to contain both the bug fix "
|
dongsheng@627
|
4886 "and the new feature."
|
dongsheng@627
|
4887 msgstr ""
|
dongsheng@627
|
4888
|
dongsheng@627
|
4889 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
4890 #: ../en/ch03-tour-merge.xml:27
|
dongsheng@714
|
4891 msgid ""
|
dongsheng@714
|
4892 "Cynthia frequently works on several different tasks for a single project at "
|
dongsheng@714
|
4893 "once, each safely isolated in its own repository. Working this way means that "
|
dongsheng@714
|
4894 "she often needs to merge one piece of her own work with another."
|
dongsheng@714
|
4895 msgstr ""
|
dongsheng@714
|
4896
|
dongsheng@714
|
4897 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4898 #: ../en/ch03-tour-merge.xml:35
|
dongsheng@714
|
4899 msgid ""
|
dongsheng@714
|
4900 "Because we need to merge often, Mercurial makes the process easy. Let's walk "
|
dongsheng@714
|
4901 "through a merge. We'll begin by cloning yet another repository (see how "
|
dongsheng@714
|
4902 "often they spring up?) and making a change in it."
|
dongsheng@714
|
4903 msgstr ""
|
dongsheng@714
|
4904
|
dongsheng@714
|
4905 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4906 #: ../en/ch03-tour-merge.xml:42
|
dongsheng@627
|
4907 msgid ""
|
dongsheng@627
|
4908 "We should now have two copies of <filename>hello.c</filename> with different "
|
dongsheng@627
|
4909 "contents. The histories of the two repositories have also diverged, as "
|
dongsheng@714
|
4910 "illustrated in <xref linkend=\"fig:tour-merge:sep-repos\"/>. Here is a copy "
|
dongsheng@714
|
4911 "of our file from one repository."
|
dongsheng@714
|
4912 msgstr ""
|
dongsheng@714
|
4913
|
dongsheng@714
|
4914 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4915 #: ../en/ch03-tour-merge.xml:51
|
dongsheng@714
|
4916 msgid "And here is our slightly different version from the other repository."
|
songdongsheng@658
|
4917 msgstr ""
|
songdongsheng@658
|
4918
|
songdongsheng@658
|
4919 #. type: Content of: <book><chapter><sect1><figure><title>
|
dongsheng@714
|
4920 #: ../en/ch03-tour-merge.xml:57
|
dongsheng@627
|
4921 msgid ""
|
dongsheng@627
|
4922 "Divergent recent histories of the <filename class=\"directory\">my-hello</"
|
dongsheng@627
|
4923 "filename> and <filename class=\"directory\">my-new-hello</filename> "
|
dongsheng@627
|
4924 "repositories"
|
dongsheng@627
|
4925 msgstr ""
|
dongsheng@660
|
4926 "<filename class=\"directory\">my-hello</filename> 与 <filename class="
|
dongsheng@660
|
4927 "\"directory\">my-new-hello</filename> 最新的历史分叉"
|
dongsheng@627
|
4928
|
songdongsheng@658
|
4929 #. type: Content of: <book><chapter><sect1><figure><mediaobject>
|
dongsheng@714
|
4930 #: ../en/ch03-tour-merge.xml:62
|
songdongsheng@658
|
4931 msgid ""
|
songdongsheng@658
|
4932 "<imageobject><imagedata fileref=\"figs/tour-merge-sep-repos.png\"/></"
|
songdongsheng@658
|
4933 "imageobject>"
|
songdongsheng@658
|
4934 msgstr ""
|
songdongsheng@658
|
4935
|
songdongsheng@658
|
4936 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4937 #: ../en/ch03-tour-merge.xml:67
|
dongsheng@627
|
4938 msgid ""
|
dongsheng@627
|
4939 "We already know that pulling changes from our <filename class=\"directory"
|
dongsheng@627
|
4940 "\">my-hello</filename> repository will have no effect on the working "
|
dongsheng@627
|
4941 "directory."
|
dongsheng@627
|
4942 msgstr ""
|
dongsheng@627
|
4943
|
dongsheng@627
|
4944 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
4945 #: ../en/ch03-tour-merge.xml:73
|
dongsheng@627
|
4946 msgid ""
|
dongsheng@627
|
4947 "However, the <command role=\"hg-cmd\">hg pull</command> command says "
|
dongsheng@627
|
4948 "something about <quote>heads</quote>."
|
dongsheng@627
|
4949 msgstr ""
|
dongsheng@627
|
4950
|
dongsheng@627
|
4951 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
4952 #: ../en/ch03-tour-merge.xml:77
|
dongsheng@627
|
4953 msgid "Head changesets"
|
songdongsheng@665
|
4954 msgstr "顶点修改集"
|
dongsheng@627
|
4955
|
dongsheng@627
|
4956 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4957 #: ../en/ch03-tour-merge.xml:79
|
dongsheng@714
|
4958 msgid ""
|
dongsheng@714
|
4959 "Remember that Mercurial records what the parent of each change is. If a "
|
dongsheng@714
|
4960 "change has a parent, we call it a child or descendant of the parent. A head "
|
dongsheng@714
|
4961 "is a change that has no children. The tip revision is thus a head, because "
|
dongsheng@714
|
4962 "the newest revision in a repository doesn't have any children. There are "
|
dongsheng@714
|
4963 "times when a repository can contain more than one head."
|
dongsheng@627
|
4964 msgstr ""
|
dongsheng@627
|
4965
|
songdongsheng@658
|
4966 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
|
dongsheng@714
|
4967 #: ../en/ch03-tour-merge.xml:88
|
dongsheng@627
|
4968 msgid ""
|
dongsheng@627
|
4969 "Repository contents after pulling from <filename class=\"directory\">my-"
|
dongsheng@627
|
4970 "hello</filename> into <filename class=\"directory\">my-new-hello</filename>"
|
dongsheng@627
|
4971 msgstr ""
|
dongsheng@660
|
4972 "从 <filename class=\"directory\">my-hello</filename> 拉到 <filename class="
|
dongsheng@660
|
4973 "\"directory\">my-new-hello</filename> 之后版本库的内容"
|
dongsheng@627
|
4974
|
songdongsheng@658
|
4975 #. type: Content of: <book><chapter><sect1><sect2><figure>
|
dongsheng@714
|
4976 #: ../en/ch03-tour-merge.xml:91 ../en/ch03-tour-merge.xml:178
|
dongsheng@714
|
4977 #: ../en/ch03-tour-merge.xml:275 ../en/ch04-concepts.xml:57
|
dongsheng@714
|
4978 #: ../en/ch04-concepts.xml:106 ../en/ch04-concepts.xml:196
|
dongsheng@714
|
4979 #: ../en/ch04-concepts.xml:345 ../en/ch04-concepts.xml:360
|
dongsheng@714
|
4980 #: ../en/ch04-concepts.xml:401 ../en/ch04-concepts.xml:421
|
dongsheng@714
|
4981 #: ../en/ch04-concepts.xml:465 ../en/ch06-collab.xml:314
|
dongsheng@714
|
4982 #: ../en/ch09-undo.xml:342 ../en/ch09-undo.xml:389 ../en/ch09-undo.xml:462
|
dongsheng@714
|
4983 #: ../en/ch09-undo.xml:500 ../en/ch09-undo.xml:656 ../en/ch09-undo.xml:680
|
dongsheng@714
|
4984 #: ../en/ch09-undo.xml:698 ../en/ch09-undo.xml:712 ../en/ch09-undo.xml:725
|
dongsheng@714
|
4985 #: ../en/ch12-mq.xml:411
|
songdongsheng@658
|
4986 msgid " <placeholder type=\"mediaobject\" id=\"0\"/>"
|
songdongsheng@658
|
4987 msgstr ""
|
songdongsheng@658
|
4988
|
songdongsheng@658
|
4989 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
|
dongsheng@714
|
4990 #: ../en/ch03-tour-merge.xml:92
|
songdongsheng@658
|
4991 msgid ""
|
songdongsheng@658
|
4992 "<imageobject> <imagedata fileref=\"figs/tour-merge-pull.png\"/> </imageobject>"
|
songdongsheng@658
|
4993 msgstr ""
|
songdongsheng@658
|
4994
|
songdongsheng@658
|
4995 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
4996 #: ../en/ch03-tour-merge.xml:99
|
songdongsheng@658
|
4997 msgid ""
|
songdongsheng@658
|
4998 "In <xref linkend=\"fig:tour-merge:pull\"/>, you can see the effect of the "
|
songdongsheng@658
|
4999 "pull from <filename class=\"directory\">my-hello</filename> into <filename "
|
songdongsheng@658
|
5000 "class=\"directory\">my-new-hello</filename>. The history that was already "
|
songdongsheng@658
|
5001 "present in <filename class=\"directory\">my-new-hello</filename> is "
|
songdongsheng@658
|
5002 "untouched, but a new revision has been added. By referring to <xref linkend="
|
songdongsheng@658
|
5003 "\"fig:tour-merge:sep-repos\"/>, we can see that the <emphasis>changeset ID</"
|
songdongsheng@658
|
5004 "emphasis> remains the same in the new repository, but the <emphasis>revision "
|
songdongsheng@658
|
5005 "number</emphasis> has changed. (This, incidentally, is a fine example of why "
|
songdongsheng@658
|
5006 "it's not safe to use revision numbers when discussing changesets.) We can "
|
songdongsheng@658
|
5007 "view the heads in a repository using the <command role=\"hg-cmd\">hg heads</"
|
songdongsheng@658
|
5008 "command> command."
|
dongsheng@627
|
5009 msgstr ""
|
dongsheng@627
|
5010
|
dongsheng@627
|
5011 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
5012 #: ../en/ch03-tour-merge.xml:118
|
dongsheng@627
|
5013 msgid "Performing the merge"
|
dongsheng@627
|
5014 msgstr "执行合并"
|
dongsheng@627
|
5015
|
dongsheng@627
|
5016 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5017 #: ../en/ch03-tour-merge.xml:120
|
dongsheng@627
|
5018 msgid ""
|
dongsheng@627
|
5019 "What happens if we try to use the normal <command role=\"hg-cmd\">hg update</"
|
dongsheng@627
|
5020 "command> command to update to the new tip?"
|
dongsheng@627
|
5021 msgstr ""
|
dongsheng@627
|
5022
|
dongsheng@627
|
5023 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5024 #: ../en/ch03-tour-merge.xml:126
|
dongsheng@627
|
5025 msgid ""
|
dongsheng@627
|
5026 "Mercurial is telling us that the <command role=\"hg-cmd\">hg update</command> "
|
dongsheng@627
|
5027 "command won't do a merge; it won't update the working directory when it "
|
dongsheng@714
|
5028 "thinks we might want to do a merge, unless we force it to do so. "
|
dongsheng@714
|
5029 "(Incidentally, forcing the update with <command>hg update -C</command> would "
|
dongsheng@714
|
5030 "revert any uncommitted changes in the working directory.)"
|
dongsheng@714
|
5031 msgstr ""
|
dongsheng@714
|
5032
|
dongsheng@714
|
5033 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5034 #: ../en/ch03-tour-merge.xml:134
|
dongsheng@714
|
5035 msgid ""
|
dongsheng@714
|
5036 "To start a merge between the two heads, we use the <command role=\"hg-cmd"
|
dongsheng@714
|
5037 "\">hg merge</command> command."
|
dongsheng@715
|
5038 msgstr ""
|
dongsheng@715
|
5039 "我们使用 <command role=\"hg-cmd\">hg merge</command> 命令来合并两个顶点。"
|
dongsheng@714
|
5040
|
dongsheng@714
|
5041 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5042 #: ../en/ch03-tour-merge.xml:139
|
dongsheng@714
|
5043 msgid ""
|
dongsheng@714
|
5044 "We resolve the contents of <filename>hello.c</filename> This updates the "
|
dongsheng@714
|
5045 "working directory so that it contains changes from <emphasis>both</emphasis> "
|
dongsheng@714
|
5046 "heads, which is reflected in both the output of <command role=\"hg-cmd\">hg "
|
dongsheng@714
|
5047 "parents</command> and the contents of <filename>hello.c</filename>."
|
dongsheng@627
|
5048 msgstr ""
|
dongsheng@627
|
5049
|
dongsheng@627
|
5050 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
5051 #: ../en/ch03-tour-merge.xml:151
|
dongsheng@627
|
5052 msgid "Committing the results of the merge"
|
dongsheng@627
|
5053 msgstr "提交合并结果"
|
dongsheng@627
|
5054
|
dongsheng@627
|
5055 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5056 #: ../en/ch03-tour-merge.xml:153
|
dongsheng@627
|
5057 msgid ""
|
dongsheng@627
|
5058 "Whenever we've done a merge, <command role=\"hg-cmd\">hg parents</command> "
|
dongsheng@627
|
5059 "will display two parents until we <command role=\"hg-cmd\">hg commit</"
|
dongsheng@627
|
5060 "command> the results of the merge."
|
dongsheng@627
|
5061 msgstr ""
|
dongsheng@627
|
5062
|
dongsheng@627
|
5063 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5064 #: ../en/ch03-tour-merge.xml:160
|
dongsheng@627
|
5065 msgid ""
|
dongsheng@627
|
5066 "We now have a new tip revision; notice that it has <emphasis>both</emphasis> "
|
dongsheng@627
|
5067 "of our former heads as its parents. These are the same revisions that were "
|
dongsheng@627
|
5068 "previously displayed by <command role=\"hg-cmd\">hg parents</command>."
|
dongsheng@627
|
5069 msgstr ""
|
dongsheng@627
|
5070
|
dongsheng@627
|
5071 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5072 #: ../en/ch03-tour-merge.xml:167
|
songdongsheng@658
|
5073 msgid ""
|
songdongsheng@658
|
5074 "In <xref linkend=\"fig:tour-merge:merge\"/>, you can see a representation of "
|
songdongsheng@658
|
5075 "what happens to the working directory during the merge, and how this affects "
|
songdongsheng@658
|
5076 "the repository when the commit happens. During the merge, the working "
|
songdongsheng@658
|
5077 "directory has two parent changesets, and these become the parents of the new "
|
songdongsheng@658
|
5078 "changeset."
|
dongsheng@627
|
5079 msgstr ""
|
dongsheng@627
|
5080
|
songdongsheng@710
|
5081 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
|
dongsheng@714
|
5082 #: ../en/ch03-tour-merge.xml:176
|
songdongsheng@710
|
5083 msgid "Working directory and repository during merge, and following commit"
|
songdongsheng@710
|
5084 msgstr "在合并期间,以及提交之后的工作目录与版本库"
|
songdongsheng@710
|
5085
|
songdongsheng@710
|
5086 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
|
dongsheng@714
|
5087 #: ../en/ch03-tour-merge.xml:179
|
songdongsheng@710
|
5088 msgid ""
|
songdongsheng@710
|
5089 "<imageobject> <imagedata fileref=\"figs/tour-merge-merge.png\"/> </"
|
songdongsheng@710
|
5090 "imageobject>"
|
songdongsheng@710
|
5091 msgstr ""
|
songdongsheng@710
|
5092
|
songdongsheng@710
|
5093 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5094 #: ../en/ch03-tour-merge.xml:186
|
songdongsheng@710
|
5095 msgid ""
|
songdongsheng@710
|
5096 "We sometimes talk about a merge having <emphasis>sides</emphasis>: the left "
|
songdongsheng@710
|
5097 "side is the first parent in the output of <command role=\"hg-cmd\">hg "
|
songdongsheng@710
|
5098 "parents</command>, and the right side is the second. If the working "
|
songdongsheng@710
|
5099 "directory was at e.g. revision 5 before we began a merge, that revision will "
|
songdongsheng@710
|
5100 "become the left side of the merge."
|
songdongsheng@710
|
5101 msgstr ""
|
songdongsheng@710
|
5102
|
dongsheng@627
|
5103 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
5104 #: ../en/ch03-tour-merge.xml:196
|
dongsheng@627
|
5105 msgid "Merging conflicting changes"
|
dongsheng@627
|
5106 msgstr "合并有冲突的改变"
|
dongsheng@627
|
5107
|
dongsheng@627
|
5108 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5109 #: ../en/ch03-tour-merge.xml:198
|
dongsheng@627
|
5110 msgid ""
|
dongsheng@627
|
5111 "Most merges are simple affairs, but sometimes you'll find yourself merging "
|
songdongsheng@710
|
5112 "changes where each side modifies the same portions of the same files. Unless "
|
songdongsheng@710
|
5113 "both modifications are identical, this results in a <emphasis>conflict</"
|
songdongsheng@710
|
5114 "emphasis>, where you have to decide how to reconcile the different changes "
|
songdongsheng@710
|
5115 "into something coherent."
|
dongsheng@627
|
5116 msgstr ""
|
dongsheng@627
|
5117
|
songdongsheng@658
|
5118 #. type: Content of: <book><chapter><sect1><figure><title>
|
dongsheng@714
|
5119 #: ../en/ch03-tour-merge.xml:206
|
songdongsheng@658
|
5120 msgid "Conflicting changes to a document"
|
dongsheng@660
|
5121 msgstr "冲突的修改"
|
songdongsheng@658
|
5122
|
songdongsheng@658
|
5123 #. type: Content of: <book><chapter><sect1><figure><mediaobject>
|
dongsheng@714
|
5124 #: ../en/ch03-tour-merge.xml:208
|
songdongsheng@658
|
5125 msgid ""
|
songdongsheng@658
|
5126 "<imageobject><imagedata fileref=\"figs/tour-merge-conflict.png\"/></"
|
dongsheng@627
|
5127 "imageobject>"
|
dongsheng@627
|
5128 msgstr ""
|
dongsheng@627
|
5129
|
songdongsheng@658
|
5130 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5131 #: ../en/ch03-tour-merge.xml:213
|
songdongsheng@658
|
5132 msgid ""
|
songdongsheng@658
|
5133 "<xref linkend=\"fig:tour-merge:conflict\"/> illustrates an instance of two "
|
songdongsheng@658
|
5134 "conflicting changes to a document. We started with a single version of the "
|
songdongsheng@658
|
5135 "file; then we made some changes; while someone else made different changes to "
|
songdongsheng@658
|
5136 "the same text. Our task in resolving the conflicting changes is to decide "
|
songdongsheng@658
|
5137 "what the file should look like."
|
songdongsheng@658
|
5138 msgstr ""
|
songdongsheng@658
|
5139
|
songdongsheng@658
|
5140 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5141 #: ../en/ch03-tour-merge.xml:220
|
dongsheng@627
|
5142 msgid ""
|
dongsheng@627
|
5143 "Mercurial doesn't have a built-in facility for handling conflicts. Instead, "
|
songdongsheng@710
|
5144 "it runs an external program, usually one that displays some kind of graphical "
|
songdongsheng@710
|
5145 "conflict resolution interface. By default, Mercurial tries to find one of "
|
songdongsheng@710
|
5146 "several different merging tools that are likely to be installed on your "
|
songdongsheng@710
|
5147 "system. It first tries a few fully automatic merging tools; if these don't "
|
songdongsheng@710
|
5148 "succeed (because the resolution process requires human guidance) or aren't "
|
songdongsheng@710
|
5149 "present, it tries a few different graphical merging tools."
|
songdongsheng@710
|
5150 msgstr ""
|
songdongsheng@710
|
5151
|
songdongsheng@710
|
5152 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5153 #: ../en/ch03-tour-merge.xml:230
|
dongsheng@714
|
5154 msgid ""
|
dongsheng@714
|
5155 "It's also possible to get Mercurial to run a specific program or script, by "
|
dongsheng@714
|
5156 "setting the <envar>HGMERGE</envar> environment variable to the name of your "
|
dongsheng@714
|
5157 "preferred program."
|
dongsheng@627
|
5158 msgstr ""
|
dongsheng@627
|
5159
|
dongsheng@627
|
5160 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
5161 #: ../en/ch03-tour-merge.xml:236
|
dongsheng@627
|
5162 msgid "Using a graphical merge tool"
|
dongsheng@627
|
5163 msgstr "使用图形合并工具"
|
dongsheng@627
|
5164
|
dongsheng@627
|
5165 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5166 #: ../en/ch03-tour-merge.xml:238
|
dongsheng@627
|
5167 msgid ""
|
dongsheng@627
|
5168 "My preferred graphical merge tool is <command>kdiff3</command>, which I'll "
|
dongsheng@627
|
5169 "use to describe the features that are common to graphical file merging "
|
dongsheng@627
|
5170 "tools. You can see a screenshot of <command>kdiff3</command> in action in "
|
songdongsheng@658
|
5171 "<xref linkend=\"fig:tour-merge:kdiff3\"/>. The kind of merge it is "
|
songdongsheng@658
|
5172 "performing is called a <emphasis>three-way merge</emphasis>, because there "
|
songdongsheng@658
|
5173 "are three different versions of the file of interest to us. The tool thus "
|
songdongsheng@658
|
5174 "splits the upper portion of the window into three panes:"
|
dongsheng@627
|
5175 msgstr ""
|
dongsheng@627
|
5176
|
dongsheng@627
|
5177 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
5178 #: ../en/ch03-tour-merge.xml:248
|
dongsheng@627
|
5179 msgid ""
|
dongsheng@627
|
5180 "At the left is the <emphasis>base</emphasis> version of the file, i.e. the "
|
dongsheng@627
|
5181 "most recent version from which the two versions we're trying to merge are "
|
dongsheng@627
|
5182 "descended."
|
dongsheng@627
|
5183 msgstr ""
|
dongsheng@627
|
5184
|
dongsheng@627
|
5185 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
5186 #: ../en/ch03-tour-merge.xml:253
|
dongsheng@627
|
5187 msgid ""
|
dongsheng@627
|
5188 "In the middle is <quote>our</quote> version of the file, with the contents "
|
dongsheng@627
|
5189 "that we modified."
|
dongsheng@627
|
5190 msgstr ""
|
dongsheng@627
|
5191
|
dongsheng@627
|
5192 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
5193 #: ../en/ch03-tour-merge.xml:256
|
dongsheng@627
|
5194 msgid ""
|
dongsheng@627
|
5195 "On the right is <quote>their</quote> version of the file, the one that from "
|
dongsheng@627
|
5196 "the changeset that we're trying to merge with."
|
dongsheng@627
|
5197 msgstr ""
|
dongsheng@627
|
5198
|
dongsheng@627
|
5199 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5200 #: ../en/ch03-tour-merge.xml:260
|
dongsheng@627
|
5201 msgid ""
|
dongsheng@627
|
5202 "In the pane below these is the current <emphasis>result</emphasis> of the "
|
dongsheng@627
|
5203 "merge. Our task is to replace all of the red text, which indicates unresolved "
|
dongsheng@627
|
5204 "conflicts, with some sensible merger of the <quote>ours</quote> and "
|
dongsheng@627
|
5205 "<quote>theirs</quote> versions of the file."
|
dongsheng@627
|
5206 msgstr ""
|
dongsheng@627
|
5207
|
dongsheng@627
|
5208 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5209 #: ../en/ch03-tour-merge.xml:267
|
dongsheng@627
|
5210 msgid ""
|
dongsheng@627
|
5211 "All four of these panes are <emphasis>locked together</emphasis>; if we "
|
dongsheng@627
|
5212 "scroll vertically or horizontally in any of them, the others are updated to "
|
dongsheng@627
|
5213 "display the corresponding sections of their respective files."
|
dongsheng@627
|
5214 msgstr ""
|
dongsheng@627
|
5215
|
songdongsheng@658
|
5216 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
|
dongsheng@714
|
5217 #: ../en/ch03-tour-merge.xml:273
|
songdongsheng@658
|
5218 msgid "Using <command>kdiff3</command> to merge versions of a file"
|
dongsheng@660
|
5219 msgstr "使用 <command>kdiff3</command> 合并文件的不同版本"
|
songdongsheng@658
|
5220
|
songdongsheng@658
|
5221 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
|
dongsheng@714
|
5222 #: ../en/ch03-tour-merge.xml:276
|
songdongsheng@658
|
5223 msgid ""
|
songdongsheng@658
|
5224 "<imageobject> <imagedata width=\"100%\" fileref=\"figs/kdiff3.png\"/></"
|
dongsheng@630
|
5225 "imageobject>"
|
dongsheng@627
|
5226 msgstr ""
|
dongsheng@627
|
5227
|
songdongsheng@658
|
5228 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5229 #: ../en/ch03-tour-merge.xml:284
|
dongsheng@627
|
5230 msgid ""
|
dongsheng@627
|
5231 "For each conflicting portion of the file, we can choose to resolve the "
|
dongsheng@627
|
5232 "conflict using some combination of text from the base version, ours, or "
|
dongsheng@627
|
5233 "theirs. We can also manually edit the merged file at any time, in case we "
|
dongsheng@627
|
5234 "need to make further modifications."
|
dongsheng@627
|
5235 msgstr ""
|
dongsheng@627
|
5236
|
dongsheng@627
|
5237 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5238 #: ../en/ch03-tour-merge.xml:290
|
dongsheng@627
|
5239 msgid ""
|
dongsheng@627
|
5240 "There are <emphasis>many</emphasis> file merging tools available, too many to "
|
dongsheng@627
|
5241 "cover here. They vary in which platforms they are available for, and in "
|
dongsheng@627
|
5242 "their particular strengths and weaknesses. Most are tuned for merging files "
|
dongsheng@627
|
5243 "containing plain text, while a few are aimed at specialised file formats "
|
dongsheng@627
|
5244 "(generally XML)."
|
dongsheng@627
|
5245 msgstr ""
|
dongsheng@627
|
5246
|
dongsheng@627
|
5247 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
5248 #: ../en/ch03-tour-merge.xml:299
|
dongsheng@627
|
5249 msgid "A worked example"
|
dongsheng@627
|
5250 msgstr "合并实例"
|
dongsheng@627
|
5251
|
dongsheng@627
|
5252 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5253 #: ../en/ch03-tour-merge.xml:301
|
songdongsheng@658
|
5254 msgid ""
|
songdongsheng@658
|
5255 "In this example, we will reproduce the file modification history of <xref "
|
songdongsheng@658
|
5256 "linkend=\"fig:tour-merge:conflict\"/> above. Let's begin by creating a "
|
songdongsheng@658
|
5257 "repository with a base version of our document."
|
songdongsheng@658
|
5258 msgstr ""
|
songdongsheng@658
|
5259
|
songdongsheng@658
|
5260 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5261 #: ../en/ch03-tour-merge.xml:308
|
dongsheng@627
|
5262 msgid "We'll clone the repository and make a change to the file."
|
dongsheng@627
|
5263 msgstr ""
|
dongsheng@627
|
5264
|
dongsheng@627
|
5265 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5266 #: ../en/ch03-tour-merge.xml:313
|
dongsheng@627
|
5267 msgid ""
|
dongsheng@627
|
5268 "And another clone, to simulate someone else making a change to the file. "
|
dongsheng@627
|
5269 "(This hints at the idea that it's not all that unusual to merge with yourself "
|
dongsheng@627
|
5270 "when you isolate tasks in separate repositories, and indeed to find and "
|
dongsheng@627
|
5271 "resolve conflicts while doing so.)"
|
dongsheng@627
|
5272 msgstr ""
|
dongsheng@627
|
5273
|
dongsheng@627
|
5274 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5275 #: ../en/ch03-tour-merge.xml:321
|
dongsheng@627
|
5276 msgid ""
|
dongsheng@627
|
5277 "Having created two different versions of the file, we'll set up an "
|
dongsheng@627
|
5278 "environment suitable for running our merge."
|
dongsheng@627
|
5279 msgstr ""
|
dongsheng@627
|
5280
|
dongsheng@627
|
5281 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5282 #: ../en/ch03-tour-merge.xml:327
|
songdongsheng@710
|
5283 msgid ""
|
songdongsheng@710
|
5284 "In this example, I'll set <envar>HGMERGE</envar> to tell Mercurial to use the "
|
songdongsheng@710
|
5285 "non-interactive <command>merge</command> command. This is bundled with many "
|
songdongsheng@710
|
5286 "Unix-like systems. (If you're following this example on your computer, don't "
|
dongsheng@714
|
5287 "bother setting <envar>HGMERGE</envar>. You'll get dropped into a GUI file "
|
dongsheng@714
|
5288 "merge tool instead, which is much preferable.)"
|
dongsheng@714
|
5289 msgstr ""
|
dongsheng@714
|
5290
|
dongsheng@714
|
5291 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5292 #: ../en/ch03-tour-merge.xml:337
|
dongsheng@627
|
5293 msgid ""
|
dongsheng@627
|
5294 "Because <command>merge</command> can't resolve the conflicting changes, it "
|
dongsheng@627
|
5295 "leaves <emphasis>merge markers</emphasis> inside the file that has conflicts, "
|
dongsheng@627
|
5296 "indicating which lines have conflicts, and whether they came from our version "
|
dongsheng@627
|
5297 "of the file or theirs."
|
dongsheng@627
|
5298 msgstr ""
|
dongsheng@627
|
5299
|
dongsheng@627
|
5300 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5301 #: ../en/ch03-tour-merge.xml:343
|
dongsheng@627
|
5302 msgid ""
|
dongsheng@627
|
5303 "Mercurial can tell from the way <command>merge</command> exits that it wasn't "
|
dongsheng@627
|
5304 "able to merge successfully, so it tells us what commands we'll need to run if "
|
dongsheng@627
|
5305 "we want to redo the merging operation. This could be useful if, for example, "
|
dongsheng@627
|
5306 "we were running a graphical merge tool and quit because we were confused or "
|
dongsheng@627
|
5307 "realised we had made a mistake."
|
dongsheng@627
|
5308 msgstr ""
|
dongsheng@627
|
5309
|
dongsheng@627
|
5310 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5311 #: ../en/ch03-tour-merge.xml:350
|
dongsheng@627
|
5312 msgid ""
|
dongsheng@627
|
5313 "If automatic or manual merges fail, there's nothing to prevent us from "
|
dongsheng@627
|
5314 "<quote>fixing up</quote> the affected files ourselves, and committing the "
|
dongsheng@627
|
5315 "results of our merge:"
|
dongsheng@627
|
5316 msgstr ""
|
dongsheng@627
|
5317
|
dongsheng@714
|
5318 #. type: Content of: <book><chapter><sect1><sect2><note><title>
|
dongsheng@714
|
5319 #: ../en/ch03-tour-merge.xml:357
|
dongsheng@714
|
5320 msgid "Where is the <command>hg resolve</command> command?"
|
dongsheng@715
|
5321 msgstr "在哪里能找到 <command role=\"hg-cmd\">hg resolve</command> 命令?"
|
dongsheng@714
|
5322
|
dongsheng@714
|
5323 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@714
|
5324 #: ../en/ch03-tour-merge.xml:359
|
dongsheng@714
|
5325 msgid ""
|
dongsheng@714
|
5326 "The <command>hg resolve</command> command was introduced in Mercurial 1.1, "
|
dongsheng@714
|
5327 "which was released in December 2008. If you are using an older version of "
|
dongsheng@714
|
5328 "Mercurial (run <command>hg version</command> to see), this command will not "
|
dongsheng@714
|
5329 "be present. If your version of Mercurial is older than 1.1, you should "
|
dongsheng@714
|
5330 "strongly consider upgrading to a newer version before trying to tackle "
|
dongsheng@714
|
5331 "complicated merges."
|
dongsheng@714
|
5332 msgstr ""
|
dongsheng@714
|
5333
|
dongsheng@627
|
5334 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
5335 #: ../en/ch03-tour-merge.xml:371
|
dongsheng@627
|
5336 msgid "Simplifying the pull-merge-commit sequence"
|
dongsheng@627
|
5337 msgstr "简化拉-合并-提交程序"
|
dongsheng@627
|
5338
|
dongsheng@627
|
5339 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5340 #: ../en/ch03-tour-merge.xml:373
|
dongsheng@627
|
5341 msgid ""
|
dongsheng@627
|
5342 "The process of merging changes as outlined above is straightforward, but "
|
dongsheng@627
|
5343 "requires running three commands in sequence."
|
dongsheng@627
|
5344 msgstr ""
|
dongsheng@627
|
5345
|
dongsheng@627
|
5346 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5347 #: ../en/ch03-tour-merge.xml:379
|
dongsheng@627
|
5348 msgid ""
|
dongsheng@627
|
5349 "In the case of the final commit, you also need to enter a commit message, "
|
dongsheng@627
|
5350 "which is almost always going to be a piece of uninteresting "
|
dongsheng@627
|
5351 "<quote>boilerplate</quote> text."
|
dongsheng@627
|
5352 msgstr ""
|
dongsheng@627
|
5353
|
dongsheng@627
|
5354 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5355 #: ../en/ch03-tour-merge.xml:383
|
dongsheng@627
|
5356 msgid ""
|
dongsheng@627
|
5357 "It would be nice to reduce the number of steps needed, if this were "
|
dongsheng@627
|
5358 "possible. Indeed, Mercurial is distributed with an extension called <literal "
|
dongsheng@627
|
5359 "role=\"hg-ext\">fetch</literal> that does just this."
|
dongsheng@627
|
5360 msgstr ""
|
dongsheng@627
|
5361
|
dongsheng@627
|
5362 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5363 #: ../en/ch03-tour-merge.xml:388
|
dongsheng@627
|
5364 msgid ""
|
dongsheng@627
|
5365 "Mercurial provides a flexible extension mechanism that lets people extend its "
|
dongsheng@627
|
5366 "functionality, while keeping the core of Mercurial small and easy to deal "
|
dongsheng@627
|
5367 "with. Some extensions add new commands that you can use from the command "
|
dongsheng@627
|
5368 "line, while others work <quote>behind the scenes,</quote> for example adding "
|
dongsheng@714
|
5369 "capabilities to Mercurial's built-in server mode."
|
dongsheng@714
|
5370 msgstr ""
|
dongsheng@714
|
5371
|
dongsheng@714
|
5372 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5373 #: ../en/ch03-tour-merge.xml:395
|
dongsheng@627
|
5374 msgid ""
|
dongsheng@627
|
5375 "The <literal role=\"hg-ext\">fetch</literal> extension adds a new command "
|
dongsheng@627
|
5376 "called, not surprisingly, <command role=\"hg-cmd\">hg fetch</command>. This "
|
songdongsheng@710
|
5377 "extension acts as a combination of <command role=\"hg-cmd\">hg pull -u</"
|
songdongsheng@710
|
5378 "command>, <command role=\"hg-cmd\">hg merge</command> and <command role=\"hg-"
|
songdongsheng@710
|
5379 "cmd\">hg commit</command>. It begins by pulling changes from another "
|
dongsheng@627
|
5380 "repository into the current repository. If it finds that the changes added a "
|
dongsheng@714
|
5381 "new head to the repository, it updates to the new head, begins a merge, then "
|
dongsheng@714
|
5382 "(if the merge succeeded) commits the result of the merge with an "
|
dongsheng@714
|
5383 "automatically-generated commit message. If no new heads were added, it "
|
dongsheng@714
|
5384 "updates the working directory to the new tip changeset."
|
dongsheng@714
|
5385 msgstr ""
|
dongsheng@714
|
5386
|
dongsheng@714
|
5387 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5388 #: ../en/ch03-tour-merge.xml:409
|
dongsheng@627
|
5389 msgid ""
|
dongsheng@627
|
5390 "Enabling the <literal role=\"hg-ext\">fetch</literal> extension is easy. "
|
songdongsheng@710
|
5391 "Edit the <filename role=\"special\">.hgrc</filename> file in your home "
|
songdongsheng@710
|
5392 "directory, and either go to the <literal role=\"rc-extensions\">extensions</"
|
songdongsheng@710
|
5393 "literal> section or create an <literal role=\"rc-extensions\">extensions</"
|
songdongsheng@710
|
5394 "literal> section. Then add a line that simply reads <quote><literal>fetch=</"
|
songdongsheng@710
|
5395 "literal></quote>."
|
songdongsheng@710
|
5396 msgstr ""
|
songdongsheng@710
|
5397
|
songdongsheng@710
|
5398 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5399 #: ../en/ch03-tour-merge.xml:421
|
songdongsheng@710
|
5400 msgid ""
|
songdongsheng@710
|
5401 "(Normally, the right-hand side of the <quote><literal>=</literal></quote> "
|
songdongsheng@710
|
5402 "would indicate where to find the extension, but since the <literal role=\"hg-"
|
dongsheng@627
|
5403 "ext\">fetch</literal> extension is in the standard distribution, Mercurial "
|
dongsheng@627
|
5404 "knows where to search for it.)"
|
dongsheng@627
|
5405 msgstr ""
|
dongsheng@627
|
5406
|
dongsheng@714
|
5407 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
5408 #: ../en/ch03-tour-merge.xml:429
|
dongsheng@714
|
5409 msgid "Renaming, copying, and merging"
|
dongsheng@715
|
5410 msgstr "改名,复制与合并"
|
dongsheng@714
|
5411
|
dongsheng@714
|
5412 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5413 #: ../en/ch03-tour-merge.xml:431
|
dongsheng@714
|
5414 msgid ""
|
dongsheng@714
|
5415 "During the life of a project, we will often want to change the layout of its "
|
dongsheng@714
|
5416 "files and directories. This can be as simple as renaming a single file, or as "
|
dongsheng@714
|
5417 "complex as restructuring the entire hierarchy of files within the project."
|
dongsheng@714
|
5418 msgstr ""
|
dongsheng@714
|
5419
|
dongsheng@714
|
5420 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5421 #: ../en/ch03-tour-merge.xml:436
|
dongsheng@714
|
5422 msgid ""
|
dongsheng@714
|
5423 "Mercurial supports these kinds of complex changes fluently, provided we tell "
|
dongsheng@714
|
5424 "it what we're doing. If we want to rename a file, we should use the "
|
dongsheng@714
|
5425 "<command>hg rename</command><placeholder type=\"footnote\" id=\"0\"/> command "
|
dongsheng@714
|
5426 "to rename it, so that Mercurial can do the right thing later when we merge."
|
dongsheng@714
|
5427 msgstr ""
|
dongsheng@714
|
5428
|
dongsheng@714
|
5429 #. type: Content of: <book><chapter><sect1><para><footnote><para>
|
dongsheng@714
|
5430 #: ../en/ch03-tour-merge.xml:439
|
dongsheng@714
|
5431 msgid ""
|
dongsheng@714
|
5432 "If you're a Unix user, you'll be glad to know that the <command>hg rename</"
|
dongsheng@714
|
5433 "command> command can be abbreviated as <command>hg mv</command>."
|
dongsheng@714
|
5434 msgstr ""
|
dongsheng@714
|
5435
|
dongsheng@714
|
5436 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5437 #: ../en/ch03-tour-merge.xml:445
|
dongsheng@714
|
5438 msgid ""
|
dongsheng@714
|
5439 "We will cover the use of these commands in more detail in <xref linkend="
|
dongsheng@714
|
5440 "\"chap:daily.copy\"/>."
|
dongsheng@714
|
5441 msgstr ""
|
dongsheng@714
|
5442
|
dongsheng@627
|
5443 #. type: Content of: <book><chapter><title>
|
dongsheng@714
|
5444 #: ../en/ch04-concepts.xml:5
|
dongsheng@627
|
5445 msgid "Behind the scenes"
|
dongsheng@627
|
5446 msgstr "Mercurial 内幕"
|
dongsheng@627
|
5447
|
dongsheng@627
|
5448 #. type: Content of: <book><chapter><para>
|
dongsheng@714
|
5449 #: ../en/ch04-concepts.xml:7
|
dongsheng@627
|
5450 msgid ""
|
dongsheng@627
|
5451 "Unlike many revision control systems, the concepts upon which Mercurial is "
|
dongsheng@627
|
5452 "built are simple enough that it's easy to understand how the software really "
|
songdongsheng@710
|
5453 "works. Knowing these details certainly isn't necessary, so it is certainly "
|
songdongsheng@710
|
5454 "safe to skip this chapter. However, I think you will get more out of the "
|
songdongsheng@710
|
5455 "software with a <quote>mental model</quote> of what's going on."
|
dongsheng@627
|
5456 msgstr ""
|
dongsheng@627
|
5457
|
dongsheng@627
|
5458 #. type: Content of: <book><chapter><para>
|
dongsheng@714
|
5459 #: ../en/ch04-concepts.xml:14
|
songdongsheng@710
|
5460 msgid ""
|
songdongsheng@710
|
5461 "Being able to understand what's going on behind the scenes gives me "
|
songdongsheng@710
|
5462 "confidence that Mercurial has been carefully designed to be both "
|
songdongsheng@710
|
5463 "<emphasis>safe</emphasis> and <emphasis>efficient</emphasis>. And just as "
|
songdongsheng@710
|
5464 "importantly, if it's easy for me to retain a good idea of what the software "
|
songdongsheng@710
|
5465 "is doing when I perform a revision control task, I'm less likely to be "
|
songdongsheng@710
|
5466 "surprised by its behavior."
|
dongsheng@627
|
5467 msgstr ""
|
dongsheng@627
|
5468
|
dongsheng@627
|
5469 #. type: Content of: <book><chapter><para>
|
dongsheng@714
|
5470 #: ../en/ch04-concepts.xml:22
|
dongsheng@627
|
5471 msgid ""
|
dongsheng@627
|
5472 "In this chapter, we'll initially cover the core concepts behind Mercurial's "
|
dongsheng@627
|
5473 "design, then continue to discuss some of the interesting details of its "
|
dongsheng@627
|
5474 "implementation."
|
dongsheng@627
|
5475 msgstr ""
|
dongsheng@627
|
5476
|
dongsheng@627
|
5477 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
5478 #: ../en/ch04-concepts.xml:27
|
dongsheng@627
|
5479 msgid "Mercurial's historical record"
|
dongsheng@627
|
5480 msgstr "Mercurial 的历史记录"
|
dongsheng@627
|
5481
|
dongsheng@627
|
5482 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
5483 #: ../en/ch04-concepts.xml:30
|
dongsheng@627
|
5484 msgid "Tracking the history of a single file"
|
dongsheng@627
|
5485 msgstr "跟踪单一文件的历史"
|
dongsheng@627
|
5486
|
dongsheng@627
|
5487 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5488 #: ../en/ch04-concepts.xml:32
|
dongsheng@627
|
5489 msgid ""
|
dongsheng@627
|
5490 "When Mercurial tracks modifications to a file, it stores the history of that "
|
dongsheng@627
|
5491 "file in a metadata object called a <emphasis>filelog</emphasis>. Each entry "
|
dongsheng@627
|
5492 "in the filelog contains enough information to reconstruct one revision of the "
|
dongsheng@627
|
5493 "file that is being tracked. Filelogs are stored as files in the <filename "
|
dongsheng@627
|
5494 "role=\"special\" class=\"directory\">.hg/store/data</filename> directory. A "
|
dongsheng@627
|
5495 "filelog contains two kinds of information: revision data, and an index to "
|
dongsheng@627
|
5496 "help Mercurial to find a revision efficiently."
|
dongsheng@627
|
5497 msgstr ""
|
dongsheng@627
|
5498
|
dongsheng@627
|
5499 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5500 #: ../en/ch04-concepts.xml:43
|
dongsheng@627
|
5501 msgid ""
|
dongsheng@627
|
5502 "A file that is large, or has a lot of history, has its filelog stored in "
|
dongsheng@627
|
5503 "separate data (<quote><literal>.d</literal></quote> suffix) and index "
|
dongsheng@627
|
5504 "(<quote><literal>.i</literal></quote> suffix) files. For small files without "
|
dongsheng@627
|
5505 "much history, the revision data and index are combined in a single "
|
dongsheng@627
|
5506 "<quote><literal>.i</literal></quote> file. The correspondence between a file "
|
dongsheng@627
|
5507 "in the working directory and the filelog that tracks its history in the "
|
songdongsheng@658
|
5508 "repository is illustrated in <xref linkend=\"fig:concepts:filelog\"/>."
|
songdongsheng@658
|
5509 msgstr ""
|
songdongsheng@658
|
5510
|
songdongsheng@658
|
5511 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
|
dongsheng@714
|
5512 #: ../en/ch04-concepts.xml:55
|
dongsheng@627
|
5513 msgid ""
|
dongsheng@627
|
5514 "Relationships between files in working directory and filelogs in repository"
|
dongsheng@660
|
5515 msgstr "工作目录中的文件与版本库中的文件日志之间的关系"
|
dongsheng@627
|
5516
|
songdongsheng@658
|
5517 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
|
dongsheng@714
|
5518 #: ../en/ch04-concepts.xml:58
|
songdongsheng@658
|
5519 msgid "<imageobject><imagedata fileref=\"figs/filelog.png\"/></imageobject>"
|
songdongsheng@658
|
5520 msgstr ""
|
songdongsheng@658
|
5521
|
dongsheng@627
|
5522 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
5523 #: ../en/ch04-concepts.xml:65
|
dongsheng@627
|
5524 msgid "Managing tracked files"
|
dongsheng@627
|
5525 msgstr "管理跟踪的文件"
|
dongsheng@627
|
5526
|
dongsheng@627
|
5527 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5528 #: ../en/ch04-concepts.xml:67
|
dongsheng@627
|
5529 msgid ""
|
dongsheng@627
|
5530 "Mercurial uses a structure called a <emphasis>manifest</emphasis> to collect "
|
dongsheng@627
|
5531 "together information about the files that it tracks. Each entry in the "
|
dongsheng@627
|
5532 "manifest contains information about the files present in a single changeset. "
|
dongsheng@627
|
5533 "An entry records which files are present in the changeset, the revision of "
|
dongsheng@627
|
5534 "each file, and a few other pieces of file metadata."
|
dongsheng@627
|
5535 msgstr ""
|
dongsheng@627
|
5536
|
dongsheng@627
|
5537 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
5538 #: ../en/ch04-concepts.xml:77
|
dongsheng@627
|
5539 msgid "Recording changeset information"
|
dongsheng@627
|
5540 msgstr "记录修改集信息"
|
dongsheng@627
|
5541
|
dongsheng@627
|
5542 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5543 #: ../en/ch04-concepts.xml:79
|
dongsheng@627
|
5544 msgid ""
|
dongsheng@627
|
5545 "The <emphasis>changelog</emphasis> contains information about each "
|
dongsheng@627
|
5546 "changeset. Each revision records who committed a change, the changeset "
|
dongsheng@627
|
5547 "comment, other pieces of changeset-related information, and the revision of "
|
dongsheng@627
|
5548 "the manifest to use."
|
dongsheng@627
|
5549 msgstr ""
|
dongsheng@627
|
5550
|
dongsheng@627
|
5551 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
5552 #: ../en/ch04-concepts.xml:87
|
dongsheng@627
|
5553 msgid "Relationships between revisions"
|
dongsheng@627
|
5554 msgstr "版本之间的关系"
|
dongsheng@627
|
5555
|
dongsheng@627
|
5556 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5557 #: ../en/ch04-concepts.xml:89
|
dongsheng@627
|
5558 msgid ""
|
dongsheng@627
|
5559 "Within a changelog, a manifest, or a filelog, each revision stores a pointer "
|
dongsheng@627
|
5560 "to its immediate parent (or to its two parents, if it's a merge revision). "
|
dongsheng@627
|
5561 "As I mentioned above, there are also relationships between revisions "
|
dongsheng@627
|
5562 "<emphasis>across</emphasis> these structures, and they are hierarchical in "
|
dongsheng@627
|
5563 "nature."
|
dongsheng@627
|
5564 msgstr ""
|
dongsheng@627
|
5565
|
dongsheng@627
|
5566 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5567 #: ../en/ch04-concepts.xml:96
|
dongsheng@627
|
5568 msgid ""
|
dongsheng@627
|
5569 "For every changeset in a repository, there is exactly one revision stored in "
|
dongsheng@627
|
5570 "the changelog. Each revision of the changelog contains a pointer to a single "
|
dongsheng@627
|
5571 "revision of the manifest. A revision of the manifest stores a pointer to a "
|
dongsheng@627
|
5572 "single revision of each filelog tracked when that changeset was created. "
|
songdongsheng@658
|
5573 "These relationships are illustrated in <xref linkend=\"fig:concepts:metadata"
|
songdongsheng@658
|
5574 "\"/>."
|
songdongsheng@658
|
5575 msgstr ""
|
songdongsheng@658
|
5576
|
songdongsheng@658
|
5577 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
|
dongsheng@714
|
5578 #: ../en/ch04-concepts.xml:105
|
dongsheng@627
|
5579 msgid "Metadata relationships"
|
dongsheng@660
|
5580 msgstr "元数据之间的关系"
|
dongsheng@627
|
5581
|
songdongsheng@658
|
5582 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
|
dongsheng@714
|
5583 #: ../en/ch04-concepts.xml:107
|
songdongsheng@658
|
5584 msgid "<imageobject><imagedata fileref=\"figs/metadata.png\"/></imageobject>"
|
songdongsheng@658
|
5585 msgstr ""
|
songdongsheng@658
|
5586
|
songdongsheng@658
|
5587 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5588 #: ../en/ch04-concepts.xml:112
|
dongsheng@627
|
5589 msgid ""
|
dongsheng@627
|
5590 "As the illustration shows, there is <emphasis>not</emphasis> a <quote>one to "
|
dongsheng@627
|
5591 "one</quote> relationship between revisions in the changelog, manifest, or "
|
dongsheng@714
|
5592 "filelog. If a file that Mercurial tracks hasn't changed between two "
|
dongsheng@627
|
5593 "changesets, the entry for that file in the two revisions of the manifest will "
|
dongsheng@714
|
5594 "point to the same revision of its filelog<placeholder type=\"footnote\" id=\"0"
|
dongsheng@714
|
5595 "\"/>."
|
dongsheng@714
|
5596 msgstr ""
|
dongsheng@714
|
5597
|
dongsheng@714
|
5598 #. type: Content of: <book><chapter><sect1><sect2><para><footnote><para>
|
dongsheng@714
|
5599 #: ../en/ch04-concepts.xml:119
|
dongsheng@714
|
5600 msgid ""
|
dongsheng@714
|
5601 "It is possible (though unusual) for the manifest to remain the same between "
|
dongsheng@714
|
5602 "two changesets, in which case the changelog entries for those changesets will "
|
dongsheng@714
|
5603 "point to the same revision of the manifest."
|
dongsheng@627
|
5604 msgstr ""
|
dongsheng@627
|
5605
|
dongsheng@627
|
5606 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
5607 #: ../en/ch04-concepts.xml:128
|
dongsheng@627
|
5608 msgid "Safe, efficient storage"
|
dongsheng@627
|
5609 msgstr "安全,高效的存储"
|
dongsheng@627
|
5610
|
dongsheng@627
|
5611 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5612 #: ../en/ch04-concepts.xml:130
|
dongsheng@627
|
5613 msgid ""
|
dongsheng@627
|
5614 "The underpinnings of changelogs, manifests, and filelogs are provided by a "
|
dongsheng@627
|
5615 "single structure called the <emphasis>revlog</emphasis>."
|
dongsheng@627
|
5616 msgstr ""
|
dongsheng@627
|
5617
|
dongsheng@627
|
5618 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
5619 #: ../en/ch04-concepts.xml:135
|
dongsheng@627
|
5620 msgid "Efficient storage"
|
dongsheng@627
|
5621 msgstr "高效存储"
|
dongsheng@627
|
5622
|
dongsheng@627
|
5623 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5624 #: ../en/ch04-concepts.xml:137
|
dongsheng@627
|
5625 msgid ""
|
dongsheng@627
|
5626 "The revlog provides efficient storage of revisions using a <emphasis>delta</"
|
dongsheng@627
|
5627 "emphasis> mechanism. Instead of storing a complete copy of a file for each "
|
dongsheng@627
|
5628 "revision, it stores the changes needed to transform an older revision into "
|
dongsheng@627
|
5629 "the new revision. For many kinds of file data, these deltas are typically a "
|
dongsheng@627
|
5630 "fraction of a percent of the size of a full copy of a file."
|
dongsheng@627
|
5631 msgstr ""
|
dongsheng@627
|
5632
|
dongsheng@627
|
5633 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5634 #: ../en/ch04-concepts.xml:145
|
dongsheng@627
|
5635 msgid ""
|
dongsheng@627
|
5636 "Some obsolete revision control systems can only work with deltas of text "
|
dongsheng@627
|
5637 "files. They must either store binary files as complete snapshots or encoded "
|
dongsheng@627
|
5638 "into a text representation, both of which are wasteful approaches. Mercurial "
|
dongsheng@627
|
5639 "can efficiently handle deltas of files with arbitrary binary contents; it "
|
dongsheng@627
|
5640 "doesn't need to treat text as special."
|
dongsheng@627
|
5641 msgstr ""
|
dongsheng@627
|
5642
|
dongsheng@627
|
5643 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
5644 #: ../en/ch04-concepts.xml:154
|
dongsheng@627
|
5645 msgid "Safe operation"
|
dongsheng@627
|
5646 msgstr "安全操作"
|
dongsheng@627
|
5647
|
dongsheng@627
|
5648 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5649 #: ../en/ch04-concepts.xml:156
|
dongsheng@627
|
5650 msgid ""
|
dongsheng@627
|
5651 "Mercurial only ever <emphasis>appends</emphasis> data to the end of a revlog "
|
dongsheng@627
|
5652 "file. It never modifies a section of a file after it has written it. This is "
|
dongsheng@627
|
5653 "both more robust and efficient than schemes that need to modify or rewrite "
|
dongsheng@627
|
5654 "data."
|
dongsheng@627
|
5655 msgstr ""
|
dongsheng@627
|
5656
|
dongsheng@627
|
5657 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5658 #: ../en/ch04-concepts.xml:162
|
dongsheng@627
|
5659 msgid ""
|
dongsheng@627
|
5660 "In addition, Mercurial treats every write as part of a <emphasis>transaction</"
|
dongsheng@627
|
5661 "emphasis> that can span a number of files. A transaction is "
|
dongsheng@627
|
5662 "<emphasis>atomic</emphasis>: either the entire transaction succeeds and its "
|
dongsheng@627
|
5663 "effects are all visible to readers in one go, or the whole thing is undone. "
|
dongsheng@627
|
5664 "This guarantee of atomicity means that if you're running two copies of "
|
dongsheng@627
|
5665 "Mercurial, where one is reading data and one is writing it, the reader will "
|
dongsheng@627
|
5666 "never see a partially written result that might confuse it."
|
dongsheng@627
|
5667 msgstr ""
|
dongsheng@627
|
5668
|
dongsheng@627
|
5669 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5670 #: ../en/ch04-concepts.xml:172
|
dongsheng@627
|
5671 msgid ""
|
dongsheng@627
|
5672 "The fact that Mercurial only appends to files makes it easier to provide this "
|
dongsheng@627
|
5673 "transactional guarantee. The easier it is to do stuff like this, the more "
|
dongsheng@627
|
5674 "confident you should be that it's done correctly."
|
dongsheng@627
|
5675 msgstr ""
|
dongsheng@627
|
5676
|
dongsheng@627
|
5677 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
5678 #: ../en/ch04-concepts.xml:179
|
dongsheng@627
|
5679 msgid "Fast retrieval"
|
dongsheng@627
|
5680 msgstr "快速检索"
|
dongsheng@627
|
5681
|
dongsheng@627
|
5682 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5683 #: ../en/ch04-concepts.xml:181
|
dongsheng@627
|
5684 msgid ""
|
dongsheng@627
|
5685 "Mercurial cleverly avoids a pitfall common to all earlier revision control "
|
dongsheng@627
|
5686 "systems: the problem of <emphasis>inefficient retrieval</emphasis>. Most "
|
dongsheng@627
|
5687 "revision control systems store the contents of a revision as an incremental "
|
dongsheng@714
|
5688 "series of modifications against a <quote>snapshot</quote>. (Some base the "
|
dongsheng@714
|
5689 "snapshot on the oldest revision, others on the newest.) To reconstruct a "
|
dongsheng@627
|
5690 "specific revision, you must first read the snapshot, and then every one of "
|
dongsheng@627
|
5691 "the revisions between the snapshot and your target revision. The more "
|
dongsheng@627
|
5692 "history that a file accumulates, the more revisions you must read, hence the "
|
dongsheng@627
|
5693 "longer it takes to reconstruct a particular revision."
|
dongsheng@627
|
5694 msgstr ""
|
dongsheng@627
|
5695
|
songdongsheng@658
|
5696 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
|
dongsheng@714
|
5697 #: ../en/ch04-concepts.xml:195
|
songdongsheng@658
|
5698 msgid "Snapshot of a revlog, with incremental deltas"
|
dongsheng@660
|
5699 msgstr "版本日志的快照,以及增量差异"
|
songdongsheng@658
|
5700
|
songdongsheng@658
|
5701 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
|
dongsheng@714
|
5702 #: ../en/ch04-concepts.xml:197
|
songdongsheng@658
|
5703 msgid "<imageobject><imagedata fileref=\"figs/snapshot.png\"/></imageobject>"
|
songdongsheng@658
|
5704 msgstr ""
|
songdongsheng@658
|
5705
|
songdongsheng@658
|
5706 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5707 #: ../en/ch04-concepts.xml:202
|
dongsheng@627
|
5708 msgid ""
|
dongsheng@627
|
5709 "The innovation that Mercurial applies to this problem is simple but "
|
dongsheng@627
|
5710 "effective. Once the cumulative amount of delta information stored since the "
|
dongsheng@627
|
5711 "last snapshot exceeds a fixed threshold, it stores a new snapshot "
|
dongsheng@627
|
5712 "(compressed, of course), instead of another delta. This makes it possible to "
|
dongsheng@627
|
5713 "reconstruct <emphasis>any</emphasis> revision of a file quickly. This "
|
dongsheng@627
|
5714 "approach works so well that it has since been copied by several other "
|
dongsheng@627
|
5715 "revision control systems."
|
dongsheng@627
|
5716 msgstr ""
|
dongsheng@627
|
5717
|
dongsheng@627
|
5718 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5719 #: ../en/ch04-concepts.xml:211
|
songdongsheng@658
|
5720 msgid ""
|
songdongsheng@658
|
5721 "<xref linkend=\"fig:concepts:snapshot\"/> illustrates the idea. In an entry "
|
songdongsheng@658
|
5722 "in a revlog's index file, Mercurial stores the range of entries from the data "
|
songdongsheng@658
|
5723 "file that it must read to reconstruct a particular revision."
|
dongsheng@627
|
5724 msgstr ""
|
dongsheng@627
|
5725
|
dongsheng@627
|
5726 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
5727 #: ../en/ch04-concepts.xml:217
|
dongsheng@627
|
5728 msgid "Aside: the influence of video compression"
|
dongsheng@660
|
5729 msgstr "旁白: 视频压缩的影响"
|
dongsheng@627
|
5730
|
dongsheng@627
|
5731 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
5732 #: ../en/ch04-concepts.xml:219
|
dongsheng@627
|
5733 msgid ""
|
dongsheng@627
|
5734 "If you're familiar with video compression or have ever watched a TV feed "
|
dongsheng@627
|
5735 "through a digital cable or satellite service, you may know that most video "
|
dongsheng@627
|
5736 "compression schemes store each frame of video as a delta against its "
|
dongsheng@714
|
5737 "predecessor frame."
|
dongsheng@627
|
5738 msgstr ""
|
dongsheng@627
|
5739
|
dongsheng@627
|
5740 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
5741 #: ../en/ch04-concepts.xml:225
|
dongsheng@714
|
5742 msgid ""
|
dongsheng@714
|
5743 "Mercurial borrows this idea to make it possible to reconstruct a revision "
|
dongsheng@714
|
5744 "from a snapshot and a small number of deltas."
|
dongsheng@627
|
5745 msgstr ""
|
dongsheng@627
|
5746
|
dongsheng@627
|
5747 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
5748 #: ../en/ch04-concepts.xml:232
|
dongsheng@627
|
5749 msgid "Identification and strong integrity"
|
dongsheng@627
|
5750 msgstr "鉴别和强完整性"
|
dongsheng@627
|
5751
|
dongsheng@627
|
5752 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5753 #: ../en/ch04-concepts.xml:234
|
dongsheng@627
|
5754 msgid ""
|
dongsheng@627
|
5755 "Along with delta or snapshot information, a revlog entry contains a "
|
dongsheng@627
|
5756 "cryptographic hash of the data that it represents. This makes it difficult "
|
dongsheng@627
|
5757 "to forge the contents of a revision, and easy to detect accidental corruption."
|
dongsheng@627
|
5758 msgstr ""
|
dongsheng@627
|
5759
|
dongsheng@627
|
5760 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5761 #: ../en/ch04-concepts.xml:239
|
dongsheng@627
|
5762 msgid ""
|
dongsheng@627
|
5763 "Hashes provide more than a mere check against corruption; they are used as "
|
dongsheng@627
|
5764 "the identifiers for revisions. The changeset identification hashes that you "
|
dongsheng@627
|
5765 "see as an end user are from revisions of the changelog. Although filelogs "
|
dongsheng@627
|
5766 "and the manifest also use hashes, Mercurial only uses these behind the scenes."
|
dongsheng@627
|
5767 msgstr ""
|
dongsheng@627
|
5768
|
dongsheng@627
|
5769 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5770 #: ../en/ch04-concepts.xml:246
|
dongsheng@627
|
5771 msgid ""
|
dongsheng@627
|
5772 "Mercurial verifies that hashes are correct when it retrieves file revisions "
|
dongsheng@627
|
5773 "and when it pulls changes from another repository. If it encounters an "
|
dongsheng@627
|
5774 "integrity problem, it will complain and stop whatever it's doing."
|
dongsheng@627
|
5775 msgstr ""
|
dongsheng@627
|
5776
|
dongsheng@627
|
5777 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5778 #: ../en/ch04-concepts.xml:251
|
dongsheng@627
|
5779 msgid ""
|
dongsheng@627
|
5780 "In addition to the effect it has on retrieval efficiency, Mercurial's use of "
|
dongsheng@627
|
5781 "periodic snapshots makes it more robust against partial data corruption. If "
|
dongsheng@627
|
5782 "a revlog becomes partly corrupted due to a hardware error or system bug, it's "
|
dongsheng@627
|
5783 "often possible to reconstruct some or most revisions from the uncorrupted "
|
dongsheng@627
|
5784 "sections of the revlog, both before and after the corrupted section. This "
|
dongsheng@627
|
5785 "would not be possible with a delta-only storage model."
|
dongsheng@627
|
5786 msgstr ""
|
dongsheng@627
|
5787
|
dongsheng@627
|
5788 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
5789 #: ../en/ch04-concepts.xml:263
|
dongsheng@627
|
5790 msgid "Revision history, branching, and merging"
|
dongsheng@627
|
5791 msgstr "修订历史,分支与合并"
|
dongsheng@627
|
5792
|
dongsheng@627
|
5793 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5794 #: ../en/ch04-concepts.xml:265
|
dongsheng@627
|
5795 msgid ""
|
dongsheng@627
|
5796 "Every entry in a Mercurial revlog knows the identity of its immediate "
|
dongsheng@627
|
5797 "ancestor revision, usually referred to as its <emphasis>parent</emphasis>. "
|
dongsheng@627
|
5798 "In fact, a revision contains room for not one parent, but two. Mercurial "
|
dongsheng@627
|
5799 "uses a special hash, called the <quote>null ID</quote>, to represent the idea "
|
dongsheng@627
|
5800 "<quote>there is no parent here</quote>. This hash is simply a string of "
|
dongsheng@627
|
5801 "zeroes."
|
dongsheng@627
|
5802 msgstr ""
|
dongsheng@627
|
5803
|
dongsheng@627
|
5804 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5805 #: ../en/ch04-concepts.xml:273
|
songdongsheng@658
|
5806 msgid ""
|
songdongsheng@658
|
5807 "In <xref linkend=\"fig:concepts:revlog\"/>, you can see an example of the "
|
songdongsheng@658
|
5808 "conceptual structure of a revlog. Filelogs, manifests, and changelogs all "
|
songdongsheng@658
|
5809 "have this same structure; they differ only in the kind of data stored in each "
|
songdongsheng@658
|
5810 "delta or snapshot."
|
songdongsheng@658
|
5811 msgstr ""
|
songdongsheng@658
|
5812
|
songdongsheng@658
|
5813 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5814 #: ../en/ch04-concepts.xml:279
|
dongsheng@627
|
5815 msgid ""
|
dongsheng@627
|
5816 "The first revision in a revlog (at the bottom of the image) has the null ID "
|
dongsheng@627
|
5817 "in both of its parent slots. For a <quote>normal</quote> revision, its first "
|
dongsheng@627
|
5818 "parent slot contains the ID of its parent revision, and its second contains "
|
dongsheng@627
|
5819 "the null ID, indicating that the revision has only one real parent. Any two "
|
dongsheng@627
|
5820 "revisions that have the same parent ID are branches. A revision that "
|
dongsheng@627
|
5821 "represents a merge between branches has two normal revision IDs in its parent "
|
dongsheng@627
|
5822 "slots."
|
dongsheng@627
|
5823 msgstr ""
|
dongsheng@627
|
5824
|
songdongsheng@658
|
5825 #. type: Content of: <book><chapter><sect1><figure><title>
|
dongsheng@714
|
5826 #: ../en/ch04-concepts.xml:289
|
songdongsheng@658
|
5827 msgid "The conceptual structure of a revlog"
|
dongsheng@660
|
5828 msgstr "版本日志的设计结构"
|
songdongsheng@658
|
5829
|
songdongsheng@658
|
5830 #. type: Content of: <book><chapter><sect1><figure><mediaobject>
|
dongsheng@714
|
5831 #: ../en/ch04-concepts.xml:291
|
songdongsheng@658
|
5832 msgid "<imageobject><imagedata fileref=\"figs/revlog.png\"/></imageobject>"
|
dongsheng@641
|
5833 msgstr ""
|
dongsheng@641
|
5834
|
dongsheng@627
|
5835 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
5836 #: ../en/ch04-concepts.xml:298
|
dongsheng@627
|
5837 msgid "The working directory"
|
dongsheng@627
|
5838 msgstr "工作目录"
|
dongsheng@627
|
5839
|
dongsheng@627
|
5840 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5841 #: ../en/ch04-concepts.xml:300
|
dongsheng@627
|
5842 msgid ""
|
dongsheng@627
|
5843 "In the working directory, Mercurial stores a snapshot of the files from the "
|
dongsheng@627
|
5844 "repository as of a particular changeset."
|
dongsheng@627
|
5845 msgstr ""
|
dongsheng@627
|
5846
|
dongsheng@627
|
5847 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5848 #: ../en/ch04-concepts.xml:303
|
dongsheng@627
|
5849 msgid ""
|
dongsheng@627
|
5850 "The working directory <quote>knows</quote> which changeset it contains. When "
|
dongsheng@627
|
5851 "you update the working directory to contain a particular changeset, Mercurial "
|
dongsheng@627
|
5852 "looks up the appropriate revision of the manifest to find out which files it "
|
dongsheng@627
|
5853 "was tracking at the time that changeset was committed, and which revision of "
|
dongsheng@627
|
5854 "each file was then current. It then recreates a copy of each of those files, "
|
dongsheng@627
|
5855 "with the same contents it had when the changeset was committed."
|
dongsheng@627
|
5856 msgstr ""
|
dongsheng@627
|
5857
|
dongsheng@627
|
5858 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5859 #: ../en/ch04-concepts.xml:312
|
dongsheng@714
|
5860 msgid ""
|
dongsheng@714
|
5861 "The <emphasis>dirstate</emphasis> is a special structure that contains "
|
dongsheng@714
|
5862 "Mercurial's knowledge of the working directory. It is maintained as a file "
|
dongsheng@714
|
5863 "named <filename>.hg/dirstate</filename> inside a repository. The dirstate "
|
dongsheng@714
|
5864 "details which changeset the working directory is updated to, and all of the "
|
dongsheng@714
|
5865 "files that Mercurial is tracking in the working directory. It also lets "
|
dongsheng@714
|
5866 "Mercurial quickly notice changed files, by recording their checkout times and "
|
dongsheng@714
|
5867 "sizes."
|
dongsheng@714
|
5868 msgstr ""
|
dongsheng@714
|
5869
|
dongsheng@714
|
5870 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
5871 #: ../en/ch04-concepts.xml:322
|
dongsheng@627
|
5872 msgid ""
|
dongsheng@627
|
5873 "Just as a revision of a revlog has room for two parents, so that it can "
|
dongsheng@627
|
5874 "represent either a normal revision (with one parent) or a merge of two "
|
dongsheng@627
|
5875 "earlier revisions, the dirstate has slots for two parents. When you use the "
|
dongsheng@627
|
5876 "<command role=\"hg-cmd\">hg update</command> command, the changeset that you "
|
dongsheng@627
|
5877 "update to is stored in the <quote>first parent</quote> slot, and the null ID "
|
dongsheng@627
|
5878 "in the second. When you <command role=\"hg-cmd\">hg merge</command> with "
|
dongsheng@627
|
5879 "another changeset, the first parent remains unchanged, and the second parent "
|
dongsheng@627
|
5880 "is filled in with the changeset you're merging with. The <command role=\"hg-"
|
dongsheng@627
|
5881 "cmd\">hg parents</command> command tells you what the parents of the dirstate "
|
dongsheng@627
|
5882 "are."
|
dongsheng@627
|
5883 msgstr ""
|
dongsheng@627
|
5884
|
dongsheng@627
|
5885 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
5886 #: ../en/ch04-concepts.xml:336
|
dongsheng@627
|
5887 msgid "What happens when you commit"
|
dongsheng@627
|
5888 msgstr "当你提交时发生的事情"
|
dongsheng@627
|
5889
|
dongsheng@627
|
5890 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5891 #: ../en/ch04-concepts.xml:338
|
dongsheng@627
|
5892 msgid ""
|
dongsheng@627
|
5893 "The dirstate stores parent information for more than just book-keeping "
|
dongsheng@627
|
5894 "purposes. Mercurial uses the parents of the dirstate as <emphasis>the "
|
dongsheng@627
|
5895 "parents of a new changeset</emphasis> when you perform a commit."
|
dongsheng@627
|
5896 msgstr ""
|
dongsheng@627
|
5897
|
songdongsheng@658
|
5898 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
|
dongsheng@714
|
5899 #: ../en/ch04-concepts.xml:344
|
dongsheng@627
|
5900 msgid "The working directory can have two parents"
|
dongsheng@660
|
5901 msgstr "工作目录可以有两个父亲"
|
dongsheng@627
|
5902
|
songdongsheng@658
|
5903 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
|
dongsheng@714
|
5904 #: ../en/ch04-concepts.xml:346
|
songdongsheng@658
|
5905 msgid "<imageobject><imagedata fileref=\"figs/wdir.png\"/></imageobject>"
|
songdongsheng@658
|
5906 msgstr ""
|
songdongsheng@658
|
5907
|
songdongsheng@658
|
5908 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5909 #: ../en/ch04-concepts.xml:351
|
songdongsheng@658
|
5910 msgid ""
|
songdongsheng@658
|
5911 "<xref linkend=\"fig:concepts:wdir\"/> shows the normal state of the working "
|
songdongsheng@658
|
5912 "directory, where it has a single changeset as parent. That changeset is the "
|
songdongsheng@658
|
5913 "<emphasis>tip</emphasis>, the newest changeset in the repository that has no "
|
songdongsheng@658
|
5914 "children."
|
songdongsheng@658
|
5915 msgstr ""
|
songdongsheng@658
|
5916
|
songdongsheng@658
|
5917 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
|
dongsheng@714
|
5918 #: ../en/ch04-concepts.xml:358
|
dongsheng@627
|
5919 msgid "The working directory gains new parents after a commit"
|
dongsheng@660
|
5920 msgstr "提交之后,工作目录的父亲就改变了"
|
dongsheng@627
|
5921
|
songdongsheng@658
|
5922 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
|
dongsheng@714
|
5923 #: ../en/ch04-concepts.xml:361
|
songdongsheng@658
|
5924 msgid ""
|
songdongsheng@658
|
5925 "<imageobject><imagedata fileref=\"figs/wdir-after-commit.png\"/></imageobject>"
|
songdongsheng@658
|
5926 msgstr ""
|
songdongsheng@658
|
5927
|
songdongsheng@658
|
5928 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5929 #: ../en/ch04-concepts.xml:366
|
dongsheng@627
|
5930 msgid ""
|
dongsheng@627
|
5931 "It's useful to think of the working directory as <quote>the changeset I'm "
|
dongsheng@627
|
5932 "about to commit</quote>. Any files that you tell Mercurial that you've "
|
dongsheng@627
|
5933 "added, removed, renamed, or copied will be reflected in that changeset, as "
|
dongsheng@627
|
5934 "will modifications to any files that Mercurial is already tracking; the new "
|
dongsheng@627
|
5935 "changeset will have the parents of the working directory as its parents."
|
dongsheng@627
|
5936 msgstr ""
|
dongsheng@627
|
5937
|
dongsheng@627
|
5938 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5939 #: ../en/ch04-concepts.xml:374
|
dongsheng@627
|
5940 msgid ""
|
dongsheng@627
|
5941 "After a commit, Mercurial will update the parents of the working directory, "
|
dongsheng@627
|
5942 "so that the first parent is the ID of the new changeset, and the second is "
|
songdongsheng@658
|
5943 "the null ID. This is shown in <xref linkend=\"fig:concepts:wdir-after-commit"
|
songdongsheng@658
|
5944 "\"/>. Mercurial doesn't touch any of the files in the working directory when "
|
songdongsheng@658
|
5945 "you commit; it just modifies the dirstate to note its new parents."
|
dongsheng@641
|
5946 msgstr ""
|
dongsheng@641
|
5947
|
dongsheng@641
|
5948 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
5949 #: ../en/ch04-concepts.xml:385
|
dongsheng@627
|
5950 msgid "Creating a new head"
|
dongsheng@627
|
5951 msgstr "创建新顶点"
|
dongsheng@627
|
5952
|
dongsheng@627
|
5953 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5954 #: ../en/ch04-concepts.xml:387
|
dongsheng@627
|
5955 msgid ""
|
dongsheng@627
|
5956 "It's perfectly normal to update the working directory to a changeset other "
|
dongsheng@627
|
5957 "than the current tip. For example, you might want to know what your project "
|
dongsheng@627
|
5958 "looked like last Tuesday, or you could be looking through changesets to see "
|
dongsheng@627
|
5959 "which one introduced a bug. In cases like this, the natural thing to do is "
|
dongsheng@627
|
5960 "update the working directory to the changeset you're interested in, and then "
|
dongsheng@627
|
5961 "examine the files in the working directory directly to see their contents as "
|
dongsheng@627
|
5962 "they were when you committed that changeset. The effect of this is shown in "
|
songdongsheng@658
|
5963 "<xref linkend=\"fig:concepts:wdir-pre-branch\"/>."
|
songdongsheng@658
|
5964 msgstr ""
|
songdongsheng@658
|
5965
|
songdongsheng@658
|
5966 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
|
dongsheng@714
|
5967 #: ../en/ch04-concepts.xml:399
|
dongsheng@627
|
5968 msgid "The working directory, updated to an older changeset"
|
dongsheng@660
|
5969 msgstr "同步到旧修改集的工作目录"
|
dongsheng@627
|
5970
|
songdongsheng@658
|
5971 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
|
dongsheng@714
|
5972 #: ../en/ch04-concepts.xml:402
|
songdongsheng@658
|
5973 msgid ""
|
songdongsheng@658
|
5974 "<imageobject><imagedata fileref=\"figs/wdir-pre-branch.png\"/></imageobject>"
|
songdongsheng@658
|
5975 msgstr ""
|
songdongsheng@658
|
5976
|
songdongsheng@658
|
5977 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
5978 #: ../en/ch04-concepts.xml:407
|
dongsheng@627
|
5979 msgid ""
|
dongsheng@627
|
5980 "Having updated the working directory to an older changeset, what happens if "
|
dongsheng@627
|
5981 "you make some changes, and then commit? Mercurial behaves in the same way as "
|
dongsheng@627
|
5982 "I outlined above. The parents of the working directory become the parents of "
|
dongsheng@627
|
5983 "the new changeset. This new changeset has no children, so it becomes the new "
|
dongsheng@627
|
5984 "tip. And the repository now contains two changesets that have no children; "
|
dongsheng@627
|
5985 "we call these <emphasis>heads</emphasis>. You can see the structure that "
|
songdongsheng@658
|
5986 "this creates in <xref linkend=\"fig:concepts:wdir-branch\"/>."
|
songdongsheng@658
|
5987 msgstr ""
|
songdongsheng@658
|
5988
|
songdongsheng@658
|
5989 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
|
dongsheng@714
|
5990 #: ../en/ch04-concepts.xml:419
|
dongsheng@627
|
5991 msgid "After a commit made while synced to an older changeset"
|
dongsheng@660
|
5992 msgstr "对同步到旧修改集的工作目录提交之后"
|
dongsheng@627
|
5993
|
songdongsheng@658
|
5994 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
|
dongsheng@714
|
5995 #: ../en/ch04-concepts.xml:422
|
songdongsheng@658
|
5996 msgid "<imageobject><imagedata fileref=\"figs/wdir-branch.png\"/></imageobject>"
|
songdongsheng@658
|
5997 msgstr ""
|
songdongsheng@658
|
5998
|
dongsheng@627
|
5999 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@714
|
6000 #: ../en/ch04-concepts.xml:428
|
dongsheng@627
|
6001 msgid ""
|
dongsheng@627
|
6002 "If you're new to Mercurial, you should keep in mind a common <quote>error</"
|
dongsheng@627
|
6003 "quote>, which is to use the <command role=\"hg-cmd\">hg pull</command> "
|
dongsheng@627
|
6004 "command without any options. By default, the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
6005 "pull</command> command <emphasis>does not</emphasis> update the working "
|
dongsheng@627
|
6006 "directory, so you'll bring new changesets into your repository, but the "
|
dongsheng@627
|
6007 "working directory will stay synced at the same changeset as before the pull. "
|
dongsheng@627
|
6008 "If you make some changes and commit afterwards, you'll thus create a new "
|
dongsheng@627
|
6009 "head, because your working directory isn't synced to whatever the current tip "
|
dongsheng@714
|
6010 "is. To combine the operation of a pull, followed by an update, run "
|
dongsheng@714
|
6011 "<command>hg pull -u</command>."
|
dongsheng@627
|
6012 msgstr ""
|
dongsheng@627
|
6013
|
dongsheng@627
|
6014 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@714
|
6015 #: ../en/ch04-concepts.xml:442
|
dongsheng@627
|
6016 msgid ""
|
dongsheng@627
|
6017 "I put the word <quote>error</quote> in quotes because all that you need to do "
|
dongsheng@714
|
6018 "to rectify the situation where you created a new head by accident is <command "
|
dongsheng@714
|
6019 "role=\"hg-cmd\">hg merge</command>, then <command role=\"hg-cmd\">hg commit</"
|
dongsheng@714
|
6020 "command>. In other words, this almost never has negative consequences; it's "
|
dongsheng@714
|
6021 "just something of a surprise for newcomers. I'll discuss other ways to avoid "
|
dongsheng@714
|
6022 "this behavior, and why Mercurial behaves in this initially surprising way, "
|
dongsheng@714
|
6023 "later on."
|
songdongsheng@710
|
6024 msgstr ""
|
songdongsheng@710
|
6025
|
songdongsheng@710
|
6026 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
6027 #: ../en/ch04-concepts.xml:455
|
songdongsheng@710
|
6028 msgid "Merging changes"
|
songdongsheng@711
|
6029 msgstr "合并修改"
|
songdongsheng@710
|
6030
|
songdongsheng@710
|
6031 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6032 #: ../en/ch04-concepts.xml:457
|
dongsheng@627
|
6033 msgid ""
|
dongsheng@627
|
6034 "When you run the <command role=\"hg-cmd\">hg merge</command> command, "
|
dongsheng@627
|
6035 "Mercurial leaves the first parent of the working directory unchanged, and "
|
dongsheng@627
|
6036 "sets the second parent to the changeset you're merging with, as shown in "
|
songdongsheng@658
|
6037 "<xref linkend=\"fig:concepts:wdir-merge\"/>."
|
songdongsheng@658
|
6038 msgstr ""
|
songdongsheng@658
|
6039
|
songdongsheng@658
|
6040 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
|
dongsheng@714
|
6041 #: ../en/ch04-concepts.xml:464
|
dongsheng@627
|
6042 msgid "Merging two heads"
|
dongsheng@660
|
6043 msgstr "合并两个顶点"
|
dongsheng@627
|
6044
|
songdongsheng@658
|
6045 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
|
dongsheng@714
|
6046 #: ../en/ch04-concepts.xml:466
|
songdongsheng@658
|
6047 msgid ""
|
songdongsheng@658
|
6048 "<imageobject> <imagedata fileref=\"figs/wdir-merge.png\"/> </imageobject>"
|
songdongsheng@658
|
6049 msgstr ""
|
songdongsheng@658
|
6050
|
songdongsheng@658
|
6051 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6052 #: ../en/ch04-concepts.xml:473
|
dongsheng@627
|
6053 msgid ""
|
dongsheng@627
|
6054 "Mercurial also has to modify the working directory, to merge the files "
|
dongsheng@627
|
6055 "managed in the two changesets. Simplified a little, the merging process goes "
|
dongsheng@627
|
6056 "like this, for every file in the manifests of both changesets."
|
dongsheng@627
|
6057 msgstr ""
|
dongsheng@627
|
6058
|
dongsheng@627
|
6059 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
6060 #: ../en/ch04-concepts.xml:478
|
dongsheng@627
|
6061 msgid "If neither changeset has modified a file, do nothing with that file."
|
dongsheng@627
|
6062 msgstr ""
|
dongsheng@627
|
6063
|
dongsheng@627
|
6064 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
6065 #: ../en/ch04-concepts.xml:481
|
dongsheng@627
|
6066 msgid ""
|
dongsheng@627
|
6067 "If one changeset has modified a file, and the other hasn't, create the "
|
dongsheng@627
|
6068 "modified copy of the file in the working directory."
|
dongsheng@627
|
6069 msgstr ""
|
dongsheng@627
|
6070
|
dongsheng@627
|
6071 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
6072 #: ../en/ch04-concepts.xml:485
|
dongsheng@627
|
6073 msgid ""
|
dongsheng@627
|
6074 "If one changeset has removed a file, and the other hasn't (or has also "
|
dongsheng@627
|
6075 "deleted it), delete the file from the working directory."
|
dongsheng@627
|
6076 msgstr ""
|
dongsheng@627
|
6077
|
dongsheng@627
|
6078 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
6079 #: ../en/ch04-concepts.xml:489
|
dongsheng@627
|
6080 msgid ""
|
dongsheng@627
|
6081 "If one changeset has removed a file, but the other has modified the file, ask "
|
dongsheng@627
|
6082 "the user what to do: keep the modified file, or remove it?"
|
dongsheng@627
|
6083 msgstr ""
|
dongsheng@627
|
6084
|
dongsheng@627
|
6085 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
6086 #: ../en/ch04-concepts.xml:493
|
dongsheng@627
|
6087 msgid ""
|
dongsheng@627
|
6088 "If both changesets have modified a file, invoke an external merge program to "
|
dongsheng@627
|
6089 "choose the new contents for the merged file. This may require input from the "
|
dongsheng@627
|
6090 "user."
|
dongsheng@627
|
6091 msgstr ""
|
dongsheng@627
|
6092
|
dongsheng@627
|
6093 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
6094 #: ../en/ch04-concepts.xml:498
|
dongsheng@627
|
6095 msgid ""
|
dongsheng@627
|
6096 "If one changeset has modified a file, and the other has renamed or copied the "
|
dongsheng@627
|
6097 "file, make sure that the changes follow the new name of the file."
|
dongsheng@627
|
6098 msgstr ""
|
dongsheng@627
|
6099
|
dongsheng@627
|
6100 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6101 #: ../en/ch04-concepts.xml:502
|
dongsheng@627
|
6102 msgid ""
|
songdongsheng@668
|
6103 "There are more details&emdash;merging has plenty of corner cases&emdash;but "
|
songdongsheng@668
|
6104 "these are the most common choices that are involved in a merge. As you can "
|
songdongsheng@668
|
6105 "see, most cases are completely automatic, and indeed most merges finish "
|
dongsheng@627
|
6106 "automatically, without requiring your input to resolve any conflicts."
|
dongsheng@627
|
6107 msgstr ""
|
dongsheng@627
|
6108
|
dongsheng@627
|
6109 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6110 #: ../en/ch04-concepts.xml:509
|
dongsheng@627
|
6111 msgid ""
|
dongsheng@627
|
6112 "When you're thinking about what happens when you commit after a merge, once "
|
dongsheng@627
|
6113 "again the working directory is <quote>the changeset I'm about to commit</"
|
dongsheng@627
|
6114 "quote>. After the <command role=\"hg-cmd\">hg merge</command> command "
|
dongsheng@627
|
6115 "completes, the working directory has two parents; these will become the "
|
dongsheng@627
|
6116 "parents of the new changeset."
|
dongsheng@627
|
6117 msgstr ""
|
dongsheng@627
|
6118
|
dongsheng@627
|
6119 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6120 #: ../en/ch04-concepts.xml:516
|
dongsheng@627
|
6121 msgid ""
|
dongsheng@627
|
6122 "Mercurial lets you perform multiple merges, but you must commit the results "
|
dongsheng@627
|
6123 "of each individual merge as you go. This is necessary because Mercurial only "
|
dongsheng@627
|
6124 "tracks two parents for both revisions and the working directory. While it "
|
dongsheng@714
|
6125 "would be technically feasible to merge multiple changesets at once, Mercurial "
|
dongsheng@714
|
6126 "avoids this for simplicity. With multi-way merges, the risks of user "
|
dongsheng@714
|
6127 "confusion, nasty conflict resolution, and making a terrible mess of a merge "
|
dongsheng@714
|
6128 "would grow intolerable."
|
dongsheng@627
|
6129 msgstr ""
|
dongsheng@627
|
6130
|
songdongsheng@710
|
6131 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
6132 #: ../en/ch04-concepts.xml:529
|
songdongsheng@710
|
6133 msgid "Merging and renames"
|
songdongsheng@711
|
6134 msgstr "合并与改名"
|
songdongsheng@710
|
6135
|
songdongsheng@710
|
6136 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6137 #: ../en/ch04-concepts.xml:531
|
songdongsheng@710
|
6138 msgid ""
|
songdongsheng@710
|
6139 "A surprising number of revision control systems pay little or no attention to "
|
songdongsheng@710
|
6140 "a file's <emphasis>name</emphasis> over time. For instance, it used to be "
|
songdongsheng@710
|
6141 "common that if a file got renamed on one side of a merge, the changes from "
|
songdongsheng@710
|
6142 "the other side would be silently dropped."
|
songdongsheng@710
|
6143 msgstr ""
|
songdongsheng@710
|
6144
|
songdongsheng@710
|
6145 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6146 #: ../en/ch04-concepts.xml:537
|
songdongsheng@710
|
6147 msgid ""
|
songdongsheng@710
|
6148 "Mercurial records metadata when you tell it to perform a rename or copy. It "
|
songdongsheng@710
|
6149 "uses this metadata during a merge to do the right thing in the case of a "
|
songdongsheng@710
|
6150 "merge. For instance, if I rename a file, and you edit it without renaming "
|
songdongsheng@710
|
6151 "it, when we merge our work the file will be renamed and have your edits "
|
songdongsheng@710
|
6152 "applied."
|
songdongsheng@710
|
6153 msgstr ""
|
songdongsheng@710
|
6154
|
dongsheng@627
|
6155 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
6156 #: ../en/ch04-concepts.xml:547
|
dongsheng@627
|
6157 msgid "Other interesting design features"
|
dongsheng@627
|
6158 msgstr "其它有趣的设计特性"
|
dongsheng@627
|
6159
|
dongsheng@627
|
6160 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
6161 #: ../en/ch04-concepts.xml:549
|
dongsheng@627
|
6162 msgid ""
|
dongsheng@627
|
6163 "In the sections above, I've tried to highlight some of the most important "
|
dongsheng@627
|
6164 "aspects of Mercurial's design, to illustrate that it pays careful attention "
|
dongsheng@627
|
6165 "to reliability and performance. However, the attention to detail doesn't "
|
dongsheng@627
|
6166 "stop there. There are a number of other aspects of Mercurial's construction "
|
dongsheng@627
|
6167 "that I personally find interesting. I'll detail a few of them here, separate "
|
dongsheng@627
|
6168 "from the <quote>big ticket</quote> items above, so that if you're interested, "
|
dongsheng@627
|
6169 "you can gain a better idea of the amount of thinking that goes into a well-"
|
dongsheng@627
|
6170 "designed system."
|
dongsheng@627
|
6171 msgstr ""
|
dongsheng@627
|
6172
|
dongsheng@627
|
6173 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
6174 #: ../en/ch04-concepts.xml:560
|
dongsheng@627
|
6175 msgid "Clever compression"
|
dongsheng@627
|
6176 msgstr "智能压缩"
|
dongsheng@627
|
6177
|
dongsheng@627
|
6178 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6179 #: ../en/ch04-concepts.xml:562
|
dongsheng@627
|
6180 msgid ""
|
dongsheng@627
|
6181 "When appropriate, Mercurial will store both snapshots and deltas in "
|
dongsheng@627
|
6182 "compressed form. It does this by always <emphasis>trying to</emphasis> "
|
dongsheng@627
|
6183 "compress a snapshot or delta, but only storing the compressed version if it's "
|
dongsheng@627
|
6184 "smaller than the uncompressed version."
|
dongsheng@627
|
6185 msgstr ""
|
dongsheng@627
|
6186
|
dongsheng@627
|
6187 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6188 #: ../en/ch04-concepts.xml:568
|
dongsheng@627
|
6189 msgid ""
|
dongsheng@627
|
6190 "This means that Mercurial does <quote>the right thing</quote> when storing a "
|
dongsheng@627
|
6191 "file whose native form is compressed, such as a <literal>zip</literal> "
|
dongsheng@627
|
6192 "archive or a JPEG image. When these types of files are compressed a second "
|
dongsheng@627
|
6193 "time, the resulting file is usually bigger than the once-compressed form, and "
|
dongsheng@627
|
6194 "so Mercurial will store the plain <literal>zip</literal> or JPEG."
|
dongsheng@627
|
6195 msgstr ""
|
dongsheng@627
|
6196
|
dongsheng@627
|
6197 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6198 #: ../en/ch04-concepts.xml:576
|
dongsheng@627
|
6199 msgid ""
|
dongsheng@627
|
6200 "Deltas between revisions of a compressed file are usually larger than "
|
dongsheng@627
|
6201 "snapshots of the file, and Mercurial again does <quote>the right thing</"
|
dongsheng@627
|
6202 "quote> in these cases. It finds that such a delta exceeds the threshold at "
|
dongsheng@627
|
6203 "which it should store a complete snapshot of the file, so it stores the "
|
dongsheng@627
|
6204 "snapshot, again saving space compared to a naive delta-only approach."
|
dongsheng@627
|
6205 msgstr ""
|
dongsheng@627
|
6206
|
dongsheng@627
|
6207 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
6208 #: ../en/ch04-concepts.xml:585
|
dongsheng@627
|
6209 msgid "Network recompression"
|
dongsheng@627
|
6210 msgstr "网络重新压缩"
|
dongsheng@627
|
6211
|
dongsheng@627
|
6212 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
6213 #: ../en/ch04-concepts.xml:587
|
dongsheng@627
|
6214 msgid ""
|
dongsheng@627
|
6215 "When storing revisions on disk, Mercurial uses the <quote>deflate</quote> "
|
dongsheng@627
|
6216 "compression algorithm (the same one used by the popular <literal>zip</"
|
dongsheng@627
|
6217 "literal> archive format), which balances good speed with a respectable "
|
dongsheng@627
|
6218 "compression ratio. However, when transmitting revision data over a network "
|
dongsheng@627
|
6219 "connection, Mercurial uncompresses the compressed revision data."
|
dongsheng@627
|
6220 msgstr ""
|
dongsheng@627
|
6221
|
dongsheng@627
|
6222 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
6223 #: ../en/ch04-concepts.xml:595
|
dongsheng@627
|
6224 msgid ""
|
dongsheng@627
|
6225 "If the connection is over HTTP, Mercurial recompresses the entire stream of "
|
dongsheng@627
|
6226 "data using a compression algorithm that gives a better compression ratio (the "
|
dongsheng@627
|
6227 "Burrows-Wheeler algorithm from the widely used <literal>bzip2</literal> "
|
dongsheng@627
|
6228 "compression package). This combination of algorithm and compression of the "
|
dongsheng@627
|
6229 "entire stream (instead of a revision at a time) substantially reduces the "
|
dongsheng@627
|
6230 "number of bytes to be transferred, yielding better network performance over "
|
songdongsheng@710
|
6231 "most kinds of network."
|
dongsheng@627
|
6232 msgstr ""
|
dongsheng@627
|
6233
|
dongsheng@627
|
6234 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
6235 #: ../en/ch04-concepts.xml:605
|
dongsheng@714
|
6236 msgid ""
|
dongsheng@714
|
6237 "If the connection is over <command>ssh</command>, Mercurial "
|
dongsheng@627
|
6238 "<emphasis>doesn't</emphasis> recompress the stream, because <command>ssh</"
|
dongsheng@714
|
6239 "command> can already do this itself. You can tell Mercurial to always use "
|
dongsheng@714
|
6240 "<command>ssh</command>'s compression feature by editing the <filename>.hgrc</"
|
dongsheng@714
|
6241 "filename> file in your home directory as follows."
|
dongsheng@627
|
6242 msgstr ""
|
dongsheng@627
|
6243
|
dongsheng@627
|
6244 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
6245 #: ../en/ch04-concepts.xml:620
|
dongsheng@627
|
6246 msgid "Read/write ordering and atomicity"
|
dongsheng@627
|
6247 msgstr "读写顺序与原子性"
|
dongsheng@627
|
6248
|
dongsheng@627
|
6249 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6250 #: ../en/ch04-concepts.xml:622
|
dongsheng@627
|
6251 msgid ""
|
dongsheng@627
|
6252 "Appending to files isn't the whole story when it comes to guaranteeing that a "
|
songdongsheng@658
|
6253 "reader won't see a partial write. If you recall <xref linkend=\"fig:concepts:"
|
songdongsheng@658
|
6254 "metadata\"/>, revisions in the changelog point to revisions in the manifest, "
|
songdongsheng@658
|
6255 "and revisions in the manifest point to revisions in filelogs. This hierarchy "
|
songdongsheng@658
|
6256 "is deliberate."
|
songdongsheng@658
|
6257 msgstr ""
|
songdongsheng@658
|
6258
|
songdongsheng@658
|
6259 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6260 #: ../en/ch04-concepts.xml:629
|
dongsheng@627
|
6261 msgid ""
|
dongsheng@627
|
6262 "A writer starts a transaction by writing filelog and manifest data, and "
|
dongsheng@627
|
6263 "doesn't write any changelog data until those are finished. A reader starts "
|
dongsheng@627
|
6264 "by reading changelog data, then manifest data, followed by filelog data."
|
dongsheng@627
|
6265 msgstr ""
|
dongsheng@627
|
6266
|
dongsheng@627
|
6267 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6268 #: ../en/ch04-concepts.xml:634
|
dongsheng@627
|
6269 msgid ""
|
dongsheng@627
|
6270 "Since the writer has always finished writing filelog and manifest data before "
|
dongsheng@627
|
6271 "it writes to the changelog, a reader will never read a pointer to a partially "
|
dongsheng@627
|
6272 "written manifest revision from the changelog, and it will never read a "
|
dongsheng@627
|
6273 "pointer to a partially written filelog revision from the manifest."
|
dongsheng@627
|
6274 msgstr ""
|
dongsheng@627
|
6275
|
dongsheng@627
|
6276 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
6277 #: ../en/ch04-concepts.xml:642
|
dongsheng@627
|
6278 msgid "Concurrent access"
|
dongsheng@627
|
6279 msgstr "并发访问"
|
dongsheng@627
|
6280
|
dongsheng@627
|
6281 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6282 #: ../en/ch04-concepts.xml:644
|
dongsheng@627
|
6283 msgid ""
|
dongsheng@627
|
6284 "The read/write ordering and atomicity guarantees mean that Mercurial never "
|
dongsheng@627
|
6285 "needs to <emphasis>lock</emphasis> a repository when it's reading data, even "
|
dongsheng@627
|
6286 "if the repository is being written to while the read is occurring. This has a "
|
dongsheng@627
|
6287 "big effect on scalability; you can have an arbitrary number of Mercurial "
|
dongsheng@714
|
6288 "processes safely reading data from a repository all at once, no matter "
|
dongsheng@627
|
6289 "whether it's being written to or not."
|
dongsheng@627
|
6290 msgstr ""
|
dongsheng@627
|
6291
|
dongsheng@627
|
6292 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6293 #: ../en/ch04-concepts.xml:653
|
dongsheng@627
|
6294 msgid ""
|
dongsheng@627
|
6295 "The lockless nature of reading means that if you're sharing a repository on a "
|
dongsheng@627
|
6296 "multi-user system, you don't need to grant other local users permission to "
|
dongsheng@627
|
6297 "<emphasis>write</emphasis> to your repository in order for them to be able to "
|
dongsheng@627
|
6298 "clone it or pull changes from it; they only need <emphasis>read</emphasis> "
|
dongsheng@627
|
6299 "permission. (This is <emphasis>not</emphasis> a common feature among "
|
dongsheng@627
|
6300 "revision control systems, so don't take it for granted! Most require readers "
|
dongsheng@627
|
6301 "to be able to lock a repository to access it safely, and this requires write "
|
dongsheng@627
|
6302 "permission on at least one directory, which of course makes for all kinds of "
|
dongsheng@627
|
6303 "nasty and annoying security and administrative problems.)"
|
dongsheng@627
|
6304 msgstr ""
|
dongsheng@627
|
6305
|
dongsheng@627
|
6306 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6307 #: ../en/ch04-concepts.xml:666
|
dongsheng@627
|
6308 msgid ""
|
dongsheng@627
|
6309 "Mercurial uses locks to ensure that only one process can write to a "
|
dongsheng@627
|
6310 "repository at a time (the locking mechanism is safe even over filesystems "
|
dongsheng@627
|
6311 "that are notoriously hostile to locking, such as NFS). If a repository is "
|
dongsheng@627
|
6312 "locked, a writer will wait for a while to retry if the repository becomes "
|
dongsheng@627
|
6313 "unlocked, but if the repository remains locked for too long, the process "
|
dongsheng@627
|
6314 "attempting to write will time out after a while. This means that your daily "
|
dongsheng@627
|
6315 "automated scripts won't get stuck forever and pile up if a system crashes "
|
dongsheng@627
|
6316 "unnoticed, for example. (Yes, the timeout is configurable, from zero to "
|
dongsheng@627
|
6317 "infinity.)"
|
dongsheng@627
|
6318 msgstr ""
|
dongsheng@627
|
6319
|
dongsheng@627
|
6320 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
6321 #: ../en/ch04-concepts.xml:678
|
dongsheng@627
|
6322 msgid "Safe dirstate access"
|
dongsheng@627
|
6323 msgstr "安全的目录状态访问"
|
dongsheng@627
|
6324
|
dongsheng@627
|
6325 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
6326 #: ../en/ch04-concepts.xml:680
|
dongsheng@627
|
6327 msgid ""
|
dongsheng@627
|
6328 "As with revision data, Mercurial doesn't take a lock to read the dirstate "
|
dongsheng@627
|
6329 "file; it does acquire a lock to write it. To avoid the possibility of "
|
dongsheng@627
|
6330 "reading a partially written copy of the dirstate file, Mercurial writes to a "
|
dongsheng@627
|
6331 "file with a unique name in the same directory as the dirstate file, then "
|
dongsheng@627
|
6332 "renames the temporary file atomically to <filename>dirstate</filename>. The "
|
dongsheng@627
|
6333 "file named <filename>dirstate</filename> is thus guaranteed to be complete, "
|
dongsheng@627
|
6334 "not partially written."
|
dongsheng@627
|
6335 msgstr ""
|
dongsheng@627
|
6336
|
dongsheng@627
|
6337 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
6338 #: ../en/ch04-concepts.xml:693
|
dongsheng@627
|
6339 msgid "Avoiding seeks"
|
dongsheng@627
|
6340 msgstr "避免查找"
|
dongsheng@627
|
6341
|
dongsheng@627
|
6342 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6343 #: ../en/ch04-concepts.xml:695
|
dongsheng@627
|
6344 msgid ""
|
dongsheng@627
|
6345 "Critical to Mercurial's performance is the avoidance of seeks of the disk "
|
dongsheng@627
|
6346 "head, since any seek is far more expensive than even a comparatively large "
|
dongsheng@627
|
6347 "read operation."
|
dongsheng@627
|
6348 msgstr ""
|
dongsheng@627
|
6349
|
dongsheng@627
|
6350 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6351 #: ../en/ch04-concepts.xml:699
|
dongsheng@627
|
6352 msgid ""
|
dongsheng@627
|
6353 "This is why, for example, the dirstate is stored in a single file. If there "
|
dongsheng@627
|
6354 "were a dirstate file per directory that Mercurial tracked, the disk would "
|
dongsheng@627
|
6355 "seek once per directory. Instead, Mercurial reads the entire single dirstate "
|
dongsheng@627
|
6356 "file in one step."
|
dongsheng@627
|
6357 msgstr ""
|
dongsheng@627
|
6358
|
dongsheng@627
|
6359 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6360 #: ../en/ch04-concepts.xml:705
|
dongsheng@627
|
6361 msgid ""
|
dongsheng@627
|
6362 "Mercurial also uses a <quote>copy on write</quote> scheme when cloning a "
|
dongsheng@627
|
6363 "repository on local storage. Instead of copying every revlog file from the "
|
dongsheng@627
|
6364 "old repository into the new repository, it makes a <quote>hard link</quote>, "
|
dongsheng@627
|
6365 "which is a shorthand way to say <quote>these two names point to the same "
|
dongsheng@627
|
6366 "file</quote>. When Mercurial is about to write to one of a revlog's files, "
|
dongsheng@627
|
6367 "it checks to see if the number of names pointing at the file is greater than "
|
dongsheng@627
|
6368 "one. If it is, more than one repository is using the file, so Mercurial "
|
dongsheng@627
|
6369 "makes a new copy of the file that is private to this repository."
|
dongsheng@627
|
6370 msgstr ""
|
dongsheng@627
|
6371
|
dongsheng@627
|
6372 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6373 #: ../en/ch04-concepts.xml:716
|
dongsheng@627
|
6374 msgid ""
|
dongsheng@627
|
6375 "A few revision control developers have pointed out that this idea of making a "
|
dongsheng@627
|
6376 "complete private copy of a file is not very efficient in its use of storage. "
|
dongsheng@627
|
6377 "While this is true, storage is cheap, and this method gives the highest "
|
dongsheng@627
|
6378 "performance while deferring most book-keeping to the operating system. An "
|
dongsheng@627
|
6379 "alternative scheme would most likely reduce performance and increase the "
|
dongsheng@714
|
6380 "complexity of the software, but speed and simplicity are key to the "
|
dongsheng@627
|
6381 "<quote>feel</quote> of day-to-day use."
|
dongsheng@627
|
6382 msgstr ""
|
dongsheng@627
|
6383
|
dongsheng@627
|
6384 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
6385 #: ../en/ch04-concepts.xml:728
|
dongsheng@627
|
6386 msgid "Other contents of the dirstate"
|
dongsheng@627
|
6387 msgstr "目录状态的其它内容"
|
dongsheng@627
|
6388
|
dongsheng@627
|
6389 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6390 #: ../en/ch04-concepts.xml:730
|
dongsheng@627
|
6391 msgid ""
|
dongsheng@627
|
6392 "Because Mercurial doesn't force you to tell it when you're modifying a file, "
|
dongsheng@627
|
6393 "it uses the dirstate to store some extra information so it can determine "
|
dongsheng@627
|
6394 "efficiently whether you have modified a file. For each file in the working "
|
dongsheng@627
|
6395 "directory, it stores the time that it last modified the file itself, and the "
|
dongsheng@627
|
6396 "size of the file at that time."
|
dongsheng@627
|
6397 msgstr ""
|
dongsheng@627
|
6398
|
dongsheng@627
|
6399 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6400 #: ../en/ch04-concepts.xml:737
|
dongsheng@627
|
6401 msgid ""
|
dongsheng@627
|
6402 "When you explicitly <command role=\"hg-cmd\">hg add</command>, <command role="
|
dongsheng@627
|
6403 "\"hg-cmd\">hg remove</command>, <command role=\"hg-cmd\">hg rename</command> "
|
dongsheng@627
|
6404 "or <command role=\"hg-cmd\">hg copy</command> files, Mercurial updates the "
|
dongsheng@627
|
6405 "dirstate so that it knows what to do with those files when you commit."
|
dongsheng@627
|
6406 msgstr ""
|
dongsheng@627
|
6407
|
dongsheng@627
|
6408 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6409 #: ../en/ch04-concepts.xml:744
|
dongsheng@714
|
6410 msgid ""
|
dongsheng@714
|
6411 "The dirstate helps Mercurial to efficiently check the status of files in a "
|
dongsheng@714
|
6412 "repository."
|
dongsheng@714
|
6413 msgstr ""
|
dongsheng@714
|
6414
|
dongsheng@714
|
6415 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
6416 #: ../en/ch04-concepts.xml:749
|
dongsheng@714
|
6417 msgid ""
|
dongsheng@714
|
6418 "When Mercurial checks the state of a file in the working directory, it first "
|
dongsheng@714
|
6419 "checks a file's modification time against the time in the dirstate that "
|
dongsheng@714
|
6420 "records when Mercurial last wrote the file. If the last modified time is the "
|
dongsheng@714
|
6421 "same as the time when Mercurial wrote the file, the file must not have been "
|
dongsheng@714
|
6422 "modified, so Mercurial does not need to check any further."
|
dongsheng@714
|
6423 msgstr ""
|
dongsheng@714
|
6424
|
dongsheng@714
|
6425 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
6426 #: ../en/ch04-concepts.xml:758
|
dongsheng@714
|
6427 msgid ""
|
dongsheng@714
|
6428 "If the file's size has changed, the file must have been modified. If the "
|
dongsheng@714
|
6429 "modification time has changed, but the size has not, only then does Mercurial "
|
dongsheng@714
|
6430 "need to actually read the contents of the file to see if it has changed."
|
dongsheng@714
|
6431 msgstr ""
|
dongsheng@714
|
6432
|
dongsheng@714
|
6433 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6434 #: ../en/ch04-concepts.xml:766
|
dongsheng@714
|
6435 msgid ""
|
dongsheng@714
|
6436 "Storing the modification time and size dramatically reduces the number of "
|
dongsheng@714
|
6437 "read operations that Mercurial needs to perform when we run commands like "
|
dongsheng@714
|
6438 "<command>hg status</command>. This results in large performance improvements."
|
dongsheng@627
|
6439 msgstr ""
|
dongsheng@627
|
6440
|
dongsheng@627
|
6441 #. type: Content of: <book><chapter><title>
|
dongsheng@714
|
6442 #: ../en/ch05-daily.xml:5
|
dongsheng@627
|
6443 msgid "Mercurial in daily use"
|
dongsheng@627
|
6444 msgstr "Mercurial 的日常使用"
|
dongsheng@627
|
6445
|
dongsheng@627
|
6446 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
6447 #: ../en/ch05-daily.xml:8
|
dongsheng@627
|
6448 msgid "Telling Mercurial which files to track"
|
dongsheng@627
|
6449 msgstr "告诉 Mercurial 要跟踪哪些文件"
|
dongsheng@627
|
6450
|
dongsheng@627
|
6451 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
6452 #: ../en/ch05-daily.xml:10
|
dongsheng@627
|
6453 msgid ""
|
dongsheng@627
|
6454 "Mercurial does not work with files in your repository unless you tell it to "
|
dongsheng@627
|
6455 "manage them. The <command role=\"hg-cmd\">hg status</command> command will "
|
dongsheng@627
|
6456 "tell you which files Mercurial doesn't know about; it uses a <quote><literal>?"
|
dongsheng@627
|
6457 "</literal></quote> to display such files."
|
dongsheng@627
|
6458 msgstr ""
|
dongsheng@627
|
6459
|
dongsheng@627
|
6460 #
|
dongsheng@627
|
6461 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
6462 #: ../en/ch05-daily.xml:17
|
dongsheng@627
|
6463 msgid ""
|
dongsheng@627
|
6464 "To tell Mercurial to track a file, use the <command role=\"hg-cmd\">hg add</"
|
dongsheng@627
|
6465 "command> command. Once you have added a file, the entry in the output of "
|
dongsheng@627
|
6466 "<command role=\"hg-cmd\">hg status</command> for that file changes from "
|
dongsheng@627
|
6467 "<quote><literal>?</literal></quote> to <quote><literal>A</literal></quote>."
|
dongsheng@627
|
6468 msgstr ""
|
dongsheng@627
|
6469
|
dongsheng@627
|
6470 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
6471 #: ../en/ch05-daily.xml:26
|
dongsheng@627
|
6472 msgid ""
|
dongsheng@627
|
6473 "After you run a <command role=\"hg-cmd\">hg commit</command>, the files that "
|
dongsheng@627
|
6474 "you added before the commit will no longer be listed in the output of "
|
songdongsheng@710
|
6475 "<command role=\"hg-cmd\">hg status</command>. The reason for this is that by "
|
songdongsheng@710
|
6476 "default, <command role=\"hg-cmd\">hg status</command> only tells you about "
|
songdongsheng@710
|
6477 "<quote>interesting</quote> files&emdash;those that you have (for example) "
|
songdongsheng@710
|
6478 "modified, removed, or renamed. If you have a repository that contains "
|
songdongsheng@710
|
6479 "thousands of files, you will rarely want to know about files that Mercurial "
|
songdongsheng@710
|
6480 "is tracking, but that have not changed. (You can still get this information; "
|
songdongsheng@710
|
6481 "we'll return to this later.)"
|
dongsheng@627
|
6482 msgstr ""
|
dongsheng@627
|
6483
|
dongsheng@627
|
6484 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
6485 #: ../en/ch05-daily.xml:38
|
dongsheng@627
|
6486 msgid ""
|
dongsheng@627
|
6487 "Once you add a file, Mercurial doesn't do anything with it immediately. "
|
dongsheng@627
|
6488 "Instead, it will take a snapshot of the file's state the next time you "
|
dongsheng@627
|
6489 "perform a commit. It will then continue to track the changes you make to the "
|
dongsheng@627
|
6490 "file every time you commit, until you remove the file."
|
dongsheng@627
|
6491 msgstr ""
|
dongsheng@627
|
6492
|
dongsheng@627
|
6493 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
6494 #: ../en/ch05-daily.xml:45
|
dongsheng@627
|
6495 msgid "Explicit versus implicit file naming"
|
dongsheng@627
|
6496 msgstr "明确与隐含文件命名"
|
dongsheng@627
|
6497
|
dongsheng@627
|
6498 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6499 #: ../en/ch05-daily.xml:47
|
dongsheng@627
|
6500 msgid ""
|
songdongsheng@710
|
6501 "A useful behavior that Mercurial has is that if you pass the name of a "
|
dongsheng@627
|
6502 "directory to a command, every Mercurial command will treat this as <quote>I "
|
dongsheng@627
|
6503 "want to operate on every file in this directory and its subdirectories</"
|
dongsheng@627
|
6504 "quote>."
|
dongsheng@627
|
6505 msgstr ""
|
dongsheng@627
|
6506
|
dongsheng@627
|
6507 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6508 #: ../en/ch05-daily.xml:54
|
dongsheng@627
|
6509 msgid ""
|
dongsheng@627
|
6510 "Notice in this example that Mercurial printed the names of the files it "
|
songdongsheng@710
|
6511 "added, whereas it didn't do so when we added the file named <filename>myfile."
|
songdongsheng@710
|
6512 "txt</filename> in the earlier example."
|
dongsheng@627
|
6513 msgstr ""
|
dongsheng@627
|
6514
|
dongsheng@627
|
6515 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6516 #: ../en/ch05-daily.xml:59
|
dongsheng@627
|
6517 msgid ""
|
dongsheng@627
|
6518 "What's going on is that in the former case, we explicitly named the file to "
|
songdongsheng@710
|
6519 "add on the command line. The assumption that Mercurial makes in such cases "
|
songdongsheng@710
|
6520 "is that we know what we are doing, and it doesn't print any output."
|
dongsheng@627
|
6521 msgstr ""
|
dongsheng@627
|
6522
|
dongsheng@627
|
6523 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6524 #: ../en/ch05-daily.xml:64
|
dongsheng@627
|
6525 msgid ""
|
dongsheng@627
|
6526 "However, when we <emphasis>imply</emphasis> the names of files by giving the "
|
dongsheng@627
|
6527 "name of a directory, Mercurial takes the extra step of printing the name of "
|
dongsheng@627
|
6528 "each file that it does something with. This makes it more clear what is "
|
dongsheng@627
|
6529 "happening, and reduces the likelihood of a silent and nasty surprise. This "
|
songdongsheng@710
|
6530 "behavior is common to most Mercurial commands."
|
dongsheng@627
|
6531 msgstr ""
|
dongsheng@627
|
6532
|
dongsheng@627
|
6533 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
6534 #: ../en/ch05-daily.xml:73
|
songdongsheng@710
|
6535 msgid "Mercurial tracks files, not directories"
|
songdongsheng@711
|
6536 msgstr "Mercurial 只跟踪文件,不跟踪目录"
|
dongsheng@627
|
6537
|
dongsheng@627
|
6538 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6539 #: ../en/ch05-daily.xml:75
|
dongsheng@627
|
6540 msgid ""
|
dongsheng@627
|
6541 "Mercurial does not track directory information. Instead, it tracks the path "
|
dongsheng@627
|
6542 "to a file. Before creating a file, it first creates any missing directory "
|
dongsheng@627
|
6543 "components of the path. After it deletes a file, it then deletes any empty "
|
dongsheng@627
|
6544 "directories that were in the deleted file's path. This sounds like a trivial "
|
dongsheng@627
|
6545 "distinction, but it has one minor practical consequence: it is not possible "
|
dongsheng@627
|
6546 "to represent a completely empty directory in Mercurial."
|
dongsheng@627
|
6547 msgstr ""
|
dongsheng@627
|
6548
|
dongsheng@627
|
6549 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6550 #: ../en/ch05-daily.xml:84
|
dongsheng@627
|
6551 msgid ""
|
dongsheng@627
|
6552 "Empty directories are rarely useful, and there are unintrusive workarounds "
|
dongsheng@627
|
6553 "that you can use to achieve an appropriate effect. The developers of "
|
dongsheng@627
|
6554 "Mercurial thus felt that the complexity that would be required to manage "
|
dongsheng@627
|
6555 "empty directories was not worth the limited benefit this feature would bring."
|
dongsheng@627
|
6556 msgstr ""
|
dongsheng@627
|
6557
|
dongsheng@627
|
6558 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6559 #: ../en/ch05-daily.xml:91
|
dongsheng@627
|
6560 msgid ""
|
dongsheng@627
|
6561 "If you need an empty directory in your repository, there are a few ways to "
|
dongsheng@627
|
6562 "achieve this. One is to create a directory, then <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
6563 "add</command> a <quote>hidden</quote> file to that directory. On Unix-like "
|
dongsheng@627
|
6564 "systems, any file name that begins with a period (<quote><literal>.</"
|
dongsheng@627
|
6565 "literal></quote>) is treated as hidden by most commands and GUI tools. This "
|
dongsheng@627
|
6566 "approach is illustrated below."
|
dongsheng@627
|
6567 msgstr ""
|
dongsheng@627
|
6568
|
dongsheng@627
|
6569 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6570 #: ../en/ch05-daily.xml:102
|
dongsheng@627
|
6571 msgid ""
|
dongsheng@627
|
6572 "Another way to tackle a need for an empty directory is to simply create one "
|
dongsheng@627
|
6573 "in your automated build scripts before they will need it."
|
dongsheng@627
|
6574 msgstr ""
|
dongsheng@627
|
6575
|
dongsheng@627
|
6576 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
6577 #: ../en/ch05-daily.xml:109
|
dongsheng@627
|
6578 msgid "How to stop tracking a file"
|
dongsheng@627
|
6579 msgstr "如何停止跟踪文件"
|
dongsheng@627
|
6580
|
dongsheng@627
|
6581 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
6582 #: ../en/ch05-daily.xml:111
|
dongsheng@627
|
6583 msgid ""
|
dongsheng@627
|
6584 "Once you decide that a file no longer belongs in your repository, use the "
|
songdongsheng@710
|
6585 "<command role=\"hg-cmd\">hg remove</command> command. This deletes the file, "
|
dongsheng@714
|
6586 "and tells Mercurial to stop tracking it (which will occur at the next "
|
dongsheng@714
|
6587 "commit). A removed file is represented in the output of <command role=\"hg-"
|
dongsheng@714
|
6588 "cmd\">hg status</command> with a <quote><literal>R</literal></quote>."
|
dongsheng@714
|
6589 msgstr ""
|
dongsheng@714
|
6590
|
dongsheng@714
|
6591 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
6592 #: ../en/ch05-daily.xml:121
|
dongsheng@627
|
6593 msgid ""
|
dongsheng@627
|
6594 "After you <command role=\"hg-cmd\">hg remove</command> a file, Mercurial will "
|
dongsheng@627
|
6595 "no longer track changes to that file, even if you recreate a file with the "
|
dongsheng@627
|
6596 "same name in your working directory. If you do recreate a file with the same "
|
dongsheng@627
|
6597 "name and want Mercurial to track the new file, simply <command role=\"hg-cmd"
|
dongsheng@627
|
6598 "\">hg add</command> it. Mercurial will know that the newly added file is not "
|
dongsheng@627
|
6599 "related to the old file of the same name."
|
dongsheng@627
|
6600 msgstr ""
|
dongsheng@627
|
6601
|
dongsheng@627
|
6602 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
6603 #: ../en/ch05-daily.xml:130
|
dongsheng@627
|
6604 msgid "Removing a file does not affect its history"
|
dongsheng@627
|
6605 msgstr "删除文件不影响历史"
|
dongsheng@627
|
6606
|
dongsheng@627
|
6607 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6608 #: ../en/ch05-daily.xml:132
|
dongsheng@627
|
6609 msgid "It is important to understand that removing a file has only two effects."
|
dongsheng@627
|
6610 msgstr ""
|
dongsheng@627
|
6611
|
dongsheng@627
|
6612 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
6613 #: ../en/ch05-daily.xml:135
|
dongsheng@627
|
6614 msgid "It removes the current version of the file from the working directory."
|
dongsheng@627
|
6615 msgstr ""
|
dongsheng@627
|
6616
|
dongsheng@627
|
6617 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
6618 #: ../en/ch05-daily.xml:138
|
dongsheng@627
|
6619 msgid ""
|
dongsheng@627
|
6620 "It stops Mercurial from tracking changes to the file, from the time of the "
|
dongsheng@627
|
6621 "next commit."
|
dongsheng@627
|
6622 msgstr ""
|
dongsheng@627
|
6623
|
dongsheng@627
|
6624 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6625 #: ../en/ch05-daily.xml:141
|
dongsheng@627
|
6626 msgid ""
|
dongsheng@627
|
6627 "Removing a file <emphasis>does not</emphasis> in any way alter the "
|
dongsheng@627
|
6628 "<emphasis>history</emphasis> of the file."
|
dongsheng@627
|
6629 msgstr ""
|
dongsheng@627
|
6630
|
dongsheng@627
|
6631 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6632 #: ../en/ch05-daily.xml:144
|
dongsheng@627
|
6633 msgid ""
|
songdongsheng@710
|
6634 "If you update the working directory to a changeset that was committed when it "
|
songdongsheng@710
|
6635 "was still tracking a file that you later removed, the file will reappear in "
|
songdongsheng@710
|
6636 "the working directory, with the contents it had when you committed that "
|
songdongsheng@710
|
6637 "changeset. If you then update the working directory to a later changeset, in "
|
songdongsheng@710
|
6638 "which the file had been removed, Mercurial will once again remove the file "
|
songdongsheng@710
|
6639 "from the working directory."
|
songdongsheng@710
|
6640 msgstr ""
|
songdongsheng@710
|
6641
|
songdongsheng@710
|
6642 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
6643 #: ../en/ch05-daily.xml:155
|
dongsheng@627
|
6644 msgid "Missing files"
|
dongsheng@627
|
6645 msgstr "丢失的文件"
|
dongsheng@627
|
6646
|
dongsheng@627
|
6647 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6648 #: ../en/ch05-daily.xml:157
|
dongsheng@627
|
6649 msgid ""
|
dongsheng@627
|
6650 "Mercurial considers a file that you have deleted, but not used <command role="
|
dongsheng@627
|
6651 "\"hg-cmd\">hg remove</command> to delete, to be <emphasis>missing</"
|
dongsheng@627
|
6652 "emphasis>. A missing file is represented with <quote><literal>!</literal></"
|
dongsheng@627
|
6653 "quote> in the output of <command role=\"hg-cmd\">hg status</command>. "
|
dongsheng@627
|
6654 "Mercurial commands will not generally do anything with missing files."
|
dongsheng@627
|
6655 msgstr ""
|
dongsheng@627
|
6656
|
dongsheng@627
|
6657 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6658 #: ../en/ch05-daily.xml:167
|
dongsheng@627
|
6659 msgid ""
|
dongsheng@627
|
6660 "If your repository contains a file that <command role=\"hg-cmd\">hg status</"
|
dongsheng@627
|
6661 "command> reports as missing, and you want the file to stay gone, you can run "
|
dongsheng@627
|
6662 "<command role=\"hg-cmd\">hg remove <option role=\"hg-opt-remove\">--after</"
|
dongsheng@627
|
6663 "option></command> at any time later on, to tell Mercurial that you really did "
|
dongsheng@627
|
6664 "mean to remove the file."
|
dongsheng@627
|
6665 msgstr ""
|
dongsheng@627
|
6666
|
dongsheng@627
|
6667 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6668 #: ../en/ch05-daily.xml:177
|
dongsheng@627
|
6669 msgid ""
|
dongsheng@627
|
6670 "On the other hand, if you deleted the missing file by accident, give <command "
|
dongsheng@627
|
6671 "role=\"hg-cmd\">hg revert</command> the name of the file to recover. It will "
|
dongsheng@627
|
6672 "reappear, in unmodified form."
|
dongsheng@627
|
6673 msgstr ""
|
dongsheng@627
|
6674
|
dongsheng@627
|
6675 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
6676 #: ../en/ch05-daily.xml:186
|
dongsheng@627
|
6677 msgid "Aside: why tell Mercurial explicitly to remove a file?"
|
dongsheng@627
|
6678 msgstr "旁白: 为什么要明确告诉 Mercurial 删除文件?"
|
dongsheng@627
|
6679
|
dongsheng@627
|
6680 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6681 #: ../en/ch05-daily.xml:189
|
dongsheng@627
|
6682 msgid ""
|
dongsheng@627
|
6683 "You might wonder why Mercurial requires you to explicitly tell it that you "
|
dongsheng@627
|
6684 "are deleting a file. Early during the development of Mercurial, it let you "
|
dongsheng@627
|
6685 "delete a file however you pleased; Mercurial would notice the absence of the "
|
dongsheng@627
|
6686 "file automatically when you next ran a <command role=\"hg-cmd\">hg commit</"
|
dongsheng@627
|
6687 "command>, and stop tracking the file. In practice, this made it too easy to "
|
dongsheng@627
|
6688 "accidentally remove a file without noticing."
|
dongsheng@627
|
6689 msgstr ""
|
dongsheng@627
|
6690
|
dongsheng@627
|
6691 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
6692 #: ../en/ch05-daily.xml:200
|
songdongsheng@668
|
6693 msgid "Useful shorthand&emdash;adding and removing files in one step"
|
dongsheng@661
|
6694 msgstr "有用的速记—一个步骤添加和删除文件"
|
dongsheng@627
|
6695
|
dongsheng@627
|
6696 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6697 #: ../en/ch05-daily.xml:203
|
dongsheng@627
|
6698 msgid ""
|
dongsheng@627
|
6699 "Mercurial offers a combination command, <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
6700 "addremove</command>, that adds untracked files and marks missing files as "
|
dongsheng@627
|
6701 "removed."
|
dongsheng@627
|
6702 msgstr ""
|
dongsheng@627
|
6703
|
dongsheng@627
|
6704 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6705 #: ../en/ch05-daily.xml:209
|
dongsheng@627
|
6706 msgid ""
|
dongsheng@627
|
6707 "The <command role=\"hg-cmd\">hg commit</command> command also provides a "
|
dongsheng@627
|
6708 "<option role=\"hg-opt-commit\">-A</option> option that performs this same add-"
|
dongsheng@627
|
6709 "and-remove, immediately followed by a commit."
|
dongsheng@627
|
6710 msgstr ""
|
dongsheng@627
|
6711
|
dongsheng@627
|
6712 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
6713 #: ../en/ch05-daily.xml:219
|
dongsheng@627
|
6714 msgid "Copying files"
|
dongsheng@627
|
6715 msgstr "复制文件"
|
dongsheng@627
|
6716
|
dongsheng@627
|
6717 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
6718 #: ../en/ch05-daily.xml:221
|
dongsheng@627
|
6719 msgid ""
|
dongsheng@627
|
6720 "Mercurial provides a <command role=\"hg-cmd\">hg copy</command> command that "
|
dongsheng@627
|
6721 "lets you make a new copy of a file. When you copy a file using this command, "
|
dongsheng@627
|
6722 "Mercurial makes a record of the fact that the new file is a copy of the "
|
dongsheng@627
|
6723 "original file. It treats these copied files specially when you merge your "
|
dongsheng@627
|
6724 "work with someone else's."
|
dongsheng@627
|
6725 msgstr ""
|
dongsheng@627
|
6726
|
dongsheng@627
|
6727 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
6728 #: ../en/ch05-daily.xml:229
|
dongsheng@627
|
6729 msgid "The results of copying during a merge"
|
dongsheng@627
|
6730 msgstr "合并期间的复制结果"
|
dongsheng@627
|
6731
|
dongsheng@627
|
6732 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6733 #: ../en/ch05-daily.xml:231
|
dongsheng@627
|
6734 msgid ""
|
dongsheng@627
|
6735 "What happens during a merge is that changes <quote>follow</quote> a copy. To "
|
dongsheng@627
|
6736 "best illustrate what this means, let's create an example. We'll start with "
|
dongsheng@627
|
6737 "the usual tiny repository that contains a single file."
|
dongsheng@627
|
6738 msgstr ""
|
dongsheng@627
|
6739
|
dongsheng@627
|
6740 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6741 #: ../en/ch05-daily.xml:238
|
dongsheng@627
|
6742 msgid ""
|
dongsheng@627
|
6743 "We need to do some work in parallel, so that we'll have something to merge. "
|
dongsheng@627
|
6744 "So let's clone our repository."
|
dongsheng@627
|
6745 msgstr ""
|
dongsheng@627
|
6746
|
dongsheng@627
|
6747 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6748 #: ../en/ch05-daily.xml:244
|
dongsheng@627
|
6749 msgid ""
|
dongsheng@627
|
6750 "Back in our initial repository, let's use the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
6751 "copy</command> command to make a copy of the first file we created."
|
dongsheng@627
|
6752 msgstr ""
|
dongsheng@627
|
6753
|
dongsheng@627
|
6754 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6755 #: ../en/ch05-daily.xml:250
|
dongsheng@627
|
6756 msgid ""
|
dongsheng@627
|
6757 "If we look at the output of the <command role=\"hg-cmd\">hg status</command> "
|
dongsheng@627
|
6758 "command afterwards, the copied file looks just like a normal added file."
|
dongsheng@627
|
6759 msgstr ""
|
dongsheng@627
|
6760
|
dongsheng@627
|
6761 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6762 #: ../en/ch05-daily.xml:256
|
dongsheng@627
|
6763 msgid ""
|
dongsheng@627
|
6764 "But if we pass the <option role=\"hg-opt-status\">-C</option> option to "
|
dongsheng@627
|
6765 "<command role=\"hg-cmd\">hg status</command>, it prints another line of "
|
dongsheng@627
|
6766 "output: this is the file that our newly-added file was copied <emphasis>from</"
|
dongsheng@627
|
6767 "emphasis>."
|
dongsheng@627
|
6768 msgstr ""
|
dongsheng@627
|
6769
|
dongsheng@627
|
6770 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6771 #: ../en/ch05-daily.xml:264
|
dongsheng@627
|
6772 msgid ""
|
dongsheng@627
|
6773 "Now, back in the repository we cloned, let's make a change in parallel. "
|
dongsheng@627
|
6774 "We'll add a line of content to the original file that we created."
|
dongsheng@627
|
6775 msgstr ""
|
dongsheng@627
|
6776
|
dongsheng@627
|
6777 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6778 #: ../en/ch05-daily.xml:270
|
dongsheng@627
|
6779 msgid ""
|
dongsheng@627
|
6780 "Now we have a modified <filename>file</filename> in this repository. When we "
|
dongsheng@627
|
6781 "pull the changes from the first repository, and merge the two heads, "
|
dongsheng@627
|
6782 "Mercurial will propagate the changes that we made locally to <filename>file</"
|
dongsheng@627
|
6783 "filename> into its copy, <filename>new-file</filename>."
|
dongsheng@627
|
6784 msgstr ""
|
dongsheng@627
|
6785
|
dongsheng@627
|
6786 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
6787 #: ../en/ch05-daily.xml:280
|
dongsheng@627
|
6788 msgid "Why should changes follow copies?"
|
dongsheng@627
|
6789 msgstr "为什么复制后需要后续修改?"
|
dongsheng@627
|
6790
|
dongsheng@627
|
6791 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6792 #: ../en/ch05-daily.xml:282
|
songdongsheng@710
|
6793 msgid ""
|
songdongsheng@710
|
6794 "This behavior&emdash;of changes to a file propagating out to copies of the "
|
songdongsheng@710
|
6795 "file&emdash;might seem esoteric, but in most cases it's highly desirable."
|
songdongsheng@710
|
6796 msgstr ""
|
songdongsheng@710
|
6797
|
songdongsheng@710
|
6798 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6799 #: ../en/ch05-daily.xml:286
|
dongsheng@627
|
6800 msgid ""
|
dongsheng@627
|
6801 "First of all, remember that this propagation <emphasis>only</emphasis> "
|
dongsheng@627
|
6802 "happens when you merge. So if you <command role=\"hg-cmd\">hg copy</command> "
|
dongsheng@627
|
6803 "a file, and subsequently modify the original file during the normal course of "
|
dongsheng@627
|
6804 "your work, nothing will happen."
|
dongsheng@627
|
6805 msgstr ""
|
dongsheng@627
|
6806
|
dongsheng@627
|
6807 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6808 #: ../en/ch05-daily.xml:292
|
dongsheng@627
|
6809 msgid ""
|
dongsheng@627
|
6810 "The second thing to know is that modifications will only propagate across a "
|
songdongsheng@710
|
6811 "copy as long as the changeset that you're merging changes from "
|
songdongsheng@710
|
6812 "<emphasis>hasn't yet seen</emphasis> the copy."
|
songdongsheng@710
|
6813 msgstr ""
|
songdongsheng@710
|
6814
|
songdongsheng@710
|
6815 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6816 #: ../en/ch05-daily.xml:297
|
dongsheng@627
|
6817 msgid ""
|
dongsheng@627
|
6818 "The reason that Mercurial does this is as follows. Let's say I make an "
|
dongsheng@627
|
6819 "important bug fix in a source file, and commit my changes. Meanwhile, you've "
|
dongsheng@627
|
6820 "decided to <command role=\"hg-cmd\">hg copy</command> the file in your "
|
dongsheng@627
|
6821 "repository, without knowing about the bug or having seen the fix, and you "
|
dongsheng@627
|
6822 "have started hacking on your copy of the file."
|
dongsheng@627
|
6823 msgstr ""
|
dongsheng@627
|
6824
|
dongsheng@627
|
6825 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6826 #: ../en/ch05-daily.xml:304
|
dongsheng@627
|
6827 msgid ""
|
dongsheng@627
|
6828 "If you pulled and merged my changes, and Mercurial <emphasis>didn't</"
|
songdongsheng@710
|
6829 "emphasis> propagate changes across copies, your new source file would now "
|
songdongsheng@710
|
6830 "contain the bug, and unless you knew to propagate the bug fix by hand, the "
|
songdongsheng@710
|
6831 "bug would <emphasis>remain</emphasis> in your copy of the file."
|
songdongsheng@710
|
6832 msgstr ""
|
songdongsheng@710
|
6833
|
songdongsheng@710
|
6834 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6835 #: ../en/ch05-daily.xml:310
|
dongsheng@627
|
6836 msgid ""
|
dongsheng@627
|
6837 "By automatically propagating the change that fixed the bug from the original "
|
dongsheng@627
|
6838 "file to the copy, Mercurial prevents this class of problem. To my knowledge, "
|
dongsheng@627
|
6839 "Mercurial is the <emphasis>only</emphasis> revision control system that "
|
dongsheng@627
|
6840 "propagates changes across copies like this."
|
dongsheng@627
|
6841 msgstr ""
|
dongsheng@627
|
6842
|
dongsheng@627
|
6843 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6844 #: ../en/ch05-daily.xml:316
|
dongsheng@627
|
6845 msgid ""
|
dongsheng@627
|
6846 "Once your change history has a record that the copy and subsequent merge "
|
dongsheng@627
|
6847 "occurred, there's usually no further need to propagate changes from the "
|
dongsheng@627
|
6848 "original file to the copied file, and that's why Mercurial only propagates "
|
songdongsheng@710
|
6849 "changes across copies at the first merge, and not afterwards."
|
songdongsheng@710
|
6850 msgstr ""
|
songdongsheng@710
|
6851
|
songdongsheng@710
|
6852 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
6853 #: ../en/ch05-daily.xml:324
|
dongsheng@627
|
6854 msgid "How to make changes <emphasis>not</emphasis> follow a copy"
|
dongsheng@627
|
6855 msgstr "如何让复制后<emphasis>不</emphasis>修改?"
|
dongsheng@627
|
6856
|
dongsheng@627
|
6857 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6858 #: ../en/ch05-daily.xml:327
|
dongsheng@627
|
6859 msgid ""
|
dongsheng@627
|
6860 "If, for some reason, you decide that this business of automatically "
|
dongsheng@627
|
6861 "propagating changes across copies is not for you, simply use your system's "
|
dongsheng@627
|
6862 "normal file copy command (on Unix-like systems, that's <command>cp</command>) "
|
dongsheng@627
|
6863 "to make a copy of a file, then <command role=\"hg-cmd\">hg add</command> the "
|
songdongsheng@658
|
6864 "new copy by hand. Before you do so, though, please do reread <xref linkend="
|
songdongsheng@710
|
6865 "\"sec:daily:why-copy\"/>, and make an informed decision that this behavior is "
|
songdongsheng@710
|
6866 "not appropriate to your specific case."
|
songdongsheng@710
|
6867 msgstr ""
|
songdongsheng@710
|
6868
|
songdongsheng@710
|
6869 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
6870 #: ../en/ch05-daily.xml:340
|
songdongsheng@710
|
6871 msgid "Behavior of the <command role=\"hg-cmd\">hg copy</command> command"
|
dongsheng@627
|
6872 msgstr "命令 <command role=\"hg-cmd\">hg copy</command> 的特性"
|
dongsheng@627
|
6873
|
dongsheng@627
|
6874 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6875 #: ../en/ch05-daily.xml:343
|
dongsheng@627
|
6876 msgid ""
|
dongsheng@627
|
6877 "When you use the <command role=\"hg-cmd\">hg copy</command> command, "
|
dongsheng@627
|
6878 "Mercurial makes a copy of each source file as it currently stands in the "
|
dongsheng@627
|
6879 "working directory. This means that if you make some modifications to a file, "
|
dongsheng@627
|
6880 "then <command role=\"hg-cmd\">hg copy</command> it without first having "
|
dongsheng@627
|
6881 "committed those changes, the new copy will also contain the modifications you "
|
songdongsheng@710
|
6882 "have made up until that point. (I find this behavior a little "
|
dongsheng@627
|
6883 "counterintuitive, which is why I mention it here.)"
|
dongsheng@627
|
6884 msgstr ""
|
dongsheng@627
|
6885
|
dongsheng@627
|
6886 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6887 #: ../en/ch05-daily.xml:353
|
dongsheng@627
|
6888 msgid ""
|
dongsheng@627
|
6889 "The <command role=\"hg-cmd\">hg copy</command> command acts similarly to the "
|
dongsheng@627
|
6890 "Unix <command>cp</command> command (you can use the <command role=\"hg-cmd"
|
songdongsheng@710
|
6891 "\">hg cp</command> alias if you prefer). We must supply two or more "
|
songdongsheng@710
|
6892 "arguments, of which the last is treated as the <emphasis>destination</"
|
songdongsheng@710
|
6893 "emphasis>, and all others are <emphasis>sources</emphasis>."
|
songdongsheng@710
|
6894 msgstr ""
|
songdongsheng@710
|
6895
|
songdongsheng@710
|
6896 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6897 #: ../en/ch05-daily.xml:361
|
songdongsheng@710
|
6898 msgid ""
|
songdongsheng@710
|
6899 "If you pass <command role=\"hg-cmd\">hg copy</command> a single file as the "
|
songdongsheng@710
|
6900 "source, and the destination does not exist, it creates a new file with that "
|
songdongsheng@710
|
6901 "name."
|
songdongsheng@710
|
6902 msgstr ""
|
songdongsheng@710
|
6903
|
songdongsheng@710
|
6904 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6905 #: ../en/ch05-daily.xml:367
|
dongsheng@627
|
6906 msgid ""
|
dongsheng@627
|
6907 "If the destination is a directory, Mercurial copies its sources into that "
|
dongsheng@627
|
6908 "directory."
|
dongsheng@627
|
6909 msgstr ""
|
dongsheng@627
|
6910
|
dongsheng@627
|
6911 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6912 #: ../en/ch05-daily.xml:372
|
dongsheng@627
|
6913 msgid ""
|
dongsheng@627
|
6914 "Copying a directory is recursive, and preserves the directory structure of "
|
dongsheng@627
|
6915 "the source."
|
dongsheng@627
|
6916 msgstr ""
|
dongsheng@627
|
6917
|
dongsheng@627
|
6918 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6919 #: ../en/ch05-daily.xml:378
|
dongsheng@627
|
6920 msgid ""
|
dongsheng@627
|
6921 "If the source and destination are both directories, the source tree is "
|
dongsheng@627
|
6922 "recreated in the destination directory."
|
dongsheng@627
|
6923 msgstr ""
|
dongsheng@627
|
6924
|
songdongsheng@710
|
6925 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6926 #: ../en/ch05-daily.xml:383
|
songdongsheng@710
|
6927 msgid ""
|
songdongsheng@710
|
6928 "As with the <command role=\"hg-cmd\">hg remove</command> command, if you copy "
|
dongsheng@627
|
6929 "a file manually and then want Mercurial to know that you've copied the file, "
|
dongsheng@627
|
6930 "simply use the <option role=\"hg-opt-copy\">--after</option> option to "
|
dongsheng@627
|
6931 "<command role=\"hg-cmd\">hg copy</command>."
|
dongsheng@627
|
6932 msgstr ""
|
dongsheng@627
|
6933
|
dongsheng@627
|
6934 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
6935 #: ../en/ch05-daily.xml:394
|
dongsheng@627
|
6936 msgid "Renaming files"
|
dongsheng@627
|
6937 msgstr "改名文件"
|
dongsheng@627
|
6938
|
dongsheng@627
|
6939 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
6940 #: ../en/ch05-daily.xml:396
|
dongsheng@627
|
6941 msgid ""
|
dongsheng@627
|
6942 "It's rather more common to need to rename a file than to make a copy of it. "
|
dongsheng@627
|
6943 "The reason I discussed the <command role=\"hg-cmd\">hg copy</command> command "
|
dongsheng@627
|
6944 "before talking about renaming files is that Mercurial treats a rename in "
|
dongsheng@627
|
6945 "essentially the same way as a copy. Therefore, knowing what Mercurial does "
|
dongsheng@627
|
6946 "when you copy a file tells you what to expect when you rename a file."
|
dongsheng@627
|
6947 msgstr ""
|
dongsheng@627
|
6948
|
dongsheng@627
|
6949 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
6950 #: ../en/ch05-daily.xml:404
|
dongsheng@627
|
6951 msgid ""
|
dongsheng@627
|
6952 "When you use the <command role=\"hg-cmd\">hg rename</command> command, "
|
dongsheng@627
|
6953 "Mercurial makes a copy of each source file, then deletes it and marks the "
|
dongsheng@627
|
6954 "file as removed."
|
dongsheng@627
|
6955 msgstr ""
|
dongsheng@627
|
6956
|
dongsheng@627
|
6957 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
6958 #: ../en/ch05-daily.xml:410
|
dongsheng@627
|
6959 msgid ""
|
dongsheng@627
|
6960 "The <command role=\"hg-cmd\">hg status</command> command shows the newly "
|
dongsheng@627
|
6961 "copied file as added, and the copied-from file as removed."
|
dongsheng@627
|
6962 msgstr ""
|
dongsheng@627
|
6963
|
dongsheng@627
|
6964 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
6965 #: ../en/ch05-daily.xml:416
|
dongsheng@627
|
6966 msgid ""
|
dongsheng@627
|
6967 "As with the results of a <command role=\"hg-cmd\">hg copy</command>, we must "
|
dongsheng@627
|
6968 "use the <option role=\"hg-opt-status\">-C</option> option to <command role="
|
dongsheng@627
|
6969 "\"hg-cmd\">hg status</command> to see that the added file is really being "
|
dongsheng@627
|
6970 "tracked by Mercurial as a copy of the original, now removed, file."
|
dongsheng@627
|
6971 msgstr ""
|
dongsheng@627
|
6972
|
dongsheng@627
|
6973 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
6974 #: ../en/ch05-daily.xml:425
|
dongsheng@627
|
6975 msgid ""
|
dongsheng@627
|
6976 "As with <command role=\"hg-cmd\">hg remove</command> and <command role=\"hg-"
|
dongsheng@627
|
6977 "cmd\">hg copy</command>, you can tell Mercurial about a rename after the fact "
|
dongsheng@627
|
6978 "using the <option role=\"hg-opt-rename\">--after</option> option. In most "
|
songdongsheng@710
|
6979 "other respects, the behavior of the <command role=\"hg-cmd\">hg rename</"
|
dongsheng@627
|
6980 "command> command, and the options it accepts, are similar to the <command "
|
dongsheng@627
|
6981 "role=\"hg-cmd\">hg copy</command> command."
|
dongsheng@627
|
6982 msgstr ""
|
dongsheng@627
|
6983
|
songdongsheng@710
|
6984 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
6985 #: ../en/ch05-daily.xml:434
|
songdongsheng@710
|
6986 msgid ""
|
songdongsheng@710
|
6987 "If you're familiar with the Unix command line, you'll be glad to know that "
|
songdongsheng@710
|
6988 "<command role=\"hg-cmd\">hg rename</command> command can be invoked as "
|
songdongsheng@710
|
6989 "<command role=\"hg-cmd\">hg mv</command>."
|
songdongsheng@710
|
6990 msgstr ""
|
songdongsheng@710
|
6991
|
songdongsheng@710
|
6992 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
6993 #: ../en/ch05-daily.xml:440
|
dongsheng@627
|
6994 msgid "Renaming files and merging changes"
|
dongsheng@627
|
6995 msgstr "改名文件与合并修改"
|
dongsheng@627
|
6996
|
dongsheng@627
|
6997 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
6998 #: ../en/ch05-daily.xml:442
|
dongsheng@627
|
6999 msgid ""
|
dongsheng@627
|
7000 "Since Mercurial's rename is implemented as copy-and-remove, the same "
|
dongsheng@627
|
7001 "propagation of changes happens when you merge after a rename as after a copy."
|
dongsheng@627
|
7002 msgstr ""
|
dongsheng@627
|
7003
|
dongsheng@627
|
7004 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7005 #: ../en/ch05-daily.xml:446
|
dongsheng@627
|
7006 msgid ""
|
dongsheng@627
|
7007 "If I modify a file, and you rename it to a new name, and then we merge our "
|
dongsheng@627
|
7008 "respective changes, my modifications to the file under its original name will "
|
dongsheng@627
|
7009 "be propagated into the file under its new name. (This is something you might "
|
dongsheng@627
|
7010 "expect to <quote>simply work,</quote> but not all revision control systems "
|
dongsheng@627
|
7011 "actually do this.)"
|
dongsheng@627
|
7012 msgstr ""
|
dongsheng@627
|
7013
|
dongsheng@627
|
7014 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7015 #: ../en/ch05-daily.xml:453
|
dongsheng@627
|
7016 msgid ""
|
dongsheng@627
|
7017 "Whereas having changes follow a copy is a feature where you can perhaps nod "
|
dongsheng@627
|
7018 "and say <quote>yes, that might be useful,</quote> it should be clear that "
|
dongsheng@627
|
7019 "having them follow a rename is definitely important. Without this facility, "
|
dongsheng@627
|
7020 "it would simply be too easy for changes to become orphaned when files are "
|
dongsheng@627
|
7021 "renamed."
|
dongsheng@627
|
7022 msgstr ""
|
dongsheng@627
|
7023
|
dongsheng@627
|
7024 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
7025 #: ../en/ch05-daily.xml:462
|
dongsheng@627
|
7026 msgid "Divergent renames and merging"
|
dongsheng@627
|
7027 msgstr "改名与合并的分歧"
|
dongsheng@627
|
7028
|
dongsheng@627
|
7029 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7030 #: ../en/ch05-daily.xml:464
|
dongsheng@627
|
7031 msgid ""
|
songdongsheng@668
|
7032 "The case of diverging names occurs when two developers start with a "
|
songdongsheng@668
|
7033 "file&emdash;let's call it <filename>foo</filename>&emdash;in their respective "
|
dongsheng@627
|
7034 "repositories."
|
dongsheng@627
|
7035 msgstr ""
|
dongsheng@627
|
7036
|
dongsheng@627
|
7037 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7038 #: ../en/ch05-daily.xml:471
|
dongsheng@627
|
7039 msgid "Anne renames the file to <filename>bar</filename>."
|
dongsheng@627
|
7040 msgstr ""
|
dongsheng@627
|
7041
|
dongsheng@627
|
7042 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7043 #: ../en/ch05-daily.xml:475
|
songdongsheng@710
|
7044 msgid ""
|
songdongsheng@710
|
7045 "Meanwhile, Bob renames it to <filename>quux</filename>. (Remember that "
|
songdongsheng@710
|
7046 "<command role=\"hg-cmd\">hg mv</command> is an alias for <command role=\"hg-"
|
songdongsheng@710
|
7047 "cmd\">hg rename</command>.)"
|
songdongsheng@710
|
7048 msgstr ""
|
songdongsheng@710
|
7049
|
songdongsheng@710
|
7050 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7051 #: ../en/ch05-daily.xml:482
|
dongsheng@627
|
7052 msgid ""
|
dongsheng@627
|
7053 "I like to think of this as a conflict because each developer has expressed "
|
dongsheng@627
|
7054 "different intentions about what the file ought to be named."
|
dongsheng@627
|
7055 msgstr ""
|
dongsheng@627
|
7056
|
songdongsheng@710
|
7057 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7058 #: ../en/ch05-daily.xml:486
|
dongsheng@627
|
7059 msgid ""
|
dongsheng@627
|
7060 "What do you think should happen when they merge their work? Mercurial's "
|
songdongsheng@710
|
7061 "actual behavior is that it always preserves <emphasis>both</emphasis> names "
|
dongsheng@627
|
7062 "when it merges changesets that contain divergent renames."
|
dongsheng@627
|
7063 msgstr ""
|
dongsheng@627
|
7064
|
dongsheng@627
|
7065 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7066 #: ../en/ch05-daily.xml:493
|
songdongsheng@710
|
7067 msgid ""
|
songdongsheng@710
|
7068 "Notice that while Mercurial warns about the divergent renames, it leaves it "
|
dongsheng@627
|
7069 "up to you to do something about the divergence after the merge."
|
dongsheng@627
|
7070 msgstr ""
|
dongsheng@627
|
7071
|
dongsheng@627
|
7072 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
7073 #: ../en/ch05-daily.xml:499
|
dongsheng@627
|
7074 msgid "Convergent renames and merging"
|
dongsheng@627
|
7075 msgstr "收敛改名与合并"
|
dongsheng@627
|
7076
|
dongsheng@627
|
7077 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7078 #: ../en/ch05-daily.xml:501
|
dongsheng@627
|
7079 msgid ""
|
dongsheng@627
|
7080 "Another kind of rename conflict occurs when two people choose to rename "
|
dongsheng@627
|
7081 "different <emphasis>source</emphasis> files to the same "
|
dongsheng@627
|
7082 "<emphasis>destination</emphasis>. In this case, Mercurial runs its normal "
|
dongsheng@627
|
7083 "merge machinery, and lets you guide it to a suitable resolution."
|
dongsheng@627
|
7084 msgstr ""
|
dongsheng@627
|
7085
|
dongsheng@627
|
7086 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
7087 #: ../en/ch05-daily.xml:509
|
dongsheng@627
|
7088 msgid "Other name-related corner cases"
|
dongsheng@627
|
7089 msgstr "其它名称相关的角落"
|
dongsheng@627
|
7090
|
dongsheng@627
|
7091 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7092 #: ../en/ch05-daily.xml:511
|
dongsheng@627
|
7093 msgid ""
|
dongsheng@627
|
7094 "Mercurial has a longstanding bug in which it fails to handle a merge where "
|
dongsheng@627
|
7095 "one side has a file with a given name, while another has a directory with the "
|
dongsheng@627
|
7096 "same name. This is documented as <ulink role=\"hg-bug\" url=\"http://www."
|
dongsheng@627
|
7097 "selenic.com/mercurial/bts/issue29\">issue 29</ulink>."
|
dongsheng@627
|
7098 msgstr ""
|
dongsheng@627
|
7099
|
dongsheng@627
|
7100 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
7101 #: ../en/ch05-daily.xml:524
|
dongsheng@627
|
7102 msgid "Recovering from mistakes"
|
dongsheng@627
|
7103 msgstr "从错误恢复"
|
dongsheng@627
|
7104
|
dongsheng@627
|
7105 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7106 #: ../en/ch05-daily.xml:526
|
dongsheng@627
|
7107 msgid ""
|
dongsheng@627
|
7108 "Mercurial has some useful commands that will help you to recover from some "
|
dongsheng@627
|
7109 "common mistakes."
|
dongsheng@627
|
7110 msgstr ""
|
dongsheng@627
|
7111
|
dongsheng@627
|
7112 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7113 #: ../en/ch05-daily.xml:529
|
dongsheng@627
|
7114 msgid ""
|
dongsheng@627
|
7115 "The <command role=\"hg-cmd\">hg revert</command> command lets you undo "
|
dongsheng@627
|
7116 "changes that you have made to your working directory. For example, if you "
|
dongsheng@627
|
7117 "<command role=\"hg-cmd\">hg add</command> a file by accident, just run "
|
dongsheng@627
|
7118 "<command role=\"hg-cmd\">hg revert</command> with the name of the file you "
|
dongsheng@627
|
7119 "added, and while the file won't be touched in any way, it won't be tracked "
|
dongsheng@627
|
7120 "for adding by Mercurial any longer, either. You can also use <command role="
|
dongsheng@627
|
7121 "\"hg-cmd\">hg revert</command> to get rid of erroneous changes to a file."
|
dongsheng@627
|
7122 msgstr ""
|
dongsheng@627
|
7123
|
dongsheng@627
|
7124 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7125 #: ../en/ch05-daily.xml:539
|
dongsheng@714
|
7126 msgid ""
|
dongsheng@714
|
7127 "It is helpful to remember that the <command role=\"hg-cmd\">hg revert</"
|
dongsheng@714
|
7128 "command> command is useful for changes that you have not yet committed. Once "
|
dongsheng@714
|
7129 "you've committed a change, if you decide it was a mistake, you can still do "
|
dongsheng@627
|
7130 "something about it, though your options may be more limited."
|
dongsheng@627
|
7131 msgstr ""
|
dongsheng@627
|
7132
|
dongsheng@627
|
7133 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7134 #: ../en/ch05-daily.xml:546
|
dongsheng@627
|
7135 msgid ""
|
dongsheng@627
|
7136 "For more information about the <command role=\"hg-cmd\">hg revert</command> "
|
dongsheng@627
|
7137 "command, and details about how to deal with changes you have already "
|
songdongsheng@658
|
7138 "committed, see <xref linkend=\"chap:undo\"/>."
|
dongsheng@627
|
7139 msgstr ""
|
dongsheng@627
|
7140
|
songdongsheng@710
|
7141 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
7142 #: ../en/ch05-daily.xml:553
|
songdongsheng@710
|
7143 msgid "Dealing with tricky merges"
|
songdongsheng@711
|
7144 msgstr "合并的技巧"
|
songdongsheng@710
|
7145
|
songdongsheng@710
|
7146 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7147 #: ../en/ch05-daily.xml:555
|
songdongsheng@710
|
7148 msgid ""
|
songdongsheng@710
|
7149 "In a complicated or large project, it's not unusual for a merge of two "
|
songdongsheng@710
|
7150 "changesets to result in some headaches. Suppose there's a big source file "
|
songdongsheng@710
|
7151 "that's been extensively edited by each side of a merge: this is almost "
|
songdongsheng@710
|
7152 "inevitably going to result in conflicts, some of which can take a few tries "
|
songdongsheng@710
|
7153 "to sort out."
|
songdongsheng@710
|
7154 msgstr ""
|
songdongsheng@710
|
7155
|
songdongsheng@710
|
7156 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7157 #: ../en/ch05-daily.xml:562
|
songdongsheng@710
|
7158 msgid ""
|
songdongsheng@710
|
7159 "Let's develop a simple case of this and see how to deal with it. We'll start "
|
songdongsheng@710
|
7160 "off with a repository containing one file, and clone it twice."
|
songdongsheng@710
|
7161 msgstr ""
|
songdongsheng@710
|
7162
|
songdongsheng@710
|
7163 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7164 #: ../en/ch05-daily.xml:568
|
songdongsheng@710
|
7165 msgid "In one clone, we'll modify the file in one way."
|
songdongsheng@710
|
7166 msgstr ""
|
songdongsheng@710
|
7167
|
songdongsheng@710
|
7168 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7169 #: ../en/ch05-daily.xml:572
|
songdongsheng@710
|
7170 msgid "In another, we'll modify the file differently."
|
songdongsheng@710
|
7171 msgstr ""
|
songdongsheng@710
|
7172
|
songdongsheng@710
|
7173 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7174 #: ../en/ch05-daily.xml:576
|
songdongsheng@710
|
7175 msgid "Next, we'll pull each set of changes into our original repo."
|
songdongsheng@710
|
7176 msgstr ""
|
songdongsheng@710
|
7177
|
songdongsheng@710
|
7178 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7179 #: ../en/ch05-daily.xml:581
|
songdongsheng@710
|
7180 msgid "We expect our repository to now contain two heads."
|
songdongsheng@710
|
7181 msgstr ""
|
songdongsheng@710
|
7182
|
songdongsheng@710
|
7183 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7184 #: ../en/ch05-daily.xml:585
|
songdongsheng@710
|
7185 msgid ""
|
songdongsheng@710
|
7186 "Normally, if we run <command role=\"hg-cmd\">hg merge</command> at this "
|
songdongsheng@710
|
7187 "point, it will drop us into a GUI that will let us manually resolve the "
|
songdongsheng@710
|
7188 "conflicting edits to <filename>myfile.txt</filename>. However, to simplify "
|
songdongsheng@710
|
7189 "things for presentation here, we'd like the merge to fail immediately "
|
songdongsheng@710
|
7190 "instead. Here's one way we can do so."
|
songdongsheng@710
|
7191 msgstr ""
|
songdongsheng@710
|
7192
|
songdongsheng@710
|
7193 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7194 #: ../en/ch05-daily.xml:594
|
songdongsheng@710
|
7195 msgid ""
|
songdongsheng@710
|
7196 "We've told Mercurial's merge machinery to run the command <command>false</"
|
songdongsheng@710
|
7197 "command> (which, as we desire, fails immediately) if it detects a merge that "
|
songdongsheng@710
|
7198 "it can't sort out automatically."
|
songdongsheng@710
|
7199 msgstr ""
|
songdongsheng@710
|
7200
|
songdongsheng@710
|
7201 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7202 #: ../en/ch05-daily.xml:599
|
songdongsheng@710
|
7203 msgid ""
|
songdongsheng@710
|
7204 "If we now fire up <command role=\"hg-cmd\">hg merge</command>, it should "
|
songdongsheng@710
|
7205 "grind to a halt and report a failure."
|
songdongsheng@710
|
7206 msgstr ""
|
songdongsheng@710
|
7207
|
songdongsheng@710
|
7208 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7209 #: ../en/ch05-daily.xml:605
|
songdongsheng@710
|
7210 msgid ""
|
songdongsheng@710
|
7211 "Even if we don't notice that the merge failed, Mercurial will prevent us from "
|
songdongsheng@710
|
7212 "accidentally committing the result of a failed merge."
|
songdongsheng@710
|
7213 msgstr ""
|
songdongsheng@710
|
7214
|
songdongsheng@710
|
7215 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7216 #: ../en/ch05-daily.xml:611
|
songdongsheng@710
|
7217 msgid ""
|
songdongsheng@710
|
7218 "When <command role=\"hg-cmd\">hg commit</command> fails in this case, it "
|
songdongsheng@710
|
7219 "suggests that we use the unfamiliar <command role=\"hg-cmd\">hg resolve</"
|
songdongsheng@710
|
7220 "command> command. As usual, <command role=\"hg-cmd\">hg help resolve</"
|
songdongsheng@710
|
7221 "command> will print a helpful synopsis."
|
songdongsheng@710
|
7222 msgstr ""
|
songdongsheng@710
|
7223
|
songdongsheng@710
|
7224 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
7225 #: ../en/ch05-daily.xml:618
|
songdongsheng@710
|
7226 msgid "File resolution states"
|
dongsheng@716
|
7227 msgstr "文件的解决状态"
|
songdongsheng@710
|
7228
|
songdongsheng@710
|
7229 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7230 #: ../en/ch05-daily.xml:620
|
songdongsheng@710
|
7231 msgid ""
|
songdongsheng@710
|
7232 "When a merge occurs, most files will usually remain unmodified. For each "
|
songdongsheng@710
|
7233 "file where Mercurial has to do something, it tracks the state of the file."
|
songdongsheng@710
|
7234 msgstr ""
|
songdongsheng@710
|
7235
|
songdongsheng@710
|
7236 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
7237 #: ../en/ch05-daily.xml:626
|
songdongsheng@710
|
7238 msgid ""
|
songdongsheng@710
|
7239 "A <emphasis>resolved</emphasis> file has been successfully merged, either "
|
songdongsheng@710
|
7240 "automatically by Mercurial or manually with human intervention."
|
songdongsheng@710
|
7241 msgstr ""
|
songdongsheng@710
|
7242
|
songdongsheng@710
|
7243 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
7244 #: ../en/ch05-daily.xml:631
|
songdongsheng@710
|
7245 msgid ""
|
songdongsheng@710
|
7246 "An <emphasis>unresolved</emphasis> file was not merged successfully, and "
|
songdongsheng@710
|
7247 "needs more attention."
|
songdongsheng@710
|
7248 msgstr ""
|
songdongsheng@710
|
7249
|
songdongsheng@710
|
7250 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7251 #: ../en/ch05-daily.xml:636
|
songdongsheng@710
|
7252 msgid ""
|
songdongsheng@710
|
7253 "If Mercurial sees <emphasis>any</emphasis> file in the unresolved state after "
|
songdongsheng@710
|
7254 "a merge, it considers the merge to have failed. Fortunately, we do not need "
|
songdongsheng@710
|
7255 "to restart the entire merge from scratch."
|
songdongsheng@710
|
7256 msgstr ""
|
songdongsheng@710
|
7257
|
songdongsheng@710
|
7258 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7259 #: ../en/ch05-daily.xml:641
|
songdongsheng@710
|
7260 msgid ""
|
songdongsheng@710
|
7261 "The <option role=\"hg-opt-resolve\">--list</option> or <option role=\"hg-opt-"
|
songdongsheng@710
|
7262 "resolve\">-l</option> option to <command role=\"hg-cmd\">hg resolve</command> "
|
songdongsheng@710
|
7263 "prints out the state of each merged file."
|
songdongsheng@710
|
7264 msgstr ""
|
songdongsheng@710
|
7265
|
songdongsheng@710
|
7266 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7267 #: ../en/ch05-daily.xml:648
|
songdongsheng@710
|
7268 msgid ""
|
songdongsheng@710
|
7269 "In the output from <command role=\"hg-cmd\">hg resolve</command>, a resolved "
|
songdongsheng@710
|
7270 "file is marked with <literal>R</literal>, while an unresolved file is marked "
|
songdongsheng@710
|
7271 "with <literal>U</literal>. If any files are listed with <literal>U</"
|
songdongsheng@710
|
7272 "literal>, we know that an attempt to commit the results of the merge will "
|
songdongsheng@710
|
7273 "fail."
|
songdongsheng@710
|
7274 msgstr ""
|
songdongsheng@710
|
7275
|
songdongsheng@710
|
7276 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
7277 #: ../en/ch05-daily.xml:657
|
songdongsheng@710
|
7278 msgid "Resolving a file merge"
|
songdongsheng@711
|
7279 msgstr "合并文件"
|
songdongsheng@710
|
7280
|
songdongsheng@710
|
7281 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7282 #: ../en/ch05-daily.xml:659
|
songdongsheng@710
|
7283 msgid ""
|
songdongsheng@710
|
7284 "We have several options to move a file from the unresolved into the resolved "
|
songdongsheng@710
|
7285 "state. By far the most common is to rerun <command role=\"hg-cmd\">hg "
|
songdongsheng@710
|
7286 "resolve</command>. If we pass the names of individual files or directories, "
|
songdongsheng@710
|
7287 "it will retry the merges of any unresolved files present in those locations. "
|
songdongsheng@710
|
7288 "We can also pass the <option role=\"hg-opt-resolve\">--all</option> or "
|
songdongsheng@710
|
7289 "<option role=\"hg-opt-resolve\">-a</option> option, which will retry the "
|
songdongsheng@710
|
7290 "merges of <emphasis>all</emphasis> unresolved files."
|
songdongsheng@710
|
7291 msgstr ""
|
songdongsheng@710
|
7292
|
songdongsheng@710
|
7293 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7294 #: ../en/ch05-daily.xml:669
|
songdongsheng@710
|
7295 msgid ""
|
songdongsheng@710
|
7296 "Mercurial also lets us modify the resolution state of a file directly. We "
|
songdongsheng@710
|
7297 "can manually mark a file as resolved using the <option role=\"hg-opt-resolve"
|
songdongsheng@710
|
7298 "\">--mark</option> option, or as unresolved using the <option role=\"hg-opt-"
|
songdongsheng@710
|
7299 "resolve\">--unmark</option> option. This allows us to clean up a "
|
songdongsheng@710
|
7300 "particularly messy merge by hand, and to keep track of our progress with each "
|
songdongsheng@710
|
7301 "file as we go."
|
songdongsheng@710
|
7302 msgstr ""
|
songdongsheng@710
|
7303
|
dongsheng@714
|
7304 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
7305 #: ../en/ch05-daily.xml:680
|
dongsheng@714
|
7306 msgid "More useful diffs"
|
dongsheng@716
|
7307 msgstr "更有用的差异"
|
dongsheng@714
|
7308
|
dongsheng@714
|
7309 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7310 #: ../en/ch05-daily.xml:682
|
dongsheng@714
|
7311 msgid ""
|
dongsheng@714
|
7312 "The default output of the <command role=\"hg-cmd\">hg diff</command> command "
|
dongsheng@714
|
7313 "is backwards compatible with the regular <command>diff</command> command, but "
|
dongsheng@714
|
7314 "this has some drawbacks."
|
dongsheng@714
|
7315 msgstr ""
|
dongsheng@714
|
7316
|
dongsheng@714
|
7317 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7318 #: ../en/ch05-daily.xml:687
|
dongsheng@714
|
7319 msgid ""
|
dongsheng@714
|
7320 "Consider the case where we use <command role=\"hg-cmd\">hg rename</command> "
|
dongsheng@714
|
7321 "to rename a file."
|
dongsheng@715
|
7322 msgstr ""
|
dongsheng@715
|
7323 "设想我们使用 <command role=\"hg-cmd\">hg rename</command> 命令来改名文件。"
|
dongsheng@714
|
7324
|
dongsheng@714
|
7325 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7326 #: ../en/ch05-daily.xml:692
|
dongsheng@714
|
7327 msgid ""
|
dongsheng@714
|
7328 "The output of <command role=\"hg-cmd\">hg diff</command> above obscures the "
|
dongsheng@714
|
7329 "fact that we simply renamed a file. The <command role=\"hg-cmd\">hg diff</"
|
dongsheng@714
|
7330 "command> command accepts an option, <option>--git</option> or <option>-g</"
|
dongsheng@714
|
7331 "option>, to use a newer diff format that displays such information in a more "
|
dongsheng@714
|
7332 "readable form."
|
dongsheng@714
|
7333 msgstr ""
|
dongsheng@714
|
7334
|
dongsheng@714
|
7335 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7336 #: ../en/ch05-daily.xml:701
|
dongsheng@714
|
7337 msgid ""
|
dongsheng@714
|
7338 "This option also helps with a case that can otherwise be confusing: a file "
|
dongsheng@714
|
7339 "that appears to be modified according to <command role=\"hg-cmd\">hg status</"
|
dongsheng@714
|
7340 "command>, but for which <command role=\"hg-cmd\">hg diff</command> prints "
|
dongsheng@714
|
7341 "nothing. This situation can arise if we change the file's execute permissions."
|
dongsheng@714
|
7342 msgstr ""
|
dongsheng@714
|
7343
|
dongsheng@714
|
7344 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7345 #: ../en/ch05-daily.xml:710
|
dongsheng@714
|
7346 msgid ""
|
dongsheng@714
|
7347 "The normal <command>diff</command> command pays no attention to file "
|
dongsheng@714
|
7348 "permissions, which is why <command role=\"hg-cmd\">hg diff</command> prints "
|
dongsheng@714
|
7349 "nothing by default. If we supply it with the <option>-g</option> option, it "
|
dongsheng@714
|
7350 "tells us what really happened."
|
dongsheng@714
|
7351 msgstr ""
|
dongsheng@714
|
7352
|
dongsheng@714
|
7353 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
7354 #: ../en/ch05-daily.xml:720
|
dongsheng@714
|
7355 msgid "Which files to manage, and which to avoid"
|
dongsheng@716
|
7356 msgstr "需要管理哪些文件,应该避免的事情"
|
dongsheng@714
|
7357
|
dongsheng@714
|
7358 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7359 #: ../en/ch05-daily.xml:722
|
dongsheng@714
|
7360 msgid ""
|
dongsheng@714
|
7361 "Revision control systems are generally best at managing text files that are "
|
dongsheng@714
|
7362 "written by humans, such as source code, where the files do not change much "
|
dongsheng@714
|
7363 "from one revision to the next. Some centralized revision control systems can "
|
dongsheng@714
|
7364 "also deal tolerably well with binary files, such as bitmap images."
|
dongsheng@714
|
7365 msgstr ""
|
dongsheng@714
|
7366
|
dongsheng@714
|
7367 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7368 #: ../en/ch05-daily.xml:728
|
dongsheng@714
|
7369 msgid ""
|
dongsheng@714
|
7370 "For instance, a game development team will typically manage both its source "
|
dongsheng@714
|
7371 "code and all of its binary assets (e.g. geometry data, textures, map layouts) "
|
dongsheng@714
|
7372 "in a revision control system."
|
dongsheng@714
|
7373 msgstr ""
|
dongsheng@714
|
7374
|
dongsheng@714
|
7375 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7376 #: ../en/ch05-daily.xml:733
|
dongsheng@714
|
7377 msgid ""
|
dongsheng@714
|
7378 "Because it is usually impossible to merge two conflicting modifications to a "
|
dongsheng@714
|
7379 "binary file, centralized systems often provide a file locking mechanism that "
|
dongsheng@714
|
7380 "allow a user to say <quote>I am the only person who can edit this file</"
|
dongsheng@714
|
7381 "quote>."
|
dongsheng@714
|
7382 msgstr ""
|
dongsheng@714
|
7383
|
dongsheng@714
|
7384 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7385 #: ../en/ch05-daily.xml:739
|
dongsheng@714
|
7386 msgid ""
|
dongsheng@714
|
7387 "Compared to a centralized system, a distributed revision control system "
|
dongsheng@714
|
7388 "changes some of the factors that guide decisions over which files to manage "
|
dongsheng@714
|
7389 "and how."
|
dongsheng@714
|
7390 msgstr ""
|
dongsheng@714
|
7391
|
dongsheng@714
|
7392 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7393 #: ../en/ch05-daily.xml:743
|
dongsheng@714
|
7394 msgid ""
|
dongsheng@714
|
7395 "For instance, a distributed revision control system cannot, by its nature, "
|
dongsheng@714
|
7396 "offer a file locking facility. There is thus no built-in mechanism to "
|
dongsheng@714
|
7397 "prevent two people from making conflicting changes to a binary file. If you "
|
dongsheng@714
|
7398 "have a team where several people may be editing binary files frequently, it "
|
dongsheng@714
|
7399 "may not be a good idea to use Mercurial&emdash;or any other distributed "
|
dongsheng@714
|
7400 "revision control system&emdash;to manage those files."
|
dongsheng@714
|
7401 msgstr ""
|
dongsheng@714
|
7402
|
dongsheng@714
|
7403 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7404 #: ../en/ch05-daily.xml:751
|
dongsheng@714
|
7405 msgid ""
|
dongsheng@714
|
7406 "When storing modifications to a file, Mercurial usually saves only the "
|
dongsheng@714
|
7407 "differences between the previous and current versions of the file. For most "
|
dongsheng@714
|
7408 "text files, this is extremely efficient. However, some files (particularly "
|
dongsheng@714
|
7409 "binary files) are laid out in such a way that even a small change to a file's "
|
dongsheng@714
|
7410 "logical content results in many or most of the bytes inside the file "
|
dongsheng@714
|
7411 "changing. For instance, compressed files are particularly susceptible to "
|
dongsheng@714
|
7412 "this. If the differences between each successive version of a file are always "
|
dongsheng@714
|
7413 "large, Mercurial will not be able to store the file's revision history very "
|
dongsheng@714
|
7414 "efficiently. This can affect both local storage needs and the amount of time "
|
dongsheng@714
|
7415 "it takes to clone a repository."
|
dongsheng@714
|
7416 msgstr ""
|
dongsheng@714
|
7417
|
dongsheng@714
|
7418 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7419 #: ../en/ch05-daily.xml:764
|
dongsheng@714
|
7420 msgid ""
|
dongsheng@714
|
7421 "To get an idea of how this could affect you in practice, suppose you want to "
|
dongsheng@714
|
7422 "use Mercurial to manage an OpenOffice document. OpenOffice stores documents "
|
dongsheng@714
|
7423 "on disk as compressed zip files. Edit even a single letter of your document "
|
dongsheng@714
|
7424 "in OpenOffice, and almost every byte in the entire file will change when you "
|
dongsheng@714
|
7425 "save it. Now suppose that file is 2MB in size. Because most of the file "
|
dongsheng@714
|
7426 "changes every time you save, Mercurial will have to store all 2MB of the file "
|
dongsheng@714
|
7427 "every time you commit, even though from your perspective, perhaps only a few "
|
dongsheng@714
|
7428 "words are changing each time. A single frequently-edited file that is not "
|
dongsheng@714
|
7429 "friendly to Mercurial's storage assumptions can easily have an outsized "
|
dongsheng@714
|
7430 "effect on the size of the repository."
|
dongsheng@714
|
7431 msgstr ""
|
dongsheng@714
|
7432
|
dongsheng@714
|
7433 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7434 #: ../en/ch05-daily.xml:777
|
dongsheng@714
|
7435 msgid ""
|
dongsheng@714
|
7436 "Even worse, if both you and someone else edit the OpenOffice document you're "
|
dongsheng@714
|
7437 "working on, there is no useful way to merge your work. In fact, there isn't "
|
dongsheng@714
|
7438 "even a good way to tell what the differences are between your respective "
|
dongsheng@714
|
7439 "changes."
|
dongsheng@714
|
7440 msgstr ""
|
dongsheng@714
|
7441
|
dongsheng@714
|
7442 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7443 #: ../en/ch05-daily.xml:782
|
dongsheng@714
|
7444 msgid ""
|
dongsheng@714
|
7445 "There are thus a few clear recommendations about specific kinds of files to "
|
dongsheng@714
|
7446 "be very careful with."
|
dongsheng@714
|
7447 msgstr ""
|
dongsheng@714
|
7448
|
dongsheng@714
|
7449 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
7450 #: ../en/ch05-daily.xml:787
|
dongsheng@714
|
7451 msgid ""
|
dongsheng@714
|
7452 "Files that are very large and incompressible, e.g. ISO CD-ROM images, will by "
|
dongsheng@714
|
7453 "virtue of sheer size make clones over a network very slow."
|
dongsheng@714
|
7454 msgstr ""
|
dongsheng@714
|
7455
|
dongsheng@714
|
7456 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
7457 #: ../en/ch05-daily.xml:792
|
dongsheng@714
|
7458 msgid ""
|
dongsheng@714
|
7459 "Files that change a lot from one revision to the next may be expensive to "
|
dongsheng@714
|
7460 "store if you edit them frequently, and conflicts due to concurrent edits may "
|
dongsheng@714
|
7461 "be difficult to resolve."
|
dongsheng@714
|
7462 msgstr ""
|
dongsheng@714
|
7463
|
dongsheng@714
|
7464 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
7465 #: ../en/ch05-daily.xml:801
|
dongsheng@714
|
7466 msgid "Backups and mirroring"
|
dongsheng@715
|
7467 msgstr "备份与镜像"
|
dongsheng@714
|
7468
|
dongsheng@714
|
7469 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7470 #: ../en/ch05-daily.xml:803
|
dongsheng@714
|
7471 msgid ""
|
dongsheng@714
|
7472 "Since Mercurial maintains a complete copy of history in each clone, everyone "
|
dongsheng@714
|
7473 "who uses Mercurial to collaborate on a project can potentially act as a "
|
dongsheng@714
|
7474 "source of backups in the event of a catastrophe. If a central repository "
|
dongsheng@714
|
7475 "becomes unavailable, you can construct a replacement simply by cloning a copy "
|
dongsheng@714
|
7476 "of the repository from one contributor, and pulling any changes they may not "
|
dongsheng@714
|
7477 "have seen from others."
|
dongsheng@714
|
7478 msgstr ""
|
dongsheng@714
|
7479
|
dongsheng@714
|
7480 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7481 #: ../en/ch05-daily.xml:811
|
dongsheng@714
|
7482 msgid ""
|
dongsheng@714
|
7483 "It is simple to use Mercurial to perform off-site backups and remote "
|
dongsheng@714
|
7484 "mirrors. Set up a periodic job (e.g. via the <command>cron</command> "
|
dongsheng@714
|
7485 "command) on a remote server to pull changes from your master repositories "
|
dongsheng@714
|
7486 "every hour. This will only be tricky in the unlikely case that the number of "
|
dongsheng@714
|
7487 "master repositories you maintain changes frequently, in which case you'll "
|
dongsheng@714
|
7488 "need to do a little scripting to refresh the list of repositories to back up."
|
dongsheng@714
|
7489 msgstr ""
|
dongsheng@714
|
7490
|
dongsheng@714
|
7491 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7492 #: ../en/ch05-daily.xml:820
|
dongsheng@714
|
7493 msgid ""
|
dongsheng@714
|
7494 "If you perform traditional backups of your master repositories to tape or "
|
dongsheng@714
|
7495 "disk, and you want to back up a repository named <filename>myrepo</filename>, "
|
dongsheng@714
|
7496 "use <command>hg clone -U myrepo myrepo.bak</command> to create a clone of "
|
dongsheng@714
|
7497 "<filename>myrepo</filename> before you start your backups. The <option>-U</"
|
dongsheng@714
|
7498 "option> option doesn't check out a working directory after the clone "
|
dongsheng@714
|
7499 "completes, since that would be superfluous and make the backup take longer."
|
dongsheng@714
|
7500 msgstr ""
|
dongsheng@714
|
7501
|
dongsheng@714
|
7502 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7503 #: ../en/ch05-daily.xml:829
|
dongsheng@714
|
7504 msgid ""
|
dongsheng@714
|
7505 "If you then back up <filename>myrepo.bak</filename> instead of "
|
dongsheng@714
|
7506 "<filename>myrepo</filename>, you will be guaranteed to have a consistent "
|
dongsheng@714
|
7507 "snapshot of your repository that won't be pushed to by an insomniac developer "
|
dongsheng@714
|
7508 "in mid-backup."
|
dongsheng@714
|
7509 msgstr ""
|
dongsheng@714
|
7510
|
dongsheng@627
|
7511 #. type: Content of: <book><chapter><title>
|
dongsheng@714
|
7512 #: ../en/ch06-collab.xml:5
|
dongsheng@627
|
7513 msgid "Collaborating with other people"
|
dongsheng@627
|
7514 msgstr "团体协作"
|
dongsheng@627
|
7515
|
dongsheng@627
|
7516 #. type: Content of: <book><chapter><para>
|
dongsheng@714
|
7517 #: ../en/ch06-collab.xml:7
|
dongsheng@627
|
7518 msgid ""
|
dongsheng@627
|
7519 "As a completely decentralised tool, Mercurial doesn't impose any policy on "
|
dongsheng@627
|
7520 "how people ought to work with each other. However, if you're new to "
|
dongsheng@627
|
7521 "distributed revision control, it helps to have some tools and examples in "
|
dongsheng@627
|
7522 "mind when you're thinking about possible workflow models."
|
dongsheng@627
|
7523 msgstr ""
|
dongsheng@627
|
7524
|
dongsheng@627
|
7525 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
7526 #: ../en/ch06-collab.xml:14
|
dongsheng@627
|
7527 msgid "Mercurial's web interface"
|
dongsheng@630
|
7528 msgstr "Mercurial 的 web 接口"
|
dongsheng@627
|
7529
|
dongsheng@627
|
7530 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7531 #: ../en/ch06-collab.xml:16
|
dongsheng@627
|
7532 msgid ""
|
dongsheng@627
|
7533 "Mercurial has a powerful web interface that provides several useful "
|
dongsheng@627
|
7534 "capabilities."
|
dongsheng@627
|
7535 msgstr ""
|
dongsheng@627
|
7536
|
dongsheng@627
|
7537 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7538 #: ../en/ch06-collab.xml:19
|
dongsheng@627
|
7539 msgid ""
|
dongsheng@627
|
7540 "For interactive use, the web interface lets you browse a single repository or "
|
dongsheng@627
|
7541 "a collection of repositories. You can view the history of a repository, "
|
dongsheng@627
|
7542 "examine each change (comments and diffs), and view the contents of each "
|
songdongsheng@710
|
7543 "directory and file. You can even get a view of history that gives a "
|
songdongsheng@710
|
7544 "graphical view of the relationships between individual changes and merges."
|
songdongsheng@710
|
7545 msgstr ""
|
songdongsheng@710
|
7546
|
songdongsheng@710
|
7547 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7548 #: ../en/ch06-collab.xml:26
|
songdongsheng@710
|
7549 msgid ""
|
songdongsheng@710
|
7550 "Also for human consumption, the web interface provides Atom and RSS feeds of "
|
songdongsheng@710
|
7551 "the changes in a repository. This lets you <quote>subscribe</quote> to a "
|
songdongsheng@710
|
7552 "repository using your favorite feed reader, and be automatically notified of "
|
dongsheng@627
|
7553 "activity in that repository as soon as it happens. I find this capability "
|
dongsheng@627
|
7554 "much more convenient than the model of subscribing to a mailing list to which "
|
dongsheng@627
|
7555 "notifications are sent, as it requires no additional configuration on the "
|
dongsheng@627
|
7556 "part of whoever is serving the repository."
|
dongsheng@627
|
7557 msgstr ""
|
dongsheng@627
|
7558
|
dongsheng@627
|
7559 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7560 #: ../en/ch06-collab.xml:36
|
dongsheng@627
|
7561 msgid ""
|
dongsheng@627
|
7562 "The web interface also lets remote users clone a repository, pull changes "
|
dongsheng@627
|
7563 "from it, and (when the server is configured to permit it) push changes back "
|
dongsheng@627
|
7564 "to it. Mercurial's HTTP tunneling protocol aggressively compresses data, so "
|
dongsheng@627
|
7565 "that it works efficiently even over low-bandwidth network connections."
|
dongsheng@627
|
7566 msgstr ""
|
dongsheng@627
|
7567
|
dongsheng@627
|
7568 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7569 #: ../en/ch06-collab.xml:42
|
dongsheng@627
|
7570 msgid ""
|
dongsheng@627
|
7571 "The easiest way to get started with the web interface is to use your web "
|
dongsheng@627
|
7572 "browser to visit an existing repository, such as the master Mercurial "
|
songdongsheng@710
|
7573 "repository at <ulink url=\"http://www.selenic.com/repo/hg\">http://www."
|
songdongsheng@710
|
7574 "selenic.com/repo/hg</ulink>."
|
songdongsheng@710
|
7575 msgstr ""
|
songdongsheng@710
|
7576
|
songdongsheng@710
|
7577 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7578 #: ../en/ch06-collab.xml:47
|
dongsheng@627
|
7579 msgid ""
|
dongsheng@627
|
7580 "If you're interested in providing a web interface to your own repositories, "
|
songdongsheng@710
|
7581 "there are several good ways to do this."
|
songdongsheng@710
|
7582 msgstr ""
|
songdongsheng@710
|
7583
|
songdongsheng@710
|
7584 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7585 #: ../en/ch06-collab.xml:51
|
songdongsheng@710
|
7586 msgid ""
|
songdongsheng@710
|
7587 "The easiest and fastest way to get started in an informal environment is to "
|
songdongsheng@710
|
7588 "use the <command role=\"hg-cmd\">hg serve</command> command, which is best "
|
songdongsheng@710
|
7589 "suited to short-term <quote>lightweight</quote> serving. See <xref linkend="
|
songdongsheng@710
|
7590 "\"sec:collab:serve\"/> below for details of how to use this command."
|
songdongsheng@710
|
7591 msgstr ""
|
songdongsheng@710
|
7592
|
songdongsheng@710
|
7593 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7594 #: ../en/ch06-collab.xml:58
|
songdongsheng@710
|
7595 msgid ""
|
songdongsheng@710
|
7596 "For longer-lived repositories that you'd like to have permanently available, "
|
dongsheng@714
|
7597 "there are several public hosting services available. Some are free to open "
|
dongsheng@714
|
7598 "source projects, while others offer paid commercial hosting. An up-to-date "
|
dongsheng@714
|
7599 "list is available at <ulink url=\"http://www.selenic.com/mercurial/wiki/index."
|
dongsheng@714
|
7600 "cgi/MercurialHosting\">http://www.selenic.com/mercurial/wiki/index.cgi/"
|
dongsheng@714
|
7601 "MercurialHosting</ulink>."
|
dongsheng@714
|
7602 msgstr ""
|
dongsheng@714
|
7603
|
dongsheng@714
|
7604 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7605 #: ../en/ch06-collab.xml:65
|
songdongsheng@710
|
7606 msgid ""
|
songdongsheng@710
|
7607 "If you would prefer to host your own repositories, Mercurial has built-in "
|
songdongsheng@710
|
7608 "support for several popular hosting technologies, most notably CGI (Common "
|
songdongsheng@710
|
7609 "Gateway Interface), and WSGI (Web Services Gateway Interface). See <xref "
|
songdongsheng@710
|
7610 "linkend=\"sec:collab:cgi\"/> for details of CGI and WSGI configuration."
|
dongsheng@627
|
7611 msgstr ""
|
dongsheng@627
|
7612
|
dongsheng@627
|
7613 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
7614 #: ../en/ch06-collab.xml:74
|
dongsheng@627
|
7615 msgid "Collaboration models"
|
dongsheng@630
|
7616 msgstr "协作模型"
|
dongsheng@627
|
7617
|
dongsheng@627
|
7618 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
7619 #: ../en/ch06-collab.xml:76
|
dongsheng@627
|
7620 msgid ""
|
dongsheng@627
|
7621 "With a suitably flexible tool, making decisions about workflow is much more "
|
dongsheng@627
|
7622 "of a social engineering challenge than a technical one. Mercurial imposes few "
|
dongsheng@627
|
7623 "limitations on how you can structure the flow of work in a project, so it's "
|
dongsheng@627
|
7624 "up to you and your group to set up and live with a model that matches your "
|
dongsheng@627
|
7625 "own particular needs."
|
dongsheng@627
|
7626 msgstr ""
|
dongsheng@627
|
7627
|
dongsheng@627
|
7628 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
7629 #: ../en/ch06-collab.xml:84
|
dongsheng@627
|
7630 msgid "Factors to keep in mind"
|
dongsheng@630
|
7631 msgstr "要牢记的因素"
|
dongsheng@627
|
7632
|
dongsheng@627
|
7633 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7634 #: ../en/ch06-collab.xml:86
|
dongsheng@627
|
7635 msgid ""
|
dongsheng@627
|
7636 "The most important aspect of any model that you must keep in mind is how well "
|
dongsheng@627
|
7637 "it matches the needs and capabilities of the people who will be using it. "
|
dongsheng@627
|
7638 "This might seem self-evident; even so, you still can't afford to forget it "
|
dongsheng@627
|
7639 "for a moment."
|
dongsheng@627
|
7640 msgstr ""
|
dongsheng@627
|
7641
|
dongsheng@627
|
7642 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7643 #: ../en/ch06-collab.xml:92
|
dongsheng@627
|
7644 msgid ""
|
dongsheng@627
|
7645 "I once put together a workflow model that seemed to make perfect sense to me, "
|
dongsheng@627
|
7646 "but that caused a considerable amount of consternation and strife within my "
|
dongsheng@627
|
7647 "development team. In spite of my attempts to explain why we needed a complex "
|
dongsheng@627
|
7648 "set of branches, and how changes ought to flow between them, a few team "
|
dongsheng@627
|
7649 "members revolted. Even though they were smart people, they didn't want to "
|
dongsheng@627
|
7650 "pay attention to the constraints we were operating under, or face the "
|
dongsheng@627
|
7651 "consequences of those constraints in the details of the model that I was "
|
dongsheng@627
|
7652 "advocating."
|
dongsheng@627
|
7653 msgstr ""
|
dongsheng@627
|
7654
|
dongsheng@627
|
7655 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7656 #: ../en/ch06-collab.xml:102
|
dongsheng@627
|
7657 msgid ""
|
dongsheng@627
|
7658 "Don't sweep foreseeable social or technical problems under the rug. Whatever "
|
dongsheng@627
|
7659 "scheme you put into effect, you should plan for mistakes and problem "
|
dongsheng@627
|
7660 "scenarios. Consider adding automated machinery to prevent, or quickly "
|
dongsheng@627
|
7661 "recover from, trouble that you can anticipate. As an example, if you intend "
|
dongsheng@627
|
7662 "to have a branch with not-for-release changes in it, you'd do well to think "
|
dongsheng@627
|
7663 "early about the possibility that someone might accidentally merge those "
|
dongsheng@627
|
7664 "changes into a release branch. You could avoid this particular problem by "
|
dongsheng@627
|
7665 "writing a hook that prevents changes from being merged from an inappropriate "
|
dongsheng@627
|
7666 "branch."
|
dongsheng@627
|
7667 msgstr ""
|
dongsheng@627
|
7668
|
dongsheng@627
|
7669 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
7670 #: ../en/ch06-collab.xml:116
|
dongsheng@627
|
7671 msgid "Informal anarchy"
|
dongsheng@630
|
7672 msgstr "无政府状态"
|
dongsheng@627
|
7673
|
dongsheng@627
|
7674 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7675 #: ../en/ch06-collab.xml:118
|
dongsheng@627
|
7676 msgid ""
|
dongsheng@627
|
7677 "I wouldn't suggest an <quote>anything goes</quote> approach as something "
|
dongsheng@627
|
7678 "sustainable, but it's a model that's easy to grasp, and it works perfectly "
|
dongsheng@627
|
7679 "well in a few unusual situations."
|
dongsheng@627
|
7680 msgstr ""
|
dongsheng@627
|
7681
|
dongsheng@627
|
7682 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7683 #: ../en/ch06-collab.xml:123
|
dongsheng@627
|
7684 msgid ""
|
dongsheng@627
|
7685 "As one example, many projects have a loose-knit group of collaborators who "
|
dongsheng@627
|
7686 "rarely physically meet each other. Some groups like to overcome the "
|
songdongsheng@710
|
7687 "isolation of working at a distance by organizing occasional <quote>sprints</"
|
dongsheng@627
|
7688 "quote>. In a sprint, a number of people get together in a single location (a "
|
dongsheng@627
|
7689 "company's conference room, a hotel meeting room, that kind of place) and "
|
dongsheng@627
|
7690 "spend several days more or less locked in there, hacking intensely on a "
|
dongsheng@627
|
7691 "handful of projects."
|
dongsheng@627
|
7692 msgstr ""
|
dongsheng@627
|
7693
|
dongsheng@627
|
7694 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7695 #: ../en/ch06-collab.xml:132
|
songdongsheng@710
|
7696 msgid ""
|
songdongsheng@710
|
7697 "A sprint or a hacking session in a coffee shop are the perfect places to use "
|
songdongsheng@710
|
7698 "the <command role=\"hg-cmd\">hg serve</command> command, since <command role="
|
songdongsheng@710
|
7699 "\"hg-cmd\">hg serve</command> does not require any fancy server "
|
songdongsheng@710
|
7700 "infrastructure. You can get started with <command role=\"hg-cmd\">hg serve</"
|
songdongsheng@710
|
7701 "command> in moments, by reading <xref linkend=\"sec:collab:serve\"/> below. "
|
songdongsheng@710
|
7702 "Then simply tell the person next to you that you're running a server, send "
|
songdongsheng@710
|
7703 "the URL to them in an instant message, and you immediately have a quick-"
|
songdongsheng@710
|
7704 "turnaround way to work together. They can type your URL into their web "
|
songdongsheng@710
|
7705 "browser and quickly review your changes; or they can pull a bugfix from you "
|
songdongsheng@710
|
7706 "and verify it; or they can clone a branch containing a new feature and try it "
|
songdongsheng@710
|
7707 "out."
|
songdongsheng@710
|
7708 msgstr ""
|
songdongsheng@710
|
7709
|
songdongsheng@710
|
7710 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7711 #: ../en/ch06-collab.xml:146
|
dongsheng@627
|
7712 msgid ""
|
dongsheng@627
|
7713 "The charm, and the problem, with doing things in an ad hoc fashion like this "
|
dongsheng@627
|
7714 "is that only people who know about your changes, and where they are, can see "
|
dongsheng@627
|
7715 "them. Such an informal approach simply doesn't scale beyond a handful "
|
songdongsheng@710
|
7716 "people, because each individual needs to know about <emphasis>n</emphasis> "
|
songdongsheng@710
|
7717 "different repositories to pull from."
|
songdongsheng@710
|
7718 msgstr ""
|
songdongsheng@710
|
7719
|
songdongsheng@710
|
7720 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
7721 #: ../en/ch06-collab.xml:156
|
dongsheng@627
|
7722 msgid "A single central repository"
|
dongsheng@630
|
7723 msgstr "单一中央版本库"
|
dongsheng@627
|
7724
|
dongsheng@627
|
7725 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7726 #: ../en/ch06-collab.xml:158
|
dongsheng@627
|
7727 msgid ""
|
dongsheng@627
|
7728 "For smaller projects migrating from a centralised revision control tool, "
|
dongsheng@627
|
7729 "perhaps the easiest way to get started is to have changes flow through a "
|
dongsheng@627
|
7730 "single shared central repository. This is also the most common "
|
dongsheng@627
|
7731 "<quote>building block</quote> for more ambitious workflow schemes."
|
dongsheng@627
|
7732 msgstr ""
|
dongsheng@627
|
7733
|
dongsheng@627
|
7734 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7735 #: ../en/ch06-collab.xml:164
|
dongsheng@627
|
7736 msgid ""
|
dongsheng@627
|
7737 "Contributors start by cloning a copy of this repository. They can pull "
|
dongsheng@627
|
7738 "changes from it whenever they need to, and some (perhaps all) developers have "
|
dongsheng@627
|
7739 "permission to push a change back when they're ready for other people to see "
|
dongsheng@627
|
7740 "it."
|
dongsheng@627
|
7741 msgstr ""
|
dongsheng@627
|
7742
|
dongsheng@627
|
7743 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7744 #: ../en/ch06-collab.xml:169
|
dongsheng@627
|
7745 msgid ""
|
dongsheng@627
|
7746 "Under this model, it can still often make sense for people to pull changes "
|
dongsheng@627
|
7747 "directly from each other, without going through the central repository. "
|
dongsheng@627
|
7748 "Consider a case in which I have a tentative bug fix, but I am worried that if "
|
dongsheng@627
|
7749 "I were to publish it to the central repository, it might subsequently break "
|
dongsheng@627
|
7750 "everyone else's trees as they pull it. To reduce the potential for damage, I "
|
dongsheng@627
|
7751 "can ask you to clone my repository into a temporary repository of your own "
|
dongsheng@627
|
7752 "and test it. This lets us put off publishing the potentially unsafe change "
|
dongsheng@627
|
7753 "until it has had a little testing."
|
dongsheng@627
|
7754 msgstr ""
|
dongsheng@627
|
7755
|
dongsheng@627
|
7756 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7757 #: ../en/ch06-collab.xml:180
|
songdongsheng@710
|
7758 msgid ""
|
songdongsheng@710
|
7759 "If a team is hosting its own repository in this kind of scenario, people will "
|
songdongsheng@710
|
7760 "usually use the <command>ssh</command> protocol to securely push changes to "
|
songdongsheng@710
|
7761 "the central repository, as documented in <xref linkend=\"sec:collab:ssh\"/>. "
|
songdongsheng@710
|
7762 "It's also usual to publish a read-only copy of the repository over HTTP, as "
|
songdongsheng@710
|
7763 "in <xref linkend=\"sec:collab:cgi\"/>. Publishing over HTTP satisfies the "
|
songdongsheng@710
|
7764 "needs of people who don't have push access, and those who want to use web "
|
songdongsheng@710
|
7765 "browsers to browse the repository's history."
|
songdongsheng@710
|
7766 msgstr ""
|
songdongsheng@710
|
7767
|
songdongsheng@710
|
7768 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
7769 #: ../en/ch06-collab.xml:193
|
songdongsheng@710
|
7770 msgid "A hosted central repository"
|
songdongsheng@711
|
7771 msgstr "托管的中央版本库"
|
songdongsheng@710
|
7772
|
songdongsheng@710
|
7773 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7774 #: ../en/ch06-collab.xml:195
|
songdongsheng@710
|
7775 msgid ""
|
songdongsheng@710
|
7776 "A wonderful thing about public hosting services like <ulink url=\"http://"
|
songdongsheng@710
|
7777 "bitbucket.org/\">Bitbucket</ulink> is that not only do they handle the fiddly "
|
songdongsheng@710
|
7778 "server configuration details, such as user accounts, authentication, and "
|
songdongsheng@710
|
7779 "secure wire protocols, they provide additional infrastructure to make this "
|
songdongsheng@710
|
7780 "model work well."
|
songdongsheng@710
|
7781 msgstr ""
|
songdongsheng@710
|
7782
|
songdongsheng@710
|
7783 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7784 #: ../en/ch06-collab.xml:202
|
songdongsheng@710
|
7785 msgid ""
|
songdongsheng@710
|
7786 "For instance, a well-engineered hosting service will let people clone their "
|
songdongsheng@710
|
7787 "own copies of a repository with a single click. This lets people work in "
|
songdongsheng@710
|
7788 "separate spaces and share their changes when they're ready."
|
songdongsheng@710
|
7789 msgstr ""
|
songdongsheng@710
|
7790
|
songdongsheng@710
|
7791 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7792 #: ../en/ch06-collab.xml:207
|
songdongsheng@710
|
7793 msgid ""
|
songdongsheng@710
|
7794 "In addition, a good hosting service will let people communicate with each "
|
songdongsheng@710
|
7795 "other, for instance to say <quote>there are changes ready for you to review "
|
songdongsheng@710
|
7796 "in this tree</quote>."
|
songdongsheng@710
|
7797 msgstr ""
|
songdongsheng@710
|
7798
|
songdongsheng@710
|
7799 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
7800 #: ../en/ch06-collab.xml:214
|
dongsheng@627
|
7801 msgid "Working with multiple branches"
|
dongsheng@630
|
7802 msgstr "使用多个分支工作"
|
dongsheng@627
|
7803
|
dongsheng@627
|
7804 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7805 #: ../en/ch06-collab.xml:216
|
dongsheng@627
|
7806 msgid ""
|
dongsheng@627
|
7807 "Projects of any significant size naturally tend to make progress on several "
|
dongsheng@627
|
7808 "fronts simultaneously. In the case of software, it's common for a project to "
|
dongsheng@627
|
7809 "go through periodic official releases. A release might then go into "
|
dongsheng@627
|
7810 "<quote>maintenance mode</quote> for a while after its first publication; "
|
dongsheng@627
|
7811 "maintenance releases tend to contain only bug fixes, not new features. In "
|
dongsheng@627
|
7812 "parallel with these maintenance releases, one or more future releases may be "
|
dongsheng@627
|
7813 "under development. People normally use the word <quote>branch</quote> to "
|
dongsheng@627
|
7814 "refer to one of these many slightly different directions in which development "
|
dongsheng@627
|
7815 "is proceeding."
|
dongsheng@627
|
7816 msgstr ""
|
dongsheng@627
|
7817
|
dongsheng@627
|
7818 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7819 #: ../en/ch06-collab.xml:229
|
dongsheng@627
|
7820 msgid ""
|
dongsheng@627
|
7821 "Mercurial is particularly well suited to managing a number of simultaneous, "
|
dongsheng@627
|
7822 "but not identical, branches. Each <quote>development direction</quote> can "
|
dongsheng@627
|
7823 "live in its own central repository, and you can merge changes from one to "
|
dongsheng@627
|
7824 "another as the need arises. Because repositories are independent of each "
|
dongsheng@627
|
7825 "other, unstable changes in a development branch will never affect a stable "
|
songdongsheng@710
|
7826 "branch unless someone explicitly merges those changes into the stable branch."
|
songdongsheng@710
|
7827 msgstr ""
|
songdongsheng@710
|
7828
|
songdongsheng@710
|
7829 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7830 #: ../en/ch06-collab.xml:238
|
dongsheng@627
|
7831 msgid ""
|
dongsheng@627
|
7832 "Here's an example of how this can work in practice. Let's say you have one "
|
dongsheng@627
|
7833 "<quote>main branch</quote> on a central server."
|
dongsheng@627
|
7834 msgstr ""
|
dongsheng@627
|
7835
|
dongsheng@627
|
7836 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7837 #: ../en/ch06-collab.xml:244
|
dongsheng@627
|
7838 msgid "People clone it, make changes locally, test them, and push them back."
|
dongsheng@627
|
7839 msgstr ""
|
dongsheng@627
|
7840
|
dongsheng@627
|
7841 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7842 #: ../en/ch06-collab.xml:247
|
dongsheng@627
|
7843 msgid ""
|
dongsheng@627
|
7844 "Once the main branch reaches a release milestone, you can use the <command "
|
dongsheng@627
|
7845 "role=\"hg-cmd\">hg tag</command> command to give a permanent name to the "
|
dongsheng@627
|
7846 "milestone revision."
|
dongsheng@627
|
7847 msgstr ""
|
dongsheng@627
|
7848
|
dongsheng@627
|
7849 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7850 #: ../en/ch06-collab.xml:253
|
dongsheng@627
|
7851 msgid "Let's say some ongoing development occurs on the main branch."
|
dongsheng@627
|
7852 msgstr ""
|
dongsheng@627
|
7853
|
dongsheng@627
|
7854 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7855 #: ../en/ch06-collab.xml:258
|
dongsheng@627
|
7856 msgid ""
|
dongsheng@627
|
7857 "Using the tag that was recorded at the milestone, people who clone that "
|
dongsheng@627
|
7858 "repository at any time in the future can use <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
7859 "update</command> to get a copy of the working directory exactly as it was "
|
dongsheng@627
|
7860 "when that tagged revision was committed."
|
dongsheng@627
|
7861 msgstr ""
|
dongsheng@627
|
7862
|
songdongsheng@710
|
7863 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7864 #: ../en/ch06-collab.xml:266
|
songdongsheng@710
|
7865 msgid ""
|
songdongsheng@710
|
7866 "In addition, immediately after the main branch is tagged, we can then clone "
|
songdongsheng@710
|
7867 "the main branch on the server to a new <quote>stable</quote> branch, also on "
|
songdongsheng@710
|
7868 "the server."
|
songdongsheng@710
|
7869 msgstr ""
|
songdongsheng@710
|
7870
|
songdongsheng@710
|
7871 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7872 #: ../en/ch06-collab.xml:272
|
songdongsheng@710
|
7873 msgid ""
|
songdongsheng@710
|
7874 "If we need to make a change to the stable branch, we can then clone "
|
songdongsheng@710
|
7875 "<emphasis>that</emphasis> repository, make our changes, commit, and push our "
|
songdongsheng@710
|
7876 "changes back there."
|
songdongsheng@710
|
7877 msgstr ""
|
songdongsheng@710
|
7878
|
songdongsheng@710
|
7879 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7880 #: ../en/ch06-collab.xml:279
|
dongsheng@627
|
7881 msgid ""
|
dongsheng@627
|
7882 "Because Mercurial repositories are independent, and Mercurial doesn't move "
|
dongsheng@627
|
7883 "changes around automatically, the stable and main branches are "
|
songdongsheng@710
|
7884 "<emphasis>isolated</emphasis> from each other. The changes that we made on "
|
dongsheng@627
|
7885 "the main branch don't <quote>leak</quote> to the stable branch, and vice "
|
dongsheng@627
|
7886 "versa."
|
dongsheng@627
|
7887 msgstr ""
|
dongsheng@627
|
7888
|
dongsheng@627
|
7889 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7890 #: ../en/ch06-collab.xml:286
|
songdongsheng@710
|
7891 msgid ""
|
songdongsheng@710
|
7892 "We'll often want all of our bugfixes on the stable branch to show up on the "
|
songdongsheng@710
|
7893 "main branch, too. Rather than rewrite a bugfix on the main branch, we can "
|
dongsheng@627
|
7894 "simply pull and merge changes from the stable to the main branch, and "
|
songdongsheng@710
|
7895 "Mercurial will bring those bugfixes in for us."
|
songdongsheng@710
|
7896 msgstr ""
|
songdongsheng@710
|
7897
|
songdongsheng@710
|
7898 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7899 #: ../en/ch06-collab.xml:294
|
dongsheng@627
|
7900 msgid ""
|
dongsheng@627
|
7901 "The main branch will still contain changes that are not on the stable branch, "
|
dongsheng@627
|
7902 "but it will also contain all of the bugfixes from the stable branch. The "
|
songdongsheng@710
|
7903 "stable branch remains unaffected by these changes, since changes are only "
|
songdongsheng@710
|
7904 "flowing from the stable to the main branch, and not the other way."
|
dongsheng@627
|
7905 msgstr ""
|
dongsheng@627
|
7906
|
songdongsheng@658
|
7907 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
|
dongsheng@714
|
7908 #: ../en/ch06-collab.xml:303 ../en/ch06-collab.xml:313
|
dongsheng@627
|
7909 msgid "Feature branches"
|
dongsheng@630
|
7910 msgstr "特性分支"
|
dongsheng@627
|
7911
|
dongsheng@627
|
7912 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7913 #: ../en/ch06-collab.xml:305
|
dongsheng@627
|
7914 msgid ""
|
dongsheng@627
|
7915 "For larger projects, an effective way to manage change is to break up a team "
|
dongsheng@627
|
7916 "into smaller groups. Each group has a shared branch of its own, cloned from "
|
dongsheng@627
|
7917 "a single <quote>master</quote> branch used by the entire project. People "
|
dongsheng@627
|
7918 "working on an individual branch are typically quite isolated from "
|
dongsheng@627
|
7919 "developments on other branches."
|
dongsheng@627
|
7920 msgstr ""
|
dongsheng@627
|
7921
|
songdongsheng@658
|
7922 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
|
dongsheng@714
|
7923 #: ../en/ch06-collab.xml:315
|
dongsheng@641
|
7924 msgid ""
|
songdongsheng@658
|
7925 "<imageobject><imagedata width=\"100%\" fileref=\"figs/feature-branches.png\"/"
|
songdongsheng@658
|
7926 "></imageobject>"
|
songdongsheng@658
|
7927 msgstr ""
|
songdongsheng@658
|
7928
|
songdongsheng@658
|
7929 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7930 #: ../en/ch06-collab.xml:320
|
dongsheng@627
|
7931 msgid ""
|
dongsheng@627
|
7932 "When a particular feature is deemed to be in suitable shape, someone on that "
|
dongsheng@627
|
7933 "feature team pulls and merges from the master branch into the feature branch, "
|
dongsheng@627
|
7934 "then pushes back up to the master branch."
|
dongsheng@627
|
7935 msgstr ""
|
dongsheng@627
|
7936
|
dongsheng@627
|
7937 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
7938 #: ../en/ch06-collab.xml:327
|
dongsheng@627
|
7939 msgid "The release train"
|
dongsheng@630
|
7940 msgstr "发布列车"
|
dongsheng@627
|
7941
|
dongsheng@627
|
7942 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7943 #: ../en/ch06-collab.xml:329
|
songdongsheng@710
|
7944 msgid ""
|
songdongsheng@710
|
7945 "Some projects are organized on a <quote>train</quote> basis: a release is "
|
dongsheng@627
|
7946 "scheduled to happen every few months, and whatever features are ready when "
|
dongsheng@627
|
7947 "the <quote>train</quote> is ready to leave are allowed in."
|
dongsheng@627
|
7948 msgstr ""
|
dongsheng@627
|
7949
|
dongsheng@627
|
7950 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7951 #: ../en/ch06-collab.xml:334
|
dongsheng@627
|
7952 msgid ""
|
dongsheng@627
|
7953 "This model resembles working with feature branches. The difference is that "
|
dongsheng@627
|
7954 "when a feature branch misses a train, someone on the feature team pulls and "
|
dongsheng@627
|
7955 "merges the changes that went out on that train release into the feature "
|
dongsheng@627
|
7956 "branch, and the team continues its work on top of that release so that their "
|
dongsheng@627
|
7957 "feature can make the next release."
|
dongsheng@627
|
7958 msgstr ""
|
dongsheng@627
|
7959
|
dongsheng@627
|
7960 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
7961 #: ../en/ch06-collab.xml:343
|
dongsheng@627
|
7962 msgid "The Linux kernel model"
|
dongsheng@630
|
7963 msgstr "Linux 内核模型"
|
dongsheng@627
|
7964
|
dongsheng@627
|
7965 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7966 #: ../en/ch06-collab.xml:345
|
dongsheng@627
|
7967 msgid ""
|
dongsheng@627
|
7968 "The development of the Linux kernel has a shallow hierarchical structure, "
|
dongsheng@627
|
7969 "surrounded by a cloud of apparent chaos. Because most Linux developers use "
|
dongsheng@627
|
7970 "<command>git</command>, a distributed revision control tool with capabilities "
|
dongsheng@627
|
7971 "similar to Mercurial, it's useful to describe the way work flows in that "
|
dongsheng@627
|
7972 "environment; if you like the ideas, the approach translates well across tools."
|
dongsheng@627
|
7973 msgstr ""
|
dongsheng@627
|
7974
|
dongsheng@627
|
7975 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7976 #: ../en/ch06-collab.xml:353
|
dongsheng@627
|
7977 msgid ""
|
dongsheng@627
|
7978 "At the center of the community sits Linus Torvalds, the creator of Linux. He "
|
dongsheng@627
|
7979 "publishes a single source repository that is considered the "
|
dongsheng@627
|
7980 "<quote>authoritative</quote> current tree by the entire developer community. "
|
dongsheng@627
|
7981 "Anyone can clone Linus's tree, but he is very choosy about whose trees he "
|
dongsheng@627
|
7982 "pulls from."
|
dongsheng@627
|
7983 msgstr ""
|
dongsheng@627
|
7984
|
dongsheng@627
|
7985 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
7986 #: ../en/ch06-collab.xml:360
|
dongsheng@627
|
7987 msgid ""
|
dongsheng@627
|
7988 "Linus has a number of <quote>trusted lieutenants</quote>. As a general rule, "
|
dongsheng@627
|
7989 "he pulls whatever changes they publish, in most cases without even reviewing "
|
dongsheng@627
|
7990 "those changes. Some of those lieutenants are generally agreed to be "
|
dongsheng@627
|
7991 "<quote>maintainers</quote>, responsible for specific subsystems within the "
|
dongsheng@627
|
7992 "kernel. If a random kernel hacker wants to make a change to a subsystem that "
|
dongsheng@627
|
7993 "they want to end up in Linus's tree, they must find out who the subsystem's "
|
dongsheng@627
|
7994 "maintainer is, and ask that maintainer to take their change. If the "
|
dongsheng@627
|
7995 "maintainer reviews their changes and agrees to take them, they'll pass them "
|
dongsheng@627
|
7996 "along to Linus in due course."
|
dongsheng@627
|
7997 msgstr ""
|
dongsheng@627
|
7998
|
dongsheng@627
|
7999 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8000 #: ../en/ch06-collab.xml:372
|
dongsheng@627
|
8001 msgid ""
|
dongsheng@627
|
8002 "Individual lieutenants have their own approaches to reviewing, accepting, and "
|
dongsheng@627
|
8003 "publishing changes; and for deciding when to feed them to Linus. In "
|
dongsheng@627
|
8004 "addition, there are several well known branches that people use for different "
|
dongsheng@627
|
8005 "purposes. For example, a few people maintain <quote>stable</quote> "
|
dongsheng@627
|
8006 "repositories of older versions of the kernel, to which they apply critical "
|
dongsheng@627
|
8007 "fixes as needed. Some maintainers publish multiple trees: one for "
|
dongsheng@627
|
8008 "experimental changes; one for changes that they are about to feed upstream; "
|
dongsheng@627
|
8009 "and so on. Others just publish a single tree."
|
dongsheng@627
|
8010 msgstr ""
|
dongsheng@627
|
8011
|
dongsheng@627
|
8012 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8013 #: ../en/ch06-collab.xml:383
|
dongsheng@627
|
8014 msgid ""
|
dongsheng@627
|
8015 "This model has two notable features. The first is that it's <quote>pull "
|
dongsheng@627
|
8016 "only</quote>. You have to ask, convince, or beg another developer to take a "
|
dongsheng@627
|
8017 "change from you, because there are almost no trees to which more than one "
|
dongsheng@627
|
8018 "person can push, and there's no way to push changes into a tree that someone "
|
dongsheng@627
|
8019 "else controls."
|
dongsheng@627
|
8020 msgstr ""
|
dongsheng@627
|
8021
|
dongsheng@627
|
8022 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8023 #: ../en/ch06-collab.xml:390
|
dongsheng@627
|
8024 msgid ""
|
dongsheng@627
|
8025 "The second is that it's based on reputation and acclaim. If you're an "
|
dongsheng@627
|
8026 "unknown, Linus will probably ignore changes from you without even "
|
dongsheng@627
|
8027 "responding. But a subsystem maintainer will probably review them, and will "
|
dongsheng@627
|
8028 "likely take them if they pass their criteria for suitability. The more "
|
dongsheng@627
|
8029 "<quote>good</quote> changes you contribute to a maintainer, the more likely "
|
dongsheng@627
|
8030 "they are to trust your judgment and accept your changes. If you're well-"
|
dongsheng@627
|
8031 "known and maintain a long-lived branch for something Linus hasn't yet "
|
dongsheng@627
|
8032 "accepted, people with similar interests may pull your changes regularly to "
|
dongsheng@627
|
8033 "keep up with your work."
|
dongsheng@627
|
8034 msgstr ""
|
dongsheng@627
|
8035
|
dongsheng@627
|
8036 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8037 #: ../en/ch06-collab.xml:401
|
dongsheng@627
|
8038 msgid ""
|
dongsheng@627
|
8039 "Reputation and acclaim don't necessarily cross subsystem or <quote>people</"
|
dongsheng@627
|
8040 "quote> boundaries. If you're a respected but specialised storage hacker, and "
|
dongsheng@627
|
8041 "you try to fix a networking bug, that change will receive a level of scrutiny "
|
dongsheng@627
|
8042 "from a network maintainer comparable to a change from a complete stranger."
|
dongsheng@627
|
8043 msgstr ""
|
dongsheng@627
|
8044
|
dongsheng@627
|
8045 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8046 #: ../en/ch06-collab.xml:408
|
dongsheng@627
|
8047 msgid ""
|
dongsheng@627
|
8048 "To people who come from more orderly project backgrounds, the comparatively "
|
dongsheng@627
|
8049 "chaotic Linux kernel development process often seems completely insane. It's "
|
dongsheng@627
|
8050 "subject to the whims of individuals; people make sweeping changes whenever "
|
dongsheng@627
|
8051 "they deem it appropriate; and the pace of development is astounding. And yet "
|
dongsheng@627
|
8052 "Linux is a highly successful, well-regarded piece of software."
|
dongsheng@627
|
8053 msgstr ""
|
dongsheng@627
|
8054
|
dongsheng@627
|
8055 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
8056 #: ../en/ch06-collab.xml:418
|
dongsheng@627
|
8057 msgid "Pull-only versus shared-push collaboration"
|
dongsheng@630
|
8058 msgstr "只读与共享写协作"
|
dongsheng@627
|
8059
|
dongsheng@627
|
8060 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8061 #: ../en/ch06-collab.xml:420
|
dongsheng@627
|
8062 msgid ""
|
dongsheng@627
|
8063 "A perpetual source of heat in the open source community is whether a "
|
dongsheng@627
|
8064 "development model in which people only ever pull changes from others is "
|
dongsheng@627
|
8065 "<quote>better than</quote> one in which multiple people can push changes to a "
|
dongsheng@627
|
8066 "shared repository."
|
dongsheng@627
|
8067 msgstr ""
|
dongsheng@627
|
8068
|
dongsheng@627
|
8069 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8070 #: ../en/ch06-collab.xml:426
|
dongsheng@627
|
8071 msgid ""
|
dongsheng@627
|
8072 "Typically, the backers of the shared-push model use tools that actively "
|
dongsheng@627
|
8073 "enforce this approach. If you're using a centralised revision control tool "
|
dongsheng@627
|
8074 "such as Subversion, there's no way to make a choice over which model you'll "
|
dongsheng@627
|
8075 "use: the tool gives you shared-push, and if you want to do anything else, "
|
dongsheng@627
|
8076 "you'll have to roll your own approach on top (such as applying a patch by "
|
dongsheng@627
|
8077 "hand)."
|
dongsheng@627
|
8078 msgstr ""
|
dongsheng@627
|
8079
|
dongsheng@627
|
8080 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8081 #: ../en/ch06-collab.xml:434
|
songdongsheng@710
|
8082 msgid ""
|
songdongsheng@710
|
8083 "A good distributed revision control tool will support both models. You and "
|
songdongsheng@710
|
8084 "your collaborators can then structure how you work together based on your own "
|
songdongsheng@710
|
8085 "needs and preferences, not on what contortions your tools force you into."
|
songdongsheng@710
|
8086 msgstr ""
|
songdongsheng@710
|
8087
|
songdongsheng@710
|
8088 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
8089 #: ../en/ch06-collab.xml:441
|
dongsheng@627
|
8090 msgid "Where collaboration meets branch management"
|
dongsheng@630
|
8091 msgstr "协作与分支管理"
|
dongsheng@627
|
8092
|
dongsheng@627
|
8093 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8094 #: ../en/ch06-collab.xml:443
|
dongsheng@627
|
8095 msgid ""
|
dongsheng@627
|
8096 "Once you and your team set up some shared repositories and start propagating "
|
dongsheng@627
|
8097 "changes back and forth between local and shared repos, you begin to face a "
|
dongsheng@627
|
8098 "related, but slightly different challenge: that of managing the multiple "
|
dongsheng@627
|
8099 "directions in which your team may be moving at once. Even though this "
|
dongsheng@627
|
8100 "subject is intimately related to how your team collaborates, it's dense "
|
songdongsheng@658
|
8101 "enough to merit treatment of its own, in <xref linkend=\"chap:branch\"/>."
|
dongsheng@627
|
8102 msgstr ""
|
dongsheng@627
|
8103
|
dongsheng@627
|
8104 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
8105 #: ../en/ch06-collab.xml:455
|
dongsheng@627
|
8106 msgid "The technical side of sharing"
|
dongsheng@630
|
8107 msgstr "共享的技术因素"
|
dongsheng@627
|
8108
|
dongsheng@627
|
8109 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
8110 #: ../en/ch06-collab.xml:457
|
songdongsheng@710
|
8111 msgid ""
|
songdongsheng@710
|
8112 "The remainder of this chapter is devoted to the question of sharing changes "
|
songdongsheng@710
|
8113 "with your collaborators."
|
dongsheng@627
|
8114 msgstr ""
|
dongsheng@627
|
8115
|
dongsheng@627
|
8116 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
8117 #: ../en/ch06-collab.xml:462
|
dongsheng@627
|
8118 msgid "Informal sharing with <command role=\"hg-cmd\">hg serve</command>"
|
dongsheng@630
|
8119 msgstr "使用 <command role=\"hg-cmd\">hg serve</command> 进行非正式共享"
|
dongsheng@627
|
8120
|
dongsheng@627
|
8121 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
8122 #: ../en/ch06-collab.xml:465
|
dongsheng@627
|
8123 msgid ""
|
dongsheng@627
|
8124 "Mercurial's <command role=\"hg-cmd\">hg serve</command> command is "
|
dongsheng@627
|
8125 "wonderfully suited to small, tight-knit, and fast-paced group environments. "
|
dongsheng@627
|
8126 "It also provides a great way to get a feel for using Mercurial commands over "
|
dongsheng@627
|
8127 "a network."
|
dongsheng@627
|
8128 msgstr ""
|
dongsheng@627
|
8129
|
dongsheng@627
|
8130 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
8131 #: ../en/ch06-collab.xml:470
|
dongsheng@627
|
8132 msgid ""
|
dongsheng@627
|
8133 "Run <command role=\"hg-cmd\">hg serve</command> inside a repository, and in "
|
dongsheng@627
|
8134 "under a second it will bring up a specialised HTTP server; this will accept "
|
dongsheng@627
|
8135 "connections from any client, and serve up data for that repository until you "
|
dongsheng@627
|
8136 "terminate it. Anyone who knows the URL of the server you just started, and "
|
dongsheng@627
|
8137 "can talk to your computer over the network, can then use a web browser or "
|
dongsheng@627
|
8138 "Mercurial to read data from that repository. A URL for a <command role=\"hg-"
|
dongsheng@627
|
8139 "cmd\">hg serve</command> instance running on a laptop is likely to look "
|
dongsheng@627
|
8140 "something like <literal>http://my-laptop.local:8000/</literal>."
|
dongsheng@627
|
8141 msgstr ""
|
dongsheng@627
|
8142
|
dongsheng@627
|
8143 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
8144 #: ../en/ch06-collab.xml:481
|
dongsheng@627
|
8145 msgid ""
|
dongsheng@627
|
8146 "The <command role=\"hg-cmd\">hg serve</command> command is <emphasis>not</"
|
dongsheng@627
|
8147 "emphasis> a general-purpose web server. It can do only two things:"
|
dongsheng@627
|
8148 msgstr ""
|
dongsheng@627
|
8149
|
dongsheng@627
|
8150 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
8151 #: ../en/ch06-collab.xml:485
|
dongsheng@627
|
8152 msgid ""
|
dongsheng@627
|
8153 "Allow people to browse the history of the repository it's serving, from their "
|
dongsheng@627
|
8154 "normal web browsers."
|
dongsheng@627
|
8155 msgstr ""
|
dongsheng@627
|
8156
|
dongsheng@627
|
8157 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
8158 #: ../en/ch06-collab.xml:489
|
dongsheng@627
|
8159 msgid ""
|
dongsheng@627
|
8160 "Speak Mercurial's wire protocol, so that people can <command role=\"hg-cmd"
|
dongsheng@627
|
8161 "\">hg clone</command> or <command role=\"hg-cmd\">hg pull</command> changes "
|
dongsheng@627
|
8162 "from that repository."
|
dongsheng@627
|
8163 msgstr ""
|
dongsheng@627
|
8164
|
dongsheng@627
|
8165 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
8166 #: ../en/ch06-collab.xml:494
|
dongsheng@627
|
8167 msgid ""
|
dongsheng@627
|
8168 "In particular, <command role=\"hg-cmd\">hg serve</command> won't allow remote "
|
dongsheng@627
|
8169 "users to <emphasis>modify</emphasis> your repository. It's intended for read-"
|
dongsheng@627
|
8170 "only use."
|
dongsheng@627
|
8171 msgstr ""
|
dongsheng@627
|
8172
|
dongsheng@627
|
8173 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
8174 #: ../en/ch06-collab.xml:498
|
dongsheng@627
|
8175 msgid ""
|
dongsheng@627
|
8176 "If you're getting started with Mercurial, there's nothing to prevent you from "
|
dongsheng@627
|
8177 "using <command role=\"hg-cmd\">hg serve</command> to serve up a repository on "
|
dongsheng@627
|
8178 "your own computer, then use commands like <command role=\"hg-cmd\">hg clone</"
|
dongsheng@627
|
8179 "command>, <command role=\"hg-cmd\">hg incoming</command>, and so on to talk "
|
dongsheng@627
|
8180 "to that server as if the repository was hosted remotely. This can help you to "
|
dongsheng@627
|
8181 "quickly get acquainted with using commands on network-hosted repositories."
|
dongsheng@627
|
8182 msgstr ""
|
dongsheng@627
|
8183
|
dongsheng@627
|
8184 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
8185 #: ../en/ch06-collab.xml:508
|
dongsheng@627
|
8186 msgid "A few things to keep in mind"
|
dongsheng@630
|
8187 msgstr "要牢记的几件事"
|
dongsheng@627
|
8188
|
dongsheng@627
|
8189 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8190 #: ../en/ch06-collab.xml:510
|
dongsheng@627
|
8191 msgid ""
|
dongsheng@627
|
8192 "Because it provides unauthenticated read access to all clients, you should "
|
dongsheng@627
|
8193 "only use <command role=\"hg-cmd\">hg serve</command> in an environment where "
|
dongsheng@627
|
8194 "you either don't care, or have complete control over, who can access your "
|
dongsheng@627
|
8195 "network and pull data from your repository."
|
dongsheng@627
|
8196 msgstr ""
|
dongsheng@627
|
8197
|
dongsheng@627
|
8198 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8199 #: ../en/ch06-collab.xml:516
|
dongsheng@627
|
8200 msgid ""
|
dongsheng@627
|
8201 "The <command role=\"hg-cmd\">hg serve</command> command knows nothing about "
|
dongsheng@627
|
8202 "any firewall software you might have installed on your system or network. It "
|
dongsheng@627
|
8203 "cannot detect or control your firewall software. If other people are unable "
|
dongsheng@627
|
8204 "to talk to a running <command role=\"hg-cmd\">hg serve</command> instance, "
|
dongsheng@627
|
8205 "the second thing you should do (<emphasis>after</emphasis> you make sure that "
|
dongsheng@627
|
8206 "they're using the correct URL) is check your firewall configuration."
|
dongsheng@627
|
8207 msgstr ""
|
dongsheng@627
|
8208
|
dongsheng@627
|
8209 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8210 #: ../en/ch06-collab.xml:525
|
dongsheng@627
|
8211 msgid ""
|
dongsheng@627
|
8212 "By default, <command role=\"hg-cmd\">hg serve</command> listens for incoming "
|
dongsheng@627
|
8213 "connections on port 8000. If another process is already listening on the "
|
dongsheng@627
|
8214 "port you want to use, you can specify a different port to listen on using the "
|
dongsheng@627
|
8215 "<option role=\"hg-opt-serve\">-p</option> option."
|
dongsheng@627
|
8216 msgstr ""
|
dongsheng@627
|
8217
|
dongsheng@627
|
8218 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8219 #: ../en/ch06-collab.xml:531
|
dongsheng@627
|
8220 msgid ""
|
dongsheng@627
|
8221 "Normally, when <command role=\"hg-cmd\">hg serve</command> starts, it prints "
|
dongsheng@627
|
8222 "no output, which can be a bit unnerving. If you'd like to confirm that it is "
|
dongsheng@627
|
8223 "indeed running correctly, and find out what URL you should send to your "
|
dongsheng@627
|
8224 "collaborators, start it with the <option role=\"hg-opt-global\">-v</option> "
|
dongsheng@627
|
8225 "option."
|
dongsheng@627
|
8226 msgstr ""
|
dongsheng@627
|
8227
|
dongsheng@627
|
8228 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
8229 #: ../en/ch06-collab.xml:541
|
dongsheng@627
|
8230 msgid "Using the Secure Shell (ssh) protocol"
|
dongsheng@630
|
8231 msgstr "使用 ssh 协议"
|
dongsheng@627
|
8232
|
dongsheng@627
|
8233 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
8234 #: ../en/ch06-collab.xml:543
|
dongsheng@627
|
8235 msgid ""
|
dongsheng@627
|
8236 "You can pull and push changes securely over a network connection using the "
|
dongsheng@627
|
8237 "Secure Shell (<literal>ssh</literal>) protocol. To use this successfully, "
|
dongsheng@627
|
8238 "you may have to do a little bit of configuration on the client or server "
|
dongsheng@627
|
8239 "sides."
|
dongsheng@627
|
8240 msgstr ""
|
dongsheng@627
|
8241
|
dongsheng@627
|
8242 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
8243 #: ../en/ch06-collab.xml:548
|
songdongsheng@710
|
8244 msgid ""
|
songdongsheng@710
|
8245 "If you're not familiar with ssh, it's the name of both a command and a "
|
songdongsheng@710
|
8246 "network protocol that let you securely communicate with another computer. To "
|
songdongsheng@710
|
8247 "use it with Mercurial, you'll be setting up one or more user accounts on a "
|
songdongsheng@710
|
8248 "server so that remote users can log in and execute commands."
|
songdongsheng@710
|
8249 msgstr ""
|
songdongsheng@710
|
8250
|
songdongsheng@710
|
8251 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
8252 #: ../en/ch06-collab.xml:554
|
dongsheng@627
|
8253 msgid ""
|
dongsheng@627
|
8254 "(If you <emphasis>are</emphasis> familiar with ssh, you'll probably find some "
|
dongsheng@627
|
8255 "of the material that follows to be elementary in nature.)"
|
dongsheng@627
|
8256 msgstr ""
|
dongsheng@627
|
8257
|
dongsheng@627
|
8258 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
8259 #: ../en/ch06-collab.xml:559
|
dongsheng@627
|
8260 msgid "How to read and write ssh URLs"
|
dongsheng@630
|
8261 msgstr "如何读写 ssh 路径"
|
dongsheng@627
|
8262
|
dongsheng@627
|
8263 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8264 #: ../en/ch06-collab.xml:561
|
songdongsheng@658
|
8265 msgid "An ssh URL tends to look like this:"
|
songdongsheng@658
|
8266 msgstr ""
|
songdongsheng@658
|
8267
|
songdongsheng@658
|
8268 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
8269 #: ../en/ch06-collab.xml:564
|
songdongsheng@658
|
8270 msgid ""
|
songdongsheng@658
|
8271 "The <quote><literal>ssh://</literal></quote> part tells Mercurial to use the "
|
songdongsheng@658
|
8272 "ssh protocol."
|
dongsheng@627
|
8273 msgstr ""
|
dongsheng@627
|
8274
|
dongsheng@627
|
8275 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
8276 #: ../en/ch06-collab.xml:567
|
dongsheng@627
|
8277 msgid ""
|
dongsheng@627
|
8278 "The <quote><literal>bos@</literal></quote> component indicates what username "
|
dongsheng@627
|
8279 "to log into the server as. You can leave this out if the remote username is "
|
dongsheng@627
|
8280 "the same as your local username."
|
dongsheng@627
|
8281 msgstr ""
|
dongsheng@627
|
8282
|
dongsheng@627
|
8283 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
8284 #: ../en/ch06-collab.xml:572
|
dongsheng@627
|
8285 msgid ""
|
dongsheng@627
|
8286 "The <quote><literal>hg.serpentine.com</literal></quote> gives the hostname of "
|
dongsheng@627
|
8287 "the server to log into."
|
dongsheng@627
|
8288 msgstr ""
|
dongsheng@627
|
8289
|
dongsheng@627
|
8290 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
8291 #: ../en/ch06-collab.xml:576
|
dongsheng@627
|
8292 msgid ""
|
dongsheng@627
|
8293 "The <quote>:22</quote> identifies the port number to connect to the server "
|
dongsheng@650
|
8294 "on. The default port is 22, so you only need to specify a colon and port "
|
dongsheng@650
|
8295 "number if you're <emphasis>not</emphasis> using port 22."
|
dongsheng@627
|
8296 msgstr ""
|
dongsheng@627
|
8297
|
dongsheng@627
|
8298 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
8299 #: ../en/ch06-collab.xml:581
|
dongsheng@627
|
8300 msgid ""
|
dongsheng@627
|
8301 "The remainder of the URL is the local path to the repository on the server."
|
dongsheng@627
|
8302 msgstr ""
|
dongsheng@627
|
8303
|
dongsheng@627
|
8304 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8305 #: ../en/ch06-collab.xml:585
|
dongsheng@627
|
8306 msgid ""
|
dongsheng@627
|
8307 "There's plenty of scope for confusion with the path component of ssh URLs, as "
|
dongsheng@627
|
8308 "there is no standard way for tools to interpret it. Some programs behave "
|
dongsheng@627
|
8309 "differently than others when dealing with these paths. This isn't an ideal "
|
dongsheng@627
|
8310 "situation, but it's unlikely to change. Please read the following paragraphs "
|
dongsheng@627
|
8311 "carefully."
|
dongsheng@627
|
8312 msgstr ""
|
dongsheng@627
|
8313
|
dongsheng@627
|
8314 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8315 #: ../en/ch06-collab.xml:592
|
dongsheng@627
|
8316 msgid ""
|
dongsheng@627
|
8317 "Mercurial treats the path to a repository on the server as relative to the "
|
dongsheng@627
|
8318 "remote user's home directory. For example, if user <literal>foo</literal> on "
|
dongsheng@627
|
8319 "the server has a home directory of <filename class=\"directory\">/home/foo</"
|
dongsheng@627
|
8320 "filename>, then an ssh URL that contains a path component of <filename class="
|
dongsheng@627
|
8321 "\"directory\">bar</filename> <emphasis>really</emphasis> refers to the "
|
dongsheng@627
|
8322 "directory <filename class=\"directory\">/home/foo/bar</filename>."
|
dongsheng@627
|
8323 msgstr ""
|
dongsheng@627
|
8324
|
dongsheng@627
|
8325 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8326 #: ../en/ch06-collab.xml:601
|
dongsheng@627
|
8327 msgid ""
|
dongsheng@627
|
8328 "If you want to specify a path relative to another user's home directory, you "
|
dongsheng@627
|
8329 "can use a path that starts with a tilde character followed by the user's name "
|
dongsheng@627
|
8330 "(let's call them <literal>otheruser</literal>), like this."
|
dongsheng@627
|
8331 msgstr ""
|
dongsheng@627
|
8332
|
dongsheng@627
|
8333 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8334 #: ../en/ch06-collab.xml:607
|
dongsheng@627
|
8335 msgid ""
|
dongsheng@627
|
8336 "And if you really want to specify an <emphasis>absolute</emphasis> path on "
|
dongsheng@627
|
8337 "the server, begin the path component with two slashes, as in this example."
|
dongsheng@627
|
8338 msgstr ""
|
dongsheng@627
|
8339
|
dongsheng@627
|
8340 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
8341 #: ../en/ch06-collab.xml:614
|
dongsheng@627
|
8342 msgid "Finding an ssh client for your system"
|
dongsheng@630
|
8343 msgstr "为你的系统寻找 ssh 客户端"
|
dongsheng@627
|
8344
|
dongsheng@627
|
8345 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8346 #: ../en/ch06-collab.xml:616
|
dongsheng@627
|
8347 msgid ""
|
dongsheng@627
|
8348 "Almost every Unix-like system comes with OpenSSH preinstalled. If you're "
|
dongsheng@627
|
8349 "using such a system, run <literal>which ssh</literal> to find out if the "
|
dongsheng@627
|
8350 "<command>ssh</command> command is installed (it's usually in <filename class="
|
dongsheng@627
|
8351 "\"directory\">/usr/bin</filename>). In the unlikely event that it isn't "
|
dongsheng@627
|
8352 "present, take a look at your system documentation to figure out how to "
|
dongsheng@627
|
8353 "install it."
|
dongsheng@627
|
8354 msgstr ""
|
dongsheng@627
|
8355
|
dongsheng@627
|
8356 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8357 #: ../en/ch06-collab.xml:624
|
songdongsheng@710
|
8358 msgid ""
|
songdongsheng@710
|
8359 "On Windows, the TortoiseHg package is bundled with a version of Simon "
|
songdongsheng@710
|
8360 "Tatham's excellent <command>plink</command> command, and you should not need "
|
songdongsheng@710
|
8361 "to do any further configuration."
|
songdongsheng@710
|
8362 msgstr ""
|
songdongsheng@710
|
8363
|
songdongsheng@710
|
8364 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
8365 #: ../en/ch06-collab.xml:631
|
dongsheng@627
|
8366 msgid "Generating a key pair"
|
dongsheng@630
|
8367 msgstr "产生密钥对"
|
dongsheng@627
|
8368
|
dongsheng@627
|
8369 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8370 #: ../en/ch06-collab.xml:633
|
dongsheng@627
|
8371 msgid ""
|
dongsheng@627
|
8372 "To avoid the need to repetitively type a password every time you need to use "
|
songdongsheng@710
|
8373 "your ssh client, I recommend generating a key pair."
|
songdongsheng@710
|
8374 msgstr ""
|
songdongsheng@710
|
8375
|
songdongsheng@710
|
8376 #. type: Content of: <book><chapter><sect1><sect2><tip><title>
|
dongsheng@714
|
8377 #: ../en/ch06-collab.xml:638
|
songdongsheng@710
|
8378 msgid "Key pairs are not mandatory"
|
songdongsheng@710
|
8379 msgstr ""
|
songdongsheng@710
|
8380
|
songdongsheng@710
|
8381 #. type: Content of: <book><chapter><sect1><sect2><tip><para>
|
dongsheng@714
|
8382 #: ../en/ch06-collab.xml:640
|
songdongsheng@710
|
8383 msgid ""
|
songdongsheng@710
|
8384 "Mercurial knows nothing about ssh authentication or key pairs. You can, if "
|
songdongsheng@710
|
8385 "you like, safely ignore this section and the one that follows until you grow "
|
songdongsheng@710
|
8386 "tired of repeatedly typing ssh passwords."
|
songdongsheng@710
|
8387 msgstr ""
|
songdongsheng@710
|
8388
|
songdongsheng@710
|
8389 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
8390 #: ../en/ch06-collab.xml:648
|
songdongsheng@710
|
8391 msgid ""
|
songdongsheng@710
|
8392 "On a Unix-like system, the <command>ssh-keygen</command> command will do the "
|
songdongsheng@710
|
8393 "trick."
|
songdongsheng@710
|
8394 msgstr ""
|
songdongsheng@710
|
8395
|
songdongsheng@710
|
8396 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
8397 #: ../en/ch06-collab.xml:651
|
songdongsheng@710
|
8398 msgid ""
|
songdongsheng@710
|
8399 "On Windows, if you're using TortoiseHg, you may need to download a command "
|
songdongsheng@710
|
8400 "named <command>puttygen</command> from <ulink url=\"http://www.chiark."
|
songdongsheng@710
|
8401 "greenend.org.uk/~sgtatham/putty\">the PuTTY web site</ulink> to generate a "
|
songdongsheng@710
|
8402 "key pair. See <ulink url=\"http://the.earth.li/~sgtatham/putty/0.60/htmldoc/"
|
songdongsheng@710
|
8403 "Chapter8.html#pubkey-puttygen\">the <command>puttygen</command> "
|
songdongsheng@710
|
8404 "documentation</ulink> for details of how use the command."
|
songdongsheng@710
|
8405 msgstr ""
|
songdongsheng@710
|
8406
|
songdongsheng@710
|
8407 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8408 #: ../en/ch06-collab.xml:663
|
dongsheng@627
|
8409 msgid ""
|
dongsheng@627
|
8410 "When you generate a key pair, it's usually <emphasis>highly</emphasis> "
|
dongsheng@627
|
8411 "advisable to protect it with a passphrase. (The only time that you might not "
|
dongsheng@627
|
8412 "want to do this is when you're using the ssh protocol for automated tasks on "
|
dongsheng@627
|
8413 "a secure network.)"
|
dongsheng@627
|
8414 msgstr ""
|
dongsheng@627
|
8415
|
dongsheng@627
|
8416 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8417 #: ../en/ch06-collab.xml:669
|
dongsheng@627
|
8418 msgid ""
|
dongsheng@627
|
8419 "Simply generating a key pair isn't enough, however. You'll need to add the "
|
dongsheng@627
|
8420 "public key to the set of authorised keys for whatever user you're logging in "
|
dongsheng@627
|
8421 "remotely as. For servers using OpenSSH (the vast majority), this will mean "
|
dongsheng@627
|
8422 "adding the public key to a list in a file called <filename role=\"special"
|
dongsheng@627
|
8423 "\">authorized_keys</filename> in their <filename role=\"special\" class="
|
dongsheng@627
|
8424 "\"directory\">.ssh</filename> directory."
|
dongsheng@627
|
8425 msgstr ""
|
dongsheng@627
|
8426
|
dongsheng@627
|
8427 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8428 #: ../en/ch06-collab.xml:678
|
dongsheng@627
|
8429 msgid ""
|
dongsheng@627
|
8430 "On a Unix-like system, your public key will have a <filename>.pub</filename> "
|
dongsheng@627
|
8431 "extension. If you're using <command>puttygen</command> on Windows, you can "
|
dongsheng@627
|
8432 "save the public key to a file of your choosing, or paste it from the window "
|
dongsheng@627
|
8433 "it's displayed in straight into the <filename role=\"special"
|
dongsheng@627
|
8434 "\">authorized_keys</filename> file."
|
dongsheng@627
|
8435 msgstr ""
|
dongsheng@627
|
8436
|
dongsheng@627
|
8437 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
8438 #: ../en/ch06-collab.xml:686
|
dongsheng@627
|
8439 msgid "Using an authentication agent"
|
dongsheng@630
|
8440 msgstr "使用认证代理"
|
dongsheng@627
|
8441
|
dongsheng@627
|
8442 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8443 #: ../en/ch06-collab.xml:688
|
dongsheng@627
|
8444 msgid ""
|
dongsheng@627
|
8445 "An authentication agent is a daemon that stores passphrases in memory (so it "
|
dongsheng@627
|
8446 "will forget passphrases if you log out and log back in again). An ssh client "
|
dongsheng@627
|
8447 "will notice if it's running, and query it for a passphrase. If there's no "
|
dongsheng@627
|
8448 "authentication agent running, or the agent doesn't store the necessary "
|
dongsheng@627
|
8449 "passphrase, you'll have to type your passphrase every time Mercurial tries to "
|
dongsheng@627
|
8450 "communicate with a server on your behalf (e.g. whenever you pull or push "
|
dongsheng@627
|
8451 "changes)."
|
dongsheng@627
|
8452 msgstr ""
|
dongsheng@627
|
8453
|
dongsheng@627
|
8454 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8455 #: ../en/ch06-collab.xml:697
|
dongsheng@627
|
8456 msgid ""
|
dongsheng@627
|
8457 "The downside of storing passphrases in an agent is that it's possible for a "
|
dongsheng@627
|
8458 "well-prepared attacker to recover the plain text of your passphrases, in some "
|
dongsheng@627
|
8459 "cases even if your system has been power-cycled. You should make your own "
|
dongsheng@627
|
8460 "judgment as to whether this is an acceptable risk. It certainly saves a lot "
|
dongsheng@627
|
8461 "of repeated typing."
|
dongsheng@627
|
8462 msgstr ""
|
dongsheng@627
|
8463
|
songdongsheng@710
|
8464 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
8465 #: ../en/ch06-collab.xml:706
|
dongsheng@627
|
8466 msgid ""
|
dongsheng@627
|
8467 "On Unix-like systems, the agent is called <command>ssh-agent</command>, and "
|
dongsheng@627
|
8468 "it's often run automatically for you when you log in. You'll need to use the "
|
songdongsheng@710
|
8469 "<command>ssh-add</command> command to add passphrases to the agent's store."
|
songdongsheng@710
|
8470 msgstr ""
|
songdongsheng@710
|
8471
|
songdongsheng@710
|
8472 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
8473 #: ../en/ch06-collab.xml:713
|
songdongsheng@710
|
8474 msgid ""
|
songdongsheng@710
|
8475 "On Windows, if you're using TortoiseHg, the <command>pageant</command> "
|
songdongsheng@710
|
8476 "command acts as the agent. As with <command>puttygen</command>, you'll need "
|
songdongsheng@710
|
8477 "to <ulink url=\"http://www.chiark.greenend.org.uk/%7Esgtatham/putty/download."
|
songdongsheng@710
|
8478 "html\">download <command>pageant</command></ulink> from the PuTTY web site "
|
songdongsheng@710
|
8479 "and read <ulink url=\"http://the.earth.li/~sgtatham/putty/0.60/htmldoc/"
|
songdongsheng@710
|
8480 "Chapter9.html#pageant\">its documentation</ulink>. The <command>pageant</"
|
songdongsheng@710
|
8481 "command> command adds an icon to your system tray that will let you manage "
|
songdongsheng@710
|
8482 "stored passphrases."
|
songdongsheng@710
|
8483 msgstr ""
|
songdongsheng@710
|
8484
|
songdongsheng@710
|
8485 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
8486 #: ../en/ch06-collab.xml:728
|
dongsheng@627
|
8487 msgid "Configuring the server side properly"
|
dongsheng@630
|
8488 msgstr "正确配置服务器端"
|
dongsheng@627
|
8489
|
dongsheng@627
|
8490 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8491 #: ../en/ch06-collab.xml:730
|
songdongsheng@710
|
8492 msgid ""
|
songdongsheng@710
|
8493 "Because ssh can be fiddly to set up if you're new to it, a variety of things "
|
songdongsheng@710
|
8494 "can go wrong. Add Mercurial on top, and there's plenty more scope for head-"
|
songdongsheng@710
|
8495 "scratching. Most of these potential problems occur on the server side, not "
|
songdongsheng@710
|
8496 "the client side. The good news is that once you've gotten a configuration "
|
songdongsheng@710
|
8497 "working, it will usually continue to work indefinitely."
|
songdongsheng@710
|
8498 msgstr ""
|
songdongsheng@710
|
8499
|
songdongsheng@710
|
8500 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8501 #: ../en/ch06-collab.xml:738
|
dongsheng@627
|
8502 msgid ""
|
dongsheng@627
|
8503 "Before you try using Mercurial to talk to an ssh server, it's best to make "
|
dongsheng@627
|
8504 "sure that you can use the normal <command>ssh</command> or <command>putty</"
|
dongsheng@627
|
8505 "command> command to talk to the server first. If you run into problems with "
|
dongsheng@627
|
8506 "using these commands directly, Mercurial surely won't work. Worse, it will "
|
dongsheng@627
|
8507 "obscure the underlying problem. Any time you want to debug ssh-related "
|
dongsheng@627
|
8508 "Mercurial problems, you should drop back to making sure that plain ssh client "
|
dongsheng@627
|
8509 "commands work first, <emphasis>before</emphasis> you worry about whether "
|
dongsheng@627
|
8510 "there's a problem with Mercurial."
|
dongsheng@627
|
8511 msgstr ""
|
dongsheng@627
|
8512
|
dongsheng@627
|
8513 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8514 #: ../en/ch06-collab.xml:749
|
dongsheng@627
|
8515 msgid ""
|
dongsheng@627
|
8516 "The first thing to be sure of on the server side is that you can actually log "
|
dongsheng@627
|
8517 "in from another machine at all. If you can't use <command>ssh</command> or "
|
dongsheng@627
|
8518 "<command>putty</command> to log in, the error message you get may give you a "
|
dongsheng@627
|
8519 "few hints as to what's wrong. The most common problems are as follows."
|
dongsheng@627
|
8520 msgstr ""
|
dongsheng@627
|
8521
|
dongsheng@627
|
8522 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
8523 #: ../en/ch06-collab.xml:756
|
dongsheng@627
|
8524 msgid ""
|
dongsheng@627
|
8525 "If you get a <quote>connection refused</quote> error, either there isn't an "
|
dongsheng@627
|
8526 "SSH daemon running on the server at all, or it's inaccessible due to firewall "
|
dongsheng@627
|
8527 "configuration."
|
dongsheng@627
|
8528 msgstr ""
|
dongsheng@627
|
8529
|
dongsheng@627
|
8530 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
8531 #: ../en/ch06-collab.xml:761
|
dongsheng@627
|
8532 msgid ""
|
dongsheng@627
|
8533 "If you get a <quote>no route to host</quote> error, you either have an "
|
dongsheng@627
|
8534 "incorrect address for the server or a seriously locked down firewall that "
|
dongsheng@627
|
8535 "won't admit its existence at all."
|
dongsheng@627
|
8536 msgstr ""
|
dongsheng@627
|
8537
|
dongsheng@627
|
8538 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
8539 #: ../en/ch06-collab.xml:766
|
dongsheng@627
|
8540 msgid ""
|
dongsheng@627
|
8541 "If you get a <quote>permission denied</quote> error, you may have mistyped "
|
dongsheng@627
|
8542 "the username on the server, or you could have mistyped your key's passphrase "
|
dongsheng@627
|
8543 "or the remote user's password."
|
dongsheng@627
|
8544 msgstr ""
|
dongsheng@627
|
8545
|
dongsheng@627
|
8546 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8547 #: ../en/ch06-collab.xml:771
|
dongsheng@627
|
8548 msgid ""
|
dongsheng@627
|
8549 "In summary, if you're having trouble talking to the server's ssh daemon, "
|
dongsheng@627
|
8550 "first make sure that one is running at all. On many systems it will be "
|
dongsheng@627
|
8551 "installed, but disabled, by default. Once you're done with this step, you "
|
dongsheng@627
|
8552 "should then check that the server's firewall is configured to allow incoming "
|
dongsheng@627
|
8553 "connections on the port the ssh daemon is listening on (usually 22). Don't "
|
dongsheng@627
|
8554 "worry about more exotic possibilities for misconfiguration until you've "
|
dongsheng@627
|
8555 "checked these two first."
|
dongsheng@627
|
8556 msgstr ""
|
dongsheng@627
|
8557
|
dongsheng@627
|
8558 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8559 #: ../en/ch06-collab.xml:781
|
dongsheng@627
|
8560 msgid ""
|
dongsheng@627
|
8561 "If you're using an authentication agent on the client side to store "
|
dongsheng@627
|
8562 "passphrases for your keys, you ought to be able to log into the server "
|
dongsheng@627
|
8563 "without being prompted for a passphrase or a password. If you're prompted "
|
dongsheng@627
|
8564 "for a passphrase, there are a few possible culprits."
|
dongsheng@627
|
8565 msgstr ""
|
dongsheng@627
|
8566
|
dongsheng@627
|
8567 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
8568 #: ../en/ch06-collab.xml:787
|
dongsheng@627
|
8569 msgid ""
|
dongsheng@627
|
8570 "You might have forgotten to use <command>ssh-add</command> or "
|
dongsheng@627
|
8571 "<command>pageant</command> to store the passphrase."
|
dongsheng@627
|
8572 msgstr ""
|
dongsheng@627
|
8573
|
dongsheng@627
|
8574 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
8575 #: ../en/ch06-collab.xml:791
|
songdongsheng@658
|
8576 msgid "You might have stored the passphrase for the wrong key."
|
songdongsheng@658
|
8577 msgstr ""
|
songdongsheng@658
|
8578
|
songdongsheng@658
|
8579 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8580 #: ../en/ch06-collab.xml:794
|
dongsheng@627
|
8581 msgid ""
|
dongsheng@627
|
8582 "If you're being prompted for the remote user's password, there are another "
|
dongsheng@627
|
8583 "few possible problems to check."
|
dongsheng@627
|
8584 msgstr ""
|
dongsheng@627
|
8585
|
dongsheng@627
|
8586 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
8587 #: ../en/ch06-collab.xml:797
|
dongsheng@627
|
8588 msgid ""
|
dongsheng@627
|
8589 "Either the user's home directory or their <filename role=\"special\" class="
|
dongsheng@627
|
8590 "\"directory\">.ssh</filename> directory might have excessively liberal "
|
dongsheng@627
|
8591 "permissions. As a result, the ssh daemon will not trust or read their "
|
dongsheng@627
|
8592 "<filename role=\"special\">authorized_keys</filename> file. For example, a "
|
dongsheng@627
|
8593 "group-writable home or <filename role=\"special\" class=\"directory\">.ssh</"
|
dongsheng@627
|
8594 "filename> directory will often cause this symptom."
|
dongsheng@627
|
8595 msgstr ""
|
dongsheng@627
|
8596
|
dongsheng@627
|
8597 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
8598 #: ../en/ch06-collab.xml:806
|
dongsheng@627
|
8599 msgid ""
|
dongsheng@627
|
8600 "The user's <filename role=\"special\">authorized_keys</filename> file may "
|
dongsheng@627
|
8601 "have a problem. If anyone other than the user owns or can write to that file, "
|
dongsheng@627
|
8602 "the ssh daemon will not trust or read it."
|
dongsheng@627
|
8603 msgstr ""
|
dongsheng@627
|
8604
|
dongsheng@627
|
8605 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8606 #: ../en/ch06-collab.xml:813
|
dongsheng@627
|
8607 msgid ""
|
dongsheng@627
|
8608 "In the ideal world, you should be able to run the following command "
|
dongsheng@627
|
8609 "successfully, and it should print exactly one line of output, the current "
|
dongsheng@627
|
8610 "date and time."
|
dongsheng@627
|
8611 msgstr ""
|
dongsheng@627
|
8612
|
dongsheng@627
|
8613 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8614 #: ../en/ch06-collab.xml:818
|
dongsheng@627
|
8615 msgid ""
|
dongsheng@627
|
8616 "If, on your server, you have login scripts that print banners or other junk "
|
dongsheng@627
|
8617 "even when running non-interactive commands like this, you should fix them "
|
dongsheng@627
|
8618 "before you continue, so that they only print output if they're run "
|
dongsheng@627
|
8619 "interactively. Otherwise these banners will at least clutter up Mercurial's "
|
dongsheng@627
|
8620 "output. Worse, they could potentially cause problems with running Mercurial "
|
dongsheng@714
|
8621 "commands remotely. Mercurial tries to detect and ignore banners in non-"
|
dongsheng@627
|
8622 "interactive <command>ssh</command> sessions, but it is not foolproof. (If "
|
dongsheng@627
|
8623 "you're editing your login scripts on your server, the usual way to see if a "
|
dongsheng@627
|
8624 "login script is running in an interactive shell is to check the return code "
|
dongsheng@627
|
8625 "from the command <literal>tty -s</literal>.)"
|
dongsheng@627
|
8626 msgstr ""
|
dongsheng@627
|
8627
|
dongsheng@627
|
8628 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8629 #: ../en/ch06-collab.xml:832
|
dongsheng@627
|
8630 msgid ""
|
dongsheng@627
|
8631 "Once you've verified that plain old ssh is working with your server, the next "
|
dongsheng@627
|
8632 "step is to ensure that Mercurial runs on the server. The following command "
|
dongsheng@627
|
8633 "should run successfully:"
|
dongsheng@627
|
8634 msgstr ""
|
dongsheng@627
|
8635
|
dongsheng@627
|
8636 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8637 #: ../en/ch06-collab.xml:839
|
dongsheng@627
|
8638 msgid ""
|
dongsheng@627
|
8639 "If you see an error message instead of normal <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
8640 "version</command> output, this is usually because you haven't installed "
|
dongsheng@627
|
8641 "Mercurial to <filename class=\"directory\">/usr/bin</filename>. Don't worry "
|
dongsheng@627
|
8642 "if this is the case; you don't need to do that. But you should check for a "
|
dongsheng@627
|
8643 "few possible problems."
|
dongsheng@627
|
8644 msgstr ""
|
dongsheng@627
|
8645
|
dongsheng@627
|
8646 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
8647 #: ../en/ch06-collab.xml:846
|
dongsheng@627
|
8648 msgid ""
|
dongsheng@627
|
8649 "Is Mercurial really installed on the server at all? I know this sounds "
|
dongsheng@627
|
8650 "trivial, but it's worth checking!"
|
dongsheng@627
|
8651 msgstr ""
|
dongsheng@627
|
8652
|
dongsheng@627
|
8653 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
8654 #: ../en/ch06-collab.xml:850
|
dongsheng@627
|
8655 msgid ""
|
dongsheng@627
|
8656 "Maybe your shell's search path (usually set via the <envar>PATH</envar> "
|
dongsheng@627
|
8657 "environment variable) is simply misconfigured."
|
dongsheng@627
|
8658 msgstr ""
|
dongsheng@627
|
8659
|
dongsheng@627
|
8660 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
8661 #: ../en/ch06-collab.xml:854
|
dongsheng@627
|
8662 msgid ""
|
dongsheng@627
|
8663 "Perhaps your <envar>PATH</envar> environment variable is only being set to "
|
dongsheng@627
|
8664 "point to the location of the <command>hg</command> executable if the login "
|
dongsheng@627
|
8665 "session is interactive. This can happen if you're setting the path in the "
|
dongsheng@627
|
8666 "wrong shell login script. See your shell's documentation for details."
|
dongsheng@627
|
8667 msgstr ""
|
dongsheng@627
|
8668
|
dongsheng@627
|
8669 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
8670 #: ../en/ch06-collab.xml:861
|
dongsheng@627
|
8671 msgid ""
|
dongsheng@627
|
8672 "The <envar>PYTHONPATH</envar> environment variable may need to contain the "
|
dongsheng@627
|
8673 "path to the Mercurial Python modules. It might not be set at all; it could "
|
dongsheng@627
|
8674 "be incorrect; or it may be set only if the login is interactive."
|
dongsheng@627
|
8675 msgstr ""
|
dongsheng@627
|
8676
|
dongsheng@627
|
8677 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8678 #: ../en/ch06-collab.xml:868
|
dongsheng@627
|
8679 msgid ""
|
dongsheng@627
|
8680 "If you can run <command role=\"hg-cmd\">hg version</command> over an ssh "
|
dongsheng@627
|
8681 "connection, well done! You've got the server and client sorted out. You "
|
dongsheng@627
|
8682 "should now be able to use Mercurial to access repositories hosted by that "
|
dongsheng@627
|
8683 "username on that server. If you run into problems with Mercurial and ssh at "
|
dongsheng@627
|
8684 "this point, try using the <option role=\"hg-opt-global\">--debug</option> "
|
dongsheng@627
|
8685 "option to get a clearer picture of what's going on."
|
dongsheng@627
|
8686 msgstr ""
|
dongsheng@627
|
8687
|
dongsheng@627
|
8688 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
8689 #: ../en/ch06-collab.xml:877
|
dongsheng@627
|
8690 msgid "Using compression with ssh"
|
dongsheng@630
|
8691 msgstr "通过 ssh 使用压缩"
|
dongsheng@627
|
8692
|
dongsheng@627
|
8693 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8694 #: ../en/ch06-collab.xml:879
|
dongsheng@627
|
8695 msgid ""
|
dongsheng@627
|
8696 "Mercurial does not compress data when it uses the ssh protocol, because the "
|
songdongsheng@710
|
8697 "ssh protocol can transparently compress data. However, the default behavior "
|
dongsheng@627
|
8698 "of ssh clients is <emphasis>not</emphasis> to request compression."
|
dongsheng@627
|
8699 msgstr ""
|
dongsheng@627
|
8700
|
dongsheng@627
|
8701 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8702 #: ../en/ch06-collab.xml:884
|
dongsheng@627
|
8703 msgid ""
|
dongsheng@627
|
8704 "Over any network other than a fast LAN (even a wireless network), using "
|
dongsheng@627
|
8705 "compression is likely to significantly speed up Mercurial's network "
|
dongsheng@627
|
8706 "operations. For example, over a WAN, someone measured compression as "
|
dongsheng@627
|
8707 "reducing the amount of time required to clone a particularly large repository "
|
dongsheng@627
|
8708 "from 51 minutes to 17 minutes."
|
dongsheng@627
|
8709 msgstr ""
|
dongsheng@627
|
8710
|
dongsheng@627
|
8711 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8712 #: ../en/ch06-collab.xml:891
|
dongsheng@627
|
8713 msgid ""
|
dongsheng@627
|
8714 "Both <command>ssh</command> and <command>plink</command> accept a <option "
|
dongsheng@627
|
8715 "role=\"cmd-opt-ssh\">-C</option> option which turns on compression. You can "
|
dongsheng@650
|
8716 "easily edit your <filename role=\"special\">~/.hgrc</filename> to enable "
|
songdongsheng@710
|
8717 "compression for all of Mercurial's uses of the ssh protocol. Here is how to "
|
songdongsheng@710
|
8718 "do so for regular <command>ssh</command> on Unix-like systems, for example."
|
songdongsheng@710
|
8719 msgstr ""
|
songdongsheng@710
|
8720
|
songdongsheng@710
|
8721 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8722 #: ../en/ch06-collab.xml:901
|
songdongsheng@710
|
8723 msgid ""
|
songdongsheng@710
|
8724 "If you use <command>ssh</command> on a Unix-like system, you can configure it "
|
songdongsheng@710
|
8725 "to always use compression when talking to your server. To do this, edit your "
|
songdongsheng@710
|
8726 "<filename role=\"special\">.ssh/config</filename> file (which may not yet "
|
songdongsheng@710
|
8727 "exist), as follows."
|
songdongsheng@710
|
8728 msgstr ""
|
songdongsheng@710
|
8729
|
songdongsheng@710
|
8730 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8731 #: ../en/ch06-collab.xml:911
|
songdongsheng@710
|
8732 msgid ""
|
songdongsheng@710
|
8733 "This defines a hostname alias, <literal>hg</literal>. When you use that "
|
songdongsheng@710
|
8734 "hostname on the <command>ssh</command> command line or in a Mercurial "
|
songdongsheng@710
|
8735 "<literal>ssh</literal>-protocol URL, it will cause <command>ssh</command> to "
|
songdongsheng@710
|
8736 "connect to <literal>hg.example.com</literal> and use compression. This gives "
|
songdongsheng@710
|
8737 "you both a shorter name to type and compression, each of which is a good "
|
songdongsheng@710
|
8738 "thing in its own right."
|
dongsheng@627
|
8739 msgstr ""
|
dongsheng@627
|
8740
|
dongsheng@627
|
8741 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
8742 #: ../en/ch06-collab.xml:923
|
dongsheng@627
|
8743 msgid "Serving over HTTP using CGI"
|
dongsheng@630
|
8744 msgstr "使用 CGI 通过 HTTP 提供服务"
|
dongsheng@627
|
8745
|
dongsheng@627
|
8746 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
8747 #: ../en/ch06-collab.xml:925
|
songdongsheng@710
|
8748 msgid ""
|
songdongsheng@710
|
8749 "The simplest way to host one or more repositories in a permanent way is to "
|
songdongsheng@710
|
8750 "use a web server and Mercurial's CGI support."
|
songdongsheng@710
|
8751 msgstr ""
|
songdongsheng@710
|
8752
|
songdongsheng@710
|
8753 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
8754 #: ../en/ch06-collab.xml:929
|
dongsheng@627
|
8755 msgid ""
|
dongsheng@627
|
8756 "Depending on how ambitious you are, configuring Mercurial's CGI interface can "
|
dongsheng@627
|
8757 "take anything from a few moments to several hours."
|
dongsheng@627
|
8758 msgstr ""
|
dongsheng@627
|
8759
|
dongsheng@627
|
8760 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
8761 #: ../en/ch06-collab.xml:933
|
dongsheng@627
|
8762 msgid ""
|
dongsheng@627
|
8763 "We'll begin with the simplest of examples, and work our way towards a more "
|
dongsheng@627
|
8764 "complex configuration. Even for the most basic case, you're almost certainly "
|
dongsheng@627
|
8765 "going to need to read and modify your web server's configuration."
|
dongsheng@627
|
8766 msgstr ""
|
dongsheng@627
|
8767
|
songdongsheng@710
|
8768 #. type: Content of: <book><chapter><sect1><note><title>
|
dongsheng@714
|
8769 #: ../en/ch06-collab.xml:939
|
songdongsheng@710
|
8770 msgid "High pain tolerance required"
|
songdongsheng@710
|
8771 msgstr ""
|
songdongsheng@710
|
8772
|
dongsheng@627
|
8773 #. type: Content of: <book><chapter><sect1><note><para>
|
dongsheng@714
|
8774 #: ../en/ch06-collab.xml:941
|
dongsheng@627
|
8775 msgid ""
|
dongsheng@627
|
8776 "Configuring a web server is a complex, fiddly, and highly system-dependent "
|
dongsheng@627
|
8777 "activity. I can't possibly give you instructions that will cover anything "
|
dongsheng@627
|
8778 "like all of the cases you will encounter. Please use your discretion and "
|
dongsheng@627
|
8779 "judgment in following the sections below. Be prepared to make plenty of "
|
dongsheng@627
|
8780 "mistakes, and to spend a lot of time reading your server's error logs."
|
dongsheng@627
|
8781 msgstr ""
|
dongsheng@627
|
8782
|
songdongsheng@710
|
8783 #. type: Content of: <book><chapter><sect1><note><para>
|
dongsheng@714
|
8784 #: ../en/ch06-collab.xml:949
|
songdongsheng@710
|
8785 msgid ""
|
songdongsheng@710
|
8786 "If you don't have a strong stomach for tweaking configurations over and over, "
|
songdongsheng@710
|
8787 "or a compelling need to host your own services, you might want to try one of "
|
songdongsheng@710
|
8788 "the public hosting services that I mentioned earlier."
|
songdongsheng@710
|
8789 msgstr ""
|
songdongsheng@710
|
8790
|
songdongsheng@710
|
8791 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
8792 #: ../en/ch06-collab.xml:956
|
dongsheng@627
|
8793 msgid "Web server configuration checklist"
|
dongsheng@630
|
8794 msgstr "Web 服务器配置检查表"
|
dongsheng@627
|
8795
|
dongsheng@627
|
8796 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8797 #: ../en/ch06-collab.xml:958
|
dongsheng@627
|
8798 msgid ""
|
dongsheng@627
|
8799 "Before you continue, do take a few moments to check a few aspects of your "
|
dongsheng@627
|
8800 "system's setup."
|
dongsheng@627
|
8801 msgstr ""
|
dongsheng@627
|
8802
|
dongsheng@627
|
8803 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
8804 #: ../en/ch06-collab.xml:962
|
songdongsheng@710
|
8805 msgid ""
|
songdongsheng@710
|
8806 "Do you have a web server installed at all? Mac OS X and some Linux "
|
songdongsheng@710
|
8807 "distributions ship with Apache, but many other systems may not have a web "
|
songdongsheng@710
|
8808 "server installed."
|
dongsheng@627
|
8809 msgstr ""
|
dongsheng@627
|
8810
|
dongsheng@627
|
8811 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
8812 #: ../en/ch06-collab.xml:967
|
dongsheng@627
|
8813 msgid ""
|
dongsheng@627
|
8814 "If you have a web server installed, is it actually running? On most systems, "
|
dongsheng@627
|
8815 "even if one is present, it will be disabled by default."
|
dongsheng@627
|
8816 msgstr ""
|
dongsheng@627
|
8817
|
dongsheng@627
|
8818 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
8819 #: ../en/ch06-collab.xml:971
|
dongsheng@627
|
8820 msgid ""
|
dongsheng@627
|
8821 "Is your server configured to allow you to run CGI programs in the directory "
|
dongsheng@627
|
8822 "where you plan to do so? Most servers default to explicitly disabling the "
|
dongsheng@627
|
8823 "ability to run CGI programs."
|
dongsheng@627
|
8824 msgstr ""
|
dongsheng@627
|
8825
|
dongsheng@627
|
8826 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8827 #: ../en/ch06-collab.xml:977
|
dongsheng@627
|
8828 msgid ""
|
dongsheng@627
|
8829 "If you don't have a web server installed, and don't have substantial "
|
dongsheng@627
|
8830 "experience configuring Apache, you should consider using the "
|
dongsheng@627
|
8831 "<literal>lighttpd</literal> web server instead of Apache. Apache has a well-"
|
dongsheng@627
|
8832 "deserved reputation for baroque and confusing configuration. While "
|
dongsheng@627
|
8833 "<literal>lighttpd</literal> is less capable in some ways than Apache, most of "
|
dongsheng@627
|
8834 "these capabilities are not relevant to serving Mercurial repositories. And "
|
dongsheng@627
|
8835 "<literal>lighttpd</literal> is undeniably <emphasis>much</emphasis> easier to "
|
dongsheng@627
|
8836 "get started with than Apache."
|
dongsheng@627
|
8837 msgstr ""
|
dongsheng@627
|
8838
|
dongsheng@627
|
8839 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
8840 #: ../en/ch06-collab.xml:990
|
dongsheng@627
|
8841 msgid "Basic CGI configuration"
|
dongsheng@630
|
8842 msgstr "基本 CGI 配置"
|
dongsheng@627
|
8843
|
dongsheng@627
|
8844 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8845 #: ../en/ch06-collab.xml:992
|
dongsheng@627
|
8846 msgid ""
|
dongsheng@627
|
8847 "On Unix-like systems, it's common for users to have a subdirectory named "
|
dongsheng@627
|
8848 "something like <filename class=\"directory\">public_html</filename> in their "
|
dongsheng@627
|
8849 "home directory, from which they can serve up web pages. A file named "
|
dongsheng@627
|
8850 "<filename>foo</filename> in this directory will be accessible at a URL of the "
|
dongsheng@650
|
8851 "form <literal>http://www.example.com/username/foo</literal>."
|
dongsheng@650
|
8852 msgstr ""
|
dongsheng@650
|
8853
|
dongsheng@650
|
8854 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8855 #: ../en/ch06-collab.xml:1000
|
dongsheng@627
|
8856 msgid ""
|
dongsheng@627
|
8857 "To get started, find the <filename role=\"special\">hgweb.cgi</filename> "
|
dongsheng@627
|
8858 "script that should be present in your Mercurial installation. If you can't "
|
dongsheng@627
|
8859 "quickly find a local copy on your system, simply download one from the master "
|
dongsheng@627
|
8860 "Mercurial repository at <ulink url=\"http://www.selenic.com/repo/hg/raw-file/"
|
dongsheng@627
|
8861 "tip/hgweb.cgi\">http://www.selenic.com/repo/hg/raw-file/tip/hgweb.cgi</ulink>."
|
dongsheng@627
|
8862 msgstr ""
|
dongsheng@627
|
8863
|
dongsheng@627
|
8864 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8865 #: ../en/ch06-collab.xml:1007 ../en/ch06-collab.xml:1175
|
dongsheng@627
|
8866 msgid ""
|
dongsheng@627
|
8867 "You'll need to copy this script into your <filename class=\"directory"
|
dongsheng@627
|
8868 "\">public_html</filename> directory, and ensure that it's executable."
|
dongsheng@627
|
8869 msgstr ""
|
dongsheng@627
|
8870
|
dongsheng@627
|
8871 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
8872 #: ../en/ch06-collab.xml:1012
|
dongsheng@627
|
8873 msgid ""
|
dongsheng@627
|
8874 "The <literal>755</literal> argument to <command>chmod</command> is a little "
|
dongsheng@627
|
8875 "more general than just making the script executable: it ensures that the "
|
dongsheng@627
|
8876 "script is executable by anyone, and that <quote>group</quote> and "
|
dongsheng@627
|
8877 "<quote>other</quote> write permissions are <emphasis>not</emphasis> set. If "
|
dongsheng@627
|
8878 "you were to leave those write permissions enabled, Apache's <literal>suexec</"
|
dongsheng@627
|
8879 "literal> subsystem would likely refuse to execute the script. In fact, "
|
dongsheng@627
|
8880 "<literal>suexec</literal> also insists that the <emphasis>directory</"
|
dongsheng@627
|
8881 "emphasis> in which the script resides must not be writable by others."
|
dongsheng@627
|
8882 msgstr ""
|
dongsheng@627
|
8883
|
dongsheng@627
|
8884 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
8885 #: ../en/ch06-collab.xml:1026
|
dongsheng@627
|
8886 msgid "What could <emphasis>possibly</emphasis> go wrong?"
|
dongsheng@630
|
8887 msgstr "什么<emphasis>可能</emphasis>会出错?"
|
dongsheng@627
|
8888
|
dongsheng@627
|
8889 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
8890 #: ../en/ch06-collab.xml:1029
|
dongsheng@627
|
8891 msgid ""
|
dongsheng@627
|
8892 "Once you've copied the CGI script into place, go into a web browser, and try "
|
dongsheng@714
|
8893 "to open the URL <literal>http://myhostname/~myuser/hgweb.cgi</literal>, "
|
dongsheng@714
|
8894 "<emphasis>but</emphasis> brace yourself for instant failure. There's a high "
|
dongsheng@714
|
8895 "probability that trying to visit this URL will fail, and there are many "
|
dongsheng@714
|
8896 "possible reasons for this. In fact, you're likely to stumble over almost "
|
dongsheng@714
|
8897 "every one of the possible errors below, so please read carefully. The "
|
dongsheng@714
|
8898 "following are all of the problems I ran into on a system running Fedora 7, "
|
dongsheng@714
|
8899 "with a fresh installation of Apache, and a user account that I created "
|
dongsheng@714
|
8900 "specially to perform this exercise."
|
dongsheng@627
|
8901 msgstr ""
|
dongsheng@627
|
8902
|
dongsheng@627
|
8903 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
8904 #: ../en/ch06-collab.xml:1042
|
dongsheng@627
|
8905 msgid ""
|
dongsheng@627
|
8906 "Your web server may have per-user directories disabled. If you're using "
|
dongsheng@627
|
8907 "Apache, search your config file for a <literal>UserDir</literal> directive. "
|
dongsheng@627
|
8908 "If there's none present, per-user directories will be disabled. If one "
|
dongsheng@627
|
8909 "exists, but its value is <literal>disabled</literal>, then per-user "
|
dongsheng@627
|
8910 "directories will be disabled. Otherwise, the string after <literal>UserDir</"
|
dongsheng@627
|
8911 "literal> gives the name of the subdirectory that Apache will look in under "
|
dongsheng@627
|
8912 "your home directory, for example <filename class=\"directory\">public_html</"
|
dongsheng@627
|
8913 "filename>."
|
dongsheng@627
|
8914 msgstr ""
|
dongsheng@627
|
8915
|
dongsheng@627
|
8916 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
8917 #: ../en/ch06-collab.xml:1053
|
dongsheng@627
|
8918 msgid ""
|
dongsheng@627
|
8919 "Your file access permissions may be too restrictive. The web server must be "
|
dongsheng@627
|
8920 "able to traverse your home directory and directories under your <filename "
|
dongsheng@627
|
8921 "class=\"directory\">public_html</filename> directory, and read files under "
|
dongsheng@627
|
8922 "the latter too. Here's a quick recipe to help you to make your permissions "
|
dongsheng@627
|
8923 "more appropriate."
|
dongsheng@627
|
8924 msgstr ""
|
dongsheng@627
|
8925
|
dongsheng@627
|
8926 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
8927 #: ../en/ch06-collab.xml:1063
|
dongsheng@627
|
8928 msgid ""
|
dongsheng@627
|
8929 "The other possibility with permissions is that you might get a completely "
|
dongsheng@627
|
8930 "empty window when you try to load the script. In this case, it's likely that "
|
dongsheng@627
|
8931 "your access permissions are <emphasis>too permissive</emphasis>. Apache's "
|
dongsheng@627
|
8932 "<literal>suexec</literal> subsystem won't execute a script that's group- or "
|
dongsheng@627
|
8933 "world-writable, for example."
|
dongsheng@627
|
8934 msgstr ""
|
dongsheng@627
|
8935
|
dongsheng@627
|
8936 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
8937 #: ../en/ch06-collab.xml:1070
|
dongsheng@627
|
8938 msgid ""
|
dongsheng@627
|
8939 "Your web server may be configured to disallow execution of CGI programs in "
|
dongsheng@627
|
8940 "your per-user web directory. Here's Apache's default per-user configuration "
|
dongsheng@627
|
8941 "from my Fedora system."
|
dongsheng@627
|
8942 msgstr ""
|
dongsheng@627
|
8943
|
dongsheng@627
|
8944 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
8945 #: ../en/ch06-collab.xml:1077
|
dongsheng@627
|
8946 msgid ""
|
dongsheng@627
|
8947 "If you find a similar-looking <literal>Directory</literal> group in your "
|
dongsheng@627
|
8948 "Apache configuration, the directive to look at inside it is <literal>Options</"
|
dongsheng@627
|
8949 "literal>. Add <literal>ExecCGI</literal> to the end of this list if it's "
|
dongsheng@627
|
8950 "missing, and restart the web server."
|
dongsheng@627
|
8951 msgstr ""
|
dongsheng@627
|
8952
|
dongsheng@627
|
8953 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
8954 #: ../en/ch06-collab.xml:1084
|
dongsheng@627
|
8955 msgid ""
|
dongsheng@627
|
8956 "If you find that Apache serves you the text of the CGI script instead of "
|
dongsheng@627
|
8957 "executing it, you may need to either uncomment (if already present) or add a "
|
dongsheng@627
|
8958 "directive like this."
|
dongsheng@627
|
8959 msgstr ""
|
dongsheng@627
|
8960
|
dongsheng@627
|
8961 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
8962 #: ../en/ch06-collab.xml:1090
|
dongsheng@627
|
8963 msgid ""
|
dongsheng@627
|
8964 "The next possibility is that you might be served with a colourful Python "
|
dongsheng@627
|
8965 "backtrace claiming that it can't import a <literal>mercurial</literal>-"
|
dongsheng@627
|
8966 "related module. This is actually progress! The server is now capable of "
|
dongsheng@627
|
8967 "executing your CGI script. This error is only likely to occur if you're "
|
dongsheng@627
|
8968 "running a private installation of Mercurial, instead of a system-wide "
|
dongsheng@627
|
8969 "version. Remember that the web server runs the CGI program without any of "
|
dongsheng@627
|
8970 "the environment variables that you take for granted in an interactive "
|
dongsheng@627
|
8971 "session. If this error happens to you, edit your copy of <filename role="
|
dongsheng@627
|
8972 "\"special\">hgweb.cgi</filename> and follow the directions inside it to "
|
dongsheng@627
|
8973 "correctly set your <envar>PYTHONPATH</envar> environment variable."
|
dongsheng@627
|
8974 msgstr ""
|
dongsheng@627
|
8975
|
dongsheng@627
|
8976 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
8977 #: ../en/ch06-collab.xml:1104
|
dongsheng@714
|
8978 msgid ""
|
dongsheng@714
|
8979 "Finally, you are <emphasis>certain</emphasis> to be served with another "
|
dongsheng@627
|
8980 "colourful Python backtrace: this one will complain that it can't find "
|
dongsheng@627
|
8981 "<filename class=\"directory\">/path/to/repository</filename>. Edit your "
|
dongsheng@627
|
8982 "<filename role=\"special\">hgweb.cgi</filename> script and replace the "
|
dongsheng@627
|
8983 "<filename class=\"directory\">/path/to/repository</filename> string with the "
|
dongsheng@627
|
8984 "complete path to the repository you want to serve up."
|
dongsheng@627
|
8985 msgstr ""
|
dongsheng@627
|
8986
|
dongsheng@627
|
8987 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
8988 #: ../en/ch06-collab.xml:1114
|
dongsheng@627
|
8989 msgid ""
|
dongsheng@627
|
8990 "At this point, when you try to reload the page, you should be presented with "
|
dongsheng@627
|
8991 "a nice HTML view of your repository's history. Whew!"
|
dongsheng@627
|
8992 msgstr ""
|
dongsheng@627
|
8993
|
dongsheng@627
|
8994 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
8995 #: ../en/ch06-collab.xml:1120
|
dongsheng@627
|
8996 msgid "Configuring lighttpd"
|
dongsheng@630
|
8997 msgstr "配置 lighttpd"
|
dongsheng@627
|
8998
|
dongsheng@627
|
8999 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
9000 #: ../en/ch06-collab.xml:1122
|
dongsheng@627
|
9001 msgid ""
|
dongsheng@627
|
9002 "To be exhaustive in my experiments, I tried configuring the increasingly "
|
dongsheng@627
|
9003 "popular <literal>lighttpd</literal> web server to serve the same repository "
|
dongsheng@627
|
9004 "as I described with Apache above. I had already overcome all of the problems "
|
dongsheng@627
|
9005 "I outlined with Apache, many of which are not server-specific. As a result, "
|
dongsheng@627
|
9006 "I was fairly sure that my file and directory permissions were good, and that "
|
dongsheng@627
|
9007 "my <filename role=\"special\">hgweb.cgi</filename> script was properly edited."
|
dongsheng@627
|
9008 msgstr ""
|
dongsheng@627
|
9009
|
dongsheng@627
|
9010 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
9011 #: ../en/ch06-collab.xml:1132
|
dongsheng@627
|
9012 msgid ""
|
dongsheng@627
|
9013 "Once I had Apache running, getting <literal>lighttpd</literal> to serve the "
|
dongsheng@627
|
9014 "repository was a snap (in other words, even if you're trying to use "
|
dongsheng@627
|
9015 "<literal>lighttpd</literal>, you should read the Apache section). I first "
|
dongsheng@627
|
9016 "had to edit the <literal>mod_access</literal> section of its config file to "
|
dongsheng@627
|
9017 "enable <literal>mod_cgi</literal> and <literal>mod_userdir</literal>, both of "
|
dongsheng@627
|
9018 "which were disabled by default on my system. I then added a few lines to the "
|
dongsheng@627
|
9019 "end of the config file, to configure these modules."
|
dongsheng@627
|
9020 msgstr ""
|
dongsheng@627
|
9021
|
dongsheng@627
|
9022 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
9023 #: ../en/ch06-collab.xml:1144
|
dongsheng@627
|
9024 msgid ""
|
dongsheng@627
|
9025 "With this done, <literal>lighttpd</literal> ran immediately for me. If I had "
|
dongsheng@627
|
9026 "configured <literal>lighttpd</literal> before Apache, I'd almost certainly "
|
dongsheng@627
|
9027 "have run into many of the same system-level configuration problems as I did "
|
dongsheng@627
|
9028 "with Apache. However, I found <literal>lighttpd</literal> to be noticeably "
|
dongsheng@627
|
9029 "easier to configure than Apache, even though I've used Apache for over a "
|
dongsheng@627
|
9030 "decade, and this was my first exposure to <literal>lighttpd</literal>."
|
dongsheng@627
|
9031 msgstr ""
|
dongsheng@627
|
9032
|
dongsheng@627
|
9033 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
9034 #: ../en/ch06-collab.xml:1157
|
dongsheng@627
|
9035 msgid "Sharing multiple repositories with one CGI script"
|
dongsheng@630
|
9036 msgstr "使用一个 CGI 脚本共享多个版本库"
|
dongsheng@627
|
9037
|
dongsheng@627
|
9038 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9039 #: ../en/ch06-collab.xml:1159
|
dongsheng@627
|
9040 msgid ""
|
dongsheng@627
|
9041 "The <filename role=\"special\">hgweb.cgi</filename> script only lets you "
|
dongsheng@627
|
9042 "publish a single repository, which is an annoying restriction. If you want "
|
dongsheng@627
|
9043 "to publish more than one without wracking yourself with multiple copies of "
|
dongsheng@627
|
9044 "the same script, each with different names, a better choice is to use the "
|
dongsheng@627
|
9045 "<filename role=\"special\">hgwebdir.cgi</filename> script."
|
dongsheng@627
|
9046 msgstr ""
|
dongsheng@627
|
9047
|
dongsheng@627
|
9048 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9049 #: ../en/ch06-collab.xml:1167
|
dongsheng@627
|
9050 msgid ""
|
dongsheng@627
|
9051 "The procedure to configure <filename role=\"special\">hgwebdir.cgi</filename> "
|
dongsheng@627
|
9052 "is only a little more involved than for <filename role=\"special\">hgweb.cgi</"
|
dongsheng@627
|
9053 "filename>. First, you must obtain a copy of the script. If you don't have "
|
dongsheng@627
|
9054 "one handy, you can download a copy from the master Mercurial repository at "
|
dongsheng@627
|
9055 "<ulink url=\"http://www.selenic.com/repo/hg/raw-file/tip/hgwebdir.cgi"
|
dongsheng@627
|
9056 "\">http://www.selenic.com/repo/hg/raw-file/tip/hgwebdir.cgi</ulink>."
|
dongsheng@627
|
9057 msgstr ""
|
dongsheng@627
|
9058
|
dongsheng@627
|
9059 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9060 #: ../en/ch06-collab.xml:1182
|
dongsheng@714
|
9061 msgid ""
|
dongsheng@714
|
9062 "With basic configuration out of the way, try to visit <literal>http://"
|
dongsheng@714
|
9063 "myhostname/~myuser/hgwebdir.cgi</literal> in your\tbrowser. It should "
|
dongsheng@714
|
9064 "display an empty list of repositories. If you get a blank window or error "
|
dongsheng@714
|
9065 "message, try walking through the list of potential problems in <xref linkend="
|
dongsheng@714
|
9066 "\"sec:collab:wtf\"/>."
|
dongsheng@714
|
9067 msgstr ""
|
dongsheng@714
|
9068
|
dongsheng@714
|
9069 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9070 #: ../en/ch06-collab.xml:1190
|
dongsheng@627
|
9071 msgid ""
|
dongsheng@627
|
9072 "The <filename role=\"special\">hgwebdir.cgi</filename> script relies on an "
|
dongsheng@627
|
9073 "external configuration file. By default, it searches for a file named "
|
dongsheng@627
|
9074 "<filename role=\"special\">hgweb.config</filename> in the same directory as "
|
dongsheng@627
|
9075 "itself. You'll need to create this file, and make it world-readable. The "
|
dongsheng@627
|
9076 "format of the file is similar to a Windows <quote>ini</quote> file, as "
|
dongsheng@627
|
9077 "understood by Python's <literal>ConfigParser</literal> <citation>web:"
|
dongsheng@627
|
9078 "configparser</citation> module."
|
dongsheng@627
|
9079 msgstr ""
|
dongsheng@627
|
9080
|
dongsheng@627
|
9081 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9082 #: ../en/ch06-collab.xml:1200
|
dongsheng@627
|
9083 msgid ""
|
dongsheng@627
|
9084 "The easiest way to configure <filename role=\"special\">hgwebdir.cgi</"
|
dongsheng@627
|
9085 "filename> is with a section named <literal>collections</literal>. This will "
|
dongsheng@627
|
9086 "automatically publish <emphasis>every</emphasis> repository under the "
|
dongsheng@627
|
9087 "directories you name. The section should look like this:"
|
dongsheng@627
|
9088 msgstr ""
|
dongsheng@627
|
9089
|
dongsheng@627
|
9090 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9091 #: ../en/ch06-collab.xml:1208
|
dongsheng@627
|
9092 msgid ""
|
dongsheng@627
|
9093 "Mercurial interprets this by looking at the directory name on the "
|
dongsheng@627
|
9094 "<emphasis>right</emphasis> hand side of the <quote><literal>=</literal></"
|
dongsheng@627
|
9095 "quote> sign; finding repositories in that directory hierarchy; and using the "
|
dongsheng@627
|
9096 "text on the <emphasis>left</emphasis> to strip off matching text from the "
|
dongsheng@627
|
9097 "names it will actually list in the web interface. The remaining component of "
|
dongsheng@627
|
9098 "a path after this stripping has occurred is called a <quote>virtual path</"
|
dongsheng@627
|
9099 "quote>."
|
dongsheng@627
|
9100 msgstr ""
|
dongsheng@627
|
9101
|
dongsheng@627
|
9102 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9103 #: ../en/ch06-collab.xml:1217
|
dongsheng@627
|
9104 msgid ""
|
dongsheng@627
|
9105 "Given the example above, if we have a repository whose local path is "
|
dongsheng@627
|
9106 "<filename class=\"directory\">/my/root/this/repo</filename>, the CGI script "
|
dongsheng@627
|
9107 "will strip the leading <filename class=\"directory\">/my/root</filename> from "
|
dongsheng@627
|
9108 "the name, and publish the repository with a virtual path of <filename class="
|
dongsheng@627
|
9109 "\"directory\">this/repo</filename>. If the base URL for our CGI script is "
|
dongsheng@714
|
9110 "<literal>http://myhostname/~myuser/hgwebdir.cgi</literal>, the complete URL "
|
dongsheng@714
|
9111 "for that repository will be <literal>http://myhostname/~myuser/hgwebdir.cgi/"
|
dongsheng@714
|
9112 "this/repo</literal>."
|
dongsheng@714
|
9113 msgstr ""
|
dongsheng@714
|
9114
|
dongsheng@714
|
9115 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9116 #: ../en/ch06-collab.xml:1229
|
dongsheng@627
|
9117 msgid ""
|
dongsheng@627
|
9118 "If we replace <filename class=\"directory\">/my/root</filename> on the left "
|
dongsheng@627
|
9119 "hand side of this example with <filename class=\"directory\">/my</filename>, "
|
dongsheng@627
|
9120 "then <filename role=\"special\">hgwebdir.cgi</filename> will only strip off "
|
dongsheng@627
|
9121 "<filename class=\"directory\">/my</filename> from the repository name, and "
|
dongsheng@627
|
9122 "will give us a virtual path of <filename class=\"directory\">root/this/repo</"
|
dongsheng@627
|
9123 "filename> instead of <filename class=\"directory\">this/repo</filename>."
|
dongsheng@627
|
9124 msgstr ""
|
dongsheng@627
|
9125
|
dongsheng@627
|
9126 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9127 #: ../en/ch06-collab.xml:1239
|
dongsheng@627
|
9128 msgid ""
|
dongsheng@627
|
9129 "The <filename role=\"special\">hgwebdir.cgi</filename> script will "
|
dongsheng@627
|
9130 "recursively search each directory listed in the <literal>collections</"
|
dongsheng@627
|
9131 "literal> section of its configuration file, but it will <literal>not</"
|
dongsheng@627
|
9132 "literal> recurse into the repositories it finds."
|
dongsheng@627
|
9133 msgstr ""
|
dongsheng@627
|
9134
|
dongsheng@627
|
9135 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9136 #: ../en/ch06-collab.xml:1245
|
dongsheng@627
|
9137 msgid ""
|
dongsheng@627
|
9138 "The <literal>collections</literal> mechanism makes it easy to publish many "
|
dongsheng@627
|
9139 "repositories in a <quote>fire and forget</quote> manner. You only need to "
|
dongsheng@627
|
9140 "set up the CGI script and configuration file one time. Afterwards, you can "
|
dongsheng@627
|
9141 "publish or unpublish a repository at any time by simply moving it into, or "
|
dongsheng@627
|
9142 "out of, the directory hierarchy in which you've configured <filename role="
|
dongsheng@627
|
9143 "\"special\">hgwebdir.cgi</filename> to look."
|
dongsheng@627
|
9144 msgstr ""
|
dongsheng@627
|
9145
|
dongsheng@627
|
9146 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
9147 #: ../en/ch06-collab.xml:1255
|
dongsheng@627
|
9148 msgid "Explicitly specifying which repositories to publish"
|
dongsheng@630
|
9149 msgstr "明确指出要发布的版本库"
|
dongsheng@627
|
9150
|
dongsheng@627
|
9151 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
9152 #: ../en/ch06-collab.xml:1258
|
dongsheng@627
|
9153 msgid ""
|
dongsheng@627
|
9154 "In addition to the <literal>collections</literal> mechanism, the <filename "
|
dongsheng@627
|
9155 "role=\"special\">hgwebdir.cgi</filename> script allows you to publish a "
|
dongsheng@627
|
9156 "specific list of repositories. To do so, create a <literal>paths</literal> "
|
dongsheng@627
|
9157 "section, with contents of the following form."
|
dongsheng@627
|
9158 msgstr ""
|
dongsheng@627
|
9159
|
dongsheng@627
|
9160 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
9161 #: ../en/ch06-collab.xml:1267
|
dongsheng@627
|
9162 msgid ""
|
dongsheng@627
|
9163 "In this case, the virtual path (the component that will appear in a URL) is "
|
dongsheng@627
|
9164 "on the left hand side of each definition, while the path to the repository is "
|
dongsheng@627
|
9165 "on the right. Notice that there does not need to be any relationship between "
|
dongsheng@627
|
9166 "the virtual path you choose and the location of a repository in your "
|
dongsheng@627
|
9167 "filesystem."
|
dongsheng@627
|
9168 msgstr ""
|
dongsheng@627
|
9169
|
dongsheng@627
|
9170 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
9171 #: ../en/ch06-collab.xml:1274
|
dongsheng@627
|
9172 msgid ""
|
dongsheng@627
|
9173 "If you wish, you can use both the <literal>collections</literal> and "
|
dongsheng@627
|
9174 "<literal>paths</literal> mechanisms simultaneously in a single configuration "
|
dongsheng@627
|
9175 "file."
|
dongsheng@627
|
9176 msgstr ""
|
dongsheng@627
|
9177
|
songdongsheng@710
|
9178 #. type: Content of: <book><chapter><sect1><sect2><sect3><note><title>
|
dongsheng@714
|
9179 #: ../en/ch06-collab.xml:1280
|
songdongsheng@710
|
9180 msgid "Beware duplicate virtual paths"
|
songdongsheng@710
|
9181 msgstr ""
|
songdongsheng@710
|
9182
|
dongsheng@627
|
9183 #. type: Content of: <book><chapter><sect1><sect2><sect3><note><para>
|
dongsheng@714
|
9184 #: ../en/ch06-collab.xml:1282
|
songdongsheng@710
|
9185 msgid ""
|
songdongsheng@710
|
9186 "If several repositories have the same virtual path, <filename role=\"special"
|
dongsheng@627
|
9187 "\">hgwebdir.cgi</filename> will not report an error. Instead, it will behave "
|
dongsheng@627
|
9188 "unpredictably."
|
dongsheng@627
|
9189 msgstr ""
|
dongsheng@627
|
9190
|
dongsheng@627
|
9191 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
9192 #: ../en/ch06-collab.xml:1291
|
dongsheng@627
|
9193 msgid "Downloading source archives"
|
dongsheng@630
|
9194 msgstr "下载源代码档案包"
|
dongsheng@627
|
9195
|
dongsheng@627
|
9196 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9197 #: ../en/ch06-collab.xml:1293
|
dongsheng@627
|
9198 msgid ""
|
dongsheng@627
|
9199 "Mercurial's web interface lets users download an archive of any revision. "
|
dongsheng@627
|
9200 "This archive will contain a snapshot of the working directory as of that "
|
dongsheng@627
|
9201 "revision, but it will not contain a copy of the repository data."
|
dongsheng@627
|
9202 msgstr ""
|
dongsheng@627
|
9203
|
dongsheng@627
|
9204 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9205 #: ../en/ch06-collab.xml:1298
|
dongsheng@627
|
9206 msgid ""
|
dongsheng@627
|
9207 "By default, this feature is not enabled. To enable it, you'll need to add an "
|
dongsheng@627
|
9208 "<envar role=\"rc-item-web\">allow_archive</envar> item to the <literal role="
|
dongsheng@650
|
9209 "\"rc-web\">web</literal> section of your <filename role=\"special\">~/.hgrc</"
|
songdongsheng@710
|
9210 "filename>; see below for details."
|
songdongsheng@710
|
9211 msgstr ""
|
songdongsheng@710
|
9212
|
songdongsheng@710
|
9213 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
9214 #: ../en/ch06-collab.xml:1305
|
dongsheng@627
|
9215 msgid "Web configuration options"
|
dongsheng@630
|
9216 msgstr "Web 配置选项"
|
dongsheng@627
|
9217
|
dongsheng@627
|
9218 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9219 #: ../en/ch06-collab.xml:1307
|
dongsheng@627
|
9220 msgid ""
|
dongsheng@627
|
9221 "Mercurial's web interfaces (the <command role=\"hg-cmd\">hg serve</command> "
|
dongsheng@627
|
9222 "command, and the <filename role=\"special\">hgweb.cgi</filename> and "
|
dongsheng@627
|
9223 "<filename role=\"special\">hgwebdir.cgi</filename> scripts) have a number of "
|
dongsheng@627
|
9224 "configuration options that you can set. These belong in a section named "
|
dongsheng@627
|
9225 "<literal role=\"rc-web\">web</literal>."
|
dongsheng@627
|
9226 msgstr ""
|
dongsheng@627
|
9227
|
dongsheng@627
|
9228 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
9229 #: ../en/ch06-collab.xml:1315
|
dongsheng@627
|
9230 msgid ""
|
dongsheng@627
|
9231 "<envar role=\"rc-item-web\">allow_archive</envar>: Determines which (if any) "
|
dongsheng@627
|
9232 "archive download mechanisms Mercurial supports. If you enable this feature, "
|
dongsheng@627
|
9233 "users of the web interface will be able to download an archive of whatever "
|
dongsheng@627
|
9234 "revision of a repository they are viewing. To enable the archive feature, "
|
dongsheng@627
|
9235 "this item must take the form of a sequence of words drawn from the list below."
|
dongsheng@627
|
9236 msgstr ""
|
dongsheng@627
|
9237
|
dongsheng@627
|
9238 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
|
dongsheng@714
|
9239 #: ../en/ch06-collab.xml:1324
|
dongsheng@627
|
9240 msgid ""
|
dongsheng@627
|
9241 "<literal>bz2</literal>: A <command>tar</command> archive, compressed using "
|
dongsheng@627
|
9242 "<literal>bzip2</literal> compression. This has the best compression ratio, "
|
dongsheng@627
|
9243 "but uses the most CPU time on the server."
|
dongsheng@627
|
9244 msgstr ""
|
dongsheng@627
|
9245
|
dongsheng@627
|
9246 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
|
dongsheng@714
|
9247 #: ../en/ch06-collab.xml:1330
|
dongsheng@627
|
9248 msgid ""
|
dongsheng@627
|
9249 "<literal>gz</literal>: A <command>tar</command> archive, compressed using "
|
dongsheng@627
|
9250 "<literal>gzip</literal> compression."
|
dongsheng@627
|
9251 msgstr ""
|
dongsheng@627
|
9252
|
dongsheng@627
|
9253 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
|
dongsheng@714
|
9254 #: ../en/ch06-collab.xml:1334
|
dongsheng@627
|
9255 msgid ""
|
dongsheng@627
|
9256 "<literal>zip</literal>: A <command>zip</command> archive, compressed using "
|
dongsheng@627
|
9257 "LZW compression. This format has the worst compression ratio, but is widely "
|
dongsheng@627
|
9258 "used in the Windows world."
|
dongsheng@627
|
9259 msgstr ""
|
dongsheng@627
|
9260
|
dongsheng@627
|
9261 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
9262 #: ../en/ch06-collab.xml:1340
|
dongsheng@627
|
9263 msgid ""
|
dongsheng@627
|
9264 "If you provide an empty list, or don't have an <envar role=\"rc-item-web"
|
dongsheng@627
|
9265 "\">allow_archive</envar> entry at all, this feature will be disabled. Here "
|
dongsheng@627
|
9266 "is an example of how to enable all three supported formats."
|
dongsheng@627
|
9267 msgstr ""
|
dongsheng@627
|
9268
|
dongsheng@627
|
9269 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
9270 #: ../en/ch06-collab.xml:1347
|
dongsheng@627
|
9271 msgid ""
|
dongsheng@627
|
9272 "<envar role=\"rc-item-web\">allowpull</envar>: Boolean. Determines whether "
|
dongsheng@627
|
9273 "the web interface allows remote users to <command role=\"hg-cmd\">hg pull</"
|
dongsheng@627
|
9274 "command> and <command role=\"hg-cmd\">hg clone</command> this repository over "
|
dongsheng@627
|
9275 "HTTP. If set to <literal>no</literal> or <literal>false</literal>, only the "
|
dongsheng@627
|
9276 "<quote>human-oriented</quote> portion of the web interface is available."
|
dongsheng@627
|
9277 msgstr ""
|
dongsheng@627
|
9278
|
dongsheng@627
|
9279 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
9280 #: ../en/ch06-collab.xml:1356
|
dongsheng@627
|
9281 msgid ""
|
dongsheng@627
|
9282 "<envar role=\"rc-item-web\">contact</envar>: String. A free-form (but "
|
dongsheng@627
|
9283 "preferably brief) string identifying the person or group in charge of the "
|
dongsheng@627
|
9284 "repository. This often contains the name and email address of a person or "
|
dongsheng@627
|
9285 "mailing list. It often makes sense to place this entry in a repository's own "
|
dongsheng@627
|
9286 "<filename role=\"special\">.hg/hgrc</filename> file, but it can make sense to "
|
dongsheng@650
|
9287 "use in a global <filename role=\"special\">~/.hgrc</filename> if every "
|
dongsheng@627
|
9288 "repository has a single maintainer."
|
dongsheng@627
|
9289 msgstr ""
|
dongsheng@627
|
9290
|
dongsheng@627
|
9291 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
9292 #: ../en/ch06-collab.xml:1367
|
dongsheng@627
|
9293 msgid ""
|
dongsheng@627
|
9294 "<envar role=\"rc-item-web\">maxchanges</envar>: Integer. The default maximum "
|
dongsheng@627
|
9295 "number of changesets to display in a single page of output."
|
dongsheng@627
|
9296 msgstr ""
|
dongsheng@627
|
9297
|
dongsheng@627
|
9298 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
9299 #: ../en/ch06-collab.xml:1371
|
dongsheng@627
|
9300 msgid ""
|
dongsheng@627
|
9301 "<envar role=\"rc-item-web\">maxfiles</envar>: Integer. The default maximum "
|
dongsheng@627
|
9302 "number of modified files to display in a single page of output."
|
dongsheng@627
|
9303 msgstr ""
|
dongsheng@627
|
9304
|
dongsheng@627
|
9305 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
9306 #: ../en/ch06-collab.xml:1375
|
dongsheng@627
|
9307 msgid ""
|
dongsheng@627
|
9308 "<envar role=\"rc-item-web\">stripes</envar>: Integer. If the web interface "
|
dongsheng@627
|
9309 "displays alternating <quote>stripes</quote> to make it easier to visually "
|
dongsheng@627
|
9310 "align rows when you are looking at a table, this number controls the number "
|
dongsheng@627
|
9311 "of rows in each stripe."
|
dongsheng@627
|
9312 msgstr ""
|
dongsheng@627
|
9313
|
dongsheng@627
|
9314 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
9315 #: ../en/ch06-collab.xml:1381
|
dongsheng@627
|
9316 msgid ""
|
dongsheng@627
|
9317 "<envar role=\"rc-item-web\">style</envar>: Controls the template Mercurial "
|
songdongsheng@710
|
9318 "uses to display the web interface. Mercurial ships with several web "
|
songdongsheng@710
|
9319 "templates."
|
songdongsheng@710
|
9320 msgstr ""
|
songdongsheng@710
|
9321
|
songdongsheng@710
|
9322 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
|
dongsheng@714
|
9323 #: ../en/ch06-collab.xml:1387
|
songdongsheng@710
|
9324 msgid "<literal>coal</literal> is monochromatic."
|
songdongsheng@710
|
9325 msgstr ""
|
songdongsheng@710
|
9326
|
songdongsheng@710
|
9327 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
|
dongsheng@714
|
9328 #: ../en/ch06-collab.xml:1390
|
songdongsheng@710
|
9329 msgid ""
|
songdongsheng@710
|
9330 "<literal>gitweb</literal> emulates the visual style of git's web interface."
|
songdongsheng@710
|
9331 msgstr ""
|
songdongsheng@710
|
9332
|
songdongsheng@710
|
9333 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
|
dongsheng@714
|
9334 #: ../en/ch06-collab.xml:1394
|
songdongsheng@710
|
9335 msgid "<literal>monoblue</literal> uses solid blues and greys."
|
songdongsheng@710
|
9336 msgstr ""
|
songdongsheng@710
|
9337
|
songdongsheng@710
|
9338 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
|
dongsheng@714
|
9339 #: ../en/ch06-collab.xml:1398
|
songdongsheng@710
|
9340 msgid "<literal>paper</literal> is the default."
|
songdongsheng@710
|
9341 msgstr ""
|
songdongsheng@710
|
9342
|
songdongsheng@710
|
9343 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
|
dongsheng@714
|
9344 #: ../en/ch06-collab.xml:1401
|
songdongsheng@710
|
9345 msgid "<literal>spartan</literal> was the default for a long time."
|
dongsheng@627
|
9346 msgstr ""
|
dongsheng@627
|
9347
|
dongsheng@627
|
9348 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
9349 #: ../en/ch06-collab.xml:1405
|
songdongsheng@710
|
9350 msgid ""
|
songdongsheng@710
|
9351 "You can also specify a custom template of your own; see <xref linkend=\"chap:"
|
songdongsheng@710
|
9352 "template\"/> for details. Here, you can see how to enable the "
|
songdongsheng@710
|
9353 "<literal>gitweb</literal> style."
|
songdongsheng@710
|
9354 msgstr ""
|
songdongsheng@710
|
9355
|
songdongsheng@710
|
9356 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
9357 #: ../en/ch06-collab.xml:1413
|
dongsheng@627
|
9358 msgid ""
|
dongsheng@627
|
9359 "<envar role=\"rc-item-web\">templates</envar>: Path. The directory in which "
|
dongsheng@627
|
9360 "to search for template files. By default, Mercurial searches in the "
|
dongsheng@627
|
9361 "directory in which it was installed."
|
dongsheng@627
|
9362 msgstr ""
|
dongsheng@627
|
9363
|
dongsheng@627
|
9364 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9365 #: ../en/ch06-collab.xml:1418
|
dongsheng@627
|
9366 msgid ""
|
dongsheng@627
|
9367 "If you are using <filename role=\"special\">hgwebdir.cgi</filename>, you can "
|
dongsheng@627
|
9368 "place a few configuration items in a <literal role=\"rc-web\">web</literal> "
|
dongsheng@627
|
9369 "section of the <filename role=\"special\">hgweb.config</filename> file "
|
dongsheng@650
|
9370 "instead of a <filename role=\"special\">~/.hgrc</filename> file, for "
|
dongsheng@627
|
9371 "convenience. These items are <envar role=\"rc-item-web\">motd</envar> and "
|
dongsheng@627
|
9372 "<envar role=\"rc-item-web\">style</envar>."
|
dongsheng@627
|
9373 msgstr ""
|
dongsheng@627
|
9374
|
dongsheng@627
|
9375 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
9376 #: ../en/ch06-collab.xml:1429
|
dongsheng@627
|
9377 msgid "Options specific to an individual repository"
|
dongsheng@630
|
9378 msgstr "针对单个版本库的选项"
|
dongsheng@627
|
9379
|
dongsheng@627
|
9380 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
9381 #: ../en/ch06-collab.xml:1431
|
dongsheng@627
|
9382 msgid ""
|
dongsheng@627
|
9383 "A few <literal role=\"rc-web\">web</literal> configuration items ought to be "
|
dongsheng@627
|
9384 "placed in a repository's local <filename role=\"special\">.hg/hgrc</"
|
dongsheng@650
|
9385 "filename>, rather than a user's or global <filename role=\"special\">~/.hgrc</"
|
dongsheng@627
|
9386 "filename>."
|
dongsheng@627
|
9387 msgstr ""
|
dongsheng@627
|
9388
|
dongsheng@627
|
9389 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
9390 #: ../en/ch06-collab.xml:1436
|
dongsheng@627
|
9391 msgid ""
|
dongsheng@627
|
9392 "<envar role=\"rc-item-web\">description</envar>: String. A free-form (but "
|
dongsheng@627
|
9393 "preferably brief) string that describes the contents or purpose of the "
|
dongsheng@627
|
9394 "repository."
|
dongsheng@627
|
9395 msgstr ""
|
dongsheng@627
|
9396
|
dongsheng@627
|
9397 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
9398 #: ../en/ch06-collab.xml:1441
|
dongsheng@627
|
9399 msgid ""
|
dongsheng@627
|
9400 "<envar role=\"rc-item-web\">name</envar>: String. The name to use for the "
|
dongsheng@627
|
9401 "repository in the web interface. This overrides the default name, which is "
|
dongsheng@627
|
9402 "the last component of the repository's path."
|
dongsheng@627
|
9403 msgstr ""
|
dongsheng@627
|
9404
|
dongsheng@627
|
9405 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
9406 #: ../en/ch06-collab.xml:1449
|
dongsheng@627
|
9407 msgid ""
|
dongsheng@627
|
9408 "Options specific to the <command role=\"hg-cmd\">hg serve</command> command"
|
dongsheng@630
|
9409 msgstr "命令 <command role=\"hg-cmd\">hg serve</command> 的选项"
|
dongsheng@627
|
9410
|
dongsheng@627
|
9411 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
9412 #: ../en/ch06-collab.xml:1452
|
dongsheng@627
|
9413 msgid ""
|
dongsheng@627
|
9414 "Some of the items in the <literal role=\"rc-web\">web</literal> section of a "
|
dongsheng@650
|
9415 "<filename role=\"special\">~/.hgrc</filename> file are only for use with the "
|
dongsheng@650
|
9416 "<command role=\"hg-cmd\">hg serve</command> command."
|
dongsheng@627
|
9417 msgstr ""
|
dongsheng@627
|
9418
|
dongsheng@627
|
9419 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
9420 #: ../en/ch06-collab.xml:1458
|
dongsheng@627
|
9421 msgid ""
|
dongsheng@627
|
9422 "<envar role=\"rc-item-web\">accesslog</envar>: Path. The name of a file into "
|
dongsheng@627
|
9423 "which to write an access log. By default, the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
9424 "serve</command> command writes this information to standard output, not to a "
|
dongsheng@627
|
9425 "file. Log entries are written in the standard <quote>combined</quote> file "
|
dongsheng@627
|
9426 "format used by almost all web servers."
|
dongsheng@627
|
9427 msgstr ""
|
dongsheng@627
|
9428
|
dongsheng@627
|
9429 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
9430 #: ../en/ch06-collab.xml:1466
|
dongsheng@627
|
9431 msgid ""
|
dongsheng@627
|
9432 "<envar role=\"rc-item-web\">address</envar>: String. The local address on "
|
dongsheng@627
|
9433 "which the server should listen for incoming connections. By default, the "
|
dongsheng@627
|
9434 "server listens on all addresses."
|
dongsheng@627
|
9435 msgstr ""
|
dongsheng@627
|
9436
|
dongsheng@627
|
9437 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
9438 #: ../en/ch06-collab.xml:1471
|
dongsheng@627
|
9439 msgid ""
|
dongsheng@627
|
9440 "<envar role=\"rc-item-web\">errorlog</envar>: Path. The name of a file into "
|
dongsheng@627
|
9441 "which to write an error log. By default, the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
9442 "serve</command> command writes this information to standard error, not to a "
|
dongsheng@627
|
9443 "file."
|
dongsheng@627
|
9444 msgstr ""
|
dongsheng@627
|
9445
|
dongsheng@627
|
9446 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
9447 #: ../en/ch06-collab.xml:1477
|
dongsheng@627
|
9448 msgid ""
|
dongsheng@627
|
9449 "<envar role=\"rc-item-web\">ipv6</envar>: Boolean. Whether to use the IPv6 "
|
dongsheng@627
|
9450 "protocol. By default, IPv6 is not used."
|
dongsheng@627
|
9451 msgstr ""
|
dongsheng@627
|
9452
|
dongsheng@627
|
9453 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
9454 #: ../en/ch06-collab.xml:1481
|
dongsheng@627
|
9455 msgid ""
|
dongsheng@627
|
9456 "<envar role=\"rc-item-web\">port</envar>: Integer. The TCP port number on "
|
dongsheng@627
|
9457 "which the server should listen. The default port number used is 8000."
|
dongsheng@627
|
9458 msgstr ""
|
dongsheng@627
|
9459
|
dongsheng@627
|
9460 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
9461 #: ../en/ch06-collab.xml:1488
|
dongsheng@650
|
9462 msgid ""
|
dongsheng@650
|
9463 "Choosing the right <filename role=\"special\">~/.hgrc</filename> file to add "
|
dongsheng@650
|
9464 "<literal role=\"rc-web\">web</literal> items to"
|
dongsheng@627
|
9465 msgstr ""
|
dongsheng@653
|
9466 "选择正确的 <filename role=\"special\"> ~/.hgrc</filename> 文件增加到 <literal "
|
dongsheng@630
|
9467 "role=\"rc-web\">web</literal> 条目"
|
dongsheng@627
|
9468
|
dongsheng@627
|
9469 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
9470 #: ../en/ch06-collab.xml:1492
|
dongsheng@627
|
9471 msgid ""
|
dongsheng@627
|
9472 "It is important to remember that a web server like Apache or "
|
dongsheng@627
|
9473 "<literal>lighttpd</literal> will run under a user ID that is different to "
|
dongsheng@627
|
9474 "yours. CGI scripts run by your server, such as <filename role=\"special"
|
dongsheng@627
|
9475 "\">hgweb.cgi</filename>, will usually also run under that user ID."
|
dongsheng@627
|
9476 msgstr ""
|
dongsheng@627
|
9477
|
dongsheng@627
|
9478 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
9479 #: ../en/ch06-collab.xml:1499
|
dongsheng@627
|
9480 msgid ""
|
dongsheng@627
|
9481 "If you add <literal role=\"rc-web\">web</literal> items to your own personal "
|
dongsheng@650
|
9482 "<filename role=\"special\">~/.hgrc</filename> file, CGI scripts won't read "
|
dongsheng@650
|
9483 "that <filename role=\"special\">~/.hgrc</filename> file. Those settings will "
|
songdongsheng@710
|
9484 "thus only affect the behavior of the <command role=\"hg-cmd\">hg serve</"
|
dongsheng@627
|
9485 "command> command when you run it. To cause CGI scripts to see your settings, "
|
dongsheng@650
|
9486 "either create a <filename role=\"special\">~/.hgrc</filename> file in the "
|
dongsheng@627
|
9487 "home directory of the user ID that runs your web server, or add those "
|
songdongsheng@710
|
9488 "settings to a system-wide <filename role=\"special\">hgrc</filename> file."
|
songdongsheng@710
|
9489 msgstr ""
|
songdongsheng@710
|
9490
|
songdongsheng@710
|
9491 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
9492 #: ../en/ch06-collab.xml:1514
|
songdongsheng@710
|
9493 msgid "System-wide configuration"
|
songdongsheng@711
|
9494 msgstr "全局配置"
|
songdongsheng@710
|
9495
|
songdongsheng@710
|
9496 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9497 #: ../en/ch06-collab.xml:1516
|
songdongsheng@710
|
9498 msgid ""
|
songdongsheng@710
|
9499 "On Unix-like systems shared by multiple users (such as a server to which "
|
songdongsheng@710
|
9500 "people publish changes), it often makes sense to set up some global default "
|
songdongsheng@710
|
9501 "behaviors, such as what theme to use in web interfaces."
|
songdongsheng@710
|
9502 msgstr ""
|
songdongsheng@710
|
9503
|
songdongsheng@710
|
9504 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9505 #: ../en/ch06-collab.xml:1521
|
songdongsheng@710
|
9506 msgid ""
|
songdongsheng@710
|
9507 "If a file named <filename>/etc/mercurial/hgrc</filename> exists, Mercurial "
|
songdongsheng@710
|
9508 "will read it at startup time and apply any configuration settings it finds in "
|
songdongsheng@710
|
9509 "that file. It will also look for files ending in a <literal>.rc</literal> "
|
songdongsheng@710
|
9510 "extension in a directory named <filename>/etc/mercurial/hgrc.d</filename>, "
|
songdongsheng@710
|
9511 "and apply any configuration settings it finds in each of those files."
|
songdongsheng@710
|
9512 msgstr ""
|
songdongsheng@710
|
9513
|
songdongsheng@710
|
9514 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
9515 #: ../en/ch06-collab.xml:1530
|
songdongsheng@710
|
9516 msgid "Making Mercurial more trusting"
|
songdongsheng@711
|
9517 msgstr "让 Mercurial 更可信"
|
songdongsheng@710
|
9518
|
songdongsheng@710
|
9519 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9520 #: ../en/ch06-collab.xml:1532
|
songdongsheng@710
|
9521 msgid ""
|
songdongsheng@710
|
9522 "One situation in which a global <filename>hgrc</filename> can be useful is if "
|
songdongsheng@710
|
9523 "users are pulling changes owned by other users. By default, Mercurial will "
|
songdongsheng@710
|
9524 "not trust most of the configuration items in a <filename>.hg/hgrc</filename> "
|
songdongsheng@710
|
9525 "file inside a repository that is owned by a different user. If we clone or "
|
songdongsheng@710
|
9526 "pull changes from such a repository, Mercurial will print a warning stating "
|
songdongsheng@710
|
9527 "that it does not trust their <filename>.hg/hgrc</filename>."
|
songdongsheng@710
|
9528 msgstr ""
|
songdongsheng@710
|
9529
|
songdongsheng@710
|
9530 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9531 #: ../en/ch06-collab.xml:1541
|
songdongsheng@710
|
9532 msgid ""
|
songdongsheng@710
|
9533 "If everyone in a particular Unix group is on the same team and "
|
songdongsheng@710
|
9534 "<emphasis>should</emphasis> trust each other's configuration settings, or we "
|
songdongsheng@710
|
9535 "want to trust particular users, we can override Mercurial's skeptical "
|
songdongsheng@710
|
9536 "defaults by creating a system-wide <filename>hgrc</filename> file such as the "
|
songdongsheng@710
|
9537 "following:"
|
dongsheng@627
|
9538 msgstr ""
|
dongsheng@627
|
9539
|
dongsheng@627
|
9540 #. type: Content of: <book><chapter><title>
|
dongsheng@714
|
9541 #: ../en/ch07-filenames.xml:5
|
dongsheng@627
|
9542 msgid "File names and pattern matching"
|
dongsheng@627
|
9543 msgstr "文件名称与模式匹配"
|
dongsheng@627
|
9544
|
dongsheng@627
|
9545 #. type: Content of: <book><chapter><para>
|
dongsheng@714
|
9546 #: ../en/ch07-filenames.xml:7
|
dongsheng@627
|
9547 msgid ""
|
dongsheng@627
|
9548 "Mercurial provides mechanisms that let you work with file names in a "
|
dongsheng@627
|
9549 "consistent and expressive way."
|
dongsheng@627
|
9550 msgstr ""
|
dongsheng@627
|
9551
|
dongsheng@627
|
9552 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
9553 #: ../en/ch07-filenames.xml:11
|
dongsheng@627
|
9554 msgid "Simple file naming"
|
dongsheng@630
|
9555 msgstr "简单文件名称"
|
dongsheng@627
|
9556
|
dongsheng@627
|
9557 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9558 #: ../en/ch07-filenames.xml:13
|
dongsheng@627
|
9559 msgid ""
|
dongsheng@627
|
9560 "Mercurial uses a unified piece of machinery <quote>under the hood</quote> to "
|
dongsheng@627
|
9561 "handle file names. Every command behaves uniformly with respect to file "
|
dongsheng@627
|
9562 "names. The way in which commands work with file names is as follows."
|
dongsheng@627
|
9563 msgstr ""
|
dongsheng@627
|
9564
|
dongsheng@627
|
9565 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9566 #: ../en/ch07-filenames.xml:18
|
dongsheng@627
|
9567 msgid ""
|
dongsheng@627
|
9568 "If you explicitly name real files on the command line, Mercurial works with "
|
dongsheng@627
|
9569 "exactly those files, as you would expect. &interaction.filenames.files;"
|
dongsheng@627
|
9570 msgstr ""
|
dongsheng@627
|
9571
|
dongsheng@627
|
9572 #
|
dongsheng@627
|
9573 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9574 #: ../en/ch07-filenames.xml:22
|
dongsheng@627
|
9575 msgid ""
|
dongsheng@627
|
9576 "When you provide a directory name, Mercurial will interpret this as "
|
dongsheng@627
|
9577 "<quote>operate on every file in this directory and its subdirectories</"
|
dongsheng@627
|
9578 "quote>. Mercurial traverses the files and subdirectories in a directory in "
|
dongsheng@627
|
9579 "alphabetical order. When it encounters a subdirectory, it will traverse that "
|
dongsheng@627
|
9580 "subdirectory before continuing with the current directory."
|
dongsheng@627
|
9581 msgstr ""
|
dongsheng@627
|
9582
|
dongsheng@627
|
9583 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
9584 #: ../en/ch07-filenames.xml:33
|
dongsheng@627
|
9585 msgid "Running commands without any file names"
|
dongsheng@630
|
9586 msgstr "不提供文件名称的执行命令"
|
dongsheng@627
|
9587
|
dongsheng@627
|
9588 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9589 #: ../en/ch07-filenames.xml:35
|
dongsheng@627
|
9590 msgid ""
|
songdongsheng@710
|
9591 "Mercurial's commands that work with file names have useful default behaviors "
|
dongsheng@627
|
9592 "when you invoke them without providing any file names or patterns. What kind "
|
songdongsheng@710
|
9593 "of behavior you should expect depends on what the command does. Here are a "
|
dongsheng@627
|
9594 "few rules of thumb you can use to predict what a command is likely to do if "
|
dongsheng@627
|
9595 "you don't give it any names to work with."
|
dongsheng@627
|
9596 msgstr ""
|
dongsheng@627
|
9597
|
dongsheng@627
|
9598 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
9599 #: ../en/ch07-filenames.xml:42
|
dongsheng@627
|
9600 msgid ""
|
dongsheng@627
|
9601 "Most commands will operate on the entire working directory. This is what the "
|
dongsheng@627
|
9602 "<command role=\"hg-cmd\">hg add</command> command does, for example."
|
dongsheng@627
|
9603 msgstr ""
|
dongsheng@627
|
9604
|
dongsheng@627
|
9605 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
9606 #: ../en/ch07-filenames.xml:46
|
dongsheng@627
|
9607 msgid ""
|
dongsheng@627
|
9608 "If the command has effects that are difficult or impossible to reverse, it "
|
dongsheng@627
|
9609 "will force you to explicitly provide at least one name or pattern (see "
|
dongsheng@627
|
9610 "below). This protects you from accidentally deleting files by running "
|
dongsheng@627
|
9611 "<command role=\"hg-cmd\">hg remove</command> with no arguments, for example."
|
dongsheng@627
|
9612 msgstr ""
|
dongsheng@627
|
9613
|
dongsheng@627
|
9614 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9615 #: ../en/ch07-filenames.xml:54
|
dongsheng@627
|
9616 msgid ""
|
songdongsheng@710
|
9617 "It's easy to work around these default behaviors if they don't suit you. If "
|
dongsheng@627
|
9618 "a command normally operates on the whole working directory, you can invoke it "
|
dongsheng@627
|
9619 "on just the current directory and its subdirectories by giving it the name "
|
dongsheng@627
|
9620 "<quote><filename class=\"directory\">.</filename></quote>."
|
dongsheng@627
|
9621 msgstr ""
|
dongsheng@627
|
9622
|
dongsheng@627
|
9623 #
|
dongsheng@627
|
9624 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9625 #: ../en/ch07-filenames.xml:62
|
dongsheng@627
|
9626 msgid ""
|
dongsheng@627
|
9627 "Along the same lines, some commands normally print file names relative to the "
|
dongsheng@627
|
9628 "root of the repository, even if you're invoking them from a subdirectory. "
|
dongsheng@627
|
9629 "Such a command will print file names relative to your subdirectory if you "
|
dongsheng@627
|
9630 "give it explicit names. Here, we're going to run <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
9631 "status</command> from a subdirectory, and get it to operate on the entire "
|
dongsheng@627
|
9632 "working directory while printing file names relative to our subdirectory, by "
|
dongsheng@627
|
9633 "passing it the output of the <command role=\"hg-cmd\">hg root</command> "
|
dongsheng@627
|
9634 "command."
|
dongsheng@627
|
9635 msgstr ""
|
dongsheng@627
|
9636
|
dongsheng@627
|
9637 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
9638 #: ../en/ch07-filenames.xml:76
|
dongsheng@627
|
9639 msgid "Telling you what's going on"
|
dongsheng@630
|
9640 msgstr "告诉你正在做什么"
|
dongsheng@627
|
9641
|
dongsheng@627
|
9642 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9643 #: ../en/ch07-filenames.xml:78
|
dongsheng@627
|
9644 msgid ""
|
dongsheng@627
|
9645 "The <command role=\"hg-cmd\">hg add</command> example in the preceding "
|
dongsheng@627
|
9646 "section illustrates something else that's helpful about Mercurial commands. "
|
dongsheng@627
|
9647 "If a command operates on a file that you didn't name explicitly on the "
|
dongsheng@627
|
9648 "command line, it will usually print the name of the file, so that you will "
|
dongsheng@627
|
9649 "not be surprised what's going on."
|
dongsheng@627
|
9650 msgstr ""
|
dongsheng@627
|
9651
|
dongsheng@627
|
9652 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9653 #: ../en/ch07-filenames.xml:85
|
dongsheng@627
|
9654 msgid ""
|
dongsheng@627
|
9655 "The principle here is of <emphasis>least surprise</emphasis>. If you've "
|
dongsheng@627
|
9656 "exactly named a file on the command line, there's no point in repeating it "
|
dongsheng@627
|
9657 "back at you. If Mercurial is acting on a file <emphasis>implicitly</"
|
songdongsheng@710
|
9658 "emphasis>, e.g. because you provided no names, or a directory, or a pattern "
|
songdongsheng@710
|
9659 "(see below), it is safest to tell you what files it's operating on."
|
dongsheng@627
|
9660 msgstr ""
|
dongsheng@627
|
9661
|
dongsheng@627
|
9662 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9663 #: ../en/ch07-filenames.xml:92
|
dongsheng@627
|
9664 msgid ""
|
dongsheng@627
|
9665 "For commands that behave this way, you can silence them using the <option "
|
dongsheng@627
|
9666 "role=\"hg-opt-global\">-q</option> option. You can also get them to print "
|
dongsheng@627
|
9667 "the name of every file, even those you've named explicitly, using the <option "
|
dongsheng@627
|
9668 "role=\"hg-opt-global\">-v</option> option."
|
dongsheng@627
|
9669 msgstr ""
|
dongsheng@627
|
9670
|
dongsheng@627
|
9671 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
9672 #: ../en/ch07-filenames.xml:100
|
dongsheng@627
|
9673 msgid "Using patterns to identify files"
|
dongsheng@630
|
9674 msgstr "使用模式标识文件"
|
dongsheng@627
|
9675
|
dongsheng@627
|
9676 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9677 #: ../en/ch07-filenames.xml:102
|
dongsheng@627
|
9678 msgid ""
|
dongsheng@627
|
9679 "In addition to working with file and directory names, Mercurial lets you use "
|
dongsheng@627
|
9680 "<emphasis>patterns</emphasis> to identify files. Mercurial's pattern "
|
dongsheng@627
|
9681 "handling is expressive."
|
dongsheng@627
|
9682 msgstr ""
|
dongsheng@627
|
9683
|
dongsheng@627
|
9684 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9685 #: ../en/ch07-filenames.xml:106
|
dongsheng@627
|
9686 msgid ""
|
dongsheng@627
|
9687 "On Unix-like systems (Linux, MacOS, etc.), the job of matching file names to "
|
dongsheng@627
|
9688 "patterns normally falls to the shell. On these systems, you must explicitly "
|
dongsheng@627
|
9689 "tell Mercurial that a name is a pattern. On Windows, the shell does not "
|
dongsheng@627
|
9690 "expand patterns, so Mercurial will automatically identify names that are "
|
dongsheng@627
|
9691 "patterns, and expand them for you."
|
dongsheng@627
|
9692 msgstr ""
|
dongsheng@627
|
9693
|
dongsheng@627
|
9694 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9695 #: ../en/ch07-filenames.xml:113
|
dongsheng@627
|
9696 msgid ""
|
dongsheng@627
|
9697 "To provide a pattern in place of a regular name on the command line, the "
|
dongsheng@627
|
9698 "mechanism is simple:"
|
dongsheng@627
|
9699 msgstr ""
|
dongsheng@627
|
9700
|
dongsheng@627
|
9701 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9702 #: ../en/ch07-filenames.xml:116
|
dongsheng@627
|
9703 msgid ""
|
dongsheng@627
|
9704 "That is, a pattern is identified by a short text string that says what kind "
|
dongsheng@627
|
9705 "of pattern this is, followed by a colon, followed by the actual pattern."
|
dongsheng@627
|
9706 msgstr ""
|
dongsheng@627
|
9707
|
dongsheng@627
|
9708 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9709 #: ../en/ch07-filenames.xml:120
|
dongsheng@627
|
9710 msgid ""
|
dongsheng@627
|
9711 "Mercurial supports two kinds of pattern syntax. The most frequently used is "
|
dongsheng@627
|
9712 "called <literal>glob</literal>; this is the same kind of pattern matching "
|
dongsheng@627
|
9713 "used by the Unix shell, and should be familiar to Windows command prompt "
|
dongsheng@627
|
9714 "users, too."
|
dongsheng@627
|
9715 msgstr ""
|
dongsheng@627
|
9716
|
dongsheng@627
|
9717 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9718 #: ../en/ch07-filenames.xml:125
|
dongsheng@627
|
9719 msgid ""
|
dongsheng@627
|
9720 "When Mercurial does automatic pattern matching on Windows, it uses "
|
dongsheng@627
|
9721 "<literal>glob</literal> syntax. You can thus omit the <quote><literal>glob:</"
|
dongsheng@627
|
9722 "literal></quote> prefix on Windows, but it's safe to use it, too."
|
dongsheng@627
|
9723 msgstr ""
|
dongsheng@627
|
9724
|
dongsheng@627
|
9725 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9726 #: ../en/ch07-filenames.xml:130
|
dongsheng@627
|
9727 msgid ""
|
dongsheng@627
|
9728 "The <literal>re</literal> syntax is more powerful; it lets you specify "
|
dongsheng@627
|
9729 "patterns using regular expressions, also known as regexps."
|
dongsheng@627
|
9730 msgstr ""
|
dongsheng@627
|
9731
|
dongsheng@627
|
9732 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9733 #: ../en/ch07-filenames.xml:134
|
dongsheng@627
|
9734 msgid ""
|
dongsheng@627
|
9735 "By the way, in the examples that follow, notice that I'm careful to wrap all "
|
dongsheng@627
|
9736 "of my patterns in quote characters, so that they won't get expanded by the "
|
dongsheng@627
|
9737 "shell before Mercurial sees them."
|
dongsheng@627
|
9738 msgstr ""
|
dongsheng@627
|
9739
|
dongsheng@627
|
9740 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
9741 #: ../en/ch07-filenames.xml:140
|
dongsheng@627
|
9742 msgid "Shell-style <literal>glob</literal> patterns"
|
dongsheng@630
|
9743 msgstr "外壳风格的 <literal>glob</literal> 模式"
|
dongsheng@627
|
9744
|
dongsheng@627
|
9745 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9746 #: ../en/ch07-filenames.xml:142
|
dongsheng@627
|
9747 msgid ""
|
dongsheng@627
|
9748 "This is an overview of the kinds of patterns you can use when you're matching "
|
dongsheng@627
|
9749 "on glob patterns."
|
dongsheng@627
|
9750 msgstr ""
|
dongsheng@627
|
9751
|
dongsheng@627
|
9752 #
|
dongsheng@627
|
9753 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9754 #: ../en/ch07-filenames.xml:145
|
dongsheng@627
|
9755 msgid ""
|
dongsheng@627
|
9756 "The <quote><literal>*</literal></quote> character matches any string, within "
|
dongsheng@627
|
9757 "a single directory."
|
dongsheng@627
|
9758 msgstr ""
|
dongsheng@627
|
9759
|
dongsheng@627
|
9760 #
|
dongsheng@627
|
9761 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9762 #: ../en/ch07-filenames.xml:150
|
dongsheng@627
|
9763 msgid ""
|
dongsheng@627
|
9764 "The <quote><literal>**</literal></quote> pattern matches any string, and "
|
dongsheng@627
|
9765 "crosses directory boundaries. It's not a standard Unix glob token, but it's "
|
dongsheng@627
|
9766 "accepted by several popular Unix shells, and is very useful."
|
dongsheng@627
|
9767 msgstr ""
|
dongsheng@627
|
9768
|
dongsheng@627
|
9769 #
|
dongsheng@627
|
9770 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9771 #: ../en/ch07-filenames.xml:157
|
dongsheng@627
|
9772 msgid ""
|
dongsheng@627
|
9773 "The <quote><literal>?</literal></quote> pattern matches any single character."
|
dongsheng@627
|
9774 msgstr ""
|
dongsheng@627
|
9775
|
dongsheng@627
|
9776 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9777 #: ../en/ch07-filenames.xml:162
|
dongsheng@627
|
9778 msgid ""
|
dongsheng@627
|
9779 "The <quote><literal>[</literal></quote> character begins a "
|
dongsheng@627
|
9780 "<emphasis>character class</emphasis>. This matches any single character "
|
dongsheng@627
|
9781 "within the class. The class ends with a <quote><literal>]</literal></quote> "
|
dongsheng@627
|
9782 "character. A class may contain multiple <emphasis>range</emphasis>s of the "
|
dongsheng@627
|
9783 "form <quote><literal>a-f</literal></quote>, which is shorthand for "
|
dongsheng@627
|
9784 "<quote><literal>abcdef</literal></quote>."
|
dongsheng@627
|
9785 msgstr ""
|
dongsheng@627
|
9786
|
dongsheng@627
|
9787 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9788 #: ../en/ch07-filenames.xml:172
|
dongsheng@627
|
9789 msgid ""
|
dongsheng@627
|
9790 "If the first character after the <quote><literal>[</literal></quote> in a "
|
dongsheng@627
|
9791 "character class is a <quote><literal>!</literal></quote>, it "
|
dongsheng@627
|
9792 "<emphasis>negates</emphasis> the class, making it match any single character "
|
dongsheng@627
|
9793 "not in the class."
|
dongsheng@627
|
9794 msgstr ""
|
dongsheng@627
|
9795
|
dongsheng@627
|
9796 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9797 #: ../en/ch07-filenames.xml:178
|
dongsheng@627
|
9798 msgid ""
|
dongsheng@627
|
9799 "A <quote><literal>{</literal></quote> begins a group of subpatterns, where "
|
dongsheng@627
|
9800 "the whole group matches if any subpattern in the group matches. The "
|
dongsheng@627
|
9801 "<quote><literal>,</literal></quote> character separates subpatterns, and "
|
dongsheng@627
|
9802 "<quote><literal>}</literal></quote> ends the group."
|
dongsheng@627
|
9803 msgstr ""
|
dongsheng@627
|
9804
|
dongsheng@627
|
9805 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
9806 #: ../en/ch07-filenames.xml:187
|
dongsheng@627
|
9807 msgid "Watch out!"
|
dongsheng@630
|
9808 msgstr "千万小心!"
|
dongsheng@627
|
9809
|
dongsheng@627
|
9810 #
|
dongsheng@627
|
9811 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
9812 #: ../en/ch07-filenames.xml:189
|
dongsheng@627
|
9813 msgid ""
|
dongsheng@627
|
9814 "Don't forget that if you want to match a pattern in any directory, you should "
|
dongsheng@627
|
9815 "not be using the <quote><literal>*</literal></quote> match-any token, as this "
|
dongsheng@627
|
9816 "will only match within one directory. Instead, use the <quote><literal>**</"
|
dongsheng@627
|
9817 "literal></quote> token. This small example illustrates the difference "
|
dongsheng@627
|
9818 "between the two."
|
dongsheng@627
|
9819 msgstr ""
|
dongsheng@627
|
9820
|
dongsheng@627
|
9821 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
9822 #: ../en/ch07-filenames.xml:201
|
dongsheng@627
|
9823 msgid "Regular expression matching with <literal>re</literal> patterns"
|
dongsheng@630
|
9824 msgstr "使用 <literal>re</literal> 模式的正则表达式匹配"
|
dongsheng@627
|
9825
|
dongsheng@627
|
9826 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9827 #: ../en/ch07-filenames.xml:204
|
dongsheng@627
|
9828 msgid ""
|
dongsheng@627
|
9829 "Mercurial accepts the same regular expression syntax as the Python "
|
dongsheng@627
|
9830 "programming language (it uses Python's regexp engine internally). This is "
|
dongsheng@627
|
9831 "based on the Perl language's regexp syntax, which is the most popular dialect "
|
dongsheng@627
|
9832 "in use (it's also used in Java, for example)."
|
dongsheng@627
|
9833 msgstr ""
|
dongsheng@627
|
9834
|
dongsheng@627
|
9835 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9836 #: ../en/ch07-filenames.xml:210
|
dongsheng@627
|
9837 msgid ""
|
dongsheng@627
|
9838 "I won't discuss Mercurial's regexp dialect in any detail here, as regexps are "
|
dongsheng@627
|
9839 "not often used. Perl-style regexps are in any case already exhaustively "
|
dongsheng@627
|
9840 "documented on a multitude of web sites, and in many books. Instead, I will "
|
dongsheng@627
|
9841 "focus here on a few things you should know if you find yourself needing to "
|
dongsheng@627
|
9842 "use regexps with Mercurial."
|
dongsheng@627
|
9843 msgstr ""
|
dongsheng@627
|
9844
|
dongsheng@627
|
9845 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9846 #: ../en/ch07-filenames.xml:217
|
dongsheng@627
|
9847 msgid ""
|
dongsheng@627
|
9848 "A regexp is matched against an entire file name, relative to the root of the "
|
dongsheng@627
|
9849 "repository. In other words, even if you're already in subbdirectory "
|
dongsheng@627
|
9850 "<filename class=\"directory\">foo</filename>, if you want to match files "
|
dongsheng@627
|
9851 "under this directory, your pattern must start with <quote><literal>foo/</"
|
dongsheng@627
|
9852 "literal></quote>."
|
dongsheng@627
|
9853 msgstr ""
|
dongsheng@627
|
9854
|
dongsheng@627
|
9855 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
9856 #: ../en/ch07-filenames.xml:224
|
dongsheng@627
|
9857 msgid ""
|
dongsheng@627
|
9858 "One thing to note, if you're familiar with Perl-style regexps, is that "
|
dongsheng@627
|
9859 "Mercurial's are <emphasis>rooted</emphasis>. That is, a regexp starts "
|
dongsheng@627
|
9860 "matching against the beginning of a string; it doesn't look for a match "
|
dongsheng@627
|
9861 "anywhere within the string. To match anywhere in a string, start your "
|
dongsheng@627
|
9862 "pattern with <quote><literal>.*</literal></quote>."
|
dongsheng@627
|
9863 msgstr ""
|
dongsheng@627
|
9864
|
dongsheng@627
|
9865 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
9866 #: ../en/ch07-filenames.xml:234
|
dongsheng@627
|
9867 msgid "Filtering files"
|
dongsheng@630
|
9868 msgstr "过滤文件"
|
dongsheng@627
|
9869
|
dongsheng@627
|
9870 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9871 #: ../en/ch07-filenames.xml:236
|
dongsheng@627
|
9872 msgid ""
|
dongsheng@627
|
9873 "Not only does Mercurial give you a variety of ways to specify files; it lets "
|
dongsheng@627
|
9874 "you further winnow those files using <emphasis>filters</emphasis>. Commands "
|
dongsheng@627
|
9875 "that work with file names accept two filtering options."
|
dongsheng@627
|
9876 msgstr ""
|
dongsheng@627
|
9877
|
dongsheng@627
|
9878 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
9879 #: ../en/ch07-filenames.xml:241
|
dongsheng@627
|
9880 msgid ""
|
dongsheng@627
|
9881 "<option role=\"hg-opt-global\">-I</option>, or <option role=\"hg-opt-global"
|
dongsheng@627
|
9882 "\">--include</option>, lets you specify a pattern that file names must match "
|
dongsheng@627
|
9883 "in order to be processed."
|
dongsheng@627
|
9884 msgstr ""
|
dongsheng@627
|
9885
|
dongsheng@627
|
9886 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
9887 #: ../en/ch07-filenames.xml:246
|
dongsheng@627
|
9888 msgid ""
|
dongsheng@627
|
9889 "<option role=\"hg-opt-global\">-X</option>, or <option role=\"hg-opt-global"
|
dongsheng@627
|
9890 "\">--exclude</option>, gives you a way to <emphasis>avoid</emphasis> "
|
dongsheng@627
|
9891 "processing files, if they match this pattern."
|
dongsheng@627
|
9892 msgstr ""
|
dongsheng@627
|
9893
|
dongsheng@627
|
9894 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9895 #: ../en/ch07-filenames.xml:251
|
dongsheng@627
|
9896 msgid ""
|
dongsheng@627
|
9897 "You can provide multiple <option role=\"hg-opt-global\">-I</option> and "
|
dongsheng@627
|
9898 "<option role=\"hg-opt-global\">-X</option> options on the command line, and "
|
dongsheng@627
|
9899 "intermix them as you please. Mercurial interprets the patterns you provide "
|
dongsheng@627
|
9900 "using glob syntax by default (but you can use regexps if you need to)."
|
dongsheng@627
|
9901 msgstr ""
|
dongsheng@627
|
9902
|
dongsheng@627
|
9903 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9904 #: ../en/ch07-filenames.xml:258
|
dongsheng@627
|
9905 msgid ""
|
dongsheng@627
|
9906 "You can read a <option role=\"hg-opt-global\">-I</option> filter as "
|
dongsheng@627
|
9907 "<quote>process only the files that match this filter</quote>."
|
dongsheng@627
|
9908 msgstr ""
|
dongsheng@627
|
9909
|
dongsheng@627
|
9910 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9911 #: ../en/ch07-filenames.xml:264
|
dongsheng@627
|
9912 msgid ""
|
dongsheng@627
|
9913 "The <option role=\"hg-opt-global\">-X</option> filter is best read as "
|
dongsheng@627
|
9914 "<quote>process only the files that don't match this pattern</quote>."
|
dongsheng@627
|
9915 msgstr ""
|
dongsheng@627
|
9916
|
dongsheng@627
|
9917 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
9918 #: ../en/ch07-filenames.xml:272
|
songdongsheng@710
|
9919 msgid "Permanently ignoring unwanted files and directories"
|
songdongsheng@711
|
9920 msgstr "始终忽略不需要的文件和目录"
|
dongsheng@627
|
9921
|
dongsheng@627
|
9922 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9923 #: ../en/ch07-filenames.xml:274
|
songdongsheng@710
|
9924 msgid ""
|
songdongsheng@710
|
9925 "When you create a new repository, the chances are that over time it will grow "
|
songdongsheng@710
|
9926 "to contain files that ought to <emphasis>not</emphasis> be managed by "
|
songdongsheng@710
|
9927 "Mercurial, but which you don't want to see listed every time you run "
|
songdongsheng@710
|
9928 "<command>hg status</command>. For instance, <quote>build products</quote> "
|
songdongsheng@710
|
9929 "are files that are created as part of a build but which should not be managed "
|
songdongsheng@710
|
9930 "by a revision control system. The most common build products are output "
|
songdongsheng@710
|
9931 "files produced by software tools such as compilers. As another example, many "
|
songdongsheng@710
|
9932 "text editors litter a directory with lock files, temporary working files, and "
|
songdongsheng@710
|
9933 "backup files, which it also makes no sense to manage."
|
songdongsheng@710
|
9934 msgstr ""
|
songdongsheng@710
|
9935
|
songdongsheng@710
|
9936 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9937 #: ../en/ch07-filenames.xml:286
|
songdongsheng@710
|
9938 msgid ""
|
songdongsheng@710
|
9939 "To have Mercurial permanently ignore such files, create a file named "
|
songdongsheng@710
|
9940 "<filename>.hgignore</filename> in the root of your repository. You "
|
songdongsheng@710
|
9941 "<emphasis>should</emphasis> <command>hg add</command> this file so that it "
|
songdongsheng@710
|
9942 "gets tracked with the rest of your repository contents, since your "
|
songdongsheng@710
|
9943 "collaborators will probably find it useful too."
|
songdongsheng@710
|
9944 msgstr ""
|
songdongsheng@710
|
9945
|
songdongsheng@710
|
9946 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9947 #: ../en/ch07-filenames.xml:293
|
songdongsheng@710
|
9948 msgid ""
|
songdongsheng@710
|
9949 "By default, the <filename>.hgignore</filename> file should contain a list of "
|
songdongsheng@710
|
9950 "regular expressions, one per line. Empty lines are skipped. Most people "
|
songdongsheng@710
|
9951 "prefer to describe the files they want to ignore using the <quote>glob</"
|
songdongsheng@710
|
9952 "quote> syntax that we described above, so a typical <filename>.hgignore</"
|
songdongsheng@710
|
9953 "filename> file will start with this directive:"
|
songdongsheng@710
|
9954 msgstr ""
|
songdongsheng@710
|
9955
|
songdongsheng@710
|
9956 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9957 #: ../en/ch07-filenames.xml:302
|
songdongsheng@710
|
9958 msgid ""
|
songdongsheng@710
|
9959 "This tells Mercurial to interpret the lines that follow as glob patterns, not "
|
songdongsheng@710
|
9960 "regular expressions."
|
songdongsheng@710
|
9961 msgstr ""
|
songdongsheng@710
|
9962
|
songdongsheng@710
|
9963 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9964 #: ../en/ch07-filenames.xml:305
|
songdongsheng@710
|
9965 msgid "Here is a typical-looking <filename>.hgignore</filename> file."
|
dongsheng@627
|
9966 msgstr ""
|
dongsheng@627
|
9967
|
dongsheng@627
|
9968 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
9969 #: ../en/ch07-filenames.xml:329
|
dongsheng@627
|
9970 msgid "Case sensitivity"
|
dongsheng@630
|
9971 msgstr "大小写敏感性"
|
dongsheng@627
|
9972
|
dongsheng@627
|
9973 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9974 #: ../en/ch07-filenames.xml:331
|
dongsheng@627
|
9975 msgid ""
|
dongsheng@627
|
9976 "If you're working in a mixed development environment that contains both Linux "
|
dongsheng@627
|
9977 "(or other Unix) systems and Macs or Windows systems, you should keep in the "
|
dongsheng@627
|
9978 "back of your mind the knowledge that they treat the case (<quote>N</quote> "
|
dongsheng@627
|
9979 "versus <quote>n</quote>) of file names in incompatible ways. This is not "
|
dongsheng@627
|
9980 "very likely to affect you, and it's easy to deal with if it does, but it "
|
dongsheng@627
|
9981 "could surprise you if you don't know about it."
|
dongsheng@627
|
9982 msgstr ""
|
dongsheng@627
|
9983
|
dongsheng@627
|
9984 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
9985 #: ../en/ch07-filenames.xml:340
|
dongsheng@627
|
9986 msgid ""
|
dongsheng@627
|
9987 "Operating systems and filesystems differ in the way they handle the "
|
dongsheng@627
|
9988 "<emphasis>case</emphasis> of characters in file and directory names. There "
|
dongsheng@627
|
9989 "are three common ways to handle case in names."
|
dongsheng@627
|
9990 msgstr ""
|
dongsheng@627
|
9991
|
dongsheng@627
|
9992 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
9993 #: ../en/ch07-filenames.xml:345
|
dongsheng@627
|
9994 msgid ""
|
dongsheng@627
|
9995 "Completely case insensitive. Uppercase and lowercase versions of a letter "
|
dongsheng@627
|
9996 "are treated as identical, both when creating a file and during subsequent "
|
dongsheng@627
|
9997 "accesses. This is common on older DOS-based systems."
|
dongsheng@627
|
9998 msgstr ""
|
dongsheng@627
|
9999
|
dongsheng@627
|
10000 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
10001 #: ../en/ch07-filenames.xml:350
|
dongsheng@627
|
10002 msgid ""
|
dongsheng@627
|
10003 "Case preserving, but insensitive. When a file or directory is created, the "
|
dongsheng@627
|
10004 "case of its name is stored, and can be retrieved and displayed by the "
|
dongsheng@627
|
10005 "operating system. When an existing file is being looked up, its case is "
|
dongsheng@627
|
10006 "ignored. This is the standard arrangement on Windows and MacOS. The names "
|
dongsheng@627
|
10007 "<filename>foo</filename> and <filename>FoO</filename> identify the same "
|
dongsheng@627
|
10008 "file. This treatment of uppercase and lowercase letters as interchangeable "
|
dongsheng@627
|
10009 "is also referred to as <emphasis>case folding</emphasis>."
|
dongsheng@627
|
10010 msgstr ""
|
dongsheng@627
|
10011
|
dongsheng@627
|
10012 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
10013 #: ../en/ch07-filenames.xml:361
|
dongsheng@627
|
10014 msgid ""
|
dongsheng@627
|
10015 "Case sensitive. The case of a name is significant at all times. The names "
|
dongsheng@714
|
10016 "<filename>foo</filename> and <filename>FoO</filename> identify different "
|
dongsheng@714
|
10017 "files. This is the way Linux and Unix systems normally work."
|
dongsheng@714
|
10018 msgstr ""
|
dongsheng@714
|
10019
|
dongsheng@714
|
10020 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10021 #: ../en/ch07-filenames.xml:368
|
dongsheng@627
|
10022 msgid ""
|
dongsheng@627
|
10023 "On Unix-like systems, it is possible to have any or all of the above ways of "
|
dongsheng@627
|
10024 "handling case in action at once. For example, if you use a USB thumb drive "
|
dongsheng@627
|
10025 "formatted with a FAT32 filesystem on a Linux system, Linux will handle names "
|
dongsheng@627
|
10026 "on that filesystem in a case preserving, but insensitive, way."
|
dongsheng@627
|
10027 msgstr ""
|
dongsheng@627
|
10028
|
dongsheng@627
|
10029 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
10030 #: ../en/ch07-filenames.xml:375
|
dongsheng@627
|
10031 msgid "Safe, portable repository storage"
|
dongsheng@630
|
10032 msgstr "安全,可移植的版本库存储"
|
dongsheng@627
|
10033
|
dongsheng@627
|
10034 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10035 #: ../en/ch07-filenames.xml:377
|
dongsheng@627
|
10036 msgid ""
|
dongsheng@627
|
10037 "Mercurial's repository storage mechanism is <emphasis>case safe</emphasis>. "
|
dongsheng@627
|
10038 "It translates file names so that they can be safely stored on both case "
|
dongsheng@627
|
10039 "sensitive and case insensitive filesystems. This means that you can use "
|
dongsheng@627
|
10040 "normal file copying tools to transfer a Mercurial repository onto, for "
|
dongsheng@627
|
10041 "example, a USB thumb drive, and safely move that drive and repository back "
|
dongsheng@627
|
10042 "and forth between a Mac, a PC running Windows, and a Linux box."
|
dongsheng@627
|
10043 msgstr ""
|
dongsheng@627
|
10044
|
dongsheng@627
|
10045 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
10046 #: ../en/ch07-filenames.xml:388
|
dongsheng@627
|
10047 msgid "Detecting case conflicts"
|
dongsheng@630
|
10048 msgstr "检测大小写冲突"
|
dongsheng@627
|
10049
|
dongsheng@627
|
10050 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10051 #: ../en/ch07-filenames.xml:390
|
dongsheng@627
|
10052 msgid ""
|
dongsheng@627
|
10053 "When operating in the working directory, Mercurial honours the naming policy "
|
dongsheng@627
|
10054 "of the filesystem where the working directory is located. If the filesystem "
|
dongsheng@627
|
10055 "is case preserving, but insensitive, Mercurial will treat names that differ "
|
dongsheng@627
|
10056 "only in case as the same."
|
dongsheng@627
|
10057 msgstr ""
|
dongsheng@627
|
10058
|
dongsheng@627
|
10059 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10060 #: ../en/ch07-filenames.xml:396
|
dongsheng@627
|
10061 msgid ""
|
dongsheng@627
|
10062 "An important aspect of this approach is that it is possible to commit a "
|
dongsheng@627
|
10063 "changeset on a case sensitive (typically Linux or Unix) filesystem that will "
|
dongsheng@627
|
10064 "cause trouble for users on case insensitive (usually Windows and MacOS) "
|
dongsheng@627
|
10065 "users. If a Linux user commits changes to two files, one named "
|
dongsheng@627
|
10066 "<filename>myfile.c</filename> and the other named <filename>MyFile.C</"
|
dongsheng@627
|
10067 "filename>, they will be stored correctly in the repository. And in the "
|
dongsheng@627
|
10068 "working directories of other Linux users, they will be correctly represented "
|
dongsheng@627
|
10069 "as separate files."
|
dongsheng@627
|
10070 msgstr ""
|
dongsheng@627
|
10071
|
dongsheng@627
|
10072 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10073 #: ../en/ch07-filenames.xml:407
|
dongsheng@627
|
10074 msgid ""
|
dongsheng@627
|
10075 "If a Windows or Mac user pulls this change, they will not initially have a "
|
dongsheng@627
|
10076 "problem, because Mercurial's repository storage mechanism is case safe. "
|
dongsheng@627
|
10077 "However, once they try to <command role=\"hg-cmd\">hg update</command> the "
|
dongsheng@627
|
10078 "working directory to that changeset, or <command role=\"hg-cmd\">hg merge</"
|
dongsheng@627
|
10079 "command> with that changeset, Mercurial will spot the conflict between the "
|
dongsheng@627
|
10080 "two file names that the filesystem would treat as the same, and forbid the "
|
dongsheng@627
|
10081 "update or merge from occurring."
|
dongsheng@627
|
10082 msgstr ""
|
dongsheng@627
|
10083
|
dongsheng@627
|
10084 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
10085 #: ../en/ch07-filenames.xml:419
|
dongsheng@627
|
10086 msgid "Fixing a case conflict"
|
dongsheng@630
|
10087 msgstr "修正大小写冲突"
|
dongsheng@627
|
10088
|
dongsheng@627
|
10089 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10090 #: ../en/ch07-filenames.xml:421
|
dongsheng@627
|
10091 msgid ""
|
dongsheng@627
|
10092 "If you are using Windows or a Mac in a mixed environment where some of your "
|
dongsheng@627
|
10093 "collaborators are using Linux or Unix, and Mercurial reports a case folding "
|
dongsheng@627
|
10094 "conflict when you try to <command role=\"hg-cmd\">hg update</command> or "
|
dongsheng@627
|
10095 "<command role=\"hg-cmd\">hg merge</command>, the procedure to fix the problem "
|
dongsheng@627
|
10096 "is simple."
|
dongsheng@627
|
10097 msgstr ""
|
dongsheng@627
|
10098
|
dongsheng@627
|
10099 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10100 #: ../en/ch07-filenames.xml:428
|
dongsheng@627
|
10101 msgid ""
|
dongsheng@627
|
10102 "Just find a nearby Linux or Unix box, clone the problem repository onto it, "
|
dongsheng@627
|
10103 "and use Mercurial's <command role=\"hg-cmd\">hg rename</command> command to "
|
dongsheng@627
|
10104 "change the names of any offending files or directories so that they will no "
|
dongsheng@627
|
10105 "longer cause case folding conflicts. Commit this change, <command role=\"hg-"
|
dongsheng@627
|
10106 "cmd\">hg pull</command> or <command role=\"hg-cmd\">hg push</command> it "
|
dongsheng@627
|
10107 "across to your Windows or MacOS system, and <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
10108 "update</command> to the revision with the non-conflicting names."
|
dongsheng@627
|
10109 msgstr ""
|
dongsheng@627
|
10110
|
dongsheng@627
|
10111 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10112 #: ../en/ch07-filenames.xml:438
|
dongsheng@627
|
10113 msgid ""
|
dongsheng@627
|
10114 "The changeset with case-conflicting names will remain in your project's "
|
dongsheng@627
|
10115 "history, and you still won't be able to <command role=\"hg-cmd\">hg update</"
|
dongsheng@627
|
10116 "command> your working directory to that changeset on a Windows or MacOS "
|
dongsheng@627
|
10117 "system, but you can continue development unimpeded."
|
dongsheng@627
|
10118 msgstr ""
|
dongsheng@627
|
10119
|
dongsheng@627
|
10120 #. type: Content of: <book><chapter><title>
|
dongsheng@714
|
10121 #: ../en/ch08-branch.xml:5
|
dongsheng@627
|
10122 msgid "Managing releases and branchy development"
|
dongsheng@627
|
10123 msgstr "发布管理与分支开发"
|
dongsheng@627
|
10124
|
dongsheng@627
|
10125 #. type: Content of: <book><chapter><para>
|
dongsheng@714
|
10126 #: ../en/ch08-branch.xml:7
|
dongsheng@627
|
10127 msgid ""
|
dongsheng@627
|
10128 "Mercurial provides several mechanisms for you to manage a project that is "
|
dongsheng@627
|
10129 "making progress on multiple fronts at once. To understand these mechanisms, "
|
dongsheng@627
|
10130 "let's first take a brief look at a fairly normal software project structure."
|
dongsheng@627
|
10131 msgstr ""
|
dongsheng@627
|
10132
|
dongsheng@627
|
10133 #. type: Content of: <book><chapter><para>
|
dongsheng@714
|
10134 #: ../en/ch08-branch.xml:12
|
dongsheng@627
|
10135 msgid ""
|
dongsheng@627
|
10136 "Many software projects issue periodic <quote>major</quote> releases that "
|
dongsheng@627
|
10137 "contain substantial new features. In parallel, they may issue <quote>minor</"
|
dongsheng@627
|
10138 "quote> releases. These are usually identical to the major releases off which "
|
dongsheng@627
|
10139 "they're based, but with a few bugs fixed."
|
dongsheng@627
|
10140 msgstr ""
|
dongsheng@627
|
10141
|
dongsheng@627
|
10142 #. type: Content of: <book><chapter><para>
|
dongsheng@714
|
10143 #: ../en/ch08-branch.xml:18
|
dongsheng@627
|
10144 msgid ""
|
dongsheng@627
|
10145 "In this chapter, we'll start by talking about how to keep records of project "
|
dongsheng@627
|
10146 "milestones such as releases. We'll then continue on to talk about the flow "
|
dongsheng@627
|
10147 "of work between different phases of a project, and how Mercurial can help you "
|
dongsheng@627
|
10148 "to isolate and manage this work."
|
dongsheng@627
|
10149 msgstr ""
|
dongsheng@627
|
10150
|
dongsheng@627
|
10151 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
10152 #: ../en/ch08-branch.xml:25
|
dongsheng@627
|
10153 msgid "Giving a persistent name to a revision"
|
dongsheng@635
|
10154 msgstr "给版本指定一个永久的名称"
|
dongsheng@627
|
10155
|
dongsheng@627
|
10156 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10157 #: ../en/ch08-branch.xml:27
|
dongsheng@627
|
10158 msgid ""
|
dongsheng@627
|
10159 "Once you decide that you'd like to call a particular revision a "
|
dongsheng@627
|
10160 "<quote>release</quote>, it's a good idea to record the identity of that "
|
dongsheng@627
|
10161 "revision. This will let you reproduce that release at a later date, for "
|
dongsheng@627
|
10162 "whatever purpose you might need at the time (reproducing a bug, porting to a "
|
dongsheng@627
|
10163 "new platform, etc). &interaction.tag.init;"
|
dongsheng@627
|
10164 msgstr ""
|
dongsheng@627
|
10165
|
dongsheng@627
|
10166 #
|
dongsheng@627
|
10167 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10168 #: ../en/ch08-branch.xml:34
|
dongsheng@627
|
10169 msgid ""
|
dongsheng@627
|
10170 "Mercurial lets you give a permanent name to any revision using the <command "
|
dongsheng@627
|
10171 "role=\"hg-cmd\">hg tag</command> command. Not surprisingly, these names are "
|
dongsheng@627
|
10172 "called <quote>tags</quote>."
|
dongsheng@627
|
10173 msgstr ""
|
dongsheng@627
|
10174
|
dongsheng@627
|
10175 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10176 #: ../en/ch08-branch.xml:40
|
dongsheng@627
|
10177 msgid ""
|
dongsheng@627
|
10178 "A tag is nothing more than a <quote>symbolic name</quote> for a revision. "
|
dongsheng@627
|
10179 "Tags exist purely for your convenience, so that you have a handy permanent "
|
dongsheng@627
|
10180 "way to refer to a revision; Mercurial doesn't interpret the tag names you use "
|
dongsheng@627
|
10181 "in any way. Neither does Mercurial place any restrictions on the name of a "
|
dongsheng@627
|
10182 "tag, beyond a few that are necessary to ensure that a tag can be parsed "
|
dongsheng@627
|
10183 "unambiguously. A tag name cannot contain any of the following characters:"
|
dongsheng@627
|
10184 msgstr ""
|
dongsheng@627
|
10185
|
dongsheng@627
|
10186 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
10187 #: ../en/ch08-branch.xml:49
|
dongsheng@627
|
10188 msgid "Colon (ASCII 58, <quote><literal>:</literal></quote>)"
|
dongsheng@627
|
10189 msgstr ""
|
dongsheng@627
|
10190
|
dongsheng@627
|
10191 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
10192 #: ../en/ch08-branch.xml:52
|
dongsheng@627
|
10193 msgid "Carriage return (ASCII 13, <quote><literal>\\r</literal></quote>)"
|
dongsheng@627
|
10194 msgstr ""
|
dongsheng@627
|
10195
|
dongsheng@627
|
10196 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
10197 #: ../en/ch08-branch.xml:55
|
dongsheng@627
|
10198 msgid "Newline (ASCII 10, <quote><literal>\\n</literal></quote>)"
|
dongsheng@627
|
10199 msgstr ""
|
dongsheng@627
|
10200
|
dongsheng@627
|
10201 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10202 #: ../en/ch08-branch.xml:59
|
dongsheng@627
|
10203 msgid ""
|
dongsheng@627
|
10204 "You can use the <command role=\"hg-cmd\">hg tags</command> command to display "
|
dongsheng@627
|
10205 "the tags present in your repository. In the output, each tagged revision is "
|
dongsheng@627
|
10206 "identified first by its name, then by revision number, and finally by the "
|
dongsheng@627
|
10207 "unique hash of the revision."
|
dongsheng@627
|
10208 msgstr ""
|
dongsheng@627
|
10209
|
dongsheng@627
|
10210 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10211 #: ../en/ch08-branch.xml:67
|
dongsheng@627
|
10212 msgid ""
|
dongsheng@627
|
10213 "Notice that <literal>tip</literal> is listed in the output of <command role="
|
dongsheng@627
|
10214 "\"hg-cmd\">hg tags</command>. The <literal>tip</literal> tag is a special "
|
dongsheng@627
|
10215 "<quote>floating</quote> tag, which always identifies the newest revision in "
|
dongsheng@627
|
10216 "the repository."
|
dongsheng@627
|
10217 msgstr ""
|
dongsheng@627
|
10218
|
dongsheng@627
|
10219 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10220 #: ../en/ch08-branch.xml:73
|
dongsheng@627
|
10221 msgid ""
|
dongsheng@627
|
10222 "In the output of the <command role=\"hg-cmd\">hg tags</command> command, tags "
|
dongsheng@627
|
10223 "are listed in reverse order, by revision number. This usually means that "
|
dongsheng@627
|
10224 "recent tags are listed before older tags. It also means that <literal>tip</"
|
dongsheng@627
|
10225 "literal> is always going to be the first tag listed in the output of <command "
|
dongsheng@627
|
10226 "role=\"hg-cmd\">hg tags</command>."
|
dongsheng@627
|
10227 msgstr ""
|
dongsheng@627
|
10228
|
dongsheng@627
|
10229 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10230 #: ../en/ch08-branch.xml:80
|
dongsheng@627
|
10231 msgid ""
|
dongsheng@627
|
10232 "When you run <command role=\"hg-cmd\">hg log</command>, if it displays a "
|
dongsheng@627
|
10233 "revision that has tags associated with it, it will print those tags."
|
dongsheng@627
|
10234 msgstr ""
|
dongsheng@627
|
10235
|
dongsheng@627
|
10236 #
|
dongsheng@627
|
10237 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10238 #: ../en/ch08-branch.xml:86
|
dongsheng@627
|
10239 msgid ""
|
dongsheng@627
|
10240 "Any time you need to provide a revision ID to a Mercurial command, the "
|
dongsheng@627
|
10241 "command will accept a tag name in its place. Internally, Mercurial will "
|
dongsheng@627
|
10242 "translate your tag name into the corresponding revision ID, then use that."
|
dongsheng@627
|
10243 msgstr ""
|
dongsheng@627
|
10244
|
dongsheng@627
|
10245 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10246 #: ../en/ch08-branch.xml:93
|
dongsheng@627
|
10247 msgid ""
|
dongsheng@627
|
10248 "There's no limit on the number of tags you can have in a repository, or on "
|
dongsheng@627
|
10249 "the number of tags that a single revision can have. As a practical matter, "
|
dongsheng@627
|
10250 "it's not a great idea to have <quote>too many</quote> (a number which will "
|
dongsheng@627
|
10251 "vary from project to project), simply because tags are supposed to help you "
|
dongsheng@627
|
10252 "to find revisions. If you have lots of tags, the ease of using them to "
|
dongsheng@627
|
10253 "identify revisions diminishes rapidly."
|
dongsheng@627
|
10254 msgstr ""
|
dongsheng@627
|
10255
|
dongsheng@627
|
10256 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10257 #: ../en/ch08-branch.xml:101
|
dongsheng@627
|
10258 msgid ""
|
dongsheng@627
|
10259 "For example, if your project has milestones as frequent as every few days, "
|
dongsheng@627
|
10260 "it's perfectly reasonable to tag each one of those. But if you have a "
|
dongsheng@627
|
10261 "continuous build system that makes sure every revision can be built cleanly, "
|
dongsheng@627
|
10262 "you'd be introducing a lot of noise if you were to tag every clean build. "
|
dongsheng@627
|
10263 "Instead, you could tag failed builds (on the assumption that they're rare!), "
|
dongsheng@627
|
10264 "or simply not use tags to track buildability."
|
dongsheng@627
|
10265 msgstr ""
|
dongsheng@627
|
10266
|
dongsheng@627
|
10267 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10268 #: ../en/ch08-branch.xml:109
|
dongsheng@627
|
10269 msgid ""
|
dongsheng@627
|
10270 "If you want to remove a tag that you no longer want, use <command role=\"hg-"
|
dongsheng@627
|
10271 "cmd\">hg tag --remove</command>."
|
dongsheng@627
|
10272 msgstr ""
|
dongsheng@627
|
10273
|
dongsheng@627
|
10274 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10275 #: ../en/ch08-branch.xml:114
|
dongsheng@627
|
10276 msgid ""
|
dongsheng@627
|
10277 "You can also modify a tag at any time, so that it identifies a different "
|
dongsheng@627
|
10278 "revision, by simply issuing a new <command role=\"hg-cmd\">hg tag</command> "
|
dongsheng@627
|
10279 "command. You'll have to use the <option role=\"hg-opt-tag\">-f</option> "
|
dongsheng@627
|
10280 "option to tell Mercurial that you <emphasis>really</emphasis> want to update "
|
dongsheng@627
|
10281 "the tag."
|
dongsheng@627
|
10282 msgstr ""
|
dongsheng@627
|
10283
|
dongsheng@627
|
10284 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10285 #: ../en/ch08-branch.xml:123
|
dongsheng@627
|
10286 msgid ""
|
dongsheng@627
|
10287 "There will still be a permanent record of the previous identity of the tag, "
|
dongsheng@627
|
10288 "but Mercurial will no longer use it. There's thus no penalty to tagging the "
|
dongsheng@627
|
10289 "wrong revision; all you have to do is turn around and tag the correct "
|
dongsheng@627
|
10290 "revision once you discover your error."
|
dongsheng@627
|
10291 msgstr ""
|
dongsheng@627
|
10292
|
dongsheng@627
|
10293 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10294 #: ../en/ch08-branch.xml:129
|
dongsheng@627
|
10295 msgid ""
|
dongsheng@627
|
10296 "Mercurial stores tags in a normal revision-controlled file in your "
|
songdongsheng@710
|
10297 "repository. If you've created any tags, you'll find them in a file in the "
|
songdongsheng@710
|
10298 "root of your repository named <filename role=\"special\">.hgtags</filename>. "
|
songdongsheng@710
|
10299 "When you run the <command role=\"hg-cmd\">hg tag</command> command, Mercurial "
|
songdongsheng@710
|
10300 "modifies this file, then automatically commits the change to it. This means "
|
songdongsheng@710
|
10301 "that every time you run <command role=\"hg-cmd\">hg tag</command>, you'll see "
|
songdongsheng@710
|
10302 "a corresponding changeset in the output of <command role=\"hg-cmd\">hg log</"
|
songdongsheng@710
|
10303 "command>."
|
dongsheng@627
|
10304 msgstr ""
|
dongsheng@627
|
10305
|
dongsheng@627
|
10306 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
10307 #: ../en/ch08-branch.xml:142
|
dongsheng@627
|
10308 msgid "Handling tag conflicts during a merge"
|
dongsheng@635
|
10309 msgstr "在合并期间处理标签冲突"
|
dongsheng@627
|
10310
|
dongsheng@627
|
10311 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10312 #: ../en/ch08-branch.xml:144
|
dongsheng@627
|
10313 msgid ""
|
dongsheng@627
|
10314 "You won't often need to care about the <filename role=\"special\">.hgtags</"
|
dongsheng@627
|
10315 "filename> file, but it sometimes makes its presence known during a merge. "
|
dongsheng@627
|
10316 "The format of the file is simple: it consists of a series of lines. Each "
|
dongsheng@627
|
10317 "line starts with a changeset hash, followed by a space, followed by the name "
|
dongsheng@627
|
10318 "of a tag."
|
dongsheng@627
|
10319 msgstr ""
|
dongsheng@627
|
10320
|
dongsheng@627
|
10321 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10322 #: ../en/ch08-branch.xml:151
|
dongsheng@627
|
10323 msgid ""
|
dongsheng@627
|
10324 "If you're resolving a conflict in the <filename role=\"special\">.hgtags</"
|
dongsheng@627
|
10325 "filename> file during a merge, there's one twist to modifying the <filename "
|
dongsheng@627
|
10326 "role=\"special\">.hgtags</filename> file: when Mercurial is parsing the tags "
|
dongsheng@627
|
10327 "in a repository, it <emphasis>never</emphasis> reads the working copy of the "
|
dongsheng@627
|
10328 "<filename role=\"special\">.hgtags</filename> file. Instead, it reads the "
|
dongsheng@627
|
10329 "<emphasis>most recently committed</emphasis> revision of the file."
|
dongsheng@627
|
10330 msgstr ""
|
dongsheng@627
|
10331
|
dongsheng@627
|
10332 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10333 #: ../en/ch08-branch.xml:161
|
dongsheng@627
|
10334 msgid ""
|
dongsheng@627
|
10335 "An unfortunate consequence of this design is that you can't actually verify "
|
dongsheng@627
|
10336 "that your merged <filename role=\"special\">.hgtags</filename> file is "
|
dongsheng@627
|
10337 "correct until <emphasis>after</emphasis> you've committed a change. So if "
|
dongsheng@627
|
10338 "you find yourself resolving a conflict on <filename role=\"special\">.hgtags</"
|
dongsheng@627
|
10339 "filename> during a merge, be sure to run <command role=\"hg-cmd\">hg tags</"
|
dongsheng@627
|
10340 "command> after you commit. If it finds an error in the <filename role="
|
dongsheng@627
|
10341 "\"special\">.hgtags</filename> file, it will report the location of the "
|
dongsheng@627
|
10342 "error, which you can then fix and commit. You should then run <command role="
|
dongsheng@627
|
10343 "\"hg-cmd\">hg tags</command> again, just to be sure that your fix is correct."
|
dongsheng@627
|
10344 msgstr ""
|
dongsheng@627
|
10345
|
dongsheng@627
|
10346 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
10347 #: ../en/ch08-branch.xml:176
|
dongsheng@627
|
10348 msgid "Tags and cloning"
|
dongsheng@635
|
10349 msgstr "标签与克隆"
|
dongsheng@627
|
10350
|
dongsheng@627
|
10351 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10352 #: ../en/ch08-branch.xml:178
|
dongsheng@627
|
10353 msgid ""
|
dongsheng@627
|
10354 "You may have noticed that the <command role=\"hg-cmd\">hg clone</command> "
|
dongsheng@627
|
10355 "command has a <option role=\"hg-opt-clone\">-r</option> option that lets you "
|
dongsheng@627
|
10356 "clone an exact copy of the repository as of a particular changeset. The new "
|
dongsheng@627
|
10357 "clone will not contain any project history that comes after the revision you "
|
dongsheng@627
|
10358 "specified. This has an interaction with tags that can surprise the unwary."
|
dongsheng@627
|
10359 msgstr ""
|
dongsheng@627
|
10360
|
dongsheng@627
|
10361 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10362 #: ../en/ch08-branch.xml:186
|
dongsheng@627
|
10363 msgid ""
|
dongsheng@627
|
10364 "Recall that a tag is stored as a revision to the <filename role=\"special\">."
|
dongsheng@714
|
10365 "hgtags</filename> file. When you create a tag, the changeset in which its "
|
dongsheng@714
|
10366 "recorded refers to an older changeset. When you run <command role=\"hg-cmd"
|
dongsheng@714
|
10367 "\">hg clone -r foo</command> to clone a repository as of tag <literal>foo</"
|
dongsheng@714
|
10368 "literal>, the new clone <emphasis>will not contain any revision newer than "
|
dongsheng@714
|
10369 "the one the tag refers to, including the revision where the tag was created</"
|
dongsheng@714
|
10370 "emphasis>. The result is that you'll get exactly the right subset of the "
|
dongsheng@627
|
10371 "project's history in the new repository, but <emphasis>not</emphasis> the tag "
|
dongsheng@627
|
10372 "you might have expected."
|
dongsheng@627
|
10373 msgstr ""
|
dongsheng@627
|
10374
|
dongsheng@627
|
10375 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
10376 #: ../en/ch08-branch.xml:201
|
dongsheng@627
|
10377 msgid "When permanent tags are too much"
|
dongsheng@635
|
10378 msgstr "当永久标签太多的时候"
|
dongsheng@627
|
10379
|
dongsheng@627
|
10380 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10381 #: ../en/ch08-branch.xml:203
|
dongsheng@627
|
10382 msgid ""
|
dongsheng@627
|
10383 "Since Mercurial's tags are revision controlled and carried around with a "
|
dongsheng@627
|
10384 "project's history, everyone you work with will see the tags you create. But "
|
dongsheng@627
|
10385 "giving names to revisions has uses beyond simply noting that revision "
|
dongsheng@627
|
10386 "<literal>4237e45506ee</literal> is really <literal>v2.0.2</literal>. If "
|
dongsheng@627
|
10387 "you're trying to track down a subtle bug, you might want a tag to remind you "
|
dongsheng@627
|
10388 "of something like <quote>Anne saw the symptoms with this revision</quote>."
|
dongsheng@627
|
10389 msgstr ""
|
dongsheng@627
|
10390
|
dongsheng@627
|
10391 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10392 #: ../en/ch08-branch.xml:213
|
dongsheng@627
|
10393 msgid ""
|
dongsheng@627
|
10394 "For cases like this, what you might want to use are <emphasis>local</"
|
dongsheng@627
|
10395 "emphasis> tags. You can create a local tag with the <option role=\"hg-opt-tag"
|
dongsheng@627
|
10396 "\">-l</option> option to the <command role=\"hg-cmd\">hg tag</command> "
|
dongsheng@627
|
10397 "command. This will store the tag in a file called <filename role=\"special"
|
dongsheng@627
|
10398 "\">.hg/localtags</filename>. Unlike <filename role=\"special\">.hgtags</"
|
dongsheng@627
|
10399 "filename>, <filename role=\"special\">.hg/localtags</filename> is not "
|
dongsheng@627
|
10400 "revision controlled. Any tags you create using <option role=\"hg-opt-tag\">-"
|
dongsheng@627
|
10401 "l</option> remain strictly local to the repository you're currently working "
|
dongsheng@627
|
10402 "in."
|
dongsheng@627
|
10403 msgstr ""
|
dongsheng@627
|
10404
|
dongsheng@627
|
10405 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
10406 #: ../en/ch08-branch.xml:228
|
songdongsheng@668
|
10407 msgid "The flow of changes&emdash;big picture vs. little"
|
dongsheng@661
|
10408 msgstr "修改流程—宏观与微观"
|
dongsheng@627
|
10409
|
dongsheng@627
|
10410 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10411 #: ../en/ch08-branch.xml:230
|
dongsheng@714
|
10412 msgid ""
|
dongsheng@714
|
10413 "To return to the outline I sketched at the beginning of the chapter, let's "
|
dongsheng@627
|
10414 "think about a project that has multiple concurrent pieces of work under "
|
dongsheng@627
|
10415 "development at once."
|
dongsheng@627
|
10416 msgstr ""
|
dongsheng@627
|
10417
|
dongsheng@627
|
10418 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10419 #: ../en/ch08-branch.xml:235
|
dongsheng@627
|
10420 msgid ""
|
dongsheng@627
|
10421 "There might be a push for a new <quote>main</quote> release; a new minor "
|
dongsheng@627
|
10422 "bugfix release to the last main release; and an unexpected <quote>hot fix</"
|
dongsheng@627
|
10423 "quote> to an old release that is now in maintenance mode."
|
dongsheng@627
|
10424 msgstr ""
|
dongsheng@627
|
10425
|
dongsheng@627
|
10426 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10427 #: ../en/ch08-branch.xml:240
|
dongsheng@627
|
10428 msgid ""
|
dongsheng@627
|
10429 "The usual way people refer to these different concurrent directions of "
|
dongsheng@627
|
10430 "development is as <quote>branches</quote>. However, we've already seen "
|
dongsheng@627
|
10431 "numerous times that Mercurial treats <emphasis>all of history</emphasis> as a "
|
dongsheng@627
|
10432 "series of branches and merges. Really, what we have here is two ideas that "
|
dongsheng@627
|
10433 "are peripherally related, but which happen to share a name."
|
dongsheng@627
|
10434 msgstr ""
|
dongsheng@627
|
10435
|
dongsheng@627
|
10436 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
10437 #: ../en/ch08-branch.xml:247
|
dongsheng@627
|
10438 msgid ""
|
dongsheng@627
|
10439 "<quote>Big picture</quote> branches represent the sweep of a project's "
|
dongsheng@627
|
10440 "evolution; people give them names, and talk about them in conversation."
|
dongsheng@627
|
10441 msgstr ""
|
dongsheng@627
|
10442
|
dongsheng@627
|
10443 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
10444 #: ../en/ch08-branch.xml:251
|
dongsheng@627
|
10445 msgid ""
|
dongsheng@627
|
10446 "<quote>Little picture</quote> branches are artefacts of the day-to-day "
|
dongsheng@627
|
10447 "activity of developing and merging changes. They expose the narrative of how "
|
dongsheng@627
|
10448 "the code was developed."
|
dongsheng@627
|
10449 msgstr ""
|
dongsheng@627
|
10450
|
dongsheng@627
|
10451 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
10452 #: ../en/ch08-branch.xml:259
|
dongsheng@627
|
10453 msgid "Managing big-picture branches in repositories"
|
dongsheng@635
|
10454 msgstr "在版本库中管理分支"
|
dongsheng@627
|
10455
|
dongsheng@627
|
10456 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10457 #: ../en/ch08-branch.xml:261
|
dongsheng@627
|
10458 msgid ""
|
dongsheng@627
|
10459 "The easiest way to isolate a <quote>big picture</quote> branch in Mercurial "
|
songdongsheng@668
|
10460 "is in a dedicated repository. If you have an existing shared "
|
songdongsheng@668
|
10461 "repository&emdash;let's call it <literal>myproject</literal>&emdash;that "
|
songdongsheng@668
|
10462 "reaches a <quote>1.0</quote> milestone, you can start to prepare for future "
|
songdongsheng@668
|
10463 "maintenance releases on top of version 1.0 by tagging the revision from which "
|
songdongsheng@668
|
10464 "you prepared the 1.0 release."
|
dongsheng@627
|
10465 msgstr ""
|
dongsheng@627
|
10466
|
dongsheng@627
|
10467 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10468 #: ../en/ch08-branch.xml:271
|
dongsheng@627
|
10469 msgid ""
|
dongsheng@627
|
10470 "You can then clone a new shared <literal>myproject-1.0.1</literal> repository "
|
dongsheng@627
|
10471 "as of that tag."
|
dongsheng@627
|
10472 msgstr ""
|
dongsheng@627
|
10473
|
dongsheng@627
|
10474 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10475 #: ../en/ch08-branch.xml:277
|
dongsheng@627
|
10476 msgid ""
|
dongsheng@627
|
10477 "Afterwards, if someone needs to work on a bug fix that ought to go into an "
|
dongsheng@627
|
10478 "upcoming 1.0.1 minor release, they clone the <literal>myproject-1.0.1</"
|
dongsheng@627
|
10479 "literal> repository, make their changes, and push them back."
|
dongsheng@627
|
10480 msgstr ""
|
dongsheng@627
|
10481
|
dongsheng@627
|
10482 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10483 #: ../en/ch08-branch.xml:284
|
dongsheng@627
|
10484 msgid ""
|
dongsheng@627
|
10485 "Meanwhile, development for the next major release can continue, isolated and "
|
dongsheng@627
|
10486 "unabated, in the <literal>myproject</literal> repository."
|
dongsheng@627
|
10487 msgstr ""
|
dongsheng@627
|
10488
|
dongsheng@627
|
10489 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
10490 #: ../en/ch08-branch.xml:292
|
dongsheng@627
|
10491 msgid "Don't repeat yourself: merging across branches"
|
dongsheng@635
|
10492 msgstr "不要重复劳动:在分支间合并"
|
dongsheng@627
|
10493
|
dongsheng@627
|
10494 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10495 #: ../en/ch08-branch.xml:294
|
dongsheng@627
|
10496 msgid ""
|
dongsheng@627
|
10497 "In many cases, if you have a bug to fix on a maintenance branch, the chances "
|
dongsheng@627
|
10498 "are good that the bug exists on your project's main branch (and possibly "
|
dongsheng@627
|
10499 "other maintenance branches, too). It's a rare developer who wants to fix the "
|
dongsheng@627
|
10500 "same bug multiple times, so let's look at a few ways that Mercurial can help "
|
dongsheng@627
|
10501 "you to manage these bugfixes without duplicating your work."
|
dongsheng@627
|
10502 msgstr ""
|
dongsheng@627
|
10503
|
dongsheng@627
|
10504 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10505 #: ../en/ch08-branch.xml:302
|
dongsheng@627
|
10506 msgid ""
|
dongsheng@627
|
10507 "In the simplest instance, all you need to do is pull changes from your "
|
dongsheng@627
|
10508 "maintenance branch into your local clone of the target branch."
|
dongsheng@627
|
10509 msgstr ""
|
dongsheng@627
|
10510
|
dongsheng@627
|
10511 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10512 #: ../en/ch08-branch.xml:308
|
dongsheng@627
|
10513 msgid ""
|
dongsheng@627
|
10514 "You'll then need to merge the heads of the two branches, and push back to the "
|
dongsheng@627
|
10515 "main branch."
|
dongsheng@627
|
10516 msgstr ""
|
dongsheng@627
|
10517
|
dongsheng@627
|
10518 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
10519 #: ../en/ch08-branch.xml:315
|
dongsheng@627
|
10520 msgid "Naming branches within one repository"
|
dongsheng@635
|
10521 msgstr "版本库中的命名分支"
|
dongsheng@627
|
10522
|
dongsheng@627
|
10523 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10524 #: ../en/ch08-branch.xml:317
|
dongsheng@627
|
10525 msgid ""
|
dongsheng@627
|
10526 "In most instances, isolating branches in repositories is the right approach. "
|
dongsheng@627
|
10527 "Its simplicity makes it easy to understand; and so it's hard to make "
|
dongsheng@627
|
10528 "mistakes. There's a one-to-one relationship between branches you're working "
|
dongsheng@627
|
10529 "in and directories on your system. This lets you use normal (non-Mercurial-"
|
dongsheng@627
|
10530 "aware) tools to work on files within a branch/repository."
|
dongsheng@627
|
10531 msgstr ""
|
dongsheng@627
|
10532
|
dongsheng@627
|
10533 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10534 #: ../en/ch08-branch.xml:324
|
dongsheng@627
|
10535 msgid ""
|
dongsheng@627
|
10536 "If you're more in the <quote>power user</quote> category (<emphasis>and</"
|
dongsheng@627
|
10537 "emphasis> your collaborators are too), there is an alternative way of "
|
dongsheng@627
|
10538 "handling branches that you can consider. I've already mentioned the human-"
|
dongsheng@627
|
10539 "level distinction between <quote>small picture</quote> and <quote>big "
|
dongsheng@627
|
10540 "picture</quote> branches. While Mercurial works with multiple <quote>small "
|
dongsheng@627
|
10541 "picture</quote> branches in a repository all the time (for example after you "
|
dongsheng@627
|
10542 "pull changes in, but before you merge them), it can <emphasis>also</emphasis> "
|
dongsheng@627
|
10543 "work with multiple <quote>big picture</quote> branches."
|
dongsheng@627
|
10544 msgstr ""
|
dongsheng@627
|
10545
|
dongsheng@627
|
10546 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10547 #: ../en/ch08-branch.xml:335
|
dongsheng@627
|
10548 msgid ""
|
dongsheng@627
|
10549 "The key to working this way is that Mercurial lets you assign a persistent "
|
dongsheng@627
|
10550 "<emphasis>name</emphasis> to a branch. There always exists a branch named "
|
dongsheng@627
|
10551 "<literal>default</literal>. Even before you start naming branches yourself, "
|
dongsheng@627
|
10552 "you can find traces of the <literal>default</literal> branch if you look for "
|
dongsheng@627
|
10553 "them."
|
dongsheng@627
|
10554 msgstr ""
|
dongsheng@627
|
10555
|
dongsheng@627
|
10556 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10557 #: ../en/ch08-branch.xml:342
|
dongsheng@627
|
10558 msgid ""
|
dongsheng@627
|
10559 "As an example, when you run the <command role=\"hg-cmd\">hg commit</command> "
|
dongsheng@627
|
10560 "command, and it pops up your editor so that you can enter a commit message, "
|
dongsheng@627
|
10561 "look for a line that contains the text <quote><literal>HG: branch default</"
|
dongsheng@627
|
10562 "literal></quote> at the bottom. This is telling you that your commit will "
|
dongsheng@627
|
10563 "occur on the branch named <literal>default</literal>."
|
dongsheng@627
|
10564 msgstr ""
|
dongsheng@627
|
10565
|
dongsheng@627
|
10566 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10567 #: ../en/ch08-branch.xml:349
|
dongsheng@627
|
10568 msgid ""
|
dongsheng@627
|
10569 "To start working with named branches, use the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
10570 "branches</command> command. This command lists the named branches already "
|
dongsheng@627
|
10571 "present in your repository, telling you which changeset is the tip of each."
|
dongsheng@627
|
10572 msgstr ""
|
dongsheng@627
|
10573
|
dongsheng@627
|
10574 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10575 #: ../en/ch08-branch.xml:356
|
dongsheng@627
|
10576 msgid ""
|
dongsheng@627
|
10577 "Since you haven't created any named branches yet, the only one that exists is "
|
dongsheng@627
|
10578 "<literal>default</literal>."
|
dongsheng@627
|
10579 msgstr ""
|
dongsheng@627
|
10580
|
dongsheng@627
|
10581 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10582 #: ../en/ch08-branch.xml:359
|
dongsheng@627
|
10583 msgid ""
|
dongsheng@627
|
10584 "To find out what the <quote>current</quote> branch is, run the <command role="
|
dongsheng@627
|
10585 "\"hg-cmd\">hg branch</command> command, giving it no arguments. This tells "
|
dongsheng@627
|
10586 "you what branch the parent of the current changeset is on."
|
dongsheng@627
|
10587 msgstr ""
|
dongsheng@627
|
10588
|
dongsheng@627
|
10589 #
|
dongsheng@627
|
10590 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10591 #: ../en/ch08-branch.xml:366
|
dongsheng@627
|
10592 msgid ""
|
dongsheng@627
|
10593 "To create a new branch, run the <command role=\"hg-cmd\">hg branch</command> "
|
dongsheng@627
|
10594 "command again. This time, give it one argument: the name of the branch you "
|
dongsheng@627
|
10595 "want to create."
|
dongsheng@627
|
10596 msgstr ""
|
dongsheng@627
|
10597
|
dongsheng@627
|
10598 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10599 #: ../en/ch08-branch.xml:372
|
dongsheng@627
|
10600 msgid ""
|
dongsheng@627
|
10601 "After you've created a branch, you might wonder what effect the <command role="
|
dongsheng@627
|
10602 "\"hg-cmd\">hg branch</command> command has had. What do the <command role="
|
dongsheng@627
|
10603 "\"hg-cmd\">hg status</command> and <command role=\"hg-cmd\">hg tip</command> "
|
dongsheng@627
|
10604 "commands report?"
|
dongsheng@627
|
10605 msgstr ""
|
dongsheng@627
|
10606
|
dongsheng@627
|
10607 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10608 #: ../en/ch08-branch.xml:379
|
dongsheng@627
|
10609 msgid ""
|
dongsheng@627
|
10610 "Nothing has changed in the working directory, and there's been no new history "
|
dongsheng@627
|
10611 "created. As this suggests, running the <command role=\"hg-cmd\">hg branch</"
|
dongsheng@627
|
10612 "command> command has no permanent effect; it only tells Mercurial what branch "
|
dongsheng@627
|
10613 "name to use the <emphasis>next</emphasis> time you commit a changeset."
|
dongsheng@627
|
10614 msgstr ""
|
dongsheng@627
|
10615
|
dongsheng@627
|
10616 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10617 #: ../en/ch08-branch.xml:386
|
dongsheng@627
|
10618 msgid ""
|
dongsheng@627
|
10619 "When you commit a change, Mercurial records the name of the branch on which "
|
dongsheng@627
|
10620 "you committed. Once you've switched from the <literal>default</literal> "
|
dongsheng@627
|
10621 "branch to another and committed, you'll see the name of the new branch show "
|
dongsheng@627
|
10622 "up in the output of <command role=\"hg-cmd\">hg log</command>, <command role="
|
dongsheng@627
|
10623 "\"hg-cmd\">hg tip</command>, and other commands that display the same kind of "
|
dongsheng@627
|
10624 "output."
|
dongsheng@627
|
10625 msgstr ""
|
dongsheng@627
|
10626
|
dongsheng@627
|
10627 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10628 #: ../en/ch08-branch.xml:396
|
dongsheng@627
|
10629 msgid ""
|
dongsheng@627
|
10630 "The <command role=\"hg-cmd\">hg log</command>-like commands will print the "
|
dongsheng@627
|
10631 "branch name of every changeset that's not on the <literal>default</literal> "
|
dongsheng@627
|
10632 "branch. As a result, if you never use named branches, you'll never see this "
|
dongsheng@627
|
10633 "information."
|
dongsheng@627
|
10634 msgstr ""
|
dongsheng@627
|
10635
|
dongsheng@627
|
10636 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10637 #: ../en/ch08-branch.xml:401
|
dongsheng@627
|
10638 msgid ""
|
dongsheng@627
|
10639 "Once you've named a branch and committed a change with that name, every "
|
dongsheng@627
|
10640 "subsequent commit that descends from that change will inherit the same branch "
|
dongsheng@627
|
10641 "name. You can change the name of a branch at any time, using the <command "
|
dongsheng@627
|
10642 "role=\"hg-cmd\">hg branch</command> command."
|
dongsheng@627
|
10643 msgstr ""
|
dongsheng@627
|
10644
|
dongsheng@627
|
10645 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10646 #: ../en/ch08-branch.xml:409
|
dongsheng@627
|
10647 msgid ""
|
dongsheng@627
|
10648 "In practice, this is something you won't do very often, as branch names tend "
|
dongsheng@627
|
10649 "to have fairly long lifetimes. (This isn't a rule, just an observation.)"
|
dongsheng@627
|
10650 msgstr ""
|
dongsheng@627
|
10651
|
dongsheng@627
|
10652 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
10653 #: ../en/ch08-branch.xml:415
|
dongsheng@627
|
10654 msgid "Dealing with multiple named branches in a repository"
|
dongsheng@635
|
10655 msgstr "在版本库中处理多个命名分支"
|
dongsheng@627
|
10656
|
dongsheng@627
|
10657 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10658 #: ../en/ch08-branch.xml:418
|
dongsheng@627
|
10659 msgid ""
|
dongsheng@627
|
10660 "If you have more than one named branch in a repository, Mercurial will "
|
dongsheng@714
|
10661 "remember the branch that your working directory is on when you start a "
|
dongsheng@714
|
10662 "command like <command role=\"hg-cmd\">hg update</command> or <command role="
|
dongsheng@714
|
10663 "\"hg-cmd\">hg pull -u</command>. It will update the working directory to the "
|
dongsheng@714
|
10664 "tip of this branch, no matter what the <quote>repo-wide</quote> tip is. To "
|
dongsheng@714
|
10665 "update to a revision that's on a different named branch, you may need to use "
|
dongsheng@714
|
10666 "the <option role=\"hg-opt-update\">-C</option> option to <command role=\"hg-"
|
dongsheng@714
|
10667 "cmd\">hg update</command>."
|
dongsheng@714
|
10668 msgstr ""
|
dongsheng@714
|
10669
|
dongsheng@714
|
10670 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10671 #: ../en/ch08-branch.xml:428
|
dongsheng@627
|
10672 msgid ""
|
songdongsheng@710
|
10673 "This behavior is a little subtle, so let's see it in action. First, let's "
|
dongsheng@627
|
10674 "remind ourselves what branch we're currently on, and what branches are in our "
|
dongsheng@627
|
10675 "repository."
|
dongsheng@627
|
10676 msgstr ""
|
dongsheng@627
|
10677
|
dongsheng@627
|
10678 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10679 #: ../en/ch08-branch.xml:434
|
dongsheng@627
|
10680 msgid ""
|
dongsheng@627
|
10681 "We're on the <literal>bar</literal> branch, but there also exists an older "
|
dongsheng@627
|
10682 "<command role=\"hg-cmd\">hg foo</command> branch."
|
dongsheng@627
|
10683 msgstr ""
|
dongsheng@627
|
10684
|
dongsheng@627
|
10685 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10686 #: ../en/ch08-branch.xml:438
|
dongsheng@627
|
10687 msgid ""
|
dongsheng@627
|
10688 "We can <command role=\"hg-cmd\">hg update</command> back and forth between "
|
dongsheng@627
|
10689 "the tips of the <literal>foo</literal> and <literal>bar</literal> branches "
|
dongsheng@627
|
10690 "without needing to use the <option role=\"hg-opt-update\">-C</option> option, "
|
dongsheng@627
|
10691 "because this only involves going backwards and forwards linearly through our "
|
dongsheng@627
|
10692 "change history."
|
dongsheng@627
|
10693 msgstr ""
|
dongsheng@627
|
10694
|
dongsheng@627
|
10695 #
|
dongsheng@627
|
10696 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10697 #: ../en/ch08-branch.xml:447
|
dongsheng@627
|
10698 msgid ""
|
dongsheng@627
|
10699 "If we go back to the <literal>foo</literal> branch and then run <command role="
|
dongsheng@627
|
10700 "\"hg-cmd\">hg update</command>, it will keep us on <literal>foo</literal>, "
|
dongsheng@627
|
10701 "not move us to the tip of <literal>bar</literal>."
|
dongsheng@627
|
10702 msgstr ""
|
dongsheng@627
|
10703
|
dongsheng@627
|
10704 #
|
dongsheng@627
|
10705 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10706 #: ../en/ch08-branch.xml:454
|
dongsheng@627
|
10707 msgid ""
|
dongsheng@627
|
10708 "Committing a new change on the <literal>foo</literal> branch introduces a new "
|
dongsheng@627
|
10709 "head."
|
dongsheng@627
|
10710 msgstr ""
|
dongsheng@627
|
10711
|
dongsheng@627
|
10712 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
10713 #: ../en/ch08-branch.xml:461
|
dongsheng@627
|
10714 msgid "Branch names and merging"
|
dongsheng@635
|
10715 msgstr "分支名称与合并"
|
dongsheng@627
|
10716
|
dongsheng@627
|
10717 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10718 #: ../en/ch08-branch.xml:463
|
dongsheng@627
|
10719 msgid ""
|
dongsheng@627
|
10720 "As you've probably noticed, merges in Mercurial are not symmetrical. Let's "
|
dongsheng@627
|
10721 "say our repository has two heads, 17 and 23. If I <command role=\"hg-cmd"
|
dongsheng@627
|
10722 "\">hg update</command> to 17 and then <command role=\"hg-cmd\">hg merge</"
|
dongsheng@627
|
10723 "command> with 23, Mercurial records 17 as the first parent of the merge, and "
|
dongsheng@627
|
10724 "23 as the second. Whereas if I <command role=\"hg-cmd\">hg update</command> "
|
dongsheng@627
|
10725 "to 23 and then <command role=\"hg-cmd\">hg merge</command> with 17, it "
|
dongsheng@627
|
10726 "records 23 as the first parent, and 17 as the second."
|
dongsheng@627
|
10727 msgstr ""
|
dongsheng@627
|
10728
|
dongsheng@627
|
10729 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10730 #: ../en/ch08-branch.xml:473
|
dongsheng@627
|
10731 msgid ""
|
dongsheng@627
|
10732 "This affects Mercurial's choice of branch name when you merge. After a "
|
dongsheng@627
|
10733 "merge, Mercurial will retain the branch name of the first parent when you "
|
dongsheng@627
|
10734 "commit the result of the merge. If your first parent's branch name is "
|
dongsheng@627
|
10735 "<literal>foo</literal>, and you merge with <literal>bar</literal>, the branch "
|
dongsheng@627
|
10736 "name will still be <literal>foo</literal> after you merge."
|
dongsheng@627
|
10737 msgstr ""
|
dongsheng@627
|
10738
|
dongsheng@627
|
10739 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10740 #: ../en/ch08-branch.xml:480
|
dongsheng@627
|
10741 msgid ""
|
dongsheng@627
|
10742 "It's not unusual for a repository to contain multiple heads, each with the "
|
dongsheng@627
|
10743 "same branch name. Let's say I'm working on the <literal>foo</literal> "
|
dongsheng@627
|
10744 "branch, and so are you. We commit different changes; I pull your changes; I "
|
dongsheng@627
|
10745 "now have two heads, each claiming to be on the <literal>foo</literal> "
|
dongsheng@627
|
10746 "branch. The result of a merge will be a single head on the <literal>foo</"
|
dongsheng@627
|
10747 "literal> branch, as you might hope."
|
dongsheng@627
|
10748 msgstr ""
|
dongsheng@627
|
10749
|
dongsheng@627
|
10750 #
|
dongsheng@627
|
10751 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10752 #: ../en/ch08-branch.xml:488
|
dongsheng@627
|
10753 msgid ""
|
dongsheng@627
|
10754 "But if I'm working on the <literal>bar</literal> branch, and I merge work "
|
dongsheng@627
|
10755 "from the <literal>foo</literal> branch, the result will remain on the "
|
dongsheng@627
|
10756 "<literal>bar</literal> branch."
|
dongsheng@627
|
10757 msgstr ""
|
dongsheng@627
|
10758
|
dongsheng@627
|
10759 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10760 #: ../en/ch08-branch.xml:494
|
dongsheng@627
|
10761 msgid ""
|
dongsheng@627
|
10762 "To give a more concrete example, if I'm working on the <literal>bleeding-"
|
dongsheng@627
|
10763 "edge</literal> branch, and I want to bring in the latest fixes from the "
|
dongsheng@627
|
10764 "<literal>stable</literal> branch, Mercurial will choose the <quote>right</"
|
dongsheng@627
|
10765 "quote> (<literal>bleeding-edge</literal>) branch name when I pull and merge "
|
dongsheng@627
|
10766 "from <literal>stable</literal>."
|
dongsheng@627
|
10767 msgstr ""
|
dongsheng@627
|
10768
|
dongsheng@627
|
10769 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
10770 #: ../en/ch08-branch.xml:503
|
dongsheng@627
|
10771 msgid "Branch naming is generally useful"
|
dongsheng@635
|
10772 msgstr "分支名称通常都很有用"
|
dongsheng@627
|
10773
|
dongsheng@627
|
10774 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10775 #: ../en/ch08-branch.xml:505
|
dongsheng@627
|
10776 msgid ""
|
dongsheng@627
|
10777 "You shouldn't think of named branches as applicable only to situations where "
|
dongsheng@627
|
10778 "you have multiple long-lived branches cohabiting in a single repository. "
|
dongsheng@627
|
10779 "They're very useful even in the one-branch-per-repository case."
|
dongsheng@627
|
10780 msgstr ""
|
dongsheng@627
|
10781
|
dongsheng@627
|
10782 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10783 #: ../en/ch08-branch.xml:510
|
dongsheng@627
|
10784 msgid ""
|
dongsheng@627
|
10785 "In the simplest case, giving a name to each branch gives you a permanent "
|
dongsheng@627
|
10786 "record of which branch a changeset originated on. This gives you more "
|
dongsheng@627
|
10787 "context when you're trying to follow the history of a long-lived branchy "
|
dongsheng@627
|
10788 "project."
|
dongsheng@627
|
10789 msgstr ""
|
dongsheng@627
|
10790
|
dongsheng@627
|
10791 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
10792 #: ../en/ch08-branch.xml:515
|
dongsheng@627
|
10793 msgid ""
|
dongsheng@627
|
10794 "If you're working with shared repositories, you can set up a <literal role="
|
dongsheng@627
|
10795 "\"hook\">pretxnchangegroup</literal> hook on each that will block incoming "
|
dongsheng@627
|
10796 "changes that have the <quote>wrong</quote> branch name. This provides a "
|
dongsheng@627
|
10797 "simple, but effective, defence against people accidentally pushing changes "
|
dongsheng@627
|
10798 "from a <quote>bleeding edge</quote> branch to a <quote>stable</quote> "
|
dongsheng@627
|
10799 "branch. Such a hook might look like this inside the shared repo's <filename "
|
dongsheng@627
|
10800 "role=\"special\"> /.hgrc</filename>."
|
dongsheng@627
|
10801 msgstr ""
|
dongsheng@627
|
10802
|
dongsheng@627
|
10803 #. type: Content of: <book><chapter><title>
|
dongsheng@714
|
10804 #: ../en/ch09-undo.xml:5
|
dongsheng@627
|
10805 msgid "Finding and fixing mistakes"
|
dongsheng@627
|
10806 msgstr "查找和修改错误"
|
dongsheng@627
|
10807
|
dongsheng@627
|
10808 #. type: Content of: <book><chapter><para>
|
dongsheng@714
|
10809 #: ../en/ch09-undo.xml:7
|
dongsheng@627
|
10810 msgid ""
|
dongsheng@627
|
10811 "To err might be human, but to really handle the consequences well takes a top-"
|
dongsheng@627
|
10812 "notch revision control system. In this chapter, we'll discuss some of the "
|
dongsheng@627
|
10813 "techniques you can use when you find that a problem has crept into your "
|
dongsheng@627
|
10814 "project. Mercurial has some highly capable features that will help you to "
|
dongsheng@627
|
10815 "isolate the sources of problems, and to handle them appropriately."
|
dongsheng@627
|
10816 msgstr ""
|
dongsheng@627
|
10817
|
dongsheng@627
|
10818 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
10819 #: ../en/ch09-undo.xml:15
|
dongsheng@627
|
10820 msgid "Erasing local history"
|
dongsheng@635
|
10821 msgstr "销毁本地历史"
|
dongsheng@627
|
10822
|
dongsheng@627
|
10823 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
10824 #: ../en/ch09-undo.xml:18
|
dongsheng@627
|
10825 msgid "The accidental commit"
|
dongsheng@635
|
10826 msgstr "意外的提交"
|
dongsheng@627
|
10827
|
dongsheng@627
|
10828 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10829 #: ../en/ch09-undo.xml:20
|
dongsheng@627
|
10830 msgid ""
|
dongsheng@627
|
10831 "I have the occasional but persistent problem of typing rather more quickly "
|
dongsheng@627
|
10832 "than I can think, which sometimes results in me committing a changeset that "
|
dongsheng@627
|
10833 "is either incomplete or plain wrong. In my case, the usual kind of "
|
dongsheng@627
|
10834 "incomplete changeset is one in which I've created a new source file, but "
|
dongsheng@627
|
10835 "forgotten to <command role=\"hg-cmd\">hg add</command> it. A <quote>plain "
|
dongsheng@627
|
10836 "wrong</quote> changeset is not as common, but no less annoying."
|
dongsheng@627
|
10837 msgstr ""
|
dongsheng@627
|
10838
|
dongsheng@627
|
10839 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
10840 #: ../en/ch09-undo.xml:31
|
dongsheng@627
|
10841 msgid "Rolling back a transaction"
|
dongsheng@635
|
10842 msgstr "回滚一个事务"
|
dongsheng@627
|
10843
|
dongsheng@627
|
10844 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10845 #: ../en/ch09-undo.xml:33
|
dongsheng@627
|
10846 msgid ""
|
songdongsheng@658
|
10847 "In <xref linkend=\"sec:concepts:txn\"/>, I mentioned that Mercurial treats "
|
songdongsheng@658
|
10848 "each modification of a repository as a <emphasis>transaction</emphasis>. "
|
songdongsheng@658
|
10849 "Every time you commit a changeset or pull changes from another repository, "
|
songdongsheng@658
|
10850 "Mercurial remembers what you did. You can undo, or <emphasis>roll back</"
|
songdongsheng@658
|
10851 "emphasis>, exactly one of these actions using the <command role=\"hg-cmd\">hg "
|
songdongsheng@658
|
10852 "rollback</command> command. (See <xref linkend=\"sec:undo:rollback-after-push"
|
songdongsheng@658
|
10853 "\"/> for an important caveat about the use of this command.)"
|
dongsheng@627
|
10854 msgstr ""
|
dongsheng@627
|
10855
|
dongsheng@627
|
10856 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10857 #: ../en/ch09-undo.xml:43
|
dongsheng@627
|
10858 msgid ""
|
dongsheng@627
|
10859 "Here's a mistake that I often find myself making: committing a change in "
|
dongsheng@627
|
10860 "which I've created a new file, but forgotten to <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
10861 "add</command> it."
|
dongsheng@627
|
10862 msgstr ""
|
dongsheng@627
|
10863
|
dongsheng@627
|
10864 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10865 #: ../en/ch09-undo.xml:50
|
dongsheng@627
|
10866 msgid ""
|
dongsheng@627
|
10867 "Looking at the output of <command role=\"hg-cmd\">hg status</command> after "
|
dongsheng@627
|
10868 "the commit immediately confirms the error."
|
dongsheng@627
|
10869 msgstr ""
|
dongsheng@627
|
10870
|
dongsheng@627
|
10871 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10872 #: ../en/ch09-undo.xml:56
|
dongsheng@627
|
10873 msgid ""
|
dongsheng@627
|
10874 "The commit captured the changes to the file <filename>a</filename>, but not "
|
dongsheng@627
|
10875 "the new file <filename>b</filename>. If I were to push this changeset to a "
|
dongsheng@627
|
10876 "repository that I shared with a colleague, the chances are high that "
|
dongsheng@627
|
10877 "something in <filename>a</filename> would refer to <filename>b</filename>, "
|
dongsheng@627
|
10878 "which would not be present in their repository when they pulled my changes. "
|
dongsheng@627
|
10879 "I would thus become the object of some indignation."
|
dongsheng@627
|
10880 msgstr ""
|
dongsheng@627
|
10881
|
dongsheng@627
|
10882 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10883 #: ../en/ch09-undo.xml:65
|
dongsheng@627
|
10884 msgid ""
|
songdongsheng@668
|
10885 "However, luck is with me&emdash;I've caught my error before I pushed the "
|
songdongsheng@668
|
10886 "changeset. I use the <command role=\"hg-cmd\">hg rollback</command> command, "
|
songdongsheng@668
|
10887 "and Mercurial makes that last changeset vanish."
|
dongsheng@627
|
10888 msgstr ""
|
dongsheng@627
|
10889
|
dongsheng@627
|
10890 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10891 #: ../en/ch09-undo.xml:72
|
dongsheng@627
|
10892 msgid ""
|
dongsheng@627
|
10893 "Notice that the changeset is no longer present in the repository's history, "
|
dongsheng@627
|
10894 "and the working directory once again thinks that the file <filename>a</"
|
dongsheng@627
|
10895 "filename> is modified. The commit and rollback have left the working "
|
dongsheng@627
|
10896 "directory exactly as it was prior to the commit; the changeset has been "
|
dongsheng@627
|
10897 "completely erased. I can now safely <command role=\"hg-cmd\">hg add</"
|
dongsheng@627
|
10898 "command> the file <filename>b</filename>, and rerun my commit."
|
dongsheng@627
|
10899 msgstr ""
|
dongsheng@627
|
10900
|
dongsheng@627
|
10901 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
10902 #: ../en/ch09-undo.xml:85
|
dongsheng@627
|
10903 msgid "The erroneous pull"
|
dongsheng@635
|
10904 msgstr "错误的抓取"
|
dongsheng@627
|
10905
|
dongsheng@627
|
10906 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10907 #: ../en/ch09-undo.xml:87
|
dongsheng@627
|
10908 msgid ""
|
dongsheng@627
|
10909 "It's common practice with Mercurial to maintain separate development branches "
|
dongsheng@627
|
10910 "of a project in different repositories. Your development team might have one "
|
dongsheng@627
|
10911 "shared repository for your project's <quote>0.9</quote> release, and another, "
|
dongsheng@627
|
10912 "containing different changes, for the <quote>1.0</quote> release."
|
dongsheng@627
|
10913 msgstr ""
|
dongsheng@627
|
10914
|
dongsheng@627
|
10915 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10916 #: ../en/ch09-undo.xml:94
|
dongsheng@627
|
10917 msgid ""
|
dongsheng@627
|
10918 "Given this, you can imagine that the consequences could be messy if you had a "
|
dongsheng@627
|
10919 "local <quote>0.9</quote> repository, and accidentally pulled changes from the "
|
dongsheng@627
|
10920 "shared <quote>1.0</quote> repository into it. At worst, you could be paying "
|
dongsheng@627
|
10921 "insufficient attention, and push those changes into the shared <quote>0.9</"
|
dongsheng@627
|
10922 "quote> tree, confusing your entire team (but don't worry, we'll return to "
|
dongsheng@627
|
10923 "this horror scenario later). However, it's more likely that you'll notice "
|
dongsheng@627
|
10924 "immediately, because Mercurial will display the URL it's pulling from, or you "
|
dongsheng@627
|
10925 "will see it pull a suspiciously large number of changes into the repository."
|
dongsheng@627
|
10926 msgstr ""
|
dongsheng@627
|
10927
|
dongsheng@627
|
10928 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10929 #: ../en/ch09-undo.xml:106
|
dongsheng@627
|
10930 msgid ""
|
dongsheng@627
|
10931 "The <command role=\"hg-cmd\">hg rollback</command> command will work nicely "
|
dongsheng@627
|
10932 "to expunge all of the changesets that you just pulled. Mercurial groups all "
|
dongsheng@627
|
10933 "changes from one <command role=\"hg-cmd\">hg pull</command> into a single "
|
dongsheng@627
|
10934 "transaction, so one <command role=\"hg-cmd\">hg rollback</command> is all you "
|
dongsheng@627
|
10935 "need to undo this mistake."
|
dongsheng@627
|
10936 msgstr ""
|
dongsheng@627
|
10937
|
dongsheng@627
|
10938 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
10939 #: ../en/ch09-undo.xml:115
|
dongsheng@627
|
10940 msgid "Rolling back is useless once you've pushed"
|
dongsheng@635
|
10941 msgstr "当完成推送后,回滚是无效的"
|
dongsheng@627
|
10942
|
dongsheng@627
|
10943 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10944 #: ../en/ch09-undo.xml:117
|
dongsheng@627
|
10945 msgid ""
|
dongsheng@627
|
10946 "The value of the <command role=\"hg-cmd\">hg rollback</command> command drops "
|
dongsheng@627
|
10947 "to zero once you've pushed your changes to another repository. Rolling back "
|
dongsheng@627
|
10948 "a change makes it disappear entirely, but <emphasis>only</emphasis> in the "
|
dongsheng@627
|
10949 "repository in which you perform the <command role=\"hg-cmd\">hg rollback</"
|
dongsheng@627
|
10950 "command>. Because a rollback eliminates history, there's no way for the "
|
dongsheng@627
|
10951 "disappearance of a change to propagate between repositories."
|
dongsheng@627
|
10952 msgstr ""
|
dongsheng@627
|
10953
|
dongsheng@627
|
10954 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10955 #: ../en/ch09-undo.xml:126
|
dongsheng@627
|
10956 msgid ""
|
songdongsheng@668
|
10957 "If you've pushed a change to another repository&emdash;particularly if it's a "
|
songdongsheng@668
|
10958 "shared repository&emdash;it has essentially <quote>escaped into the wild,</"
|
dongsheng@714
|
10959 "quote> and you'll have to recover from your mistake in a different way. If "
|
dongsheng@714
|
10960 "you push a changeset somewhere, then roll it back, then pull from the "
|
dongsheng@714
|
10961 "repository you pushed to, the changeset you thought you'd gotten rid of will "
|
dongsheng@714
|
10962 "simply reappear in your repository."
|
dongsheng@714
|
10963 msgstr ""
|
dongsheng@714
|
10964
|
dongsheng@714
|
10965 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10966 #: ../en/ch09-undo.xml:135
|
dongsheng@627
|
10967 msgid ""
|
dongsheng@627
|
10968 "(If you absolutely know for sure that the change you want to roll back is the "
|
dongsheng@627
|
10969 "most recent change in the repository that you pushed to, <emphasis>and</"
|
dongsheng@627
|
10970 "emphasis> you know that nobody else could have pulled it from that "
|
dongsheng@627
|
10971 "repository, you can roll back the changeset there, too, but you really should "
|
dongsheng@714
|
10972 "not expect this to work reliably. Sooner or later a change really will make "
|
dongsheng@714
|
10973 "it into a repository that you don't directly control (or have forgotten "
|
dongsheng@714
|
10974 "about), and come back to bite you.)"
|
dongsheng@627
|
10975 msgstr ""
|
dongsheng@627
|
10976
|
dongsheng@627
|
10977 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
10978 #: ../en/ch09-undo.xml:147
|
dongsheng@627
|
10979 msgid "You can only roll back once"
|
dongsheng@635
|
10980 msgstr "你只能回滚一次"
|
dongsheng@627
|
10981
|
dongsheng@627
|
10982 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10983 #: ../en/ch09-undo.xml:149
|
dongsheng@627
|
10984 msgid ""
|
dongsheng@627
|
10985 "Mercurial stores exactly one transaction in its transaction log; that "
|
dongsheng@627
|
10986 "transaction is the most recent one that occurred in the repository. This "
|
dongsheng@627
|
10987 "means that you can only roll back one transaction. If you expect to be able "
|
songdongsheng@710
|
10988 "to roll back one transaction, then its predecessor, this is not the behavior "
|
dongsheng@627
|
10989 "you will get."
|
dongsheng@627
|
10990 msgstr ""
|
dongsheng@627
|
10991
|
dongsheng@627
|
10992 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
10993 #: ../en/ch09-undo.xml:158
|
dongsheng@627
|
10994 msgid ""
|
dongsheng@627
|
10995 "Once you've rolled back one transaction in a repository, you can't roll back "
|
dongsheng@627
|
10996 "again in that repository until you perform another commit or pull."
|
dongsheng@627
|
10997 msgstr ""
|
dongsheng@627
|
10998
|
dongsheng@627
|
10999 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
11000 #: ../en/ch09-undo.xml:165
|
dongsheng@627
|
11001 msgid "Reverting the mistaken change"
|
dongsheng@635
|
11002 msgstr "撤销错误的修改"
|
dongsheng@627
|
11003
|
dongsheng@627
|
11004 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11005 #: ../en/ch09-undo.xml:167
|
dongsheng@627
|
11006 msgid ""
|
dongsheng@627
|
11007 "If you make a modification to a file, and decide that you really didn't want "
|
dongsheng@627
|
11008 "to change the file at all, and you haven't yet committed your changes, the "
|
dongsheng@627
|
11009 "<command role=\"hg-cmd\">hg revert</command> command is the one you'll need. "
|
dongsheng@627
|
11010 "It looks at the changeset that's the parent of the working directory, and "
|
dongsheng@627
|
11011 "restores the contents of the file to their state as of that changeset. "
|
dongsheng@627
|
11012 "(That's a long-winded way of saying that, in the normal case, it undoes your "
|
dongsheng@627
|
11013 "modifications.)"
|
dongsheng@627
|
11014 msgstr ""
|
dongsheng@627
|
11015
|
dongsheng@627
|
11016 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11017 #: ../en/ch09-undo.xml:176
|
dongsheng@627
|
11018 msgid ""
|
dongsheng@627
|
11019 "Let's illustrate how the <command role=\"hg-cmd\">hg revert</command> command "
|
dongsheng@627
|
11020 "works with yet another small example. We'll begin by modifying a file that "
|
dongsheng@627
|
11021 "Mercurial is already tracking."
|
dongsheng@627
|
11022 msgstr ""
|
dongsheng@627
|
11023
|
dongsheng@627
|
11024 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11025 #: ../en/ch09-undo.xml:183
|
dongsheng@627
|
11026 msgid ""
|
dongsheng@627
|
11027 "If we don't want that change, we can simply <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
11028 "revert</command> the file."
|
dongsheng@627
|
11029 msgstr ""
|
dongsheng@627
|
11030
|
dongsheng@627
|
11031 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11032 #: ../en/ch09-undo.xml:189
|
dongsheng@627
|
11033 msgid ""
|
dongsheng@627
|
11034 "The <command role=\"hg-cmd\">hg revert</command> command provides us with an "
|
dongsheng@627
|
11035 "extra degree of safety by saving our modified file with a <filename>.orig</"
|
dongsheng@627
|
11036 "filename> extension."
|
dongsheng@627
|
11037 msgstr ""
|
dongsheng@627
|
11038
|
dongsheng@714
|
11039 #. type: Content of: <book><chapter><sect1><tip><title>
|
dongsheng@714
|
11040 #: ../en/ch09-undo.xml:197
|
dongsheng@714
|
11041 msgid "Be careful with <filename>.orig</filename> files"
|
dongsheng@715
|
11042 msgstr "小心 <filename>.orig</filename> 文件"
|
dongsheng@714
|
11043
|
dongsheng@714
|
11044 #. type: Content of: <book><chapter><sect1><tip><para>
|
dongsheng@714
|
11045 #: ../en/ch09-undo.xml:199
|
dongsheng@714
|
11046 msgid ""
|
dongsheng@714
|
11047 "It's extremely unlikely that you are either using Mercurial to manage files "
|
dongsheng@714
|
11048 "with <filename>.orig</filename> extensions or that you even care about the "
|
dongsheng@714
|
11049 "contents of such files. Just in case, though, it's useful to remember that "
|
dongsheng@714
|
11050 "<command role=\"hg-cmd\">hg revert</command> will unconditionally overwrite "
|
dongsheng@714
|
11051 "an existing file with a <filename>.orig</filename> extension. For instance, "
|
dongsheng@714
|
11052 "if you already have a file named <filename>foo.orig</filename> when you "
|
dongsheng@714
|
11053 "revert <filename>foo</filename>, the contents of <filename>foo.orig</"
|
dongsheng@714
|
11054 "filename> will be clobbered."
|
dongsheng@714
|
11055 msgstr ""
|
dongsheng@714
|
11056
|
dongsheng@714
|
11057 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11058 #: ../en/ch09-undo.xml:211
|
dongsheng@627
|
11059 msgid ""
|
dongsheng@627
|
11060 "Here is a summary of the cases that the <command role=\"hg-cmd\">hg revert</"
|
dongsheng@627
|
11061 "command> command can deal with. We will describe each of these in more "
|
dongsheng@627
|
11062 "detail in the section that follows."
|
dongsheng@627
|
11063 msgstr ""
|
dongsheng@627
|
11064
|
dongsheng@627
|
11065 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
11066 #: ../en/ch09-undo.xml:216
|
dongsheng@627
|
11067 msgid "If you modify a file, it will restore the file to its unmodified state."
|
dongsheng@627
|
11068 msgstr ""
|
dongsheng@627
|
11069
|
dongsheng@627
|
11070 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
11071 #: ../en/ch09-undo.xml:219
|
dongsheng@627
|
11072 msgid ""
|
dongsheng@627
|
11073 "If you <command role=\"hg-cmd\">hg add</command> a file, it will undo the "
|
dongsheng@627
|
11074 "<quote>added</quote> state of the file, but leave the file itself untouched."
|
dongsheng@627
|
11075 msgstr ""
|
dongsheng@627
|
11076
|
dongsheng@627
|
11077 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
11078 #: ../en/ch09-undo.xml:223
|
dongsheng@627
|
11079 msgid ""
|
dongsheng@627
|
11080 "If you delete a file without telling Mercurial, it will restore the file to "
|
dongsheng@627
|
11081 "its unmodified contents."
|
dongsheng@627
|
11082 msgstr ""
|
dongsheng@627
|
11083
|
dongsheng@627
|
11084 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
11085 #: ../en/ch09-undo.xml:226
|
dongsheng@627
|
11086 msgid ""
|
dongsheng@627
|
11087 "If you use the <command role=\"hg-cmd\">hg remove</command> command to remove "
|
dongsheng@627
|
11088 "a file, it will undo the <quote>removed</quote> state of the file, and "
|
dongsheng@627
|
11089 "restore the file to its unmodified contents."
|
dongsheng@627
|
11090 msgstr ""
|
dongsheng@627
|
11091
|
dongsheng@627
|
11092 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
11093 #: ../en/ch09-undo.xml:233
|
dongsheng@627
|
11094 msgid "File management errors"
|
dongsheng@635
|
11095 msgstr "文件管理错误"
|
dongsheng@627
|
11096
|
dongsheng@627
|
11097 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11098 #: ../en/ch09-undo.xml:235
|
dongsheng@627
|
11099 msgid ""
|
dongsheng@627
|
11100 "The <command role=\"hg-cmd\">hg revert</command> command is useful for more "
|
dongsheng@627
|
11101 "than just modified files. It lets you reverse the results of all of "
|
songdongsheng@668
|
11102 "Mercurial's file management commands&emdash;<command role=\"hg-cmd\">hg add</"
|
dongsheng@627
|
11103 "command>, <command role=\"hg-cmd\">hg remove</command>, and so on."
|
dongsheng@627
|
11104 msgstr ""
|
dongsheng@627
|
11105
|
dongsheng@627
|
11106 #
|
dongsheng@627
|
11107 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11108 #: ../en/ch09-undo.xml:241
|
dongsheng@627
|
11109 msgid ""
|
dongsheng@627
|
11110 "If you <command role=\"hg-cmd\">hg add</command> a file, then decide that in "
|
dongsheng@627
|
11111 "fact you don't want Mercurial to track it, use <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
11112 "revert</command> to undo the add. Don't worry; Mercurial will not modify the "
|
dongsheng@627
|
11113 "file in any way. It will just <quote>unmark</quote> the file."
|
dongsheng@627
|
11114 msgstr ""
|
dongsheng@627
|
11115
|
dongsheng@627
|
11116 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11117 #: ../en/ch09-undo.xml:249
|
dongsheng@627
|
11118 msgid ""
|
dongsheng@627
|
11119 "Similarly, if you ask Mercurial to <command role=\"hg-cmd\">hg remove</"
|
dongsheng@627
|
11120 "command> a file, you can use <command role=\"hg-cmd\">hg revert</command> to "
|
dongsheng@627
|
11121 "restore it to the contents it had as of the parent of the working directory. "
|
dongsheng@627
|
11122 "&interaction.daily.revert.remove; This works just as well for a file that you "
|
dongsheng@627
|
11123 "deleted by hand, without telling Mercurial (recall that in Mercurial "
|
dongsheng@627
|
11124 "terminology, this kind of file is called <quote>missing</quote>)."
|
dongsheng@627
|
11125 msgstr ""
|
dongsheng@627
|
11126
|
dongsheng@627
|
11127 #
|
dongsheng@627
|
11128 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11129 #: ../en/ch09-undo.xml:260
|
dongsheng@627
|
11130 msgid ""
|
dongsheng@627
|
11131 "If you revert a <command role=\"hg-cmd\">hg copy</command>, the copied-to "
|
dongsheng@627
|
11132 "file remains in your working directory afterwards, untracked. Since a copy "
|
dongsheng@627
|
11133 "doesn't affect the copied-from file in any way, Mercurial doesn't do anything "
|
dongsheng@627
|
11134 "with the copied-from file."
|
dongsheng@627
|
11135 msgstr ""
|
dongsheng@627
|
11136
|
dongsheng@627
|
11137 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
11138 #: ../en/ch09-undo.xml:271
|
dongsheng@627
|
11139 msgid "Dealing with committed changes"
|
dongsheng@635
|
11140 msgstr "处理已经提交的修改"
|
dongsheng@627
|
11141
|
dongsheng@627
|
11142 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11143 #: ../en/ch09-undo.xml:273
|
dongsheng@714
|
11144 msgid ""
|
dongsheng@714
|
11145 "Consider a case where you have committed a change <emphasis>a</emphasis>, and "
|
dongsheng@714
|
11146 "another change <emphasis>b</emphasis> on top of it; you then realise that "
|
dongsheng@714
|
11147 "change <emphasis>a</emphasis> was incorrect. Mercurial lets you <quote>back "
|
dongsheng@714
|
11148 "out</quote> an entire changeset automatically, and building blocks that let "
|
dongsheng@714
|
11149 "you reverse part of a changeset by hand."
|
dongsheng@714
|
11150 msgstr ""
|
dongsheng@714
|
11151
|
dongsheng@714
|
11152 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11153 #: ../en/ch09-undo.xml:281
|
dongsheng@627
|
11154 msgid ""
|
dongsheng@627
|
11155 "Before you read this section, here's something to keep in mind: the <command "
|
dongsheng@714
|
11156 "role=\"hg-cmd\">hg backout</command> command undoes the effect of a change by "
|
dongsheng@714
|
11157 "<emphasis>adding</emphasis> to your repository's history, not by modifying or "
|
dongsheng@714
|
11158 "erasing it. It's the right tool to use if you're fixing bugs, but not if "
|
dongsheng@714
|
11159 "you're trying to undo some change that has catastrophic consequences. To "
|
dongsheng@714
|
11160 "deal with those, see <xref linkend=\"sec:undo:aaaiiieee\"/>."
|
dongsheng@627
|
11161 msgstr ""
|
dongsheng@627
|
11162
|
dongsheng@627
|
11163 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
11164 #: ../en/ch09-undo.xml:291
|
dongsheng@627
|
11165 msgid "Backing out a changeset"
|
dongsheng@635
|
11166 msgstr "恢复一个修改集"
|
dongsheng@627
|
11167
|
dongsheng@627
|
11168 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11169 #: ../en/ch09-undo.xml:293
|
dongsheng@627
|
11170 msgid ""
|
dongsheng@627
|
11171 "The <command role=\"hg-cmd\">hg backout</command> command lets you "
|
dongsheng@627
|
11172 "<quote>undo</quote> the effects of an entire changeset in an automated "
|
dongsheng@627
|
11173 "fashion. Because Mercurial's history is immutable, this command "
|
dongsheng@627
|
11174 "<emphasis>does not</emphasis> get rid of the changeset you want to undo. "
|
dongsheng@627
|
11175 "Instead, it creates a new changeset that <emphasis>reverses</emphasis> the "
|
dongsheng@627
|
11176 "effect of the to-be-undone changeset."
|
dongsheng@627
|
11177 msgstr ""
|
dongsheng@627
|
11178
|
dongsheng@627
|
11179 #
|
dongsheng@627
|
11180 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11181 #: ../en/ch09-undo.xml:302
|
dongsheng@627
|
11182 msgid ""
|
dongsheng@627
|
11183 "The operation of the <command role=\"hg-cmd\">hg backout</command> command is "
|
dongsheng@627
|
11184 "a little intricate, so let's illustrate it with some examples. First, we'll "
|
dongsheng@627
|
11185 "create a repository with some simple changes."
|
dongsheng@627
|
11186 msgstr ""
|
dongsheng@627
|
11187
|
dongsheng@627
|
11188 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11189 #: ../en/ch09-undo.xml:309
|
dongsheng@627
|
11190 msgid ""
|
dongsheng@627
|
11191 "The <command role=\"hg-cmd\">hg backout</command> command takes a single "
|
dongsheng@627
|
11192 "changeset ID as its argument; this is the changeset to back out. Normally, "
|
dongsheng@627
|
11193 "<command role=\"hg-cmd\">hg backout</command> will drop you into a text "
|
dongsheng@627
|
11194 "editor to write a commit message, so you can record why you're backing the "
|
dongsheng@627
|
11195 "change out. In this example, we provide a commit message on the command line "
|
dongsheng@627
|
11196 "using the <option role=\"hg-opt-backout\">-m</option> option."
|
dongsheng@627
|
11197 msgstr ""
|
dongsheng@627
|
11198
|
dongsheng@627
|
11199 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
11200 #: ../en/ch09-undo.xml:320
|
dongsheng@627
|
11201 msgid "Backing out the tip changeset"
|
dongsheng@635
|
11202 msgstr "恢复顶点修改集"
|
dongsheng@627
|
11203
|
dongsheng@627
|
11204 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11205 #: ../en/ch09-undo.xml:322
|
dongsheng@627
|
11206 msgid "We're going to start by backing out the last changeset we committed."
|
dongsheng@627
|
11207 msgstr ""
|
dongsheng@627
|
11208
|
dongsheng@627
|
11209 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11210 #: ../en/ch09-undo.xml:327
|
dongsheng@627
|
11211 msgid ""
|
dongsheng@627
|
11212 "You can see that the second line from <filename>myfile</filename> is no "
|
dongsheng@627
|
11213 "longer present. Taking a look at the output of <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
11214 "log</command> gives us an idea of what the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
11215 "backout</command> command has done. &interaction.backout.simple.log; Notice "
|
dongsheng@627
|
11216 "that the new changeset that <command role=\"hg-cmd\">hg backout</command> has "
|
dongsheng@627
|
11217 "created is a child of the changeset we backed out. It's easier to see this "
|
songdongsheng@658
|
11218 "in <xref linkend=\"fig:undo:backout\"/>, which presents a graphical view of "
|
songdongsheng@658
|
11219 "the change history. As you can see, the history is nice and linear."
|
songdongsheng@658
|
11220 msgstr ""
|
songdongsheng@658
|
11221
|
songdongsheng@658
|
11222 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
|
dongsheng@714
|
11223 #: ../en/ch09-undo.xml:340 ../en/ch09-undo.xml:460
|
dongsheng@627
|
11224 msgid ""
|
dongsheng@627
|
11225 "Backing out a change using the <command role=\"hg-cmd\">hg backout</command> "
|
dongsheng@627
|
11226 "command"
|
dongsheng@660
|
11227 msgstr "使用 <command role=\"hg-cmd\">hg backout</command> 恢复一个修改"
|
dongsheng@627
|
11228
|
songdongsheng@658
|
11229 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
|
dongsheng@714
|
11230 #: ../en/ch09-undo.xml:343
|
songdongsheng@658
|
11231 msgid "<imageobject><imagedata fileref=\"figs/undo-simple.png\"/></imageobject>"
|
songdongsheng@658
|
11232 msgstr ""
|
songdongsheng@658
|
11233
|
dongsheng@627
|
11234 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
11235 #: ../en/ch09-undo.xml:350
|
dongsheng@627
|
11236 msgid "Backing out a non-tip change"
|
dongsheng@635
|
11237 msgstr "恢复非顶点的修改"
|
dongsheng@627
|
11238
|
dongsheng@627
|
11239 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11240 #: ../en/ch09-undo.xml:352
|
dongsheng@627
|
11241 msgid ""
|
dongsheng@627
|
11242 "If you want to back out a change other than the last one you committed, pass "
|
dongsheng@627
|
11243 "the <option role=\"hg-opt-backout\">--merge</option> option to the <command "
|
dongsheng@627
|
11244 "role=\"hg-cmd\">hg backout</command> command."
|
dongsheng@627
|
11245 msgstr ""
|
dongsheng@627
|
11246
|
dongsheng@627
|
11247 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11248 #: ../en/ch09-undo.xml:359
|
dongsheng@627
|
11249 msgid ""
|
dongsheng@627
|
11250 "This makes backing out any changeset a <quote>one-shot</quote> operation "
|
dongsheng@627
|
11251 "that's usually simple and fast."
|
dongsheng@627
|
11252 msgstr ""
|
dongsheng@627
|
11253
|
dongsheng@627
|
11254 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11255 #: ../en/ch09-undo.xml:365
|
dongsheng@627
|
11256 msgid ""
|
dongsheng@627
|
11257 "If you take a look at the contents of <filename>myfile</filename> after the "
|
dongsheng@627
|
11258 "backout finishes, you'll see that the first and third changes are present, "
|
dongsheng@627
|
11259 "but not the second."
|
dongsheng@627
|
11260 msgstr ""
|
dongsheng@627
|
11261
|
dongsheng@627
|
11262 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11263 #: ../en/ch09-undo.xml:372
|
songdongsheng@658
|
11264 msgid ""
|
songdongsheng@658
|
11265 "As the graphical history in <xref linkend=\"fig:undo:backout-non-tip\"/> "
|
dongsheng@714
|
11266 "illustrates, Mercurial still commits one change in this kind of situation "
|
dongsheng@714
|
11267 "(the box-shaped node is the ones that Mercurial commits automatically), but "
|
dongsheng@714
|
11268 "the revision graph now looks different. Before Mercurial begins the backout "
|
dongsheng@714
|
11269 "process, it first remembers what the current parent of the working directory "
|
dongsheng@714
|
11270 "is. It then backs out the target changeset, and commits that as a "
|
dongsheng@714
|
11271 "changeset. Finally, it merges back to the previous parent of the working "
|
dongsheng@714
|
11272 "directory, but notice that it <emphasis>does not commit</emphasis> the result "
|
dongsheng@714
|
11273 "of the merge. The repository now contains two heads, and the working "
|
dongsheng@714
|
11274 "directory is in a merge state."
|
dongsheng@627
|
11275 msgstr ""
|
dongsheng@627
|
11276
|
songdongsheng@658
|
11277 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
|
dongsheng@714
|
11278 #: ../en/ch09-undo.xml:387
|
dongsheng@627
|
11279 msgid ""
|
dongsheng@627
|
11280 "Automated backout of a non-tip change using the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
11281 "backout</command> command"
|
dongsheng@660
|
11282 msgstr "使用 <command role=\"hg-cmd\">hg backout</command> 自动恢复非顶点的修改"
|
dongsheng@627
|
11283
|
songdongsheng@658
|
11284 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
|
dongsheng@714
|
11285 #: ../en/ch09-undo.xml:390
|
songdongsheng@658
|
11286 msgid ""
|
songdongsheng@658
|
11287 "<imageobject><imagedata fileref=\"figs/undo-non-tip.png\"/></imageobject>"
|
songdongsheng@658
|
11288 msgstr ""
|
songdongsheng@658
|
11289
|
songdongsheng@658
|
11290 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11291 #: ../en/ch09-undo.xml:395
|
dongsheng@627
|
11292 msgid ""
|
dongsheng@627
|
11293 "The result is that you end up <quote>back where you were</quote>, only with "
|
dongsheng@627
|
11294 "some extra history that undoes the effect of the changeset you wanted to back "
|
dongsheng@627
|
11295 "out."
|
dongsheng@627
|
11296 msgstr ""
|
dongsheng@627
|
11297
|
dongsheng@714
|
11298 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11299 #: ../en/ch09-undo.xml:399
|
dongsheng@714
|
11300 msgid ""
|
dongsheng@714
|
11301 "You might wonder why Mercurial does not commit the result of the merge that "
|
dongsheng@714
|
11302 "it performed. The reason lies in Mercurial behaving conservatively: a merge "
|
dongsheng@714
|
11303 "naturally has more scope for error than simply undoing the effect of the tip "
|
dongsheng@714
|
11304 "changeset, so your work will be safest if you first inspect (and test!) the "
|
dongsheng@714
|
11305 "result of the merge, <emphasis>then</emphasis> commit it."
|
dongsheng@714
|
11306 msgstr ""
|
dongsheng@714
|
11307
|
dongsheng@627
|
11308 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
11309 #: ../en/ch09-undo.xml:408
|
dongsheng@627
|
11310 msgid "Always use the <option role=\"hg-opt-backout\">--merge</option> option"
|
dongsheng@635
|
11311 msgstr "始终使用选项 <option role=\"hg-opt-backout\">--merge</option>"
|
dongsheng@627
|
11312
|
dongsheng@627
|
11313 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
11314 #: ../en/ch09-undo.xml:411
|
dongsheng@627
|
11315 msgid ""
|
dongsheng@627
|
11316 "In fact, since the <option role=\"hg-opt-backout\">--merge</option> option "
|
dongsheng@627
|
11317 "will do the <quote>right thing</quote> whether or not the changeset you're "
|
dongsheng@627
|
11318 "backing out is the tip (i.e. it won't try to merge if it's backing out the "
|
dongsheng@627
|
11319 "tip, since there's no need), you should <emphasis>always</emphasis> use this "
|
dongsheng@627
|
11320 "option when you run the <command role=\"hg-cmd\">hg backout</command> command."
|
dongsheng@627
|
11321 msgstr ""
|
dongsheng@627
|
11322
|
dongsheng@627
|
11323 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
11324 #: ../en/ch09-undo.xml:422
|
dongsheng@627
|
11325 msgid "Gaining more control of the backout process"
|
dongsheng@635
|
11326 msgstr "在恢复处理中获得更多控制"
|
dongsheng@627
|
11327
|
dongsheng@627
|
11328 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11329 #: ../en/ch09-undo.xml:424
|
dongsheng@627
|
11330 msgid ""
|
dongsheng@627
|
11331 "While I've recommended that you always use the <option role=\"hg-opt-backout"
|
dongsheng@627
|
11332 "\">--merge</option> option when backing out a change, the <command role=\"hg-"
|
dongsheng@627
|
11333 "cmd\">hg backout</command> command lets you decide how to merge a backout "
|
dongsheng@627
|
11334 "changeset. Taking control of the backout process by hand is something you "
|
dongsheng@627
|
11335 "will rarely need to do, but it can be useful to understand what the <command "
|
dongsheng@627
|
11336 "role=\"hg-cmd\">hg backout</command> command is doing for you automatically. "
|
dongsheng@627
|
11337 "To illustrate this, let's clone our first repository, but omit the backout "
|
dongsheng@627
|
11338 "change that it contains."
|
dongsheng@627
|
11339 msgstr ""
|
dongsheng@627
|
11340
|
dongsheng@627
|
11341 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11342 #: ../en/ch09-undo.xml:437
|
dongsheng@627
|
11343 msgid ""
|
dongsheng@627
|
11344 "As with our earlier example, We'll commit a third changeset, then back out "
|
dongsheng@627
|
11345 "its parent, and see what happens."
|
dongsheng@627
|
11346 msgstr ""
|
dongsheng@627
|
11347
|
dongsheng@627
|
11348 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11349 #: ../en/ch09-undo.xml:443
|
dongsheng@627
|
11350 msgid ""
|
dongsheng@627
|
11351 "Our new changeset is again a descendant of the changeset we backout out; it's "
|
dongsheng@627
|
11352 "thus a new head, <emphasis>not</emphasis> a descendant of the changeset that "
|
dongsheng@627
|
11353 "was the tip. The <command role=\"hg-cmd\">hg backout</command> command was "
|
dongsheng@627
|
11354 "quite explicit in telling us this."
|
dongsheng@627
|
11355 msgstr ""
|
dongsheng@627
|
11356
|
dongsheng@627
|
11357 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11358 #: ../en/ch09-undo.xml:451
|
dongsheng@627
|
11359 msgid ""
|
dongsheng@627
|
11360 "Again, it's easier to see what has happened by looking at a graph of the "
|
songdongsheng@658
|
11361 "revision history, in <xref linkend=\"fig:undo:backout-manual\"/>. This makes "
|
songdongsheng@658
|
11362 "it clear that when we use <command role=\"hg-cmd\">hg backout</command> to "
|
songdongsheng@658
|
11363 "back out a change other than the tip, Mercurial adds a new head to the "
|
songdongsheng@658
|
11364 "repository (the change it committed is box-shaped)."
|
songdongsheng@658
|
11365 msgstr ""
|
songdongsheng@658
|
11366
|
songdongsheng@658
|
11367 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
|
dongsheng@714
|
11368 #: ../en/ch09-undo.xml:463
|
songdongsheng@658
|
11369 msgid "<imageobject><imagedata fileref=\"figs/undo-manual.png\"/></imageobject>"
|
songdongsheng@658
|
11370 msgstr ""
|
songdongsheng@658
|
11371
|
songdongsheng@658
|
11372 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11373 #: ../en/ch09-undo.xml:468
|
dongsheng@627
|
11374 msgid ""
|
dongsheng@627
|
11375 "After the <command role=\"hg-cmd\">hg backout</command> command has "
|
dongsheng@627
|
11376 "completed, it leaves the new <quote>backout</quote> changeset as the parent "
|
dongsheng@627
|
11377 "of the working directory."
|
dongsheng@627
|
11378 msgstr ""
|
dongsheng@627
|
11379
|
dongsheng@627
|
11380 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11381 #: ../en/ch09-undo.xml:475
|
dongsheng@627
|
11382 msgid "Now we have two isolated sets of changes."
|
dongsheng@627
|
11383 msgstr ""
|
dongsheng@627
|
11384
|
dongsheng@627
|
11385 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11386 #: ../en/ch09-undo.xml:479
|
dongsheng@627
|
11387 msgid ""
|
dongsheng@627
|
11388 "Let's think about what we expect to see as the contents of <filename>myfile</"
|
dongsheng@627
|
11389 "filename> now. The first change should be present, because we've never "
|
dongsheng@627
|
11390 "backed it out. The second change should be missing, as that's the change we "
|
dongsheng@627
|
11391 "backed out. Since the history graph shows the third change as a separate "
|
dongsheng@627
|
11392 "head, we <emphasis>don't</emphasis> expect to see the third change present in "
|
dongsheng@627
|
11393 "<filename>myfile</filename>."
|
dongsheng@627
|
11394 msgstr ""
|
dongsheng@627
|
11395
|
dongsheng@627
|
11396 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11397 #: ../en/ch09-undo.xml:489
|
dongsheng@627
|
11398 msgid ""
|
dongsheng@627
|
11399 "To get the third change back into the file, we just do a normal merge of our "
|
dongsheng@627
|
11400 "two heads."
|
dongsheng@627
|
11401 msgstr ""
|
dongsheng@627
|
11402
|
dongsheng@627
|
11403 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11404 #: ../en/ch09-undo.xml:494
|
songdongsheng@658
|
11405 msgid ""
|
songdongsheng@658
|
11406 "Afterwards, the graphical history of our repository looks like <xref linkend="
|
songdongsheng@658
|
11407 "\"fig:undo:backout-manual-merge\"/>."
|
songdongsheng@658
|
11408 msgstr ""
|
songdongsheng@658
|
11409
|
songdongsheng@658
|
11410 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
|
dongsheng@714
|
11411 #: ../en/ch09-undo.xml:499
|
dongsheng@627
|
11412 msgid "Manually merging a backout change"
|
dongsheng@660
|
11413 msgstr "手工合并恢复修改"
|
dongsheng@627
|
11414
|
songdongsheng@658
|
11415 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
|
dongsheng@714
|
11416 #: ../en/ch09-undo.xml:501
|
songdongsheng@658
|
11417 msgid ""
|
songdongsheng@658
|
11418 "<imageobject><imagedata fileref=\"figs/undo-manual-merge.png\"/></imageobject>"
|
songdongsheng@658
|
11419 msgstr ""
|
songdongsheng@658
|
11420
|
dongsheng@627
|
11421 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
11422 #: ../en/ch09-undo.xml:508
|
dongsheng@627
|
11423 msgid "Why <command role=\"hg-cmd\">hg backout</command> works as it does"
|
dongsheng@635
|
11424 msgstr "<command role=\"hg-cmd\">hg backout</command> 的内幕"
|
dongsheng@627
|
11425
|
dongsheng@627
|
11426 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11427 #: ../en/ch09-undo.xml:511
|
dongsheng@627
|
11428 msgid ""
|
dongsheng@627
|
11429 "Here's a brief description of how the <command role=\"hg-cmd\">hg backout</"
|
dongsheng@627
|
11430 "command> command works."
|
dongsheng@627
|
11431 msgstr ""
|
dongsheng@627
|
11432
|
dongsheng@627
|
11433 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
11434 #: ../en/ch09-undo.xml:514
|
dongsheng@627
|
11435 msgid ""
|
dongsheng@627
|
11436 "It ensures that the working directory is <quote>clean</quote>, i.e. that the "
|
dongsheng@627
|
11437 "output of <command role=\"hg-cmd\">hg status</command> would be empty."
|
dongsheng@627
|
11438 msgstr ""
|
dongsheng@627
|
11439
|
dongsheng@627
|
11440 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
11441 #: ../en/ch09-undo.xml:518
|
dongsheng@627
|
11442 msgid ""
|
dongsheng@627
|
11443 "It remembers the current parent of the working directory. Let's call this "
|
dongsheng@714
|
11444 "changeset <literal>orig</literal>."
|
dongsheng@627
|
11445 msgstr ""
|
dongsheng@627
|
11446
|
dongsheng@627
|
11447 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
11448 #: ../en/ch09-undo.xml:522
|
dongsheng@627
|
11449 msgid ""
|
dongsheng@627
|
11450 "It does the equivalent of a <command role=\"hg-cmd\">hg update</command> to "
|
dongsheng@627
|
11451 "sync the working directory to the changeset you want to back out. Let's call "
|
dongsheng@714
|
11452 "this changeset <literal>backout</literal>."
|
dongsheng@627
|
11453 msgstr ""
|
dongsheng@627
|
11454
|
dongsheng@627
|
11455 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
11456 #: ../en/ch09-undo.xml:527
|
dongsheng@627
|
11457 msgid ""
|
dongsheng@627
|
11458 "It finds the parent of that changeset. Let's call that changeset "
|
dongsheng@627
|
11459 "<literal>parent</literal>."
|
dongsheng@627
|
11460 msgstr ""
|
dongsheng@627
|
11461
|
dongsheng@627
|
11462 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
11463 #: ../en/ch09-undo.xml:530
|
dongsheng@627
|
11464 msgid ""
|
dongsheng@627
|
11465 "For each file that the <literal>backout</literal> changeset affected, it does "
|
dongsheng@627
|
11466 "the equivalent of a <command role=\"hg-cmd\">hg revert -r parent</command> on "
|
dongsheng@627
|
11467 "that file, to restore it to the contents it had before that changeset was "
|
dongsheng@627
|
11468 "committed."
|
dongsheng@627
|
11469 msgstr ""
|
dongsheng@627
|
11470
|
dongsheng@627
|
11471 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
11472 #: ../en/ch09-undo.xml:537
|
dongsheng@627
|
11473 msgid ""
|
dongsheng@627
|
11474 "It commits the result as a new changeset. This changeset has "
|
dongsheng@627
|
11475 "<literal>backout</literal> as its parent."
|
dongsheng@627
|
11476 msgstr ""
|
dongsheng@627
|
11477
|
dongsheng@627
|
11478 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
11479 #: ../en/ch09-undo.xml:541
|
dongsheng@627
|
11480 msgid ""
|
dongsheng@627
|
11481 "If you specify <option role=\"hg-opt-backout\">--merge</option> on the "
|
dongsheng@627
|
11482 "command line, it merges with <literal>orig</literal>, and commits the result "
|
dongsheng@627
|
11483 "of the merge."
|
dongsheng@627
|
11484 msgstr ""
|
dongsheng@627
|
11485
|
dongsheng@627
|
11486 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11487 #: ../en/ch09-undo.xml:547
|
dongsheng@627
|
11488 msgid ""
|
dongsheng@627
|
11489 "An alternative way to implement the <command role=\"hg-cmd\">hg backout</"
|
dongsheng@627
|
11490 "command> command would be to <command role=\"hg-cmd\">hg export</command> the "
|
dongsheng@627
|
11491 "to-be-backed-out changeset as a diff, then use the <option role=\"cmd-opt-"
|
dongsheng@627
|
11492 "patch\">--reverse</option> option to the <command>patch</command> command to "
|
dongsheng@627
|
11493 "reverse the effect of the change without fiddling with the working "
|
dongsheng@627
|
11494 "directory. This sounds much simpler, but it would not work nearly as well."
|
dongsheng@627
|
11495 msgstr ""
|
dongsheng@627
|
11496
|
dongsheng@627
|
11497 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11498 #: ../en/ch09-undo.xml:557
|
dongsheng@627
|
11499 msgid ""
|
dongsheng@627
|
11500 "The reason that <command role=\"hg-cmd\">hg backout</command> does an update, "
|
dongsheng@627
|
11501 "a commit, a merge, and another commit is to give the merge machinery the best "
|
dongsheng@627
|
11502 "chance to do a good job when dealing with all the changes <emphasis>between</"
|
dongsheng@627
|
11503 "emphasis> the change you're backing out and the current tip."
|
dongsheng@627
|
11504 msgstr ""
|
dongsheng@627
|
11505
|
dongsheng@627
|
11506 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11507 #: ../en/ch09-undo.xml:564
|
dongsheng@627
|
11508 msgid ""
|
dongsheng@627
|
11509 "If you're backing out a changeset that's 100 revisions back in your project's "
|
dongsheng@627
|
11510 "history, the chances that the <command>patch</command> command will be able "
|
dongsheng@627
|
11511 "to apply a reverse diff cleanly are not good, because intervening changes are "
|
dongsheng@627
|
11512 "likely to have <quote>broken the context</quote> that <command>patch</"
|
dongsheng@627
|
11513 "command> uses to determine whether it can apply a patch (if this sounds like "
|
songdongsheng@658
|
11514 "gibberish, see <xref linkend=\"sec:mq:patch\"/> for a discussion of the "
|
dongsheng@627
|
11515 "<command>patch</command> command). Also, Mercurial's merge machinery will "
|
dongsheng@627
|
11516 "handle files and directories being renamed, permission changes, and "
|
dongsheng@627
|
11517 "modifications to binary files, none of which <command>patch</command> can "
|
dongsheng@627
|
11518 "deal with."
|
dongsheng@627
|
11519 msgstr ""
|
dongsheng@627
|
11520
|
dongsheng@627
|
11521 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
11522 #: ../en/ch09-undo.xml:581
|
dongsheng@627
|
11523 msgid "Changes that should never have been"
|
dongsheng@635
|
11524 msgstr "不该发生的修改"
|
dongsheng@627
|
11525
|
dongsheng@627
|
11526 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11527 #: ../en/ch09-undo.xml:583
|
dongsheng@627
|
11528 msgid ""
|
dongsheng@627
|
11529 "Most of the time, the <command role=\"hg-cmd\">hg backout</command> command "
|
dongsheng@627
|
11530 "is exactly what you need if you want to undo the effects of a change. It "
|
dongsheng@627
|
11531 "leaves a permanent record of exactly what you did, both when committing the "
|
dongsheng@627
|
11532 "original changeset and when you cleaned up after it."
|
dongsheng@627
|
11533 msgstr ""
|
dongsheng@627
|
11534
|
dongsheng@627
|
11535 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11536 #: ../en/ch09-undo.xml:589
|
dongsheng@627
|
11537 msgid ""
|
dongsheng@627
|
11538 "On rare occasions, though, you may find that you've committed a change that "
|
dongsheng@627
|
11539 "really should not be present in the repository at all. For example, it would "
|
dongsheng@627
|
11540 "be very unusual, and usually considered a mistake, to commit a software "
|
dongsheng@627
|
11541 "project's object files as well as its source files. Object files have almost "
|
dongsheng@627
|
11542 "no intrinsic value, and they're <emphasis>big</emphasis>, so they increase "
|
dongsheng@627
|
11543 "the size of the repository and the amount of time it takes to clone or pull "
|
dongsheng@627
|
11544 "changes."
|
dongsheng@627
|
11545 msgstr ""
|
dongsheng@627
|
11546
|
dongsheng@627
|
11547 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11548 #: ../en/ch09-undo.xml:598
|
dongsheng@627
|
11549 msgid ""
|
dongsheng@627
|
11550 "Before I discuss the options that you have if you commit a <quote>brown paper "
|
dongsheng@627
|
11551 "bag</quote> change (the kind that's so bad that you want to pull a brown "
|
dongsheng@627
|
11552 "paper bag over your head), let me first discuss some approaches that probably "
|
dongsheng@627
|
11553 "won't work."
|
dongsheng@627
|
11554 msgstr ""
|
dongsheng@627
|
11555
|
dongsheng@627
|
11556 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11557 #: ../en/ch09-undo.xml:603
|
dongsheng@627
|
11558 msgid ""
|
songdongsheng@668
|
11559 "Since Mercurial treats history as accumulative&emdash;every change builds on "
|
songdongsheng@668
|
11560 "top of all changes that preceded it&emdash;you generally can't just make "
|
songdongsheng@668
|
11561 "disastrous changes disappear. The one exception is when you've just "
|
songdongsheng@668
|
11562 "committed a change, and it hasn't been pushed or pulled into another "
|
songdongsheng@668
|
11563 "repository. That's when you can safely use the <command role=\"hg-cmd\">hg "
|
songdongsheng@668
|
11564 "rollback</command> command, as I detailed in <xref linkend=\"sec:undo:rollback"
|
songdongsheng@668
|
11565 "\"/>."
|
songdongsheng@658
|
11566 msgstr ""
|
songdongsheng@658
|
11567
|
songdongsheng@658
|
11568 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11569 #: ../en/ch09-undo.xml:612
|
dongsheng@627
|
11570 msgid ""
|
dongsheng@627
|
11571 "After you've pushed a bad change to another repository, you <emphasis>could</"
|
dongsheng@627
|
11572 "emphasis> still use <command role=\"hg-cmd\">hg rollback</command> to make "
|
dongsheng@627
|
11573 "your local copy of the change disappear, but it won't have the consequences "
|
dongsheng@627
|
11574 "you want. The change will still be present in the remote repository, so it "
|
dongsheng@627
|
11575 "will reappear in your local repository the next time you pull."
|
dongsheng@627
|
11576 msgstr ""
|
dongsheng@627
|
11577
|
dongsheng@627
|
11578 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11579 #: ../en/ch09-undo.xml:620
|
dongsheng@627
|
11580 msgid ""
|
dongsheng@627
|
11581 "If a situation like this arises, and you know which repositories your bad "
|
dongsheng@627
|
11582 "change has propagated into, you can <emphasis>try</emphasis> to get rid of "
|
dongsheng@714
|
11583 "the change from <emphasis>every</emphasis> one of those repositories. This "
|
dongsheng@627
|
11584 "is, of course, not a satisfactory solution: if you miss even a single "
|
dongsheng@627
|
11585 "repository while you're expunging, the change is still <quote>in the wild</"
|
dongsheng@627
|
11586 "quote>, and could propagate further."
|
dongsheng@627
|
11587 msgstr ""
|
dongsheng@627
|
11588
|
dongsheng@627
|
11589 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11590 #: ../en/ch09-undo.xml:628
|
dongsheng@627
|
11591 msgid ""
|
dongsheng@627
|
11592 "If you've committed one or more changes <emphasis>after</emphasis> the change "
|
dongsheng@627
|
11593 "that you'd like to see disappear, your options are further reduced. Mercurial "
|
dongsheng@627
|
11594 "doesn't provide a way to <quote>punch a hole</quote> in history, leaving "
|
dongsheng@627
|
11595 "changesets intact."
|
dongsheng@627
|
11596 msgstr ""
|
dongsheng@627
|
11597
|
dongsheng@627
|
11598 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
11599 #: ../en/ch09-undo.xml:635
|
dongsheng@714
|
11600 msgid "Backing out a merge"
|
dongsheng@715
|
11601 msgstr "撤销一个合并"
|
dongsheng@714
|
11602
|
dongsheng@714
|
11603 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11604 #: ../en/ch09-undo.xml:637
|
dongsheng@714
|
11605 msgid ""
|
dongsheng@714
|
11606 "Since merges are often complicated, it is not unheard of for a merge to be "
|
dongsheng@714
|
11607 "mangled badly, but committed erroneously. Mercurial provides an important "
|
dongsheng@714
|
11608 "safeguard against bad merges by refusing to commit unresolved files, but "
|
dongsheng@714
|
11609 "human ingenuity guarantees that it is still possible to mess a merge up and "
|
dongsheng@714
|
11610 "commit it."
|
dongsheng@714
|
11611 msgstr ""
|
dongsheng@714
|
11612
|
dongsheng@714
|
11613 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11614 #: ../en/ch09-undo.xml:644
|
dongsheng@714
|
11615 msgid ""
|
dongsheng@714
|
11616 "Given a bad merge that has been committed, usually the best way to approach "
|
dongsheng@714
|
11617 "it is to simply try to repair the damage by hand. A complete disaster that "
|
dongsheng@714
|
11618 "cannot be easily fixed up by hand ought to be very rare, but the <command "
|
dongsheng@714
|
11619 "role=\"hg-cmd\">hg backout</command> command may help in making the cleanup "
|
dongsheng@714
|
11620 "easier. It offers a <option role=\"hg-opt-backout\">--parent</option> option, "
|
dongsheng@714
|
11621 "which lets you specify which parent to revert to when backing out a merge."
|
dongsheng@714
|
11622 msgstr ""
|
dongsheng@714
|
11623
|
dongsheng@714
|
11624 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
|
dongsheng@714
|
11625 #: ../en/ch09-undo.xml:655
|
dongsheng@714
|
11626 msgid "A bad merge"
|
dongsheng@716
|
11627 msgstr "错误的合并"
|
dongsheng@714
|
11628
|
dongsheng@714
|
11629 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
|
dongsheng@714
|
11630 #: ../en/ch09-undo.xml:657
|
dongsheng@714
|
11631 msgid "<imageobject><imagedata fileref=\"figs/bad-merge-1.png\"/></imageobject>"
|
dongsheng@714
|
11632 msgstr ""
|
dongsheng@714
|
11633
|
dongsheng@714
|
11634 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11635 #: ../en/ch09-undo.xml:662
|
dongsheng@714
|
11636 msgid ""
|
dongsheng@714
|
11637 "Suppose we have a revision graph like that in <xref linkend=\"fig:undo:bad-"
|
dongsheng@714
|
11638 "merge-1\"/>. What we'd like is to <emphasis>redo</emphasis> the merge of "
|
dongsheng@714
|
11639 "revisions 2 and 3."
|
dongsheng@714
|
11640 msgstr ""
|
dongsheng@714
|
11641
|
dongsheng@714
|
11642 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11643 #: ../en/ch09-undo.xml:667
|
dongsheng@714
|
11644 msgid "One way to do so would be as follows."
|
dongsheng@714
|
11645 msgstr ""
|
dongsheng@714
|
11646
|
dongsheng@714
|
11647 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
11648 #: ../en/ch09-undo.xml:671
|
dongsheng@714
|
11649 msgid ""
|
dongsheng@714
|
11650 "Call <command role=\"hg-cmd\">hg backout --rev=4 --parent=2</command>. This "
|
dongsheng@714
|
11651 "tells <command role=\"hg-cmd\">hg backout</command> to back out revision 4, "
|
dongsheng@714
|
11652 "which is the bad merge, and to when deciding which revision to prefer, to "
|
dongsheng@714
|
11653 "choose parent 2, one of the parents of the merge. The effect can be seen in "
|
dongsheng@714
|
11654 "<xref linkend=\"fig:undo:bad-merge-2\"/>."
|
dongsheng@714
|
11655 msgstr ""
|
dongsheng@714
|
11656
|
dongsheng@714
|
11657 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><figure><title>
|
dongsheng@714
|
11658 #: ../en/ch09-undo.xml:679
|
dongsheng@714
|
11659 msgid "Backing out the merge, favoring one parent"
|
dongsheng@715
|
11660 msgstr "拆除合并,关注一个父亲"
|
dongsheng@714
|
11661
|
dongsheng@714
|
11662 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><figure><mediaobject>
|
dongsheng@714
|
11663 #: ../en/ch09-undo.xml:681
|
dongsheng@714
|
11664 msgid "<imageobject><imagedata fileref=\"figs/bad-merge-2.png\"/></imageobject>"
|
dongsheng@714
|
11665 msgstr ""
|
dongsheng@715
|
11666 "<imageobject><imagedata fileref=\"figs/bad-merge-2.png\"/></imageobject>"
|
dongsheng@714
|
11667
|
dongsheng@714
|
11668 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
11669 #: ../en/ch09-undo.xml:688
|
dongsheng@714
|
11670 msgid ""
|
dongsheng@714
|
11671 "Call <command role=\"hg-cmd\">hg backout --rev=4 --parent=3</command>. This "
|
dongsheng@714
|
11672 "tells <command role=\"hg-cmd\">hg backout</command> to back out revision 4 "
|
dongsheng@714
|
11673 "again, but this time to choose parent 3, the other parent of the merge. The "
|
dongsheng@714
|
11674 "result is visible in <xref linkend=\"fig:undo:bad-merge-3\"/>, in which the "
|
dongsheng@714
|
11675 "repository now contains three heads."
|
dongsheng@714
|
11676 msgstr ""
|
dongsheng@714
|
11677
|
dongsheng@714
|
11678 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><figure><title>
|
dongsheng@714
|
11679 #: ../en/ch09-undo.xml:696
|
dongsheng@714
|
11680 msgid "Backing out the merge, favoring the other parent"
|
dongsheng@715
|
11681 msgstr "拆除合并,关注其它父亲"
|
dongsheng@714
|
11682
|
dongsheng@714
|
11683 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><figure><mediaobject>
|
dongsheng@714
|
11684 #: ../en/ch09-undo.xml:699
|
dongsheng@714
|
11685 msgid "<imageobject><imagedata fileref=\"figs/bad-merge-3.png\"/></imageobject>"
|
dongsheng@714
|
11686 msgstr ""
|
dongsheng@715
|
11687 "<imageobject><imagedata fileref=\"figs/bad-merge-3.png\"/></imageobject>"
|
dongsheng@714
|
11688
|
dongsheng@714
|
11689 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
11690 #: ../en/ch09-undo.xml:706
|
dongsheng@714
|
11691 msgid ""
|
dongsheng@714
|
11692 "Redo the bad merge by merging the two backout heads, which reduces the number "
|
dongsheng@714
|
11693 "of heads in the repository to two, as can be seen in <xref linkend=\"fig:undo:"
|
dongsheng@714
|
11694 "bad-merge-4\"/>."
|
dongsheng@714
|
11695 msgstr ""
|
dongsheng@714
|
11696
|
dongsheng@714
|
11697 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><figure><title>
|
dongsheng@714
|
11698 #: ../en/ch09-undo.xml:711 ../en/ch09-undo.xml:724
|
dongsheng@714
|
11699 msgid "Merging the backouts"
|
dongsheng@715
|
11700 msgstr "合并拆除"
|
dongsheng@714
|
11701
|
dongsheng@714
|
11702 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><figure><mediaobject>
|
dongsheng@714
|
11703 #: ../en/ch09-undo.xml:713
|
dongsheng@714
|
11704 msgid "<imageobject><imagedata fileref=\"figs/bad-merge-4.png\"/></imageobject>"
|
dongsheng@714
|
11705 msgstr ""
|
dongsheng@715
|
11706 "<imageobject><imagedata fileref=\"figs/bad-merge-4.png\"/></imageobject>"
|
dongsheng@714
|
11707
|
dongsheng@714
|
11708 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
11709 #: ../en/ch09-undo.xml:720
|
dongsheng@714
|
11710 msgid ""
|
dongsheng@714
|
11711 "Merge with the commit that was made after the bad merge, as shown in <xref "
|
dongsheng@714
|
11712 "linkend=\"fig:undo:bad-merge-5\"/>."
|
dongsheng@714
|
11713 msgstr ""
|
dongsheng@714
|
11714
|
dongsheng@714
|
11715 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><figure><mediaobject>
|
dongsheng@714
|
11716 #: ../en/ch09-undo.xml:726
|
dongsheng@714
|
11717 msgid "<imageobject><imagedata fileref=\"figs/bad-merge-5.png\"/></imageobject>"
|
dongsheng@714
|
11718 msgstr ""
|
dongsheng@714
|
11719
|
dongsheng@714
|
11720 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
11721 #: ../en/ch09-undo.xml:735
|
dongsheng@627
|
11722 msgid "Protect yourself from <quote>escaped</quote> changes"
|
dongsheng@635
|
11723 msgstr "使用<quote>校验</quote>修改来保护你自己"
|
dongsheng@627
|
11724
|
dongsheng@627
|
11725 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11726 #: ../en/ch09-undo.xml:738
|
dongsheng@627
|
11727 msgid ""
|
dongsheng@627
|
11728 "If you've committed some changes to your local repository and they've been "
|
dongsheng@627
|
11729 "pushed or pulled somewhere else, this isn't necessarily a disaster. You can "
|
dongsheng@627
|
11730 "protect yourself ahead of time against some classes of bad changeset. This "
|
dongsheng@627
|
11731 "is particularly easy if your team usually pulls changes from a central "
|
dongsheng@627
|
11732 "repository."
|
dongsheng@627
|
11733 msgstr ""
|
dongsheng@627
|
11734
|
dongsheng@627
|
11735 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11736 #: ../en/ch09-undo.xml:745
|
dongsheng@627
|
11737 msgid ""
|
dongsheng@627
|
11738 "By configuring some hooks on that repository to validate incoming changesets "
|
songdongsheng@658
|
11739 "(see chapter <xref linkend=\"chap:hook\"/>), you can automatically prevent "
|
dongsheng@627
|
11740 "some kinds of bad changeset from being pushed to the central repository at "
|
dongsheng@627
|
11741 "all. With such a configuration in place, some kinds of bad changeset will "
|
dongsheng@627
|
11742 "naturally tend to <quote>die out</quote> because they can't propagate into "
|
dongsheng@627
|
11743 "the central repository. Better yet, this happens without any need for "
|
dongsheng@627
|
11744 "explicit intervention."
|
dongsheng@627
|
11745 msgstr ""
|
dongsheng@627
|
11746
|
dongsheng@627
|
11747 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11748 #: ../en/ch09-undo.xml:755
|
dongsheng@627
|
11749 msgid ""
|
dongsheng@627
|
11750 "For instance, an incoming change hook that verifies that a changeset will "
|
dongsheng@714
|
11751 "actually compile can prevent people from inadvertently <quote>breaking the "
|
dongsheng@627
|
11752 "build</quote>."
|
dongsheng@627
|
11753 msgstr ""
|
dongsheng@627
|
11754
|
dongsheng@714
|
11755 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
11756 #: ../en/ch09-undo.xml:762
|
dongsheng@714
|
11757 msgid "What to do about sensitive changes that escape"
|
dongsheng@716
|
11758 msgstr "处理敏感信息泄漏的方法"
|
dongsheng@714
|
11759
|
dongsheng@714
|
11760 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11761 #: ../en/ch09-undo.xml:764
|
dongsheng@714
|
11762 msgid ""
|
dongsheng@714
|
11763 "Even a carefully run project can suffer an unfortunate event such as the "
|
dongsheng@714
|
11764 "committing and uncontrolled propagation of a file that contains important "
|
dongsheng@714
|
11765 "passwords."
|
dongsheng@714
|
11766 msgstr ""
|
dongsheng@714
|
11767
|
dongsheng@714
|
11768 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11769 #: ../en/ch09-undo.xml:768
|
dongsheng@714
|
11770 msgid ""
|
dongsheng@714
|
11771 "If something like this happens to you, and the information that gets "
|
dongsheng@714
|
11772 "accidentally propagated is truly sensitive, your first step should be to "
|
dongsheng@714
|
11773 "mitigate the effect of the leak without trying to control the leak itself. If "
|
dongsheng@714
|
11774 "you are not 100% certain that you know exactly who could have seen the "
|
dongsheng@714
|
11775 "changes, you should immediately change passwords, cancel credit cards, or "
|
dongsheng@714
|
11776 "find some other way to make sure that the information that has leaked is no "
|
dongsheng@714
|
11777 "longer useful. In other words, assume that the change has propagated far and "
|
dongsheng@714
|
11778 "wide, and that there's nothing more you can do."
|
dongsheng@714
|
11779 msgstr ""
|
dongsheng@714
|
11780
|
dongsheng@714
|
11781 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11782 #: ../en/ch09-undo.xml:779
|
dongsheng@714
|
11783 msgid ""
|
dongsheng@714
|
11784 "You might hope that there would be mechanisms you could use to either figure "
|
dongsheng@714
|
11785 "out who has seen a change or to erase the change permanently everywhere, but "
|
dongsheng@714
|
11786 "there are good reasons why these are not possible."
|
dongsheng@714
|
11787 msgstr ""
|
dongsheng@714
|
11788
|
dongsheng@714
|
11789 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11790 #: ../en/ch09-undo.xml:784
|
dongsheng@714
|
11791 msgid ""
|
dongsheng@714
|
11792 "Mercurial does not provide an audit trail of who has pulled changes from a "
|
dongsheng@714
|
11793 "repository, because it is usually either impossible to record such "
|
dongsheng@714
|
11794 "information or trivial to spoof it. In a multi-user or networked "
|
dongsheng@714
|
11795 "environment, you should thus be extremely skeptical of yourself if you think "
|
dongsheng@714
|
11796 "that you have identified every place that a sensitive changeset has "
|
dongsheng@714
|
11797 "propagated to. Don't forget that people can and will send bundles by email, "
|
dongsheng@714
|
11798 "have their backup software save data offsite, carry repositories on USB "
|
dongsheng@714
|
11799 "sticks, and find other completely innocent ways to confound your attempts to "
|
dongsheng@714
|
11800 "track down every copy of a problematic change."
|
dongsheng@714
|
11801 msgstr ""
|
dongsheng@714
|
11802
|
dongsheng@714
|
11803 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11804 #: ../en/ch09-undo.xml:796
|
dongsheng@714
|
11805 msgid ""
|
dongsheng@714
|
11806 "Mercurial also does not provide a way to make a file or changeset completely "
|
dongsheng@714
|
11807 "disappear from history, because there is no way to enforce its disappearance; "
|
dongsheng@714
|
11808 "someone could easily modify their copy of Mercurial to ignore such "
|
dongsheng@714
|
11809 "directives. In addition, even if Mercurial provided such a capability, "
|
dongsheng@714
|
11810 "someone who simply hadn't pulled a <quote>make this file disappear</quote> "
|
dongsheng@714
|
11811 "changeset wouldn't be affected by it, nor would web crawlers visiting at the "
|
dongsheng@714
|
11812 "wrong time, disk backups, or other mechanisms. Indeed, no distributed "
|
dongsheng@714
|
11813 "revision control system can make data reliably vanish. Providing the illusion "
|
dongsheng@714
|
11814 "of such control could easily give a false sense of security, and be worse "
|
dongsheng@714
|
11815 "than not providing it at all."
|
dongsheng@714
|
11816 msgstr ""
|
dongsheng@714
|
11817
|
dongsheng@627
|
11818 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
11819 #: ../en/ch09-undo.xml:812
|
dongsheng@627
|
11820 msgid "Finding the source of a bug"
|
dongsheng@635
|
11821 msgstr "查找问题的根源"
|
dongsheng@627
|
11822
|
dongsheng@627
|
11823 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11824 #: ../en/ch09-undo.xml:814
|
dongsheng@627
|
11825 msgid ""
|
dongsheng@627
|
11826 "While it's all very well to be able to back out a changeset that introduced a "
|
dongsheng@627
|
11827 "bug, this requires that you know which changeset to back out. Mercurial "
|
dongsheng@627
|
11828 "provides an invaluable command, called <command role=\"hg-cmd\">hg bisect</"
|
dongsheng@627
|
11829 "command>, that helps you to automate this process and accomplish it very "
|
dongsheng@627
|
11830 "efficiently."
|
dongsheng@627
|
11831 msgstr ""
|
dongsheng@627
|
11832
|
dongsheng@627
|
11833 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11834 #: ../en/ch09-undo.xml:821
|
dongsheng@627
|
11835 msgid ""
|
dongsheng@627
|
11836 "The idea behind the <command role=\"hg-cmd\">hg bisect</command> command is "
|
songdongsheng@710
|
11837 "that a changeset has introduced some change of behavior that you can identify "
|
dongsheng@714
|
11838 "with a simple pass/fail test. You don't know which piece of code introduced "
|
dongsheng@714
|
11839 "the change, but you know how to test for the presence of the bug. The "
|
dongsheng@714
|
11840 "<command role=\"hg-cmd\">hg bisect</command> command uses your test to direct "
|
dongsheng@714
|
11841 "its search for the changeset that introduced the code that caused the bug."
|
dongsheng@714
|
11842 msgstr ""
|
dongsheng@714
|
11843
|
dongsheng@714
|
11844 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11845 #: ../en/ch09-undo.xml:830
|
dongsheng@627
|
11846 msgid ""
|
dongsheng@627
|
11847 "Here are a few scenarios to help you understand how you might apply this "
|
dongsheng@627
|
11848 "command."
|
dongsheng@627
|
11849 msgstr ""
|
dongsheng@627
|
11850
|
dongsheng@627
|
11851 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
11852 #: ../en/ch09-undo.xml:833
|
dongsheng@627
|
11853 msgid ""
|
dongsheng@627
|
11854 "The most recent version of your software has a bug that you remember wasn't "
|
dongsheng@627
|
11855 "present a few weeks ago, but you don't know when it was introduced. Here, "
|
dongsheng@627
|
11856 "your binary test checks for the presence of that bug."
|
dongsheng@627
|
11857 msgstr ""
|
dongsheng@627
|
11858
|
dongsheng@627
|
11859 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
11860 #: ../en/ch09-undo.xml:838
|
dongsheng@627
|
11861 msgid ""
|
dongsheng@627
|
11862 "You fixed a bug in a rush, and now it's time to close the entry in your "
|
dongsheng@627
|
11863 "team's bug database. The bug database requires a changeset ID when you close "
|
dongsheng@627
|
11864 "an entry, but you don't remember which changeset you fixed the bug in. Once "
|
dongsheng@627
|
11865 "again, your binary test checks for the presence of the bug."
|
dongsheng@627
|
11866 msgstr ""
|
dongsheng@627
|
11867
|
dongsheng@627
|
11868 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
11869 #: ../en/ch09-undo.xml:845
|
dongsheng@627
|
11870 msgid ""
|
dongsheng@627
|
11871 "Your software works correctly, but runs 15% slower than the last time you "
|
dongsheng@627
|
11872 "measured it. You want to know which changeset introduced the performance "
|
dongsheng@627
|
11873 "regression. In this case, your binary test measures the performance of your "
|
dongsheng@627
|
11874 "software, to see whether it's <quote>fast</quote> or <quote>slow</quote>."
|
dongsheng@627
|
11875 msgstr ""
|
dongsheng@627
|
11876
|
dongsheng@627
|
11877 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
11878 #: ../en/ch09-undo.xml:852
|
dongsheng@627
|
11879 msgid ""
|
dongsheng@627
|
11880 "The sizes of the components of your project that you ship exploded recently, "
|
dongsheng@627
|
11881 "and you suspect that something changed in the way you build your project."
|
dongsheng@627
|
11882 msgstr ""
|
dongsheng@627
|
11883
|
dongsheng@627
|
11884 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11885 #: ../en/ch09-undo.xml:857
|
dongsheng@627
|
11886 msgid ""
|
dongsheng@627
|
11887 "From these examples, it should be clear that the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
11888 "bisect</command> command is not useful only for finding the sources of bugs. "
|
dongsheng@627
|
11889 "You can use it to find any <quote>emergent property</quote> of a repository "
|
dongsheng@627
|
11890 "(anything that you can't find from a simple text search of the files in the "
|
dongsheng@627
|
11891 "tree) for which you can write a binary test."
|
dongsheng@627
|
11892 msgstr ""
|
dongsheng@627
|
11893
|
dongsheng@627
|
11894 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11895 #: ../en/ch09-undo.xml:864
|
dongsheng@627
|
11896 msgid ""
|
dongsheng@627
|
11897 "We'll introduce a little bit of terminology here, just to make it clear which "
|
dongsheng@627
|
11898 "parts of the search process are your responsibility, and which are "
|
dongsheng@627
|
11899 "Mercurial's. A <emphasis>test</emphasis> is something that <emphasis>you</"
|
dongsheng@627
|
11900 "emphasis> run when <command role=\"hg-cmd\">hg bisect</command> chooses a "
|
dongsheng@627
|
11901 "changeset. A <emphasis>probe</emphasis> is what <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
11902 "bisect</command> runs to tell whether a revision is good. Finally, we'll use "
|
dongsheng@627
|
11903 "the word <quote>bisect</quote>, as both a noun and a verb, to stand in for "
|
dongsheng@627
|
11904 "the phrase <quote>search using the <command role=\"hg-cmd\">hg bisect</"
|
dongsheng@627
|
11905 "command> command</quote>."
|
dongsheng@627
|
11906 msgstr ""
|
dongsheng@627
|
11907
|
dongsheng@627
|
11908 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11909 #: ../en/ch09-undo.xml:877
|
dongsheng@627
|
11910 msgid ""
|
dongsheng@627
|
11911 "One simple way to automate the searching process would be simply to probe "
|
dongsheng@627
|
11912 "every changeset. However, this scales poorly. If it took ten minutes to "
|
dongsheng@627
|
11913 "test a single changeset, and you had 10,000 changesets in your repository, "
|
dongsheng@627
|
11914 "the exhaustive approach would take on average 35 <emphasis>days</emphasis> to "
|
dongsheng@627
|
11915 "find the changeset that introduced a bug. Even if you knew that the bug was "
|
dongsheng@627
|
11916 "introduced by one of the last 500 changesets, and limited your search to "
|
dongsheng@627
|
11917 "those, you'd still be looking at over 40 hours to find the changeset that "
|
dongsheng@627
|
11918 "introduced your bug."
|
dongsheng@627
|
11919 msgstr ""
|
dongsheng@627
|
11920
|
dongsheng@627
|
11921 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11922 #: ../en/ch09-undo.xml:887
|
dongsheng@627
|
11923 msgid ""
|
dongsheng@627
|
11924 "What the <command role=\"hg-cmd\">hg bisect</command> command does is use its "
|
dongsheng@627
|
11925 "knowledge of the <quote>shape</quote> of your project's revision history to "
|
dongsheng@627
|
11926 "perform a search in time proportional to the <emphasis>logarithm</emphasis> "
|
dongsheng@627
|
11927 "of the number of changesets to check (the kind of search it performs is "
|
dongsheng@627
|
11928 "called a dichotomic search). With this approach, searching through 10,000 "
|
dongsheng@627
|
11929 "changesets will take less than three hours, even at ten minutes per test (the "
|
dongsheng@627
|
11930 "search will require about 14 tests). Limit your search to the last hundred "
|
dongsheng@627
|
11931 "changesets, and it will take only about an hour (roughly seven tests)."
|
dongsheng@627
|
11932 msgstr ""
|
dongsheng@627
|
11933
|
dongsheng@627
|
11934 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
11935 #: ../en/ch09-undo.xml:898
|
dongsheng@627
|
11936 msgid ""
|
dongsheng@627
|
11937 "The <command role=\"hg-cmd\">hg bisect</command> command is aware of the "
|
dongsheng@627
|
11938 "<quote>branchy</quote> nature of a Mercurial project's revision history, so "
|
dongsheng@627
|
11939 "it has no problems dealing with branches, merges, or multiple heads in a "
|
dongsheng@627
|
11940 "repository. It can prune entire branches of history with a single probe, "
|
dongsheng@627
|
11941 "which is how it operates so efficiently."
|
dongsheng@627
|
11942 msgstr ""
|
dongsheng@627
|
11943
|
dongsheng@627
|
11944 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
11945 #: ../en/ch09-undo.xml:906
|
dongsheng@627
|
11946 msgid "Using the <command role=\"hg-cmd\">hg bisect</command> command"
|
dongsheng@635
|
11947 msgstr "使用命令 <command role=\"hg-cmd\">hg bisect</command>"
|
dongsheng@627
|
11948
|
dongsheng@627
|
11949 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11950 #: ../en/ch09-undo.xml:909
|
dongsheng@627
|
11951 msgid ""
|
dongsheng@627
|
11952 "Here's an example of <command role=\"hg-cmd\">hg bisect</command> in action."
|
dongsheng@627
|
11953 msgstr ""
|
dongsheng@627
|
11954
|
dongsheng@627
|
11955 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@714
|
11956 #: ../en/ch09-undo.xml:913
|
dongsheng@627
|
11957 msgid ""
|
dongsheng@627
|
11958 "In versions 0.9.5 and earlier of Mercurial, <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
11959 "bisect</command> was not a core command: it was distributed with Mercurial as "
|
dongsheng@627
|
11960 "an extension. This section describes the built-in command, not the old "
|
dongsheng@627
|
11961 "extension."
|
dongsheng@627
|
11962 msgstr ""
|
dongsheng@627
|
11963
|
dongsheng@627
|
11964 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11965 #: ../en/ch09-undo.xml:920
|
dongsheng@627
|
11966 msgid ""
|
dongsheng@627
|
11967 "Now let's create a repository, so that we can try out the <command role=\"hg-"
|
dongsheng@627
|
11968 "cmd\">hg bisect</command> command in isolation."
|
dongsheng@627
|
11969 msgstr ""
|
dongsheng@627
|
11970
|
dongsheng@627
|
11971 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11972 #: ../en/ch09-undo.xml:926
|
dongsheng@627
|
11973 msgid ""
|
dongsheng@627
|
11974 "We'll simulate a project that has a bug in it in a simple-minded way: create "
|
dongsheng@627
|
11975 "trivial changes in a loop, and nominate one specific change that will have "
|
dongsheng@627
|
11976 "the <quote>bug</quote>. This loop creates 35 changesets, each adding a "
|
dongsheng@627
|
11977 "single file to the repository. We'll represent our <quote>bug</quote> with a "
|
dongsheng@627
|
11978 "file that contains the text <quote>i have a gub</quote>."
|
dongsheng@627
|
11979 msgstr ""
|
dongsheng@627
|
11980
|
dongsheng@627
|
11981 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11982 #: ../en/ch09-undo.xml:936
|
dongsheng@627
|
11983 msgid ""
|
dongsheng@627
|
11984 "The next thing that we'd like to do is figure out how to use the <command "
|
dongsheng@627
|
11985 "role=\"hg-cmd\">hg bisect</command> command. We can use Mercurial's normal "
|
dongsheng@627
|
11986 "built-in help mechanism for this."
|
dongsheng@627
|
11987 msgstr ""
|
dongsheng@627
|
11988
|
dongsheng@627
|
11989 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
11990 #: ../en/ch09-undo.xml:943
|
dongsheng@627
|
11991 msgid ""
|
dongsheng@627
|
11992 "The <command role=\"hg-cmd\">hg bisect</command> command works in steps. "
|
dongsheng@627
|
11993 "Each step proceeds as follows."
|
dongsheng@627
|
11994 msgstr ""
|
dongsheng@627
|
11995
|
dongsheng@627
|
11996 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
11997 #: ../en/ch09-undo.xml:946
|
dongsheng@627
|
11998 msgid "You run your binary test."
|
dongsheng@627
|
11999 msgstr ""
|
dongsheng@627
|
12000
|
dongsheng@627
|
12001 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><itemizedlist><listitem><para>
|
dongsheng@714
|
12002 #: ../en/ch09-undo.xml:948
|
dongsheng@627
|
12003 msgid ""
|
dongsheng@627
|
12004 "If the test succeeded, you tell <command role=\"hg-cmd\">hg bisect</command> "
|
dongsheng@714
|
12005 "by running the <command role=\"hg-cmd\">hg bisect --good</command> command."
|
dongsheng@715
|
12006 msgstr ""
|
dongsheng@715
|
12007 "当测试成功后,使用 <command role=\"hg-cmd\">hg bisect --good</command> 命令告"
|
dongsheng@715
|
12008 "诉 <command role=\"hg-cmd\">hg bisect</command> 命令。"
|
dongsheng@627
|
12009
|
dongsheng@627
|
12010 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><itemizedlist><listitem><para>
|
dongsheng@714
|
12011 #: ../en/ch09-undo.xml:953
|
dongsheng@714
|
12012 msgid ""
|
dongsheng@714
|
12013 "If it failed, run the <command role=\"hg-cmd\">hg bisect --bad</command> "
|
dongsheng@627
|
12014 "command."
|
dongsheng@715
|
12015 msgstr ""
|
dongsheng@715
|
12016 "如果失败,执行 <command role=\"hg-cmd\">hg bisect --bad</command> 命令。"
|
dongsheng@627
|
12017
|
dongsheng@627
|
12018 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
12019 #: ../en/ch09-undo.xml:957
|
dongsheng@627
|
12020 msgid ""
|
dongsheng@627
|
12021 "The command uses your information to decide which changeset to test next."
|
dongsheng@627
|
12022 msgstr ""
|
dongsheng@627
|
12023
|
dongsheng@627
|
12024 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
|
dongsheng@714
|
12025 #: ../en/ch09-undo.xml:960
|
dongsheng@627
|
12026 msgid ""
|
dongsheng@627
|
12027 "It updates the working directory to that changeset, and the process begins "
|
dongsheng@627
|
12028 "again."
|
dongsheng@627
|
12029 msgstr ""
|
dongsheng@627
|
12030
|
dongsheng@627
|
12031 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12032 #: ../en/ch09-undo.xml:963
|
dongsheng@627
|
12033 msgid ""
|
dongsheng@627
|
12034 "The process ends when <command role=\"hg-cmd\">hg bisect</command> identifies "
|
dongsheng@627
|
12035 "a unique changeset that marks the point where your test transitioned from "
|
dongsheng@627
|
12036 "<quote>succeeding</quote> to <quote>failing</quote>."
|
dongsheng@627
|
12037 msgstr ""
|
dongsheng@627
|
12038
|
dongsheng@627
|
12039 #
|
dongsheng@627
|
12040 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12041 #: ../en/ch09-undo.xml:968
|
dongsheng@627
|
12042 msgid ""
|
dongsheng@627
|
12043 "To start the search, we must run the <command role=\"hg-cmd\">hg bisect --"
|
dongsheng@627
|
12044 "reset</command> command."
|
dongsheng@627
|
12045 msgstr ""
|
dongsheng@627
|
12046
|
dongsheng@627
|
12047 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12048 #: ../en/ch09-undo.xml:973
|
dongsheng@627
|
12049 msgid ""
|
dongsheng@627
|
12050 "In our case, the binary test we use is simple: we check to see if any file in "
|
dongsheng@627
|
12051 "the repository contains the string <quote>i have a gub</quote>. If it does, "
|
dongsheng@627
|
12052 "this changeset contains the change that <quote>caused the bug</quote>. By "
|
dongsheng@627
|
12053 "convention, a changeset that has the property we're searching for is "
|
dongsheng@627
|
12054 "<quote>bad</quote>, while one that doesn't is <quote>good</quote>."
|
dongsheng@627
|
12055 msgstr ""
|
dongsheng@627
|
12056
|
dongsheng@627
|
12057 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12058 #: ../en/ch09-undo.xml:981
|
dongsheng@627
|
12059 msgid ""
|
dongsheng@627
|
12060 "Most of the time, the revision to which the working directory is synced "
|
dongsheng@627
|
12061 "(usually the tip) already exhibits the problem introduced by the buggy "
|
dongsheng@627
|
12062 "change, so we'll mark it as <quote>bad</quote>."
|
dongsheng@627
|
12063 msgstr ""
|
dongsheng@627
|
12064
|
dongsheng@627
|
12065 #
|
dongsheng@627
|
12066 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12067 #: ../en/ch09-undo.xml:988
|
dongsheng@627
|
12068 msgid ""
|
dongsheng@627
|
12069 "Our next task is to nominate a changeset that we know <emphasis>doesn't</"
|
dongsheng@627
|
12070 "emphasis> have the bug; the <command role=\"hg-cmd\">hg bisect</command> "
|
dongsheng@627
|
12071 "command will <quote>bracket</quote> its search between the first pair of good "
|
dongsheng@627
|
12072 "and bad changesets. In our case, we know that revision 10 didn't have the "
|
dongsheng@627
|
12073 "bug. (I'll have more words about choosing the first <quote>good</quote> "
|
dongsheng@627
|
12074 "changeset later.)"
|
dongsheng@627
|
12075 msgstr ""
|
dongsheng@627
|
12076
|
dongsheng@627
|
12077 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12078 #: ../en/ch09-undo.xml:998
|
dongsheng@627
|
12079 msgid "Notice that this command printed some output."
|
dongsheng@627
|
12080 msgstr ""
|
dongsheng@627
|
12081
|
dongsheng@627
|
12082 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
12083 #: ../en/ch09-undo.xml:1000
|
dongsheng@627
|
12084 msgid ""
|
dongsheng@627
|
12085 "It told us how many changesets it must consider before it can identify the "
|
dongsheng@627
|
12086 "one that introduced the bug, and how many tests that will require."
|
dongsheng@627
|
12087 msgstr ""
|
dongsheng@627
|
12088
|
dongsheng@627
|
12089 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
12090 #: ../en/ch09-undo.xml:1004
|
dongsheng@627
|
12091 msgid ""
|
dongsheng@627
|
12092 "It updated the working directory to the next changeset to test, and told us "
|
dongsheng@627
|
12093 "which changeset it's testing."
|
dongsheng@627
|
12094 msgstr ""
|
dongsheng@627
|
12095
|
dongsheng@627
|
12096 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12097 #: ../en/ch09-undo.xml:1009
|
dongsheng@627
|
12098 msgid ""
|
dongsheng@627
|
12099 "We now run our test in the working directory. We use the <command>grep</"
|
dongsheng@627
|
12100 "command> command to see if our <quote>bad</quote> file is present in the "
|
dongsheng@627
|
12101 "working directory. If it is, this revision is bad; if not, this revision is "
|
dongsheng@627
|
12102 "good. &interaction.bisect.search.step1;"
|
dongsheng@627
|
12103 msgstr ""
|
dongsheng@627
|
12104
|
dongsheng@627
|
12105 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12106 #: ../en/ch09-undo.xml:1015
|
dongsheng@627
|
12107 msgid ""
|
dongsheng@627
|
12108 "This test looks like a perfect candidate for automation, so let's turn it "
|
dongsheng@627
|
12109 "into a shell function."
|
dongsheng@627
|
12110 msgstr ""
|
dongsheng@627
|
12111
|
dongsheng@627
|
12112 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12113 #: ../en/ch09-undo.xml:1019
|
dongsheng@627
|
12114 msgid ""
|
dongsheng@627
|
12115 "We can now run an entire test step with a single command, <literal>mytest</"
|
dongsheng@627
|
12116 "literal>."
|
dongsheng@627
|
12117 msgstr ""
|
dongsheng@627
|
12118
|
dongsheng@627
|
12119 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12120 #: ../en/ch09-undo.xml:1024
|
dongsheng@627
|
12121 msgid "A few more invocations of our canned test step command, and we're done."
|
dongsheng@627
|
12122 msgstr ""
|
dongsheng@627
|
12123
|
dongsheng@627
|
12124 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12125 #: ../en/ch09-undo.xml:1029
|
dongsheng@627
|
12126 msgid ""
|
dongsheng@627
|
12127 "Even though we had 40 changesets to search through, the <command role=\"hg-cmd"
|
dongsheng@627
|
12128 "\">hg bisect</command> command let us find the changeset that introduced our "
|
dongsheng@627
|
12129 "<quote>bug</quote> with only five tests. Because the number of tests that "
|
dongsheng@627
|
12130 "the <command role=\"hg-cmd\">hg bisect</command> command performs grows "
|
dongsheng@627
|
12131 "logarithmically with the number of changesets to search, the advantage that "
|
dongsheng@627
|
12132 "it has over the <quote>brute force</quote> search approach increases with "
|
dongsheng@627
|
12133 "every changeset you add."
|
dongsheng@627
|
12134 msgstr ""
|
dongsheng@627
|
12135
|
dongsheng@627
|
12136 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
12137 #: ../en/ch09-undo.xml:1040
|
dongsheng@627
|
12138 msgid "Cleaning up after your search"
|
dongsheng@635
|
12139 msgstr "搜索后的清理"
|
dongsheng@627
|
12140
|
dongsheng@714
|
12141 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12142 #: ../en/ch09-undo.xml:1042
|
dongsheng@627
|
12143 msgid ""
|
dongsheng@627
|
12144 "When you're finished using the <command role=\"hg-cmd\">hg bisect</command> "
|
dongsheng@714
|
12145 "command in a repository, you can use the <command role=\"hg-cmd\">hg bisect --"
|
dongsheng@627
|
12146 "reset</command> command to drop the information it was using to drive your "
|
dongsheng@627
|
12147 "search. The command doesn't use much space, so it doesn't matter if you "
|
dongsheng@627
|
12148 "forget to run this command. However, <command role=\"hg-cmd\">hg bisect</"
|
dongsheng@627
|
12149 "command> won't let you start a new search in that repository until you do a "
|
dongsheng@714
|
12150 "<command role=\"hg-cmd\">hg bisect --reset</command>."
|
dongsheng@627
|
12151 msgstr ""
|
dongsheng@627
|
12152
|
dongsheng@627
|
12153 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
12154 #: ../en/ch09-undo.xml:1057
|
dongsheng@627
|
12155 msgid "Tips for finding bugs effectively"
|
dongsheng@635
|
12156 msgstr "有效查找问题的技巧"
|
dongsheng@627
|
12157
|
dongsheng@627
|
12158 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
12159 #: ../en/ch09-undo.xml:1060
|
dongsheng@627
|
12160 msgid "Give consistent input"
|
dongsheng@635
|
12161 msgstr "给出一致的输入"
|
dongsheng@627
|
12162
|
dongsheng@627
|
12163 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12164 #: ../en/ch09-undo.xml:1062
|
dongsheng@627
|
12165 msgid ""
|
dongsheng@627
|
12166 "The <command role=\"hg-cmd\">hg bisect</command> command requires that you "
|
dongsheng@627
|
12167 "correctly report the result of every test you perform. If you tell it that a "
|
dongsheng@627
|
12168 "test failed when it really succeeded, it <emphasis>might</emphasis> be able "
|
dongsheng@627
|
12169 "to detect the inconsistency. If it can identify an inconsistency in your "
|
dongsheng@627
|
12170 "reports, it will tell you that a particular changeset is both good and bad. "
|
dongsheng@627
|
12171 "However, it can't do this perfectly; it's about as likely to report the wrong "
|
dongsheng@627
|
12172 "changeset as the source of the bug."
|
dongsheng@627
|
12173 msgstr ""
|
dongsheng@627
|
12174
|
dongsheng@627
|
12175 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
12176 #: ../en/ch09-undo.xml:1074
|
dongsheng@627
|
12177 msgid "Automate as much as possible"
|
dongsheng@635
|
12178 msgstr "尽量自动"
|
dongsheng@627
|
12179
|
dongsheng@627
|
12180 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12181 #: ../en/ch09-undo.xml:1076
|
dongsheng@627
|
12182 msgid ""
|
dongsheng@627
|
12183 "When I started using the <command role=\"hg-cmd\">hg bisect</command> "
|
dongsheng@627
|
12184 "command, I tried a few times to run my tests by hand, on the command line. "
|
dongsheng@627
|
12185 "This is an approach that I, at least, am not suited to. After a few tries, I "
|
dongsheng@627
|
12186 "found that I was making enough mistakes that I was having to restart my "
|
dongsheng@627
|
12187 "searches several times before finally getting correct results."
|
dongsheng@627
|
12188 msgstr ""
|
dongsheng@627
|
12189
|
dongsheng@627
|
12190 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12191 #: ../en/ch09-undo.xml:1084
|
dongsheng@627
|
12192 msgid ""
|
dongsheng@627
|
12193 "My initial problems with driving the <command role=\"hg-cmd\">hg bisect</"
|
dongsheng@627
|
12194 "command> command by hand occurred even with simple searches on small "
|
dongsheng@627
|
12195 "repositories; if the problem you're looking for is more subtle, or the number "
|
dongsheng@627
|
12196 "of tests that <command role=\"hg-cmd\">hg bisect</command> must perform "
|
dongsheng@627
|
12197 "increases, the likelihood of operator error ruining the search is much "
|
dongsheng@627
|
12198 "higher. Once I started automating my tests, I had much better results."
|
dongsheng@627
|
12199 msgstr ""
|
dongsheng@627
|
12200
|
dongsheng@627
|
12201 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12202 #: ../en/ch09-undo.xml:1093
|
dongsheng@627
|
12203 msgid "The key to automated testing is twofold:"
|
dongsheng@627
|
12204 msgstr ""
|
dongsheng@627
|
12205
|
dongsheng@627
|
12206 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
12207 #: ../en/ch09-undo.xml:1095
|
dongsheng@627
|
12208 msgid "always test for the same symptom, and"
|
dongsheng@627
|
12209 msgstr ""
|
dongsheng@627
|
12210
|
dongsheng@627
|
12211 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
12212 #: ../en/ch09-undo.xml:1097
|
dongsheng@627
|
12213 msgid ""
|
dongsheng@627
|
12214 "always feed consistent input to the <command role=\"hg-cmd\">hg bisect</"
|
dongsheng@627
|
12215 "command> command."
|
dongsheng@627
|
12216 msgstr ""
|
dongsheng@627
|
12217
|
dongsheng@627
|
12218 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12219 #: ../en/ch09-undo.xml:1100
|
dongsheng@627
|
12220 msgid ""
|
dongsheng@627
|
12221 "In my tutorial example above, the <command>grep</command> command tests for "
|
dongsheng@627
|
12222 "the symptom, and the <literal>if</literal> statement takes the result of this "
|
dongsheng@627
|
12223 "check and ensures that we always feed the same input to the <command role="
|
dongsheng@627
|
12224 "\"hg-cmd\">hg bisect</command> command. The <literal>mytest</literal> "
|
dongsheng@627
|
12225 "function marries these together in a reproducible way, so that every test is "
|
dongsheng@627
|
12226 "uniform and consistent."
|
dongsheng@627
|
12227 msgstr ""
|
dongsheng@627
|
12228
|
dongsheng@627
|
12229 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
12230 #: ../en/ch09-undo.xml:1110
|
dongsheng@627
|
12231 msgid "Check your results"
|
dongsheng@635
|
12232 msgstr "检查你的结果"
|
dongsheng@627
|
12233
|
dongsheng@627
|
12234 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12235 #: ../en/ch09-undo.xml:1112
|
dongsheng@627
|
12236 msgid ""
|
dongsheng@627
|
12237 "Because the output of a <command role=\"hg-cmd\">hg bisect</command> search "
|
dongsheng@627
|
12238 "is only as good as the input you give it, don't take the changeset it reports "
|
dongsheng@627
|
12239 "as the absolute truth. A simple way to cross-check its report is to manually "
|
dongsheng@627
|
12240 "run your test at each of the following changesets:"
|
dongsheng@627
|
12241 msgstr ""
|
dongsheng@627
|
12242
|
dongsheng@627
|
12243 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
12244 #: ../en/ch09-undo.xml:1118
|
dongsheng@627
|
12245 msgid ""
|
dongsheng@627
|
12246 "The changeset that it reports as the first bad revision. Your test should "
|
dongsheng@627
|
12247 "still report this as bad."
|
dongsheng@627
|
12248 msgstr ""
|
dongsheng@627
|
12249
|
dongsheng@627
|
12250 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
12251 #: ../en/ch09-undo.xml:1122
|
dongsheng@627
|
12252 msgid ""
|
dongsheng@627
|
12253 "The parent of that changeset (either parent, if it's a merge). Your test "
|
dongsheng@627
|
12254 "should report this changeset as good."
|
dongsheng@627
|
12255 msgstr ""
|
dongsheng@627
|
12256
|
dongsheng@627
|
12257 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
12258 #: ../en/ch09-undo.xml:1126
|
dongsheng@627
|
12259 msgid ""
|
dongsheng@627
|
12260 "A child of that changeset. Your test should report this changeset as bad."
|
dongsheng@627
|
12261 msgstr ""
|
dongsheng@627
|
12262
|
dongsheng@627
|
12263 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
12264 #: ../en/ch09-undo.xml:1132
|
dongsheng@627
|
12265 msgid "Beware interference between bugs"
|
dongsheng@635
|
12266 msgstr "谨防问题之间的冲突"
|
dongsheng@627
|
12267
|
dongsheng@627
|
12268 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12269 #: ../en/ch09-undo.xml:1134
|
dongsheng@627
|
12270 msgid ""
|
dongsheng@627
|
12271 "It's possible that your search for one bug could be disrupted by the presence "
|
dongsheng@627
|
12272 "of another. For example, let's say your software crashes at revision 100, "
|
dongsheng@627
|
12273 "and worked correctly at revision 50. Unknown to you, someone else introduced "
|
dongsheng@627
|
12274 "a different crashing bug at revision 60, and fixed it at revision 80. This "
|
dongsheng@627
|
12275 "could distort your results in one of several ways."
|
dongsheng@627
|
12276 msgstr ""
|
dongsheng@627
|
12277
|
dongsheng@627
|
12278 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12279 #: ../en/ch09-undo.xml:1142
|
dongsheng@627
|
12280 msgid ""
|
dongsheng@627
|
12281 "It is possible that this other bug completely <quote>masks</quote> yours, "
|
dongsheng@627
|
12282 "which is to say that it occurs before your bug has a chance to manifest "
|
dongsheng@627
|
12283 "itself. If you can't avoid that other bug (for example, it prevents your "
|
dongsheng@627
|
12284 "project from building), and so can't tell whether your bug is present in a "
|
dongsheng@627
|
12285 "particular changeset, the <command role=\"hg-cmd\">hg bisect</command> "
|
dongsheng@627
|
12286 "command cannot help you directly. Instead, you can mark a changeset as "
|
dongsheng@627
|
12287 "untested by running <command role=\"hg-cmd\">hg bisect --skip</command>."
|
dongsheng@627
|
12288 msgstr ""
|
dongsheng@627
|
12289
|
dongsheng@627
|
12290 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12291 #: ../en/ch09-undo.xml:1152
|
dongsheng@627
|
12292 msgid ""
|
dongsheng@627
|
12293 "A different problem could arise if your test for a bug's presence is not "
|
dongsheng@627
|
12294 "specific enough. If you check for <quote>my program crashes</quote>, then "
|
dongsheng@627
|
12295 "both your crashing bug and an unrelated crashing bug that masks it will look "
|
dongsheng@627
|
12296 "like the same thing, and mislead <command role=\"hg-cmd\">hg bisect</command>."
|
dongsheng@627
|
12297 msgstr ""
|
dongsheng@627
|
12298
|
dongsheng@627
|
12299 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12300 #: ../en/ch09-undo.xml:1159
|
dongsheng@627
|
12301 msgid ""
|
dongsheng@627
|
12302 "Another useful situation in which to use <command role=\"hg-cmd\">hg bisect --"
|
dongsheng@627
|
12303 "skip</command> is if you can't test a revision because your project was in a "
|
dongsheng@627
|
12304 "broken and hence untestable state at that revision, perhaps because someone "
|
dongsheng@627
|
12305 "checked in a change that prevented the project from building."
|
dongsheng@627
|
12306 msgstr ""
|
dongsheng@627
|
12307
|
dongsheng@627
|
12308 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
12309 #: ../en/ch09-undo.xml:1168
|
dongsheng@627
|
12310 msgid "Bracket your search lazily"
|
dongsheng@635
|
12311 msgstr "减少你的查找工作"
|
dongsheng@627
|
12312
|
dongsheng@627
|
12313 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12314 #: ../en/ch09-undo.xml:1170
|
dongsheng@627
|
12315 msgid ""
|
dongsheng@627
|
12316 "Choosing the first <quote>good</quote> and <quote>bad</quote> changesets that "
|
dongsheng@627
|
12317 "will mark the end points of your search is often easy, but it bears a little "
|
dongsheng@627
|
12318 "discussion nevertheless. From the perspective of <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
12319 "bisect</command>, the <quote>newest</quote> changeset is conventionally "
|
dongsheng@627
|
12320 "<quote>bad</quote>, and the older changeset is <quote>good</quote>."
|
dongsheng@627
|
12321 msgstr ""
|
dongsheng@627
|
12322
|
dongsheng@627
|
12323 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12324 #: ../en/ch09-undo.xml:1178
|
dongsheng@627
|
12325 msgid ""
|
dongsheng@627
|
12326 "If you're having trouble remembering when a suitable <quote>good</quote> "
|
dongsheng@627
|
12327 "change was, so that you can tell <command role=\"hg-cmd\">hg bisect</"
|
dongsheng@627
|
12328 "command>, you could do worse than testing changesets at random. Just "
|
dongsheng@627
|
12329 "remember to eliminate contenders that can't possibly exhibit the bug (perhaps "
|
dongsheng@627
|
12330 "because the feature with the bug isn't present yet) and those where another "
|
dongsheng@627
|
12331 "problem masks the bug (as I discussed above)."
|
dongsheng@627
|
12332 msgstr ""
|
dongsheng@627
|
12333
|
dongsheng@627
|
12334 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12335 #: ../en/ch09-undo.xml:1187
|
dongsheng@627
|
12336 msgid ""
|
dongsheng@627
|
12337 "Even if you end up <quote>early</quote> by thousands of changesets or months "
|
dongsheng@627
|
12338 "of history, you will only add a handful of tests to the total number that "
|
dongsheng@627
|
12339 "<command role=\"hg-cmd\">hg bisect</command> must perform, thanks to its "
|
songdongsheng@710
|
12340 "logarithmic behavior."
|
dongsheng@627
|
12341 msgstr ""
|
dongsheng@627
|
12342
|
dongsheng@627
|
12343 #. type: Content of: <book><chapter><title>
|
dongsheng@714
|
12344 #: ../en/ch10-hook.xml:5
|
dongsheng@627
|
12345 msgid "Handling repository events with hooks"
|
dongsheng@627
|
12346 msgstr "使用钩子处理版本库事件"
|
dongsheng@627
|
12347
|
dongsheng@627
|
12348 #. type: Content of: <book><chapter><para>
|
dongsheng@714
|
12349 #: ../en/ch10-hook.xml:7
|
dongsheng@627
|
12350 msgid ""
|
dongsheng@627
|
12351 "Mercurial offers a powerful mechanism to let you perform automated actions in "
|
dongsheng@627
|
12352 "response to events that occur in a repository. In some cases, you can even "
|
dongsheng@627
|
12353 "control Mercurial's response to those events."
|
dongsheng@627
|
12354 msgstr ""
|
dongsheng@627
|
12355
|
dongsheng@627
|
12356 #. type: Content of: <book><chapter><para>
|
dongsheng@714
|
12357 #: ../en/ch10-hook.xml:12
|
dongsheng@627
|
12358 msgid ""
|
dongsheng@627
|
12359 "The name Mercurial uses for one of these actions is a <emphasis>hook</"
|
dongsheng@627
|
12360 "emphasis>. Hooks are called <quote>triggers</quote> in some revision control "
|
dongsheng@627
|
12361 "systems, but the two names refer to the same idea."
|
dongsheng@627
|
12362 msgstr ""
|
dongsheng@627
|
12363
|
dongsheng@627
|
12364 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
12365 #: ../en/ch10-hook.xml:18
|
dongsheng@627
|
12366 msgid "An overview of hooks in Mercurial"
|
dongsheng@635
|
12367 msgstr "Mercurial 钩子概述"
|
dongsheng@627
|
12368
|
dongsheng@627
|
12369 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
12370 #: ../en/ch10-hook.xml:20
|
dongsheng@627
|
12371 msgid ""
|
songdongsheng@658
|
12372 "Here is a brief list of the hooks that Mercurial supports. We will revisit "
|
songdongsheng@658
|
12373 "each of these hooks in more detail later, in <xref linkend=\"sec:hook:ref\"/>."
|
dongsheng@627
|
12374 msgstr ""
|
dongsheng@627
|
12375
|
dongsheng@714
|
12376 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
12377 #: ../en/ch10-hook.xml:24
|
dongsheng@714
|
12378 msgid ""
|
dongsheng@714
|
12379 "Each of the hooks whose description begins with the word <quote>Controlling</"
|
dongsheng@714
|
12380 "quote> has the ability to determine whether an activity can proceed. If the "
|
dongsheng@714
|
12381 "hook succeeds, the activity may proceed; if it fails, the activity is either "
|
dongsheng@714
|
12382 "not permitted or undone, depending on the hook."
|
dongsheng@714
|
12383 msgstr ""
|
dongsheng@714
|
12384
|
dongsheng@627
|
12385 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
12386 #: ../en/ch10-hook.xml:31
|
dongsheng@627
|
12387 msgid ""
|
dongsheng@627
|
12388 "<literal role=\"hook\">changegroup</literal>: This is run after a group of "
|
dongsheng@627
|
12389 "changesets has been brought into the repository from elsewhere."
|
dongsheng@627
|
12390 msgstr ""
|
dongsheng@627
|
12391
|
dongsheng@627
|
12392 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
12393 #: ../en/ch10-hook.xml:35
|
dongsheng@627
|
12394 msgid ""
|
dongsheng@627
|
12395 "<literal role=\"hook\">commit</literal>: This is run after a new changeset "
|
dongsheng@627
|
12396 "has been created in the local repository."
|
dongsheng@627
|
12397 msgstr ""
|
dongsheng@627
|
12398
|
dongsheng@627
|
12399 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
12400 #: ../en/ch10-hook.xml:39
|
dongsheng@627
|
12401 msgid ""
|
dongsheng@627
|
12402 "<literal role=\"hook\">incoming</literal>: This is run once for each new "
|
dongsheng@627
|
12403 "changeset that is brought into the repository from elsewhere. Notice the "
|
dongsheng@627
|
12404 "difference from <literal role=\"hook\">changegroup</literal>, which is run "
|
dongsheng@627
|
12405 "once per <emphasis>group</emphasis> of changesets brought in."
|
dongsheng@627
|
12406 msgstr ""
|
dongsheng@627
|
12407
|
dongsheng@627
|
12408 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
12409 #: ../en/ch10-hook.xml:46
|
dongsheng@627
|
12410 msgid ""
|
dongsheng@627
|
12411 "<literal role=\"hook\">outgoing</literal>: This is run after a group of "
|
dongsheng@627
|
12412 "changesets has been transmitted from this repository."
|
dongsheng@627
|
12413 msgstr ""
|
dongsheng@627
|
12414
|
dongsheng@627
|
12415 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
12416 #: ../en/ch10-hook.xml:50
|
dongsheng@627
|
12417 msgid ""
|
dongsheng@627
|
12418 "<literal role=\"hook\">prechangegroup</literal>: This is run before starting "
|
dongsheng@627
|
12419 "to bring a group of changesets into the repository."
|
dongsheng@627
|
12420 msgstr ""
|
dongsheng@627
|
12421
|
dongsheng@627
|
12422 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
12423 #: ../en/ch10-hook.xml:55
|
dongsheng@627
|
12424 msgid ""
|
dongsheng@627
|
12425 "<literal role=\"hook\">precommit</literal>: Controlling. This is run before "
|
dongsheng@627
|
12426 "starting a commit."
|
dongsheng@627
|
12427 msgstr ""
|
dongsheng@627
|
12428
|
dongsheng@627
|
12429 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
12430 #: ../en/ch10-hook.xml:59
|
dongsheng@627
|
12431 msgid ""
|
dongsheng@627
|
12432 "<literal role=\"hook\">preoutgoing</literal>: Controlling. This is run before "
|
dongsheng@627
|
12433 "starting to transmit a group of changesets from this repository."
|
dongsheng@627
|
12434 msgstr ""
|
dongsheng@627
|
12435
|
dongsheng@627
|
12436 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
12437 #: ../en/ch10-hook.xml:64
|
dongsheng@627
|
12438 msgid ""
|
dongsheng@627
|
12439 "<literal role=\"hook\">pretag</literal>: Controlling. This is run before "
|
dongsheng@627
|
12440 "creating a tag."
|
dongsheng@627
|
12441 msgstr ""
|
dongsheng@627
|
12442
|
dongsheng@627
|
12443 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
12444 #: ../en/ch10-hook.xml:68
|
dongsheng@627
|
12445 msgid ""
|
dongsheng@627
|
12446 "<literal role=\"hook\">pretxnchangegroup</literal>: Controlling. This is run "
|
dongsheng@627
|
12447 "after a group of changesets has been brought into the local repository from "
|
dongsheng@627
|
12448 "another, but before the transaction completes that will make the changes "
|
dongsheng@627
|
12449 "permanent in the repository."
|
dongsheng@627
|
12450 msgstr ""
|
dongsheng@627
|
12451
|
dongsheng@627
|
12452 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
12453 #: ../en/ch10-hook.xml:76
|
dongsheng@627
|
12454 msgid ""
|
dongsheng@627
|
12455 "<literal role=\"hook\">pretxncommit</literal>: Controlling. This is run after "
|
dongsheng@627
|
12456 "a new changeset has been created in the local repository, but before the "
|
dongsheng@627
|
12457 "transaction completes that will make it permanent."
|
dongsheng@627
|
12458 msgstr ""
|
dongsheng@627
|
12459
|
dongsheng@627
|
12460 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
12461 #: ../en/ch10-hook.xml:82
|
dongsheng@627
|
12462 msgid ""
|
dongsheng@627
|
12463 "<literal role=\"hook\">preupdate</literal>: Controlling. This is run before "
|
dongsheng@627
|
12464 "starting an update or merge of the working directory."
|
dongsheng@627
|
12465 msgstr ""
|
dongsheng@627
|
12466
|
dongsheng@627
|
12467 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
12468 #: ../en/ch10-hook.xml:87
|
dongsheng@627
|
12469 msgid ""
|
dongsheng@627
|
12470 "<literal role=\"hook\">tag</literal>: This is run after a tag is created."
|
dongsheng@627
|
12471 msgstr ""
|
dongsheng@627
|
12472
|
dongsheng@627
|
12473 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
12474 #: ../en/ch10-hook.xml:91
|
dongsheng@627
|
12475 msgid ""
|
dongsheng@627
|
12476 "<literal role=\"hook\">update</literal>: This is run after an update or merge "
|
dongsheng@627
|
12477 "of the working directory has finished."
|
dongsheng@627
|
12478 msgstr ""
|
dongsheng@627
|
12479
|
dongsheng@627
|
12480 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
12481 #: ../en/ch10-hook.xml:99
|
dongsheng@627
|
12482 msgid "Hooks and security"
|
dongsheng@635
|
12483 msgstr "钩子与安全性"
|
dongsheng@627
|
12484
|
dongsheng@627
|
12485 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
12486 #: ../en/ch10-hook.xml:102
|
dongsheng@627
|
12487 msgid "Hooks are run with your privileges"
|
dongsheng@635
|
12488 msgstr "钩子以你的特权执行"
|
dongsheng@627
|
12489
|
dongsheng@627
|
12490 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12491 #: ../en/ch10-hook.xml:104
|
dongsheng@627
|
12492 msgid ""
|
dongsheng@627
|
12493 "When you run a Mercurial command in a repository, and the command causes a "
|
dongsheng@627
|
12494 "hook to run, that hook runs on <emphasis>your</emphasis> system, under "
|
dongsheng@627
|
12495 "<emphasis>your</emphasis> user account, with <emphasis>your</emphasis> "
|
dongsheng@627
|
12496 "privilege level. Since hooks are arbitrary pieces of executable code, you "
|
dongsheng@627
|
12497 "should treat them with an appropriate level of suspicion. Do not install a "
|
dongsheng@627
|
12498 "hook unless you are confident that you know who created it and what it does."
|
dongsheng@627
|
12499 msgstr ""
|
dongsheng@627
|
12500
|
dongsheng@627
|
12501 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12502 #: ../en/ch10-hook.xml:115
|
dongsheng@627
|
12503 msgid ""
|
dongsheng@627
|
12504 "In some cases, you may be exposed to hooks that you did not install "
|
dongsheng@627
|
12505 "yourself. If you work with Mercurial on an unfamiliar system, Mercurial will "
|
dongsheng@650
|
12506 "run hooks defined in that system's global <filename role=\"special\">~/.hgrc</"
|
dongsheng@650
|
12507 "filename> file."
|
dongsheng@650
|
12508 msgstr ""
|
dongsheng@650
|
12509
|
dongsheng@650
|
12510 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12511 #: ../en/ch10-hook.xml:122
|
dongsheng@627
|
12512 msgid ""
|
dongsheng@627
|
12513 "If you are working with a repository owned by another user, Mercurial can run "
|
dongsheng@627
|
12514 "hooks defined in that user's repository, but it will still run them as "
|
dongsheng@627
|
12515 "<quote>you</quote>. For example, if you <command role=\"hg-cmd\">hg pull</"
|
dongsheng@627
|
12516 "command> from that repository, and its <filename role=\"special\">.hg/hgrc</"
|
dongsheng@627
|
12517 "filename> defines a local <literal role=\"hook\">outgoing</literal> hook, "
|
dongsheng@627
|
12518 "that hook will run under your user account, even though you don't own that "
|
dongsheng@627
|
12519 "repository."
|
dongsheng@627
|
12520 msgstr ""
|
dongsheng@627
|
12521
|
dongsheng@627
|
12522 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@714
|
12523 #: ../en/ch10-hook.xml:134
|
dongsheng@627
|
12524 msgid ""
|
dongsheng@627
|
12525 "This only applies if you are pulling from a repository on a local or network "
|
dongsheng@627
|
12526 "filesystem. If you're pulling over http or ssh, any <literal role=\"hook"
|
dongsheng@627
|
12527 "\">outgoing</literal> hook will run under whatever account is executing the "
|
dongsheng@627
|
12528 "server process, on the server."
|
dongsheng@627
|
12529 msgstr ""
|
dongsheng@627
|
12530
|
dongsheng@627
|
12531 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12532 #: ../en/ch10-hook.xml:142
|
dongsheng@714
|
12533 msgid ""
|
dongsheng@714
|
12534 "To see what hooks are defined in a repository, use the <command role=\"hg-cmd"
|
dongsheng@714
|
12535 "\">hg showconfig hooks</command> command. If you are working in one "
|
dongsheng@627
|
12536 "repository, but talking to another that you do not own (e.g. using <command "
|
dongsheng@627
|
12537 "role=\"hg-cmd\">hg pull</command> or <command role=\"hg-cmd\">hg incoming</"
|
dongsheng@627
|
12538 "command>), remember that it is the other repository's hooks you should be "
|
dongsheng@627
|
12539 "checking, not your own."
|
dongsheng@627
|
12540 msgstr ""
|
dongsheng@627
|
12541
|
dongsheng@627
|
12542 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
12543 #: ../en/ch10-hook.xml:153
|
dongsheng@627
|
12544 msgid "Hooks do not propagate"
|
dongsheng@635
|
12545 msgstr "钩子不会传播"
|
dongsheng@627
|
12546
|
dongsheng@627
|
12547 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12548 #: ../en/ch10-hook.xml:155
|
dongsheng@627
|
12549 msgid ""
|
dongsheng@627
|
12550 "In Mercurial, hooks are not revision controlled, and do not propagate when "
|
dongsheng@627
|
12551 "you clone, or pull from, a repository. The reason for this is simple: a hook "
|
dongsheng@627
|
12552 "is a completely arbitrary piece of executable code. It runs under your user "
|
dongsheng@627
|
12553 "identity, with your privilege level, on your machine."
|
dongsheng@627
|
12554 msgstr ""
|
dongsheng@627
|
12555
|
dongsheng@627
|
12556 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12557 #: ../en/ch10-hook.xml:162
|
dongsheng@627
|
12558 msgid ""
|
dongsheng@627
|
12559 "It would be extremely reckless for any distributed revision control system to "
|
dongsheng@627
|
12560 "implement revision-controlled hooks, as this would offer an easily "
|
dongsheng@627
|
12561 "exploitable way to subvert the accounts of users of the revision control "
|
dongsheng@627
|
12562 "system."
|
dongsheng@627
|
12563 msgstr ""
|
dongsheng@627
|
12564
|
dongsheng@627
|
12565 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12566 #: ../en/ch10-hook.xml:168
|
dongsheng@627
|
12567 msgid ""
|
dongsheng@627
|
12568 "Since Mercurial does not propagate hooks, if you are collaborating with other "
|
dongsheng@627
|
12569 "people on a common project, you should not assume that they are using the "
|
dongsheng@627
|
12570 "same Mercurial hooks as you are, or that theirs are correctly configured. "
|
dongsheng@627
|
12571 "You should document the hooks you expect people to use."
|
dongsheng@627
|
12572 msgstr ""
|
dongsheng@627
|
12573
|
dongsheng@627
|
12574 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12575 #: ../en/ch10-hook.xml:175
|
dongsheng@627
|
12576 msgid ""
|
dongsheng@627
|
12577 "In a corporate intranet, this is somewhat easier to control, as you can for "
|
dongsheng@627
|
12578 "example provide a <quote>standard</quote> installation of Mercurial on an NFS "
|
dongsheng@650
|
12579 "filesystem, and use a site-wide <filename role=\"special\">~/.hgrc</filename> "
|
dongsheng@650
|
12580 "file to define hooks that all users will see. However, this too has its "
|
dongsheng@627
|
12581 "limits; see below."
|
dongsheng@627
|
12582 msgstr ""
|
dongsheng@627
|
12583
|
dongsheng@627
|
12584 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
12585 #: ../en/ch10-hook.xml:184
|
dongsheng@627
|
12586 msgid "Hooks can be overridden"
|
dongsheng@635
|
12587 msgstr "钩子可以被覆盖"
|
dongsheng@627
|
12588
|
dongsheng@627
|
12589 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12590 #: ../en/ch10-hook.xml:186
|
dongsheng@627
|
12591 msgid ""
|
dongsheng@627
|
12592 "Mercurial allows you to override a hook definition by redefining the hook. "
|
dongsheng@627
|
12593 "You can disable it by setting its value to the empty string, or change its "
|
songdongsheng@710
|
12594 "behavior as you wish."
|
dongsheng@627
|
12595 msgstr ""
|
dongsheng@627
|
12596
|
dongsheng@627
|
12597 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12598 #: ../en/ch10-hook.xml:191
|
dongsheng@650
|
12599 msgid ""
|
dongsheng@650
|
12600 "If you deploy a system- or site-wide <filename role=\"special\">~/.hgrc</"
|
dongsheng@650
|
12601 "filename> file that defines some hooks, you should thus understand that your "
|
dongsheng@650
|
12602 "users can disable or override those hooks."
|
dongsheng@650
|
12603 msgstr ""
|
dongsheng@650
|
12604
|
dongsheng@650
|
12605 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
12606 #: ../en/ch10-hook.xml:199
|
dongsheng@627
|
12607 msgid "Ensuring that critical hooks are run"
|
dongsheng@635
|
12608 msgstr "确保关键钩子的执行"
|
dongsheng@627
|
12609
|
dongsheng@627
|
12610 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12611 #: ../en/ch10-hook.xml:201
|
dongsheng@627
|
12612 msgid ""
|
dongsheng@627
|
12613 "Sometimes you may want to enforce a policy that you do not want others to be "
|
dongsheng@627
|
12614 "able to work around. For example, you may have a requirement that every "
|
dongsheng@627
|
12615 "changeset must pass a rigorous set of tests. Defining this requirement via a "
|
dongsheng@650
|
12616 "hook in a site-wide <filename role=\"special\">~/.hgrc</filename> won't work "
|
dongsheng@650
|
12617 "for remote users on laptops, and of course local users can subvert it at will "
|
dongsheng@650
|
12618 "by overriding the hook."
|
dongsheng@650
|
12619 msgstr ""
|
dongsheng@650
|
12620
|
dongsheng@650
|
12621 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12622 #: ../en/ch10-hook.xml:210
|
dongsheng@627
|
12623 msgid ""
|
dongsheng@627
|
12624 "Instead, you can set up your policies for use of Mercurial so that people are "
|
dongsheng@627
|
12625 "expected to propagate changes through a well-known <quote>canonical</quote> "
|
dongsheng@627
|
12626 "server that you have locked down and configured appropriately."
|
dongsheng@627
|
12627 msgstr ""
|
dongsheng@627
|
12628
|
dongsheng@627
|
12629 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12630 #: ../en/ch10-hook.xml:216
|
dongsheng@627
|
12631 msgid ""
|
dongsheng@627
|
12632 "One way to do this is via a combination of social engineering and "
|
dongsheng@627
|
12633 "technology. Set up a restricted-access account; users can push changes over "
|
dongsheng@627
|
12634 "the network to repositories managed by this account, but they cannot log into "
|
dongsheng@627
|
12635 "the account and run normal shell commands. In this scenario, a user can "
|
dongsheng@627
|
12636 "commit a changeset that contains any old garbage they want."
|
dongsheng@627
|
12637 msgstr ""
|
dongsheng@627
|
12638
|
dongsheng@627
|
12639 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12640 #: ../en/ch10-hook.xml:225
|
dongsheng@627
|
12641 msgid ""
|
dongsheng@627
|
12642 "When someone pushes a changeset to the server that everyone pulls from, the "
|
dongsheng@627
|
12643 "server will test the changeset before it accepts it as permanent, and reject "
|
dongsheng@627
|
12644 "it if it fails to pass the test suite. If people only pull changes from this "
|
dongsheng@627
|
12645 "filtering server, it will serve to ensure that all changes that people pull "
|
dongsheng@627
|
12646 "have been automatically vetted."
|
dongsheng@627
|
12647 msgstr ""
|
dongsheng@627
|
12648
|
dongsheng@627
|
12649 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
12650 #: ../en/ch10-hook.xml:237
|
dongsheng@627
|
12651 msgid "A short tutorial on using hooks"
|
dongsheng@635
|
12652 msgstr "使用钩子的简短指南"
|
dongsheng@627
|
12653
|
dongsheng@627
|
12654 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
12655 #: ../en/ch10-hook.xml:239
|
dongsheng@627
|
12656 msgid ""
|
dongsheng@627
|
12657 "It is easy to write a Mercurial hook. Let's start with a hook that runs when "
|
dongsheng@627
|
12658 "you finish a <command role=\"hg-cmd\">hg commit</command>, and simply prints "
|
dongsheng@627
|
12659 "the hash of the changeset you just created. The hook is called <literal role="
|
dongsheng@627
|
12660 "\"hook\">commit</literal>."
|
dongsheng@627
|
12661 msgstr ""
|
dongsheng@627
|
12662
|
dongsheng@627
|
12663 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
12664 #: ../en/ch10-hook.xml:246
|
dongsheng@627
|
12665 msgid "All hooks follow the pattern in this example."
|
dongsheng@627
|
12666 msgstr ""
|
dongsheng@627
|
12667
|
dongsheng@627
|
12668 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
12669 #: ../en/ch10-hook.xml:250
|
dongsheng@627
|
12670 msgid ""
|
dongsheng@627
|
12671 "You add an entry to the <literal role=\"rc-hooks\">hooks</literal> section of "
|
dongsheng@650
|
12672 "your <filename role=\"special\">~/.hgrc</filename>. On the left is the name "
|
dongsheng@627
|
12673 "of the event to trigger on; on the right is the action to take. As you can "
|
dongsheng@627
|
12674 "see, you can run an arbitrary shell command in a hook. Mercurial passes "
|
dongsheng@627
|
12675 "extra information to the hook using environment variables (look for "
|
dongsheng@627
|
12676 "<envar>HG_NODE</envar> in the example)."
|
dongsheng@627
|
12677 msgstr ""
|
dongsheng@627
|
12678
|
dongsheng@627
|
12679 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
12680 #: ../en/ch10-hook.xml:260
|
dongsheng@627
|
12681 msgid "Performing multiple actions per event"
|
dongsheng@635
|
12682 msgstr "每个事件执行多个操作"
|
dongsheng@627
|
12683
|
dongsheng@627
|
12684 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12685 #: ../en/ch10-hook.xml:262
|
dongsheng@627
|
12686 msgid ""
|
dongsheng@627
|
12687 "Quite often, you will want to define more than one hook for a particular kind "
|
dongsheng@627
|
12688 "of event, as shown below."
|
dongsheng@627
|
12689 msgstr ""
|
dongsheng@627
|
12690
|
dongsheng@627
|
12691 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12692 #: ../en/ch10-hook.xml:267
|
dongsheng@627
|
12693 msgid ""
|
dongsheng@627
|
12694 "Mercurial lets you do this by adding an <emphasis>extension</emphasis> to the "
|
dongsheng@627
|
12695 "end of a hook's name. You extend a hook's name by giving the name of the "
|
dongsheng@627
|
12696 "hook, followed by a full stop (the <quote><literal>.</literal></quote> "
|
dongsheng@627
|
12697 "character), followed by some more text of your choosing. For example, "
|
dongsheng@627
|
12698 "Mercurial will run both <literal>commit.foo</literal> and <literal>commit."
|
dongsheng@627
|
12699 "bar</literal> when the <literal>commit</literal> event occurs."
|
dongsheng@627
|
12700 msgstr ""
|
dongsheng@627
|
12701
|
dongsheng@627
|
12702 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12703 #: ../en/ch10-hook.xml:278
|
dongsheng@627
|
12704 msgid ""
|
dongsheng@627
|
12705 "To give a well-defined order of execution when there are multiple hooks "
|
dongsheng@627
|
12706 "defined for an event, Mercurial sorts hooks by extension, and executes the "
|
dongsheng@627
|
12707 "hook commands in this sorted order. In the above example, it will execute "
|
dongsheng@627
|
12708 "<literal>commit.bar</literal> before <literal>commit.foo</literal>, and "
|
dongsheng@627
|
12709 "<literal>commit</literal> before both."
|
dongsheng@627
|
12710 msgstr ""
|
dongsheng@627
|
12711
|
dongsheng@627
|
12712 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12713 #: ../en/ch10-hook.xml:287
|
dongsheng@627
|
12714 msgid ""
|
dongsheng@627
|
12715 "It is a good idea to use a somewhat descriptive extension when you define a "
|
dongsheng@627
|
12716 "new hook. This will help you to remember what the hook was for. If the hook "
|
dongsheng@627
|
12717 "fails, you'll get an error message that contains the hook name and extension, "
|
dongsheng@627
|
12718 "so using a descriptive extension could give you an immediate hint as to why "
|
songdongsheng@658
|
12719 "the hook failed (see <xref linkend=\"sec:hook:perm\"/> for an example)."
|
dongsheng@627
|
12720 msgstr ""
|
dongsheng@627
|
12721
|
dongsheng@627
|
12722 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
12723 #: ../en/ch10-hook.xml:298
|
dongsheng@627
|
12724 msgid "Controlling whether an activity can proceed"
|
dongsheng@635
|
12725 msgstr "控制处理的活动"
|
dongsheng@627
|
12726
|
dongsheng@627
|
12727 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12728 #: ../en/ch10-hook.xml:300
|
dongsheng@627
|
12729 msgid ""
|
dongsheng@627
|
12730 "In our earlier examples, we used the <literal role=\"hook\">commit</literal> "
|
dongsheng@627
|
12731 "hook, which is run after a commit has completed. This is one of several "
|
dongsheng@627
|
12732 "Mercurial hooks that run after an activity finishes. Such hooks have no way "
|
dongsheng@627
|
12733 "of influencing the activity itself."
|
dongsheng@627
|
12734 msgstr ""
|
dongsheng@627
|
12735
|
dongsheng@627
|
12736 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12737 #: ../en/ch10-hook.xml:307
|
dongsheng@627
|
12738 msgid ""
|
dongsheng@627
|
12739 "Mercurial defines a number of events that occur before an activity starts; or "
|
dongsheng@627
|
12740 "after it starts, but before it finishes. Hooks that trigger on these events "
|
dongsheng@627
|
12741 "have the added ability to choose whether the activity can continue, or will "
|
dongsheng@627
|
12742 "abort."
|
dongsheng@627
|
12743 msgstr ""
|
dongsheng@627
|
12744
|
dongsheng@627
|
12745 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12746 #: ../en/ch10-hook.xml:313
|
dongsheng@627
|
12747 msgid ""
|
dongsheng@627
|
12748 "The <literal role=\"hook\">pretxncommit</literal> hook runs after a commit "
|
dongsheng@627
|
12749 "has all but completed. In other words, the metadata representing the "
|
dongsheng@627
|
12750 "changeset has been written out to disk, but the transaction has not yet been "
|
dongsheng@627
|
12751 "allowed to complete. The <literal role=\"hook\">pretxncommit</literal> hook "
|
dongsheng@627
|
12752 "has the ability to decide whether the transaction can complete, or must be "
|
dongsheng@627
|
12753 "rolled back."
|
dongsheng@627
|
12754 msgstr ""
|
dongsheng@627
|
12755
|
dongsheng@627
|
12756 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12757 #: ../en/ch10-hook.xml:322
|
dongsheng@627
|
12758 msgid ""
|
dongsheng@627
|
12759 "If the <literal role=\"hook\">pretxncommit</literal> hook exits with a status "
|
dongsheng@627
|
12760 "code of zero, the transaction is allowed to complete; the commit finishes; "
|
dongsheng@627
|
12761 "and the <literal role=\"hook\">commit</literal> hook is run. If the <literal "
|
dongsheng@627
|
12762 "role=\"hook\">pretxncommit</literal> hook exits with a non-zero status code, "
|
dongsheng@627
|
12763 "the transaction is rolled back; the metadata representing the changeset is "
|
dongsheng@627
|
12764 "erased; and the <literal role=\"hook\">commit</literal> hook is not run."
|
dongsheng@627
|
12765 msgstr ""
|
dongsheng@627
|
12766
|
dongsheng@627
|
12767 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12768 #: ../en/ch10-hook.xml:334
|
dongsheng@627
|
12769 msgid ""
|
dongsheng@627
|
12770 "The hook in the example above checks that a commit comment contains a bug "
|
dongsheng@627
|
12771 "ID. If it does, the commit can complete. If not, the commit is rolled back."
|
dongsheng@627
|
12772 msgstr ""
|
dongsheng@627
|
12773
|
dongsheng@627
|
12774 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
12775 #: ../en/ch10-hook.xml:342
|
dongsheng@627
|
12776 msgid "Writing your own hooks"
|
dongsheng@635
|
12777 msgstr "编写钩子"
|
dongsheng@627
|
12778
|
dongsheng@627
|
12779 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
12780 #: ../en/ch10-hook.xml:344
|
dongsheng@627
|
12781 msgid ""
|
dongsheng@627
|
12782 "When you are writing a hook, you might find it useful to run Mercurial either "
|
dongsheng@627
|
12783 "with the <option role=\"hg-opt-global\">-v</option> option, or the <envar "
|
dongsheng@627
|
12784 "role=\"rc-item-ui\">verbose</envar> config item set to <quote>true</quote>. "
|
dongsheng@627
|
12785 "When you do so, Mercurial will print a message before it calls each hook."
|
dongsheng@627
|
12786 msgstr ""
|
dongsheng@627
|
12787
|
dongsheng@627
|
12788 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
12789 #: ../en/ch10-hook.xml:353
|
dongsheng@627
|
12790 msgid "Choosing how your hook should run"
|
dongsheng@635
|
12791 msgstr "选择钩子的执行方式"
|
dongsheng@627
|
12792
|
dongsheng@627
|
12793 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12794 #: ../en/ch10-hook.xml:355
|
dongsheng@627
|
12795 msgid ""
|
songdongsheng@668
|
12796 "You can write a hook either as a normal program&emdash;typically a shell "
|
songdongsheng@668
|
12797 "script&emdash;or as a Python function that is executed within the Mercurial "
|
songdongsheng@668
|
12798 "process."
|
dongsheng@627
|
12799 msgstr ""
|
dongsheng@627
|
12800
|
dongsheng@627
|
12801 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12802 #: ../en/ch10-hook.xml:360
|
dongsheng@627
|
12803 msgid ""
|
dongsheng@627
|
12804 "Writing a hook as an external program has the advantage that it requires no "
|
dongsheng@627
|
12805 "knowledge of Mercurial's internals. You can call normal Mercurial commands "
|
dongsheng@627
|
12806 "to get any added information you need. The trade-off is that external hooks "
|
dongsheng@627
|
12807 "are slower than in-process hooks."
|
dongsheng@627
|
12808 msgstr ""
|
dongsheng@627
|
12809
|
dongsheng@627
|
12810 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12811 #: ../en/ch10-hook.xml:367
|
dongsheng@627
|
12812 msgid ""
|
dongsheng@627
|
12813 "An in-process Python hook has complete access to the Mercurial API, and does "
|
dongsheng@627
|
12814 "not <quote>shell out</quote> to another process, so it is inherently faster "
|
dongsheng@627
|
12815 "than an external hook. It is also easier to obtain much of the information "
|
dongsheng@627
|
12816 "that a hook requires by using the Mercurial API than by running Mercurial "
|
dongsheng@627
|
12817 "commands."
|
dongsheng@627
|
12818 msgstr ""
|
dongsheng@627
|
12819
|
dongsheng@627
|
12820 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12821 #: ../en/ch10-hook.xml:375
|
dongsheng@627
|
12822 msgid ""
|
dongsheng@627
|
12823 "If you are comfortable with Python, or require high performance, writing your "
|
dongsheng@627
|
12824 "hooks in Python may be a good choice. However, when you have a "
|
dongsheng@627
|
12825 "straightforward hook to write and you don't need to care about performance "
|
dongsheng@627
|
12826 "(probably the majority of hooks), a shell script is perfectly fine."
|
dongsheng@627
|
12827 msgstr ""
|
dongsheng@627
|
12828
|
dongsheng@627
|
12829 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
12830 #: ../en/ch10-hook.xml:384
|
dongsheng@627
|
12831 msgid "Hook parameters"
|
dongsheng@635
|
12832 msgstr "钩子的参数"
|
dongsheng@627
|
12833
|
dongsheng@627
|
12834 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12835 #: ../en/ch10-hook.xml:386
|
dongsheng@627
|
12836 msgid ""
|
dongsheng@627
|
12837 "Mercurial calls each hook with a set of well-defined parameters. In Python, "
|
dongsheng@627
|
12838 "a parameter is passed as a keyword argument to your hook function. For an "
|
dongsheng@627
|
12839 "external program, a parameter is passed as an environment variable."
|
dongsheng@627
|
12840 msgstr ""
|
dongsheng@627
|
12841
|
dongsheng@627
|
12842 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12843 #: ../en/ch10-hook.xml:392
|
dongsheng@627
|
12844 msgid ""
|
dongsheng@627
|
12845 "Whether your hook is written in Python or as a shell script, the hook-"
|
dongsheng@627
|
12846 "specific parameter names and values will be the same. A boolean parameter "
|
dongsheng@627
|
12847 "will be represented as a boolean value in Python, but as the number 1 (for "
|
dongsheng@627
|
12848 "<quote>true</quote>) or 0 (for <quote>false</quote>) as an environment "
|
dongsheng@627
|
12849 "variable for an external hook. If a hook parameter is named <literal>foo</"
|
dongsheng@627
|
12850 "literal>, the keyword argument for a Python hook will also be named "
|
dongsheng@627
|
12851 "<literal>foo</literal>, while the environment variable for an external hook "
|
dongsheng@627
|
12852 "will be named <literal>HG_FOO</literal>."
|
dongsheng@627
|
12853 msgstr ""
|
dongsheng@627
|
12854
|
dongsheng@627
|
12855 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
12856 #: ../en/ch10-hook.xml:406
|
dongsheng@627
|
12857 msgid "Hook return values and activity control"
|
dongsheng@635
|
12858 msgstr "钩子的返回值与活动控制"
|
dongsheng@627
|
12859
|
dongsheng@627
|
12860 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12861 #: ../en/ch10-hook.xml:408
|
dongsheng@627
|
12862 msgid ""
|
dongsheng@627
|
12863 "A hook that executes successfully must exit with a status of zero if "
|
dongsheng@627
|
12864 "external, or return boolean <quote>false</quote> if in-process. Failure is "
|
dongsheng@627
|
12865 "indicated with a non-zero exit status from an external hook, or an in-process "
|
dongsheng@627
|
12866 "hook returning boolean <quote>true</quote>. If an in-process hook raises an "
|
dongsheng@627
|
12867 "exception, the hook is considered to have failed."
|
dongsheng@627
|
12868 msgstr ""
|
dongsheng@627
|
12869
|
dongsheng@627
|
12870 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12871 #: ../en/ch10-hook.xml:416
|
dongsheng@627
|
12872 msgid ""
|
dongsheng@627
|
12873 "For a hook that controls whether an activity can proceed, zero/false means "
|
dongsheng@627
|
12874 "<quote>allow</quote>, while non-zero/true/exception means <quote>deny</quote>."
|
dongsheng@627
|
12875 msgstr ""
|
dongsheng@627
|
12876
|
dongsheng@627
|
12877 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
12878 #: ../en/ch10-hook.xml:423
|
dongsheng@627
|
12879 msgid "Writing an external hook"
|
dongsheng@635
|
12880 msgstr "编写外部钩子"
|
dongsheng@627
|
12881
|
dongsheng@627
|
12882 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12883 #: ../en/ch10-hook.xml:425
|
dongsheng@650
|
12884 msgid ""
|
dongsheng@650
|
12885 "When you define an external hook in your <filename role=\"special\">~/.hgrc</"
|
dongsheng@650
|
12886 "filename> and the hook is run, its value is passed to your shell, which "
|
dongsheng@627
|
12887 "interprets it. This means that you can use normal shell constructs in the "
|
dongsheng@627
|
12888 "body of the hook."
|
dongsheng@627
|
12889 msgstr ""
|
dongsheng@627
|
12890
|
dongsheng@627
|
12891 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12892 #: ../en/ch10-hook.xml:432
|
dongsheng@627
|
12893 msgid ""
|
dongsheng@627
|
12894 "An executable hook is always run with its current directory set to a "
|
dongsheng@627
|
12895 "repository's root directory."
|
dongsheng@627
|
12896 msgstr ""
|
dongsheng@627
|
12897
|
dongsheng@627
|
12898 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12899 #: ../en/ch10-hook.xml:436
|
dongsheng@627
|
12900 msgid ""
|
dongsheng@627
|
12901 "Each hook parameter is passed in as an environment variable; the name is "
|
dongsheng@627
|
12902 "upper-cased, and prefixed with the string <quote><literal>HG_</literal></"
|
dongsheng@627
|
12903 "quote>."
|
dongsheng@627
|
12904 msgstr ""
|
dongsheng@627
|
12905
|
dongsheng@627
|
12906 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12907 #: ../en/ch10-hook.xml:441
|
dongsheng@627
|
12908 msgid ""
|
dongsheng@627
|
12909 "With the exception of hook parameters, Mercurial does not set or modify any "
|
dongsheng@627
|
12910 "environment variables when running a hook. This is useful to remember if you "
|
dongsheng@627
|
12911 "are writing a site-wide hook that may be run by a number of different users "
|
dongsheng@627
|
12912 "with differing environment variables set. In multi-user situations, you "
|
dongsheng@627
|
12913 "should not rely on environment variables being set to the values you have in "
|
dongsheng@627
|
12914 "your environment when testing the hook."
|
dongsheng@627
|
12915 msgstr ""
|
dongsheng@627
|
12916
|
dongsheng@627
|
12917 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
12918 #: ../en/ch10-hook.xml:452
|
dongsheng@627
|
12919 msgid "Telling Mercurial to use an in-process hook"
|
dongsheng@642
|
12920 msgstr "让 Mercurial 使用进程内钩子"
|
dongsheng@627
|
12921
|
dongsheng@627
|
12922 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12923 #: ../en/ch10-hook.xml:454
|
dongsheng@650
|
12924 msgid ""
|
dongsheng@650
|
12925 "The <filename role=\"special\">~/.hgrc</filename> syntax for defining an in-"
|
dongsheng@627
|
12926 "process hook is slightly different than for an executable hook. The value of "
|
dongsheng@627
|
12927 "the hook must start with the text <quote><literal>python:</literal></quote>, "
|
dongsheng@627
|
12928 "and continue with the fully-qualified name of a callable object to use as the "
|
dongsheng@627
|
12929 "hook's value."
|
dongsheng@627
|
12930 msgstr ""
|
dongsheng@627
|
12931
|
dongsheng@627
|
12932 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12933 #: ../en/ch10-hook.xml:462
|
dongsheng@627
|
12934 msgid ""
|
dongsheng@627
|
12935 "The module in which a hook lives is automatically imported when a hook is "
|
dongsheng@627
|
12936 "run. So long as you have the module name and <envar>PYTHONPATH</envar> "
|
dongsheng@627
|
12937 "right, it should <quote>just work</quote>."
|
dongsheng@627
|
12938 msgstr ""
|
dongsheng@627
|
12939
|
dongsheng@627
|
12940 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12941 #: ../en/ch10-hook.xml:468
|
dongsheng@650
|
12942 msgid ""
|
dongsheng@650
|
12943 "The following <filename role=\"special\">~/.hgrc</filename> example snippet "
|
dongsheng@627
|
12944 "illustrates the syntax and meaning of the notions we just described."
|
dongsheng@627
|
12945 msgstr ""
|
dongsheng@627
|
12946
|
dongsheng@627
|
12947 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12948 #: ../en/ch10-hook.xml:474
|
dongsheng@627
|
12949 msgid ""
|
dongsheng@627
|
12950 "When Mercurial runs the <literal>commit.example</literal> hook, it imports "
|
dongsheng@627
|
12951 "<literal>mymodule.submodule</literal>, looks for the callable object named "
|
dongsheng@627
|
12952 "<literal>myhook</literal>, and calls it."
|
dongsheng@627
|
12953 msgstr ""
|
dongsheng@627
|
12954
|
dongsheng@627
|
12955 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
12956 #: ../en/ch10-hook.xml:482
|
dongsheng@627
|
12957 msgid "Writing an in-process hook"
|
dongsheng@635
|
12958 msgstr "编写进程内钩子"
|
dongsheng@627
|
12959
|
dongsheng@627
|
12960 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12961 #: ../en/ch10-hook.xml:484
|
dongsheng@627
|
12962 msgid ""
|
dongsheng@627
|
12963 "The simplest in-process hook does nothing, but illustrates the basic shape of "
|
dongsheng@627
|
12964 "the hook API:"
|
dongsheng@627
|
12965 msgstr ""
|
dongsheng@627
|
12966
|
dongsheng@627
|
12967 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12968 #: ../en/ch10-hook.xml:489
|
dongsheng@627
|
12969 msgid ""
|
dongsheng@627
|
12970 "The first argument to a Python hook is always a <literal role=\"py-mod-"
|
dongsheng@627
|
12971 "mercurial.ui\">ui</literal> object. The second is a repository object; at "
|
dongsheng@627
|
12972 "the moment, it is always an instance of <literal role=\"py-mod-mercurial."
|
dongsheng@627
|
12973 "localrepo\">localrepository</literal>. Following these two arguments are "
|
dongsheng@627
|
12974 "other keyword arguments. Which ones are passed in depends on the hook being "
|
dongsheng@627
|
12975 "called, but a hook can ignore arguments it doesn't care about by dropping "
|
dongsheng@627
|
12976 "them into a keyword argument dict, as with <literal>**kwargs</literal> above."
|
dongsheng@627
|
12977 msgstr ""
|
dongsheng@627
|
12978
|
dongsheng@627
|
12979 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
12980 #: ../en/ch10-hook.xml:504
|
dongsheng@627
|
12981 msgid "Some hook examples"
|
dongsheng@635
|
12982 msgstr "钩子样例"
|
dongsheng@627
|
12983
|
dongsheng@627
|
12984 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
12985 #: ../en/ch10-hook.xml:507
|
dongsheng@627
|
12986 msgid "Writing meaningful commit messages"
|
dongsheng@635
|
12987 msgstr "编写有意义的提交日志"
|
dongsheng@627
|
12988
|
dongsheng@627
|
12989 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
12990 #: ../en/ch10-hook.xml:509
|
dongsheng@627
|
12991 msgid ""
|
dongsheng@627
|
12992 "It's hard to imagine a useful commit message being very short. The simple "
|
dongsheng@627
|
12993 "<literal role=\"hook\">pretxncommit</literal> hook of the example below will "
|
dongsheng@627
|
12994 "prevent you from committing a changeset with a message that is less than ten "
|
dongsheng@627
|
12995 "bytes long."
|
dongsheng@627
|
12996 msgstr ""
|
dongsheng@627
|
12997
|
dongsheng@627
|
12998 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
12999 #: ../en/ch10-hook.xml:519
|
dongsheng@627
|
13000 msgid "Checking for trailing whitespace"
|
dongsheng@635
|
13001 msgstr "检查行尾空格"
|
dongsheng@627
|
13002
|
dongsheng@627
|
13003 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13004 #: ../en/ch10-hook.xml:521
|
dongsheng@627
|
13005 msgid ""
|
dongsheng@627
|
13006 "An interesting use of a commit-related hook is to help you to write cleaner "
|
dongsheng@627
|
13007 "code. A simple example of <quote>cleaner code</quote> is the dictum that a "
|
dongsheng@627
|
13008 "change should not add any new lines of text that contain <quote>trailing "
|
dongsheng@627
|
13009 "whitespace</quote>. Trailing whitespace is a series of space and tab "
|
dongsheng@627
|
13010 "characters at the end of a line of text. In most cases, trailing whitespace "
|
dongsheng@627
|
13011 "is unnecessary, invisible noise, but it is occasionally problematic, and "
|
dongsheng@627
|
13012 "people often prefer to get rid of it."
|
dongsheng@627
|
13013 msgstr ""
|
dongsheng@627
|
13014
|
dongsheng@627
|
13015 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13016 #: ../en/ch10-hook.xml:532
|
dongsheng@627
|
13017 msgid ""
|
dongsheng@627
|
13018 "You can use either the <literal role=\"hook\">precommit</literal> or <literal "
|
dongsheng@627
|
13019 "role=\"hook\">pretxncommit</literal> hook to tell whether you have a trailing "
|
dongsheng@627
|
13020 "whitespace problem. If you use the <literal role=\"hook\">precommit</"
|
dongsheng@627
|
13021 "literal> hook, the hook will not know which files you are committing, so it "
|
dongsheng@627
|
13022 "will have to check every modified file in the repository for trailing white "
|
dongsheng@627
|
13023 "space. If you want to commit a change to just the file <filename>foo</"
|
dongsheng@627
|
13024 "filename>, but the file <filename>bar</filename> contains trailing "
|
dongsheng@627
|
13025 "whitespace, doing a check in the <literal role=\"hook\">precommit</literal> "
|
dongsheng@627
|
13026 "hook will prevent you from committing <filename>foo</filename> due to the "
|
dongsheng@627
|
13027 "problem with <filename>bar</filename>. This doesn't seem right."
|
dongsheng@627
|
13028 msgstr ""
|
dongsheng@627
|
13029
|
dongsheng@627
|
13030 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13031 #: ../en/ch10-hook.xml:548
|
dongsheng@627
|
13032 msgid ""
|
dongsheng@627
|
13033 "Should you choose the <literal role=\"hook\">pretxncommit</literal> hook, the "
|
dongsheng@627
|
13034 "check won't occur until just before the transaction for the commit "
|
dongsheng@627
|
13035 "completes. This will allow you to check for problems only the exact files "
|
dongsheng@627
|
13036 "that are being committed. However, if you entered the commit message "
|
dongsheng@627
|
13037 "interactively and the hook fails, the transaction will roll back; you'll have "
|
dongsheng@627
|
13038 "to re-enter the commit message after you fix the trailing whitespace and run "
|
dongsheng@627
|
13039 "<command role=\"hg-cmd\">hg commit</command> again."
|
dongsheng@627
|
13040 msgstr ""
|
dongsheng@627
|
13041
|
dongsheng@627
|
13042 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13043 #: ../en/ch10-hook.xml:561
|
dongsheng@627
|
13044 msgid ""
|
dongsheng@627
|
13045 "In this example, we introduce a simple <literal role=\"hook\">pretxncommit</"
|
dongsheng@627
|
13046 "literal> hook that checks for trailing whitespace. This hook is short, but "
|
dongsheng@627
|
13047 "not very helpful. It exits with an error status if a change adds a line with "
|
dongsheng@627
|
13048 "trailing whitespace to any file, but does not print any information that "
|
dongsheng@627
|
13049 "might help us to identify the offending file or line. It also has the nice "
|
dongsheng@627
|
13050 "property of not paying attention to unmodified lines; only lines that "
|
dongsheng@627
|
13051 "introduce new trailing whitespace cause problems."
|
dongsheng@627
|
13052 msgstr ""
|
dongsheng@627
|
13053
|
dongsheng@627
|
13054 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13055 #: ../en/ch10-hook.xml:574
|
dongsheng@627
|
13056 msgid ""
|
dongsheng@627
|
13057 "The above version is much more complex, but also more useful. It parses a "
|
dongsheng@627
|
13058 "unified diff to see if any lines add trailing whitespace, and prints the name "
|
dongsheng@627
|
13059 "of the file and the line number of each such occurrence. Even better, if the "
|
dongsheng@627
|
13060 "change adds trailing whitespace, this hook saves the commit comment and "
|
dongsheng@627
|
13061 "prints the name of the save file before exiting and telling Mercurial to roll "
|
dongsheng@627
|
13062 "the transaction back, so you can use the <option role=\"hg-opt-commit\">-l "
|
dongsheng@627
|
13063 "filename</option> option to <command role=\"hg-cmd\">hg commit</command> to "
|
dongsheng@627
|
13064 "reuse the saved commit message once you've corrected the problem."
|
dongsheng@627
|
13065 msgstr ""
|
dongsheng@627
|
13066
|
dongsheng@627
|
13067 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13068 #: ../en/ch10-hook.xml:588
|
dongsheng@714
|
13069 msgid ""
|
dongsheng@714
|
13070 "As a final aside, note in the example above the use of <command>sed</"
|
dongsheng@627
|
13071 "command>'s in-place editing feature to get rid of trailing whitespace from a "
|
dongsheng@714
|
13072 "file. This is concise and useful enough that I will reproduce it here (using "
|
dongsheng@714
|
13073 "<command>perl</command> for good measure)."
|
dongsheng@627
|
13074 msgstr ""
|
dongsheng@627
|
13075
|
dongsheng@627
|
13076 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
13077 #: ../en/ch10-hook.xml:598
|
dongsheng@627
|
13078 msgid "Bundled hooks"
|
dongsheng@635
|
13079 msgstr "内置的钩子"
|
dongsheng@627
|
13080
|
dongsheng@627
|
13081 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
13082 #: ../en/ch10-hook.xml:600
|
dongsheng@627
|
13083 msgid ""
|
dongsheng@627
|
13084 "Mercurial ships with several bundled hooks. You can find them in the "
|
dongsheng@627
|
13085 "<filename class=\"directory\">hgext</filename> directory of a Mercurial "
|
dongsheng@627
|
13086 "source tree. If you are using a Mercurial binary package, the hooks will be "
|
dongsheng@627
|
13087 "located in the <filename class=\"directory\">hgext</filename> directory of "
|
dongsheng@627
|
13088 "wherever your package installer put Mercurial."
|
dongsheng@627
|
13089 msgstr ""
|
dongsheng@627
|
13090
|
dongsheng@627
|
13091 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
13092 #: ../en/ch10-hook.xml:609
|
songdongsheng@668
|
13093 msgid ""
|
songdongsheng@668
|
13094 "<literal role=\"hg-ext\">acl</literal>&emdash;access control for parts of a "
|
dongsheng@627
|
13095 "repository"
|
dongsheng@661
|
13096 msgstr "<literal role=\"hg-ext\">acl</literal>—版本库的访问控制"
|
dongsheng@627
|
13097
|
dongsheng@627
|
13098 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13099 #: ../en/ch10-hook.xml:612
|
dongsheng@627
|
13100 msgid ""
|
dongsheng@627
|
13101 "The <literal role=\"hg-ext\">acl</literal> extension lets you control which "
|
dongsheng@627
|
13102 "remote users are allowed to push changesets to a networked server. You can "
|
dongsheng@627
|
13103 "protect any portion of a repository (including the entire repo), so that a "
|
dongsheng@627
|
13104 "specific remote user can push changes that do not affect the protected "
|
dongsheng@627
|
13105 "portion."
|
dongsheng@627
|
13106 msgstr ""
|
dongsheng@627
|
13107
|
dongsheng@627
|
13108 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13109 #: ../en/ch10-hook.xml:620
|
dongsheng@627
|
13110 msgid ""
|
dongsheng@627
|
13111 "This extension implements access control based on the identity of the user "
|
dongsheng@627
|
13112 "performing a push, <emphasis>not</emphasis> on who committed the changesets "
|
dongsheng@627
|
13113 "they're pushing. It makes sense to use this hook only if you have a locked-"
|
dongsheng@627
|
13114 "down server environment that authenticates remote users, and you want to be "
|
dongsheng@627
|
13115 "sure that only specific users are allowed to push changes to that server."
|
dongsheng@627
|
13116 msgstr ""
|
dongsheng@627
|
13117
|
dongsheng@627
|
13118 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
13119 #: ../en/ch10-hook.xml:630
|
dongsheng@627
|
13120 msgid "Configuring the <literal role=\"hook\">acl</literal> hook"
|
dongsheng@635
|
13121 msgstr "配置 <literal role=\"hook\">acl</literal> 钩子"
|
dongsheng@627
|
13122
|
dongsheng@627
|
13123 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13124 #: ../en/ch10-hook.xml:633
|
dongsheng@627
|
13125 msgid ""
|
dongsheng@627
|
13126 "In order to manage incoming changesets, the <literal role=\"hg-ext\">acl</"
|
dongsheng@627
|
13127 "literal> hook must be used as a <literal role=\"hook\">pretxnchangegroup</"
|
dongsheng@627
|
13128 "literal> hook. This lets it see which files are modified by each incoming "
|
dongsheng@627
|
13129 "changeset, and roll back a group of changesets if they modify "
|
dongsheng@627
|
13130 "<quote>forbidden</quote> files. Example:"
|
dongsheng@627
|
13131 msgstr ""
|
dongsheng@627
|
13132
|
dongsheng@627
|
13133 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13134 #: ../en/ch10-hook.xml:643
|
dongsheng@627
|
13135 msgid ""
|
dongsheng@627
|
13136 "The <literal role=\"hg-ext\">acl</literal> extension is configured using "
|
dongsheng@627
|
13137 "three sections."
|
dongsheng@627
|
13138 msgstr ""
|
dongsheng@627
|
13139
|
dongsheng@627
|
13140 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13141 #: ../en/ch10-hook.xml:647
|
dongsheng@627
|
13142 msgid ""
|
dongsheng@627
|
13143 "The <literal role=\"rc-acl\">acl</literal> section has only one entry, <envar "
|
dongsheng@627
|
13144 "role=\"rc-item-acl\">sources</envar>, which lists the sources of incoming "
|
dongsheng@627
|
13145 "changesets that the hook should pay attention to. You don't normally need to "
|
dongsheng@627
|
13146 "configure this section."
|
dongsheng@627
|
13147 msgstr ""
|
dongsheng@627
|
13148
|
dongsheng@627
|
13149 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13150 #: ../en/ch10-hook.xml:654
|
dongsheng@627
|
13151 msgid ""
|
dongsheng@627
|
13152 "<envar role=\"rc-item-acl\">serve</envar>: Control incoming changesets that "
|
dongsheng@627
|
13153 "are arriving from a remote repository over http or ssh. This is the default "
|
dongsheng@627
|
13154 "value of <envar role=\"rc-item-acl\">sources</envar>, and usually the only "
|
dongsheng@627
|
13155 "setting you'll need for this configuration item."
|
dongsheng@627
|
13156 msgstr ""
|
dongsheng@627
|
13157
|
dongsheng@627
|
13158 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13159 #: ../en/ch10-hook.xml:662
|
dongsheng@627
|
13160 msgid ""
|
dongsheng@627
|
13161 "<envar role=\"rc-item-acl\">pull</envar>: Control incoming changesets that "
|
dongsheng@627
|
13162 "are arriving via a pull from a local repository."
|
dongsheng@627
|
13163 msgstr ""
|
dongsheng@627
|
13164
|
dongsheng@627
|
13165 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13166 #: ../en/ch10-hook.xml:667
|
dongsheng@627
|
13167 msgid ""
|
dongsheng@627
|
13168 "<envar role=\"rc-item-acl\">push</envar>: Control incoming changesets that "
|
dongsheng@627
|
13169 "are arriving via a push from a local repository."
|
dongsheng@627
|
13170 msgstr ""
|
dongsheng@627
|
13171
|
dongsheng@627
|
13172 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13173 #: ../en/ch10-hook.xml:672
|
dongsheng@627
|
13174 msgid ""
|
dongsheng@627
|
13175 "<envar role=\"rc-item-acl\">bundle</envar>: Control incoming changesets that "
|
dongsheng@627
|
13176 "are arriving from another repository via a bundle."
|
dongsheng@627
|
13177 msgstr ""
|
dongsheng@627
|
13178
|
dongsheng@627
|
13179 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13180 #: ../en/ch10-hook.xml:678
|
dongsheng@627
|
13181 msgid ""
|
dongsheng@627
|
13182 "The <literal role=\"rc-acl.allow\">acl.allow</literal> section controls the "
|
dongsheng@627
|
13183 "users that are allowed to add changesets to the repository. If this section "
|
dongsheng@627
|
13184 "is not present, all users that are not explicitly denied are allowed. If "
|
dongsheng@627
|
13185 "this section is present, all users that are not explicitly allowed are denied "
|
dongsheng@627
|
13186 "(so an empty section means that all users are denied)."
|
dongsheng@627
|
13187 msgstr ""
|
dongsheng@627
|
13188
|
dongsheng@627
|
13189 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13190 #: ../en/ch10-hook.xml:687
|
dongsheng@627
|
13191 msgid ""
|
dongsheng@627
|
13192 "The <literal role=\"rc-acl.deny\">acl.deny</literal> section determines which "
|
dongsheng@627
|
13193 "users are denied from adding changesets to the repository. If this section "
|
dongsheng@627
|
13194 "is not present or is empty, no users are denied."
|
dongsheng@627
|
13195 msgstr ""
|
dongsheng@627
|
13196
|
dongsheng@627
|
13197 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13198 #: ../en/ch10-hook.xml:693
|
dongsheng@627
|
13199 msgid ""
|
dongsheng@627
|
13200 "The syntaxes for the <literal role=\"rc-acl.allow\">acl.allow</literal> and "
|
dongsheng@627
|
13201 "<literal role=\"rc-acl.deny\">acl.deny</literal> sections are identical. On "
|
dongsheng@627
|
13202 "the left of each entry is a glob pattern that matches files or directories, "
|
dongsheng@627
|
13203 "relative to the root of the repository; on the right, a user name."
|
dongsheng@627
|
13204 msgstr ""
|
dongsheng@627
|
13205
|
dongsheng@627
|
13206 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13207 #: ../en/ch10-hook.xml:701
|
dongsheng@627
|
13208 msgid ""
|
dongsheng@627
|
13209 "In the following example, the user <literal>docwriter</literal> can only push "
|
dongsheng@627
|
13210 "changes to the <filename class=\"directory\">docs</filename> subtree of the "
|
dongsheng@627
|
13211 "repository, while <literal>intern</literal> can push changes to any file or "
|
dongsheng@627
|
13212 "directory except <filename class=\"directory\">source/sensitive</filename>."
|
dongsheng@627
|
13213 msgstr ""
|
dongsheng@627
|
13214
|
dongsheng@627
|
13215 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
13216 #: ../en/ch10-hook.xml:715 ../en/ch10-hook.xml:979 ../en/ch10-hook.xml:1169
|
dongsheng@627
|
13217 msgid "Testing and troubleshooting"
|
dongsheng@635
|
13218 msgstr "测试与问题处理"
|
dongsheng@627
|
13219
|
dongsheng@627
|
13220 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13221 #: ../en/ch10-hook.xml:717
|
dongsheng@627
|
13222 msgid ""
|
dongsheng@627
|
13223 "If you want to test the <literal role=\"hg-ext\">acl</literal> hook, run it "
|
dongsheng@627
|
13224 "with Mercurial's debugging output enabled. Since you'll probably be running "
|
dongsheng@627
|
13225 "it on a server where it's not convenient (or sometimes possible) to pass in "
|
dongsheng@627
|
13226 "the <option role=\"hg-opt-global\">--debug</option> option, don't forget that "
|
dongsheng@650
|
13227 "you can enable debugging output in your <filename role=\"special\">~/.hgrc</"
|
dongsheng@627
|
13228 "filename>:"
|
dongsheng@627
|
13229 msgstr ""
|
dongsheng@627
|
13230
|
dongsheng@627
|
13231 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13232 #: ../en/ch10-hook.xml:728
|
dongsheng@627
|
13233 msgid ""
|
dongsheng@627
|
13234 "With this enabled, the <literal role=\"hg-ext\">acl</literal> hook will print "
|
dongsheng@627
|
13235 "enough information to let you figure out why it is allowing or forbidding "
|
dongsheng@627
|
13236 "pushes from specific users."
|
dongsheng@627
|
13237 msgstr ""
|
dongsheng@627
|
13238
|
dongsheng@627
|
13239 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
13240 #: ../en/ch10-hook.xml:737
|
songdongsheng@668
|
13241 msgid ""
|
songdongsheng@668
|
13242 "<literal role=\"hg-ext\">bugzilla</literal>&emdash;integration with Bugzilla"
|
dongsheng@661
|
13243 msgstr "<literal role=\"hg-ext\">bugzilla</literal>—与 Bugzilla 的集成"
|
dongsheng@627
|
13244
|
dongsheng@627
|
13245 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13246 #: ../en/ch10-hook.xml:741
|
dongsheng@627
|
13247 msgid ""
|
dongsheng@627
|
13248 "The <literal role=\"hg-ext\">bugzilla</literal> extension adds a comment to a "
|
dongsheng@627
|
13249 "Bugzilla bug whenever it finds a reference to that bug ID in a commit "
|
dongsheng@627
|
13250 "comment. You can install this hook on a shared server, so that any time a "
|
dongsheng@627
|
13251 "remote user pushes changes to this server, the hook gets run."
|
dongsheng@627
|
13252 msgstr ""
|
dongsheng@627
|
13253
|
dongsheng@627
|
13254 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13255 #: ../en/ch10-hook.xml:748
|
dongsheng@627
|
13256 msgid ""
|
dongsheng@627
|
13257 "It adds a comment to the bug that looks like this (you can configure the "
|
songdongsheng@668
|
13258 "contents of the comment&emdash;see below):"
|
dongsheng@627
|
13259 msgstr ""
|
dongsheng@627
|
13260
|
dongsheng@627
|
13261 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13262 #: ../en/ch10-hook.xml:757
|
dongsheng@627
|
13263 msgid ""
|
dongsheng@627
|
13264 "The value of this hook is that it automates the process of updating a bug any "
|
dongsheng@627
|
13265 "time a changeset refers to it. If you configure the hook properly, it makes "
|
dongsheng@627
|
13266 "it easy for people to browse straight from a Bugzilla bug to a changeset that "
|
dongsheng@627
|
13267 "refers to that bug."
|
dongsheng@627
|
13268 msgstr ""
|
dongsheng@627
|
13269
|
dongsheng@627
|
13270 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13271 #: ../en/ch10-hook.xml:764
|
dongsheng@627
|
13272 msgid ""
|
dongsheng@627
|
13273 "You can use the code in this hook as a starting point for some more exotic "
|
dongsheng@627
|
13274 "Bugzilla integration recipes. Here are a few possibilities:"
|
dongsheng@627
|
13275 msgstr ""
|
dongsheng@627
|
13276
|
dongsheng@627
|
13277 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
13278 #: ../en/ch10-hook.xml:769
|
dongsheng@627
|
13279 msgid ""
|
dongsheng@627
|
13280 "Require that every changeset pushed to the server have a valid bug ID in its "
|
dongsheng@627
|
13281 "commit comment. In this case, you'd want to configure the hook as a <literal "
|
dongsheng@627
|
13282 "role=\"hook\">pretxncommit</literal> hook. This would allow the hook to "
|
dongsheng@627
|
13283 "reject changes that didn't contain bug IDs."
|
dongsheng@627
|
13284 msgstr ""
|
dongsheng@627
|
13285
|
dongsheng@627
|
13286 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
13287 #: ../en/ch10-hook.xml:777
|
dongsheng@627
|
13288 msgid ""
|
dongsheng@627
|
13289 "Allow incoming changesets to automatically modify the <emphasis>state</"
|
dongsheng@627
|
13290 "emphasis> of a bug, as well as simply adding a comment. For example, the "
|
dongsheng@627
|
13291 "hook could recognise the string <quote>fixed bug 31337</quote> as indicating "
|
dongsheng@627
|
13292 "that it should update the state of bug 31337 to <quote>requires testing</"
|
dongsheng@627
|
13293 "quote>."
|
dongsheng@627
|
13294 msgstr ""
|
dongsheng@627
|
13295
|
dongsheng@627
|
13296 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
13297 #: ../en/ch10-hook.xml:787
|
dongsheng@627
|
13298 msgid "Configuring the <literal role=\"hook\">bugzilla</literal> hook"
|
dongsheng@635
|
13299 msgstr "配置 <literal role=\"hook\">bugzilla</literal> 钩子"
|
dongsheng@627
|
13300
|
dongsheng@627
|
13301 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13302 #: ../en/ch10-hook.xml:790
|
dongsheng@650
|
13303 msgid ""
|
dongsheng@650
|
13304 "You should configure this hook in your server's <filename role=\"special\">~/."
|
dongsheng@650
|
13305 "hgrc</filename> as an <literal role=\"hook\">incoming</literal> hook, for "
|
dongsheng@627
|
13306 "example as follows:"
|
dongsheng@627
|
13307 msgstr ""
|
dongsheng@627
|
13308
|
dongsheng@627
|
13309 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13310 #: ../en/ch10-hook.xml:798
|
dongsheng@627
|
13311 msgid ""
|
dongsheng@627
|
13312 "Because of the specialised nature of this hook, and because Bugzilla was not "
|
dongsheng@627
|
13313 "written with this kind of integration in mind, configuring this hook is a "
|
dongsheng@627
|
13314 "somewhat involved process."
|
dongsheng@627
|
13315 msgstr ""
|
dongsheng@627
|
13316
|
dongsheng@627
|
13317 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13318 #: ../en/ch10-hook.xml:804
|
dongsheng@627
|
13319 msgid ""
|
dongsheng@627
|
13320 "Before you begin, you must install the MySQL bindings for Python on the host"
|
dongsheng@627
|
13321 "(s) where you'll be running the hook. If this is not available as a binary "
|
dongsheng@627
|
13322 "package for your system, you can download it from <citation>web:mysql-python</"
|
dongsheng@627
|
13323 "citation>."
|
dongsheng@627
|
13324 msgstr ""
|
dongsheng@627
|
13325
|
dongsheng@627
|
13326 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13327 #: ../en/ch10-hook.xml:811
|
dongsheng@627
|
13328 msgid ""
|
dongsheng@627
|
13329 "Configuration information for this hook lives in the <literal role=\"rc-"
|
dongsheng@650
|
13330 "bugzilla\">bugzilla</literal> section of your <filename role=\"special\">~/."
|
dongsheng@627
|
13331 "hgrc</filename>."
|
dongsheng@627
|
13332 msgstr ""
|
dongsheng@627
|
13333
|
dongsheng@627
|
13334 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13335 #: ../en/ch10-hook.xml:816
|
dongsheng@627
|
13336 msgid ""
|
dongsheng@627
|
13337 "<envar role=\"rc-item-bugzilla\">version</envar>: The version of Bugzilla "
|
dongsheng@627
|
13338 "installed on the server. The database schema that Bugzilla uses changes "
|
dongsheng@714
|
13339 "occasionally, so this hook has to know exactly which schema to use."
|
dongsheng@627
|
13340 msgstr ""
|
dongsheng@627
|
13341
|
dongsheng@627
|
13342 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13343 #: ../en/ch10-hook.xml:822
|
dongsheng@627
|
13344 msgid ""
|
dongsheng@627
|
13345 "<envar role=\"rc-item-bugzilla\">host</envar>: The hostname of the MySQL "
|
dongsheng@627
|
13346 "server that stores your Bugzilla data. The database must be configured to "
|
dongsheng@627
|
13347 "allow connections from whatever host you are running the <literal role=\"hook"
|
dongsheng@627
|
13348 "\">bugzilla</literal> hook on."
|
dongsheng@627
|
13349 msgstr ""
|
dongsheng@627
|
13350
|
dongsheng@627
|
13351 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13352 #: ../en/ch10-hook.xml:829
|
dongsheng@627
|
13353 msgid ""
|
dongsheng@627
|
13354 "<envar role=\"rc-item-bugzilla\">user</envar>: The username with which to "
|
dongsheng@627
|
13355 "connect to the MySQL server. The database must be configured to allow this "
|
dongsheng@627
|
13356 "user to connect from whatever host you are running the <literal role=\"hook"
|
dongsheng@627
|
13357 "\">bugzilla</literal> hook on. This user must be able to access and modify "
|
dongsheng@627
|
13358 "Bugzilla tables. The default value of this item is <literal>bugs</literal>, "
|
dongsheng@627
|
13359 "which is the standard name of the Bugzilla user in a MySQL database."
|
dongsheng@627
|
13360 msgstr ""
|
dongsheng@627
|
13361
|
dongsheng@627
|
13362 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13363 #: ../en/ch10-hook.xml:840
|
dongsheng@627
|
13364 msgid ""
|
dongsheng@627
|
13365 "<envar role=\"rc-item-bugzilla\">password</envar>: The MySQL password for the "
|
dongsheng@627
|
13366 "user you configured above. This is stored as plain text, so you should make "
|
dongsheng@650
|
13367 "sure that unauthorised users cannot read the <filename role=\"special\">~/."
|
dongsheng@650
|
13368 "hgrc</filename> file where you store this information."
|
dongsheng@627
|
13369 msgstr ""
|
dongsheng@627
|
13370
|
dongsheng@627
|
13371 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13372 #: ../en/ch10-hook.xml:849
|
dongsheng@627
|
13373 msgid ""
|
dongsheng@627
|
13374 "<envar role=\"rc-item-bugzilla\">db</envar>: The name of the Bugzilla "
|
dongsheng@627
|
13375 "database on the MySQL server. The default value of this item is "
|
dongsheng@627
|
13376 "<literal>bugs</literal>, which is the standard name of the MySQL database "
|
dongsheng@627
|
13377 "where Bugzilla stores its data."
|
dongsheng@627
|
13378 msgstr ""
|
dongsheng@627
|
13379
|
dongsheng@627
|
13380 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13381 #: ../en/ch10-hook.xml:856
|
dongsheng@627
|
13382 msgid ""
|
dongsheng@627
|
13383 "<envar role=\"rc-item-bugzilla\">notify</envar>: If you want Bugzilla to send "
|
dongsheng@627
|
13384 "out a notification email to subscribers after this hook has added a comment "
|
dongsheng@627
|
13385 "to a bug, you will need this hook to run a command whenever it updates the "
|
dongsheng@627
|
13386 "database. The command to run depends on where you have installed Bugzilla, "
|
dongsheng@627
|
13387 "but it will typically look something like this, if you have Bugzilla "
|
dongsheng@627
|
13388 "installed in <filename class=\"directory\">/var/www/html/bugzilla</filename>:"
|
dongsheng@627
|
13389 msgstr ""
|
dongsheng@627
|
13390
|
dongsheng@627
|
13391 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13392 #: ../en/ch10-hook.xml:869
|
dongsheng@627
|
13393 msgid ""
|
dongsheng@627
|
13394 "The Bugzilla <literal>processmail</literal> program expects to be given a bug "
|
dongsheng@627
|
13395 "ID (the hook replaces <quote><literal>%s</literal></quote> with the bug ID) "
|
dongsheng@627
|
13396 "and an email address. It also expects to be able to write to some files in "
|
dongsheng@627
|
13397 "the directory that it runs in. If Bugzilla and this hook are not installed "
|
dongsheng@627
|
13398 "on the same machine, you will need to find a way to run <literal>processmail</"
|
dongsheng@627
|
13399 "literal> on the server where Bugzilla is installed."
|
dongsheng@627
|
13400 msgstr ""
|
dongsheng@627
|
13401
|
dongsheng@627
|
13402 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
13403 #: ../en/ch10-hook.xml:884
|
dongsheng@627
|
13404 msgid "Mapping committer names to Bugzilla user names"
|
dongsheng@635
|
13405 msgstr "提交者的名称与 Bugzilla 用户名称的映射"
|
dongsheng@627
|
13406
|
dongsheng@627
|
13407 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13408 #: ../en/ch10-hook.xml:886
|
dongsheng@627
|
13409 msgid ""
|
dongsheng@627
|
13410 "By default, the <literal role=\"hg-ext\">bugzilla</literal> hook tries to use "
|
dongsheng@627
|
13411 "the email address of a changeset's committer as the Bugzilla user name with "
|
dongsheng@627
|
13412 "which to update a bug. If this does not suit your needs, you can map "
|
dongsheng@627
|
13413 "committer email addresses to Bugzilla user names using a <literal role=\"rc-"
|
dongsheng@627
|
13414 "usermap\">usermap</literal> section."
|
dongsheng@627
|
13415 msgstr ""
|
dongsheng@627
|
13416
|
dongsheng@627
|
13417 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13418 #: ../en/ch10-hook.xml:895
|
dongsheng@627
|
13419 msgid ""
|
dongsheng@627
|
13420 "Each item in the <literal role=\"rc-usermap\">usermap</literal> section "
|
dongsheng@627
|
13421 "contains an email address on the left, and a Bugzilla user name on the right."
|
dongsheng@627
|
13422 msgstr ""
|
dongsheng@627
|
13423
|
dongsheng@627
|
13424 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13425 #: ../en/ch10-hook.xml:902
|
dongsheng@627
|
13426 msgid ""
|
dongsheng@627
|
13427 "You can either keep the <literal role=\"rc-usermap\">usermap</literal> data "
|
dongsheng@627
|
13428 "in a normal <filename role=\"special\">~/.hgrc</filename>, or tell the "
|
dongsheng@627
|
13429 "<literal role=\"hg-ext\">bugzilla</literal> hook to read the information from "
|
dongsheng@627
|
13430 "an external <filename>usermap</filename> file. In the latter case, you can "
|
dongsheng@627
|
13431 "store <filename>usermap</filename> data by itself in (for example) a user-"
|
dongsheng@627
|
13432 "modifiable repository. This makes it possible to let your users maintain "
|
dongsheng@627
|
13433 "their own <envar role=\"rc-item-bugzilla\">usermap</envar> entries. The main "
|
dongsheng@650
|
13434 "<filename role=\"special\">~/.hgrc</filename> file might look like this:"
|
dongsheng@627
|
13435 msgstr ""
|
dongsheng@627
|
13436
|
dongsheng@627
|
13437 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13438 #: ../en/ch10-hook.xml:918
|
dongsheng@627
|
13439 msgid ""
|
dongsheng@627
|
13440 "While the <filename>usermap</filename> file that it refers to might look like "
|
dongsheng@627
|
13441 "this:"
|
dongsheng@627
|
13442 msgstr ""
|
dongsheng@627
|
13443
|
dongsheng@627
|
13444 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
13445 #: ../en/ch10-hook.xml:926
|
dongsheng@627
|
13446 msgid "Configuring the text that gets added to a bug"
|
dongsheng@635
|
13447 msgstr "配置增加到问题中的正文"
|
dongsheng@627
|
13448
|
dongsheng@627
|
13449 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13450 #: ../en/ch10-hook.xml:928
|
dongsheng@627
|
13451 msgid ""
|
dongsheng@627
|
13452 "You can configure the text that this hook adds as a comment; you specify it "
|
dongsheng@650
|
13453 "in the form of a Mercurial template. Several <filename role=\"special\">~/."
|
dongsheng@650
|
13454 "hgrc</filename> entries (still in the <literal role=\"rc-bugzilla\">bugzilla</"
|
songdongsheng@710
|
13455 "literal> section) control this behavior."
|
dongsheng@627
|
13456 msgstr ""
|
dongsheng@627
|
13457
|
dongsheng@627
|
13458 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13459 #: ../en/ch10-hook.xml:935
|
dongsheng@627
|
13460 msgid ""
|
dongsheng@627
|
13461 "<literal>strip</literal>: The number of leading path elements to strip from a "
|
dongsheng@627
|
13462 "repository's path name to construct a partial path for a URL. For example, if "
|
dongsheng@627
|
13463 "the repositories on your server live under <filename class=\"directory\">/"
|
dongsheng@627
|
13464 "home/hg/repos</filename>, and you have a repository whose path is <filename "
|
dongsheng@627
|
13465 "class=\"directory\">/home/hg/repos/app/tests</filename>, then setting "
|
dongsheng@627
|
13466 "<literal>strip</literal> to <literal>4</literal> will give a partial path of "
|
dongsheng@627
|
13467 "<filename class=\"directory\">app/tests</filename>. The hook will make this "
|
dongsheng@627
|
13468 "partial path available when expanding a template, as <literal>webroot</"
|
dongsheng@627
|
13469 "literal>."
|
dongsheng@627
|
13470 msgstr ""
|
dongsheng@627
|
13471
|
dongsheng@627
|
13472 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13473 #: ../en/ch10-hook.xml:949
|
dongsheng@627
|
13474 msgid ""
|
dongsheng@627
|
13475 "<literal>template</literal>: The text of the template to use. In addition to "
|
dongsheng@627
|
13476 "the usual changeset-related variables, this template can use <literal>hgweb</"
|
dongsheng@627
|
13477 "literal> (the value of the <literal>hgweb</literal> configuration item above) "
|
dongsheng@627
|
13478 "and <literal>webroot</literal> (the path constructed using <literal>strip</"
|
dongsheng@627
|
13479 "literal> above)."
|
dongsheng@627
|
13480 msgstr ""
|
dongsheng@627
|
13481
|
dongsheng@627
|
13482 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13483 #: ../en/ch10-hook.xml:959
|
dongsheng@627
|
13484 msgid ""
|
dongsheng@627
|
13485 "In addition, you can add a <envar role=\"rc-item-web\">baseurl</envar> item "
|
dongsheng@627
|
13486 "to the <literal role=\"rc-web\">web</literal> section of your <filename role="
|
dongsheng@650
|
13487 "\"special\">~/.hgrc</filename>. The <literal role=\"hg-ext\">bugzilla</"
|
dongsheng@627
|
13488 "literal> hook will make this available when expanding a template, as the base "
|
dongsheng@627
|
13489 "string to use when constructing a URL that will let users browse from a "
|
dongsheng@627
|
13490 "Bugzilla comment to view a changeset. Example:"
|
dongsheng@627
|
13491 msgstr ""
|
dongsheng@627
|
13492
|
dongsheng@627
|
13493 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13494 #: ../en/ch10-hook.xml:971
|
dongsheng@627
|
13495 msgid ""
|
dongsheng@627
|
13496 "Here is an example set of <literal role=\"hg-ext\">bugzilla</literal> hook "
|
dongsheng@627
|
13497 "config information."
|
dongsheng@627
|
13498 msgstr ""
|
dongsheng@627
|
13499
|
dongsheng@627
|
13500 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13501 #: ../en/ch10-hook.xml:981
|
dongsheng@627
|
13502 msgid ""
|
dongsheng@627
|
13503 "The most common problems with configuring the <literal role=\"hg-ext"
|
dongsheng@627
|
13504 "\">bugzilla</literal> hook relate to running Bugzilla's "
|
dongsheng@627
|
13505 "<filename>processmail</filename> script and mapping committer names to user "
|
dongsheng@627
|
13506 "names."
|
dongsheng@627
|
13507 msgstr ""
|
dongsheng@627
|
13508
|
dongsheng@627
|
13509 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13510 #: ../en/ch10-hook.xml:987
|
dongsheng@627
|
13511 msgid ""
|
songdongsheng@658
|
13512 "Recall from <xref linkend=\"sec:hook:bugzilla:config\"/> above that the user "
|
songdongsheng@658
|
13513 "that runs the Mercurial process on the server is also the one that will run "
|
songdongsheng@658
|
13514 "the <filename>processmail</filename> script. The <filename>processmail</"
|
songdongsheng@658
|
13515 "filename> script sometimes causes Bugzilla to write to files in its "
|
songdongsheng@658
|
13516 "configuration directory, and Bugzilla's configuration files are usually owned "
|
songdongsheng@658
|
13517 "by the user that your web server runs under."
|
dongsheng@627
|
13518 msgstr ""
|
dongsheng@627
|
13519
|
dongsheng@627
|
13520 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13521 #: ../en/ch10-hook.xml:998
|
dongsheng@627
|
13522 msgid ""
|
dongsheng@627
|
13523 "You can cause <filename>processmail</filename> to be run with the suitable "
|
dongsheng@627
|
13524 "user's identity using the <command>sudo</command> command. Here is an "
|
dongsheng@627
|
13525 "example entry for a <filename>sudoers</filename> file."
|
dongsheng@627
|
13526 msgstr ""
|
dongsheng@627
|
13527
|
dongsheng@627
|
13528 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13529 #: ../en/ch10-hook.xml:1005
|
dongsheng@627
|
13530 msgid ""
|
dongsheng@627
|
13531 "This allows the <literal>hg_user</literal> user to run a "
|
dongsheng@627
|
13532 "<filename>processmail-wrapper</filename> program under the identity of "
|
dongsheng@627
|
13533 "<literal>httpd_user</literal>."
|
dongsheng@627
|
13534 msgstr ""
|
dongsheng@627
|
13535
|
dongsheng@627
|
13536 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13537 #: ../en/ch10-hook.xml:1010
|
dongsheng@627
|
13538 msgid ""
|
dongsheng@627
|
13539 "This indirection through a wrapper script is necessary, because "
|
dongsheng@627
|
13540 "<filename>processmail</filename> expects to be run with its current directory "
|
dongsheng@627
|
13541 "set to wherever you installed Bugzilla; you can't specify that kind of "
|
dongsheng@627
|
13542 "constraint in a <filename>sudoers</filename> file. The contents of the "
|
dongsheng@627
|
13543 "wrapper script are simple:"
|
dongsheng@627
|
13544 msgstr ""
|
dongsheng@627
|
13545
|
dongsheng@627
|
13546 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13547 #: ../en/ch10-hook.xml:1019
|
dongsheng@627
|
13548 msgid ""
|
dongsheng@627
|
13549 "It doesn't seem to matter what email address you pass to "
|
dongsheng@627
|
13550 "<filename>processmail</filename>."
|
dongsheng@627
|
13551 msgstr ""
|
dongsheng@627
|
13552
|
dongsheng@627
|
13553 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13554 #: ../en/ch10-hook.xml:1023
|
dongsheng@627
|
13555 msgid ""
|
dongsheng@627
|
13556 "If your <literal role=\"rc-usermap\">usermap</literal> is not set up "
|
dongsheng@627
|
13557 "correctly, users will see an error message from the <literal role=\"hg-ext"
|
dongsheng@627
|
13558 "\">bugzilla</literal> hook when they push changes to the server. The error "
|
dongsheng@627
|
13559 "message will look like this:"
|
dongsheng@627
|
13560 msgstr ""
|
dongsheng@627
|
13561
|
dongsheng@627
|
13562 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13563 #: ../en/ch10-hook.xml:1030
|
dongsheng@627
|
13564 msgid ""
|
dongsheng@627
|
13565 "What this means is that the committer's address, <literal>john.q."
|
dongsheng@627
|
13566 "public@example.com</literal>, is not a valid Bugzilla user name, nor does it "
|
dongsheng@627
|
13567 "have an entry in your <literal role=\"rc-usermap\">usermap</literal> that "
|
dongsheng@627
|
13568 "maps it to a valid Bugzilla user name."
|
dongsheng@627
|
13569 msgstr ""
|
dongsheng@627
|
13570
|
dongsheng@627
|
13571 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
13572 #: ../en/ch10-hook.xml:1040
|
songdongsheng@668
|
13573 msgid ""
|
songdongsheng@668
|
13574 "<literal role=\"hg-ext\">notify</literal>&emdash;send email notifications"
|
dongsheng@661
|
13575 msgstr "<literal role=\"hg-ext\">notify</literal>—邮件通知"
|
dongsheng@627
|
13576
|
dongsheng@627
|
13577 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13578 #: ../en/ch10-hook.xml:1043
|
dongsheng@627
|
13579 msgid ""
|
dongsheng@627
|
13580 "Although Mercurial's built-in web server provides RSS feeds of changes in "
|
dongsheng@627
|
13581 "every repository, many people prefer to receive change notifications via "
|
dongsheng@627
|
13582 "email. The <literal role=\"hg-ext\">notify</literal> hook lets you send out "
|
dongsheng@627
|
13583 "notifications to a set of email addresses whenever changesets arrive that "
|
dongsheng@627
|
13584 "those subscribers are interested in."
|
dongsheng@627
|
13585 msgstr ""
|
dongsheng@627
|
13586
|
dongsheng@627
|
13587 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13588 #: ../en/ch10-hook.xml:1051
|
dongsheng@627
|
13589 msgid ""
|
dongsheng@627
|
13590 "As with the <literal role=\"hg-ext\">bugzilla</literal> hook, the <literal "
|
dongsheng@627
|
13591 "role=\"hg-ext\">notify</literal> hook is template-driven, so you can "
|
dongsheng@627
|
13592 "customise the contents of the notification messages that it sends."
|
dongsheng@627
|
13593 msgstr ""
|
dongsheng@627
|
13594
|
dongsheng@627
|
13595 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13596 #: ../en/ch10-hook.xml:1057
|
dongsheng@627
|
13597 msgid ""
|
dongsheng@627
|
13598 "By default, the <literal role=\"hg-ext\">notify</literal> hook includes a "
|
dongsheng@627
|
13599 "diff of every changeset that it sends out; you can limit the size of the "
|
dongsheng@627
|
13600 "diff, or turn this feature off entirely. It is useful for letting "
|
dongsheng@627
|
13601 "subscribers review changes immediately, rather than clicking to follow a URL."
|
dongsheng@627
|
13602 msgstr ""
|
dongsheng@627
|
13603
|
dongsheng@627
|
13604 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
13605 #: ../en/ch10-hook.xml:1065
|
dongsheng@627
|
13606 msgid "Configuring the <literal role=\"hg-ext\">notify</literal> hook"
|
dongsheng@635
|
13607 msgstr "配置 <literal role=\"hg-ext\">notify</literal> 钩子"
|
dongsheng@627
|
13608
|
dongsheng@627
|
13609 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13610 #: ../en/ch10-hook.xml:1068
|
dongsheng@627
|
13611 msgid ""
|
dongsheng@627
|
13612 "You can set up the <literal role=\"hg-ext\">notify</literal> hook to send one "
|
dongsheng@627
|
13613 "email message per incoming changeset, or one per incoming group of changesets "
|
dongsheng@627
|
13614 "(all those that arrived in a single pull or push)."
|
dongsheng@627
|
13615 msgstr ""
|
dongsheng@627
|
13616
|
dongsheng@627
|
13617 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13618 #: ../en/ch10-hook.xml:1080
|
dongsheng@627
|
13619 msgid ""
|
dongsheng@627
|
13620 "Configuration information for this hook lives in the <literal role=\"rc-notify"
|
dongsheng@650
|
13621 "\">notify</literal> section of a <filename role=\"special\">~/.hgrc</"
|
dongsheng@650
|
13622 "filename> file."
|
dongsheng@627
|
13623 msgstr ""
|
dongsheng@627
|
13624
|
dongsheng@627
|
13625 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13626 #: ../en/ch10-hook.xml:1085
|
dongsheng@627
|
13627 msgid ""
|
dongsheng@627
|
13628 "<envar role=\"rc-item-notify\">test</envar>: By default, this hook does not "
|
dongsheng@627
|
13629 "send out email at all; instead, it prints the message that it "
|
dongsheng@627
|
13630 "<emphasis>would</emphasis> send. Set this item to <literal>false</literal> "
|
dongsheng@627
|
13631 "to allow email to be sent. The reason that sending of email is turned off by "
|
dongsheng@627
|
13632 "default is that it takes several tries to configure this extension exactly as "
|
dongsheng@627
|
13633 "you would like, and it would be bad form to spam subscribers with a number of "
|
dongsheng@627
|
13634 "<quote>broken</quote> notifications while you debug your configuration."
|
dongsheng@627
|
13635 msgstr ""
|
dongsheng@627
|
13636
|
dongsheng@627
|
13637 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13638 #: ../en/ch10-hook.xml:1097
|
dongsheng@627
|
13639 msgid ""
|
dongsheng@627
|
13640 "<envar role=\"rc-item-notify\">config</envar>: The path to a configuration "
|
dongsheng@627
|
13641 "file that contains subscription information. This is kept separate from the "
|
dongsheng@650
|
13642 "main <filename role=\"special\">~/.hgrc</filename> so that you can maintain "
|
dongsheng@627
|
13643 "it in a repository of its own. People can then clone that repository, update "
|
dongsheng@627
|
13644 "their subscriptions, and push the changes back to your server."
|
dongsheng@627
|
13645 msgstr ""
|
dongsheng@627
|
13646
|
dongsheng@627
|
13647 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13648 #: ../en/ch10-hook.xml:1106
|
dongsheng@627
|
13649 msgid ""
|
dongsheng@627
|
13650 "<envar role=\"rc-item-notify\">strip</envar>: The number of leading path "
|
dongsheng@627
|
13651 "separator characters to strip from a repository's path, when deciding whether "
|
dongsheng@627
|
13652 "a repository has subscribers. For example, if the repositories on your "
|
dongsheng@627
|
13653 "server live in <filename class=\"directory\">/home/hg/repos</filename>, and "
|
dongsheng@627
|
13654 "<literal role=\"hg-ext\">notify</literal> is considering a repository named "
|
dongsheng@627
|
13655 "<filename class=\"directory\">/home/hg/repos/shared/test</filename>, setting "
|
dongsheng@627
|
13656 "<envar role=\"rc-item-notify\">strip</envar> to <literal>4</literal> will "
|
dongsheng@627
|
13657 "cause <literal role=\"hg-ext\">notify</literal> to trim the path it considers "
|
dongsheng@627
|
13658 "down to <filename class=\"directory\">shared/test</filename>, and it will "
|
dongsheng@627
|
13659 "match subscribers against that."
|
dongsheng@627
|
13660 msgstr ""
|
dongsheng@627
|
13661
|
dongsheng@627
|
13662 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13663 #: ../en/ch10-hook.xml:1123
|
dongsheng@627
|
13664 msgid ""
|
dongsheng@627
|
13665 "<envar role=\"rc-item-notify\">template</envar>: The template text to use "
|
dongsheng@627
|
13666 "when sending messages. This specifies both the contents of the message "
|
dongsheng@627
|
13667 "header and its body."
|
dongsheng@627
|
13668 msgstr ""
|
dongsheng@627
|
13669
|
dongsheng@627
|
13670 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13671 #: ../en/ch10-hook.xml:1129
|
dongsheng@627
|
13672 msgid ""
|
dongsheng@627
|
13673 "<envar role=\"rc-item-notify\">maxdiff</envar>: The maximum number of lines "
|
dongsheng@627
|
13674 "of diff data to append to the end of a message. If a diff is longer than "
|
dongsheng@627
|
13675 "this, it is truncated. By default, this is set to 300. Set this to "
|
dongsheng@627
|
13676 "<literal>0</literal> to omit diffs from notification emails."
|
dongsheng@627
|
13677 msgstr ""
|
dongsheng@627
|
13678
|
dongsheng@627
|
13679 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13680 #: ../en/ch10-hook.xml:1138
|
dongsheng@627
|
13681 msgid ""
|
dongsheng@627
|
13682 "<envar role=\"rc-item-notify\">sources</envar>: A list of sources of "
|
dongsheng@627
|
13683 "changesets to consider. This lets you limit <literal role=\"hg-ext\">notify</"
|
dongsheng@627
|
13684 "literal> to only sending out email about changes that remote users pushed "
|
songdongsheng@658
|
13685 "into this repository via a server, for example. See <xref linkend=\"sec:hook:"
|
songdongsheng@658
|
13686 "sources\"/> for the sources you can specify here."
|
dongsheng@627
|
13687 msgstr ""
|
dongsheng@627
|
13688
|
dongsheng@627
|
13689 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13690 #: ../en/ch10-hook.xml:1149
|
dongsheng@627
|
13691 msgid ""
|
dongsheng@627
|
13692 "If you set the <envar role=\"rc-item-web\">baseurl</envar> item in the "
|
dongsheng@627
|
13693 "<literal role=\"rc-web\">web</literal> section, you can use it in a template; "
|
dongsheng@627
|
13694 "it will be available as <literal>webroot</literal>."
|
dongsheng@627
|
13695 msgstr ""
|
dongsheng@627
|
13696
|
dongsheng@627
|
13697 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13698 #: ../en/ch10-hook.xml:1155
|
dongsheng@627
|
13699 msgid ""
|
dongsheng@627
|
13700 "Here is an example set of <literal role=\"hg-ext\">notify</literal> "
|
dongsheng@627
|
13701 "configuration information."
|
dongsheng@627
|
13702 msgstr ""
|
dongsheng@627
|
13703
|
dongsheng@627
|
13704 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13705 #: ../en/ch10-hook.xml:1161
|
dongsheng@627
|
13706 msgid "This will produce a message that looks like the following:"
|
dongsheng@627
|
13707 msgstr ""
|
dongsheng@627
|
13708
|
dongsheng@627
|
13709 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13710 #: ../en/ch10-hook.xml:1171
|
dongsheng@627
|
13711 msgid ""
|
dongsheng@627
|
13712 "Do not forget that by default, the <literal role=\"hg-ext\">notify</literal> "
|
dongsheng@627
|
13713 "extension <emphasis>will not send any mail</emphasis> until you explicitly "
|
dongsheng@627
|
13714 "configure it to do so, by setting <envar role=\"rc-item-notify\">test</envar> "
|
dongsheng@627
|
13715 "to <literal>false</literal>. Until you do that, it simply prints the message "
|
dongsheng@627
|
13716 "it <emphasis>would</emphasis> send."
|
dongsheng@627
|
13717 msgstr ""
|
dongsheng@627
|
13718
|
dongsheng@627
|
13719 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
13720 #: ../en/ch10-hook.xml:1183
|
dongsheng@627
|
13721 msgid "Information for writers of hooks"
|
dongsheng@635
|
13722 msgstr "编写钩子的信息"
|
dongsheng@627
|
13723
|
dongsheng@627
|
13724 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
13725 #: ../en/ch10-hook.xml:1186
|
dongsheng@627
|
13726 msgid "In-process hook execution"
|
dongsheng@635
|
13727 msgstr "进程内钩子的执行"
|
dongsheng@627
|
13728
|
dongsheng@627
|
13729 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13730 #: ../en/ch10-hook.xml:1188
|
dongsheng@627
|
13731 msgid "An in-process hook is called with arguments of the following form:"
|
dongsheng@627
|
13732 msgstr ""
|
dongsheng@627
|
13733
|
dongsheng@627
|
13734 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13735 #: ../en/ch10-hook.xml:1192
|
dongsheng@627
|
13736 msgid ""
|
dongsheng@627
|
13737 "The <literal>ui</literal> parameter is a <literal role=\"py-mod-mercurial.ui"
|
dongsheng@627
|
13738 "\">ui</literal> object. The <literal>repo</literal> parameter is a <literal "
|
dongsheng@627
|
13739 "role=\"py-mod-mercurial.localrepo\">localrepository</literal> object. The "
|
dongsheng@627
|
13740 "names and values of the <literal>**kwargs</literal> parameters depend on the "
|
dongsheng@627
|
13741 "hook being invoked, with the following common features:"
|
dongsheng@627
|
13742 msgstr ""
|
dongsheng@627
|
13743
|
dongsheng@627
|
13744 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
13745 #: ../en/ch10-hook.xml:1201
|
dongsheng@627
|
13746 msgid ""
|
dongsheng@627
|
13747 "If a parameter is named <literal>node</literal> or <literal>parentN</"
|
dongsheng@627
|
13748 "literal>, it will contain a hexadecimal changeset ID. The empty string is "
|
dongsheng@627
|
13749 "used to represent <quote>null changeset ID</quote> instead of a string of "
|
dongsheng@627
|
13750 "zeroes."
|
dongsheng@627
|
13751 msgstr ""
|
dongsheng@627
|
13752
|
dongsheng@627
|
13753 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
13754 #: ../en/ch10-hook.xml:1208
|
dongsheng@627
|
13755 msgid ""
|
dongsheng@627
|
13756 "If a parameter is named <literal>url</literal>, it will contain the URL of a "
|
dongsheng@627
|
13757 "remote repository, if that can be determined."
|
dongsheng@627
|
13758 msgstr ""
|
dongsheng@627
|
13759
|
dongsheng@627
|
13760 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
13761 #: ../en/ch10-hook.xml:1213
|
dongsheng@627
|
13762 msgid ""
|
dongsheng@627
|
13763 "Boolean-valued parameters are represented as Python <literal>bool</literal> "
|
dongsheng@627
|
13764 "objects."
|
dongsheng@627
|
13765 msgstr ""
|
dongsheng@627
|
13766
|
dongsheng@627
|
13767 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13768 #: ../en/ch10-hook.xml:1218
|
dongsheng@627
|
13769 msgid ""
|
dongsheng@627
|
13770 "An in-process hook is called without a change to the process's working "
|
dongsheng@627
|
13771 "directory (unlike external hooks, which are run in the root of the "
|
dongsheng@627
|
13772 "repository). It must not change the process's working directory, or it will "
|
dongsheng@627
|
13773 "cause any calls it makes into the Mercurial API to fail."
|
dongsheng@627
|
13774 msgstr ""
|
dongsheng@627
|
13775
|
dongsheng@627
|
13776 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13777 #: ../en/ch10-hook.xml:1225
|
dongsheng@627
|
13778 msgid ""
|
dongsheng@627
|
13779 "If a hook returns a boolean <quote>false</quote> value, it is considered to "
|
dongsheng@627
|
13780 "have succeeded. If it returns a boolean <quote>true</quote> value or raises "
|
dongsheng@627
|
13781 "an exception, it is considered to have failed. A useful way to think of the "
|
dongsheng@627
|
13782 "calling convention is <quote>tell me if you fail</quote>."
|
dongsheng@627
|
13783 msgstr ""
|
dongsheng@627
|
13784
|
dongsheng@627
|
13785 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13786 #: ../en/ch10-hook.xml:1232
|
dongsheng@627
|
13787 msgid ""
|
dongsheng@627
|
13788 "Note that changeset IDs are passed into Python hooks as hexadecimal strings, "
|
dongsheng@627
|
13789 "not the binary hashes that Mercurial's APIs normally use. To convert a hash "
|
dongsheng@650
|
13790 "from hex to binary, use the <literal>bin</literal> function."
|
dongsheng@650
|
13791 msgstr ""
|
dongsheng@650
|
13792
|
dongsheng@650
|
13793 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
13794 #: ../en/ch10-hook.xml:1240
|
dongsheng@627
|
13795 msgid "External hook execution"
|
dongsheng@635
|
13796 msgstr "外部钩子的执行"
|
dongsheng@627
|
13797
|
dongsheng@627
|
13798 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13799 #: ../en/ch10-hook.xml:1242
|
dongsheng@627
|
13800 msgid ""
|
dongsheng@627
|
13801 "An external hook is passed to the shell of the user running Mercurial. "
|
dongsheng@627
|
13802 "Features of that shell, such as variable substitution and command "
|
dongsheng@627
|
13803 "redirection, are available. The hook is run in the root directory of the "
|
dongsheng@627
|
13804 "repository (unlike in-process hooks, which are run in the same directory that "
|
dongsheng@627
|
13805 "Mercurial was run in)."
|
dongsheng@627
|
13806 msgstr ""
|
dongsheng@627
|
13807
|
dongsheng@627
|
13808 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13809 #: ../en/ch10-hook.xml:1250
|
dongsheng@627
|
13810 msgid ""
|
dongsheng@627
|
13811 "Hook parameters are passed to the hook as environment variables. Each "
|
dongsheng@627
|
13812 "environment variable's name is converted in upper case and prefixed with the "
|
dongsheng@627
|
13813 "string <quote><literal>HG_</literal></quote>. For example, if the name of a "
|
dongsheng@627
|
13814 "parameter is <quote><literal>node</literal></quote>, the name of the "
|
dongsheng@627
|
13815 "environment variable representing that parameter will be "
|
dongsheng@627
|
13816 "<quote><literal>HG_NODE</literal></quote>."
|
dongsheng@627
|
13817 msgstr ""
|
dongsheng@627
|
13818
|
dongsheng@627
|
13819 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13820 #: ../en/ch10-hook.xml:1259
|
dongsheng@627
|
13821 msgid ""
|
dongsheng@627
|
13822 "A boolean parameter is represented as the string <quote><literal>1</literal></"
|
dongsheng@627
|
13823 "quote> for <quote>true</quote>, <quote><literal>0</literal></quote> for "
|
dongsheng@627
|
13824 "<quote>false</quote>. If an environment variable is named <envar>HG_NODE</"
|
dongsheng@627
|
13825 "envar>, <envar>HG_PARENT1</envar> or <envar>HG_PARENT2</envar>, it contains a "
|
dongsheng@627
|
13826 "changeset ID represented as a hexadecimal string. The empty string is used "
|
dongsheng@627
|
13827 "to represent <quote>null changeset ID</quote> instead of a string of zeroes. "
|
dongsheng@627
|
13828 "If an environment variable is named <envar>HG_URL</envar>, it will contain "
|
dongsheng@627
|
13829 "the URL of a remote repository, if that can be determined."
|
dongsheng@627
|
13830 msgstr ""
|
dongsheng@627
|
13831
|
dongsheng@627
|
13832 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13833 #: ../en/ch10-hook.xml:1271
|
dongsheng@627
|
13834 msgid ""
|
dongsheng@627
|
13835 "If a hook exits with a status of zero, it is considered to have succeeded. "
|
dongsheng@627
|
13836 "If it exits with a non-zero status, it is considered to have failed."
|
dongsheng@627
|
13837 msgstr ""
|
dongsheng@627
|
13838
|
dongsheng@627
|
13839 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
13840 #: ../en/ch10-hook.xml:1278
|
dongsheng@627
|
13841 msgid "Finding out where changesets come from"
|
dongsheng@635
|
13842 msgstr "检查修改集来自何处"
|
dongsheng@627
|
13843
|
dongsheng@627
|
13844 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13845 #: ../en/ch10-hook.xml:1280
|
dongsheng@627
|
13846 msgid ""
|
dongsheng@627
|
13847 "A hook that involves the transfer of changesets between a local repository "
|
dongsheng@627
|
13848 "and another may be able to find out information about the <quote>far side</"
|
dongsheng@627
|
13849 "quote>. Mercurial knows <emphasis>how</emphasis> changes are being "
|
dongsheng@627
|
13850 "transferred, and in many cases <emphasis>where</emphasis> they are being "
|
dongsheng@627
|
13851 "transferred to or from."
|
dongsheng@627
|
13852 msgstr ""
|
dongsheng@627
|
13853
|
dongsheng@627
|
13854 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
13855 #: ../en/ch10-hook.xml:1289
|
dongsheng@627
|
13856 msgid "Sources of changesets"
|
dongsheng@635
|
13857 msgstr "修改集的来源"
|
dongsheng@627
|
13858
|
dongsheng@627
|
13859 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13860 #: ../en/ch10-hook.xml:1291
|
dongsheng@627
|
13861 msgid ""
|
dongsheng@627
|
13862 "Mercurial will tell a hook what means are, or were, used to transfer "
|
dongsheng@627
|
13863 "changesets between repositories. This is provided by Mercurial in a Python "
|
dongsheng@627
|
13864 "parameter named <literal>source</literal>, or an environment variable named "
|
dongsheng@627
|
13865 "<envar>HG_SOURCE</envar>."
|
dongsheng@627
|
13866 msgstr ""
|
dongsheng@627
|
13867
|
dongsheng@627
|
13868 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13869 #: ../en/ch10-hook.xml:1299
|
dongsheng@627
|
13870 msgid ""
|
dongsheng@627
|
13871 "<literal>serve</literal>: Changesets are transferred to or from a remote "
|
dongsheng@627
|
13872 "repository over http or ssh."
|
dongsheng@627
|
13873 msgstr ""
|
dongsheng@627
|
13874
|
dongsheng@627
|
13875 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13876 #: ../en/ch10-hook.xml:1304
|
dongsheng@627
|
13877 msgid ""
|
dongsheng@627
|
13878 "<literal>pull</literal>: Changesets are being transferred via a pull from one "
|
dongsheng@627
|
13879 "repository into another."
|
dongsheng@627
|
13880 msgstr ""
|
dongsheng@627
|
13881
|
dongsheng@627
|
13882 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13883 #: ../en/ch10-hook.xml:1309
|
dongsheng@627
|
13884 msgid ""
|
dongsheng@627
|
13885 "<literal>push</literal>: Changesets are being transferred via a push from one "
|
dongsheng@627
|
13886 "repository into another."
|
dongsheng@627
|
13887 msgstr ""
|
dongsheng@627
|
13888
|
dongsheng@627
|
13889 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13890 #: ../en/ch10-hook.xml:1314
|
dongsheng@627
|
13891 msgid ""
|
dongsheng@627
|
13892 "<literal>bundle</literal>: Changesets are being transferred to or from a "
|
dongsheng@627
|
13893 "bundle."
|
dongsheng@627
|
13894 msgstr ""
|
dongsheng@627
|
13895
|
dongsheng@627
|
13896 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
|
dongsheng@714
|
13897 #: ../en/ch10-hook.xml:1321
|
songdongsheng@668
|
13898 msgid "Where changes are going&emdash;remote repository URLs"
|
dongsheng@661
|
13899 msgstr "修改集要到哪里—远程版本库的地址"
|
dongsheng@627
|
13900
|
dongsheng@627
|
13901 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13902 #: ../en/ch10-hook.xml:1324
|
dongsheng@627
|
13903 msgid ""
|
dongsheng@627
|
13904 "When possible, Mercurial will tell a hook the location of the <quote>far "
|
dongsheng@627
|
13905 "side</quote> of an activity that transfers changeset data between "
|
dongsheng@627
|
13906 "repositories. This is provided by Mercurial in a Python parameter named "
|
dongsheng@627
|
13907 "<literal>url</literal>, or an environment variable named <envar>HG_URL</"
|
dongsheng@627
|
13908 "envar>."
|
dongsheng@627
|
13909 msgstr ""
|
dongsheng@627
|
13910
|
dongsheng@627
|
13911 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
|
dongsheng@714
|
13912 #: ../en/ch10-hook.xml:1332
|
dongsheng@627
|
13913 msgid ""
|
dongsheng@627
|
13914 "This information is not always known. If a hook is invoked in a repository "
|
dongsheng@627
|
13915 "that is being served via http or ssh, Mercurial cannot tell where the remote "
|
dongsheng@627
|
13916 "repository is, but it may know where the client is connecting from. In such "
|
dongsheng@627
|
13917 "cases, the URL will take one of the following forms:"
|
dongsheng@627
|
13918 msgstr ""
|
dongsheng@627
|
13919
|
dongsheng@627
|
13920 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13921 #: ../en/ch10-hook.xml:1339
|
dongsheng@627
|
13922 msgid ""
|
songdongsheng@668
|
13923 "<literal>remote:ssh:1.2.3.4</literal>&emdash;remote ssh client, at the IP "
|
songdongsheng@668
|
13924 "address <literal>1.2.3.4</literal>."
|
dongsheng@627
|
13925 msgstr ""
|
dongsheng@627
|
13926
|
dongsheng@627
|
13927 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13928 #: ../en/ch10-hook.xml:1344
|
dongsheng@627
|
13929 msgid ""
|
songdongsheng@668
|
13930 "<literal>remote:http:1.2.3.4</literal>&emdash;remote http client, at the IP "
|
songdongsheng@668
|
13931 "address <literal>1.2.3.4</literal>. If the client is using SSL, this will be "
|
songdongsheng@668
|
13932 "of the form <literal>remote:https:1.2.3.4</literal>."
|
dongsheng@627
|
13933 msgstr ""
|
dongsheng@627
|
13934
|
dongsheng@627
|
13935 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
|
dongsheng@714
|
13936 #: ../en/ch10-hook.xml:1351
|
songdongsheng@668
|
13937 msgid "Empty&emdash;no information could be discovered about the remote client."
|
dongsheng@627
|
13938 msgstr ""
|
dongsheng@627
|
13939
|
dongsheng@627
|
13940 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
13941 #: ../en/ch10-hook.xml:1359
|
dongsheng@627
|
13942 msgid "Hook reference"
|
dongsheng@635
|
13943 msgstr "钩子参考"
|
dongsheng@627
|
13944
|
dongsheng@627
|
13945 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
13946 #: ../en/ch10-hook.xml:1362
|
songdongsheng@668
|
13947 msgid ""
|
songdongsheng@668
|
13948 "<literal role=\"hook\">changegroup</literal>&emdash;after remote changesets "
|
songdongsheng@668
|
13949 "added"
|
dongsheng@661
|
13950 msgstr "<literal role=\"hook\">changegroup</literal>—增加远程修改集之后"
|
dongsheng@627
|
13951
|
dongsheng@627
|
13952 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13953 #: ../en/ch10-hook.xml:1365
|
dongsheng@627
|
13954 msgid ""
|
dongsheng@627
|
13955 "This hook is run after a group of pre-existing changesets has been added to "
|
dongsheng@627
|
13956 "the repository, for example via a <command role=\"hg-cmd\">hg pull</command> "
|
dongsheng@627
|
13957 "or <command role=\"hg-cmd\">hg unbundle</command>. This hook is run once per "
|
dongsheng@627
|
13958 "operation that added one or more changesets. This is in contrast to the "
|
dongsheng@627
|
13959 "<literal role=\"hook\">incoming</literal> hook, which is run once per "
|
dongsheng@627
|
13960 "changeset, regardless of whether the changesets arrive in a group."
|
dongsheng@627
|
13961 msgstr ""
|
dongsheng@627
|
13962
|
dongsheng@627
|
13963 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13964 #: ../en/ch10-hook.xml:1375
|
dongsheng@627
|
13965 msgid ""
|
dongsheng@627
|
13966 "Some possible uses for this hook include kicking off an automated build or "
|
dongsheng@627
|
13967 "test of the added changesets, updating a bug database, or notifying "
|
dongsheng@627
|
13968 "subscribers that a repository contains new changes."
|
dongsheng@627
|
13969 msgstr ""
|
dongsheng@627
|
13970
|
dongsheng@627
|
13971 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
13972 #: ../en/ch10-hook.xml:1381 ../en/ch10-hook.xml:1421 ../en/ch10-hook.xml:1465
|
dongsheng@714
|
13973 #: ../en/ch10-hook.xml:1507 ../en/ch10-hook.xml:1562 ../en/ch10-hook.xml:1602
|
dongsheng@714
|
13974 #: ../en/ch10-hook.xml:1638 ../en/ch10-hook.xml:1672 ../en/ch10-hook.xml:1736
|
dongsheng@714
|
13975 #: ../en/ch10-hook.xml:1794 ../en/ch10-hook.xml:1830 ../en/ch10-hook.xml:1857
|
dongsheng@627
|
13976 msgid "Parameters to this hook:"
|
dongsheng@627
|
13977 msgstr ""
|
dongsheng@627
|
13978
|
dongsheng@627
|
13979 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
13980 #: ../en/ch10-hook.xml:1384 ../en/ch10-hook.xml:1739
|
dongsheng@627
|
13981 msgid ""
|
dongsheng@627
|
13982 "<literal>node</literal>: A changeset ID. The changeset ID of the first "
|
dongsheng@627
|
13983 "changeset in the group that was added. All changesets between this and "
|
dongsheng@650
|
13984 "<literal role=\"tag\">tip</literal>, inclusive, were added by a single "
|
dongsheng@650
|
13985 "<command role=\"hg-cmd\">hg pull</command>, <command role=\"hg-cmd\">hg push</"
|
dongsheng@650
|
13986 "command> or <command role=\"hg-cmd\">hg unbundle</command>."
|
dongsheng@627
|
13987 msgstr ""
|
dongsheng@627
|
13988
|
dongsheng@627
|
13989 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
13990 #: ../en/ch10-hook.xml:1393 ../en/ch10-hook.xml:1472 ../en/ch10-hook.xml:1565
|
dongsheng@714
|
13991 #: ../en/ch10-hook.xml:1749
|
dongsheng@627
|
13992 msgid ""
|
songdongsheng@658
|
13993 "<literal>source</literal>: A string. The source of these changes. See <xref "
|
songdongsheng@658
|
13994 "linkend=\"sec:hook:sources\"/> for details."
|
dongsheng@627
|
13995 msgstr ""
|
dongsheng@627
|
13996
|
dongsheng@627
|
13997 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
13998 #: ../en/ch10-hook.xml:1398 ../en/ch10-hook.xml:1477 ../en/ch10-hook.xml:1528
|
dongsheng@714
|
13999 #: ../en/ch10-hook.xml:1570 ../en/ch10-hook.xml:1651 ../en/ch10-hook.xml:1754
|
dongsheng@627
|
14000 msgid ""
|
dongsheng@627
|
14001 "<literal>url</literal>: A URL. The location of the remote repository, if "
|
songdongsheng@658
|
14002 "known. See <xref linkend=\"sec:hook:url\"/> for more information."
|
songdongsheng@658
|
14003 msgstr ""
|
songdongsheng@658
|
14004
|
songdongsheng@658
|
14005 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14006 #: ../en/ch10-hook.xml:1404
|
songdongsheng@658
|
14007 msgid ""
|
songdongsheng@658
|
14008 "See also: <literal role=\"hook\">incoming</literal> (<xref linkend=\"sec:hook:"
|
songdongsheng@658
|
14009 "incoming\"/>), <literal role=\"hook\">prechangegroup</literal> (<xref linkend="
|
songdongsheng@658
|
14010 "\"sec:hook:prechangegroup\"/>), <literal role=\"hook\">pretxnchangegroup</"
|
songdongsheng@658
|
14011 "literal> (<xref linkend=\"sec:hook:pretxnchangegroup\"/>)"
|
dongsheng@627
|
14012 msgstr ""
|
dongsheng@627
|
14013
|
dongsheng@627
|
14014 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
14015 #: ../en/ch10-hook.xml:1415
|
songdongsheng@668
|
14016 msgid ""
|
songdongsheng@668
|
14017 "<literal role=\"hook\">commit</literal>&emdash;after a new changeset is "
|
songdongsheng@668
|
14018 "created"
|
dongsheng@661
|
14019 msgstr "<literal role=\"hook\">commit</literal>—创建新修改集之后"
|
dongsheng@627
|
14020
|
dongsheng@627
|
14021 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14022 #: ../en/ch10-hook.xml:1418
|
dongsheng@627
|
14023 msgid "This hook is run after a new changeset has been created."
|
dongsheng@627
|
14024 msgstr ""
|
dongsheng@627
|
14025
|
dongsheng@627
|
14026 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
14027 #: ../en/ch10-hook.xml:1424 ../en/ch10-hook.xml:1797
|
dongsheng@627
|
14028 msgid ""
|
dongsheng@627
|
14029 "<literal>node</literal>: A changeset ID. The changeset ID of the newly "
|
dongsheng@627
|
14030 "committed changeset."
|
dongsheng@627
|
14031 msgstr ""
|
dongsheng@627
|
14032
|
dongsheng@627
|
14033 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
14034 #: ../en/ch10-hook.xml:1428 ../en/ch10-hook.xml:1801
|
dongsheng@627
|
14035 msgid ""
|
dongsheng@627
|
14036 "<literal>parent1</literal>: A changeset ID. The changeset ID of the first "
|
dongsheng@627
|
14037 "parent of the newly committed changeset."
|
dongsheng@627
|
14038 msgstr ""
|
dongsheng@627
|
14039
|
dongsheng@627
|
14040 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
14041 #: ../en/ch10-hook.xml:1433 ../en/ch10-hook.xml:1806
|
dongsheng@627
|
14042 msgid ""
|
dongsheng@627
|
14043 "<literal>parent2</literal>: A changeset ID. The changeset ID of the second "
|
dongsheng@627
|
14044 "parent of the newly committed changeset."
|
dongsheng@627
|
14045 msgstr ""
|
dongsheng@627
|
14046
|
dongsheng@627
|
14047 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14048 #: ../en/ch10-hook.xml:1439
|
songdongsheng@658
|
14049 msgid ""
|
songdongsheng@658
|
14050 "See also: <literal role=\"hook\">precommit</literal> (<xref linkend=\"sec:"
|
songdongsheng@658
|
14051 "hook:precommit\"/>), <literal role=\"hook\">pretxncommit</literal> (<xref "
|
songdongsheng@658
|
14052 "linkend=\"sec:hook:pretxncommit\"/>)"
|
dongsheng@627
|
14053 msgstr ""
|
dongsheng@627
|
14054
|
dongsheng@627
|
14055 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
14056 #: ../en/ch10-hook.xml:1448
|
songdongsheng@668
|
14057 msgid ""
|
songdongsheng@668
|
14058 "<literal role=\"hook\">incoming</literal>&emdash;after one remote changeset "
|
songdongsheng@668
|
14059 "is added"
|
dongsheng@661
|
14060 msgstr "<literal role=\"hook\">incoming</literal>—增加远程修改集之后"
|
dongsheng@627
|
14061
|
dongsheng@627
|
14062 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14063 #: ../en/ch10-hook.xml:1451
|
dongsheng@627
|
14064 msgid ""
|
dongsheng@627
|
14065 "This hook is run after a pre-existing changeset has been added to the "
|
dongsheng@627
|
14066 "repository, for example via a <command role=\"hg-cmd\">hg push</command>. If "
|
dongsheng@627
|
14067 "a group of changesets was added in a single operation, this hook is called "
|
dongsheng@627
|
14068 "once for each added changeset."
|
dongsheng@627
|
14069 msgstr ""
|
dongsheng@627
|
14070
|
dongsheng@627
|
14071 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14072 #: ../en/ch10-hook.xml:1458
|
dongsheng@627
|
14073 msgid ""
|
dongsheng@627
|
14074 "You can use this hook for the same purposes as the <literal role=\"hook"
|
songdongsheng@658
|
14075 "\">changegroup</literal> hook (<xref linkend=\"sec:hook:changegroup\"/>); "
|
songdongsheng@658
|
14076 "it's simply more convenient sometimes to run a hook once per group of "
|
dongsheng@627
|
14077 "changesets, while other times it's handier once per changeset."
|
dongsheng@627
|
14078 msgstr ""
|
dongsheng@627
|
14079
|
dongsheng@627
|
14080 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
14081 #: ../en/ch10-hook.xml:1468
|
dongsheng@627
|
14082 msgid ""
|
dongsheng@627
|
14083 "<literal>node</literal>: A changeset ID. The ID of the newly added changeset."
|
dongsheng@627
|
14084 msgstr ""
|
dongsheng@627
|
14085
|
dongsheng@627
|
14086 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14087 #: ../en/ch10-hook.xml:1483
|
songdongsheng@658
|
14088 msgid ""
|
songdongsheng@658
|
14089 "See also: <literal role=\"hook\">changegroup</literal> (<xref linkend=\"sec:"
|
songdongsheng@658
|
14090 "hook:changegroup\"/>) <literal role=\"hook\">prechangegroup</literal> (<xref "
|
songdongsheng@658
|
14091 "linkend=\"sec:hook:prechangegroup\"/>), <literal role=\"hook"
|
songdongsheng@658
|
14092 "\">pretxnchangegroup</literal> (<xref linkend=\"sec:hook:pretxnchangegroup\"/"
|
songdongsheng@658
|
14093 ">)"
|
dongsheng@627
|
14094 msgstr ""
|
dongsheng@627
|
14095
|
dongsheng@627
|
14096 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
14097 #: ../en/ch10-hook.xml:1494
|
songdongsheng@668
|
14098 msgid ""
|
songdongsheng@668
|
14099 "<literal role=\"hook\">outgoing</literal>&emdash;after changesets are "
|
songdongsheng@668
|
14100 "propagated"
|
dongsheng@661
|
14101 msgstr "<literal role=\"hook\">outgoing</literal>—传播修改集之后"
|
dongsheng@627
|
14102
|
dongsheng@627
|
14103 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14104 #: ../en/ch10-hook.xml:1497
|
dongsheng@627
|
14105 msgid ""
|
dongsheng@627
|
14106 "This hook is run after a group of changesets has been propagated out of this "
|
dongsheng@627
|
14107 "repository, for example by a <command role=\"hg-cmd\">hg push</command> or "
|
dongsheng@627
|
14108 "<command role=\"hg-cmd\">hg bundle</command> command."
|
dongsheng@627
|
14109 msgstr ""
|
dongsheng@627
|
14110
|
dongsheng@627
|
14111 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14112 #: ../en/ch10-hook.xml:1503
|
dongsheng@627
|
14113 msgid ""
|
dongsheng@627
|
14114 "One possible use for this hook is to notify administrators that changes have "
|
dongsheng@627
|
14115 "been pulled."
|
dongsheng@627
|
14116 msgstr ""
|
dongsheng@627
|
14117
|
dongsheng@627
|
14118 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
14119 #: ../en/ch10-hook.xml:1510
|
dongsheng@627
|
14120 msgid ""
|
dongsheng@627
|
14121 "<literal>node</literal>: A changeset ID. The changeset ID of the first "
|
dongsheng@627
|
14122 "changeset of the group that was sent."
|
dongsheng@627
|
14123 msgstr ""
|
dongsheng@627
|
14124
|
dongsheng@627
|
14125 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
14126 #: ../en/ch10-hook.xml:1515
|
dongsheng@627
|
14127 msgid ""
|
dongsheng@627
|
14128 "<literal>source</literal>: A string. The source of the of the operation (see "
|
songdongsheng@658
|
14129 "<xref linkend=\"sec:hook:sources\"/>). If a remote client pulled changes "
|
songdongsheng@658
|
14130 "from this repository, <literal>source</literal> will be <literal>serve</"
|
songdongsheng@658
|
14131 "literal>. If the client that obtained changes from this repository was "
|
songdongsheng@658
|
14132 "local, <literal>source</literal> will be <literal>bundle</literal>, "
|
songdongsheng@658
|
14133 "<literal>pull</literal>, or <literal>push</literal>, depending on the "
|
songdongsheng@658
|
14134 "operation the client performed."
|
songdongsheng@658
|
14135 msgstr ""
|
songdongsheng@658
|
14136
|
songdongsheng@658
|
14137 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14138 #: ../en/ch10-hook.xml:1534
|
songdongsheng@658
|
14139 msgid ""
|
songdongsheng@658
|
14140 "See also: <literal role=\"hook\">preoutgoing</literal> (<xref linkend=\"sec:"
|
songdongsheng@658
|
14141 "hook:preoutgoing\"/>)"
|
dongsheng@627
|
14142 msgstr ""
|
dongsheng@627
|
14143
|
dongsheng@627
|
14144 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
14145 #: ../en/ch10-hook.xml:1541
|
songdongsheng@668
|
14146 msgid ""
|
songdongsheng@668
|
14147 "<literal role=\"hook\">prechangegroup</literal>&emdash;before starting to add "
|
songdongsheng@668
|
14148 "remote changesets"
|
dongsheng@661
|
14149 msgstr "<literal role=\"hook\">prechangegroup</literal>—增加远程修改集之前"
|
dongsheng@627
|
14150
|
dongsheng@627
|
14151 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14152 #: ../en/ch10-hook.xml:1545
|
dongsheng@627
|
14153 msgid ""
|
dongsheng@627
|
14154 "This controlling hook is run before Mercurial begins to add a group of "
|
dongsheng@627
|
14155 "changesets from another repository."
|
dongsheng@627
|
14156 msgstr ""
|
dongsheng@627
|
14157
|
dongsheng@627
|
14158 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14159 #: ../en/ch10-hook.xml:1549
|
dongsheng@627
|
14160 msgid ""
|
dongsheng@627
|
14161 "This hook does not have any information about the changesets to be added, "
|
dongsheng@627
|
14162 "because it is run before transmission of those changesets is allowed to "
|
dongsheng@627
|
14163 "begin. If this hook fails, the changesets will not be transmitted."
|
dongsheng@627
|
14164 msgstr ""
|
dongsheng@627
|
14165
|
dongsheng@627
|
14166 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14167 #: ../en/ch10-hook.xml:1555
|
dongsheng@627
|
14168 msgid ""
|
dongsheng@627
|
14169 "One use for this hook is to prevent external changes from being added to a "
|
dongsheng@627
|
14170 "repository. For example, you could use this to <quote>freeze</quote> a "
|
dongsheng@627
|
14171 "server-hosted branch temporarily or permanently so that users cannot push to "
|
dongsheng@627
|
14172 "it, while still allowing a local administrator to modify the repository."
|
dongsheng@627
|
14173 msgstr ""
|
dongsheng@627
|
14174
|
dongsheng@627
|
14175 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14176 #: ../en/ch10-hook.xml:1576
|
songdongsheng@658
|
14177 msgid ""
|
songdongsheng@658
|
14178 "See also: <literal role=\"hook\">changegroup</literal> (<xref linkend=\"sec:"
|
songdongsheng@658
|
14179 "hook:changegroup\"/>), <literal role=\"hook\">incoming</literal> (<xref "
|
songdongsheng@658
|
14180 "linkend=\"sec:hook:incoming\"/>), <literal role=\"hook\">pretxnchangegroup</"
|
songdongsheng@658
|
14181 "literal> (<xref linkend=\"sec:hook:pretxnchangegroup\"/>)"
|
dongsheng@627
|
14182 msgstr ""
|
dongsheng@627
|
14183
|
dongsheng@627
|
14184 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
14185 #: ../en/ch10-hook.xml:1587
|
songdongsheng@668
|
14186 msgid ""
|
songdongsheng@668
|
14187 "<literal role=\"hook\">precommit</literal>&emdash;before starting to commit a "
|
dongsheng@627
|
14188 "changeset"
|
dongsheng@661
|
14189 msgstr "<literal role=\"hook\">precommit</literal>—提交修改集之前"
|
dongsheng@627
|
14190
|
dongsheng@627
|
14191 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14192 #: ../en/ch10-hook.xml:1590
|
dongsheng@627
|
14193 msgid ""
|
dongsheng@627
|
14194 "This hook is run before Mercurial begins to commit a new changeset. It is run "
|
dongsheng@627
|
14195 "before Mercurial has any of the metadata for the commit, such as the files to "
|
dongsheng@627
|
14196 "be committed, the commit message, or the commit date."
|
dongsheng@627
|
14197 msgstr ""
|
dongsheng@627
|
14198
|
dongsheng@627
|
14199 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14200 #: ../en/ch10-hook.xml:1596
|
dongsheng@627
|
14201 msgid ""
|
dongsheng@627
|
14202 "One use for this hook is to disable the ability to commit new changesets, "
|
dongsheng@627
|
14203 "while still allowing incoming changesets. Another is to run a build or test, "
|
dongsheng@627
|
14204 "and only allow the commit to begin if the build or test succeeds."
|
dongsheng@627
|
14205 msgstr ""
|
dongsheng@627
|
14206
|
dongsheng@627
|
14207 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
14208 #: ../en/ch10-hook.xml:1605
|
dongsheng@627
|
14209 msgid ""
|
dongsheng@627
|
14210 "<literal>parent1</literal>: A changeset ID. The changeset ID of the first "
|
dongsheng@627
|
14211 "parent of the working directory."
|
dongsheng@627
|
14212 msgstr ""
|
dongsheng@627
|
14213
|
dongsheng@627
|
14214 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
14215 #: ../en/ch10-hook.xml:1610
|
dongsheng@627
|
14216 msgid ""
|
dongsheng@627
|
14217 "<literal>parent2</literal>: A changeset ID. The changeset ID of the second "
|
dongsheng@627
|
14218 "parent of the working directory."
|
dongsheng@627
|
14219 msgstr ""
|
dongsheng@627
|
14220
|
dongsheng@627
|
14221 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14222 #: ../en/ch10-hook.xml:1615
|
dongsheng@627
|
14223 msgid ""
|
dongsheng@627
|
14224 "If the commit proceeds, the parents of the working directory will become the "
|
dongsheng@627
|
14225 "parents of the new changeset."
|
dongsheng@627
|
14226 msgstr ""
|
dongsheng@627
|
14227
|
dongsheng@627
|
14228 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14229 #: ../en/ch10-hook.xml:1619
|
dongsheng@627
|
14230 msgid ""
|
songdongsheng@658
|
14231 "See also: <literal role=\"hook\">commit</literal> (<xref linkend=\"sec:hook:"
|
songdongsheng@658
|
14232 "commit\"/>), <literal role=\"hook\">pretxncommit</literal> (<xref linkend="
|
songdongsheng@658
|
14233 "\"sec:hook:pretxncommit\"/>)"
|
dongsheng@627
|
14234 msgstr ""
|
dongsheng@627
|
14235
|
dongsheng@627
|
14236 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
14237 #: ../en/ch10-hook.xml:1627
|
songdongsheng@668
|
14238 msgid ""
|
songdongsheng@668
|
14239 "<literal role=\"hook\">preoutgoing</literal>&emdash;before starting to "
|
songdongsheng@668
|
14240 "propagate changesets"
|
dongsheng@661
|
14241 msgstr "<literal role=\"hook\">preoutgoing</literal>—传播修改集之前"
|
dongsheng@627
|
14242
|
dongsheng@627
|
14243 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14244 #: ../en/ch10-hook.xml:1630
|
dongsheng@627
|
14245 msgid ""
|
dongsheng@627
|
14246 "This hook is invoked before Mercurial knows the identities of the changesets "
|
dongsheng@627
|
14247 "to be transmitted."
|
dongsheng@627
|
14248 msgstr ""
|
dongsheng@627
|
14249
|
dongsheng@627
|
14250 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14251 #: ../en/ch10-hook.xml:1634
|
dongsheng@627
|
14252 msgid ""
|
dongsheng@627
|
14253 "One use for this hook is to prevent changes from being transmitted to another "
|
dongsheng@627
|
14254 "repository."
|
dongsheng@627
|
14255 msgstr ""
|
dongsheng@627
|
14256
|
dongsheng@627
|
14257 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
14258 #: ../en/ch10-hook.xml:1641
|
dongsheng@627
|
14259 msgid ""
|
dongsheng@627
|
14260 "<literal>source</literal>: A string. The source of the operation that is "
|
songdongsheng@658
|
14261 "attempting to obtain changes from this repository (see <xref linkend=\"sec:"
|
songdongsheng@658
|
14262 "hook:sources\"/>). See the documentation for the <literal>source</literal> "
|
songdongsheng@658
|
14263 "parameter to the <literal role=\"hook\">outgoing</literal> hook, in <xref "
|
songdongsheng@658
|
14264 "linkend=\"sec:hook:outgoing\"/>, for possible values of this parameter."
|
songdongsheng@658
|
14265 msgstr ""
|
songdongsheng@658
|
14266
|
songdongsheng@658
|
14267 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14268 #: ../en/ch10-hook.xml:1657
|
songdongsheng@658
|
14269 msgid ""
|
songdongsheng@658
|
14270 "See also: <literal role=\"hook\">outgoing</literal> (<xref linkend=\"sec:hook:"
|
songdongsheng@658
|
14271 "outgoing\"/>)"
|
dongsheng@627
|
14272 msgstr ""
|
dongsheng@627
|
14273
|
dongsheng@627
|
14274 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
14275 #: ../en/ch10-hook.xml:1664
|
songdongsheng@668
|
14276 msgid ""
|
songdongsheng@668
|
14277 "<literal role=\"hook\">pretag</literal>&emdash;before tagging a changeset"
|
dongsheng@661
|
14278 msgstr "<literal role=\"hook\">pretag</literal>—创建标签之前"
|
dongsheng@627
|
14279
|
dongsheng@627
|
14280 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14281 #: ../en/ch10-hook.xml:1667
|
dongsheng@627
|
14282 msgid ""
|
dongsheng@627
|
14283 "This controlling hook is run before a tag is created. If the hook succeeds, "
|
dongsheng@627
|
14284 "creation of the tag proceeds. If the hook fails, the tag is not created."
|
dongsheng@627
|
14285 msgstr ""
|
dongsheng@627
|
14286
|
dongsheng@627
|
14287 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
14288 #: ../en/ch10-hook.xml:1675
|
dongsheng@627
|
14289 msgid ""
|
dongsheng@627
|
14290 "<literal>local</literal>: A boolean. Whether the tag is local to this "
|
dongsheng@627
|
14291 "repository instance (i.e. stored in <filename role=\"special\">.hg/localtags</"
|
dongsheng@627
|
14292 "filename>) or managed by Mercurial (stored in <filename role=\"special\">."
|
dongsheng@627
|
14293 "hgtags</filename>)."
|
dongsheng@627
|
14294 msgstr ""
|
dongsheng@627
|
14295
|
dongsheng@627
|
14296 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
14297 #: ../en/ch10-hook.xml:1682
|
dongsheng@627
|
14298 msgid ""
|
dongsheng@627
|
14299 "<literal>node</literal>: A changeset ID. The ID of the changeset to be "
|
dongsheng@627
|
14300 "tagged."
|
dongsheng@627
|
14301 msgstr ""
|
dongsheng@627
|
14302
|
dongsheng@627
|
14303 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
14304 #: ../en/ch10-hook.xml:1686
|
dongsheng@627
|
14305 msgid "<literal>tag</literal>: A string. The name of the tag to be created."
|
dongsheng@627
|
14306 msgstr ""
|
dongsheng@627
|
14307
|
dongsheng@627
|
14308 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14309 #: ../en/ch10-hook.xml:1691
|
dongsheng@627
|
14310 msgid ""
|
dongsheng@627
|
14311 "If the tag to be created is revision-controlled, the <literal role=\"hook"
|
dongsheng@627
|
14312 "\">precommit</literal> and <literal role=\"hook\">pretxncommit</literal> "
|
songdongsheng@658
|
14313 "hooks (<xref linkend=\"sec:hook:commit\"/> and <xref linkend=\"sec:hook:"
|
songdongsheng@658
|
14314 "pretxncommit\"/>) will also be run."
|
dongsheng@627
|
14315 msgstr ""
|
dongsheng@627
|
14316
|
dongsheng@627
|
14317 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14318 #: ../en/ch10-hook.xml:1699
|
dongsheng@627
|
14319 msgid ""
|
songdongsheng@658
|
14320 "See also: <literal role=\"hook\">tag</literal> (<xref linkend=\"sec:hook:tag"
|
songdongsheng@658
|
14321 "\"/>)"
|
dongsheng@627
|
14322 msgstr ""
|
dongsheng@627
|
14323
|
dongsheng@627
|
14324 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
14325 #: ../en/ch10-hook.xml:1705
|
songdongsheng@668
|
14326 msgid ""
|
songdongsheng@668
|
14327 "<literal role=\"hook\">pretxnchangegroup</literal>&emdash;before completing "
|
songdongsheng@668
|
14328 "addition of remote changesets"
|
dongsheng@661
|
14329 msgstr ""
|
dongsheng@661
|
14330 "<literal role=\"hook\">pretxnchangegroup</literal>—完成增加远程修改集之前"
|
dongsheng@627
|
14331
|
dongsheng@627
|
14332 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14333 #: ../en/ch10-hook.xml:1709
|
dongsheng@627
|
14334 msgid ""
|
songdongsheng@668
|
14335 "This controlling hook is run before a transaction&emdash;that manages the "
|
songdongsheng@668
|
14336 "addition of a group of new changesets from outside the repository&emdash;"
|
songdongsheng@668
|
14337 "completes. If the hook succeeds, the transaction completes, and all of the "
|
songdongsheng@668
|
14338 "changesets become permanent within this repository. If the hook fails, the "
|
songdongsheng@668
|
14339 "transaction is rolled back, and the data for the changesets is erased."
|
dongsheng@627
|
14340 msgstr ""
|
dongsheng@627
|
14341
|
dongsheng@627
|
14342 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14343 #: ../en/ch10-hook.xml:1718
|
dongsheng@627
|
14344 msgid ""
|
dongsheng@627
|
14345 "This hook can access the metadata associated with the almost-added "
|
dongsheng@627
|
14346 "changesets, but it should not do anything permanent with this data. It must "
|
dongsheng@627
|
14347 "also not modify the working directory."
|
dongsheng@627
|
14348 msgstr ""
|
dongsheng@627
|
14349
|
dongsheng@627
|
14350 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14351 #: ../en/ch10-hook.xml:1724
|
dongsheng@627
|
14352 msgid ""
|
dongsheng@627
|
14353 "While this hook is running, if other Mercurial processes access this "
|
dongsheng@627
|
14354 "repository, they will be able to see the almost-added changesets as if they "
|
dongsheng@627
|
14355 "are permanent. This may lead to race conditions if you do not take steps to "
|
dongsheng@627
|
14356 "avoid them."
|
dongsheng@627
|
14357 msgstr ""
|
dongsheng@627
|
14358
|
dongsheng@627
|
14359 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14360 #: ../en/ch10-hook.xml:1731
|
dongsheng@627
|
14361 msgid ""
|
dongsheng@627
|
14362 "This hook can be used to automatically vet a group of changesets. If the "
|
dongsheng@627
|
14363 "hook fails, all of the changesets are <quote>rejected</quote> when the "
|
dongsheng@627
|
14364 "transaction rolls back."
|
dongsheng@627
|
14365 msgstr ""
|
dongsheng@627
|
14366
|
dongsheng@627
|
14367 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14368 #: ../en/ch10-hook.xml:1760
|
songdongsheng@658
|
14369 msgid ""
|
songdongsheng@658
|
14370 "See also: <literal role=\"hook\">changegroup</literal> (<xref linkend=\"sec:"
|
songdongsheng@658
|
14371 "hook:changegroup\"/>), <literal role=\"hook\">incoming</literal> (<xref "
|
songdongsheng@658
|
14372 "linkend=\"sec:hook:incoming\"/>), <literal role=\"hook\">prechangegroup</"
|
songdongsheng@658
|
14373 "literal> (<xref linkend=\"sec:hook:prechangegroup\"/>)"
|
dongsheng@627
|
14374 msgstr ""
|
dongsheng@627
|
14375
|
dongsheng@627
|
14376 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
14377 #: ../en/ch10-hook.xml:1771
|
songdongsheng@668
|
14378 msgid ""
|
songdongsheng@668
|
14379 "<literal role=\"hook\">pretxncommit</literal>&emdash;before completing commit "
|
songdongsheng@668
|
14380 "of new changeset"
|
dongsheng@661
|
14381 msgstr "<literal role=\"hook\">pretxncommit</literal>—完成提交之前"
|
dongsheng@627
|
14382
|
dongsheng@627
|
14383 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14384 #: ../en/ch10-hook.xml:1774
|
dongsheng@627
|
14385 msgid ""
|
songdongsheng@668
|
14386 "This controlling hook is run before a transaction&emdash;that manages a new "
|
songdongsheng@668
|
14387 "commit&emdash;completes. If the hook succeeds, the transaction completes and "
|
songdongsheng@668
|
14388 "the changeset becomes permanent within this repository. If the hook fails, "
|
songdongsheng@668
|
14389 "the transaction is rolled back, and the commit data is erased."
|
dongsheng@627
|
14390 msgstr ""
|
dongsheng@627
|
14391
|
dongsheng@627
|
14392 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14393 #: ../en/ch10-hook.xml:1782
|
dongsheng@627
|
14394 msgid ""
|
dongsheng@627
|
14395 "This hook can access the metadata associated with the almost-new changeset, "
|
dongsheng@627
|
14396 "but it should not do anything permanent with this data. It must also not "
|
dongsheng@627
|
14397 "modify the working directory."
|
dongsheng@627
|
14398 msgstr ""
|
dongsheng@627
|
14399
|
dongsheng@627
|
14400 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14401 #: ../en/ch10-hook.xml:1788
|
dongsheng@627
|
14402 msgid ""
|
dongsheng@627
|
14403 "While this hook is running, if other Mercurial processes access this "
|
dongsheng@627
|
14404 "repository, they will be able to see the almost-new changeset as if it is "
|
dongsheng@627
|
14405 "permanent. This may lead to race conditions if you do not take steps to "
|
dongsheng@627
|
14406 "avoid them."
|
dongsheng@627
|
14407 msgstr ""
|
dongsheng@627
|
14408
|
dongsheng@627
|
14409 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14410 #: ../en/ch10-hook.xml:1812
|
songdongsheng@658
|
14411 msgid ""
|
songdongsheng@658
|
14412 "See also: <literal role=\"hook\">precommit</literal> (<xref linkend=\"sec:"
|
songdongsheng@658
|
14413 "hook:precommit\"/>)"
|
dongsheng@660
|
14414 msgstr ""
|
dongsheng@660
|
14415 "参见: <literal role=\"hook\">precommit</literal> (<xref linkend=\"sec:hook:"
|
dongsheng@660
|
14416 "precommit\"/>)"
|
dongsheng@627
|
14417
|
dongsheng@627
|
14418 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
14419 #: ../en/ch10-hook.xml:1819
|
songdongsheng@668
|
14420 msgid ""
|
songdongsheng@668
|
14421 "<literal role=\"hook\">preupdate</literal>&emdash;before updating or merging "
|
songdongsheng@668
|
14422 "working directory"
|
dongsheng@661
|
14423 msgstr "<literal role=\"hook\">preupdate</literal>—更新或合并工作目录之前"
|
dongsheng@627
|
14424
|
dongsheng@627
|
14425 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14426 #: ../en/ch10-hook.xml:1822
|
dongsheng@627
|
14427 msgid ""
|
dongsheng@627
|
14428 "This controlling hook is run before an update or merge of the working "
|
dongsheng@627
|
14429 "directory begins. It is run only if Mercurial's normal pre-update checks "
|
dongsheng@627
|
14430 "determine that the update or merge can proceed. If the hook succeeds, the "
|
dongsheng@627
|
14431 "update or merge may proceed; if it fails, the update or merge does not start."
|
dongsheng@627
|
14432 msgstr ""
|
dongsheng@627
|
14433
|
dongsheng@627
|
14434 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
14435 #: ../en/ch10-hook.xml:1833
|
songdongsheng@658
|
14436 msgid ""
|
songdongsheng@658
|
14437 "<literal>parent1</literal>: A changeset ID. The ID of the parent that the "
|
dongsheng@627
|
14438 "working directory is to be updated to. If the working directory is being "
|
dongsheng@627
|
14439 "merged, it will not change this parent."
|
dongsheng@627
|
14440 msgstr ""
|
dongsheng@627
|
14441
|
dongsheng@627
|
14442 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
14443 #: ../en/ch10-hook.xml:1839
|
songdongsheng@658
|
14444 msgid ""
|
songdongsheng@658
|
14445 "<literal>parent2</literal>: A changeset ID. Only set if the working directory "
|
songdongsheng@658
|
14446 "is being merged. The ID of the revision that the working directory is being "
|
songdongsheng@658
|
14447 "merged with."
|
songdongsheng@658
|
14448 msgstr ""
|
songdongsheng@658
|
14449
|
songdongsheng@658
|
14450 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14451 #: ../en/ch10-hook.xml:1846
|
songdongsheng@658
|
14452 msgid ""
|
songdongsheng@658
|
14453 "See also: <literal role=\"hook\">update</literal> (<xref linkend=\"sec:hook:"
|
songdongsheng@658
|
14454 "update\"/>)"
|
dongsheng@627
|
14455 msgstr ""
|
dongsheng@627
|
14456
|
dongsheng@627
|
14457 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
14458 #: ../en/ch10-hook.xml:1851
|
songdongsheng@668
|
14459 msgid "<literal role=\"hook\">tag</literal>&emdash;after tagging a changeset"
|
dongsheng@661
|
14460 msgstr "<literal role=\"hook\">tag</literal>—创建标签之后"
|
dongsheng@627
|
14461
|
dongsheng@627
|
14462 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14463 #: ../en/ch10-hook.xml:1854
|
dongsheng@627
|
14464 msgid "This hook is run after a tag has been created."
|
dongsheng@627
|
14465 msgstr ""
|
dongsheng@627
|
14466
|
dongsheng@627
|
14467 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
14468 #: ../en/ch10-hook.xml:1860
|
dongsheng@627
|
14469 msgid ""
|
dongsheng@627
|
14470 "<literal>local</literal>: A boolean. Whether the new tag is local to this "
|
dongsheng@627
|
14471 "repository instance (i.e. stored in <filename role=\"special\">.hg/"
|
dongsheng@627
|
14472 "localtags</filename>) or managed by Mercurial (stored in <filename role="
|
dongsheng@627
|
14473 "\"special\">.hgtags</filename>)."
|
dongsheng@627
|
14474 msgstr ""
|
dongsheng@627
|
14475
|
dongsheng@627
|
14476 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
14477 #: ../en/ch10-hook.xml:1868
|
dongsheng@627
|
14478 msgid ""
|
dongsheng@627
|
14479 "<literal>node</literal>: A changeset ID. The ID of the changeset that was "
|
dongsheng@627
|
14480 "tagged."
|
dongsheng@627
|
14481 msgstr ""
|
dongsheng@627
|
14482
|
dongsheng@627
|
14483 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
14484 #: ../en/ch10-hook.xml:1872
|
dongsheng@627
|
14485 msgid "<literal>tag</literal>: A string. The name of the tag that was created."
|
dongsheng@627
|
14486 msgstr ""
|
dongsheng@627
|
14487
|
dongsheng@627
|
14488 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14489 #: ../en/ch10-hook.xml:1877
|
dongsheng@627
|
14490 msgid ""
|
dongsheng@627
|
14491 "If the created tag is revision-controlled, the <literal role=\"hook\">commit</"
|
songdongsheng@658
|
14492 "literal> hook (section <xref linkend=\"sec:hook:commit\"/>) is run before "
|
dongsheng@627
|
14493 "this hook."
|
dongsheng@627
|
14494 msgstr ""
|
dongsheng@627
|
14495
|
dongsheng@627
|
14496 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14497 #: ../en/ch10-hook.xml:1882
|
songdongsheng@658
|
14498 msgid ""
|
songdongsheng@658
|
14499 "See also: <literal role=\"hook\">pretag</literal> (<xref linkend=\"sec:hook:"
|
songdongsheng@658
|
14500 "pretag\"/>)"
|
dongsheng@660
|
14501 msgstr ""
|
dongsheng@660
|
14502 "参见: <literal role=\"hook\">pretag</literal> (<xref linkend=\"sec:hook:pretag"
|
dongsheng@660
|
14503 "\"/>)"
|
dongsheng@627
|
14504
|
dongsheng@627
|
14505 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
14506 #: ../en/ch10-hook.xml:1888
|
songdongsheng@668
|
14507 msgid ""
|
songdongsheng@668
|
14508 "<literal role=\"hook\">update</literal>&emdash;after updating or merging "
|
songdongsheng@668
|
14509 "working directory"
|
dongsheng@661
|
14510 msgstr "<literal role=\"hook\">update</literal>—更新或合并工作目录之后"
|
dongsheng@627
|
14511
|
dongsheng@627
|
14512 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14513 #: ../en/ch10-hook.xml:1891
|
dongsheng@627
|
14514 msgid ""
|
dongsheng@627
|
14515 "This hook is run after an update or merge of the working directory "
|
dongsheng@627
|
14516 "completes. Since a merge can fail (if the external <command>hgmerge</"
|
dongsheng@627
|
14517 "command> command fails to resolve conflicts in a file), this hook "
|
dongsheng@627
|
14518 "communicates whether the update or merge completed cleanly."
|
dongsheng@627
|
14519 msgstr ""
|
dongsheng@627
|
14520
|
dongsheng@627
|
14521 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
14522 #: ../en/ch10-hook.xml:1899
|
dongsheng@627
|
14523 msgid ""
|
dongsheng@627
|
14524 "<literal>error</literal>: A boolean. Indicates whether the update or merge "
|
dongsheng@627
|
14525 "completed successfully."
|
dongsheng@627
|
14526 msgstr ""
|
dongsheng@627
|
14527
|
dongsheng@627
|
14528 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
14529 #: ../en/ch10-hook.xml:1904
|
dongsheng@627
|
14530 msgid ""
|
dongsheng@627
|
14531 "<literal>parent1</literal>: A changeset ID. The ID of the parent that the "
|
dongsheng@627
|
14532 "working directory was updated to. If the working directory was merged, it "
|
dongsheng@627
|
14533 "will not have changed this parent."
|
dongsheng@627
|
14534 msgstr ""
|
dongsheng@627
|
14535
|
dongsheng@627
|
14536 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
14537 #: ../en/ch10-hook.xml:1910
|
dongsheng@627
|
14538 msgid ""
|
dongsheng@627
|
14539 "<literal>parent2</literal>: A changeset ID. Only set if the working "
|
dongsheng@627
|
14540 "directory was merged. The ID of the revision that the working directory was "
|
dongsheng@627
|
14541 "merged with."
|
dongsheng@627
|
14542 msgstr ""
|
dongsheng@627
|
14543
|
dongsheng@627
|
14544 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14545 #: ../en/ch10-hook.xml:1916
|
songdongsheng@658
|
14546 msgid ""
|
songdongsheng@658
|
14547 "See also: <literal role=\"hook\">preupdate</literal> (<xref linkend=\"sec:"
|
songdongsheng@658
|
14548 "hook:preupdate\"/>)"
|
dongsheng@627
|
14549 msgstr ""
|
dongsheng@627
|
14550
|
dongsheng@627
|
14551 #. type: Content of: <book><chapter><title>
|
dongsheng@714
|
14552 #: ../en/ch11-template.xml:5
|
dongsheng@714
|
14553 msgid "Customizing the output of Mercurial"
|
dongsheng@627
|
14554 msgstr "定制 Mercurial 的输出"
|
dongsheng@627
|
14555
|
dongsheng@627
|
14556 #. type: Content of: <book><chapter><para>
|
dongsheng@714
|
14557 #: ../en/ch11-template.xml:7
|
dongsheng@627
|
14558 msgid ""
|
dongsheng@627
|
14559 "Mercurial provides a powerful mechanism to let you control how it displays "
|
dongsheng@627
|
14560 "information. The mechanism is based on templates. You can use templates to "
|
dongsheng@714
|
14561 "generate specific output for a single command, or to customize the entire "
|
dongsheng@627
|
14562 "appearance of the built-in web interface."
|
dongsheng@627
|
14563 msgstr ""
|
dongsheng@627
|
14564
|
dongsheng@627
|
14565 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
14566 #: ../en/ch11-template.xml:14
|
dongsheng@627
|
14567 msgid "Using precanned output styles"
|
dongsheng@636
|
14568 msgstr "使用预定义的输出样式"
|
dongsheng@627
|
14569
|
dongsheng@627
|
14570 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14571 #: ../en/ch11-template.xml:16
|
dongsheng@627
|
14572 msgid ""
|
dongsheng@627
|
14573 "Packaged with Mercurial are some output styles that you can use immediately. "
|
dongsheng@627
|
14574 "A style is simply a precanned template that someone wrote and installed "
|
dongsheng@627
|
14575 "somewhere that Mercurial can find."
|
dongsheng@627
|
14576 msgstr ""
|
dongsheng@627
|
14577
|
dongsheng@627
|
14578 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14579 #: ../en/ch11-template.xml:21
|
dongsheng@627
|
14580 msgid ""
|
dongsheng@627
|
14581 "Before we take a look at Mercurial's bundled styles, let's review its normal "
|
dongsheng@627
|
14582 "output."
|
dongsheng@627
|
14583 msgstr ""
|
dongsheng@627
|
14584
|
dongsheng@627
|
14585 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14586 #: ../en/ch11-template.xml:26
|
dongsheng@627
|
14587 msgid ""
|
songdongsheng@668
|
14588 "This is somewhat informative, but it takes up a lot of space&emdash;five "
|
songdongsheng@668
|
14589 "lines of output per changeset. The <literal>compact</literal> style reduces "
|
songdongsheng@668
|
14590 "this to three lines, presented in a sparse manner."
|
dongsheng@627
|
14591 msgstr ""
|
dongsheng@627
|
14592
|
dongsheng@627
|
14593 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14594 #: ../en/ch11-template.xml:33
|
dongsheng@627
|
14595 msgid ""
|
dongsheng@627
|
14596 "The <literal>changelog</literal> style hints at the expressive power of "
|
dongsheng@627
|
14597 "Mercurial's templating engine. This style attempts to follow the GNU "
|
dongsheng@627
|
14598 "Project's changelog guidelines<citation>web:changelog</citation>."
|
dongsheng@627
|
14599 msgstr ""
|
dongsheng@627
|
14600
|
dongsheng@627
|
14601 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14602 #: ../en/ch11-template.xml:40
|
dongsheng@627
|
14603 msgid ""
|
dongsheng@627
|
14604 "You will not be shocked to learn that Mercurial's default output style is "
|
dongsheng@627
|
14605 "named <literal>default</literal>."
|
dongsheng@627
|
14606 msgstr ""
|
dongsheng@627
|
14607
|
dongsheng@627
|
14608 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
14609 #: ../en/ch11-template.xml:44
|
dongsheng@627
|
14610 msgid "Setting a default style"
|
dongsheng@636
|
14611 msgstr "设置默认样式"
|
dongsheng@627
|
14612
|
dongsheng@627
|
14613 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14614 #: ../en/ch11-template.xml:46
|
dongsheng@627
|
14615 msgid ""
|
dongsheng@627
|
14616 "You can modify the output style that Mercurial will use for every command by "
|
dongsheng@650
|
14617 "editing your <filename role=\"special\">~/.hgrc</filename> file, naming the "
|
dongsheng@627
|
14618 "style you would prefer to use."
|
dongsheng@627
|
14619 msgstr ""
|
dongsheng@627
|
14620
|
dongsheng@627
|
14621 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
14622 #: ../en/ch11-template.xml:54
|
dongsheng@627
|
14623 msgid ""
|
dongsheng@627
|
14624 "If you write a style of your own, you can use it by either providing the path "
|
dongsheng@627
|
14625 "to your style file, or copying your style file into a location where "
|
dongsheng@627
|
14626 "Mercurial can find it (typically the <literal>templates</literal> "
|
dongsheng@627
|
14627 "subdirectory of your Mercurial install directory)."
|
dongsheng@627
|
14628 msgstr ""
|
dongsheng@627
|
14629
|
dongsheng@627
|
14630 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
14631 #: ../en/ch11-template.xml:63
|
dongsheng@627
|
14632 msgid "Commands that support styles and templates"
|
dongsheng@636
|
14633 msgstr "支持样式和模版的命令"
|
dongsheng@627
|
14634
|
dongsheng@627
|
14635 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14636 #: ../en/ch11-template.xml:65
|
dongsheng@627
|
14637 msgid ""
|
dongsheng@627
|
14638 "All of Mercurial's <quote><literal>log</literal>-like</quote> commands let "
|
dongsheng@627
|
14639 "you use styles and templates: <command role=\"hg-cmd\">hg incoming</command>, "
|
dongsheng@627
|
14640 "<command role=\"hg-cmd\">hg log</command>, <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
14641 "outgoing</command>, and <command role=\"hg-cmd\">hg tip</command>."
|
dongsheng@627
|
14642 msgstr ""
|
dongsheng@627
|
14643
|
dongsheng@627
|
14644 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14645 #: ../en/ch11-template.xml:72
|
dongsheng@627
|
14646 msgid ""
|
dongsheng@627
|
14647 "As I write this manual, these are so far the only commands that support "
|
dongsheng@627
|
14648 "styles and templates. Since these are the most important commands that need "
|
dongsheng@714
|
14649 "customizable output, there has been little pressure from the Mercurial user "
|
dongsheng@627
|
14650 "community to add style and template support to other commands."
|
dongsheng@627
|
14651 msgstr ""
|
dongsheng@627
|
14652
|
dongsheng@627
|
14653 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
14654 #: ../en/ch11-template.xml:80
|
dongsheng@627
|
14655 msgid "The basics of templating"
|
dongsheng@636
|
14656 msgstr "模版基础"
|
dongsheng@627
|
14657
|
dongsheng@627
|
14658 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14659 #: ../en/ch11-template.xml:82
|
dongsheng@627
|
14660 msgid ""
|
dongsheng@627
|
14661 "At its simplest, a Mercurial template is a piece of text. Some of the text "
|
dongsheng@627
|
14662 "never changes, while other parts are <emphasis>expanded</emphasis>, or "
|
dongsheng@627
|
14663 "replaced with new text, when necessary."
|
dongsheng@627
|
14664 msgstr ""
|
dongsheng@627
|
14665
|
dongsheng@627
|
14666 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14667 #: ../en/ch11-template.xml:87
|
dongsheng@627
|
14668 msgid ""
|
dongsheng@627
|
14669 "Before we continue, let's look again at a simple example of Mercurial's "
|
dongsheng@627
|
14670 "normal output."
|
dongsheng@627
|
14671 msgstr ""
|
dongsheng@627
|
14672
|
dongsheng@627
|
14673 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14674 #: ../en/ch11-template.xml:92
|
dongsheng@627
|
14675 msgid ""
|
dongsheng@627
|
14676 "Now, let's run the same command, but using a template to change its output."
|
dongsheng@627
|
14677 msgstr ""
|
dongsheng@627
|
14678
|
dongsheng@627
|
14679 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14680 #: ../en/ch11-template.xml:97
|
dongsheng@627
|
14681 msgid ""
|
dongsheng@627
|
14682 "The example above illustrates the simplest possible template; it's just a "
|
dongsheng@627
|
14683 "piece of static text, printed once for each changeset. The <option role=\"hg-"
|
dongsheng@627
|
14684 "opt-log\">--template</option> option to the <command role=\"hg-cmd\">hg log</"
|
dongsheng@627
|
14685 "command> command tells Mercurial to use the given text as the template when "
|
dongsheng@627
|
14686 "printing each changeset."
|
dongsheng@627
|
14687 msgstr ""
|
dongsheng@627
|
14688
|
dongsheng@627
|
14689 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14690 #: ../en/ch11-template.xml:105
|
dongsheng@627
|
14691 msgid ""
|
dongsheng@627
|
14692 "Notice that the template string above ends with the text <quote><literal>\\n</"
|
dongsheng@627
|
14693 "literal></quote>. This is an <emphasis>escape sequence</emphasis>, telling "
|
dongsheng@627
|
14694 "Mercurial to print a newline at the end of each template item. If you omit "
|
songdongsheng@658
|
14695 "this newline, Mercurial will run each piece of output together. See <xref "
|
songdongsheng@658
|
14696 "linkend=\"sec:template:escape\"/> for more details of escape sequences."
|
dongsheng@627
|
14697 msgstr ""
|
dongsheng@627
|
14698
|
dongsheng@627
|
14699 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14700 #: ../en/ch11-template.xml:113
|
dongsheng@627
|
14701 msgid ""
|
dongsheng@627
|
14702 "A template that prints a fixed string of text all the time isn't very useful; "
|
dongsheng@627
|
14703 "let's try something a bit more complex."
|
dongsheng@627
|
14704 msgstr ""
|
dongsheng@627
|
14705
|
dongsheng@627
|
14706 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14707 #: ../en/ch11-template.xml:119
|
dongsheng@627
|
14708 msgid ""
|
dongsheng@627
|
14709 "As you can see, the string <quote><literal>{desc}</literal></quote> in the "
|
dongsheng@627
|
14710 "template has been replaced in the output with the description of each "
|
dongsheng@627
|
14711 "changeset. Every time Mercurial finds text enclosed in curly braces "
|
dongsheng@627
|
14712 "(<quote><literal>{</literal></quote> and <quote><literal>}</literal></"
|
dongsheng@627
|
14713 "quote>), it will try to replace the braces and text with the expansion of "
|
dongsheng@627
|
14714 "whatever is inside. To print a literal curly brace, you must escape it, as "
|
songdongsheng@658
|
14715 "described in <xref linkend=\"sec:template:escape\"/>."
|
dongsheng@627
|
14716 msgstr ""
|
dongsheng@627
|
14717
|
dongsheng@627
|
14718 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
14719 #: ../en/ch11-template.xml:131
|
dongsheng@627
|
14720 msgid "Common template keywords"
|
dongsheng@636
|
14721 msgstr "模版关键字"
|
dongsheng@627
|
14722
|
dongsheng@627
|
14723 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14724 #: ../en/ch11-template.xml:133
|
dongsheng@627
|
14725 msgid ""
|
dongsheng@627
|
14726 "You can start writing simple templates immediately using the keywords below."
|
dongsheng@627
|
14727 msgstr ""
|
dongsheng@627
|
14728
|
dongsheng@627
|
14729 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14730 #: ../en/ch11-template.xml:137
|
dongsheng@627
|
14731 msgid ""
|
dongsheng@627
|
14732 "<literal role=\"template-keyword\">author</literal>: String. The unmodified "
|
dongsheng@627
|
14733 "author of the changeset."
|
dongsheng@627
|
14734 msgstr ""
|
dongsheng@627
|
14735
|
dongsheng@627
|
14736 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14737 #: ../en/ch11-template.xml:141
|
dongsheng@627
|
14738 msgid ""
|
dongsheng@627
|
14739 "<literal role=\"template-keyword\">branches</literal>: String. The name of "
|
dongsheng@627
|
14740 "the branch on which the changeset was committed. Will be empty if the branch "
|
dongsheng@627
|
14741 "name was <literal>default</literal>."
|
dongsheng@627
|
14742 msgstr ""
|
dongsheng@627
|
14743
|
dongsheng@627
|
14744 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14745 #: ../en/ch11-template.xml:147
|
dongsheng@627
|
14746 msgid ""
|
dongsheng@627
|
14747 "<literal role=\"template-keyword\">date</literal>: Date information. The "
|
dongsheng@627
|
14748 "date when the changeset was committed. This is <emphasis>not</emphasis> "
|
dongsheng@627
|
14749 "human-readable; you must pass it through a filter that will render it "
|
songdongsheng@658
|
14750 "appropriately. See <xref linkend=\"sec:template:filter\"/> for more "
|
dongsheng@627
|
14751 "information on filters. The date is expressed as a pair of numbers. The "
|
dongsheng@627
|
14752 "first number is a Unix UTC timestamp (seconds since January 1, 1970); the "
|
dongsheng@627
|
14753 "second is the offset of the committer's timezone from UTC, in seconds."
|
dongsheng@627
|
14754 msgstr ""
|
dongsheng@627
|
14755
|
dongsheng@627
|
14756 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14757 #: ../en/ch11-template.xml:158
|
dongsheng@627
|
14758 msgid ""
|
dongsheng@627
|
14759 "<literal role=\"template-keyword\">desc</literal>: String. The text of the "
|
dongsheng@627
|
14760 "changeset description."
|
dongsheng@627
|
14761 msgstr ""
|
dongsheng@627
|
14762
|
dongsheng@627
|
14763 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14764 #: ../en/ch11-template.xml:161
|
dongsheng@627
|
14765 msgid ""
|
dongsheng@627
|
14766 "<literal role=\"template-keyword\">files</literal>: List of strings. All "
|
dongsheng@627
|
14767 "files modified, added, or removed by this changeset."
|
dongsheng@627
|
14768 msgstr ""
|
dongsheng@627
|
14769
|
dongsheng@627
|
14770 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14771 #: ../en/ch11-template.xml:166
|
dongsheng@627
|
14772 msgid ""
|
dongsheng@627
|
14773 "<literal role=\"template-keyword\">file_adds</literal>: List of strings. "
|
dongsheng@627
|
14774 "Files added by this changeset."
|
dongsheng@627
|
14775 msgstr ""
|
dongsheng@627
|
14776
|
dongsheng@627
|
14777 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14778 #: ../en/ch11-template.xml:170
|
dongsheng@627
|
14779 msgid ""
|
dongsheng@627
|
14780 "<literal role=\"template-keyword\">file_dels</literal>: List of strings. "
|
dongsheng@627
|
14781 "Files removed by this changeset."
|
dongsheng@627
|
14782 msgstr ""
|
dongsheng@627
|
14783
|
dongsheng@627
|
14784 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14785 #: ../en/ch11-template.xml:174
|
dongsheng@627
|
14786 msgid ""
|
dongsheng@627
|
14787 "<literal role=\"template-keyword\">node</literal>: String. The changeset "
|
dongsheng@627
|
14788 "identification hash, as a 40-character hexadecimal string."
|
dongsheng@627
|
14789 msgstr ""
|
dongsheng@627
|
14790
|
dongsheng@627
|
14791 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14792 #: ../en/ch11-template.xml:178
|
dongsheng@627
|
14793 msgid ""
|
dongsheng@627
|
14794 "<literal role=\"template-keyword\">parents</literal>: List of strings. The "
|
dongsheng@627
|
14795 "parents of the changeset."
|
dongsheng@627
|
14796 msgstr ""
|
dongsheng@627
|
14797
|
dongsheng@627
|
14798 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14799 #: ../en/ch11-template.xml:182
|
dongsheng@627
|
14800 msgid ""
|
dongsheng@627
|
14801 "<literal role=\"template-keyword\">rev</literal>: Integer. The repository-"
|
dongsheng@627
|
14802 "local changeset revision number."
|
dongsheng@627
|
14803 msgstr ""
|
dongsheng@627
|
14804
|
dongsheng@627
|
14805 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14806 #: ../en/ch11-template.xml:186
|
dongsheng@627
|
14807 msgid ""
|
dongsheng@627
|
14808 "<literal role=\"template-keyword\">tags</literal>: List of strings. Any tags "
|
dongsheng@627
|
14809 "associated with the changeset."
|
dongsheng@627
|
14810 msgstr ""
|
dongsheng@627
|
14811
|
dongsheng@627
|
14812 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14813 #: ../en/ch11-template.xml:192
|
dongsheng@627
|
14814 msgid ""
|
dongsheng@627
|
14815 "A few simple experiments will show us what to expect when we use these "
|
dongsheng@627
|
14816 "keywords; you can see the results below."
|
dongsheng@627
|
14817 msgstr ""
|
dongsheng@627
|
14818
|
dongsheng@627
|
14819 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14820 #: ../en/ch11-template.xml:197
|
dongsheng@627
|
14821 msgid ""
|
dongsheng@627
|
14822 "As we noted above, the date keyword does not produce human-readable output, "
|
dongsheng@627
|
14823 "so we must treat it specially. This involves using a <emphasis>filter</"
|
songdongsheng@658
|
14824 "emphasis>, about which more in <xref linkend=\"sec:template:filter\"/>."
|
dongsheng@627
|
14825 msgstr ""
|
dongsheng@627
|
14826
|
dongsheng@627
|
14827 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
14828 #: ../en/ch11-template.xml:206
|
dongsheng@627
|
14829 msgid "Escape sequences"
|
dongsheng@636
|
14830 msgstr "转义序列"
|
dongsheng@627
|
14831
|
dongsheng@627
|
14832 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14833 #: ../en/ch11-template.xml:208
|
dongsheng@627
|
14834 msgid ""
|
dongsheng@627
|
14835 "Mercurial's templating engine recognises the most commonly used escape "
|
dongsheng@627
|
14836 "sequences in strings. When it sees a backslash (<quote><literal>\\</"
|
dongsheng@627
|
14837 "literal></quote>) character, it looks at the following character and "
|
dongsheng@627
|
14838 "substitutes the two characters with a single replacement, as described below."
|
dongsheng@627
|
14839 msgstr ""
|
dongsheng@627
|
14840
|
dongsheng@627
|
14841 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14842 #: ../en/ch11-template.xml:215
|
dongsheng@650
|
14843 msgid ""
|
dongsheng@650
|
14844 "<literal>\\</literal>: Backslash, <quote><literal>\\</literal></quote>, ASCII "
|
dongsheng@650
|
14845 "134."
|
dongsheng@627
|
14846 msgstr ""
|
dongsheng@627
|
14847
|
dongsheng@627
|
14848 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14849 #: ../en/ch11-template.xml:219
|
dongsheng@650
|
14850 msgid "<literal>\\n</literal>: Newline, ASCII 12."
|
dongsheng@627
|
14851 msgstr ""
|
dongsheng@627
|
14852
|
dongsheng@627
|
14853 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14854 #: ../en/ch11-template.xml:222
|
dongsheng@650
|
14855 msgid "<literal>\\r</literal>: Carriage return, ASCII 15."
|
dongsheng@627
|
14856 msgstr ""
|
dongsheng@627
|
14857
|
dongsheng@627
|
14858 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14859 #: ../en/ch11-template.xml:225
|
dongsheng@650
|
14860 msgid "<literal>\\t</literal>: Tab, ASCII 11."
|
dongsheng@627
|
14861 msgstr ""
|
dongsheng@627
|
14862
|
dongsheng@627
|
14863 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14864 #: ../en/ch11-template.xml:228
|
dongsheng@650
|
14865 msgid "<literal>\\v</literal>: Vertical tab, ASCII 13."
|
dongsheng@627
|
14866 msgstr ""
|
dongsheng@627
|
14867
|
dongsheng@627
|
14868 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14869 #: ../en/ch11-template.xml:231
|
dongsheng@714
|
14870 msgid ""
|
dongsheng@714
|
14871 "<literal>\\{</literal>: Open curly brace, <quote><literal>{</literal></"
|
dongsheng@714
|
14872 "quote>, ASCII 173."
|
dongsheng@627
|
14873 msgstr ""
|
dongsheng@627
|
14874
|
dongsheng@627
|
14875 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14876 #: ../en/ch11-template.xml:235
|
dongsheng@714
|
14877 msgid ""
|
dongsheng@714
|
14878 "<literal>\\}</literal>: Close curly brace, <quote><literal>}</literal></"
|
dongsheng@714
|
14879 "quote>, ASCII 175."
|
dongsheng@714
|
14880 msgstr ""
|
dongsheng@714
|
14881
|
dongsheng@714
|
14882 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14883 #: ../en/ch11-template.xml:240
|
dongsheng@627
|
14884 msgid ""
|
dongsheng@627
|
14885 "As indicated above, if you want the expansion of a template to contain a "
|
dongsheng@627
|
14886 "literal <quote><literal>\\</literal></quote>, <quote><literal>{</literal></"
|
dongsheng@627
|
14887 "quote>, or <quote><literal>{</literal></quote> character, you must escape it."
|
dongsheng@627
|
14888 msgstr ""
|
dongsheng@627
|
14889
|
dongsheng@627
|
14890 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
14891 #: ../en/ch11-template.xml:248
|
dongsheng@627
|
14892 msgid "Filtering keywords to change their results"
|
dongsheng@636
|
14893 msgstr "通过过滤关键字来修改输出结果"
|
dongsheng@627
|
14894
|
dongsheng@627
|
14895 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14896 #: ../en/ch11-template.xml:250
|
dongsheng@627
|
14897 msgid ""
|
dongsheng@627
|
14898 "Some of the results of template expansion are not immediately easy to use. "
|
dongsheng@627
|
14899 "Mercurial lets you specify an optional chain of <emphasis>filters</emphasis> "
|
dongsheng@627
|
14900 "to modify the result of expanding a keyword. You have already seen a common "
|
dongsheng@627
|
14901 "filter, <literal role=\"template-kw-filt-date\">isodate</literal>, in action "
|
dongsheng@627
|
14902 "above, to make a date readable."
|
dongsheng@627
|
14903 msgstr ""
|
dongsheng@627
|
14904
|
dongsheng@627
|
14905 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
14906 #: ../en/ch11-template.xml:257
|
dongsheng@627
|
14907 msgid ""
|
dongsheng@627
|
14908 "Below is a list of the most commonly used filters that Mercurial supports. "
|
dongsheng@627
|
14909 "While some filters can be applied to any text, others can only be used in "
|
dongsheng@627
|
14910 "specific circumstances. The name of each filter is followed first by an "
|
dongsheng@627
|
14911 "indication of where it can be used, then a description of its effect."
|
dongsheng@627
|
14912 msgstr ""
|
dongsheng@627
|
14913
|
dongsheng@627
|
14914 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14915 #: ../en/ch11-template.xml:264
|
dongsheng@627
|
14916 msgid ""
|
dongsheng@627
|
14917 "<literal role=\"template-filter\">addbreaks</literal>: Any text. Add an XHTML "
|
dongsheng@627
|
14918 "<quote><literal><br/></literal></quote> tag before the end of every "
|
dongsheng@627
|
14919 "line except the last. For example, <quote><literal>foo\\nbar</literal></"
|
dongsheng@627
|
14920 "quote> becomes <quote><literal>foo<br/>\\nbar</literal></quote>."
|
dongsheng@627
|
14921 msgstr ""
|
dongsheng@627
|
14922
|
dongsheng@627
|
14923 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14924 #: ../en/ch11-template.xml:271
|
dongsheng@627
|
14925 msgid ""
|
dongsheng@627
|
14926 "<literal role=\"template-kw-filt-date\">age</literal>: <literal role="
|
dongsheng@627
|
14927 "\"template-keyword\">date</literal> keyword. Render the age of the date, "
|
dongsheng@627
|
14928 "relative to the current time. Yields a string like <quote><literal>10 "
|
dongsheng@627
|
14929 "minutes</literal></quote>."
|
dongsheng@627
|
14930 msgstr ""
|
dongsheng@627
|
14931
|
dongsheng@627
|
14932 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14933 #: ../en/ch11-template.xml:278
|
dongsheng@627
|
14934 msgid ""
|
dongsheng@627
|
14935 "<literal role=\"template-filter\">basename</literal>: Any text, but most "
|
dongsheng@627
|
14936 "useful for the <literal role=\"template-keyword\">files</literal> keyword and "
|
dongsheng@627
|
14937 "its relatives. Treat the text as a path, and return the basename. For "
|
dongsheng@627
|
14938 "example, <quote><literal>foo/bar/baz</literal></quote> becomes "
|
dongsheng@627
|
14939 "<quote><literal>baz</literal></quote>."
|
dongsheng@627
|
14940 msgstr ""
|
dongsheng@627
|
14941
|
dongsheng@627
|
14942 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14943 #: ../en/ch11-template.xml:287
|
dongsheng@627
|
14944 msgid ""
|
dongsheng@627
|
14945 "<literal role=\"template-kw-filt-date\">date</literal>: <literal role="
|
dongsheng@627
|
14946 "\"template-keyword\">date</literal> keyword. Render a date in a similar "
|
dongsheng@627
|
14947 "format to the Unix <literal role=\"template-keyword\">date</literal> command, "
|
dongsheng@627
|
14948 "but with timezone included. Yields a string like <quote><literal>Mon Sep 04 "
|
dongsheng@627
|
14949 "15:13:13 2006 -0700</literal></quote>."
|
dongsheng@627
|
14950 msgstr ""
|
dongsheng@627
|
14951
|
dongsheng@627
|
14952 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14953 #: ../en/ch11-template.xml:295
|
dongsheng@627
|
14954 msgid ""
|
dongsheng@627
|
14955 "<literal role=\"template-kw-filt-author\">domain</literal>: Any text, but "
|
dongsheng@627
|
14956 "most useful for the <literal role=\"template-keyword\">author</literal> "
|
dongsheng@627
|
14957 "keyword. Finds the first string that looks like an email address, and "
|
dongsheng@627
|
14958 "extract just the domain component. For example, <quote><literal>Bryan "
|
dongsheng@627
|
14959 "O'Sullivan <bos@serpentine.com></literal></quote> becomes "
|
dongsheng@627
|
14960 "<quote><literal>serpentine.com</literal></quote>."
|
dongsheng@627
|
14961 msgstr ""
|
dongsheng@627
|
14962
|
dongsheng@627
|
14963 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14964 #: ../en/ch11-template.xml:305
|
dongsheng@627
|
14965 msgid ""
|
dongsheng@627
|
14966 "<literal role=\"template-kw-filt-author\">email</literal>: Any text, but most "
|
dongsheng@627
|
14967 "useful for the <literal role=\"template-keyword\">author</literal> keyword. "
|
dongsheng@627
|
14968 "Extract the first string that looks like an email address. For example, "
|
dongsheng@627
|
14969 "<quote><literal>Bryan O'Sullivan <bos@serpentine.com></literal></quote> "
|
dongsheng@627
|
14970 "becomes <quote><literal>bos@serpentine.com</literal></quote>."
|
dongsheng@627
|
14971 msgstr ""
|
dongsheng@627
|
14972
|
dongsheng@627
|
14973 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14974 #: ../en/ch11-template.xml:314
|
dongsheng@627
|
14975 msgid ""
|
dongsheng@627
|
14976 "<literal role=\"template-filter\">escape</literal>: Any text. Replace the "
|
dongsheng@627
|
14977 "special XML/XHTML characters <quote><literal>&</literal></quote>, "
|
dongsheng@627
|
14978 "<quote><literal><</literal></quote> and <quote><literal>></literal></"
|
dongsheng@627
|
14979 "quote> with XML entities."
|
dongsheng@627
|
14980 msgstr ""
|
dongsheng@627
|
14981
|
dongsheng@627
|
14982 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14983 #: ../en/ch11-template.xml:322
|
dongsheng@627
|
14984 msgid ""
|
dongsheng@627
|
14985 "<literal role=\"template-filter\">fill68</literal>: Any text. Wrap the text "
|
dongsheng@627
|
14986 "to fit in 68 columns. This is useful before you pass text through the "
|
dongsheng@627
|
14987 "<literal role=\"template-filter\">tabindent</literal> filter, and still want "
|
dongsheng@627
|
14988 "it to fit in an 80-column fixed-font window."
|
dongsheng@627
|
14989 msgstr ""
|
dongsheng@627
|
14990
|
dongsheng@627
|
14991 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14992 #: ../en/ch11-template.xml:330
|
dongsheng@627
|
14993 msgid ""
|
dongsheng@627
|
14994 "<literal role=\"template-filter\">fill76</literal>: Any text. Wrap the text "
|
dongsheng@627
|
14995 "to fit in 76 columns."
|
dongsheng@627
|
14996 msgstr ""
|
dongsheng@627
|
14997
|
dongsheng@627
|
14998 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
14999 #: ../en/ch11-template.xml:334
|
dongsheng@627
|
15000 msgid ""
|
dongsheng@627
|
15001 "<literal role=\"template-filter\">firstline</literal>: Any text. Yield the "
|
dongsheng@627
|
15002 "first line of text, without any trailing newlines."
|
dongsheng@627
|
15003 msgstr ""
|
dongsheng@627
|
15004
|
dongsheng@627
|
15005 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
15006 #: ../en/ch11-template.xml:339
|
dongsheng@627
|
15007 msgid ""
|
dongsheng@627
|
15008 "<literal role=\"template-kw-filt-date\">hgdate</literal>: <literal role="
|
dongsheng@627
|
15009 "\"template-keyword\">date</literal> keyword. Render the date as a pair of "
|
dongsheng@627
|
15010 "readable numbers. Yields a string like <quote><literal>1157407993 25200</"
|
dongsheng@627
|
15011 "literal></quote>."
|
dongsheng@627
|
15012 msgstr ""
|
dongsheng@627
|
15013
|
dongsheng@627
|
15014 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
15015 #: ../en/ch11-template.xml:346
|
dongsheng@627
|
15016 msgid ""
|
dongsheng@627
|
15017 "<literal role=\"template-kw-filt-date\">isodate</literal>: <literal role="
|
dongsheng@627
|
15018 "\"template-keyword\">date</literal> keyword. Render the date as a text "
|
dongsheng@627
|
15019 "string in ISO 8601 format. Yields a string like <quote><literal>2006-09-04 "
|
dongsheng@627
|
15020 "15:13:13 -0700</literal></quote>."
|
dongsheng@627
|
15021 msgstr ""
|
dongsheng@627
|
15022
|
dongsheng@627
|
15023 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
15024 #: ../en/ch11-template.xml:353
|
dongsheng@627
|
15025 msgid ""
|
dongsheng@627
|
15026 "<literal role=\"template-filter\">obfuscate</literal>: Any text, but most "
|
dongsheng@627
|
15027 "useful for the <literal role=\"template-keyword\">author</literal> keyword. "
|
dongsheng@627
|
15028 "Yield the input text rendered as a sequence of XML entities. This helps to "
|
dongsheng@627
|
15029 "defeat some particularly stupid screen-scraping email harvesting spambots."
|
dongsheng@627
|
15030 msgstr ""
|
dongsheng@627
|
15031
|
dongsheng@627
|
15032 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
15033 #: ../en/ch11-template.xml:361
|
dongsheng@627
|
15034 msgid ""
|
dongsheng@627
|
15035 "<literal role=\"template-kw-filt-author\">person</literal>: Any text, but "
|
dongsheng@627
|
15036 "most useful for the <literal role=\"template-keyword\">author</literal> "
|
dongsheng@627
|
15037 "keyword. Yield the text before an email address. For example, "
|
dongsheng@627
|
15038 "<quote><literal>Bryan O'Sullivan <bos@serpentine.com></literal></quote> "
|
dongsheng@627
|
15039 "becomes <quote><literal>Bryan O'Sullivan</literal></quote>."
|
dongsheng@627
|
15040 msgstr ""
|
dongsheng@627
|
15041
|
dongsheng@627
|
15042 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
15043 #: ../en/ch11-template.xml:370
|
dongsheng@627
|
15044 msgid ""
|
dongsheng@627
|
15045 "<literal role=\"template-kw-filt-date\">rfc822date</literal>: <literal role="
|
dongsheng@627
|
15046 "\"template-keyword\">date</literal> keyword. Render a date using the same "
|
dongsheng@627
|
15047 "format used in email headers. Yields a string like <quote><literal>Mon, 04 "
|
dongsheng@627
|
15048 "Sep 2006 15:13:13 -0700</literal></quote>."
|
dongsheng@627
|
15049 msgstr ""
|
dongsheng@627
|
15050
|
dongsheng@627
|
15051 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
15052 #: ../en/ch11-template.xml:377
|
dongsheng@627
|
15053 msgid ""
|
dongsheng@627
|
15054 "<literal role=\"template-kw-filt-node\">short</literal>: Changeset hash. "
|
dongsheng@627
|
15055 "Yield the short form of a changeset hash, i.e. a 12-character hexadecimal "
|
dongsheng@627
|
15056 "string."
|
dongsheng@627
|
15057 msgstr ""
|
dongsheng@627
|
15058
|
dongsheng@627
|
15059 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
15060 #: ../en/ch11-template.xml:382
|
dongsheng@627
|
15061 msgid ""
|
dongsheng@627
|
15062 "<literal role=\"template-kw-filt-date\">shortdate</literal>: <literal role="
|
dongsheng@627
|
15063 "\"template-keyword\">date</literal> keyword. Render the year, month, and day "
|
dongsheng@627
|
15064 "of the date. Yields a string like <quote><literal>2006-09-04</literal></"
|
dongsheng@627
|
15065 "quote>."
|
dongsheng@627
|
15066 msgstr ""
|
dongsheng@627
|
15067
|
dongsheng@627
|
15068 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
15069 #: ../en/ch11-template.xml:388
|
dongsheng@627
|
15070 msgid ""
|
dongsheng@627
|
15071 "<literal role=\"template-filter\">strip</literal>: Any text. Strip all "
|
dongsheng@627
|
15072 "leading and trailing whitespace from the string."
|
dongsheng@627
|
15073 msgstr ""
|
dongsheng@627
|
15074
|
dongsheng@627
|
15075 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
15076 #: ../en/ch11-template.xml:392
|
dongsheng@627
|
15077 msgid ""
|
dongsheng@627
|
15078 "<literal role=\"template-filter\">tabindent</literal>: Any text. Yield the "
|
dongsheng@627
|
15079 "text, with every line except the first starting with a tab character."
|
dongsheng@627
|
15080 msgstr ""
|
dongsheng@627
|
15081
|
dongsheng@627
|
15082 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
15083 #: ../en/ch11-template.xml:397
|
dongsheng@627
|
15084 msgid ""
|
dongsheng@627
|
15085 "<literal role=\"template-filter\">urlescape</literal>: Any text. Escape all "
|
dongsheng@627
|
15086 "characters that are considered <quote>special</quote> by URL parsers. For "
|
dongsheng@627
|
15087 "example, <literal>foo bar</literal> becomes <literal>foo%20bar</literal>."
|
dongsheng@627
|
15088 msgstr ""
|
dongsheng@627
|
15089
|
dongsheng@627
|
15090 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
15091 #: ../en/ch11-template.xml:404
|
dongsheng@627
|
15092 msgid ""
|
dongsheng@627
|
15093 "<literal role=\"template-kw-filt-author\">user</literal>: Any text, but most "
|
dongsheng@627
|
15094 "useful for the <literal role=\"template-keyword\">author</literal> keyword. "
|
dongsheng@627
|
15095 "Return the <quote>user</quote> portion of an email address. For example, "
|
dongsheng@627
|
15096 "<quote><literal>Bryan O'Sullivan <bos@serpentine.com></literal></quote> "
|
dongsheng@627
|
15097 "becomes <quote><literal>bos</literal></quote>."
|
dongsheng@627
|
15098 msgstr ""
|
dongsheng@627
|
15099
|
dongsheng@627
|
15100 #. type: Content of: <book><chapter><sect1><note><para>
|
dongsheng@714
|
15101 #: ../en/ch11-template.xml:418
|
dongsheng@627
|
15102 msgid ""
|
dongsheng@627
|
15103 "If you try to apply a filter to a piece of data that it cannot process, "
|
dongsheng@627
|
15104 "Mercurial will fail and print a Python exception. For example, trying to run "
|
dongsheng@627
|
15105 "the output of the <literal role=\"template-keyword\">desc</literal> keyword "
|
dongsheng@627
|
15106 "into the <literal role=\"template-kw-filt-date\">isodate</literal> filter is "
|
dongsheng@627
|
15107 "not a good idea."
|
dongsheng@627
|
15108 msgstr ""
|
dongsheng@627
|
15109
|
dongsheng@627
|
15110 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
15111 #: ../en/ch11-template.xml:427
|
dongsheng@627
|
15112 msgid "Combining filters"
|
dongsheng@636
|
15113 msgstr "组合过滤器"
|
dongsheng@627
|
15114
|
dongsheng@627
|
15115 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15116 #: ../en/ch11-template.xml:429
|
dongsheng@627
|
15117 msgid ""
|
dongsheng@627
|
15118 "It is easy to combine filters to yield output in the form you would like. "
|
dongsheng@627
|
15119 "The following chain of filters tidies up a description, then makes sure that "
|
dongsheng@627
|
15120 "it fits cleanly into 68 columns, then indents it by a further 8 characters "
|
dongsheng@627
|
15121 "(at least on Unix-like systems, where a tab is conventionally 8 characters "
|
dongsheng@627
|
15122 "wide)."
|
dongsheng@627
|
15123 msgstr ""
|
dongsheng@627
|
15124
|
dongsheng@627
|
15125 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15126 #: ../en/ch11-template.xml:438
|
dongsheng@627
|
15127 msgid ""
|
dongsheng@627
|
15128 "Note the use of <quote><literal>\\t</literal></quote> (a tab character) in "
|
dongsheng@627
|
15129 "the template to force the first line to be indented; this is necessary since "
|
dongsheng@627
|
15130 "<literal role=\"template-keyword\">tabindent</literal> indents all lines "
|
dongsheng@627
|
15131 "<emphasis>except</emphasis> the first."
|
dongsheng@627
|
15132 msgstr ""
|
dongsheng@627
|
15133
|
dongsheng@627
|
15134 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15135 #: ../en/ch11-template.xml:444
|
dongsheng@627
|
15136 msgid ""
|
dongsheng@627
|
15137 "Keep in mind that the order of filters in a chain is significant. The first "
|
dongsheng@627
|
15138 "filter is applied to the result of the keyword; the second to the result of "
|
dongsheng@627
|
15139 "the first filter; and so on. For example, using <literal>fill68|tabindent</"
|
dongsheng@627
|
15140 "literal> gives very different results from <literal>tabindent|fill68</"
|
dongsheng@627
|
15141 "literal>."
|
dongsheng@627
|
15142 msgstr ""
|
dongsheng@627
|
15143
|
dongsheng@627
|
15144 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
15145 #: ../en/ch11-template.xml:454
|
dongsheng@627
|
15146 msgid "From templates to styles"
|
dongsheng@636
|
15147 msgstr "从模版到样式"
|
dongsheng@627
|
15148
|
dongsheng@627
|
15149 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15150 #: ../en/ch11-template.xml:456
|
dongsheng@627
|
15151 msgid ""
|
dongsheng@627
|
15152 "A command line template provides a quick and simple way to format some "
|
dongsheng@627
|
15153 "output. Templates can become verbose, though, and it's useful to be able to "
|
dongsheng@627
|
15154 "give a template a name. A style file is a template with a name, stored in a "
|
dongsheng@627
|
15155 "file."
|
dongsheng@627
|
15156 msgstr ""
|
dongsheng@627
|
15157
|
dongsheng@627
|
15158 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15159 #: ../en/ch11-template.xml:461
|
dongsheng@627
|
15160 msgid ""
|
dongsheng@627
|
15161 "More than that, using a style file unlocks the power of Mercurial's "
|
dongsheng@627
|
15162 "templating engine in ways that are not possible using the command line "
|
dongsheng@627
|
15163 "<option role=\"hg-opt-log\">--template</option> option."
|
dongsheng@627
|
15164 msgstr ""
|
dongsheng@627
|
15165
|
dongsheng@627
|
15166 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
15167 #: ../en/ch11-template.xml:467
|
dongsheng@627
|
15168 msgid "The simplest of style files"
|
dongsheng@636
|
15169 msgstr "最简单的样式文件"
|
dongsheng@627
|
15170
|
dongsheng@627
|
15171 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15172 #: ../en/ch11-template.xml:469
|
dongsheng@627
|
15173 msgid "Our simple style file contains just one line:"
|
dongsheng@627
|
15174 msgstr ""
|
dongsheng@627
|
15175
|
dongsheng@627
|
15176 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15177 #: ../en/ch11-template.xml:473
|
dongsheng@627
|
15178 msgid ""
|
dongsheng@627
|
15179 "This tells Mercurial, <quote>if you're printing a changeset, use the text on "
|
dongsheng@627
|
15180 "the right as the template</quote>."
|
dongsheng@627
|
15181 msgstr ""
|
dongsheng@627
|
15182
|
dongsheng@627
|
15183 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
15184 #: ../en/ch11-template.xml:479
|
dongsheng@627
|
15185 msgid "Style file syntax"
|
dongsheng@636
|
15186 msgstr "样式文件语法"
|
dongsheng@627
|
15187
|
dongsheng@627
|
15188 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15189 #: ../en/ch11-template.xml:481
|
dongsheng@627
|
15190 msgid "The syntax rules for a style file are simple."
|
dongsheng@627
|
15191 msgstr ""
|
dongsheng@627
|
15192
|
dongsheng@627
|
15193 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15194 #: ../en/ch11-template.xml:484
|
dongsheng@627
|
15195 msgid "The file is processed one line at a time."
|
dongsheng@627
|
15196 msgstr ""
|
dongsheng@627
|
15197
|
dongsheng@627
|
15198 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15199 #: ../en/ch11-template.xml:487
|
dongsheng@627
|
15200 msgid "Leading and trailing white space are ignored."
|
dongsheng@627
|
15201 msgstr ""
|
dongsheng@627
|
15202
|
dongsheng@627
|
15203 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15204 #: ../en/ch11-template.xml:490
|
songdongsheng@658
|
15205 msgid "Empty lines are skipped."
|
songdongsheng@658
|
15206 msgstr ""
|
songdongsheng@658
|
15207
|
songdongsheng@658
|
15208 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15209 #: ../en/ch11-template.xml:492
|
dongsheng@627
|
15210 msgid ""
|
dongsheng@627
|
15211 "If a line starts with either of the characters <quote><literal>#</literal></"
|
dongsheng@627
|
15212 "quote> or <quote><literal>;</literal></quote>, the entire line is treated as "
|
dongsheng@627
|
15213 "a comment, and skipped as if empty."
|
dongsheng@627
|
15214 msgstr ""
|
dongsheng@627
|
15215
|
dongsheng@627
|
15216 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15217 #: ../en/ch11-template.xml:497
|
dongsheng@627
|
15218 msgid ""
|
dongsheng@627
|
15219 "A line starts with a keyword. This must start with an alphabetic character "
|
dongsheng@627
|
15220 "or underscore, and can subsequently contain any alphanumeric character or "
|
dongsheng@627
|
15221 "underscore. (In regexp notation, a keyword must match <literal>[A-Za-z_][A-"
|
dongsheng@627
|
15222 "Za-z0-9_]*</literal>.)"
|
dongsheng@627
|
15223 msgstr ""
|
dongsheng@627
|
15224
|
dongsheng@627
|
15225 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15226 #: ../en/ch11-template.xml:503
|
dongsheng@627
|
15227 msgid ""
|
dongsheng@627
|
15228 "The next element must be an <quote><literal>=</literal></quote> character, "
|
dongsheng@627
|
15229 "which can be preceded or followed by an arbitrary amount of white space."
|
dongsheng@627
|
15230 msgstr ""
|
dongsheng@627
|
15231
|
dongsheng@627
|
15232 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15233 #: ../en/ch11-template.xml:508
|
dongsheng@627
|
15234 msgid ""
|
dongsheng@627
|
15235 "If the rest of the line starts and ends with matching quote characters "
|
dongsheng@627
|
15236 "(either single or double quote), it is treated as a template body."
|
dongsheng@627
|
15237 msgstr ""
|
dongsheng@627
|
15238
|
dongsheng@627
|
15239 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15240 #: ../en/ch11-template.xml:512
|
dongsheng@627
|
15241 msgid ""
|
dongsheng@627
|
15242 "If the rest of the line <emphasis>does not</emphasis> start with a quote "
|
dongsheng@627
|
15243 "character, it is treated as the name of a file; the contents of this file "
|
dongsheng@627
|
15244 "will be read and used as a template body."
|
dongsheng@627
|
15245 msgstr ""
|
dongsheng@627
|
15246
|
dongsheng@627
|
15247 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
15248 #: ../en/ch11-template.xml:521
|
dongsheng@627
|
15249 msgid "Style files by example"
|
dongsheng@636
|
15250 msgstr "样式文件例子"
|
dongsheng@627
|
15251
|
dongsheng@627
|
15252 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15253 #: ../en/ch11-template.xml:523
|
dongsheng@627
|
15254 msgid ""
|
dongsheng@627
|
15255 "To illustrate how to write a style file, we will construct a few by example. "
|
dongsheng@627
|
15256 "Rather than provide a complete style file and walk through it, we'll mirror "
|
dongsheng@627
|
15257 "the usual process of developing a style file by starting with something very "
|
dongsheng@627
|
15258 "simple, and walking through a series of successively more complete examples."
|
dongsheng@627
|
15259 msgstr ""
|
dongsheng@627
|
15260
|
dongsheng@627
|
15261 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
15262 #: ../en/ch11-template.xml:530
|
dongsheng@627
|
15263 msgid "Identifying mistakes in style files"
|
dongsheng@636
|
15264 msgstr "在样式文件中定位错误"
|
dongsheng@627
|
15265
|
dongsheng@627
|
15266 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15267 #: ../en/ch11-template.xml:532
|
dongsheng@627
|
15268 msgid ""
|
dongsheng@627
|
15269 "If Mercurial encounters a problem in a style file you are working on, it "
|
dongsheng@627
|
15270 "prints a terse error message that, once you figure out what it means, is "
|
dongsheng@627
|
15271 "actually quite useful."
|
dongsheng@627
|
15272 msgstr ""
|
dongsheng@627
|
15273
|
dongsheng@627
|
15274 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15275 #: ../en/ch11-template.xml:538
|
dongsheng@627
|
15276 msgid ""
|
dongsheng@627
|
15277 "Notice that <filename>broken.style</filename> attempts to define a "
|
dongsheng@627
|
15278 "<literal>changeset</literal> keyword, but forgets to give any content for it. "
|
dongsheng@627
|
15279 "When instructed to use this style file, Mercurial promptly complains."
|
dongsheng@627
|
15280 msgstr ""
|
dongsheng@627
|
15281
|
dongsheng@627
|
15282 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15283 #: ../en/ch11-template.xml:545
|
dongsheng@627
|
15284 msgid "This error message looks intimidating, but it is not too hard to follow."
|
dongsheng@627
|
15285 msgstr ""
|
dongsheng@627
|
15286
|
dongsheng@627
|
15287 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15288 #: ../en/ch11-template.xml:549
|
dongsheng@627
|
15289 msgid ""
|
dongsheng@627
|
15290 "The first component is simply Mercurial's way of saying <quote>I am giving "
|
dongsheng@627
|
15291 "up</quote>."
|
dongsheng@627
|
15292 msgstr ""
|
dongsheng@627
|
15293
|
dongsheng@627
|
15294 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15295 #: ../en/ch11-template.xml:553
|
dongsheng@627
|
15296 msgid "Next comes the name of the style file that contains the error."
|
dongsheng@627
|
15297 msgstr ""
|
dongsheng@627
|
15298
|
dongsheng@627
|
15299 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15300 #: ../en/ch11-template.xml:557
|
dongsheng@627
|
15301 msgid ""
|
dongsheng@627
|
15302 "Following the file name is the line number where the error was encountered."
|
dongsheng@627
|
15303 msgstr ""
|
dongsheng@627
|
15304
|
dongsheng@627
|
15305 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15306 #: ../en/ch11-template.xml:561
|
dongsheng@627
|
15307 msgid "Finally, a description of what went wrong."
|
dongsheng@627
|
15308 msgstr ""
|
dongsheng@627
|
15309
|
dongsheng@627
|
15310 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15311 #: ../en/ch11-template.xml:565
|
dongsheng@627
|
15312 msgid ""
|
dongsheng@627
|
15313 "The description of the problem is not always clear (as in this case), but "
|
dongsheng@627
|
15314 "even when it is cryptic, it is almost always trivial to visually inspect the "
|
dongsheng@627
|
15315 "offending line in the style file and see what is wrong."
|
dongsheng@627
|
15316 msgstr ""
|
dongsheng@627
|
15317
|
dongsheng@627
|
15318 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
15319 #: ../en/ch11-template.xml:574
|
dongsheng@627
|
15320 msgid "Uniquely identifying a repository"
|
dongsheng@636
|
15321 msgstr "版本库的唯一标识"
|
dongsheng@627
|
15322
|
dongsheng@627
|
15323 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15324 #: ../en/ch11-template.xml:576
|
dongsheng@627
|
15325 msgid ""
|
dongsheng@627
|
15326 "If you would like to be able to identify a Mercurial repository <quote>fairly "
|
dongsheng@627
|
15327 "uniquely</quote> using a short string as an identifier, you can use the first "
|
dongsheng@627
|
15328 "revision in the repository."
|
dongsheng@627
|
15329 msgstr ""
|
dongsheng@627
|
15330
|
dongsheng@627
|
15331 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15332 #: ../en/ch11-template.xml:583
|
dongsheng@714
|
15333 msgid ""
|
dongsheng@714
|
15334 "This is likely to be unique, and so it is useful in many cases. There are a "
|
dongsheng@714
|
15335 "few caveats."
|
dongsheng@627
|
15336 msgstr ""
|
dongsheng@627
|
15337
|
dongsheng@627
|
15338 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15339 #: ../en/ch11-template.xml:586
|
dongsheng@627
|
15340 msgid ""
|
dongsheng@627
|
15341 "It will not work in a completely empty repository, because such a repository "
|
dongsheng@627
|
15342 "does not have a revision zero."
|
dongsheng@627
|
15343 msgstr ""
|
dongsheng@627
|
15344
|
dongsheng@627
|
15345 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15346 #: ../en/ch11-template.xml:590
|
dongsheng@627
|
15347 msgid ""
|
dongsheng@627
|
15348 "Neither will it work in the (extremely rare) case where a repository is a "
|
dongsheng@627
|
15349 "merge of two or more formerly independent repositories, and you still have "
|
dongsheng@627
|
15350 "those repositories around."
|
dongsheng@627
|
15351 msgstr ""
|
dongsheng@627
|
15352
|
dongsheng@627
|
15353 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15354 #: ../en/ch11-template.xml:595
|
dongsheng@627
|
15355 msgid "Here are some uses to which you could put this identifier:"
|
dongsheng@627
|
15356 msgstr ""
|
dongsheng@627
|
15357
|
dongsheng@627
|
15358 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15359 #: ../en/ch11-template.xml:598
|
dongsheng@627
|
15360 msgid ""
|
dongsheng@627
|
15361 "As a key into a table for a database that manages repositories on a server."
|
dongsheng@627
|
15362 msgstr ""
|
dongsheng@627
|
15363
|
dongsheng@627
|
15364 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15365 #: ../en/ch11-template.xml:601
|
dongsheng@627
|
15366 msgid ""
|
dongsheng@627
|
15367 "As half of a {<emphasis>repository ID</emphasis>, <emphasis>revision ID</"
|
dongsheng@627
|
15368 "emphasis>} tuple. Save this information away when you run an automated build "
|
dongsheng@627
|
15369 "or other activity, so that you can <quote>replay</quote> the build later if "
|
dongsheng@627
|
15370 "necessary."
|
dongsheng@627
|
15371 msgstr ""
|
dongsheng@627
|
15372
|
dongsheng@627
|
15373 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
15374 #: ../en/ch11-template.xml:611
|
dongsheng@714
|
15375 msgid "Listing files on multiple lines"
|
dongsheng@716
|
15376 msgstr "每行列出一个文件"
|
dongsheng@714
|
15377
|
dongsheng@714
|
15378 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15379 #: ../en/ch11-template.xml:613
|
dongsheng@714
|
15380 msgid ""
|
dongsheng@714
|
15381 "Suppose we want to list the files changed by a changeset, one per line, with "
|
dongsheng@714
|
15382 "a little indentation before each file name."
|
dongsheng@714
|
15383 msgstr ""
|
dongsheng@714
|
15384
|
dongsheng@714
|
15385 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
15386 #: ../en/ch11-template.xml:621
|
dongsheng@627
|
15387 msgid "Mimicking Subversion's output"
|
dongsheng@636
|
15388 msgstr "模仿 Subversion 的输出"
|
dongsheng@627
|
15389
|
dongsheng@627
|
15390 #
|
dongsheng@627
|
15391 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15392 #: ../en/ch11-template.xml:623
|
dongsheng@627
|
15393 msgid ""
|
dongsheng@627
|
15394 "Let's try to emulate the default output format used by another revision "
|
dongsheng@627
|
15395 "control tool, Subversion."
|
dongsheng@627
|
15396 msgstr ""
|
dongsheng@627
|
15397
|
dongsheng@627
|
15398 #
|
dongsheng@627
|
15399 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15400 #: ../en/ch11-template.xml:628
|
dongsheng@627
|
15401 msgid ""
|
dongsheng@627
|
15402 "Since Subversion's output style is fairly simple, it is easy to copy-and-"
|
dongsheng@627
|
15403 "paste a hunk of its output into a file, and replace the text produced above "
|
dongsheng@627
|
15404 "by Subversion with the template values we'd like to see expanded."
|
dongsheng@627
|
15405 msgstr ""
|
dongsheng@627
|
15406
|
dongsheng@627
|
15407 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15408 #: ../en/ch11-template.xml:635
|
dongsheng@627
|
15409 msgid ""
|
dongsheng@627
|
15410 "There are a few small ways in which this template deviates from the output "
|
dongsheng@627
|
15411 "produced by Subversion."
|
dongsheng@627
|
15412 msgstr ""
|
dongsheng@627
|
15413
|
dongsheng@627
|
15414 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15415 #: ../en/ch11-template.xml:638
|
dongsheng@627
|
15416 msgid ""
|
dongsheng@627
|
15417 "Subversion prints a <quote>readable</quote> date (the <quote><literal>Wed, 27 "
|
dongsheng@627
|
15418 "Sep 2006</literal></quote> in the example output above) in parentheses. "
|
dongsheng@627
|
15419 "Mercurial's templating engine does not provide a way to display a date in "
|
dongsheng@627
|
15420 "this format without also printing the time and time zone."
|
dongsheng@627
|
15421 msgstr ""
|
dongsheng@627
|
15422
|
dongsheng@627
|
15423 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15424 #: ../en/ch11-template.xml:645
|
dongsheng@627
|
15425 msgid ""
|
dongsheng@627
|
15426 "We emulate Subversion's printing of <quote>separator</quote> lines full of "
|
dongsheng@627
|
15427 "<quote><literal>-</literal></quote> characters by ending the template with "
|
dongsheng@627
|
15428 "such a line. We use the templating engine's <literal role=\"template-keyword"
|
dongsheng@627
|
15429 "\">header</literal> keyword to print a separator line as the first line of "
|
dongsheng@627
|
15430 "output (see below), thus achieving similar output to Subversion."
|
dongsheng@627
|
15431 msgstr ""
|
dongsheng@627
|
15432
|
dongsheng@627
|
15433 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15434 #: ../en/ch11-template.xml:654
|
dongsheng@627
|
15435 msgid ""
|
dongsheng@627
|
15436 "Subversion's output includes a count in the header of the number of lines in "
|
dongsheng@627
|
15437 "the commit message. We cannot replicate this in Mercurial; the templating "
|
dongsheng@627
|
15438 "engine does not currently provide a filter that counts the number of lines "
|
dongsheng@627
|
15439 "the template generates."
|
dongsheng@627
|
15440 msgstr ""
|
dongsheng@627
|
15441
|
dongsheng@627
|
15442 #
|
dongsheng@627
|
15443 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15444 #: ../en/ch11-template.xml:660
|
dongsheng@627
|
15445 msgid ""
|
dongsheng@627
|
15446 "It took me no more than a minute or two of work to replace literal text from "
|
dongsheng@627
|
15447 "an example of Subversion's output with some keywords and filters to give the "
|
dongsheng@627
|
15448 "template above. The style file simply refers to the template."
|
dongsheng@627
|
15449 msgstr ""
|
dongsheng@627
|
15450
|
dongsheng@627
|
15451 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15452 #: ../en/ch11-template.xml:667
|
dongsheng@627
|
15453 msgid ""
|
dongsheng@627
|
15454 "We could have included the text of the template file directly in the style "
|
dongsheng@627
|
15455 "file by enclosing it in quotes and replacing the newlines with "
|
dongsheng@627
|
15456 "<quote><literal>\\n</literal></quote> sequences, but it would have made the "
|
dongsheng@627
|
15457 "style file too difficult to read. Readability is a good guide when you're "
|
dongsheng@627
|
15458 "trying to decide whether some text belongs in a style file, or in a template "
|
dongsheng@627
|
15459 "file that the style file points to. If the style file will look too big or "
|
dongsheng@627
|
15460 "cluttered if you insert a literal piece of text, drop it into a template "
|
dongsheng@627
|
15461 "instead."
|
dongsheng@627
|
15462 msgstr ""
|
dongsheng@627
|
15463
|
dongsheng@627
|
15464 #. type: Content of: <book><chapter><title>
|
dongsheng@714
|
15465 #: ../en/ch12-mq.xml:5
|
dongsheng@627
|
15466 msgid "Managing change with Mercurial Queues"
|
dongsheng@627
|
15467 msgstr "使用 MQ 管理修改"
|
dongsheng@627
|
15468
|
dongsheng@627
|
15469 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
15470 #: ../en/ch12-mq.xml:8
|
dongsheng@627
|
15471 msgid "The patch management problem"
|
dongsheng@636
|
15472 msgstr "补丁的管理问题"
|
dongsheng@627
|
15473
|
dongsheng@627
|
15474 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15475 #: ../en/ch12-mq.xml:10
|
dongsheng@627
|
15476 msgid ""
|
dongsheng@627
|
15477 "Here is a common scenario: you need to install a software package from "
|
dongsheng@627
|
15478 "source, but you find a bug that you must fix in the source before you can "
|
dongsheng@627
|
15479 "start using the package. You make your changes, forget about the package for "
|
dongsheng@627
|
15480 "a while, and a few months later you need to upgrade to a newer version of the "
|
dongsheng@627
|
15481 "package. If the newer version of the package still has the bug, you must "
|
dongsheng@627
|
15482 "extract your fix from the older source tree and apply it against the newer "
|
dongsheng@627
|
15483 "version. This is a tedious task, and it's easy to make mistakes."
|
dongsheng@627
|
15484 msgstr ""
|
dongsheng@627
|
15485
|
dongsheng@627
|
15486 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15487 #: ../en/ch12-mq.xml:20
|
dongsheng@627
|
15488 msgid ""
|
dongsheng@627
|
15489 "This is a simple case of the <quote>patch management</quote> problem. You "
|
dongsheng@627
|
15490 "have an <quote>upstream</quote> source tree that you can't change; you need "
|
dongsheng@627
|
15491 "to make some local changes on top of the upstream tree; and you'd like to be "
|
dongsheng@627
|
15492 "able to keep those changes separate, so that you can apply them to newer "
|
dongsheng@627
|
15493 "versions of the upstream source."
|
dongsheng@627
|
15494 msgstr ""
|
dongsheng@627
|
15495
|
dongsheng@627
|
15496 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15497 #: ../en/ch12-mq.xml:27
|
dongsheng@627
|
15498 msgid ""
|
dongsheng@627
|
15499 "The patch management problem arises in many situations. Probably the most "
|
dongsheng@627
|
15500 "visible is that a user of an open source software project will contribute a "
|
dongsheng@627
|
15501 "bug fix or new feature to the project's maintainers in the form of a patch."
|
dongsheng@627
|
15502 msgstr ""
|
dongsheng@627
|
15503
|
dongsheng@627
|
15504 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15505 #: ../en/ch12-mq.xml:32
|
dongsheng@627
|
15506 msgid ""
|
dongsheng@627
|
15507 "Distributors of operating systems that include open source software often "
|
dongsheng@627
|
15508 "need to make changes to the packages they distribute so that they will build "
|
dongsheng@627
|
15509 "properly in their environments."
|
dongsheng@627
|
15510 msgstr ""
|
dongsheng@627
|
15511
|
dongsheng@627
|
15512 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15513 #: ../en/ch12-mq.xml:37
|
dongsheng@627
|
15514 msgid ""
|
dongsheng@627
|
15515 "When you have few changes to maintain, it is easy to manage a single patch "
|
dongsheng@627
|
15516 "using the standard <command>diff</command> and <command>patch</command> "
|
songdongsheng@658
|
15517 "programs (see <xref linkend=\"sec:mq:patch\"/> for a discussion of these "
|
songdongsheng@658
|
15518 "tools). Once the number of changes grows, it starts to make sense to maintain "
|
songdongsheng@658
|
15519 "patches as discrete <quote>chunks of work,</quote> so that for example a "
|
songdongsheng@658
|
15520 "single patch will contain only one bug fix (the patch might modify several "
|
songdongsheng@658
|
15521 "files, but it's doing <quote>only one thing</quote>), and you may have a "
|
songdongsheng@658
|
15522 "number of such patches for different bugs you need fixed and local changes "
|
songdongsheng@658
|
15523 "you require. In this situation, if you submit a bug fix patch to the "
|
dongsheng@627
|
15524 "upstream maintainers of a package and they include your fix in a subsequent "
|
dongsheng@627
|
15525 "release, you can simply drop that single patch when you're updating to the "
|
dongsheng@627
|
15526 "newer release."
|
dongsheng@627
|
15527 msgstr ""
|
dongsheng@627
|
15528
|
dongsheng@627
|
15529 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15530 #: ../en/ch12-mq.xml:52
|
dongsheng@627
|
15531 msgid ""
|
dongsheng@627
|
15532 "Maintaining a single patch against an upstream tree is a little tedious and "
|
dongsheng@627
|
15533 "error-prone, but not difficult. However, the complexity of the problem grows "
|
dongsheng@627
|
15534 "rapidly as the number of patches you have to maintain increases. With more "
|
dongsheng@627
|
15535 "than a tiny number of patches in hand, understanding which ones you have "
|
dongsheng@627
|
15536 "applied and maintaining them moves from messy to overwhelming."
|
dongsheng@627
|
15537 msgstr ""
|
dongsheng@627
|
15538
|
dongsheng@627
|
15539 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15540 #: ../en/ch12-mq.xml:59
|
dongsheng@627
|
15541 msgid ""
|
dongsheng@627
|
15542 "Fortunately, Mercurial includes a powerful extension, Mercurial Queues (or "
|
dongsheng@627
|
15543 "simply <quote>MQ</quote>), that massively simplifies the patch management "
|
dongsheng@627
|
15544 "problem."
|
dongsheng@627
|
15545 msgstr ""
|
dongsheng@627
|
15546
|
dongsheng@627
|
15547 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
15548 #: ../en/ch12-mq.xml:65
|
dongsheng@627
|
15549 msgid "The prehistory of Mercurial Queues"
|
dongsheng@636
|
15550 msgstr "MQ 的历史"
|
dongsheng@627
|
15551
|
dongsheng@627
|
15552 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15553 #: ../en/ch12-mq.xml:67
|
dongsheng@627
|
15554 msgid ""
|
dongsheng@627
|
15555 "During the late 1990s, several Linux kernel developers started to maintain "
|
songdongsheng@710
|
15556 "<quote>patch series</quote> that modified the behavior of the Linux kernel. "
|
dongsheng@627
|
15557 "Some of these series were focused on stability, some on feature coverage, and "
|
dongsheng@627
|
15558 "others were more speculative."
|
dongsheng@627
|
15559 msgstr ""
|
dongsheng@627
|
15560
|
dongsheng@627
|
15561 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15562 #: ../en/ch12-mq.xml:73
|
dongsheng@627
|
15563 msgid ""
|
dongsheng@627
|
15564 "The sizes of these patch series grew rapidly. In 2002, Andrew Morton "
|
dongsheng@627
|
15565 "published some shell scripts he had been using to automate the task of "
|
dongsheng@627
|
15566 "managing his patch queues. Andrew was successfully using these scripts to "
|
dongsheng@627
|
15567 "manage hundreds (sometimes thousands) of patches on top of the Linux kernel."
|
dongsheng@627
|
15568 msgstr ""
|
dongsheng@627
|
15569
|
dongsheng@627
|
15570 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
15571 #: ../en/ch12-mq.xml:80
|
dongsheng@627
|
15572 msgid "A patchwork quilt"
|
dongsheng@627
|
15573 msgstr ""
|
dongsheng@627
|
15574
|
dongsheng@627
|
15575 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15576 #: ../en/ch12-mq.xml:82
|
dongsheng@627
|
15577 msgid ""
|
dongsheng@627
|
15578 "In early 2003, Andreas Gruenbacher and Martin Quinson borrowed the approach "
|
dongsheng@627
|
15579 "of Andrew's scripts and published a tool called <quote>patchwork quilt</"
|
dongsheng@627
|
15580 "quote> <citation>web:quilt</citation>, or simply <quote>quilt</quote> (see "
|
dongsheng@627
|
15581 "<citation>gruenbacher:2005</citation> for a paper describing it). Because "
|
dongsheng@627
|
15582 "quilt substantially automated patch management, it rapidly gained a large "
|
dongsheng@627
|
15583 "following among open source software developers."
|
dongsheng@627
|
15584 msgstr ""
|
dongsheng@627
|
15585
|
dongsheng@627
|
15586 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15587 #: ../en/ch12-mq.xml:91
|
dongsheng@627
|
15588 msgid ""
|
dongsheng@627
|
15589 "Quilt manages a <emphasis>stack of patches</emphasis> on top of a directory "
|
dongsheng@627
|
15590 "tree. To begin, you tell quilt to manage a directory tree, and tell it which "
|
dongsheng@627
|
15591 "files you want to manage; it stores away the names and contents of those "
|
dongsheng@627
|
15592 "files. To fix a bug, you create a new patch (using a single command), edit "
|
dongsheng@627
|
15593 "the files you need to fix, then <quote>refresh</quote> the patch."
|
dongsheng@627
|
15594 msgstr ""
|
dongsheng@627
|
15595
|
dongsheng@627
|
15596 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15597 #: ../en/ch12-mq.xml:99
|
dongsheng@627
|
15598 msgid ""
|
dongsheng@627
|
15599 "The refresh step causes quilt to scan the directory tree; it updates the "
|
dongsheng@627
|
15600 "patch with all of the changes you have made. You can create another patch on "
|
dongsheng@627
|
15601 "top of the first, which will track the changes required to modify the tree "
|
dongsheng@627
|
15602 "from <quote>tree with one patch applied</quote> to <quote>tree with two "
|
dongsheng@627
|
15603 "patches applied</quote>."
|
dongsheng@627
|
15604 msgstr ""
|
dongsheng@627
|
15605
|
dongsheng@627
|
15606 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15607 #: ../en/ch12-mq.xml:106
|
dongsheng@627
|
15608 msgid ""
|
dongsheng@627
|
15609 "You can <emphasis>change</emphasis> which patches are applied to the tree. "
|
dongsheng@627
|
15610 "If you <quote>pop</quote> a patch, the changes made by that patch will vanish "
|
dongsheng@627
|
15611 "from the directory tree. Quilt remembers which patches you have popped, "
|
dongsheng@627
|
15612 "though, so you can <quote>push</quote> a popped patch again, and the "
|
dongsheng@627
|
15613 "directory tree will be restored to contain the modifications in the patch. "
|
dongsheng@627
|
15614 "Most importantly, you can run the <quote>refresh</quote> command at any time, "
|
dongsheng@627
|
15615 "and the topmost applied patch will be updated. This means that you can, at "
|
dongsheng@627
|
15616 "any time, change both which patches are applied and what modifications those "
|
dongsheng@627
|
15617 "patches make."
|
dongsheng@627
|
15618 msgstr ""
|
dongsheng@627
|
15619
|
dongsheng@627
|
15620 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15621 #: ../en/ch12-mq.xml:118
|
dongsheng@627
|
15622 msgid ""
|
dongsheng@627
|
15623 "Quilt knows nothing about revision control tools, so it works equally well on "
|
dongsheng@627
|
15624 "top of an unpacked tarball or a Subversion working copy."
|
dongsheng@627
|
15625 msgstr ""
|
dongsheng@627
|
15626
|
dongsheng@627
|
15627 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
15628 #: ../en/ch12-mq.xml:124
|
dongsheng@627
|
15629 msgid "From patchwork quilt to Mercurial Queues"
|
dongsheng@636
|
15630 msgstr "从 patchwork quilt 到 MQ"
|
dongsheng@627
|
15631
|
dongsheng@627
|
15632 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15633 #: ../en/ch12-mq.xml:126
|
dongsheng@627
|
15634 msgid ""
|
dongsheng@627
|
15635 "In mid-2005, Chris Mason took the features of quilt and wrote an extension "
|
songdongsheng@710
|
15636 "that he called Mercurial Queues, which added quilt-like behavior to Mercurial."
|
dongsheng@627
|
15637 msgstr ""
|
dongsheng@627
|
15638
|
dongsheng@627
|
15639 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15640 #: ../en/ch12-mq.xml:130
|
dongsheng@627
|
15641 msgid ""
|
dongsheng@627
|
15642 "The key difference between quilt and MQ is that quilt knows nothing about "
|
dongsheng@627
|
15643 "revision control systems, while MQ is <emphasis>integrated</emphasis> into "
|
dongsheng@627
|
15644 "Mercurial. Each patch that you push is represented as a Mercurial "
|
dongsheng@627
|
15645 "changeset. Pop a patch, and the changeset goes away."
|
dongsheng@627
|
15646 msgstr ""
|
dongsheng@627
|
15647
|
dongsheng@627
|
15648 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15649 #: ../en/ch12-mq.xml:136
|
dongsheng@627
|
15650 msgid ""
|
dongsheng@627
|
15651 "Because quilt does not care about revision control tools, it is still a "
|
dongsheng@627
|
15652 "tremendously useful piece of software to know about for situations where you "
|
dongsheng@627
|
15653 "cannot use Mercurial and MQ."
|
dongsheng@627
|
15654 msgstr ""
|
dongsheng@627
|
15655
|
dongsheng@627
|
15656 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
15657 #: ../en/ch12-mq.xml:144
|
dongsheng@627
|
15658 msgid "The huge advantage of MQ"
|
dongsheng@636
|
15659 msgstr "MQ 的巨大优势"
|
dongsheng@627
|
15660
|
dongsheng@627
|
15661 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15662 #: ../en/ch12-mq.xml:146
|
dongsheng@627
|
15663 msgid ""
|
dongsheng@627
|
15664 "I cannot overstate the value that MQ offers through the unification of "
|
dongsheng@627
|
15665 "patches and revision control."
|
dongsheng@627
|
15666 msgstr ""
|
dongsheng@627
|
15667
|
dongsheng@627
|
15668 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15669 #: ../en/ch12-mq.xml:149
|
dongsheng@627
|
15670 msgid ""
|
dongsheng@627
|
15671 "A major reason that patches have persisted in the free software and open "
|
songdongsheng@668
|
15672 "source world&emdash;in spite of the availability of increasingly capable "
|
songdongsheng@668
|
15673 "revision control tools over the years&emdash;is the <emphasis>agility</"
|
songdongsheng@668
|
15674 "emphasis> they offer."
|
dongsheng@627
|
15675 msgstr ""
|
dongsheng@627
|
15676
|
dongsheng@627
|
15677 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15678 #: ../en/ch12-mq.xml:155
|
dongsheng@627
|
15679 msgid ""
|
dongsheng@627
|
15680 "Traditional revision control tools make a permanent, irreversible record of "
|
dongsheng@627
|
15681 "everything that you do. While this has great value, it's also somewhat "
|
dongsheng@627
|
15682 "stifling. If you want to perform a wild-eyed experiment, you have to be "
|
songdongsheng@668
|
15683 "careful in how you go about it, or you risk leaving unneeded&emdash;or worse, "
|
songdongsheng@668
|
15684 "misleading or destabilising&emdash;traces of your missteps and errors in the "
|
dongsheng@627
|
15685 "permanent revision record."
|
dongsheng@627
|
15686 msgstr ""
|
dongsheng@627
|
15687
|
dongsheng@627
|
15688 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15689 #: ../en/ch12-mq.xml:163
|
dongsheng@627
|
15690 msgid ""
|
dongsheng@627
|
15691 "By contrast, MQ's marriage of distributed revision control with patches makes "
|
dongsheng@627
|
15692 "it much easier to isolate your work. Your patches live on top of normal "
|
dongsheng@627
|
15693 "revision history, and you can make them disappear or reappear at will. If "
|
dongsheng@627
|
15694 "you don't like a patch, you can drop it. If a patch isn't quite as you want "
|
songdongsheng@668
|
15695 "it to be, simply fix it&emdash;as many times as you need to, until you have "
|
songdongsheng@668
|
15696 "refined it into the form you desire."
|
dongsheng@627
|
15697 msgstr ""
|
dongsheng@627
|
15698
|
dongsheng@627
|
15699 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15700 #: ../en/ch12-mq.xml:171
|
dongsheng@627
|
15701 msgid ""
|
dongsheng@627
|
15702 "As an example, the integration of patches with revision control makes "
|
songdongsheng@668
|
15703 "understanding patches and debugging their effects&emdash;and their interplay "
|
songdongsheng@668
|
15704 "with the code they're based on&emdash;<emphasis>enormously</emphasis> easier. "
|
songdongsheng@668
|
15705 "Since every applied patch has an associated changeset, you can give <command "
|
songdongsheng@668
|
15706 "role=\"hg-cmd\">hg log</command> a file name to see which changesets and "
|
songdongsheng@668
|
15707 "patches affected the file. You can use the <command role=\"hg-cmd\">hg "
|
songdongsheng@668
|
15708 "bisect</command> command to binary-search through all changesets and applied "
|
songdongsheng@668
|
15709 "patches to see where a bug got introduced or fixed. You can use the <command "
|
songdongsheng@668
|
15710 "role=\"hg-cmd\">hg annotate</command> command to see which changeset or patch "
|
songdongsheng@668
|
15711 "modified a particular line of a source file. And so on."
|
dongsheng@627
|
15712 msgstr ""
|
dongsheng@627
|
15713
|
dongsheng@627
|
15714 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15715 #: ../en/ch12-mq.xml:189
|
dongsheng@627
|
15716 msgid ""
|
dongsheng@627
|
15717 "Because MQ doesn't hide its patch-oriented nature, it is helpful to "
|
dongsheng@627
|
15718 "understand what patches are, and a little about the tools that work with them."
|
dongsheng@627
|
15719 msgstr ""
|
dongsheng@627
|
15720
|
dongsheng@627
|
15721 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15722 #: ../en/ch12-mq.xml:193
|
dongsheng@627
|
15723 msgid ""
|
dongsheng@627
|
15724 "The traditional Unix <command>diff</command> command compares two files, and "
|
dongsheng@627
|
15725 "prints a list of differences between them. The <command>patch</command> "
|
dongsheng@627
|
15726 "command understands these differences as <emphasis>modifications</emphasis> "
|
dongsheng@627
|
15727 "to make to a file. Take a look below for a simple example of these commands "
|
dongsheng@627
|
15728 "in action."
|
dongsheng@627
|
15729 msgstr ""
|
dongsheng@627
|
15730
|
dongsheng@627
|
15731 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15732 #: ../en/ch12-mq.xml:202
|
dongsheng@627
|
15733 msgid ""
|
dongsheng@627
|
15734 "The type of file that <command>diff</command> generates (and <command>patch</"
|
dongsheng@627
|
15735 "command> takes as input) is called a <quote>patch</quote> or a <quote>diff</"
|
dongsheng@627
|
15736 "quote>; there is no difference between a patch and a diff. (We'll use the "
|
dongsheng@627
|
15737 "term <quote>patch</quote>, since it's more commonly used.)"
|
dongsheng@627
|
15738 msgstr ""
|
dongsheng@627
|
15739
|
dongsheng@627
|
15740 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15741 #: ../en/ch12-mq.xml:208
|
dongsheng@627
|
15742 msgid ""
|
dongsheng@627
|
15743 "A patch file can start with arbitrary text; the <command>patch</command> "
|
dongsheng@627
|
15744 "command ignores this text, but MQ uses it as the commit message when creating "
|
dongsheng@627
|
15745 "changesets. To find the beginning of the patch content, <command>patch</"
|
dongsheng@627
|
15746 "command> searches for the first line that starts with the string "
|
dongsheng@627
|
15747 "<quote><literal>diff -</literal></quote>."
|
dongsheng@627
|
15748 msgstr ""
|
dongsheng@627
|
15749
|
dongsheng@627
|
15750 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15751 #: ../en/ch12-mq.xml:215
|
dongsheng@627
|
15752 msgid ""
|
dongsheng@627
|
15753 "MQ works with <emphasis>unified</emphasis> diffs (<command>patch</command> "
|
dongsheng@627
|
15754 "can accept several other diff formats, but MQ doesn't). A unified diff "
|
dongsheng@627
|
15755 "contains two kinds of header. The <emphasis>file header</emphasis> describes "
|
dongsheng@627
|
15756 "the file being modified; it contains the name of the file to modify. When "
|
dongsheng@627
|
15757 "<command>patch</command> sees a new file header, it looks for a file with "
|
dongsheng@627
|
15758 "that name to start modifying."
|
dongsheng@627
|
15759 msgstr ""
|
dongsheng@627
|
15760
|
dongsheng@627
|
15761 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15762 #: ../en/ch12-mq.xml:223
|
dongsheng@627
|
15763 msgid ""
|
dongsheng@627
|
15764 "After the file header comes a series of <emphasis>hunks</emphasis>. Each "
|
dongsheng@627
|
15765 "hunk starts with a header; this identifies the range of line numbers within "
|
dongsheng@627
|
15766 "the file that the hunk should modify. Following the header, a hunk starts "
|
dongsheng@627
|
15767 "and ends with a few (usually three) lines of text from the unmodified file; "
|
dongsheng@627
|
15768 "these are called the <emphasis>context</emphasis> for the hunk. If there's "
|
dongsheng@627
|
15769 "only a small amount of context between successive hunks, <command>diff</"
|
dongsheng@627
|
15770 "command> doesn't print a new hunk header; it just runs the hunks together, "
|
dongsheng@627
|
15771 "with a few lines of context between modifications."
|
dongsheng@627
|
15772 msgstr ""
|
dongsheng@627
|
15773
|
dongsheng@627
|
15774 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15775 #: ../en/ch12-mq.xml:235
|
dongsheng@627
|
15776 msgid ""
|
dongsheng@627
|
15777 "Each line of context begins with a space character. Within the hunk, a line "
|
dongsheng@627
|
15778 "that begins with <quote><literal>-</literal></quote> means <quote>remove this "
|
dongsheng@627
|
15779 "line,</quote> while a line that begins with <quote><literal>+</literal></"
|
dongsheng@627
|
15780 "quote> means <quote>insert this line.</quote> For example, a line that is "
|
dongsheng@627
|
15781 "modified is represented by one deletion and one insertion."
|
dongsheng@627
|
15782 msgstr ""
|
dongsheng@627
|
15783
|
dongsheng@627
|
15784 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15785 #: ../en/ch12-mq.xml:243
|
dongsheng@627
|
15786 msgid ""
|
songdongsheng@658
|
15787 "We will return to some of the more subtle aspects of patches later (in <xref "
|
songdongsheng@658
|
15788 "linkend=\"sec:mq:adv-patch\"/>), but you should have enough information now "
|
songdongsheng@658
|
15789 "to use MQ."
|
dongsheng@627
|
15790 msgstr ""
|
dongsheng@627
|
15791
|
dongsheng@627
|
15792 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
15793 #: ../en/ch12-mq.xml:250
|
dongsheng@627
|
15794 msgid "Getting started with Mercurial Queues"
|
dongsheng@636
|
15795 msgstr "开始使用 MQ"
|
dongsheng@627
|
15796
|
dongsheng@627
|
15797 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15798 #: ../en/ch12-mq.xml:252
|
dongsheng@627
|
15799 msgid ""
|
dongsheng@627
|
15800 "Because MQ is implemented as an extension, you must explicitly enable before "
|
dongsheng@627
|
15801 "you can use it. (You don't need to download anything; MQ ships with the "
|
dongsheng@627
|
15802 "standard Mercurial distribution.) To enable MQ, edit your <filename role="
|
dongsheng@627
|
15803 "\"home\">~/.hgrc</filename> file, and add the lines below."
|
dongsheng@627
|
15804 msgstr ""
|
dongsheng@627
|
15805
|
dongsheng@627
|
15806 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15807 #: ../en/ch12-mq.xml:262
|
dongsheng@627
|
15808 msgid ""
|
dongsheng@627
|
15809 "Once the extension is enabled, it will make a number of new commands "
|
dongsheng@627
|
15810 "available. To verify that the extension is working, you can use <command "
|
dongsheng@627
|
15811 "role=\"hg-cmd\">hg help</command> to see if the <command role=\"hg-ext-mq"
|
dongsheng@627
|
15812 "\">qinit</command> command is now available."
|
dongsheng@627
|
15813 msgstr ""
|
dongsheng@627
|
15814
|
dongsheng@627
|
15815 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15816 #: ../en/ch12-mq.xml:270
|
dongsheng@627
|
15817 msgid ""
|
dongsheng@627
|
15818 "You can use MQ with <emphasis>any</emphasis> Mercurial repository, and its "
|
dongsheng@627
|
15819 "commands only operate within that repository. To get started, simply prepare "
|
dongsheng@627
|
15820 "the repository using the <command role=\"hg-ext-mq\">qinit</command> command."
|
dongsheng@627
|
15821 msgstr ""
|
dongsheng@627
|
15822
|
dongsheng@627
|
15823 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
15824 #: ../en/ch12-mq.xml:277
|
dongsheng@627
|
15825 msgid ""
|
dongsheng@627
|
15826 "This command creates an empty directory called <filename role=\"special\" "
|
dongsheng@627
|
15827 "class=\"directory\">.hg/patches</filename>, where MQ will keep its metadata. "
|
dongsheng@627
|
15828 "As with many Mercurial commands, the <command role=\"hg-ext-mq\">qinit</"
|
dongsheng@627
|
15829 "command> command prints nothing if it succeeds."
|
dongsheng@627
|
15830 msgstr ""
|
dongsheng@627
|
15831
|
dongsheng@627
|
15832 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
15833 #: ../en/ch12-mq.xml:284
|
dongsheng@627
|
15834 msgid "Creating a new patch"
|
dongsheng@636
|
15835 msgstr "创建新补丁"
|
dongsheng@627
|
15836
|
dongsheng@627
|
15837 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15838 #: ../en/ch12-mq.xml:286
|
dongsheng@627
|
15839 msgid ""
|
dongsheng@627
|
15840 "To begin work on a new patch, use the <command role=\"hg-ext-mq\">qnew</"
|
dongsheng@627
|
15841 "command> command. This command takes one argument, the name of the patch to "
|
dongsheng@627
|
15842 "create."
|
dongsheng@627
|
15843 msgstr ""
|
dongsheng@627
|
15844
|
dongsheng@627
|
15845 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15846 #: ../en/ch12-mq.xml:290
|
dongsheng@627
|
15847 msgid ""
|
dongsheng@627
|
15848 "MQ will use this as the name of an actual file in the <filename role=\"special"
|
dongsheng@627
|
15849 "\" class=\"directory\">.hg/patches</filename> directory, as you can see below."
|
dongsheng@627
|
15850 msgstr ""
|
dongsheng@627
|
15851
|
dongsheng@627
|
15852 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15853 #: ../en/ch12-mq.xml:297
|
dongsheng@627
|
15854 msgid ""
|
dongsheng@627
|
15855 "Also newly present in the <filename role=\"special\" class=\"directory\">.hg/"
|
dongsheng@627
|
15856 "patches</filename> directory are two other files, <filename role=\"special"
|
dongsheng@627
|
15857 "\">series</filename> and <filename role=\"special\">status</filename>. The "
|
dongsheng@627
|
15858 "<filename role=\"special\">series</filename> file lists all of the patches "
|
dongsheng@627
|
15859 "that MQ knows about for this repository, with one patch per line. Mercurial "
|
dongsheng@627
|
15860 "uses the <filename role=\"special\">status</filename> file for internal book-"
|
dongsheng@627
|
15861 "keeping; it tracks all of the patches that MQ has <emphasis>applied</"
|
dongsheng@627
|
15862 "emphasis> in this repository."
|
dongsheng@627
|
15863 msgstr ""
|
dongsheng@627
|
15864
|
dongsheng@627
|
15865 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@714
|
15866 #: ../en/ch12-mq.xml:309
|
dongsheng@627
|
15867 msgid ""
|
dongsheng@627
|
15868 "You may sometimes want to edit the <filename role=\"special\">series</"
|
dongsheng@627
|
15869 "filename> file by hand; for example, to change the sequence in which some "
|
dongsheng@627
|
15870 "patches are applied. However, manually editing the <filename role=\"special"
|
dongsheng@627
|
15871 "\">status</filename> file is almost always a bad idea, as it's easy to "
|
dongsheng@627
|
15872 "corrupt MQ's idea of what is happening."
|
dongsheng@627
|
15873 msgstr ""
|
dongsheng@627
|
15874
|
dongsheng@627
|
15875 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15876 #: ../en/ch12-mq.xml:318
|
dongsheng@627
|
15877 msgid ""
|
dongsheng@627
|
15878 "Once you have created your new patch, you can edit files in the working "
|
dongsheng@627
|
15879 "directory as you usually would. All of the normal Mercurial commands, such "
|
dongsheng@627
|
15880 "as <command role=\"hg-cmd\">hg diff</command> and <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
15881 "annotate</command>, work exactly as they did before."
|
dongsheng@627
|
15882 msgstr ""
|
dongsheng@627
|
15883
|
dongsheng@627
|
15884 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
15885 #: ../en/ch12-mq.xml:326
|
dongsheng@627
|
15886 msgid "Refreshing a patch"
|
dongsheng@636
|
15887 msgstr "刷新补丁"
|
dongsheng@627
|
15888
|
dongsheng@627
|
15889 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15890 #: ../en/ch12-mq.xml:328
|
dongsheng@627
|
15891 msgid ""
|
dongsheng@627
|
15892 "When you reach a point where you want to save your work, use the <command "
|
dongsheng@627
|
15893 "role=\"hg-ext-mq\">qrefresh</command> command to update the patch you are "
|
dongsheng@627
|
15894 "working on."
|
dongsheng@627
|
15895 msgstr ""
|
dongsheng@627
|
15896
|
dongsheng@627
|
15897 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15898 #: ../en/ch12-mq.xml:334
|
dongsheng@627
|
15899 msgid ""
|
dongsheng@627
|
15900 "This command folds the changes you have made in the working directory into "
|
dongsheng@627
|
15901 "your patch, and updates its corresponding changeset to contain those changes."
|
dongsheng@627
|
15902 msgstr ""
|
dongsheng@627
|
15903
|
dongsheng@627
|
15904 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15905 #: ../en/ch12-mq.xml:338
|
dongsheng@627
|
15906 msgid ""
|
dongsheng@627
|
15907 "You can run <command role=\"hg-ext-mq\">qrefresh</command> as often as you "
|
dongsheng@627
|
15908 "like, so it's a good way to <quote>checkpoint</quote> your work. Refresh "
|
dongsheng@627
|
15909 "your patch at an opportune time; try an experiment; and if the experiment "
|
dongsheng@627
|
15910 "doesn't work out, <command role=\"hg-cmd\">hg revert</command> your "
|
dongsheng@627
|
15911 "modifications back to the last time you refreshed."
|
dongsheng@627
|
15912 msgstr ""
|
dongsheng@627
|
15913
|
dongsheng@627
|
15914 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
15915 #: ../en/ch12-mq.xml:349
|
dongsheng@627
|
15916 msgid "Stacking and tracking patches"
|
dongsheng@636
|
15917 msgstr "堆叠和跟踪补丁"
|
dongsheng@627
|
15918
|
dongsheng@627
|
15919 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15920 #: ../en/ch12-mq.xml:351
|
dongsheng@627
|
15921 msgid ""
|
dongsheng@627
|
15922 "Once you have finished working on a patch, or need to work on another, you "
|
dongsheng@627
|
15923 "can use the <command role=\"hg-ext-mq\">qnew</command> command again to "
|
dongsheng@627
|
15924 "create a new patch. Mercurial will apply this patch on top of your existing "
|
dongsheng@627
|
15925 "patch."
|
dongsheng@627
|
15926 msgstr ""
|
dongsheng@627
|
15927
|
dongsheng@627
|
15928 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15929 #: ../en/ch12-mq.xml:359
|
dongsheng@627
|
15930 msgid ""
|
dongsheng@627
|
15931 "Notice that the patch contains the changes in our prior patch as part of its "
|
dongsheng@627
|
15932 "context (you can see this more clearly in the output of <command role=\"hg-cmd"
|
dongsheng@627
|
15933 "\">hg annotate</command>)."
|
dongsheng@627
|
15934 msgstr ""
|
dongsheng@627
|
15935
|
dongsheng@627
|
15936 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15937 #: ../en/ch12-mq.xml:364
|
dongsheng@627
|
15938 msgid ""
|
dongsheng@627
|
15939 "So far, with the exception of <command role=\"hg-ext-mq\">qnew</command> and "
|
dongsheng@627
|
15940 "<command role=\"hg-ext-mq\">qrefresh</command>, we've been careful to only "
|
dongsheng@627
|
15941 "use regular Mercurial commands. However, MQ provides many commands that are "
|
dongsheng@627
|
15942 "easier to use when you are thinking about patches, as illustrated below."
|
dongsheng@627
|
15943 msgstr ""
|
dongsheng@627
|
15944
|
dongsheng@627
|
15945 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15946 #: ../en/ch12-mq.xml:374
|
dongsheng@627
|
15947 msgid ""
|
dongsheng@627
|
15948 "The <command role=\"hg-ext-mq\">qseries</command> command lists every patch "
|
dongsheng@627
|
15949 "that MQ knows about in this repository, from oldest to newest (most recently "
|
dongsheng@627
|
15950 "<emphasis>created</emphasis>)."
|
dongsheng@627
|
15951 msgstr ""
|
dongsheng@627
|
15952
|
dongsheng@627
|
15953 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
15954 #: ../en/ch12-mq.xml:380
|
dongsheng@627
|
15955 msgid ""
|
dongsheng@627
|
15956 "The <command role=\"hg-ext-mq\">qapplied</command> command lists every patch "
|
dongsheng@627
|
15957 "that MQ has <emphasis>applied</emphasis> in this repository, again from "
|
dongsheng@627
|
15958 "oldest to newest (most recently applied)."
|
dongsheng@627
|
15959 msgstr ""
|
dongsheng@627
|
15960
|
dongsheng@627
|
15961 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
15962 #: ../en/ch12-mq.xml:389
|
dongsheng@627
|
15963 msgid "Manipulating the patch stack"
|
dongsheng@636
|
15964 msgstr "操作补丁堆栈"
|
dongsheng@627
|
15965
|
dongsheng@627
|
15966 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15967 #: ../en/ch12-mq.xml:391
|
dongsheng@627
|
15968 msgid ""
|
dongsheng@627
|
15969 "The previous discussion implied that there must be a difference between "
|
dongsheng@627
|
15970 "<quote>known</quote> and <quote>applied</quote> patches, and there is. MQ "
|
dongsheng@627
|
15971 "can manage a patch without it being applied in the repository."
|
dongsheng@627
|
15972 msgstr ""
|
dongsheng@627
|
15973
|
dongsheng@627
|
15974 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15975 #: ../en/ch12-mq.xml:396
|
dongsheng@627
|
15976 msgid ""
|
dongsheng@627
|
15977 "An <emphasis>applied</emphasis> patch has a corresponding changeset in the "
|
dongsheng@627
|
15978 "repository, and the effects of the patch and changeset are visible in the "
|
dongsheng@627
|
15979 "working directory. You can undo the application of a patch using the "
|
dongsheng@627
|
15980 "<command role=\"hg-ext-mq\">qpop</command> command. MQ still <emphasis>knows "
|
dongsheng@627
|
15981 "about</emphasis>, or manages, a popped patch, but the patch no longer has a "
|
dongsheng@627
|
15982 "corresponding changeset in the repository, and the working directory does not "
|
songdongsheng@658
|
15983 "contain the changes made by the patch. <xref linkend=\"fig:mq:stack\"/> "
|
songdongsheng@658
|
15984 "illustrates the difference between applied and tracked patches."
|
songdongsheng@658
|
15985 msgstr ""
|
songdongsheng@658
|
15986
|
songdongsheng@658
|
15987 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
|
dongsheng@714
|
15988 #: ../en/ch12-mq.xml:409
|
songdongsheng@658
|
15989 msgid "Applied and unapplied patches in the MQ patch stack"
|
dongsheng@660
|
15990 msgstr "在 MQ 补丁堆栈中应用和撤销补丁"
|
songdongsheng@658
|
15991
|
songdongsheng@658
|
15992 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
|
dongsheng@714
|
15993 #: ../en/ch12-mq.xml:412
|
songdongsheng@658
|
15994 msgid "<imageobject><imagedata fileref=\"figs/mq-stack.png\"/></imageobject>"
|
dongsheng@627
|
15995 msgstr ""
|
dongsheng@627
|
15996
|
dongsheng@627
|
15997 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
15998 #: ../en/ch12-mq.xml:417
|
dongsheng@627
|
15999 msgid ""
|
dongsheng@627
|
16000 "You can reapply an unapplied, or popped, patch using the <command role=\"hg-"
|
dongsheng@627
|
16001 "ext-mq\">qpush</command> command. This creates a new changeset to correspond "
|
dongsheng@627
|
16002 "to the patch, and the patch's changes once again become present in the "
|
dongsheng@627
|
16003 "working directory. See below for examples of <command role=\"hg-ext-mq"
|
dongsheng@627
|
16004 "\">qpop</command> and <command role=\"hg-ext-mq\">qpush</command> in action."
|
dongsheng@627
|
16005 msgstr ""
|
dongsheng@627
|
16006
|
dongsheng@627
|
16007 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16008 #: ../en/ch12-mq.xml:427
|
dongsheng@627
|
16009 msgid ""
|
dongsheng@627
|
16010 "Notice that once we have popped a patch or two patches, the output of "
|
dongsheng@627
|
16011 "<command role=\"hg-ext-mq\">qseries</command> remains the same, while that of "
|
dongsheng@627
|
16012 "<command role=\"hg-ext-mq\">qapplied</command> has changed."
|
dongsheng@627
|
16013 msgstr ""
|
dongsheng@627
|
16014
|
dongsheng@627
|
16015 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
16016 #: ../en/ch12-mq.xml:435
|
dongsheng@627
|
16017 msgid "Pushing and popping many patches"
|
dongsheng@636
|
16018 msgstr "压入或弹出多个补丁"
|
dongsheng@627
|
16019
|
dongsheng@627
|
16020 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16021 #: ../en/ch12-mq.xml:437
|
dongsheng@627
|
16022 msgid ""
|
dongsheng@627
|
16023 "While <command role=\"hg-ext-mq\">qpush</command> and <command role=\"hg-ext-"
|
dongsheng@627
|
16024 "mq\">qpop</command> each operate on a single patch at a time by default, you "
|
dongsheng@627
|
16025 "can push and pop many patches in one go. The <option role=\"hg-ext-mq-cmd-"
|
dongsheng@1034
|
16026 "qpush-opt\">-a</option> option to <command role=\"hg-ext-mq\">qpush</command> "
|
dongsheng@1034
|
16027 "causes it to push all unapplied patches, while the <option role=\"hg-ext-mq-"
|
dongsheng@1034
|
16028 "cmd-qpop-opt\">-a</option> option to <command role=\"hg-ext-mq\">qpop</"
|
dongsheng@627
|
16029 "command> causes it to pop all applied patches. (For some more ways to push "
|
songdongsheng@658
|
16030 "and pop many patches, see <xref linkend=\"sec:mq:perf\"/> below.)"
|
dongsheng@627
|
16031 msgstr ""
|
dongsheng@627
|
16032
|
dongsheng@627
|
16033 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
16034 #: ../en/ch12-mq.xml:453
|
dongsheng@627
|
16035 msgid "Safety checks, and overriding them"
|
dongsheng@636
|
16036 msgstr "安全的检查,然后覆盖它们"
|
dongsheng@627
|
16037
|
dongsheng@627
|
16038 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16039 #: ../en/ch12-mq.xml:455
|
dongsheng@627
|
16040 msgid ""
|
dongsheng@627
|
16041 "Several MQ commands check the working directory before they do anything, and "
|
dongsheng@627
|
16042 "fail if they find any modifications. They do this to ensure that you won't "
|
dongsheng@627
|
16043 "lose any changes that you have made, but not yet incorporated into a patch. "
|
dongsheng@627
|
16044 "The example below illustrates this; the <command role=\"hg-ext-mq\">qnew</"
|
dongsheng@627
|
16045 "command> command will not create a new patch if there are outstanding "
|
dongsheng@627
|
16046 "changes, caused in this case by the <command role=\"hg-cmd\">hg add</command> "
|
dongsheng@627
|
16047 "of <filename>file3</filename>."
|
dongsheng@627
|
16048 msgstr ""
|
dongsheng@627
|
16049
|
dongsheng@627
|
16050 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16051 #: ../en/ch12-mq.xml:467
|
dongsheng@627
|
16052 msgid ""
|
dongsheng@627
|
16053 "Commands that check the working directory all take an <quote>I know what I'm "
|
dongsheng@627
|
16054 "doing</quote> option, which is always named <option>-f</option>. The exact "
|
dongsheng@627
|
16055 "meaning of <option>-f</option> depends on the command. For example, <command "
|
dongsheng@1034
|
16056 "role=\"hg-cmd\">hg qnew <option role=\"hg-ext-mq-cmd-qnew-opt\">-f</option></"
|
dongsheng@1034
|
16057 "command> will incorporate any outstanding changes into the new patch it "
|
dongsheng@1034
|
16058 "creates, but <command role=\"hg-cmd\">hg qpop <option role=\"hg-ext-mq-cmd-"
|
dongsheng@1034
|
16059 "qpop-opt\">-f</option></command> will revert modifications to any files "
|
dongsheng@627
|
16060 "affected by the patch that it is popping. Be sure to read the documentation "
|
dongsheng@627
|
16061 "for a command's <option>-f</option> option before you use it!"
|
dongsheng@627
|
16062 msgstr ""
|
dongsheng@627
|
16063
|
dongsheng@627
|
16064 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
16065 #: ../en/ch12-mq.xml:482
|
dongsheng@627
|
16066 msgid "Working on several patches at once"
|
dongsheng@636
|
16067 msgstr "同时处理多个补丁"
|
dongsheng@627
|
16068
|
dongsheng@627
|
16069 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16070 #: ../en/ch12-mq.xml:484
|
dongsheng@627
|
16071 msgid ""
|
dongsheng@627
|
16072 "The <command role=\"hg-ext-mq\">qrefresh</command> command always refreshes "
|
dongsheng@627
|
16073 "the <emphasis>topmost</emphasis> applied patch. This means that you can "
|
dongsheng@627
|
16074 "suspend work on one patch (by refreshing it), pop or push to make a different "
|
dongsheng@627
|
16075 "patch the top, and work on <emphasis>that</emphasis> patch for a while."
|
dongsheng@627
|
16076 msgstr ""
|
dongsheng@627
|
16077
|
dongsheng@627
|
16078 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16079 #: ../en/ch12-mq.xml:491
|
dongsheng@627
|
16080 msgid ""
|
dongsheng@627
|
16081 "Here's an example that illustrates how you can use this ability. Let's say "
|
dongsheng@627
|
16082 "you're developing a new feature as two patches. The first is a change to the "
|
songdongsheng@668
|
16083 "core of your software, and the second&emdash;layered on top of the "
|
songdongsheng@668
|
16084 "first&emdash;changes the user interface to use the code you just added to the "
|
songdongsheng@668
|
16085 "core. If you notice a bug in the core while you're working on the UI patch, "
|
songdongsheng@668
|
16086 "it's easy to fix the core. Simply <command role=\"hg-ext-mq\">qrefresh</"
|
songdongsheng@668
|
16087 "command> the UI patch to save your in-progress changes, and <command role="
|
songdongsheng@668
|
16088 "\"hg-ext-mq\">qpop</command> down to the core patch. Fix the core bug, "
|
songdongsheng@668
|
16089 "<command role=\"hg-ext-mq\">qrefresh</command> the core patch, and <command "
|
songdongsheng@668
|
16090 "role=\"hg-ext-mq\">qpush</command> back to the UI patch to continue where you "
|
songdongsheng@668
|
16091 "left off."
|
dongsheng@627
|
16092 msgstr ""
|
dongsheng@627
|
16093
|
dongsheng@627
|
16094 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
16095 #: ../en/ch12-mq.xml:508
|
dongsheng@627
|
16096 msgid "More about patches"
|
dongsheng@636
|
16097 msgstr "关于补丁的更多信息"
|
dongsheng@627
|
16098
|
dongsheng@627
|
16099 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16100 #: ../en/ch12-mq.xml:510
|
dongsheng@627
|
16101 msgid ""
|
dongsheng@627
|
16102 "MQ uses the GNU <command>patch</command> command to apply patches, so it's "
|
dongsheng@627
|
16103 "helpful to know a few more detailed aspects of how <command>patch</command> "
|
dongsheng@627
|
16104 "works, and about patches themselves."
|
dongsheng@627
|
16105 msgstr ""
|
dongsheng@627
|
16106
|
dongsheng@627
|
16107 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
16108 #: ../en/ch12-mq.xml:516
|
dongsheng@627
|
16109 msgid "The strip count"
|
dongsheng@636
|
16110 msgstr "修剪计数"
|
dongsheng@627
|
16111
|
dongsheng@627
|
16112 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16113 #: ../en/ch12-mq.xml:518
|
dongsheng@627
|
16114 msgid ""
|
dongsheng@627
|
16115 "If you look at the file headers in a patch, you will notice that the "
|
dongsheng@627
|
16116 "pathnames usually have an extra component on the front that isn't present in "
|
dongsheng@627
|
16117 "the actual path name. This is a holdover from the way that people used to "
|
dongsheng@627
|
16118 "generate patches (people still do this, but it's somewhat rare with modern "
|
dongsheng@627
|
16119 "revision control tools)."
|
dongsheng@627
|
16120 msgstr ""
|
dongsheng@627
|
16121
|
dongsheng@627
|
16122 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16123 #: ../en/ch12-mq.xml:525
|
dongsheng@627
|
16124 msgid ""
|
dongsheng@627
|
16125 "Alice would unpack a tarball, edit her files, then decide that she wanted to "
|
dongsheng@627
|
16126 "create a patch. So she'd rename her working directory, unpack the tarball "
|
dongsheng@627
|
16127 "again (hence the need for the rename), and use the <option role=\"cmd-opt-diff"
|
dongsheng@627
|
16128 "\">-r</option> and <option role=\"cmd-opt-diff\">-N</option> options to "
|
dongsheng@627
|
16129 "<command>diff</command> to recursively generate a patch between the "
|
dongsheng@627
|
16130 "unmodified directory and the modified one. The result would be that the name "
|
dongsheng@627
|
16131 "of the unmodified directory would be at the front of the left-hand path in "
|
dongsheng@627
|
16132 "every file header, and the name of the modified directory would be at the "
|
dongsheng@627
|
16133 "front of the right-hand path."
|
dongsheng@627
|
16134 msgstr ""
|
dongsheng@627
|
16135
|
dongsheng@627
|
16136 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16137 #: ../en/ch12-mq.xml:538
|
dongsheng@627
|
16138 msgid ""
|
dongsheng@627
|
16139 "Since someone receiving a patch from the Alices of the net would be unlikely "
|
dongsheng@627
|
16140 "to have unmodified and modified directories with exactly the same names, the "
|
dongsheng@627
|
16141 "<command>patch</command> command has a <option role=\"cmd-opt-patch\">-p</"
|
dongsheng@627
|
16142 "option> option that indicates the number of leading path name components to "
|
dongsheng@627
|
16143 "strip when trying to apply a patch. This number is called the "
|
dongsheng@627
|
16144 "<emphasis>strip count</emphasis>."
|
dongsheng@627
|
16145 msgstr ""
|
dongsheng@627
|
16146
|
dongsheng@627
|
16147 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16148 #: ../en/ch12-mq.xml:546
|
dongsheng@627
|
16149 msgid ""
|
dongsheng@627
|
16150 "An option of <quote><literal>-p1</literal></quote> means <quote>use a strip "
|
dongsheng@627
|
16151 "count of one</quote>. If <command>patch</command> sees a file name "
|
dongsheng@627
|
16152 "<filename>foo/bar/baz</filename> in a file header, it will strip "
|
dongsheng@627
|
16153 "<filename>foo</filename> and try to patch a file named <filename>bar/baz</"
|
dongsheng@627
|
16154 "filename>. (Strictly speaking, the strip count refers to the number of "
|
dongsheng@627
|
16155 "<emphasis>path separators</emphasis> (and the components that go with them ) "
|
dongsheng@627
|
16156 "to strip. A strip count of one will turn <filename>foo/bar</filename> into "
|
dongsheng@627
|
16157 "<filename>bar</filename>, but <filename>/foo/bar</filename> (notice the extra "
|
dongsheng@627
|
16158 "leading slash) into <filename>foo/bar</filename>.)"
|
dongsheng@627
|
16159 msgstr ""
|
dongsheng@627
|
16160
|
dongsheng@627
|
16161 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16162 #: ../en/ch12-mq.xml:559
|
dongsheng@627
|
16163 msgid ""
|
dongsheng@627
|
16164 "The <quote>standard</quote> strip count for patches is one; almost all "
|
dongsheng@627
|
16165 "patches contain one leading path name component that needs to be stripped. "
|
dongsheng@627
|
16166 "Mercurial's <command role=\"hg-cmd\">hg diff</command> command generates path "
|
dongsheng@627
|
16167 "names in this form, and the <command role=\"hg-cmd\">hg import</command> "
|
dongsheng@627
|
16168 "command and MQ expect patches to have a strip count of one."
|
dongsheng@627
|
16169 msgstr ""
|
dongsheng@627
|
16170
|
dongsheng@627
|
16171 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16172 #: ../en/ch12-mq.xml:567
|
dongsheng@627
|
16173 msgid ""
|
dongsheng@627
|
16174 "If you receive a patch from someone that you want to add to your patch queue, "
|
dongsheng@627
|
16175 "and the patch needs a strip count other than one, you cannot just <command "
|
dongsheng@627
|
16176 "role=\"hg-ext-mq\">qimport</command> the patch, because <command role=\"hg-"
|
dongsheng@627
|
16177 "ext-mq\">qimport</command> does not yet have a <literal>-p</literal> option "
|
dongsheng@627
|
16178 "(see <ulink role=\"hg-bug\" url=\"http://www.selenic.com/mercurial/bts/"
|
dongsheng@627
|
16179 "issue311\">issue 311</ulink>). Your best bet is to <command role=\"hg-ext-mq"
|
dongsheng@627
|
16180 "\">qnew</command> a patch of your own, then use <command>patch -pN</command> "
|
dongsheng@627
|
16181 "to apply their patch, followed by <command role=\"hg-cmd\">hg addremove</"
|
dongsheng@627
|
16182 "command> to pick up any files added or removed by the patch, followed by "
|
dongsheng@627
|
16183 "<command role=\"hg-ext-mq\">hg qrefresh</command>. This complexity may become "
|
dongsheng@627
|
16184 "unnecessary; see <ulink role=\"hg-bug\" url=\"http://www.selenic.com/"
|
dongsheng@627
|
16185 "mercurial/bts/issue311\">issue 311</ulink> for details."
|
dongsheng@627
|
16186 msgstr ""
|
dongsheng@627
|
16187
|
dongsheng@627
|
16188 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
16189 #: ../en/ch12-mq.xml:587
|
dongsheng@627
|
16190 msgid "Strategies for applying a patch"
|
dongsheng@636
|
16191 msgstr "应用补丁的策略"
|
dongsheng@627
|
16192
|
dongsheng@627
|
16193 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16194 #: ../en/ch12-mq.xml:589
|
dongsheng@627
|
16195 msgid ""
|
dongsheng@627
|
16196 "When <command>patch</command> applies a hunk, it tries a handful of "
|
dongsheng@627
|
16197 "successively less accurate strategies to try to make the hunk apply. This "
|
dongsheng@627
|
16198 "falling-back technique often makes it possible to take a patch that was "
|
dongsheng@627
|
16199 "generated against an old version of a file, and apply it against a newer "
|
dongsheng@627
|
16200 "version of that file."
|
dongsheng@627
|
16201 msgstr ""
|
dongsheng@627
|
16202
|
dongsheng@627
|
16203 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16204 #: ../en/ch12-mq.xml:596
|
dongsheng@627
|
16205 msgid ""
|
dongsheng@627
|
16206 "First, <command>patch</command> tries an exact match, where the line numbers, "
|
dongsheng@627
|
16207 "the context, and the text to be modified must apply exactly. If it cannot "
|
dongsheng@627
|
16208 "make an exact match, it tries to find an exact match for the context, without "
|
dongsheng@627
|
16209 "honouring the line numbering information. If this succeeds, it prints a line "
|
dongsheng@627
|
16210 "of output saying that the hunk was applied, but at some <emphasis>offset</"
|
dongsheng@627
|
16211 "emphasis> from the original line number."
|
dongsheng@627
|
16212 msgstr ""
|
dongsheng@627
|
16213
|
dongsheng@627
|
16214 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16215 #: ../en/ch12-mq.xml:605
|
dongsheng@627
|
16216 msgid ""
|
dongsheng@627
|
16217 "If a context-only match fails, <command>patch</command> removes the first and "
|
dongsheng@627
|
16218 "last lines of the context, and tries a <emphasis>reduced</emphasis> context-"
|
dongsheng@627
|
16219 "only match. If the hunk with reduced context succeeds, it prints a message "
|
dongsheng@627
|
16220 "saying that it applied the hunk with a <emphasis>fuzz factor</emphasis> (the "
|
dongsheng@627
|
16221 "number after the fuzz factor indicates how many lines of context "
|
dongsheng@627
|
16222 "<command>patch</command> had to trim before the patch applied)."
|
dongsheng@627
|
16223 msgstr ""
|
dongsheng@627
|
16224
|
dongsheng@627
|
16225 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16226 #: ../en/ch12-mq.xml:614
|
dongsheng@627
|
16227 msgid ""
|
dongsheng@627
|
16228 "When neither of these techniques works, <command>patch</command> prints a "
|
dongsheng@627
|
16229 "message saying that the hunk in question was rejected. It saves rejected "
|
dongsheng@627
|
16230 "hunks (also simply called <quote>rejects</quote>) to a file with the same "
|
dongsheng@627
|
16231 "name, and an added <filename role=\"special\">.rej</filename> extension. It "
|
dongsheng@627
|
16232 "also saves an unmodified copy of the file with a <filename role=\"special\">."
|
dongsheng@627
|
16233 "orig</filename> extension; the copy of the file without any extensions will "
|
dongsheng@627
|
16234 "contain any changes made by hunks that <emphasis>did</emphasis> apply "
|
dongsheng@627
|
16235 "cleanly. If you have a patch that modifies <filename>foo</filename> with six "
|
dongsheng@627
|
16236 "hunks, and one of them fails to apply, you will have: an unmodified "
|
dongsheng@627
|
16237 "<filename>foo.orig</filename>, a <filename>foo.rej</filename> containing one "
|
dongsheng@627
|
16238 "hunk, and <filename>foo</filename>, containing the changes made by the five "
|
dongsheng@627
|
16239 "successful hunks."
|
dongsheng@627
|
16240 msgstr ""
|
dongsheng@627
|
16241
|
dongsheng@627
|
16242 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
16243 #: ../en/ch12-mq.xml:632
|
dongsheng@627
|
16244 msgid "Some quirks of patch representation"
|
dongsheng@636
|
16245 msgstr "补丁的一些特性"
|
dongsheng@627
|
16246
|
dongsheng@627
|
16247 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16248 #: ../en/ch12-mq.xml:634
|
dongsheng@627
|
16249 msgid ""
|
dongsheng@627
|
16250 "There are a few useful things to know about how <command>patch</command> "
|
dongsheng@627
|
16251 "works with files."
|
dongsheng@627
|
16252 msgstr ""
|
dongsheng@627
|
16253
|
dongsheng@627
|
16254 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
16255 #: ../en/ch12-mq.xml:637
|
dongsheng@627
|
16256 msgid ""
|
dongsheng@627
|
16257 "This should already be obvious, but <command>patch</command> cannot handle "
|
dongsheng@627
|
16258 "binary files."
|
dongsheng@627
|
16259 msgstr ""
|
dongsheng@627
|
16260
|
dongsheng@627
|
16261 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
16262 #: ../en/ch12-mq.xml:641
|
dongsheng@627
|
16263 msgid ""
|
dongsheng@627
|
16264 "Neither does it care about the executable bit; it creates new files as "
|
dongsheng@627
|
16265 "readable, but not executable."
|
dongsheng@627
|
16266 msgstr ""
|
dongsheng@627
|
16267
|
dongsheng@627
|
16268 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
16269 #: ../en/ch12-mq.xml:645
|
dongsheng@627
|
16270 msgid ""
|
dongsheng@627
|
16271 "<command>patch</command> treats the removal of a file as a diff between the "
|
dongsheng@627
|
16272 "file to be removed and the empty file. So your idea of <quote>I deleted this "
|
dongsheng@627
|
16273 "file</quote> looks like <quote>every line of this file was deleted</quote> in "
|
dongsheng@627
|
16274 "a patch."
|
dongsheng@627
|
16275 msgstr ""
|
dongsheng@627
|
16276
|
dongsheng@627
|
16277 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
16278 #: ../en/ch12-mq.xml:651
|
dongsheng@627
|
16279 msgid ""
|
dongsheng@627
|
16280 "It treats the addition of a file as a diff between the empty file and the "
|
dongsheng@627
|
16281 "file to be added. So in a patch, your idea of <quote>I added this file</"
|
dongsheng@627
|
16282 "quote> looks like <quote>every line of this file was added</quote>."
|
dongsheng@627
|
16283 msgstr ""
|
dongsheng@627
|
16284
|
dongsheng@627
|
16285 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
16286 #: ../en/ch12-mq.xml:657
|
dongsheng@627
|
16287 msgid ""
|
dongsheng@627
|
16288 "It treats a renamed file as the removal of the old name, and the addition of "
|
dongsheng@627
|
16289 "the new name. This means that renamed files have a big footprint in "
|
dongsheng@627
|
16290 "patches. (Note also that Mercurial does not currently try to infer when "
|
dongsheng@627
|
16291 "files have been renamed or copied in a patch.)"
|
dongsheng@627
|
16292 msgstr ""
|
dongsheng@627
|
16293
|
dongsheng@627
|
16294 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
16295 #: ../en/ch12-mq.xml:663
|
dongsheng@627
|
16296 msgid ""
|
dongsheng@627
|
16297 "<command>patch</command> cannot represent empty files, so you cannot use a "
|
dongsheng@627
|
16298 "patch to represent the notion <quote>I added this empty file to the tree</"
|
dongsheng@627
|
16299 "quote>."
|
dongsheng@627
|
16300 msgstr ""
|
dongsheng@627
|
16301
|
dongsheng@627
|
16302 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
16303 #: ../en/ch12-mq.xml:671
|
dongsheng@627
|
16304 msgid "Beware the fuzz"
|
dongsheng@636
|
16305 msgstr "当心毛刺"
|
dongsheng@627
|
16306
|
dongsheng@627
|
16307 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16308 #: ../en/ch12-mq.xml:673
|
dongsheng@627
|
16309 msgid ""
|
dongsheng@627
|
16310 "While applying a hunk at an offset, or with a fuzz factor, will often be "
|
dongsheng@627
|
16311 "completely successful, these inexact techniques naturally leave open the "
|
dongsheng@627
|
16312 "possibility of corrupting the patched file. The most common cases typically "
|
dongsheng@627
|
16313 "involve applying a patch twice, or at an incorrect location in the file. If "
|
dongsheng@627
|
16314 "<command>patch</command> or <command role=\"hg-ext-mq\">qpush</command> ever "
|
dongsheng@627
|
16315 "mentions an offset or fuzz factor, you should make sure that the modified "
|
dongsheng@627
|
16316 "files are correct afterwards."
|
dongsheng@627
|
16317 msgstr ""
|
dongsheng@627
|
16318
|
dongsheng@627
|
16319 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16320 #: ../en/ch12-mq.xml:683
|
dongsheng@627
|
16321 msgid ""
|
dongsheng@627
|
16322 "It's often a good idea to refresh a patch that has applied with an offset or "
|
dongsheng@627
|
16323 "fuzz factor; refreshing the patch generates new context information that will "
|
dongsheng@627
|
16324 "make it apply cleanly. I say <quote>often,</quote> not <quote>always,</"
|
dongsheng@627
|
16325 "quote> because sometimes refreshing a patch will make it fail to apply "
|
dongsheng@627
|
16326 "against a different revision of the underlying files. In some cases, such as "
|
dongsheng@627
|
16327 "when you're maintaining a patch that must sit on top of multiple versions of "
|
dongsheng@627
|
16328 "a source tree, it's acceptable to have a patch apply with some fuzz, provided "
|
dongsheng@627
|
16329 "you've verified the results of the patching process in such cases."
|
dongsheng@627
|
16330 msgstr ""
|
dongsheng@627
|
16331
|
dongsheng@627
|
16332 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
16333 #: ../en/ch12-mq.xml:696
|
dongsheng@627
|
16334 msgid "Handling rejection"
|
dongsheng@636
|
16335 msgstr "处理拒绝"
|
dongsheng@627
|
16336
|
dongsheng@627
|
16337 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16338 #: ../en/ch12-mq.xml:698
|
dongsheng@627
|
16339 msgid ""
|
dongsheng@627
|
16340 "If <command role=\"hg-ext-mq\">qpush</command> fails to apply a patch, it "
|
dongsheng@627
|
16341 "will print an error message and exit. If it has left <filename role=\"special"
|
dongsheng@627
|
16342 "\">.rej</filename> files behind, it is usually best to fix up the rejected "
|
dongsheng@627
|
16343 "hunks before you push more patches or do any further work."
|
dongsheng@627
|
16344 msgstr ""
|
dongsheng@627
|
16345
|
dongsheng@627
|
16346 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16347 #: ../en/ch12-mq.xml:704
|
dongsheng@627
|
16348 msgid ""
|
dongsheng@627
|
16349 "If your patch <emphasis>used to</emphasis> apply cleanly, and no longer does "
|
dongsheng@627
|
16350 "because you've changed the underlying code that your patches are based on, "
|
songdongsheng@658
|
16351 "Mercurial Queues can help; see <xref linkend=\"sec:mq:merge\"/> for details."
|
songdongsheng@658
|
16352 msgstr ""
|
songdongsheng@658
|
16353
|
songdongsheng@658
|
16354 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16355 #: ../en/ch12-mq.xml:709
|
dongsheng@627
|
16356 msgid ""
|
dongsheng@627
|
16357 "Unfortunately, there aren't any great techniques for dealing with rejected "
|
dongsheng@627
|
16358 "hunks. Most often, you'll need to view the <filename role=\"special\">.rej</"
|
dongsheng@627
|
16359 "filename> file and edit the target file, applying the rejected hunks by hand."
|
dongsheng@627
|
16360 msgstr ""
|
dongsheng@627
|
16361
|
dongsheng@627
|
16362 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16363 #: ../en/ch12-mq.xml:714
|
dongsheng@714
|
16364 msgid ""
|
dongsheng@714
|
16365 "A Linux kernel hacker, Chris Mason (the author of Mercurial Queues), wrote a "
|
dongsheng@714
|
16366 "tool called <command>mpatch</command> (<ulink url=\"http://oss.oracle.com/"
|
dongsheng@714
|
16367 "~mason/mpatch/\">http://oss.oracle.com/~mason/mpatch/</ulink>), which takes a "
|
dongsheng@714
|
16368 "simple approach to automating the application of hunks rejected by "
|
dongsheng@714
|
16369 "<command>patch</command>. The <command>mpatch</command> command can help "
|
dongsheng@714
|
16370 "with four common reasons that a hunk may be rejected:"
|
dongsheng@627
|
16371 msgstr ""
|
dongsheng@627
|
16372
|
dongsheng@627
|
16373 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
16374 #: ../en/ch12-mq.xml:724
|
dongsheng@627
|
16375 msgid "The context in the middle of a hunk has changed."
|
dongsheng@627
|
16376 msgstr ""
|
dongsheng@627
|
16377
|
dongsheng@627
|
16378 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
16379 #: ../en/ch12-mq.xml:727
|
dongsheng@627
|
16380 msgid "A hunk is missing some context at the beginning or end."
|
dongsheng@627
|
16381 msgstr ""
|
dongsheng@627
|
16382
|
dongsheng@627
|
16383 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
16384 #: ../en/ch12-mq.xml:730
|
dongsheng@627
|
16385 msgid ""
|
songdongsheng@668
|
16386 "A large hunk might apply better&emdash;either entirely or in part&emdash;if "
|
songdongsheng@668
|
16387 "it was broken up into smaller hunks."
|
dongsheng@627
|
16388 msgstr ""
|
dongsheng@627
|
16389
|
dongsheng@627
|
16390 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
16391 #: ../en/ch12-mq.xml:734
|
dongsheng@627
|
16392 msgid ""
|
dongsheng@627
|
16393 "A hunk removes lines with slightly different content than those currently "
|
dongsheng@627
|
16394 "present in the file."
|
dongsheng@627
|
16395 msgstr ""
|
dongsheng@627
|
16396
|
dongsheng@627
|
16397 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16398 #: ../en/ch12-mq.xml:738
|
dongsheng@714
|
16399 msgid ""
|
dongsheng@714
|
16400 "If you use <command>mpatch</command>, you should be doubly careful to check "
|
dongsheng@714
|
16401 "your results when you're done. In fact, <command>mpatch</command> enforces "
|
dongsheng@714
|
16402 "this method of double-checking the tool's output, by automatically dropping "
|
dongsheng@714
|
16403 "you into a merge program when it has done its job, so that you can verify its "
|
dongsheng@714
|
16404 "work and finish off any remaining merges."
|
dongsheng@627
|
16405 msgstr ""
|
dongsheng@627
|
16406
|
dongsheng@627
|
16407 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
16408 #: ../en/ch12-mq.xml:749
|
dongsheng@714
|
16409 msgid "More on patch management"
|
dongsheng@715
|
16410 msgstr "补丁管理进阶"
|
dongsheng@714
|
16411
|
dongsheng@714
|
16412 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16413 #: ../en/ch12-mq.xml:751
|
dongsheng@714
|
16414 msgid ""
|
dongsheng@714
|
16415 "As you grow familiar with MQ, you will find yourself wanting to perform other "
|
dongsheng@714
|
16416 "kinds of patch management operations."
|
dongsheng@714
|
16417 msgstr ""
|
dongsheng@714
|
16418
|
dongsheng@714
|
16419 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
16420 #: ../en/ch12-mq.xml:755
|
dongsheng@714
|
16421 msgid "Deleting unwanted patches"
|
dongsheng@715
|
16422 msgstr "删除不需要的补丁"
|
dongsheng@714
|
16423
|
dongsheng@714
|
16424 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16425 #: ../en/ch12-mq.xml:757
|
dongsheng@714
|
16426 msgid ""
|
dongsheng@714
|
16427 "If you want to get rid of a patch, use the <command role=\"hg-ext-mq\">hg "
|
dongsheng@714
|
16428 "qdelete</command> command to delete the patch file and remove its entry from "
|
dongsheng@714
|
16429 "the patch series. If you try to delete a patch that is still applied, "
|
dongsheng@714
|
16430 "<command role=\"hg-ext-mq\">hg qdelete</command> will refuse."
|
dongsheng@714
|
16431 msgstr ""
|
dongsheng@714
|
16432
|
dongsheng@714
|
16433 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
16434 #: ../en/ch12-mq.xml:767
|
dongsheng@714
|
16435 msgid "Converting to and from permanent revisions"
|
dongsheng@716
|
16436 msgstr "与持久版本的相互转换"
|
dongsheng@714
|
16437
|
dongsheng@714
|
16438 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16439 #: ../en/ch12-mq.xml:769
|
dongsheng@714
|
16440 msgid ""
|
dongsheng@714
|
16441 "Once you're done working on a patch and want to turn it into a permanent "
|
dongsheng@714
|
16442 "changeset, use the <command role=\"hg-ext-mq\">hg qfinish</command> command. "
|
dongsheng@714
|
16443 "Pass a revision to the command to identify the patch that you want to turn "
|
dongsheng@714
|
16444 "into a regular changeset; this patch must already be applied."
|
dongsheng@714
|
16445 msgstr ""
|
dongsheng@714
|
16446
|
dongsheng@714
|
16447 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16448 #: ../en/ch12-mq.xml:777
|
dongsheng@714
|
16449 msgid ""
|
dongsheng@714
|
16450 "The <command role=\"hg-ext-mq\">hg qfinish</command> command accepts an "
|
dongsheng@714
|
16451 "<option>--all</option> or <option>-a</option> option, which turns all applied "
|
dongsheng@714
|
16452 "patches into regular changesets."
|
dongsheng@714
|
16453 msgstr ""
|
dongsheng@714
|
16454
|
dongsheng@714
|
16455 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16456 #: ../en/ch12-mq.xml:782
|
dongsheng@714
|
16457 msgid ""
|
dongsheng@714
|
16458 "It is also possible to turn an existing changeset into a patch, by passing "
|
dongsheng@714
|
16459 "the <option>-r</option> option to <command role=\"hg-ext-mq\">hg qimport</"
|
dongsheng@714
|
16460 "command>."
|
dongsheng@714
|
16461 msgstr ""
|
dongsheng@714
|
16462
|
dongsheng@714
|
16463 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16464 #: ../en/ch12-mq.xml:788
|
dongsheng@714
|
16465 msgid ""
|
dongsheng@714
|
16466 "Note that it only makes sense to convert a changeset into a patch if you have "
|
dongsheng@714
|
16467 "not propagated that changeset into any other repositories. The imported "
|
dongsheng@714
|
16468 "changeset's ID will change every time you refresh the patch, which will make "
|
dongsheng@714
|
16469 "Mercurial treat it as unrelated to the original changeset if you have pushed "
|
dongsheng@714
|
16470 "it somewhere else."
|
dongsheng@714
|
16471 msgstr ""
|
dongsheng@714
|
16472
|
dongsheng@714
|
16473 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
16474 #: ../en/ch12-mq.xml:798
|
dongsheng@627
|
16475 msgid "Getting the best performance out of MQ"
|
dongsheng@636
|
16476 msgstr "MQ 的性能"
|
dongsheng@627
|
16477
|
dongsheng@627
|
16478 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16479 #: ../en/ch12-mq.xml:800
|
dongsheng@714
|
16480 msgid ""
|
dongsheng@714
|
16481 "MQ is very efficient at handling a large number of patches. I ran some "
|
dongsheng@627
|
16482 "performance experiments in mid-2006 for a talk that I gave at the 2006 "
|
dongsheng@714
|
16483 "EuroPython conference (on modern hardware, you should expect better "
|
dongsheng@714
|
16484 "performance than you'll see below). I used as my data set the Linux 2.6.17-"
|
dongsheng@714
|
16485 "mm1 patch series, which consists of 1,738 patches. I applied these on top of "
|
dongsheng@714
|
16486 "a Linux kernel repository containing all 27,472 revisions between Linux "
|
dongsheng@714
|
16487 "2.6.12-rc2 and Linux 2.6.17."
|
dongsheng@714
|
16488 msgstr ""
|
dongsheng@714
|
16489
|
dongsheng@714
|
16490 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16491 #: ../en/ch12-mq.xml:809
|
dongsheng@627
|
16492 msgid ""
|
dongsheng@627
|
16493 "On my old, slow laptop, I was able to <command role=\"hg-cmd\">hg qpush "
|
dongsheng@1034
|
16494 "<option role=\"hg-ext-mq-cmd-qpush-opt\">-a</option></command> all 1,738 "
|
dongsheng@627
|
16495 "patches in 3.5 minutes, and <command role=\"hg-cmd\">hg qpop <option role="
|
dongsheng@1034
|
16496 "\"hg-ext-mq-cmd-qpop-opt\">-a</option></command> them all in 30 seconds. (On "
|
dongsheng@1034
|
16497 "a newer laptop, the time to push all patches dropped to two minutes.) I "
|
dongsheng@627
|
16498 "could <command role=\"hg-ext-mq\">qrefresh</command> one of the biggest "
|
dongsheng@627
|
16499 "patches (which made 22,779 lines of changes to 287 files) in 6.6 seconds."
|
dongsheng@627
|
16500 msgstr ""
|
dongsheng@627
|
16501
|
dongsheng@627
|
16502 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16503 #: ../en/ch12-mq.xml:820
|
dongsheng@627
|
16504 msgid ""
|
dongsheng@627
|
16505 "Clearly, MQ is well suited to working in large trees, but there are a few "
|
dongsheng@627
|
16506 "tricks you can use to get the best performance of it."
|
dongsheng@627
|
16507 msgstr ""
|
dongsheng@627
|
16508
|
dongsheng@627
|
16509 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16510 #: ../en/ch12-mq.xml:824
|
dongsheng@627
|
16511 msgid ""
|
dongsheng@627
|
16512 "First of all, try to <quote>batch</quote> operations together. Every time "
|
dongsheng@627
|
16513 "you run <command role=\"hg-ext-mq\">qpush</command> or <command role=\"hg-ext-"
|
dongsheng@627
|
16514 "mq\">qpop</command>, these commands scan the working directory once to make "
|
dongsheng@627
|
16515 "sure you haven't made some changes and then forgotten to run <command role="
|
dongsheng@627
|
16516 "\"hg-ext-mq\">qrefresh</command>. On a small tree, the time that this scan "
|
dongsheng@627
|
16517 "takes is unnoticeable. However, on a medium-sized tree (containing tens of "
|
dongsheng@627
|
16518 "thousands of files), it can take a second or more."
|
dongsheng@627
|
16519 msgstr ""
|
dongsheng@627
|
16520
|
dongsheng@627
|
16521 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16522 #: ../en/ch12-mq.xml:835
|
dongsheng@627
|
16523 msgid ""
|
dongsheng@627
|
16524 "The <command role=\"hg-ext-mq\">qpush</command> and <command role=\"hg-ext-mq"
|
dongsheng@627
|
16525 "\">qpop</command> commands allow you to push and pop multiple patches at a "
|
dongsheng@627
|
16526 "time. You can identify the <quote>destination patch</quote> that you want to "
|
dongsheng@627
|
16527 "end up at. When you <command role=\"hg-ext-mq\">qpush</command> with a "
|
dongsheng@627
|
16528 "destination specified, it will push patches until that patch is at the top of "
|
dongsheng@627
|
16529 "the applied stack. When you <command role=\"hg-ext-mq\">qpop</command> to a "
|
dongsheng@627
|
16530 "destination, MQ will pop patches until the destination patch is at the top."
|
dongsheng@627
|
16531 msgstr ""
|
dongsheng@627
|
16532
|
dongsheng@627
|
16533 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16534 #: ../en/ch12-mq.xml:845
|
dongsheng@627
|
16535 msgid ""
|
dongsheng@627
|
16536 "You can identify a destination patch using either the name of the patch, or "
|
dongsheng@627
|
16537 "by number. If you use numeric addressing, patches are counted from zero; "
|
dongsheng@627
|
16538 "this means that the first patch is zero, the second is one, and so on."
|
dongsheng@627
|
16539 msgstr ""
|
dongsheng@627
|
16540
|
dongsheng@627
|
16541 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
16542 #: ../en/ch12-mq.xml:852
|
dongsheng@627
|
16543 msgid "Updating your patches when the underlying code changes"
|
dongsheng@636
|
16544 msgstr "当基础代码改变时,更新补丁的方法"
|
dongsheng@627
|
16545
|
dongsheng@627
|
16546 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16547 #: ../en/ch12-mq.xml:855
|
dongsheng@627
|
16548 msgid ""
|
dongsheng@627
|
16549 "It's common to have a stack of patches on top of an underlying repository "
|
dongsheng@627
|
16550 "that you don't modify directly. If you're working on changes to third-party "
|
dongsheng@627
|
16551 "code, or on a feature that is taking longer to develop than the rate of "
|
dongsheng@627
|
16552 "change of the code beneath, you will often need to sync up with the "
|
dongsheng@627
|
16553 "underlying code, and fix up any hunks in your patches that no longer apply. "
|
dongsheng@627
|
16554 "This is called <emphasis>rebasing</emphasis> your patch series."
|
dongsheng@627
|
16555 msgstr ""
|
dongsheng@627
|
16556
|
dongsheng@627
|
16557 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16558 #: ../en/ch12-mq.xml:864
|
dongsheng@627
|
16559 msgid ""
|
dongsheng@627
|
16560 "The simplest way to do this is to <command role=\"hg-cmd\">hg qpop <option "
|
dongsheng@627
|
16561 "role=\"hg-ext-mq-cmd-qpop-opt\">hg -a</option></command> your patches, then "
|
dongsheng@627
|
16562 "<command role=\"hg-cmd\">hg pull</command> changes into the underlying "
|
dongsheng@627
|
16563 "repository, and finally <command role=\"hg-cmd\">hg qpush <option role=\"hg-"
|
dongsheng@1034
|
16564 "ext-mq-cmd-qpop-opt\">-a</option></command> your patches again. MQ will stop "
|
dongsheng@1034
|
16565 "pushing any time it runs across a patch that fails to apply during conflicts, "
|
dongsheng@1034
|
16566 "allowing you to fix your conflicts, <command role=\"hg-ext-mq\">qrefresh</"
|
dongsheng@1034
|
16567 "command> the affected patch, and continue pushing until you have fixed your "
|
dongsheng@1034
|
16568 "entire stack."
|
dongsheng@627
|
16569 msgstr ""
|
dongsheng@627
|
16570
|
dongsheng@627
|
16571 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16572 #: ../en/ch12-mq.xml:876
|
dongsheng@627
|
16573 msgid ""
|
dongsheng@627
|
16574 "This approach is easy to use and works well if you don't expect changes to "
|
dongsheng@627
|
16575 "the underlying code to affect how well your patches apply. If your patch "
|
dongsheng@627
|
16576 "stack touches code that is modified frequently or invasively in the "
|
dongsheng@627
|
16577 "underlying repository, however, fixing up rejected hunks by hand quickly "
|
dongsheng@627
|
16578 "becomes tiresome."
|
dongsheng@627
|
16579 msgstr ""
|
dongsheng@627
|
16580
|
dongsheng@627
|
16581 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16582 #: ../en/ch12-mq.xml:883
|
dongsheng@627
|
16583 msgid ""
|
dongsheng@627
|
16584 "It's possible to partially automate the rebasing process. If your patches "
|
dongsheng@627
|
16585 "apply cleanly against some revision of the underlying repo, MQ can use this "
|
dongsheng@627
|
16586 "information to help you to resolve conflicts between your patches and a "
|
dongsheng@627
|
16587 "different revision."
|
dongsheng@627
|
16588 msgstr ""
|
dongsheng@627
|
16589
|
dongsheng@627
|
16590 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16591 #: ../en/ch12-mq.xml:889
|
songdongsheng@658
|
16592 msgid "The process is a little involved."
|
songdongsheng@658
|
16593 msgstr ""
|
songdongsheng@658
|
16594
|
songdongsheng@658
|
16595 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@714
|
16596 #: ../en/ch12-mq.xml:891
|
dongsheng@627
|
16597 msgid ""
|
dongsheng@627
|
16598 "To begin, <command role=\"hg-cmd\">hg qpush -a</command> all of your patches "
|
dongsheng@627
|
16599 "on top of the revision where you know that they apply cleanly."
|
dongsheng@627
|
16600 msgstr ""
|
dongsheng@627
|
16601
|
dongsheng@627
|
16602 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@714
|
16603 #: ../en/ch12-mq.xml:895
|
dongsheng@627
|
16604 msgid ""
|
dongsheng@627
|
16605 "Save a backup copy of your patch directory using <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
16606 "qsave <option role=\"hg-ext-mq-cmd-qsave-opt\">hg -e</option> <option role="
|
dongsheng@627
|
16607 "\"hg-ext-mq-cmd-qsave-opt\">hg -c</option></command>. This prints the name "
|
dongsheng@627
|
16608 "of the directory that it has saved the patches in. It will save the patches "
|
dongsheng@627
|
16609 "to a directory called <filename role=\"special\" class=\"directory\">.hg/"
|
dongsheng@627
|
16610 "patches.N</filename>, where <literal>N</literal> is a small integer. It also "
|
dongsheng@627
|
16611 "commits a <quote>save changeset</quote> on top of your applied patches; this "
|
dongsheng@627
|
16612 "is for internal book-keeping, and records the states of the <filename role="
|
dongsheng@627
|
16613 "\"special\">series</filename> and <filename role=\"special\">status</"
|
dongsheng@627
|
16614 "filename> files."
|
dongsheng@627
|
16615 msgstr ""
|
dongsheng@627
|
16616
|
dongsheng@627
|
16617 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@714
|
16618 #: ../en/ch12-mq.xml:909
|
dongsheng@627
|
16619 msgid ""
|
dongsheng@627
|
16620 "Use <command role=\"hg-cmd\">hg pull</command> to bring new changes into the "
|
dongsheng@627
|
16621 "underlying repository. (Don't run <command role=\"hg-cmd\">hg pull -u</"
|
dongsheng@627
|
16622 "command>; see below for why.)"
|
dongsheng@627
|
16623 msgstr ""
|
dongsheng@627
|
16624
|
dongsheng@627
|
16625 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@714
|
16626 #: ../en/ch12-mq.xml:914
|
dongsheng@627
|
16627 msgid ""
|
dongsheng@627
|
16628 "Update to the new tip revision, using <command role=\"hg-cmd\">hg update "
|
dongsheng@627
|
16629 "<option role=\"hg-opt-update\">-C</option></command> to override the patches "
|
dongsheng@627
|
16630 "you have pushed."
|
dongsheng@627
|
16631 msgstr ""
|
dongsheng@627
|
16632
|
dongsheng@627
|
16633 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@714
|
16634 #: ../en/ch12-mq.xml:919
|
dongsheng@650
|
16635 msgid ""
|
dongsheng@650
|
16636 "Merge all patches using <command>hg qpush -m -a</command>. The <option role="
|
dongsheng@650
|
16637 "\"hg-ext-mq-cmd-qpush-opt\">-m</option> option to <command role=\"hg-ext-mq"
|
dongsheng@650
|
16638 "\">qpush</command> tells MQ to perform a three-way merge if the patch fails "
|
dongsheng@650
|
16639 "to apply."
|
dongsheng@650
|
16640 msgstr ""
|
dongsheng@650
|
16641
|
dongsheng@650
|
16642 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16643 #: ../en/ch12-mq.xml:927
|
dongsheng@627
|
16644 msgid ""
|
dongsheng@627
|
16645 "During the <command role=\"hg-cmd\">hg qpush <option role=\"hg-ext-mq-cmd-"
|
dongsheng@627
|
16646 "qpush-opt\">hg -m</option></command>, each patch in the <filename role="
|
dongsheng@627
|
16647 "\"special\">series</filename> file is applied normally. If a patch applies "
|
dongsheng@627
|
16648 "with fuzz or rejects, MQ looks at the queue you <command role=\"hg-ext-mq"
|
dongsheng@627
|
16649 "\">qsave</command>d, and performs a three-way merge with the corresponding "
|
dongsheng@627
|
16650 "changeset. This merge uses Mercurial's normal merge machinery, so it may pop "
|
dongsheng@627
|
16651 "up a GUI merge tool to help you to resolve problems."
|
dongsheng@627
|
16652 msgstr ""
|
dongsheng@627
|
16653
|
dongsheng@627
|
16654 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16655 #: ../en/ch12-mq.xml:937
|
dongsheng@627
|
16656 msgid ""
|
dongsheng@627
|
16657 "When you finish resolving the effects of a patch, MQ refreshes your patch "
|
dongsheng@627
|
16658 "based on the result of the merge."
|
dongsheng@627
|
16659 msgstr ""
|
dongsheng@627
|
16660
|
dongsheng@627
|
16661 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16662 #: ../en/ch12-mq.xml:940
|
dongsheng@627
|
16663 msgid ""
|
dongsheng@627
|
16664 "At the end of this process, your repository will have one extra head from the "
|
dongsheng@627
|
16665 "old patch queue, and a copy of the old patch queue will be in <filename role="
|
dongsheng@627
|
16666 "\"special\" class=\"directory\">.hg/patches.N</filename>. You can remove the "
|
dongsheng@627
|
16667 "extra head using <command role=\"hg-cmd\">hg qpop -a -n patches.N</command> "
|
dongsheng@627
|
16668 "or <command role=\"hg-cmd\">hg strip</command>. You can delete <filename "
|
dongsheng@627
|
16669 "role=\"special\" class=\"directory\">.hg/patches.N</filename> once you are "
|
dongsheng@627
|
16670 "sure that you no longer need it as a backup."
|
dongsheng@627
|
16671 msgstr ""
|
dongsheng@627
|
16672
|
dongsheng@627
|
16673 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
16674 #: ../en/ch12-mq.xml:952
|
dongsheng@627
|
16675 msgid "Identifying patches"
|
dongsheng@636
|
16676 msgstr "标识补丁"
|
dongsheng@627
|
16677
|
dongsheng@627
|
16678 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16679 #: ../en/ch12-mq.xml:954
|
dongsheng@627
|
16680 msgid ""
|
dongsheng@627
|
16681 "MQ commands that work with patches let you refer to a patch either by using "
|
dongsheng@627
|
16682 "its name or by a number. By name is obvious enough; pass the name "
|
dongsheng@627
|
16683 "<filename>foo.patch</filename> to <command role=\"hg-ext-mq\">qpush</"
|
dongsheng@627
|
16684 "command>, for example, and it will push patches until <filename>foo.patch</"
|
dongsheng@627
|
16685 "filename> is applied."
|
dongsheng@627
|
16686 msgstr ""
|
dongsheng@627
|
16687
|
dongsheng@627
|
16688 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16689 #: ../en/ch12-mq.xml:961
|
dongsheng@627
|
16690 msgid ""
|
dongsheng@627
|
16691 "As a shortcut, you can refer to a patch using both a name and a numeric "
|
dongsheng@627
|
16692 "offset; <literal>foo.patch-2</literal> means <quote>two patches before "
|
dongsheng@627
|
16693 "<literal>foo.patch</literal></quote>, while <literal>bar.patch+4</literal> "
|
dongsheng@627
|
16694 "means <quote>four patches after <literal>bar.patch</literal></quote>."
|
dongsheng@627
|
16695 msgstr ""
|
dongsheng@627
|
16696
|
dongsheng@627
|
16697 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16698 #: ../en/ch12-mq.xml:967
|
dongsheng@627
|
16699 msgid ""
|
dongsheng@627
|
16700 "Referring to a patch by index isn't much different. The first patch printed "
|
dongsheng@627
|
16701 "in the output of <command role=\"hg-ext-mq\">qseries</command> is patch zero "
|
dongsheng@627
|
16702 "(yes, it's one of those start-at-zero counting systems); the second is patch "
|
dongsheng@627
|
16703 "one; and so on."
|
dongsheng@627
|
16704 msgstr ""
|
dongsheng@627
|
16705
|
dongsheng@627
|
16706 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16707 #: ../en/ch12-mq.xml:973
|
dongsheng@627
|
16708 msgid ""
|
dongsheng@627
|
16709 "MQ also makes it easy to work with patches when you are using normal "
|
dongsheng@627
|
16710 "Mercurial commands. Every command that accepts a changeset ID will also "
|
dongsheng@627
|
16711 "accept the name of an applied patch. MQ augments the tags normally in the "
|
dongsheng@627
|
16712 "repository with an eponymous one for each applied patch. In addition, the "
|
dongsheng@650
|
16713 "special tags <literal role=\"tag\">qbase</literal> and <literal role=\"tag"
|
dongsheng@650
|
16714 "\">qtip</literal> identify the <quote>bottom-most</quote> and topmost applied "
|
dongsheng@650
|
16715 "patches, respectively."
|
dongsheng@650
|
16716 msgstr ""
|
dongsheng@650
|
16717
|
dongsheng@650
|
16718 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16719 #: ../en/ch12-mq.xml:983
|
dongsheng@627
|
16720 msgid ""
|
dongsheng@627
|
16721 "These additions to Mercurial's normal tagging capabilities make dealing with "
|
dongsheng@627
|
16722 "patches even more of a breeze."
|
dongsheng@627
|
16723 msgstr ""
|
dongsheng@627
|
16724
|
dongsheng@627
|
16725 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
16726 #: ../en/ch12-mq.xml:986
|
dongsheng@627
|
16727 msgid "Want to patchbomb a mailing list with your latest series of changes?"
|
dongsheng@627
|
16728 msgstr ""
|
dongsheng@627
|
16729
|
dongsheng@627
|
16730 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
16731 #: ../en/ch12-mq.xml:989
|
songdongsheng@658
|
16732 msgid ""
|
songdongsheng@658
|
16733 "(Don't know what <quote>patchbombing</quote> is? See <xref linkend=\"sec:"
|
songdongsheng@658
|
16734 "hgext:patchbomb\"/>.)"
|
dongsheng@627
|
16735 msgstr ""
|
dongsheng@627
|
16736
|
dongsheng@627
|
16737 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
16738 #: ../en/ch12-mq.xml:992
|
dongsheng@627
|
16739 msgid ""
|
dongsheng@627
|
16740 "Need to see all of the patches since <literal>foo.patch</literal> that have "
|
dongsheng@627
|
16741 "touched files in a subdirectory of your tree?"
|
dongsheng@627
|
16742 msgstr ""
|
dongsheng@627
|
16743
|
dongsheng@650
|
16744 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16745 #: ../en/ch12-mq.xml:999
|
dongsheng@627
|
16746 msgid ""
|
dongsheng@627
|
16747 "Because MQ makes the names of patches available to the rest of Mercurial "
|
dongsheng@627
|
16748 "through its normal internal tag machinery, you don't need to type in the "
|
dongsheng@627
|
16749 "entire name of a patch when you want to identify it by name."
|
dongsheng@627
|
16750 msgstr ""
|
dongsheng@627
|
16751
|
dongsheng@627
|
16752 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16753 #: ../en/ch12-mq.xml:1004
|
dongsheng@627
|
16754 msgid ""
|
dongsheng@627
|
16755 "Another nice consequence of representing patch names as tags is that when you "
|
dongsheng@627
|
16756 "run the <command role=\"hg-cmd\">hg log</command> command, it will display a "
|
dongsheng@627
|
16757 "patch's name as a tag, simply as part of its normal output. This makes it "
|
dongsheng@627
|
16758 "easy to visually distinguish applied patches from underlying <quote>normal</"
|
dongsheng@627
|
16759 "quote> revisions. The following example shows a few normal Mercurial "
|
dongsheng@627
|
16760 "commands in use with applied patches."
|
dongsheng@627
|
16761 msgstr ""
|
dongsheng@627
|
16762
|
dongsheng@627
|
16763 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
16764 #: ../en/ch12-mq.xml:1017
|
dongsheng@627
|
16765 msgid "Useful things to know about"
|
dongsheng@636
|
16766 msgstr "其它需要了解的东西"
|
dongsheng@627
|
16767
|
dongsheng@627
|
16768 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16769 #: ../en/ch12-mq.xml:1019
|
dongsheng@627
|
16770 msgid ""
|
dongsheng@627
|
16771 "There are a number of aspects of MQ usage that don't fit tidily into sections "
|
dongsheng@627
|
16772 "of their own, but that are good to know. Here they are, in one place."
|
dongsheng@627
|
16773 msgstr ""
|
dongsheng@627
|
16774
|
dongsheng@627
|
16775 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
16776 #: ../en/ch12-mq.xml:1024
|
dongsheng@627
|
16777 msgid ""
|
dongsheng@627
|
16778 "Normally, when you <command role=\"hg-ext-mq\">qpop</command> a patch and "
|
dongsheng@627
|
16779 "<command role=\"hg-ext-mq\">qpush</command> it again, the changeset that "
|
dongsheng@627
|
16780 "represents the patch after the pop/push will have a <emphasis>different "
|
dongsheng@627
|
16781 "identity</emphasis> than the changeset that represented the hash beforehand. "
|
songdongsheng@658
|
16782 "See <xref linkend=\"sec:mqref:cmd:qpush\"/> for information as to why this is."
|
dongsheng@627
|
16783 msgstr ""
|
dongsheng@627
|
16784
|
dongsheng@627
|
16785 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
16786 #: ../en/ch12-mq.xml:1033
|
dongsheng@627
|
16787 msgid ""
|
dongsheng@627
|
16788 "It's not a good idea to <command role=\"hg-cmd\">hg merge</command> changes "
|
dongsheng@627
|
16789 "from another branch with a patch changeset, at least if you want to maintain "
|
dongsheng@627
|
16790 "the <quote>patchiness</quote> of that changeset and changesets below it on "
|
dongsheng@627
|
16791 "the patch stack. If you try to do this, it will appear to succeed, but MQ "
|
dongsheng@627
|
16792 "will become confused."
|
dongsheng@627
|
16793 msgstr ""
|
dongsheng@627
|
16794
|
dongsheng@627
|
16795 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
16796 #: ../en/ch12-mq.xml:1044
|
dongsheng@627
|
16797 msgid "Managing patches in a repository"
|
dongsheng@636
|
16798 msgstr "在版本库管理补丁"
|
dongsheng@627
|
16799
|
dongsheng@627
|
16800 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16801 #: ../en/ch12-mq.xml:1046
|
dongsheng@627
|
16802 msgid ""
|
dongsheng@627
|
16803 "Because MQ's <filename role=\"special\" class=\"directory\">.hg/patches</"
|
dongsheng@627
|
16804 "filename> directory resides outside a Mercurial repository's working "
|
dongsheng@627
|
16805 "directory, the <quote>underlying</quote> Mercurial repository knows nothing "
|
dongsheng@627
|
16806 "about the management or presence of patches."
|
dongsheng@627
|
16807 msgstr ""
|
dongsheng@627
|
16808
|
dongsheng@627
|
16809 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16810 #: ../en/ch12-mq.xml:1052
|
dongsheng@627
|
16811 msgid ""
|
dongsheng@627
|
16812 "This presents the interesting possibility of managing the contents of the "
|
dongsheng@627
|
16813 "patch directory as a Mercurial repository in its own right. This can be a "
|
dongsheng@627
|
16814 "useful way to work. For example, you can work on a patch for a while, "
|
dongsheng@627
|
16815 "<command role=\"hg-ext-mq\">qrefresh</command> it, then <command role=\"hg-cmd"
|
dongsheng@627
|
16816 "\">hg commit</command> the current state of the patch. This lets you "
|
dongsheng@627
|
16817 "<quote>roll back</quote> to that version of the patch later on."
|
dongsheng@627
|
16818 msgstr ""
|
dongsheng@627
|
16819
|
dongsheng@627
|
16820 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16821 #: ../en/ch12-mq.xml:1061
|
dongsheng@627
|
16822 msgid ""
|
dongsheng@627
|
16823 "You can then share different versions of the same patch stack among multiple "
|
dongsheng@627
|
16824 "underlying repositories. I use this when I am developing a Linux kernel "
|
dongsheng@627
|
16825 "feature. I have a pristine copy of my kernel sources for each of several CPU "
|
dongsheng@627
|
16826 "architectures, and a cloned repository under each that contains the patches I "
|
dongsheng@627
|
16827 "am working on. When I want to test a change on a different architecture, I "
|
dongsheng@627
|
16828 "push my current patches to the patch repository associated with that kernel "
|
dongsheng@627
|
16829 "tree, pop and push all of my patches, and build and test that kernel."
|
dongsheng@627
|
16830 msgstr ""
|
dongsheng@627
|
16831
|
dongsheng@627
|
16832 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16833 #: ../en/ch12-mq.xml:1071
|
dongsheng@627
|
16834 msgid ""
|
dongsheng@627
|
16835 "Managing patches in a repository makes it possible for multiple developers to "
|
dongsheng@627
|
16836 "work on the same patch series without colliding with each other, all on top "
|
dongsheng@627
|
16837 "of an underlying source base that they may or may not control."
|
dongsheng@627
|
16838 msgstr ""
|
dongsheng@627
|
16839
|
dongsheng@627
|
16840 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
16841 #: ../en/ch12-mq.xml:1077
|
dongsheng@627
|
16842 msgid "MQ support for patch repositories"
|
dongsheng@636
|
16843 msgstr "MQ 支持补丁版本库"
|
dongsheng@627
|
16844
|
dongsheng@627
|
16845 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16846 #: ../en/ch12-mq.xml:1079
|
dongsheng@627
|
16847 msgid ""
|
dongsheng@627
|
16848 "MQ helps you to work with the <filename role=\"special\" class=\"directory\">."
|
dongsheng@627
|
16849 "hg/patches</filename> directory as a repository; when you prepare a "
|
dongsheng@627
|
16850 "repository for working with patches using <command role=\"hg-ext-mq\">qinit</"
|
dongsheng@627
|
16851 "command>, you can pass the <option role=\"hg-ext-mq-cmd-qinit-opt\">hg -c</"
|
dongsheng@627
|
16852 "option> option to create the <filename role=\"special\" class=\"directory\">."
|
dongsheng@627
|
16853 "hg/patches</filename> directory as a Mercurial repository."
|
dongsheng@627
|
16854 msgstr ""
|
dongsheng@627
|
16855
|
dongsheng@627
|
16856 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@714
|
16857 #: ../en/ch12-mq.xml:1089
|
dongsheng@627
|
16858 msgid ""
|
dongsheng@627
|
16859 "If you forget to use the <option role=\"hg-ext-mq-cmd-qinit-opt\">hg -c</"
|
dongsheng@627
|
16860 "option> option, you can simply go into the <filename role=\"special\" class="
|
dongsheng@627
|
16861 "\"directory\">.hg/patches</filename> directory at any time and run <command "
|
dongsheng@627
|
16862 "role=\"hg-cmd\">hg init</command>. Don't forget to add an entry for the "
|
dongsheng@627
|
16863 "<filename role=\"special\">status</filename> file to the <filename role="
|
dongsheng@627
|
16864 "\"special\">.hgignore</filename> file, though"
|
dongsheng@627
|
16865 msgstr ""
|
dongsheng@627
|
16866
|
dongsheng@627
|
16867 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@714
|
16868 #: ../en/ch12-mq.xml:1098
|
dongsheng@627
|
16869 msgid ""
|
dongsheng@627
|
16870 "(<command role=\"hg-cmd\">hg qinit <option role=\"hg-ext-mq-cmd-qinit-opt"
|
dongsheng@627
|
16871 "\">hg -c</option></command> does this for you automatically); you "
|
dongsheng@627
|
16872 "<emphasis>really</emphasis> don't want to manage the <filename role=\"special"
|
dongsheng@627
|
16873 "\">status</filename> file."
|
dongsheng@627
|
16874 msgstr ""
|
dongsheng@627
|
16875
|
dongsheng@627
|
16876 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16877 #: ../en/ch12-mq.xml:1105
|
dongsheng@627
|
16878 msgid ""
|
dongsheng@627
|
16879 "As a convenience, if MQ notices that the <filename class=\"directory\">.hg/"
|
dongsheng@627
|
16880 "patches</filename> directory is a repository, it will automatically <command "
|
dongsheng@627
|
16881 "role=\"hg-cmd\">hg add</command> every patch that you create and import."
|
dongsheng@627
|
16882 msgstr ""
|
dongsheng@627
|
16883
|
dongsheng@627
|
16884 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16885 #: ../en/ch12-mq.xml:1110
|
dongsheng@627
|
16886 msgid ""
|
dongsheng@627
|
16887 "MQ provides a shortcut command, <command role=\"hg-ext-mq\">qcommit</"
|
dongsheng@627
|
16888 "command>, that runs <command role=\"hg-cmd\">hg commit</command> in the "
|
dongsheng@627
|
16889 "<filename role=\"special\" class=\"directory\">.hg/patches</filename> "
|
dongsheng@627
|
16890 "directory. This saves some bothersome typing."
|
dongsheng@627
|
16891 msgstr ""
|
dongsheng@627
|
16892
|
dongsheng@627
|
16893 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16894 #: ../en/ch12-mq.xml:1116
|
dongsheng@627
|
16895 msgid ""
|
dongsheng@627
|
16896 "Finally, as a convenience to manage the patch directory, you can define the "
|
dongsheng@627
|
16897 "alias <command>mq</command> on Unix systems. For example, on Linux systems "
|
dongsheng@627
|
16898 "using the <command>bash</command> shell, you can include the following "
|
dongsheng@627
|
16899 "snippet in your <filename role=\"home\">~/.bashrc</filename>."
|
dongsheng@627
|
16900 msgstr ""
|
dongsheng@627
|
16901
|
dongsheng@627
|
16902 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16903 #: ../en/ch12-mq.xml:1125
|
dongsheng@627
|
16904 msgid ""
|
dongsheng@627
|
16905 "You can then issue commands of the form <command>mq pull</command> from the "
|
dongsheng@627
|
16906 "main repository."
|
dongsheng@627
|
16907 msgstr ""
|
dongsheng@627
|
16908
|
dongsheng@627
|
16909 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
16910 #: ../en/ch12-mq.xml:1130
|
dongsheng@627
|
16911 msgid "A few things to watch out for"
|
dongsheng@636
|
16912 msgstr "需要注意的事情"
|
dongsheng@627
|
16913
|
dongsheng@627
|
16914 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16915 #: ../en/ch12-mq.xml:1132
|
dongsheng@627
|
16916 msgid ""
|
dongsheng@627
|
16917 "MQ's support for working with a repository full of patches is limited in a "
|
dongsheng@627
|
16918 "few small respects."
|
dongsheng@627
|
16919 msgstr ""
|
dongsheng@627
|
16920
|
dongsheng@627
|
16921 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
16922 #: ../en/ch12-mq.xml:1135
|
dongsheng@627
|
16923 msgid ""
|
dongsheng@627
|
16924 "MQ cannot automatically detect changes that you make to the patch directory. "
|
dongsheng@627
|
16925 "If you <command role=\"hg-cmd\">hg pull</command>, manually edit, or <command "
|
dongsheng@627
|
16926 "role=\"hg-cmd\">hg update</command> changes to patches or the <filename role="
|
dongsheng@627
|
16927 "\"special\">series</filename> file, you will have to <command role=\"hg-cmd"
|
dongsheng@1034
|
16928 "\">hg qpop <option role=\"hg-ext-mq-cmd-qpop-opt\">-a</option></command> and "
|
dongsheng@1034
|
16929 "then <command role=\"hg-cmd\">hg qpush <option role=\"hg-ext-mq-cmd-qpush-opt"
|
dongsheng@1034
|
16930 "\">-a</option></command> in the underlying repository to see those changes "
|
dongsheng@1034
|
16931 "show up there. If you forget to do this, you can confuse MQ's idea of which "
|
dongsheng@1034
|
16932 "patches are applied."
|
dongsheng@627
|
16933 msgstr ""
|
dongsheng@627
|
16934
|
dongsheng@627
|
16935 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
16936 #: ../en/ch12-mq.xml:1151
|
dongsheng@627
|
16937 msgid "Third party tools for working with patches"
|
dongsheng@636
|
16938 msgstr "操作补丁的第三方工具"
|
dongsheng@627
|
16939
|
dongsheng@627
|
16940 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16941 #: ../en/ch12-mq.xml:1153
|
dongsheng@627
|
16942 msgid ""
|
dongsheng@627
|
16943 "Once you've been working with patches for a while, you'll find yourself "
|
dongsheng@627
|
16944 "hungry for tools that will help you to understand and manipulate the patches "
|
dongsheng@627
|
16945 "you're dealing with."
|
dongsheng@627
|
16946 msgstr ""
|
dongsheng@627
|
16947
|
dongsheng@627
|
16948 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16949 #: ../en/ch12-mq.xml:1157
|
dongsheng@627
|
16950 msgid ""
|
dongsheng@627
|
16951 "The <command>diffstat</command> command <citation>web:diffstat</citation> "
|
dongsheng@627
|
16952 "generates a histogram of the modifications made to each file in a patch. It "
|
songdongsheng@668
|
16953 "provides a good way to <quote>get a sense of</quote> a patch&emdash;which "
|
songdongsheng@668
|
16954 "files it affects, and how much change it introduces to each file and as a "
|
songdongsheng@668
|
16955 "whole. (I find that it's a good idea to use <command>diffstat</command>'s "
|
songdongsheng@668
|
16956 "<option role=\"cmd-opt-diffstat\">-p</option> option as a matter of course, "
|
songdongsheng@668
|
16957 "as otherwise it will try to do clever things with prefixes of file names that "
|
songdongsheng@668
|
16958 "inevitably confuse at least me.)"
|
dongsheng@627
|
16959 msgstr ""
|
dongsheng@627
|
16960
|
dongsheng@627
|
16961 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16962 #: ../en/ch12-mq.xml:1171
|
dongsheng@627
|
16963 msgid ""
|
dongsheng@627
|
16964 "The <literal role=\"package\">patchutils</literal> package <citation>web:"
|
dongsheng@627
|
16965 "patchutils</citation> is invaluable. It provides a set of small utilities "
|
dongsheng@627
|
16966 "that follow the <quote>Unix philosophy;</quote> each does one useful thing "
|
dongsheng@627
|
16967 "with a patch. The <literal role=\"package\">patchutils</literal> command I "
|
dongsheng@627
|
16968 "use most is <command>filterdiff</command>, which extracts subsets from a "
|
dongsheng@627
|
16969 "patch file. For example, given a patch that modifies hundreds of files "
|
dongsheng@627
|
16970 "across dozens of directories, a single invocation of <command>filterdiff</"
|
dongsheng@627
|
16971 "command> can generate a smaller patch that only touches files whose names "
|
songdongsheng@658
|
16972 "match a particular glob pattern. See <xref linkend=\"mq-collab:tips:interdiff"
|
songdongsheng@658
|
16973 "\"/> for another example."
|
dongsheng@627
|
16974 msgstr ""
|
dongsheng@627
|
16975
|
dongsheng@627
|
16976 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
16977 #: ../en/ch12-mq.xml:1187
|
dongsheng@627
|
16978 msgid "Good ways to work with patches"
|
dongsheng@636
|
16979 msgstr "操作补丁的好习惯"
|
dongsheng@627
|
16980
|
dongsheng@627
|
16981 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16982 #: ../en/ch12-mq.xml:1189
|
dongsheng@627
|
16983 msgid ""
|
dongsheng@627
|
16984 "Whether you are working on a patch series to submit to a free software or "
|
dongsheng@627
|
16985 "open source project, or a series that you intend to treat as a sequence of "
|
dongsheng@627
|
16986 "regular changesets when you're done, you can use some simple techniques to "
|
songdongsheng@710
|
16987 "keep your work well organized."
|
dongsheng@627
|
16988 msgstr ""
|
dongsheng@627
|
16989
|
dongsheng@627
|
16990 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
16991 #: ../en/ch12-mq.xml:1195
|
dongsheng@627
|
16992 msgid ""
|
dongsheng@627
|
16993 "Give your patches descriptive names. A good name for a patch might be "
|
dongsheng@627
|
16994 "<filename>rework-device-alloc.patch</filename>, because it will immediately "
|
dongsheng@627
|
16995 "give you a hint what the purpose of the patch is. Long names shouldn't be a "
|
dongsheng@627
|
16996 "problem; you won't be typing the names often, but you <emphasis>will</"
|
dongsheng@627
|
16997 "emphasis> be running commands like <command role=\"hg-ext-mq\">qapplied</"
|
dongsheng@627
|
16998 "command> and <command role=\"hg-ext-mq\">qtop</command> over and over. Good "
|
dongsheng@627
|
16999 "naming becomes especially important when you have a number of patches to work "
|
dongsheng@627
|
17000 "with, or if you are juggling a number of different tasks and your patches "
|
dongsheng@627
|
17001 "only get a fraction of your attention."
|
dongsheng@627
|
17002 msgstr ""
|
dongsheng@627
|
17003
|
dongsheng@627
|
17004 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17005 #: ../en/ch12-mq.xml:1207
|
dongsheng@627
|
17006 msgid ""
|
dongsheng@627
|
17007 "Be aware of what patch you're working on. Use the <command role=\"hg-ext-mq"
|
songdongsheng@668
|
17008 "\">qtop</command> command and skim over the text of your patches "
|
songdongsheng@668
|
17009 "frequently&emdash;for example, using <command role=\"hg-cmd\">hg tip <option "
|
songdongsheng@668
|
17010 "role=\"hg-opt-tip\">-p</option></command>)&emdash;to be sure of where you "
|
songdongsheng@668
|
17011 "stand. I have several times worked on and <command role=\"hg-ext-mq"
|
songdongsheng@668
|
17012 "\">qrefresh</command>ed a patch other than the one I intended, and it's often "
|
songdongsheng@668
|
17013 "tricky to migrate changes into the right patch after making them in the wrong "
|
songdongsheng@668
|
17014 "one."
|
dongsheng@627
|
17015 msgstr ""
|
dongsheng@627
|
17016
|
dongsheng@627
|
17017 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17018 #: ../en/ch12-mq.xml:1217
|
dongsheng@627
|
17019 msgid ""
|
dongsheng@627
|
17020 "For this reason, it is very much worth investing a little time to learn how "
|
songdongsheng@658
|
17021 "to use some of the third-party tools I described in <xref linkend=\"sec:mq:"
|
songdongsheng@658
|
17022 "tools\"/>, particularly <command>diffstat</command> and <command>filterdiff</"
|
songdongsheng@658
|
17023 "command>. The former will give you a quick idea of what changes your patch "
|
songdongsheng@658
|
17024 "is making, while the latter makes it easy to splice hunks selectively out of "
|
songdongsheng@658
|
17025 "one patch and into another."
|
dongsheng@627
|
17026 msgstr ""
|
dongsheng@627
|
17027
|
dongsheng@627
|
17028 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
17029 #: ../en/ch12-mq.xml:1228
|
dongsheng@627
|
17030 msgid "MQ cookbook"
|
dongsheng@636
|
17031 msgstr "MQ 手册"
|
dongsheng@627
|
17032
|
dongsheng@627
|
17033 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
17034 #: ../en/ch12-mq.xml:1231
|
dongsheng@627
|
17035 msgid "Manage <quote>trivial</quote> patches"
|
dongsheng@636
|
17036 msgstr "管理<quote>琐碎的</quote>补丁"
|
dongsheng@627
|
17037
|
dongsheng@627
|
17038 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17039 #: ../en/ch12-mq.xml:1233
|
dongsheng@627
|
17040 msgid ""
|
dongsheng@627
|
17041 "Because the overhead of dropping files into a new Mercurial repository is so "
|
dongsheng@627
|
17042 "low, it makes a lot of sense to manage patches this way even if you simply "
|
dongsheng@627
|
17043 "want to make a few changes to a source tarball that you downloaded."
|
dongsheng@627
|
17044 msgstr ""
|
dongsheng@627
|
17045
|
dongsheng@627
|
17046 #
|
dongsheng@627
|
17047 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17048 #: ../en/ch12-mq.xml:1238
|
dongsheng@627
|
17049 msgid ""
|
dongsheng@627
|
17050 "Begin by downloading and unpacking the source tarball, and turning it into a "
|
dongsheng@627
|
17051 "Mercurial repository."
|
dongsheng@627
|
17052 msgstr ""
|
dongsheng@627
|
17053
|
dongsheng@627
|
17054 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17055 #: ../en/ch12-mq.xml:1243
|
dongsheng@627
|
17056 msgid "Continue by creating a patch stack and making your changes."
|
dongsheng@627
|
17057 msgstr ""
|
dongsheng@627
|
17058
|
dongsheng@627
|
17059 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17060 #: ../en/ch12-mq.xml:1248
|
dongsheng@627
|
17061 msgid ""
|
dongsheng@627
|
17062 "Let's say a few weeks or months pass, and your package author releases a new "
|
dongsheng@627
|
17063 "version. First, bring their changes into the repository."
|
dongsheng@627
|
17064 msgstr ""
|
dongsheng@627
|
17065
|
dongsheng@627
|
17066 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17067 #: ../en/ch12-mq.xml:1254
|
dongsheng@627
|
17068 msgid ""
|
dongsheng@627
|
17069 "The pipeline starting with <command role=\"hg-cmd\">hg locate</command> above "
|
dongsheng@627
|
17070 "deletes all files in the working directory, so that <command role=\"hg-cmd"
|
dongsheng@627
|
17071 "\">hg commit</command>'s <option role=\"hg-opt-commit\">--addremove</option> "
|
dongsheng@627
|
17072 "option can actually tell which files have really been removed in the newer "
|
dongsheng@627
|
17073 "version of the source."
|
dongsheng@627
|
17074 msgstr ""
|
dongsheng@627
|
17075
|
dongsheng@627
|
17076 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17077 #: ../en/ch12-mq.xml:1262
|
dongsheng@627
|
17078 msgid "Finally, you can apply your patches on top of the new tree."
|
dongsheng@627
|
17079 msgstr ""
|
dongsheng@627
|
17080
|
dongsheng@627
|
17081 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
17082 #: ../en/ch12-mq.xml:1269
|
dongsheng@627
|
17083 msgid "Combining entire patches"
|
dongsheng@636
|
17084 msgstr "组合全部的补丁"
|
dongsheng@627
|
17085
|
dongsheng@627
|
17086 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17087 #: ../en/ch12-mq.xml:1271
|
dongsheng@627
|
17088 msgid ""
|
dongsheng@627
|
17089 "MQ provides a command, <command role=\"hg-ext-mq\">qfold</command> that lets "
|
dongsheng@627
|
17090 "you combine entire patches. This <quote>folds</quote> the patches you name, "
|
dongsheng@627
|
17091 "in the order you name them, into the topmost applied patch, and concatenates "
|
dongsheng@627
|
17092 "their descriptions onto the end of its description. The patches that you "
|
dongsheng@627
|
17093 "fold must be unapplied before you fold them."
|
dongsheng@627
|
17094 msgstr ""
|
dongsheng@627
|
17095
|
dongsheng@627
|
17096 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17097 #: ../en/ch12-mq.xml:1279
|
dongsheng@627
|
17098 msgid ""
|
dongsheng@627
|
17099 "The order in which you fold patches matters. If your topmost applied patch "
|
dongsheng@627
|
17100 "is <literal>foo</literal>, and you <command role=\"hg-ext-mq\">qfold</"
|
dongsheng@627
|
17101 "command> <literal>bar</literal> and <literal>quux</literal> into it, you will "
|
dongsheng@627
|
17102 "end up with a patch that has the same effect as if you applied first "
|
dongsheng@627
|
17103 "<literal>foo</literal>, then <literal>bar</literal>, followed by "
|
dongsheng@627
|
17104 "<literal>quux</literal>."
|
dongsheng@627
|
17105 msgstr ""
|
dongsheng@627
|
17106
|
dongsheng@627
|
17107 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
17108 #: ../en/ch12-mq.xml:1290
|
dongsheng@627
|
17109 msgid "Merging part of one patch into another"
|
dongsheng@636
|
17110 msgstr "合并补丁的部分内容到其它补丁"
|
dongsheng@627
|
17111
|
dongsheng@627
|
17112 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17113 #: ../en/ch12-mq.xml:1292
|
dongsheng@627
|
17114 msgid ""
|
dongsheng@627
|
17115 "Merging <emphasis>part</emphasis> of one patch into another is more difficult "
|
dongsheng@627
|
17116 "than combining entire patches."
|
dongsheng@627
|
17117 msgstr ""
|
dongsheng@627
|
17118
|
dongsheng@627
|
17119 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17120 #: ../en/ch12-mq.xml:1296
|
dongsheng@627
|
17121 msgid ""
|
dongsheng@627
|
17122 "If you want to move changes to entire files, you can use <command>filterdiff</"
|
dongsheng@627
|
17123 "command>'s <option role=\"cmd-opt-filterdiff\">-i</option> and <option role="
|
dongsheng@627
|
17124 "\"cmd-opt-filterdiff\">-x</option> options to choose the modifications to "
|
dongsheng@627
|
17125 "snip out of one patch, concatenating its output onto the end of the patch you "
|
dongsheng@627
|
17126 "want to merge into. You usually won't need to modify the patch you've merged "
|
dongsheng@627
|
17127 "the changes from. Instead, MQ will report some rejected hunks when you "
|
dongsheng@627
|
17128 "<command role=\"hg-ext-mq\">qpush</command> it (from the hunks you moved into "
|
dongsheng@627
|
17129 "the other patch), and you can simply <command role=\"hg-ext-mq\">qrefresh</"
|
dongsheng@627
|
17130 "command> the patch to drop the duplicate hunks."
|
dongsheng@627
|
17131 msgstr ""
|
dongsheng@627
|
17132
|
dongsheng@627
|
17133 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17134 #: ../en/ch12-mq.xml:1309
|
dongsheng@627
|
17135 msgid ""
|
dongsheng@627
|
17136 "If you have a patch that has multiple hunks modifying a file, and you only "
|
dongsheng@627
|
17137 "want to move a few of those hunks, the job becomes more messy, but you can "
|
dongsheng@627
|
17138 "still partly automate it. Use <command>lsdiff -nvv</command> to print some "
|
dongsheng@627
|
17139 "metadata about the patch."
|
dongsheng@627
|
17140 msgstr ""
|
dongsheng@627
|
17141
|
dongsheng@627
|
17142 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17143 #: ../en/ch12-mq.xml:1317
|
dongsheng@627
|
17144 msgid "This command prints three different kinds of number:"
|
dongsheng@627
|
17145 msgstr ""
|
dongsheng@627
|
17146
|
dongsheng@627
|
17147 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
17148 #: ../en/ch12-mq.xml:1320
|
dongsheng@627
|
17149 msgid ""
|
dongsheng@627
|
17150 "(in the first column) a <emphasis>file number</emphasis> to identify each "
|
dongsheng@627
|
17151 "file modified in the patch;"
|
dongsheng@627
|
17152 msgstr ""
|
dongsheng@627
|
17153
|
dongsheng@627
|
17154 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
17155 #: ../en/ch12-mq.xml:1324
|
dongsheng@627
|
17156 msgid ""
|
dongsheng@627
|
17157 "(on the next line, indented) the line number within a modified file where a "
|
dongsheng@627
|
17158 "hunk starts; and"
|
dongsheng@627
|
17159 msgstr ""
|
dongsheng@627
|
17160
|
dongsheng@627
|
17161 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
17162 #: ../en/ch12-mq.xml:1327
|
dongsheng@627
|
17163 msgid ""
|
dongsheng@627
|
17164 "(on the same line) a <emphasis>hunk number</emphasis> to identify that hunk."
|
dongsheng@627
|
17165 msgstr ""
|
dongsheng@627
|
17166
|
dongsheng@627
|
17167 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17168 #: ../en/ch12-mq.xml:1331
|
dongsheng@627
|
17169 msgid ""
|
dongsheng@627
|
17170 "You'll have to use some visual inspection, and reading of the patch, to "
|
dongsheng@627
|
17171 "identify the file and hunk numbers you'll want, but you can then pass them to "
|
dongsheng@627
|
17172 "to <command>filterdiff</command>'s <option role=\"cmd-opt-filterdiff\">--"
|
dongsheng@627
|
17173 "files</option> and <option role=\"cmd-opt-filterdiff\">--hunks</option> "
|
dongsheng@627
|
17174 "options, to select exactly the file and hunk you want to extract."
|
dongsheng@627
|
17175 msgstr ""
|
dongsheng@627
|
17176
|
dongsheng@627
|
17177 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17178 #: ../en/ch12-mq.xml:1339
|
dongsheng@627
|
17179 msgid ""
|
dongsheng@627
|
17180 "Once you have this hunk, you can concatenate it onto the end of your "
|
songdongsheng@658
|
17181 "destination patch and continue with the remainder of <xref linkend=\"sec:mq:"
|
songdongsheng@658
|
17182 "combine\"/>."
|
dongsheng@627
|
17183 msgstr ""
|
dongsheng@627
|
17184
|
dongsheng@627
|
17185 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
17186 #: ../en/ch12-mq.xml:1346
|
dongsheng@627
|
17187 msgid "Differences between quilt and MQ"
|
dongsheng@636
|
17188 msgstr "MQ 与 quilt 的区别"
|
dongsheng@627
|
17189
|
dongsheng@627
|
17190 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17191 #: ../en/ch12-mq.xml:1348
|
dongsheng@627
|
17192 msgid ""
|
dongsheng@627
|
17193 "If you are already familiar with quilt, MQ provides a similar command set. "
|
dongsheng@627
|
17194 "There are a few differences in the way that it works."
|
dongsheng@627
|
17195 msgstr ""
|
dongsheng@627
|
17196
|
dongsheng@627
|
17197 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17198 #: ../en/ch12-mq.xml:1352
|
dongsheng@627
|
17199 msgid ""
|
dongsheng@627
|
17200 "You will already have noticed that most quilt commands have MQ counterparts "
|
dongsheng@627
|
17201 "that simply begin with a <quote><literal>q</literal></quote>. The exceptions "
|
dongsheng@627
|
17202 "are quilt's <literal>add</literal> and <literal>remove</literal> commands, "
|
dongsheng@627
|
17203 "the counterparts for which are the normal Mercurial <command role=\"hg-cmd"
|
dongsheng@627
|
17204 "\">hg add</command> and <command role=\"hg-cmd\">hg remove</command> "
|
dongsheng@627
|
17205 "commands. There is no MQ equivalent of the quilt <literal>edit</literal> "
|
dongsheng@627
|
17206 "command."
|
dongsheng@627
|
17207 msgstr ""
|
dongsheng@627
|
17208
|
dongsheng@627
|
17209 #. type: Content of: <book><chapter><title>
|
dongsheng@714
|
17210 #: ../en/ch13-mq-collab.xml:5
|
dongsheng@627
|
17211 msgid "Advanced uses of Mercurial Queues"
|
dongsheng@627
|
17212 msgstr "MQ 的高级用法"
|
dongsheng@627
|
17213
|
dongsheng@627
|
17214 #. type: Content of: <book><chapter><para>
|
dongsheng@714
|
17215 #: ../en/ch13-mq-collab.xml:7
|
dongsheng@627
|
17216 msgid ""
|
dongsheng@627
|
17217 "While it's easy to pick up straightforward uses of Mercurial Queues, use of a "
|
dongsheng@627
|
17218 "little discipline and some of MQ's less frequently used capabilities makes it "
|
dongsheng@627
|
17219 "possible to work in complicated development environments."
|
dongsheng@627
|
17220 msgstr ""
|
dongsheng@627
|
17221
|
dongsheng@627
|
17222 #. type: Content of: <book><chapter><para>
|
dongsheng@714
|
17223 #: ../en/ch13-mq-collab.xml:12
|
dongsheng@627
|
17224 msgid ""
|
dongsheng@627
|
17225 "In this chapter, I will use as an example a technique I have used to manage "
|
dongsheng@627
|
17226 "the development of an Infiniband device driver for the Linux kernel. The "
|
dongsheng@627
|
17227 "driver in question is large (at least as drivers go), with 25,000 lines of "
|
dongsheng@627
|
17228 "code spread across 35 source files. It is maintained by a small team of "
|
dongsheng@627
|
17229 "developers."
|
dongsheng@627
|
17230 msgstr ""
|
dongsheng@627
|
17231
|
dongsheng@627
|
17232 #. type: Content of: <book><chapter><para>
|
dongsheng@714
|
17233 #: ../en/ch13-mq-collab.xml:18
|
dongsheng@627
|
17234 msgid ""
|
dongsheng@627
|
17235 "While much of the material in this chapter is specific to Linux, the same "
|
dongsheng@627
|
17236 "principles apply to any code base for which you're not the primary owner, and "
|
dongsheng@627
|
17237 "upon which you need to do a lot of development."
|
dongsheng@627
|
17238 msgstr ""
|
dongsheng@627
|
17239
|
dongsheng@627
|
17240 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
17241 #: ../en/ch13-mq-collab.xml:24
|
dongsheng@627
|
17242 msgid "The problem of many targets"
|
dongsheng@636
|
17243 msgstr "多个目标的问题"
|
dongsheng@627
|
17244
|
dongsheng@627
|
17245 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17246 #: ../en/ch13-mq-collab.xml:26
|
dongsheng@627
|
17247 msgid ""
|
dongsheng@627
|
17248 "The Linux kernel changes rapidly, and has never been internally stable; "
|
dongsheng@627
|
17249 "developers frequently make drastic changes between releases. This means that "
|
dongsheng@627
|
17250 "a version of the driver that works well with a particular released version of "
|
dongsheng@627
|
17251 "the kernel will not even <emphasis>compile</emphasis> correctly against, "
|
dongsheng@627
|
17252 "typically, any other version."
|
dongsheng@627
|
17253 msgstr ""
|
dongsheng@627
|
17254
|
dongsheng@627
|
17255 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17256 #: ../en/ch13-mq-collab.xml:33
|
dongsheng@627
|
17257 msgid ""
|
dongsheng@627
|
17258 "To maintain a driver, we have to keep a number of distinct versions of Linux "
|
dongsheng@627
|
17259 "in mind."
|
dongsheng@627
|
17260 msgstr ""
|
dongsheng@627
|
17261
|
dongsheng@627
|
17262 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
17263 #: ../en/ch13-mq-collab.xml:36
|
dongsheng@627
|
17264 msgid ""
|
dongsheng@627
|
17265 "One target is the main Linux kernel development tree. Maintenance of the code "
|
dongsheng@627
|
17266 "is in this case partly shared by other developers in the kernel community, "
|
dongsheng@627
|
17267 "who make <quote>drive-by</quote> modifications to the driver as they develop "
|
dongsheng@627
|
17268 "and refine kernel subsystems."
|
dongsheng@627
|
17269 msgstr ""
|
dongsheng@627
|
17270
|
dongsheng@627
|
17271 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
17272 #: ../en/ch13-mq-collab.xml:42
|
dongsheng@627
|
17273 msgid ""
|
dongsheng@627
|
17274 "We also maintain a number of <quote>backports</quote> to older versions of "
|
dongsheng@627
|
17275 "the Linux kernel, to support the needs of customers who are running older "
|
dongsheng@627
|
17276 "Linux distributions that do not incorporate our drivers. (To "
|
dongsheng@627
|
17277 "<emphasis>backport</emphasis> a piece of code is to modify it to work in an "
|
dongsheng@627
|
17278 "older version of its target environment than the version it was developed "
|
dongsheng@627
|
17279 "for.)"
|
dongsheng@627
|
17280 msgstr ""
|
dongsheng@627
|
17281
|
dongsheng@627
|
17282 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
17283 #: ../en/ch13-mq-collab.xml:50
|
dongsheng@627
|
17284 msgid ""
|
dongsheng@627
|
17285 "Finally, we make software releases on a schedule that is necessarily not "
|
dongsheng@627
|
17286 "aligned with those used by Linux distributors and kernel developers, so that "
|
dongsheng@627
|
17287 "we can deliver new features to customers without forcing them to upgrade "
|
dongsheng@627
|
17288 "their entire kernels or distributions."
|
dongsheng@627
|
17289 msgstr ""
|
dongsheng@627
|
17290
|
dongsheng@627
|
17291 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
17292 #: ../en/ch13-mq-collab.xml:58
|
dongsheng@627
|
17293 msgid "Tempting approaches that don't work well"
|
dongsheng@636
|
17294 msgstr "工作不好的诱人方法"
|
dongsheng@627
|
17295
|
dongsheng@627
|
17296 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17297 #: ../en/ch13-mq-collab.xml:60
|
dongsheng@627
|
17298 msgid ""
|
dongsheng@627
|
17299 "There are two <quote>standard</quote> ways to maintain a piece of software "
|
dongsheng@627
|
17300 "that has to target many different environments."
|
dongsheng@627
|
17301 msgstr ""
|
dongsheng@627
|
17302
|
dongsheng@627
|
17303 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17304 #: ../en/ch13-mq-collab.xml:64
|
dongsheng@627
|
17305 msgid ""
|
dongsheng@627
|
17306 "The first is to maintain a number of branches, each intended for a single "
|
dongsheng@627
|
17307 "target. The trouble with this approach is that you must maintain iron "
|
dongsheng@627
|
17308 "discipline in the flow of changes between repositories. A new feature or bug "
|
dongsheng@627
|
17309 "fix must start life in a <quote>pristine</quote> repository, then percolate "
|
dongsheng@627
|
17310 "out to every backport repository. Backport changes are more limited in the "
|
dongsheng@627
|
17311 "branches they should propagate to; a backport change that is applied to a "
|
dongsheng@627
|
17312 "branch where it doesn't belong will probably stop the driver from compiling."
|
dongsheng@627
|
17313 msgstr ""
|
dongsheng@627
|
17314
|
dongsheng@627
|
17315 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17316 #: ../en/ch13-mq-collab.xml:74
|
dongsheng@627
|
17317 msgid ""
|
dongsheng@627
|
17318 "The second is to maintain a single source tree filled with conditional "
|
dongsheng@627
|
17319 "statements that turn chunks of code on or off depending on the intended "
|
dongsheng@627
|
17320 "target. Because these <quote>ifdefs</quote> are not allowed in the Linux "
|
dongsheng@627
|
17321 "kernel tree, a manual or automatic process must be followed to strip them out "
|
dongsheng@627
|
17322 "and yield a clean tree. A code base maintained in this fashion rapidly "
|
dongsheng@627
|
17323 "becomes a rat's nest of conditional blocks that are difficult to understand "
|
dongsheng@627
|
17324 "and maintain."
|
dongsheng@627
|
17325 msgstr ""
|
dongsheng@627
|
17326
|
dongsheng@627
|
17327 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17328 #: ../en/ch13-mq-collab.xml:83
|
dongsheng@627
|
17329 msgid ""
|
dongsheng@627
|
17330 "Neither of these approaches is well suited to a situation where you don't "
|
dongsheng@627
|
17331 "<quote>own</quote> the canonical copy of a source tree. In the case of a "
|
dongsheng@627
|
17332 "Linux driver that is distributed with the standard kernel, Linus's tree "
|
dongsheng@627
|
17333 "contains the copy of the code that will be treated by the world as "
|
dongsheng@627
|
17334 "canonical. The upstream version of <quote>my</quote> driver can be modified "
|
dongsheng@627
|
17335 "by people I don't know, without me even finding out about it until after the "
|
dongsheng@627
|
17336 "changes show up in Linus's tree."
|
dongsheng@627
|
17337 msgstr ""
|
dongsheng@627
|
17338
|
dongsheng@627
|
17339 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17340 #: ../en/ch13-mq-collab.xml:93
|
dongsheng@627
|
17341 msgid ""
|
dongsheng@627
|
17342 "These approaches have the added weakness of making it difficult to generate "
|
dongsheng@627
|
17343 "well-formed patches to submit upstream."
|
dongsheng@627
|
17344 msgstr ""
|
dongsheng@627
|
17345
|
dongsheng@627
|
17346 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17347 #: ../en/ch13-mq-collab.xml:97
|
dongsheng@627
|
17348 msgid ""
|
dongsheng@627
|
17349 "In principle, Mercurial Queues seems like a good candidate to manage a "
|
dongsheng@627
|
17350 "development scenario such as the above. While this is indeed the case, MQ "
|
dongsheng@627
|
17351 "contains a few added features that make the job more pleasant."
|
dongsheng@627
|
17352 msgstr ""
|
dongsheng@627
|
17353
|
dongsheng@627
|
17354 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
17355 #: ../en/ch13-mq-collab.xml:105
|
dongsheng@627
|
17356 msgid "Conditionally applying patches with guards"
|
dongsheng@636
|
17357 msgstr "有条件的应用补丁"
|
dongsheng@627
|
17358
|
dongsheng@627
|
17359 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17360 #: ../en/ch13-mq-collab.xml:107
|
dongsheng@627
|
17361 msgid ""
|
dongsheng@627
|
17362 "Perhaps the best way to maintain sanity with so many targets is to be able to "
|
dongsheng@627
|
17363 "choose specific patches to apply for a given situation. MQ provides a "
|
dongsheng@627
|
17364 "feature called <quote>guards</quote> (which originates with quilt's "
|
dongsheng@627
|
17365 "<literal>guards</literal> command) that does just this. To start off, let's "
|
dongsheng@627
|
17366 "create a simple repository for experimenting in."
|
dongsheng@627
|
17367 msgstr ""
|
dongsheng@627
|
17368
|
dongsheng@627
|
17369 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17370 #: ../en/ch13-mq-collab.xml:116
|
dongsheng@627
|
17371 msgid ""
|
dongsheng@627
|
17372 "This gives us a tiny repository that contains two patches that don't have any "
|
dongsheng@627
|
17373 "dependencies on each other, because they touch different files."
|
dongsheng@627
|
17374 msgstr ""
|
dongsheng@627
|
17375
|
dongsheng@627
|
17376 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17377 #: ../en/ch13-mq-collab.xml:120
|
dongsheng@627
|
17378 msgid ""
|
dongsheng@627
|
17379 "The idea behind conditional application is that you can <quote>tag</quote> a "
|
dongsheng@627
|
17380 "patch with a <emphasis>guard</emphasis>, which is simply a text string of "
|
dongsheng@627
|
17381 "your choosing, then tell MQ to select specific guards to use when applying "
|
dongsheng@627
|
17382 "patches. MQ will then either apply, or skip over, a guarded patch, depending "
|
dongsheng@627
|
17383 "on the guards that you have selected."
|
dongsheng@627
|
17384 msgstr ""
|
dongsheng@627
|
17385
|
dongsheng@627
|
17386 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17387 #: ../en/ch13-mq-collab.xml:127
|
dongsheng@627
|
17388 msgid ""
|
dongsheng@627
|
17389 "A patch can have an arbitrary number of guards; each one is "
|
dongsheng@627
|
17390 "<emphasis>positive</emphasis> (<quote>apply this patch if this guard is "
|
dongsheng@627
|
17391 "selected</quote>) or <emphasis>negative</emphasis> (<quote>skip this patch if "
|
dongsheng@627
|
17392 "this guard is selected</quote>). A patch with no guards is always applied."
|
dongsheng@627
|
17393 msgstr ""
|
dongsheng@627
|
17394
|
dongsheng@627
|
17395 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
17396 #: ../en/ch13-mq-collab.xml:135
|
dongsheng@627
|
17397 msgid "Controlling the guards on a patch"
|
dongsheng@636
|
17398 msgstr "控制补丁的应用条件"
|
dongsheng@627
|
17399
|
dongsheng@627
|
17400 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17401 #: ../en/ch13-mq-collab.xml:137
|
dongsheng@627
|
17402 msgid ""
|
dongsheng@627
|
17403 "The <command role=\"hg-ext-mq\">qguard</command> command lets you determine "
|
dongsheng@627
|
17404 "which guards should apply to a patch, or display the guards that are already "
|
dongsheng@627
|
17405 "in effect. Without any arguments, it displays the guards on the current "
|
dongsheng@627
|
17406 "topmost patch."
|
dongsheng@627
|
17407 msgstr ""
|
dongsheng@627
|
17408
|
dongsheng@627
|
17409 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17410 #: ../en/ch13-mq-collab.xml:144
|
dongsheng@627
|
17411 msgid ""
|
dongsheng@627
|
17412 "To set a positive guard on a patch, prefix the name of the guard with a "
|
dongsheng@627
|
17413 "<quote><literal>+</literal></quote>."
|
dongsheng@627
|
17414 msgstr ""
|
dongsheng@627
|
17415
|
dongsheng@627
|
17416 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17417 #: ../en/ch13-mq-collab.xml:149
|
dongsheng@627
|
17418 msgid ""
|
dongsheng@627
|
17419 "To set a negative guard on a patch, prefix the name of the guard with a "
|
dongsheng@627
|
17420 "<quote><literal>-</literal></quote>."
|
dongsheng@627
|
17421 msgstr ""
|
dongsheng@627
|
17422
|
dongsheng@714
|
17423 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17424 #: ../en/ch13-mq-collab.xml:155
|
dongsheng@714
|
17425 msgid ""
|
dongsheng@714
|
17426 "Notice that we prefixed the arguments to the <command>hg qguard</command> "
|
dongsheng@714
|
17427 "command with a <literal>--</literal> here, so that Mercurial would not "
|
dongsheng@714
|
17428 "interpret the text <literal>-quux</literal> as an option."
|
dongsheng@714
|
17429 msgstr ""
|
dongsheng@714
|
17430
|
dongsheng@714
|
17431 #. type: Content of: <book><chapter><sect1><note><title>
|
dongsheng@714
|
17432 #: ../en/ch13-mq-collab.xml:161
|
dongsheng@714
|
17433 msgid "Setting vs. modifying"
|
dongsheng@714
|
17434 msgstr ""
|
dongsheng@714
|
17435
|
dongsheng@627
|
17436 #. type: Content of: <book><chapter><sect1><note><para>
|
dongsheng@714
|
17437 #: ../en/ch13-mq-collab.xml:163
|
dongsheng@627
|
17438 msgid ""
|
dongsheng@627
|
17439 "The <command role=\"hg-ext-mq\">qguard</command> command <emphasis>sets</"
|
dongsheng@627
|
17440 "emphasis> the guards on a patch; it doesn't <emphasis>modify</emphasis> "
|
dongsheng@627
|
17441 "them. What this means is that if you run <command role=\"hg-cmd\">hg qguard "
|
dongsheng@627
|
17442 "+a +b</command> on a patch, then <command role=\"hg-cmd\">hg qguard +c</"
|
dongsheng@627
|
17443 "command> on the same patch, the <emphasis>only</emphasis> guard that will be "
|
dongsheng@627
|
17444 "set on it afterwards is <literal>+c</literal>."
|
dongsheng@627
|
17445 msgstr ""
|
dongsheng@627
|
17446
|
dongsheng@627
|
17447 #
|
dongsheng@627
|
17448 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17449 #: ../en/ch13-mq-collab.xml:172
|
dongsheng@627
|
17450 msgid ""
|
dongsheng@627
|
17451 "Mercurial stores guards in the <filename role=\"special\">series</filename> "
|
dongsheng@627
|
17452 "file; the form in which they are stored is easy both to understand and to "
|
dongsheng@627
|
17453 "edit by hand. (In other words, you don't have to use the <command role=\"hg-"
|
dongsheng@627
|
17454 "ext-mq\">qguard</command> command if you don't want to; it's okay to simply "
|
dongsheng@627
|
17455 "edit the <filename role=\"special\">series</filename> file.)"
|
dongsheng@627
|
17456 msgstr ""
|
dongsheng@627
|
17457
|
dongsheng@627
|
17458 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
17459 #: ../en/ch13-mq-collab.xml:184
|
dongsheng@627
|
17460 msgid "Selecting the guards to use"
|
dongsheng@636
|
17461 msgstr "选择使用的条件"
|
dongsheng@627
|
17462
|
dongsheng@627
|
17463 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17464 #: ../en/ch13-mq-collab.xml:186
|
dongsheng@627
|
17465 msgid ""
|
dongsheng@627
|
17466 "The <command role=\"hg-ext-mq\">qselect</command> command determines which "
|
dongsheng@627
|
17467 "guards are active at a given time. The effect of this is to determine which "
|
dongsheng@627
|
17468 "patches MQ will apply the next time you run <command role=\"hg-ext-mq"
|
dongsheng@627
|
17469 "\">qpush</command>. It has no other effect; in particular, it doesn't do "
|
dongsheng@627
|
17470 "anything to patches that are already applied."
|
dongsheng@627
|
17471 msgstr ""
|
dongsheng@627
|
17472
|
dongsheng@627
|
17473 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17474 #: ../en/ch13-mq-collab.xml:193
|
dongsheng@627
|
17475 msgid ""
|
dongsheng@627
|
17476 "With no arguments, the <command role=\"hg-ext-mq\">qselect</command> command "
|
dongsheng@627
|
17477 "lists the guards currently in effect, one per line of output. Each argument "
|
dongsheng@627
|
17478 "is treated as the name of a guard to apply."
|
dongsheng@627
|
17479 msgstr ""
|
dongsheng@627
|
17480
|
dongsheng@627
|
17481 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17482 #: ../en/ch13-mq-collab.xml:200
|
dongsheng@627
|
17483 msgid ""
|
dongsheng@627
|
17484 "In case you're interested, the currently selected guards are stored in the "
|
dongsheng@627
|
17485 "<filename role=\"special\">guards</filename> file."
|
dongsheng@627
|
17486 msgstr ""
|
dongsheng@627
|
17487
|
dongsheng@627
|
17488 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17489 #: ../en/ch13-mq-collab.xml:205
|
dongsheng@627
|
17490 msgid ""
|
dongsheng@627
|
17491 "We can see the effect the selected guards have when we run <command role=\"hg-"
|
dongsheng@627
|
17492 "ext-mq\">qpush</command>."
|
dongsheng@627
|
17493 msgstr ""
|
dongsheng@627
|
17494
|
dongsheng@627
|
17495 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17496 #: ../en/ch13-mq-collab.xml:210
|
dongsheng@627
|
17497 msgid ""
|
dongsheng@627
|
17498 "A guard cannot start with a <quote><literal>+</literal></quote> or "
|
dongsheng@627
|
17499 "<quote><literal>-</literal></quote> character. The name of a guard must not "
|
dongsheng@627
|
17500 "contain white space, but most other characters are acceptable. If you try to "
|
dongsheng@627
|
17501 "use a guard with an invalid name, MQ will complain:"
|
dongsheng@627
|
17502 msgstr ""
|
dongsheng@627
|
17503
|
dongsheng@627
|
17504 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17505 #: ../en/ch13-mq-collab.xml:219
|
dongsheng@627
|
17506 msgid "Changing the selected guards changes the patches that are applied."
|
dongsheng@627
|
17507 msgstr ""
|
dongsheng@627
|
17508
|
dongsheng@627
|
17509 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17510 #: ../en/ch13-mq-collab.xml:224
|
dongsheng@627
|
17511 msgid ""
|
dongsheng@627
|
17512 "You can see in the example below that negative guards take precedence over "
|
dongsheng@627
|
17513 "positive guards."
|
dongsheng@627
|
17514 msgstr ""
|
dongsheng@627
|
17515
|
dongsheng@627
|
17516 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
17517 #: ../en/ch13-mq-collab.xml:231
|
dongsheng@627
|
17518 msgid "MQ's rules for applying patches"
|
dongsheng@636
|
17519 msgstr "MQ 应用补丁的规则"
|
dongsheng@627
|
17520
|
dongsheng@627
|
17521 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17522 #: ../en/ch13-mq-collab.xml:233
|
dongsheng@627
|
17523 msgid ""
|
dongsheng@627
|
17524 "The rules that MQ uses when deciding whether to apply a patch are as follows."
|
dongsheng@627
|
17525 msgstr ""
|
dongsheng@627
|
17526
|
dongsheng@627
|
17527 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
17528 #: ../en/ch13-mq-collab.xml:236
|
dongsheng@627
|
17529 msgid "A patch that has no guards is always applied."
|
dongsheng@627
|
17530 msgstr ""
|
dongsheng@627
|
17531
|
dongsheng@627
|
17532 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
17533 #: ../en/ch13-mq-collab.xml:239
|
dongsheng@627
|
17534 msgid ""
|
dongsheng@627
|
17535 "If the patch has any negative guard that matches any currently selected "
|
dongsheng@627
|
17536 "guard, the patch is skipped."
|
dongsheng@627
|
17537 msgstr ""
|
dongsheng@627
|
17538
|
dongsheng@627
|
17539 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
17540 #: ../en/ch13-mq-collab.xml:242
|
dongsheng@627
|
17541 msgid ""
|
dongsheng@627
|
17542 "If the patch has any positive guard that matches any currently selected "
|
dongsheng@627
|
17543 "guard, the patch is applied."
|
dongsheng@627
|
17544 msgstr ""
|
dongsheng@627
|
17545
|
dongsheng@627
|
17546 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
17547 #: ../en/ch13-mq-collab.xml:245
|
dongsheng@627
|
17548 msgid ""
|
dongsheng@627
|
17549 "If the patch has positive or negative guards, but none matches any currently "
|
dongsheng@627
|
17550 "selected guard, the patch is skipped."
|
dongsheng@627
|
17551 msgstr ""
|
dongsheng@627
|
17552
|
dongsheng@627
|
17553 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
17554 #: ../en/ch13-mq-collab.xml:252
|
dongsheng@627
|
17555 msgid "Trimming the work environment"
|
dongsheng@636
|
17556 msgstr "修剪工作环境"
|
dongsheng@627
|
17557
|
dongsheng@627
|
17558 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17559 #: ../en/ch13-mq-collab.xml:254
|
dongsheng@627
|
17560 msgid ""
|
dongsheng@627
|
17561 "In working on the device driver I mentioned earlier, I don't apply the "
|
dongsheng@627
|
17562 "patches to a normal Linux kernel tree. Instead, I use a repository that "
|
dongsheng@627
|
17563 "contains only a snapshot of the source files and headers that are relevant to "
|
dongsheng@627
|
17564 "Infiniband development. This repository is 1% the size of a kernel "
|
dongsheng@627
|
17565 "repository, so it's easier to work with."
|
dongsheng@627
|
17566 msgstr ""
|
dongsheng@627
|
17567
|
dongsheng@627
|
17568 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17569 #: ../en/ch13-mq-collab.xml:261
|
dongsheng@627
|
17570 msgid ""
|
dongsheng@627
|
17571 "I then choose a <quote>base</quote> version on top of which the patches are "
|
dongsheng@627
|
17572 "applied. This is a snapshot of the Linux kernel tree as of a revision of my "
|
dongsheng@627
|
17573 "choosing. When I take the snapshot, I record the changeset ID from the "
|
dongsheng@627
|
17574 "kernel repository in the commit message. Since the snapshot preserves the "
|
dongsheng@627
|
17575 "<quote>shape</quote> and content of the relevant parts of the kernel tree, I "
|
dongsheng@627
|
17576 "can apply my patches on top of either my tiny repository or a normal kernel "
|
dongsheng@627
|
17577 "tree."
|
dongsheng@627
|
17578 msgstr ""
|
dongsheng@627
|
17579
|
dongsheng@627
|
17580 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17581 #: ../en/ch13-mq-collab.xml:270
|
dongsheng@627
|
17582 msgid ""
|
dongsheng@627
|
17583 "Normally, the base tree atop which the patches apply should be a snapshot of "
|
dongsheng@627
|
17584 "a very recent upstream tree. This best facilitates the development of "
|
dongsheng@627
|
17585 "patches that can easily be submitted upstream with few or no modifications."
|
dongsheng@627
|
17586 msgstr ""
|
dongsheng@627
|
17587
|
dongsheng@627
|
17588 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
17589 #: ../en/ch13-mq-collab.xml:277
|
dongsheng@627
|
17590 msgid "Dividing up the <filename role=\"special\">series</filename> file"
|
dongsheng@636
|
17591 msgstr "分类补丁<filename role=\"special\">系列</filename>"
|
dongsheng@627
|
17592
|
dongsheng@627
|
17593 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17594 #: ../en/ch13-mq-collab.xml:280
|
dongsheng@627
|
17595 msgid ""
|
dongsheng@627
|
17596 "I categorise the patches in the <filename role=\"special\">series</filename> "
|
dongsheng@627
|
17597 "file into a number of logical groups. Each section of like patches begins "
|
dongsheng@627
|
17598 "with a block of comments that describes the purpose of the patches that "
|
dongsheng@627
|
17599 "follow."
|
dongsheng@627
|
17600 msgstr ""
|
dongsheng@627
|
17601
|
dongsheng@627
|
17602 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17603 #: ../en/ch13-mq-collab.xml:286
|
dongsheng@627
|
17604 msgid ""
|
dongsheng@627
|
17605 "The sequence of patch groups that I maintain follows. The ordering of these "
|
dongsheng@627
|
17606 "groups is important; I'll describe why after I introduce the groups."
|
dongsheng@627
|
17607 msgstr ""
|
dongsheng@627
|
17608
|
dongsheng@627
|
17609 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
17610 #: ../en/ch13-mq-collab.xml:290
|
dongsheng@627
|
17611 msgid ""
|
dongsheng@627
|
17612 "The <quote>accepted</quote> group. Patches that the development team has "
|
dongsheng@627
|
17613 "submitted to the maintainer of the Infiniband subsystem, and which he has "
|
dongsheng@627
|
17614 "accepted, but which are not present in the snapshot that the tiny repository "
|
dongsheng@627
|
17615 "is based on. These are <quote>read only</quote> patches, present only to "
|
dongsheng@627
|
17616 "transform the tree into a similar state as it is in the upstream maintainer's "
|
dongsheng@627
|
17617 "repository."
|
dongsheng@627
|
17618 msgstr ""
|
dongsheng@627
|
17619
|
dongsheng@627
|
17620 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
17621 #: ../en/ch13-mq-collab.xml:298
|
dongsheng@627
|
17622 msgid ""
|
dongsheng@627
|
17623 "The <quote>rework</quote> group. Patches that I have submitted, but that the "
|
dongsheng@627
|
17624 "upstream maintainer has requested modifications to before he will accept them."
|
dongsheng@627
|
17625 msgstr ""
|
dongsheng@627
|
17626
|
dongsheng@627
|
17627 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
17628 #: ../en/ch13-mq-collab.xml:303
|
dongsheng@627
|
17629 msgid ""
|
dongsheng@627
|
17630 "The <quote>pending</quote> group. Patches that I have not yet submitted to "
|
dongsheng@627
|
17631 "the upstream maintainer, but which we have finished working on. These will be "
|
dongsheng@627
|
17632 "<quote>read only</quote> for a while. If the upstream maintainer accepts "
|
dongsheng@627
|
17633 "them upon submission, I'll move them to the end of the <quote>accepted</"
|
dongsheng@627
|
17634 "quote> group. If he requests that I modify any, I'll move them to the "
|
dongsheng@627
|
17635 "beginning of the <quote>rework</quote> group."
|
dongsheng@627
|
17636 msgstr ""
|
dongsheng@627
|
17637
|
dongsheng@627
|
17638 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
17639 #: ../en/ch13-mq-collab.xml:312
|
dongsheng@627
|
17640 msgid ""
|
dongsheng@627
|
17641 "The <quote>in progress</quote> group. Patches that are actively being "
|
dongsheng@627
|
17642 "developed, and should not be submitted anywhere yet."
|
dongsheng@627
|
17643 msgstr ""
|
dongsheng@627
|
17644
|
dongsheng@627
|
17645 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
17646 #: ../en/ch13-mq-collab.xml:316
|
dongsheng@627
|
17647 msgid ""
|
dongsheng@627
|
17648 "The <quote>backport</quote> group. Patches that adapt the source tree to "
|
dongsheng@627
|
17649 "older versions of the kernel tree."
|
dongsheng@627
|
17650 msgstr ""
|
dongsheng@627
|
17651
|
dongsheng@627
|
17652 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
17653 #: ../en/ch13-mq-collab.xml:320
|
dongsheng@627
|
17654 msgid ""
|
dongsheng@627
|
17655 "The <quote>do not ship</quote> group. Patches that for some reason should "
|
dongsheng@627
|
17656 "never be submitted upstream. For example, one such patch might change "
|
dongsheng@627
|
17657 "embedded driver identification strings to make it easier to distinguish, in "
|
dongsheng@627
|
17658 "the field, between an out-of-tree version of the driver and a version shipped "
|
dongsheng@627
|
17659 "by a distribution vendor."
|
dongsheng@627
|
17660 msgstr ""
|
dongsheng@627
|
17661
|
dongsheng@627
|
17662 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17663 #: ../en/ch13-mq-collab.xml:328
|
dongsheng@627
|
17664 msgid ""
|
dongsheng@627
|
17665 "Now to return to the reasons for ordering groups of patches in this way. We "
|
dongsheng@627
|
17666 "would like the lowest patches in the stack to be as stable as possible, so "
|
dongsheng@627
|
17667 "that we will not need to rework higher patches due to changes in context. "
|
dongsheng@627
|
17668 "Putting patches that will never be changed first in the <filename role="
|
dongsheng@627
|
17669 "\"special\">series</filename> file serves this purpose."
|
dongsheng@627
|
17670 msgstr ""
|
dongsheng@627
|
17671
|
dongsheng@627
|
17672 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17673 #: ../en/ch13-mq-collab.xml:336
|
dongsheng@627
|
17674 msgid ""
|
dongsheng@627
|
17675 "We would also like the patches that we know we'll need to modify to be "
|
dongsheng@627
|
17676 "applied on top of a source tree that resembles the upstream tree as closely "
|
dongsheng@627
|
17677 "as possible. This is why we keep accepted patches around for a while."
|
dongsheng@627
|
17678 msgstr ""
|
dongsheng@627
|
17679
|
dongsheng@627
|
17680 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17681 #: ../en/ch13-mq-collab.xml:341
|
dongsheng@627
|
17682 msgid ""
|
dongsheng@627
|
17683 "The <quote>backport</quote> and <quote>do not ship</quote> patches float at "
|
dongsheng@627
|
17684 "the end of the <filename role=\"special\">series</filename> file. The "
|
dongsheng@627
|
17685 "backport patches must be applied on top of all other patches, and the "
|
dongsheng@627
|
17686 "<quote>do not ship</quote> patches might as well stay out of harm's way."
|
dongsheng@627
|
17687 msgstr ""
|
dongsheng@627
|
17688
|
dongsheng@627
|
17689 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
17690 #: ../en/ch13-mq-collab.xml:350
|
dongsheng@627
|
17691 msgid "Maintaining the patch series"
|
dongsheng@636
|
17692 msgstr "维护补丁系列"
|
dongsheng@627
|
17693
|
dongsheng@627
|
17694 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17695 #: ../en/ch13-mq-collab.xml:352
|
dongsheng@627
|
17696 msgid ""
|
dongsheng@627
|
17697 "In my work, I use a number of guards to control which patches are to be "
|
dongsheng@627
|
17698 "applied."
|
dongsheng@627
|
17699 msgstr ""
|
dongsheng@627
|
17700
|
dongsheng@627
|
17701 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
17702 #: ../en/ch13-mq-collab.xml:356
|
dongsheng@627
|
17703 msgid ""
|
dongsheng@627
|
17704 "<quote>Accepted</quote> patches are guarded with <literal>accepted</"
|
dongsheng@627
|
17705 "literal>. I enable this guard most of the time. When I'm applying the "
|
dongsheng@627
|
17706 "patches on top of a tree where the patches are already present, I can turn "
|
dongsheng@627
|
17707 "this patch off, and the patches that follow it will apply cleanly."
|
dongsheng@627
|
17708 msgstr ""
|
dongsheng@627
|
17709
|
dongsheng@627
|
17710 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
17711 #: ../en/ch13-mq-collab.xml:363
|
dongsheng@627
|
17712 msgid ""
|
dongsheng@627
|
17713 "Patches that are <quote>finished</quote>, but not yet submitted, have no "
|
dongsheng@627
|
17714 "guards. If I'm applying the patch stack to a copy of the upstream tree, I "
|
dongsheng@627
|
17715 "don't need to enable any guards in order to get a reasonably safe source tree."
|
dongsheng@627
|
17716 msgstr ""
|
dongsheng@627
|
17717
|
dongsheng@627
|
17718 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
17719 #: ../en/ch13-mq-collab.xml:369
|
dongsheng@627
|
17720 msgid ""
|
dongsheng@627
|
17721 "Those patches that need reworking before being resubmitted are guarded with "
|
dongsheng@627
|
17722 "<literal>rework</literal>."
|
dongsheng@627
|
17723 msgstr ""
|
dongsheng@627
|
17724
|
dongsheng@627
|
17725 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
17726 #: ../en/ch13-mq-collab.xml:373
|
dongsheng@627
|
17727 msgid ""
|
dongsheng@627
|
17728 "For those patches that are still under development, I use <literal>devel</"
|
dongsheng@627
|
17729 "literal>."
|
dongsheng@627
|
17730 msgstr ""
|
dongsheng@627
|
17731
|
dongsheng@627
|
17732 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
17733 #: ../en/ch13-mq-collab.xml:376
|
dongsheng@627
|
17734 msgid ""
|
dongsheng@627
|
17735 "A backport patch may have several guards, one for each version of the kernel "
|
dongsheng@627
|
17736 "to which it applies. For example, a patch that backports a piece of code to "
|
dongsheng@627
|
17737 "2.6.9 will have a <literal>2.6.9</literal> guard."
|
dongsheng@627
|
17738 msgstr ""
|
dongsheng@627
|
17739
|
dongsheng@627
|
17740 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17741 #: ../en/ch13-mq-collab.xml:381
|
dongsheng@627
|
17742 msgid ""
|
dongsheng@627
|
17743 "This variety of guards gives me considerable flexibility in determining what "
|
dongsheng@627
|
17744 "kind of source tree I want to end up with. For most situations, the "
|
dongsheng@627
|
17745 "selection of appropriate guards is automated during the build process, but I "
|
dongsheng@627
|
17746 "can manually tune the guards to use for less common circumstances."
|
dongsheng@627
|
17747 msgstr ""
|
dongsheng@627
|
17748
|
dongsheng@627
|
17749 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
17750 #: ../en/ch13-mq-collab.xml:388
|
dongsheng@627
|
17751 msgid "The art of writing backport patches"
|
dongsheng@636
|
17752 msgstr "编写向后移植补丁的艺术"
|
dongsheng@627
|
17753
|
dongsheng@627
|
17754 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17755 #: ../en/ch13-mq-collab.xml:390
|
dongsheng@627
|
17756 msgid ""
|
dongsheng@627
|
17757 "Using MQ, writing a backport patch is a simple process. All such a patch has "
|
dongsheng@627
|
17758 "to do is modify a piece of code that uses a kernel feature not present in the "
|
dongsheng@627
|
17759 "older version of the kernel, so that the driver continues to work correctly "
|
dongsheng@627
|
17760 "under that older version."
|
dongsheng@627
|
17761 msgstr ""
|
dongsheng@627
|
17762
|
dongsheng@627
|
17763 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17764 #: ../en/ch13-mq-collab.xml:396
|
dongsheng@627
|
17765 msgid ""
|
dongsheng@627
|
17766 "A useful goal when writing a good backport patch is to make your code look as "
|
dongsheng@627
|
17767 "if it was written for the older version of the kernel you're targeting. The "
|
dongsheng@627
|
17768 "less obtrusive the patch, the easier it will be to understand and maintain. "
|
dongsheng@627
|
17769 "If you're writing a collection of backport patches to avoid the <quote>rat's "
|
dongsheng@627
|
17770 "nest</quote> effect of lots of <literal>#ifdef</literal>s (hunks of source "
|
dongsheng@627
|
17771 "code that are only used conditionally) in your code, don't introduce version-"
|
dongsheng@627
|
17772 "dependent <literal>#ifdef</literal>s into the patches. Instead, write "
|
dongsheng@627
|
17773 "several patches, each of which makes unconditional changes, and control their "
|
dongsheng@627
|
17774 "application using guards."
|
dongsheng@627
|
17775 msgstr ""
|
dongsheng@627
|
17776
|
dongsheng@627
|
17777 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17778 #: ../en/ch13-mq-collab.xml:409
|
dongsheng@627
|
17779 msgid ""
|
dongsheng@627
|
17780 "There are two reasons to divide backport patches into a distinct group, away "
|
dongsheng@627
|
17781 "from the <quote>regular</quote> patches whose effects they modify. The first "
|
dongsheng@627
|
17782 "is that intermingling the two makes it more difficult to use a tool like the "
|
dongsheng@627
|
17783 "<literal role=\"hg-ext\">patchbomb</literal> extension to automate the "
|
dongsheng@627
|
17784 "process of submitting the patches to an upstream maintainer. The second is "
|
dongsheng@627
|
17785 "that a backport patch could perturb the context in which a subsequent regular "
|
dongsheng@627
|
17786 "patch is applied, making it impossible to apply the regular patch cleanly "
|
dongsheng@627
|
17787 "<emphasis>without</emphasis> the earlier backport patch already being applied."
|
dongsheng@627
|
17788 msgstr ""
|
dongsheng@627
|
17789
|
dongsheng@627
|
17790 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
17791 #: ../en/ch13-mq-collab.xml:424
|
dongsheng@627
|
17792 msgid "Useful tips for developing with MQ"
|
dongsheng@636
|
17793 msgstr "使用 MQ 开发的技巧"
|
dongsheng@627
|
17794
|
dongsheng@627
|
17795 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
17796 #: ../en/ch13-mq-collab.xml:427
|
dongsheng@627
|
17797 msgid "Organising patches in directories"
|
dongsheng@636
|
17798 msgstr "将补丁放到几个目录中"
|
dongsheng@627
|
17799
|
dongsheng@627
|
17800 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17801 #: ../en/ch13-mq-collab.xml:429
|
dongsheng@627
|
17802 msgid ""
|
dongsheng@627
|
17803 "If you're working on a substantial project with MQ, it's not difficult to "
|
dongsheng@627
|
17804 "accumulate a large number of patches. For example, I have one patch "
|
dongsheng@627
|
17805 "repository that contains over 250 patches."
|
dongsheng@627
|
17806 msgstr ""
|
dongsheng@627
|
17807
|
dongsheng@627
|
17808 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17809 #: ../en/ch13-mq-collab.xml:434
|
dongsheng@627
|
17810 msgid ""
|
dongsheng@627
|
17811 "If you can group these patches into separate logical categories, you can if "
|
dongsheng@627
|
17812 "you like store them in different directories; MQ has no problems with patch "
|
dongsheng@627
|
17813 "names that contain path separators."
|
dongsheng@627
|
17814 msgstr ""
|
dongsheng@627
|
17815
|
dongsheng@627
|
17816 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
17817 #: ../en/ch13-mq-collab.xml:441
|
dongsheng@627
|
17818 msgid "Viewing the history of a patch"
|
dongsheng@636
|
17819 msgstr "察看补丁的历史"
|
dongsheng@627
|
17820
|
dongsheng@627
|
17821 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17822 #: ../en/ch13-mq-collab.xml:443
|
dongsheng@627
|
17823 msgid ""
|
dongsheng@627
|
17824 "If you're developing a set of patches over a long time, it's a good idea to "
|
songdongsheng@658
|
17825 "maintain them in a repository, as discussed in <xref linkend=\"sec:mq:repo\"/"
|
songdongsheng@658
|
17826 ">. If you do so, you'll quickly discover that using the <command role=\"hg-"
|
songdongsheng@658
|
17827 "cmd\">hg diff</command> command to look at the history of changes to a patch "
|
songdongsheng@658
|
17828 "is unworkable. This is in part because you're looking at the second "
|
dongsheng@627
|
17829 "derivative of the real code (a diff of a diff), but also because MQ adds "
|
dongsheng@627
|
17830 "noise to the process by modifying time stamps and directory names when it "
|
dongsheng@627
|
17831 "updates a patch."
|
dongsheng@627
|
17832 msgstr ""
|
dongsheng@627
|
17833
|
dongsheng@627
|
17834 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17835 #: ../en/ch13-mq-collab.xml:455
|
dongsheng@627
|
17836 msgid ""
|
dongsheng@627
|
17837 "However, you can use the <literal role=\"hg-ext\">extdiff</literal> "
|
dongsheng@627
|
17838 "extension, which is bundled with Mercurial, to turn a diff of two versions of "
|
dongsheng@627
|
17839 "a patch into something readable. To do this, you will need a third-party "
|
dongsheng@627
|
17840 "package called <literal role=\"package\">patchutils</literal> <citation>web:"
|
dongsheng@627
|
17841 "patchutils</citation>. This provides a command named <command>interdiff</"
|
dongsheng@627
|
17842 "command>, which shows the differences between two diffs as a diff. Used on "
|
dongsheng@627
|
17843 "two versions of the same diff, it generates a diff that represents the diff "
|
dongsheng@627
|
17844 "from the first to the second version."
|
dongsheng@627
|
17845 msgstr ""
|
dongsheng@627
|
17846
|
dongsheng@627
|
17847 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17848 #: ../en/ch13-mq-collab.xml:466
|
dongsheng@627
|
17849 msgid ""
|
dongsheng@627
|
17850 "You can enable the <literal role=\"hg-ext\">extdiff</literal> extension in "
|
dongsheng@627
|
17851 "the usual way, by adding a line to the <literal role=\"rc-extensions"
|
dongsheng@650
|
17852 "\">extensions</literal> section of your <filename role=\"special\">~/.hgrc</"
|
dongsheng@627
|
17853 "filename>."
|
dongsheng@627
|
17854 msgstr ""
|
dongsheng@627
|
17855
|
dongsheng@627
|
17856 #
|
dongsheng@1034
|
17857 #. &example.hg-interdiff;
|
dongsheng@714
|
17858 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17859 #: ../en/ch13-mq-collab.xml:473
|
dongsheng@627
|
17860 msgid ""
|
dongsheng@627
|
17861 "The <command>interdiff</command> command expects to be passed the names of "
|
dongsheng@627
|
17862 "two files, but the <literal role=\"hg-ext\">extdiff</literal> extension "
|
dongsheng@627
|
17863 "passes the program it runs a pair of directories, each of which can contain "
|
dongsheng@627
|
17864 "an arbitrary number of files. We thus need a small program that will run "
|
dongsheng@627
|
17865 "<command>interdiff</command> on each pair of files in these two directories. "
|
dongsheng@627
|
17866 "This program is available as <filename role=\"special\">hg-interdiff</"
|
dongsheng@627
|
17867 "filename> in the <filename class=\"directory\">examples</filename> directory "
|
dongsheng@627
|
17868 "of the source code repository that accompanies this book."
|
dongsheng@627
|
17869 msgstr ""
|
dongsheng@627
|
17870
|
dongsheng@627
|
17871 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17872 #: ../en/ch13-mq-collab.xml:485
|
dongsheng@627
|
17873 msgid ""
|
dongsheng@627
|
17874 "With the <filename role=\"special\">hg-interdiff</filename> program in your "
|
dongsheng@627
|
17875 "shell's search path, you can run it as follows, from inside an MQ patch "
|
dongsheng@627
|
17876 "directory:"
|
dongsheng@627
|
17877 msgstr ""
|
dongsheng@627
|
17878
|
dongsheng@627
|
17879 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17880 #: ../en/ch13-mq-collab.xml:489
|
dongsheng@627
|
17881 msgid ""
|
dongsheng@627
|
17882 "Since you'll probably want to use this long-winded command a lot, you can get "
|
dongsheng@627
|
17883 "<literal role=\"hg-ext\">hgext</literal> to make it available as a normal "
|
dongsheng@650
|
17884 "Mercurial command, again by editing your <filename role=\"special\">~/.hgrc</"
|
dongsheng@627
|
17885 "filename>."
|
dongsheng@627
|
17886 msgstr ""
|
dongsheng@627
|
17887
|
dongsheng@627
|
17888 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17889 #: ../en/ch13-mq-collab.xml:496
|
dongsheng@627
|
17890 msgid ""
|
dongsheng@627
|
17891 "This directs <literal role=\"hg-ext\">hgext</literal> to make an "
|
dongsheng@627
|
17892 "<literal>interdiff</literal> command available, so you can now shorten the "
|
dongsheng@627
|
17893 "previous invocation of <command role=\"hg-ext-extdiff\">extdiff</command> to "
|
dongsheng@627
|
17894 "something a little more wieldy."
|
dongsheng@627
|
17895 msgstr ""
|
dongsheng@627
|
17896
|
dongsheng@627
|
17897 #. type: Content of: <book><chapter><sect1><sect2><note><para>
|
dongsheng@714
|
17898 #: ../en/ch13-mq-collab.xml:504
|
dongsheng@627
|
17899 msgid ""
|
dongsheng@627
|
17900 "The <command>interdiff</command> command works well only if the underlying "
|
dongsheng@627
|
17901 "files against which versions of a patch are generated remain the same. If "
|
dongsheng@627
|
17902 "you create a patch, modify the underlying files, and then regenerate the "
|
dongsheng@627
|
17903 "patch, <command>interdiff</command> may not produce useful output."
|
dongsheng@627
|
17904 msgstr ""
|
dongsheng@627
|
17905
|
dongsheng@627
|
17906 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
17907 #: ../en/ch13-mq-collab.xml:512
|
dongsheng@627
|
17908 msgid ""
|
dongsheng@627
|
17909 "The <literal role=\"hg-ext\">extdiff</literal> extension is useful for more "
|
dongsheng@627
|
17910 "than merely improving the presentation of MQ patches. To read more about it, "
|
songdongsheng@658
|
17911 "go to <xref linkend=\"sec:hgext:extdiff\"/>."
|
dongsheng@627
|
17912 msgstr ""
|
dongsheng@627
|
17913
|
dongsheng@627
|
17914 #. type: Content of: <book><chapter><title>
|
dongsheng@714
|
17915 #: ../en/ch14-hgext.xml:5
|
dongsheng@627
|
17916 msgid "Adding functionality with extensions"
|
dongsheng@627
|
17917 msgstr "使用扩展增加功能"
|
dongsheng@627
|
17918
|
dongsheng@627
|
17919 #. type: Content of: <book><chapter><para>
|
dongsheng@714
|
17920 #: ../en/ch14-hgext.xml:7
|
dongsheng@627
|
17921 msgid ""
|
dongsheng@627
|
17922 "While the core of Mercurial is quite complete from a functionality "
|
dongsheng@627
|
17923 "standpoint, it's deliberately shorn of fancy features. This approach of "
|
dongsheng@627
|
17924 "preserving simplicity keeps the software easy to deal with for both "
|
dongsheng@627
|
17925 "maintainers and users."
|
dongsheng@627
|
17926 msgstr ""
|
dongsheng@627
|
17927
|
dongsheng@627
|
17928 #. type: Content of: <book><chapter><para>
|
dongsheng@714
|
17929 #: ../en/ch14-hgext.xml:12
|
dongsheng@627
|
17930 msgid ""
|
dongsheng@627
|
17931 "However, Mercurial doesn't box you in with an inflexible command set: you can "
|
dongsheng@627
|
17932 "add features to it as <emphasis>extensions</emphasis> (sometimes known as "
|
dongsheng@627
|
17933 "<emphasis>plugins</emphasis>). We've already discussed a few of these "
|
dongsheng@627
|
17934 "extensions in earlier chapters."
|
dongsheng@627
|
17935 msgstr ""
|
dongsheng@627
|
17936
|
dongsheng@627
|
17937 #. type: Content of: <book><chapter><itemizedlist><listitem><para>
|
dongsheng@714
|
17938 #: ../en/ch14-hgext.xml:18
|
dongsheng@627
|
17939 msgid ""
|
songdongsheng@658
|
17940 "<xref linkend=\"sec:tour-merge:fetch\"/> covers the <literal role=\"hg-ext"
|
songdongsheng@658
|
17941 "\">fetch</literal> extension; this combines pulling new changes and merging "
|
songdongsheng@658
|
17942 "them with local changes into a single command, <command role=\"hg-ext-fetch"
|
songdongsheng@658
|
17943 "\">fetch</command>."
|
dongsheng@627
|
17944 msgstr ""
|
dongsheng@627
|
17945
|
dongsheng@627
|
17946 #. type: Content of: <book><chapter><itemizedlist><listitem><para>
|
dongsheng@714
|
17947 #: ../en/ch14-hgext.xml:24
|
dongsheng@627
|
17948 msgid ""
|
songdongsheng@658
|
17949 "In <xref linkend=\"chap:hook\"/>, we covered several extensions that are "
|
songdongsheng@658
|
17950 "useful for hook-related functionality: <literal role=\"hg-ext\">acl</literal> "
|
songdongsheng@658
|
17951 "adds access control lists; <literal role=\"hg-ext\">bugzilla</literal> adds "
|
songdongsheng@658
|
17952 "integration with the Bugzilla bug tracking system; and <literal role=\"hg-ext"
|
songdongsheng@658
|
17953 "\">notify</literal> sends notification emails on new changes."
|
dongsheng@627
|
17954 msgstr ""
|
dongsheng@627
|
17955
|
dongsheng@627
|
17956 #. type: Content of: <book><chapter><itemizedlist><listitem><para>
|
dongsheng@714
|
17957 #: ../en/ch14-hgext.xml:33
|
dongsheng@627
|
17958 msgid ""
|
dongsheng@627
|
17959 "The Mercurial Queues patch management extension is so invaluable that it "
|
songdongsheng@658
|
17960 "merits two chapters and an appendix all to itself. <xref linkend=\"chap:mq\"/"
|
songdongsheng@658
|
17961 "> covers the basics; <xref linkend=\"chap:mq-collab\"/> discusses advanced "
|
songdongsheng@658
|
17962 "topics; and <xref linkend=\"chap:mqref\"/> goes into detail on each command."
|
dongsheng@627
|
17963 msgstr ""
|
dongsheng@627
|
17964
|
dongsheng@627
|
17965 #. type: Content of: <book><chapter><para>
|
dongsheng@714
|
17966 #: ../en/ch14-hgext.xml:43
|
dongsheng@627
|
17967 msgid ""
|
dongsheng@627
|
17968 "In this chapter, we'll cover some of the other extensions that are available "
|
dongsheng@627
|
17969 "for Mercurial, and briefly touch on some of the machinery you'll need to know "
|
dongsheng@627
|
17970 "about if you want to write an extension of your own."
|
dongsheng@627
|
17971 msgstr ""
|
dongsheng@627
|
17972
|
dongsheng@627
|
17973 #. type: Content of: <book><chapter><itemizedlist><listitem><para>
|
dongsheng@714
|
17974 #: ../en/ch14-hgext.xml:48
|
dongsheng@627
|
17975 msgid ""
|
songdongsheng@658
|
17976 "In <xref linkend=\"sec:hgext:inotify\"/>, we'll discuss the possibility of "
|
songdongsheng@658
|
17977 "<emphasis>huge</emphasis> performance improvements using the <literal role="
|
songdongsheng@658
|
17978 "\"hg-ext\">inotify</literal> extension."
|
dongsheng@627
|
17979 msgstr ""
|
dongsheng@627
|
17980
|
dongsheng@627
|
17981 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
17982 #: ../en/ch14-hgext.xml:55
|
dongsheng@627
|
17983 msgid ""
|
dongsheng@627
|
17984 "Improve performance with the <literal role=\"hg-ext\">inotify</literal> "
|
dongsheng@627
|
17985 "extension"
|
dongsheng@636
|
17986 msgstr "使用扩展 <literal role=\"hg-ext\">inotify</literal> 以提高性能"
|
dongsheng@627
|
17987
|
dongsheng@627
|
17988 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17989 #: ../en/ch14-hgext.xml:58
|
dongsheng@627
|
17990 msgid ""
|
dongsheng@627
|
17991 "Are you interested in having some of the most common Mercurial operations run "
|
dongsheng@627
|
17992 "as much as a hundred times faster? Read on!"
|
dongsheng@627
|
17993 msgstr ""
|
dongsheng@627
|
17994
|
dongsheng@627
|
17995 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
17996 #: ../en/ch14-hgext.xml:62
|
dongsheng@627
|
17997 msgid ""
|
dongsheng@627
|
17998 "Mercurial has great performance under normal circumstances. For example, "
|
dongsheng@627
|
17999 "when you run the <command role=\"hg-cmd\">hg status</command> command, "
|
dongsheng@627
|
18000 "Mercurial has to scan almost every directory and file in your repository so "
|
dongsheng@627
|
18001 "that it can display file status. Many other Mercurial commands need to do "
|
dongsheng@627
|
18002 "the same work behind the scenes; for example, the <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
18003 "diff</command> command uses the status machinery to avoid doing an expensive "
|
dongsheng@627
|
18004 "comparison operation on files that obviously haven't changed."
|
dongsheng@627
|
18005 msgstr ""
|
dongsheng@627
|
18006
|
dongsheng@627
|
18007 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18008 #: ../en/ch14-hgext.xml:72
|
dongsheng@627
|
18009 msgid ""
|
dongsheng@627
|
18010 "Because obtaining file status is crucial to good performance, the authors of "
|
dongsheng@627
|
18011 "Mercurial have optimised this code to within an inch of its life. However, "
|
dongsheng@627
|
18012 "there's no avoiding the fact that when you run <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
18013 "status</command>, Mercurial is going to have to perform at least one "
|
dongsheng@627
|
18014 "expensive system call for each managed file to determine whether it's changed "
|
dongsheng@627
|
18015 "since the last time Mercurial checked. For a sufficiently large repository, "
|
dongsheng@627
|
18016 "this can take a long time."
|
dongsheng@627
|
18017 msgstr ""
|
dongsheng@627
|
18018
|
dongsheng@627
|
18019 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18020 #: ../en/ch14-hgext.xml:82
|
dongsheng@627
|
18021 msgid ""
|
dongsheng@627
|
18022 "To put a number on the magnitude of this effect, I created a repository "
|
dongsheng@627
|
18023 "containing 150,000 managed files. I timed <command role=\"hg-cmd\">hg "
|
dongsheng@627
|
18024 "status</command> as taking ten seconds to run, even when <emphasis>none</"
|
dongsheng@627
|
18025 "emphasis> of those files had been modified."
|
dongsheng@627
|
18026 msgstr ""
|
dongsheng@627
|
18027
|
dongsheng@627
|
18028 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18029 #: ../en/ch14-hgext.xml:88
|
dongsheng@627
|
18030 msgid ""
|
dongsheng@627
|
18031 "Many modern operating systems contain a file notification facility. If a "
|
dongsheng@627
|
18032 "program signs up to an appropriate service, the operating system will notify "
|
dongsheng@627
|
18033 "it every time a file of interest is created, modified, or deleted. On Linux "
|
dongsheng@627
|
18034 "systems, the kernel component that does this is called <literal>inotify</"
|
dongsheng@627
|
18035 "literal>."
|
dongsheng@627
|
18036 msgstr ""
|
dongsheng@627
|
18037
|
dongsheng@627
|
18038 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18039 #: ../en/ch14-hgext.xml:95
|
dongsheng@627
|
18040 msgid ""
|
dongsheng@627
|
18041 "Mercurial's <literal role=\"hg-ext\">inotify</literal> extension talks to the "
|
dongsheng@627
|
18042 "kernel's <literal>inotify</literal> component to optimise <command role=\"hg-"
|
dongsheng@627
|
18043 "cmd\">hg status</command> commands. The extension has two components. A "
|
dongsheng@627
|
18044 "daemon sits in the background and receives notifications from the "
|
dongsheng@627
|
18045 "<literal>inotify</literal> subsystem. It also listens for connections from a "
|
songdongsheng@710
|
18046 "regular Mercurial command. The extension modifies Mercurial's behavior so "
|
dongsheng@627
|
18047 "that instead of scanning the filesystem, it queries the daemon. Since the "
|
dongsheng@627
|
18048 "daemon has perfect information about the state of the repository, it can "
|
dongsheng@627
|
18049 "respond with a result instantaneously, avoiding the need to scan every "
|
dongsheng@627
|
18050 "directory and file in the repository."
|
dongsheng@627
|
18051 msgstr ""
|
dongsheng@627
|
18052
|
dongsheng@627
|
18053 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18054 #: ../en/ch14-hgext.xml:108
|
dongsheng@627
|
18055 msgid ""
|
dongsheng@627
|
18056 "Recall the ten seconds that I measured plain Mercurial as taking to run "
|
dongsheng@627
|
18057 "<command role=\"hg-cmd\">hg status</command> on a 150,000 file repository. "
|
dongsheng@627
|
18058 "With the <literal role=\"hg-ext\">inotify</literal> extension enabled, the "
|
dongsheng@627
|
18059 "time dropped to 0.1 seconds, a factor of <emphasis>one hundred</emphasis> "
|
dongsheng@627
|
18060 "faster."
|
dongsheng@627
|
18061 msgstr ""
|
dongsheng@627
|
18062
|
dongsheng@627
|
18063 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18064 #: ../en/ch14-hgext.xml:115
|
dongsheng@627
|
18065 msgid "Before we continue, please pay attention to some caveats."
|
dongsheng@627
|
18066 msgstr ""
|
dongsheng@627
|
18067
|
dongsheng@627
|
18068 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
18069 #: ../en/ch14-hgext.xml:118
|
dongsheng@627
|
18070 msgid ""
|
dongsheng@627
|
18071 "The <literal role=\"hg-ext\">inotify</literal> extension is Linux-specific. "
|
dongsheng@627
|
18072 "Because it interfaces directly to the Linux kernel's <literal>inotify</"
|
dongsheng@627
|
18073 "literal> subsystem, it does not work on other operating systems."
|
dongsheng@627
|
18074 msgstr ""
|
dongsheng@627
|
18075
|
dongsheng@627
|
18076 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
18077 #: ../en/ch14-hgext.xml:123
|
dongsheng@627
|
18078 msgid ""
|
dongsheng@627
|
18079 "It should work on any Linux distribution that was released after early 2005. "
|
dongsheng@627
|
18080 "Older distributions are likely to have a kernel that lacks <literal>inotify</"
|
dongsheng@627
|
18081 "literal>, or a version of <literal>glibc</literal> that does not have the "
|
dongsheng@627
|
18082 "necessary interfacing support."
|
dongsheng@627
|
18083 msgstr ""
|
dongsheng@627
|
18084
|
dongsheng@627
|
18085 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
|
dongsheng@714
|
18086 #: ../en/ch14-hgext.xml:130
|
dongsheng@627
|
18087 msgid ""
|
dongsheng@627
|
18088 "Not all filesystems are suitable for use with the <literal role=\"hg-ext"
|
dongsheng@627
|
18089 "\">inotify</literal> extension. Network filesystems such as NFS are a non-"
|
dongsheng@627
|
18090 "starter, for example, particularly if you're running Mercurial on several "
|
dongsheng@627
|
18091 "systems, all mounting the same network filesystem. The kernel's "
|
dongsheng@627
|
18092 "<literal>inotify</literal> system has no way of knowing about changes made on "
|
dongsheng@627
|
18093 "another system. Most local filesystems (e.g. ext3, XFS, ReiserFS) should "
|
dongsheng@627
|
18094 "work fine."
|
dongsheng@627
|
18095 msgstr ""
|
dongsheng@627
|
18096
|
dongsheng@627
|
18097 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18098 #: ../en/ch14-hgext.xml:141
|
dongsheng@627
|
18099 msgid ""
|
dongsheng@627
|
18100 "The <literal role=\"hg-ext\">inotify</literal> extension is not yet shipped "
|
dongsheng@627
|
18101 "with Mercurial as of May 2007, so it's a little more involved to set up than "
|
dongsheng@627
|
18102 "other extensions. But the performance improvement is worth it!"
|
dongsheng@627
|
18103 msgstr ""
|
dongsheng@627
|
18104
|
dongsheng@627
|
18105 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18106 #: ../en/ch14-hgext.xml:146
|
dongsheng@627
|
18107 msgid ""
|
dongsheng@627
|
18108 "The extension currently comes in two parts: a set of patches to the Mercurial "
|
dongsheng@627
|
18109 "source code, and a library of Python bindings to the <literal>inotify</"
|
dongsheng@627
|
18110 "literal> subsystem."
|
dongsheng@627
|
18111 msgstr ""
|
dongsheng@627
|
18112
|
dongsheng@627
|
18113 #. type: Content of: <book><chapter><sect1><note><para>
|
dongsheng@714
|
18114 #: ../en/ch14-hgext.xml:150
|
dongsheng@627
|
18115 msgid ""
|
dongsheng@627
|
18116 "There are <emphasis>two</emphasis> Python <literal>inotify</literal> binding "
|
dongsheng@627
|
18117 "libraries. One of them is called <literal>pyinotify</literal>, and is "
|
dongsheng@627
|
18118 "packaged by some Linux distributions as <literal>python-inotify</literal>. "
|
dongsheng@627
|
18119 "This is <emphasis>not</emphasis> the one you'll need, as it is too buggy and "
|
dongsheng@627
|
18120 "inefficient to be practical."
|
dongsheng@627
|
18121 msgstr ""
|
dongsheng@627
|
18122
|
dongsheng@627
|
18123 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18124 #: ../en/ch14-hgext.xml:157
|
dongsheng@627
|
18125 msgid ""
|
dongsheng@627
|
18126 "To get going, it's best to already have a functioning copy of Mercurial "
|
dongsheng@627
|
18127 "installed."
|
dongsheng@627
|
18128 msgstr ""
|
dongsheng@627
|
18129
|
dongsheng@627
|
18130 #. type: Content of: <book><chapter><sect1><note><para>
|
dongsheng@714
|
18131 #: ../en/ch14-hgext.xml:160
|
dongsheng@627
|
18132 msgid ""
|
dongsheng@627
|
18133 "If you follow the instructions below, you'll be <emphasis>replacing</"
|
dongsheng@627
|
18134 "emphasis> and overwriting any existing installation of Mercurial that you "
|
dongsheng@627
|
18135 "might already have, using the latest <quote>bleeding edge</quote> Mercurial "
|
dongsheng@627
|
18136 "code. Don't say you weren't warned!"
|
dongsheng@627
|
18137 msgstr ""
|
dongsheng@627
|
18138
|
dongsheng@627
|
18139 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@714
|
18140 #: ../en/ch14-hgext.xml:167
|
dongsheng@627
|
18141 msgid ""
|
dongsheng@627
|
18142 "Clone the Python <literal>inotify</literal> binding repository. Build and "
|
dongsheng@627
|
18143 "install it."
|
dongsheng@627
|
18144 msgstr ""
|
dongsheng@627
|
18145
|
dongsheng@627
|
18146 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@714
|
18147 #: ../en/ch14-hgext.xml:174
|
dongsheng@627
|
18148 msgid ""
|
dongsheng@627
|
18149 "Clone the <filename class=\"directory\">crew</filename> Mercurial "
|
dongsheng@627
|
18150 "repository. Clone the <literal role=\"hg-ext\">inotify</literal> patch "
|
dongsheng@627
|
18151 "repository so that Mercurial Queues will be able to apply patches to your "
|
dongsheng@627
|
18152 "cope of the <filename class=\"directory\">crew</filename> repository."
|
dongsheng@627
|
18153 msgstr ""
|
dongsheng@627
|
18154
|
dongsheng@627
|
18155 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@714
|
18156 #: ../en/ch14-hgext.xml:184
|
dongsheng@627
|
18157 msgid ""
|
dongsheng@627
|
18158 "Make sure that you have the Mercurial Queues extension, <literal role=\"hg-ext"
|
songdongsheng@658
|
18159 "\">mq</literal>, enabled. If you've never used MQ, read <xref linkend=\"sec:"
|
songdongsheng@658
|
18160 "mq:start\"/> to get started quickly."
|
dongsheng@627
|
18161 msgstr ""
|
dongsheng@627
|
18162
|
dongsheng@627
|
18163 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@714
|
18164 #: ../en/ch14-hgext.xml:190
|
dongsheng@627
|
18165 msgid ""
|
dongsheng@627
|
18166 "Go into the <filename class=\"directory\">inotify</filename> repo, and apply "
|
dongsheng@627
|
18167 "all of the <literal role=\"hg-ext\">inotify</literal> patches using the "
|
dongsheng@627
|
18168 "<option role=\"hg-ext-mq-cmd-qpush-opt\">hg -a</option> option to the "
|
dongsheng@627
|
18169 "<command role=\"hg-ext-mq\">qpush</command> command."
|
dongsheng@627
|
18170 msgstr ""
|
dongsheng@627
|
18171
|
dongsheng@627
|
18172 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@714
|
18173 #: ../en/ch14-hgext.xml:199
|
dongsheng@627
|
18174 msgid ""
|
dongsheng@627
|
18175 "If you get an error message from <command role=\"hg-ext-mq\">qpush</command>, "
|
dongsheng@627
|
18176 "you should not continue. Instead, ask for help."
|
dongsheng@627
|
18177 msgstr ""
|
dongsheng@627
|
18178
|
dongsheng@627
|
18179 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
|
dongsheng@714
|
18180 #: ../en/ch14-hgext.xml:203
|
dongsheng@627
|
18181 msgid "Build and install the patched version of Mercurial."
|
dongsheng@627
|
18182 msgstr ""
|
dongsheng@627
|
18183
|
dongsheng@627
|
18184 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18185 #: ../en/ch14-hgext.xml:209
|
dongsheng@627
|
18186 msgid ""
|
dongsheng@627
|
18187 "Once you've build a suitably patched version of Mercurial, all you need to do "
|
dongsheng@627
|
18188 "to enable the <literal role=\"hg-ext\">inotify</literal> extension is add an "
|
dongsheng@650
|
18189 "entry to your <filename role=\"special\">~/.hgrc</filename>."
|
dongsheng@650
|
18190 msgstr ""
|
dongsheng@650
|
18191
|
dongsheng@650
|
18192 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18193 #: ../en/ch14-hgext.xml:214
|
dongsheng@627
|
18194 msgid ""
|
dongsheng@627
|
18195 "When the <literal role=\"hg-ext\">inotify</literal> extension is enabled, "
|
dongsheng@627
|
18196 "Mercurial will automatically and transparently start the status daemon the "
|
dongsheng@627
|
18197 "first time you run a command that needs status in a repository. It runs one "
|
dongsheng@627
|
18198 "status daemon per repository."
|
dongsheng@627
|
18199 msgstr ""
|
dongsheng@627
|
18200
|
dongsheng@627
|
18201 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18202 #: ../en/ch14-hgext.xml:220
|
dongsheng@627
|
18203 msgid ""
|
dongsheng@627
|
18204 "The status daemon is started silently, and runs in the background. If you "
|
dongsheng@627
|
18205 "look at a list of running processes after you've enabled the <literal role="
|
dongsheng@627
|
18206 "\"hg-ext\">inotify</literal> extension and run a few commands in different "
|
dongsheng@627
|
18207 "repositories, you'll thus see a few <literal>hg</literal> processes sitting "
|
dongsheng@627
|
18208 "around, waiting for updates from the kernel and queries from Mercurial."
|
dongsheng@627
|
18209 msgstr ""
|
dongsheng@627
|
18210
|
dongsheng@627
|
18211 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18212 #: ../en/ch14-hgext.xml:228
|
dongsheng@627
|
18213 msgid ""
|
dongsheng@627
|
18214 "The first time you run a Mercurial command in a repository when you have the "
|
dongsheng@627
|
18215 "<literal role=\"hg-ext\">inotify</literal> extension enabled, it will run "
|
dongsheng@627
|
18216 "with about the same performance as a normal Mercurial command. This is "
|
dongsheng@627
|
18217 "because the status daemon needs to perform a normal status scan so that it "
|
dongsheng@627
|
18218 "has a baseline against which to apply later updates from the kernel. "
|
dongsheng@627
|
18219 "However, <emphasis>every</emphasis> subsequent command that does any kind of "
|
dongsheng@627
|
18220 "status check should be noticeably faster on repositories of even fairly "
|
dongsheng@627
|
18221 "modest size. Better yet, the bigger your repository is, the greater a "
|
dongsheng@627
|
18222 "performance advantage you'll see. The <literal role=\"hg-ext\">inotify</"
|
dongsheng@627
|
18223 "literal> daemon makes status operations almost instantaneous on repositories "
|
dongsheng@627
|
18224 "of all sizes!"
|
dongsheng@627
|
18225 msgstr ""
|
dongsheng@627
|
18226
|
dongsheng@627
|
18227 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18228 #: ../en/ch14-hgext.xml:242
|
dongsheng@627
|
18229 msgid ""
|
dongsheng@627
|
18230 "If you like, you can manually start a status daemon using the <command role="
|
dongsheng@627
|
18231 "\"hg-ext-inotify\">inserve</command> command. This gives you slightly finer "
|
dongsheng@627
|
18232 "control over how the daemon ought to run. This command will of course only "
|
dongsheng@627
|
18233 "be available when the <literal role=\"hg-ext\">inotify</literal> extension is "
|
dongsheng@627
|
18234 "enabled."
|
dongsheng@627
|
18235 msgstr ""
|
dongsheng@627
|
18236
|
dongsheng@627
|
18237 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18238 #: ../en/ch14-hgext.xml:249
|
dongsheng@627
|
18239 msgid ""
|
dongsheng@627
|
18240 "When you're using the <literal role=\"hg-ext\">inotify</literal> extension, "
|
dongsheng@627
|
18241 "you should notice <emphasis>no difference at all</emphasis> in Mercurial's "
|
songdongsheng@710
|
18242 "behavior, with the sole exception of status-related commands running a whole "
|
dongsheng@627
|
18243 "lot faster than they used to. You should specifically expect that commands "
|
dongsheng@627
|
18244 "will not print different output; neither should they give different results. "
|
dongsheng@627
|
18245 "If either of these situations occurs, please report a bug."
|
dongsheng@627
|
18246 msgstr ""
|
dongsheng@627
|
18247
|
dongsheng@627
|
18248 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
18249 #: ../en/ch14-hgext.xml:260
|
dongsheng@627
|
18250 msgid ""
|
dongsheng@627
|
18251 "Flexible diff support with the <literal role=\"hg-ext\">extdiff</literal> "
|
dongsheng@627
|
18252 "extension"
|
dongsheng@636
|
18253 msgstr "使用扩展 <literal role=\"hg-ext\">extdiff</literal> 以扩展差异支持"
|
dongsheng@627
|
18254
|
dongsheng@627
|
18255 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18256 #: ../en/ch14-hgext.xml:263
|
dongsheng@627
|
18257 msgid ""
|
dongsheng@627
|
18258 "Mercurial's built-in <command role=\"hg-cmd\">hg diff</command> command "
|
dongsheng@627
|
18259 "outputs plaintext unified diffs."
|
dongsheng@627
|
18260 msgstr ""
|
dongsheng@627
|
18261 "Mercurial 内置命令 <command role=\"hg-cmd\">hg diff</command> 的输出与统一差异"
|
dongsheng@627
|
18262 "不同。"
|
dongsheng@627
|
18263
|
dongsheng@627
|
18264 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18265 #: ../en/ch14-hgext.xml:268
|
dongsheng@627
|
18266 msgid ""
|
dongsheng@627
|
18267 "If you would like to use an external tool to display modifications, you'll "
|
dongsheng@627
|
18268 "want to use the <literal role=\"hg-ext\">extdiff</literal> extension. This "
|
dongsheng@627
|
18269 "will let you use, for example, a graphical diff tool."
|
dongsheng@627
|
18270 msgstr ""
|
dongsheng@627
|
18271
|
dongsheng@627
|
18272 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18273 #: ../en/ch14-hgext.xml:273
|
dongsheng@627
|
18274 msgid ""
|
dongsheng@627
|
18275 "The <literal role=\"hg-ext\">extdiff</literal> extension is bundled with "
|
dongsheng@627
|
18276 "Mercurial, so it's easy to set up. In the <literal role=\"rc-extensions"
|
dongsheng@650
|
18277 "\">extensions</literal> section of your <filename role=\"special\">~/.hgrc</"
|
dongsheng@627
|
18278 "filename>, simply add a one-line entry to enable the extension."
|
dongsheng@627
|
18279 msgstr ""
|
dongsheng@627
|
18280
|
dongsheng@627
|
18281 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18282 #: ../en/ch14-hgext.xml:280
|
dongsheng@627
|
18283 msgid ""
|
dongsheng@627
|
18284 "This introduces a command named <command role=\"hg-ext-extdiff\">extdiff</"
|
dongsheng@627
|
18285 "command>, which by default uses your system's <command>diff</command> command "
|
dongsheng@627
|
18286 "to generate a unified diff in the same form as the built-in <command role="
|
dongsheng@627
|
18287 "\"hg-cmd\">hg diff</command> command."
|
dongsheng@627
|
18288 msgstr ""
|
dongsheng@627
|
18289
|
dongsheng@627
|
18290 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18291 #: ../en/ch14-hgext.xml:288
|
dongsheng@627
|
18292 msgid ""
|
dongsheng@627
|
18293 "The result won't be exactly the same as with the built-in <command role=\"hg-"
|
dongsheng@627
|
18294 "cmd\">hg diff</command> variations, because the output of <command>diff</"
|
dongsheng@627
|
18295 "command> varies from one system to another, even when passed the same options."
|
dongsheng@627
|
18296 msgstr ""
|
dongsheng@627
|
18297
|
dongsheng@627
|
18298 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18299 #: ../en/ch14-hgext.xml:293
|
dongsheng@627
|
18300 msgid ""
|
dongsheng@627
|
18301 "As the <quote><literal>making snapshot</literal></quote> lines of output "
|
dongsheng@627
|
18302 "above imply, the <command role=\"hg-ext-extdiff\">extdiff</command> command "
|
dongsheng@627
|
18303 "works by creating two snapshots of your source tree. The first snapshot is "
|
dongsheng@627
|
18304 "of the source revision; the second, of the target revision or working "
|
dongsheng@627
|
18305 "directory. The <command role=\"hg-ext-extdiff\">extdiff</command> command "
|
dongsheng@627
|
18306 "generates these snapshots in a temporary directory, passes the name of each "
|
dongsheng@627
|
18307 "directory to an external diff viewer, then deletes the temporary directory. "
|
dongsheng@627
|
18308 "For efficiency, it only snapshots the directories and files that have changed "
|
dongsheng@627
|
18309 "between the two revisions."
|
dongsheng@627
|
18310 msgstr ""
|
dongsheng@627
|
18311
|
dongsheng@627
|
18312 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18313 #: ../en/ch14-hgext.xml:306
|
dongsheng@627
|
18314 msgid ""
|
dongsheng@627
|
18315 "Snapshot directory names have the same base name as your repository. If your "
|
dongsheng@627
|
18316 "repository path is <filename class=\"directory\">/quux/bar/foo</filename>, "
|
dongsheng@627
|
18317 "then <filename class=\"directory\">foo</filename> will be the name of each "
|
dongsheng@627
|
18318 "snapshot directory. Each snapshot directory name has its changeset ID "
|
dongsheng@627
|
18319 "appended, if appropriate. If a snapshot is of revision "
|
dongsheng@627
|
18320 "<literal>a631aca1083f</literal>, the directory will be named <filename class="
|
dongsheng@627
|
18321 "\"directory\">foo.a631aca1083f</filename>. A snapshot of the working "
|
dongsheng@627
|
18322 "directory won't have a changeset ID appended, so it would just be <filename "
|
dongsheng@627
|
18323 "class=\"directory\">foo</filename> in this example. To see what this looks "
|
dongsheng@627
|
18324 "like in practice, look again at the <command role=\"hg-ext-extdiff\">extdiff</"
|
dongsheng@627
|
18325 "command> example above. Notice that the diff has the snapshot directory "
|
dongsheng@627
|
18326 "names embedded in its header."
|
dongsheng@627
|
18327 msgstr ""
|
dongsheng@627
|
18328
|
dongsheng@627
|
18329 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18330 #: ../en/ch14-hgext.xml:322
|
dongsheng@627
|
18331 msgid ""
|
dongsheng@627
|
18332 "The <command role=\"hg-ext-extdiff\">extdiff</command> command accepts two "
|
dongsheng@627
|
18333 "important options. The <option role=\"hg-ext-extdiff-cmd-extdiff-opt\">hg -p</"
|
dongsheng@627
|
18334 "option> option lets you choose a program to view differences with, instead of "
|
dongsheng@627
|
18335 "<command>diff</command>. With the <option role=\"hg-ext-extdiff-cmd-extdiff-"
|
dongsheng@627
|
18336 "opt\">hg -o</option> option, you can change the options that <command role="
|
dongsheng@627
|
18337 "\"hg-ext-extdiff\">extdiff</command> passes to the program (by default, these "
|
dongsheng@627
|
18338 "options are <quote><literal>-Npru</literal></quote>, which only make sense if "
|
dongsheng@627
|
18339 "you're running <command>diff</command>). In other respects, the <command "
|
dongsheng@627
|
18340 "role=\"hg-ext-extdiff\">extdiff</command> command acts similarly to the built-"
|
dongsheng@627
|
18341 "in <command role=\"hg-cmd\">hg diff</command> command: you use the same "
|
dongsheng@627
|
18342 "option names, syntax, and arguments to specify the revisions you want, the "
|
dongsheng@627
|
18343 "files you want, and so on."
|
dongsheng@627
|
18344 msgstr ""
|
dongsheng@627
|
18345
|
dongsheng@627
|
18346 #
|
dongsheng@627
|
18347 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18348 #: ../en/ch14-hgext.xml:339
|
dongsheng@627
|
18349 msgid ""
|
dongsheng@627
|
18350 "As an example, here's how to run the normal system <command>diff</command> "
|
dongsheng@627
|
18351 "command, getting it to generate context diffs (using the <option role=\"cmd-"
|
dongsheng@627
|
18352 "opt-diff\">-c</option> option) instead of unified diffs, and five lines of "
|
dongsheng@627
|
18353 "context instead of the default three (passing <literal>5</literal> as the "
|
dongsheng@627
|
18354 "argument to the <option role=\"cmd-opt-diff\">-C</option> option)."
|
dongsheng@627
|
18355 msgstr ""
|
dongsheng@627
|
18356
|
dongsheng@627
|
18357 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18358 #: ../en/ch14-hgext.xml:348
|
dongsheng@627
|
18359 msgid ""
|
dongsheng@627
|
18360 "Launching a visual diff tool is just as easy. Here's how to launch the "
|
dongsheng@627
|
18361 "<command>kdiff3</command> viewer."
|
dongsheng@627
|
18362 msgstr ""
|
dongsheng@627
|
18363
|
dongsheng@627
|
18364 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18365 #: ../en/ch14-hgext.xml:352
|
dongsheng@627
|
18366 msgid ""
|
dongsheng@627
|
18367 "If your diff viewing command can't deal with directories, you can easily work "
|
dongsheng@627
|
18368 "around this with a little scripting. For an example of such scripting in "
|
dongsheng@627
|
18369 "action with the <literal role=\"hg-ext\">mq</literal> extension and the "
|
songdongsheng@658
|
18370 "<command>interdiff</command> command, see <xref linkend=\"mq-collab:tips:"
|
songdongsheng@658
|
18371 "interdiff\"/>."
|
dongsheng@627
|
18372 msgstr ""
|
dongsheng@627
|
18373
|
dongsheng@627
|
18374 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
18375 #: ../en/ch14-hgext.xml:360
|
dongsheng@627
|
18376 msgid "Defining command aliases"
|
dongsheng@636
|
18377 msgstr "定义命令的别名"
|
dongsheng@627
|
18378
|
dongsheng@627
|
18379 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
18380 #: ../en/ch14-hgext.xml:362
|
dongsheng@627
|
18381 msgid ""
|
dongsheng@627
|
18382 "It can be cumbersome to remember the options to both the <command role=\"hg-"
|
dongsheng@627
|
18383 "ext-extdiff\">extdiff</command> command and the diff viewer you want to use, "
|
dongsheng@627
|
18384 "so the <literal role=\"hg-ext\">extdiff</literal> extension lets you define "
|
dongsheng@627
|
18385 "<emphasis>new</emphasis> commands that will invoke your diff viewer with "
|
dongsheng@627
|
18386 "exactly the right options."
|
dongsheng@627
|
18387 msgstr ""
|
dongsheng@627
|
18388
|
dongsheng@627
|
18389 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
18390 #: ../en/ch14-hgext.xml:369
|
dongsheng@650
|
18391 msgid ""
|
dongsheng@650
|
18392 "All you need to do is edit your <filename role=\"special\">~/.hgrc</"
|
dongsheng@627
|
18393 "filename>, and add a section named <literal role=\"rc-extdiff\">extdiff</"
|
dongsheng@627
|
18394 "literal>. Inside this section, you can define multiple commands. Here's how "
|
dongsheng@627
|
18395 "to add a <literal>kdiff3</literal> command. Once you've defined this, you "
|
dongsheng@627
|
18396 "can type <quote><literal>hg kdiff3</literal></quote> and the <literal role="
|
dongsheng@627
|
18397 "\"hg-ext\">extdiff</literal> extension will run <command>kdiff3</command> for "
|
dongsheng@627
|
18398 "you."
|
dongsheng@627
|
18399 msgstr ""
|
dongsheng@627
|
18400
|
dongsheng@627
|
18401 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
18402 #: ../en/ch14-hgext.xml:379
|
dongsheng@627
|
18403 msgid ""
|
dongsheng@627
|
18404 "If you leave the right hand side of the definition empty, as above, the "
|
dongsheng@627
|
18405 "<literal role=\"hg-ext\">extdiff</literal> extension uses the name of the "
|
dongsheng@627
|
18406 "command you defined as the name of the external program to run. But these "
|
dongsheng@627
|
18407 "names don't have to be the same. Here, we define a command named "
|
dongsheng@627
|
18408 "<quote><literal>hg wibble</literal></quote>, which runs <command>kdiff3</"
|
dongsheng@627
|
18409 "command>."
|
dongsheng@627
|
18410 msgstr ""
|
dongsheng@627
|
18411
|
dongsheng@627
|
18412 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
18413 #: ../en/ch14-hgext.xml:389
|
dongsheng@627
|
18414 msgid ""
|
dongsheng@627
|
18415 "You can also specify the default options that you want to invoke your diff "
|
dongsheng@627
|
18416 "viewing program with. The prefix to use is <quote><literal>opts.</literal></"
|
dongsheng@627
|
18417 "quote>, followed by the name of the command to which the options apply. This "
|
dongsheng@627
|
18418 "example defines a <quote><literal>hg vimdiff</literal></quote> command that "
|
dongsheng@627
|
18419 "runs the <command>vim</command> editor's <literal>DirDiff</literal> extension."
|
dongsheng@627
|
18420 msgstr ""
|
dongsheng@627
|
18421
|
dongsheng@627
|
18422 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
18423 #: ../en/ch14-hgext.xml:403
|
dongsheng@627
|
18424 msgid ""
|
dongsheng@627
|
18425 "Cherrypicking changes with the <literal role=\"hg-ext\">transplant</literal> "
|
dongsheng@627
|
18426 "extension"
|
dongsheng@636
|
18427 msgstr "使用扩展 <literal role=\"hg-ext\">transplant</literal> 以挑选修改"
|
dongsheng@627
|
18428
|
dongsheng@627
|
18429 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18430 #: ../en/ch14-hgext.xml:406
|
dongsheng@627
|
18431 msgid "Need to have a long chat with Brendan about this."
|
dongsheng@627
|
18432 msgstr ""
|
dongsheng@627
|
18433
|
dongsheng@627
|
18434 #. type: Content of: <book><chapter><sect1><title>
|
dongsheng@714
|
18435 #: ../en/ch14-hgext.xml:410
|
dongsheng@627
|
18436 msgid ""
|
dongsheng@627
|
18437 "Send changes via email with the <literal role=\"hg-ext\">patchbomb</literal> "
|
dongsheng@627
|
18438 "extension"
|
dongsheng@627
|
18439 msgstr ""
|
dongsheng@636
|
18440 "使用扩展 <literal role=\"hg-ext\">patchbomb</literal> 通过 email 发送修改"
|
dongsheng@627
|
18441
|
dongsheng@627
|
18442 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18443 #: ../en/ch14-hgext.xml:413
|
dongsheng@627
|
18444 msgid ""
|
dongsheng@627
|
18445 "Many projects have a culture of <quote>change review</quote>, in which people "
|
dongsheng@627
|
18446 "send their modifications to a mailing list for others to read and comment on "
|
dongsheng@627
|
18447 "before they commit the final version to a shared repository. Some projects "
|
dongsheng@627
|
18448 "have people who act as gatekeepers; they apply changes from other people to a "
|
dongsheng@627
|
18449 "repository to which those others don't have access."
|
dongsheng@627
|
18450 msgstr ""
|
dongsheng@627
|
18451
|
dongsheng@627
|
18452 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18453 #: ../en/ch14-hgext.xml:421
|
dongsheng@627
|
18454 msgid ""
|
dongsheng@627
|
18455 "Mercurial makes it easy to send changes over email for review or application, "
|
dongsheng@627
|
18456 "via its <literal role=\"hg-ext\">patchbomb</literal> extension. The "
|
dongsheng@627
|
18457 "extension is so named because changes are formatted as patches, and it's "
|
dongsheng@627
|
18458 "usual to send one changeset per email message. Sending a long series of "
|
dongsheng@627
|
18459 "changes by email is thus much like <quote>bombing</quote> the recipient's "
|
dongsheng@627
|
18460 "inbox, hence <quote>patchbomb</quote>."
|
dongsheng@627
|
18461 msgstr ""
|
dongsheng@627
|
18462
|
dongsheng@627
|
18463 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18464 #: ../en/ch14-hgext.xml:429
|
dongsheng@627
|
18465 msgid ""
|
dongsheng@627
|
18466 "As usual, the basic configuration of the <literal role=\"hg-ext\">patchbomb</"
|
dongsheng@627
|
18467 "literal> extension takes just one or two lines in your <filename role="
|
dongsheng@627
|
18468 "\"special\"> /.hgrc</filename>."
|
dongsheng@627
|
18469 msgstr ""
|
dongsheng@627
|
18470
|
dongsheng@627
|
18471 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18472 #: ../en/ch14-hgext.xml:435
|
dongsheng@627
|
18473 msgid ""
|
dongsheng@627
|
18474 "Once you've enabled the extension, you will have a new command available, "
|
dongsheng@627
|
18475 "named <command role=\"hg-ext-patchbomb\">email</command>."
|
dongsheng@627
|
18476 msgstr ""
|
dongsheng@627
|
18477
|
dongsheng@627
|
18478 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18479 #: ../en/ch14-hgext.xml:439
|
dongsheng@627
|
18480 msgid ""
|
dongsheng@627
|
18481 "The safest and best way to invoke the <command role=\"hg-ext-patchbomb"
|
dongsheng@627
|
18482 "\">email</command> command is to <emphasis>always</emphasis> run it first "
|
dongsheng@627
|
18483 "with the <option role=\"hg-ext-patchbomb-cmd-email-opt\">hg -n</option> "
|
dongsheng@627
|
18484 "option. This will show you what the command <emphasis>would</emphasis> send, "
|
dongsheng@627
|
18485 "without actually sending anything. Once you've had a quick glance over the "
|
dongsheng@627
|
18486 "changes and verified that you are sending the right ones, you can rerun the "
|
dongsheng@627
|
18487 "same command, with the <option role=\"hg-ext-patchbomb-cmd-email-opt\">hg -n</"
|
dongsheng@627
|
18488 "option> option removed."
|
dongsheng@627
|
18489 msgstr ""
|
dongsheng@627
|
18490
|
dongsheng@627
|
18491 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18492 #: ../en/ch14-hgext.xml:450
|
dongsheng@627
|
18493 msgid ""
|
dongsheng@627
|
18494 "The <command role=\"hg-ext-patchbomb\">email</command> command accepts the "
|
dongsheng@627
|
18495 "same kind of revision syntax as every other Mercurial command. For example, "
|
dongsheng@627
|
18496 "this command will send every revision between 7 and <literal>tip</literal>, "
|
dongsheng@627
|
18497 "inclusive."
|
dongsheng@627
|
18498 msgstr ""
|
dongsheng@627
|
18499
|
dongsheng@627
|
18500 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18501 #: ../en/ch14-hgext.xml:455
|
dongsheng@627
|
18502 msgid ""
|
dongsheng@627
|
18503 "You can also specify a <emphasis>repository</emphasis> to compare with. If "
|
dongsheng@627
|
18504 "you provide a repository but no revisions, the <command role=\"hg-ext-"
|
dongsheng@627
|
18505 "patchbomb\">email</command> command will send all revisions in the local "
|
dongsheng@627
|
18506 "repository that are not present in the remote repository. If you "
|
dongsheng@627
|
18507 "additionally specify revisions or a branch name (the latter using the <option "
|
dongsheng@627
|
18508 "role=\"hg-ext-patchbomb-cmd-email-opt\">hg -b</option> option), this will "
|
dongsheng@627
|
18509 "constrain the revisions sent."
|
dongsheng@627
|
18510 msgstr ""
|
dongsheng@627
|
18511
|
dongsheng@627
|
18512 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18513 #: ../en/ch14-hgext.xml:464
|
dongsheng@627
|
18514 msgid ""
|
dongsheng@627
|
18515 "It's perfectly safe to run the <command role=\"hg-ext-patchbomb\">email</"
|
dongsheng@627
|
18516 "command> command without the names of the people you want to send to: if you "
|
dongsheng@627
|
18517 "do this, it will just prompt you for those values interactively. (If you're "
|
dongsheng@627
|
18518 "using a Linux or Unix-like system, you should have enhanced "
|
dongsheng@627
|
18519 "<literal>readline</literal>-style editing capabilities when entering those "
|
dongsheng@627
|
18520 "headers, too, which is useful.)"
|
dongsheng@627
|
18521 msgstr ""
|
dongsheng@627
|
18522
|
dongsheng@627
|
18523 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18524 #: ../en/ch14-hgext.xml:472
|
dongsheng@627
|
18525 msgid ""
|
dongsheng@627
|
18526 "When you are sending just one revision, the <command role=\"hg-ext-patchbomb"
|
dongsheng@627
|
18527 "\">email</command> command will by default use the first line of the "
|
dongsheng@627
|
18528 "changeset description as the subject of the single email message it sends."
|
dongsheng@627
|
18529 msgstr ""
|
dongsheng@627
|
18530
|
dongsheng@627
|
18531 #. type: Content of: <book><chapter><sect1><para>
|
dongsheng@714
|
18532 #: ../en/ch14-hgext.xml:477
|
dongsheng@627
|
18533 msgid ""
|
dongsheng@627
|
18534 "If you send multiple revisions, the <command role=\"hg-ext-patchbomb\">email</"
|
dongsheng@627
|
18535 "command> command will usually send one message per changeset. It will "
|
dongsheng@627
|
18536 "preface the series with an introductory message, in which you should describe "
|
dongsheng@627
|
18537 "the purpose of the series of changes you're sending."
|
dongsheng@627
|
18538 msgstr ""
|
dongsheng@627
|
18539
|
dongsheng@627
|
18540 #. type: Content of: <book><chapter><sect1><sect2><title>
|
dongsheng@714
|
18541 #: ../en/ch14-hgext.xml:484
|
songdongsheng@710
|
18542 msgid "Changing the behavior of patchbombs"
|
dongsheng@636
|
18543 msgstr "修改 patchbomb 的行为"
|
dongsheng@627
|
18544
|
dongsheng@627
|
18545 #. type: Content of: <book><chapter><sect1><sect2><para>
|
dongsheng@714
|
18546 #: ../en/ch14-hgext.xml:486
|
dongsheng@627
|
18547 msgid ""
|
dongsheng@627
|
18548 "Not every project has exactly the same conventions for sending changes in "
|
dongsheng@627
|
18549 "email; the <literal role=\"hg-ext\">patchbomb</literal> extension tries to "
|
dongsheng@627
|
18550 "accommodate a number of variations through command line options."
|
dongsheng@627
|
18551 msgstr ""
|
dongsheng@627
|
18552
|
dongsheng@627
|
18553 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
18554 #: ../en/ch14-hgext.xml:492
|
dongsheng@627
|
18555 msgid ""
|
dongsheng@627
|
18556 "You can write a subject for the introductory message on the command line "
|
dongsheng@627
|
18557 "using the <option role=\"hg-ext-patchbomb-cmd-email-opt\">hg -s</option> "
|
dongsheng@627
|
18558 "option. This takes one argument, the text of the subject to use."
|
dongsheng@627
|
18559 msgstr ""
|
dongsheng@627
|
18560
|
dongsheng@627
|
18561 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
18562 #: ../en/ch14-hgext.xml:498
|
dongsheng@627
|
18563 msgid ""
|
dongsheng@627
|
18564 "To change the email address from which the messages originate, use the "
|
dongsheng@627
|
18565 "<option role=\"hg-ext-patchbomb-cmd-email-opt\">hg -f</option> option. This "
|
dongsheng@627
|
18566 "takes one argument, the email address to use."
|
dongsheng@627
|
18567 msgstr ""
|
dongsheng@627
|
18568
|
dongsheng@627
|
18569 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
18570 #: ../en/ch14-hgext.xml:504
|
dongsheng@627
|
18571 msgid ""
|
songdongsheng@710
|
18572 "The default behavior is to send unified diffs (see <xref linkend=\"sec:mq:"
|
songdongsheng@658
|
18573 "patch\"/> for a description of the format), one per message. You can send a "
|
songdongsheng@658
|
18574 "binary bundle instead with the <option role=\"hg-ext-patchbomb-cmd-email-opt"
|
songdongsheng@658
|
18575 "\">hg -b</option> option."
|
dongsheng@627
|
18576 msgstr ""
|
dongsheng@627
|
18577
|
dongsheng@627
|
18578 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
18579 #: ../en/ch14-hgext.xml:512
|
dongsheng@627
|
18580 msgid ""
|
dongsheng@627
|
18581 "Unified diffs are normally prefaced with a metadata header. You can omit "
|
dongsheng@627
|
18582 "this, and send unadorned diffs, with the <option role=\"hg-ext-patchbomb-cmd-"
|
dongsheng@627
|
18583 "email-opt\">hg --plain</option> option."
|
dongsheng@627
|
18584 msgstr ""
|
dongsheng@627
|
18585
|
dongsheng@627
|
18586 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
18587 #: ../en/ch14-hgext.xml:518
|
dongsheng@627
|
18588 msgid ""
|
dongsheng@627
|
18589 "Diffs are normally sent <quote>inline</quote>, in the same body part as the "
|
dongsheng@627
|
18590 "description of a patch. This makes it easiest for the largest number of "
|
dongsheng@627
|
18591 "readers to quote and respond to parts of a diff, as some mail clients will "
|
dongsheng@627
|
18592 "only quote the first MIME body part in a message. If you'd prefer to send the "
|
dongsheng@627
|
18593 "description and the diff in separate body parts, use the <option role=\"hg-"
|
dongsheng@627
|
18594 "ext-patchbomb-cmd-email-opt\">hg -a</option> option."
|
dongsheng@627
|
18595 msgstr ""
|
dongsheng@627
|
18596
|
dongsheng@627
|
18597 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
18598 #: ../en/ch14-hgext.xml:528
|
dongsheng@627
|
18599 msgid ""
|
dongsheng@627
|
18600 "Instead of sending mail messages, you can write them to an <literal>mbox</"
|
dongsheng@627
|
18601 "literal>-format mail folder using the <option role=\"hg-ext-patchbomb-cmd-"
|
dongsheng@627
|
18602 "email-opt\">hg -m</option> option. That option takes one argument, the name "
|
dongsheng@627
|
18603 "of the file to write to."
|
dongsheng@627
|
18604 msgstr ""
|
dongsheng@627
|
18605
|
dongsheng@627
|
18606 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
|
dongsheng@714
|
18607 #: ../en/ch14-hgext.xml:535
|
dongsheng@627
|
18608 msgid ""
|
dongsheng@627
|
18609 "If you would like to add a <command>diffstat</command>-format summary to each "
|
dongsheng@627
|
18610 "patch, and one to the introductory message, use the <option role=\"hg-ext-"
|
dongsheng@627
|
18611 "patchbomb-cmd-email-opt\">hg -d</option> option. The <command>diffstat</"
|
dongsheng@627
|
18612 "command> command displays a table containing the name of each file patched, "
|
dongsheng@627
|
18613 "the number of lines affected, and a histogram showing how much each file is "
|
dongsheng@627
|
18614 "modified. This gives readers a qualitative glance at how complex a patch is."
|
dongsheng@627
|
18615 msgstr ""
|