hgbook

annotate po/zh.po @ 1059:b098ca24c0ad

1.7 zh translated
author zhaopingsun
date Tue Nov 10 20:39:23 2009 -0500 (2009-11-10)
parents e8c480caa169
children 85265d2079fd
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 &lt;aristotle@phil.example.gr&gt;</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/&lt;catalog page&gt;\"></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 &lt;url&gt; 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 ""
zhaopingsun@1041 3086 "在你继续阅读之前,请理解本节完全反映了我的个人经验,兴趣,和偏好(我敢说)。下"
zhaopingsun@1041 3087 "面列的每个版本控制工具我都使用过,大多数情况下都用过好几年。"
dongsheng@653 3088
dongsheng@714 3089 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3090 #: ../en/ch01-intro.xml:418
dongsheng@653 3091 msgid ""
dongsheng@653 3092 "Subversion is a popular revision control tool, developed to replace CVS. It "
dongsheng@653 3093 "has a centralised client/server architecture."
dongsheng@653 3094 msgstr ""
zhaopingsun@1041 3095 "Subversion是一个流行的版本控制工具,是用来替代CVS的,它采用的是集中式的客户/服"
zhaopingsun@1041 3096 "务器结构。"
dongsheng@653 3097
dongsheng@714 3098 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3099 #: ../en/ch01-intro.xml:422
dongsheng@653 3100 msgid ""
dongsheng@653 3101 "Subversion and Mercurial have similarly named commands for performing the "
dongsheng@653 3102 "same operations, so if you're familiar with one, it is easy to learn to use "
dongsheng@653 3103 "the other. Both tools are portable to all popular operating systems."
dongsheng@653 3104 msgstr ""
zhaopingsun@1041 3105 "Subversion和Mercurial相同操作的命令的命名上非常相似,所以如果你熟悉一个,很容"
zhaopingsun@1041 3106 "易学会另外一个,两个工具都可以在大多数平台上运行。"
dongsheng@653 3107
dongsheng@714 3108 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3109 #: ../en/ch01-intro.xml:427
dongsheng@653 3110 msgid ""
dongsheng@653 3111 "Prior to version 1.5, Subversion had no useful support for merges. At the "
dongsheng@653 3112 "time of writing, its merge tracking capability is new, and known to be <ulink "
dongsheng@653 3113 "url=\"http://svnbook.red-bean.com/nightly/en/svn.branchmerge.advanced."
dongsheng@653 3114 "html#svn.branchmerge.advanced.finalword\">complicated and buggy</ulink>."
dongsheng@653 3115 msgstr ""
zhaopingsun@1041 3116 "在1.5版之前,Subversion对合并的支持并不好。在我写本书的时候,它刚新增了并跟踪"
zhaopingsun@1041 3117 "的功能,出名的<ulink url=\"http://svnbook.red-bean.com/nightly/en/svn."
zhaopingsun@1041 3118 "branchmerge.advanced.html#svn.branchmerge.advanced.finalword\">复杂和容易出错"
zhaopingsun@1041 3119 "</ulink>。"
dongsheng@653 3120
dongsheng@714 3121 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3122 #: ../en/ch01-intro.xml:433
dongsheng@653 3123 msgid ""
dongsheng@653 3124 "Mercurial has a substantial performance advantage over Subversion on every "
dongsheng@653 3125 "revision control operation I have benchmarked. I have measured its advantage "
dongsheng@653 3126 "as ranging from a factor of two to a factor of six when compared with "
dongsheng@653 3127 "Subversion 1.4.3's <emphasis>ra_local</emphasis> file store, which is the "
dongsheng@653 3128 "fastest access method available. In more realistic deployments involving a "
dongsheng@653 3129 "network-based store, Subversion will be at a substantially larger "
dongsheng@653 3130 "disadvantage. Because many Subversion commands must talk to the server and "
dongsheng@653 3131 "Subversion does not have useful replication facilities, server capacity and "
dongsheng@653 3132 "network bandwidth become bottlenecks for modestly large projects."
dongsheng@653 3133 msgstr ""
zhaopingsun@1041 3134 "在我测量过的每个版本控制操作上Mercurial都比Subversion有很大的性能优势。差距从"
zhaopingsun@1041 3135 "两个数量级到六个数量级不等,我用的是Subversion 1.4.3的<emphasis>ra_local</"
zhaopingsun@1041 3136 "emphasis>文件存储方式,这是已知的最快的存取方式了。在实际的部署中包括网络存"
zhaopingsun@1041 3137 "储,那么Subversion的劣势更大。因为很多Subversion命令必须和主机交互,并且因为"
zhaopingsun@1041 3138 "Subversion没有好的复制机制,使得对于中的等大小的项目而言,服务器容量和网络带宽"
zhaopingsun@1041 3139 "成为主要瓶颈。"
dongsheng@653 3140
dongsheng@714 3141 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3142 #: ../en/ch01-intro.xml:446
dongsheng@653 3143 msgid ""
dongsheng@653 3144 "Additionally, Subversion incurs substantial storage overhead to avoid network "
dongsheng@653 3145 "transactions for a few common operations, such as finding modified files "
dongsheng@653 3146 "(<literal>status</literal>) and displaying modifications against the current "
dongsheng@653 3147 "revision (<literal>diff</literal>). As a result, a Subversion working copy "
dongsheng@653 3148 "is often the same size as, or larger than, a Mercurial repository and working "
dongsheng@653 3149 "directory, even though the Mercurial repository contains a complete history "
dongsheng@653 3150 "of the project."
dongsheng@653 3151 msgstr ""
dongsheng@653 3152
dongsheng@714 3153 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3154 #: ../en/ch01-intro.xml:456
dongsheng@653 3155 msgid ""
dongsheng@653 3156 "Subversion is widely supported by third party tools. Mercurial currently "
dongsheng@653 3157 "lags considerably in this area. This gap is closing, however, and indeed "
dongsheng@653 3158 "some of Mercurial's GUI tools now outshine their Subversion equivalents. "
dongsheng@653 3159 "Like Mercurial, Subversion has an excellent user manual."
zhaopingsun@1042 3160 msgstr "Subversion有很多的第三方工具支持。Mercurial现在在这方面稍微欠缺。"
zhaopingsun@1042 3161 "然而,差距正在逐渐缩小,实际上一些有Mercurial的GUI工具比Subversion类似工具还略胜一筹。和Mercurial一样,Subversion也有完善的用户手册。"
dongsheng@653 3162
dongsheng@714 3163 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3164 #: ../en/ch01-intro.xml:462
dongsheng@653 3165 msgid ""
dongsheng@653 3166 "Because Subversion doesn't store revision history on the client, it is well "
dongsheng@653 3167 "suited to managing projects that deal with lots of large, opaque binary "
dongsheng@653 3168 "files. If you check in fifty revisions to an incompressible 10MB file, "
dongsheng@653 3169 "Subversion's client-side space usage stays constant The space used by any "
dongsheng@653 3170 "distributed SCM will grow rapidly in proportion to the number of revisions, "
dongsheng@653 3171 "because the differences between each revision are large."
zhaopingsun@1042 3172 msgstr "因为Subversion并不在客户端存储版本历史,这很适合管理那些有很多大的二进制文件的项目。"
zhaopingsun@1042 3173 "如果你对一个未压缩的10MB文件检入了五十次,Subversion客户端的占用的磁盘空间基本上保持不变。"
zhaopingsun@1042 3174 "而分布式SCM软件则会随着版本数量的增加,空间迅速增长,因为每个版本之间的差异非常大。"
dongsheng@653 3175
dongsheng@714 3176 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3177 #: ../en/ch01-intro.xml:471
dongsheng@653 3178 msgid ""
dongsheng@653 3179 "In addition, it's often difficult or, more usually, impossible to merge "
dongsheng@653 3180 "different versions of a binary file. Subversion's ability to let a user lock "
dongsheng@653 3181 "a file, so that they temporarily have the exclusive right to commit changes "
dongsheng@653 3182 "to it, can be a significant advantage to a project where binary files are "
dongsheng@653 3183 "widely used."
zhaopingsun@1044 3184 msgstr "另外,合并不同版本的二进制文件非常困难,换句话说,基本事实不可能。Subversion"
zhaopingsun@1044 3185 "提供锁定功能,用户锁定一个文件,这样他就取得了对这个文件临时的独占的提交权限,这对于广泛使用二进制文件的项目而言是个优势。"
dongsheng@653 3186
dongsheng@714 3187 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3188 #: ../en/ch01-intro.xml:478
dongsheng@653 3189 msgid ""
dongsheng@653 3190 "Mercurial can import revision history from a Subversion repository. It can "
dongsheng@653 3191 "also export revision history to a Subversion repository. This makes it easy "
dongsheng@653 3192 "to <quote>test the waters</quote> and use Mercurial and Subversion in "
dongsheng@653 3193 "parallel before deciding to switch. History conversion is incremental, so "
dongsheng@653 3194 "you can perform an initial conversion, then small additional conversions "
dongsheng@653 3195 "afterwards to bring in new changes."
zhaopingsun@1044 3196 msgstr "Mercurial可以从Subversion的版本库中导入历史版本。它也可以向Subversion的版本库输出历史版本。"
zhaopingsun@1044 3197 "这样在决定转换之前很容易先<quote>试一下水</quote>,同时并行的使用Mercurial和Subversion。版本史的转换是"
zhaopingsun@1044 3198 "递增的,你可以先构造一个初始版本,每次有了新的更改后加入一个小的转换。"
dongsheng@653 3199
dongsheng@714 3200 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 3201 #: ../en/ch01-intro.xml:490 ../en/ch01-intro.xml:629
dongsheng@653 3202 msgid "Git"
songdongsheng@668 3203 msgstr "Git"
dongsheng@653 3204
dongsheng@714 3205 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3206 #: ../en/ch01-intro.xml:492
dongsheng@653 3207 msgid ""
dongsheng@653 3208 "Git is a distributed revision control tool that was developed for managing "
dongsheng@653 3209 "the Linux kernel source tree. Like Mercurial, its early design was somewhat "
dongsheng@653 3210 "influenced by Monotone."
zhaopingsun@1046 3211 msgstr "Git是为了管理Linux内核代码而开发的一个分布式版本控制工具。和Mercurial一样,它在设计上受了Monotone的影响。"
dongsheng@653 3212
dongsheng@714 3213 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3214 #: ../en/ch01-intro.xml:497
dongsheng@653 3215 msgid ""
dongsheng@653 3216 "Git has a very large command set, with version 1.5.0 providing 139 individual "
dongsheng@653 3217 "commands. It has something of a reputation for being difficult to learn. "
dongsheng@653 3218 "Compared to Git, Mercurial has a strong focus on simplicity."
zhaopingsun@1046 3219 msgstr "Git有非常大的命令集,1.5.0版本提供了139个单独的命令。它以难学而闻名。与Git相比,Mercurial力求简洁。"
dongsheng@653 3220
dongsheng@714 3221 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3222 #: ../en/ch01-intro.xml:502
dongsheng@653 3223 msgid ""
dongsheng@653 3224 "In terms of performance, Git is extremely fast. In several cases, it is "
dongsheng@653 3225 "faster than Mercurial, at least on Linux, while Mercurial performs better on "
dongsheng@653 3226 "other operations. However, on Windows, the performance and general level of "
dongsheng@653 3227 "support that Git provides is, at the time of writing, far behind that of "
dongsheng@653 3228 "Mercurial."
zhaopingsun@1046 3229 msgstr "就性能而言,Git非常快。在很多情况下,它比Mercurial快,至少在Linux上,"
zhaopingsun@1046 3230 "但Mercurial在其它操作上有优势。而在Windows上,Git不管是性能还是提供的支持,"
zhaopingsun@1046 3231 "至少在本书写作的时候,都比Mercurial差很多。"
dongsheng@653 3232
dongsheng@714 3233 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3234 #: ../en/ch01-intro.xml:509
dongsheng@653 3235 msgid ""
dongsheng@653 3236 "While a Mercurial repository needs no maintenance, a Git repository requires "
dongsheng@653 3237 "frequent manual <quote>repacks</quote> of its metadata. Without these, "
dongsheng@653 3238 "performance degrades, while space usage grows rapidly. A server that "
dongsheng@653 3239 "contains many Git repositories that are not rigorously and frequently "
dongsheng@653 3240 "repacked will become heavily disk-bound during backups, and there have been "
dongsheng@653 3241 "instances of daily backups taking far longer than 24 hours as a result. A "
dongsheng@653 3242 "freshly packed Git repository is slightly smaller than a Mercurial "
dongsheng@653 3243 "repository, but an unpacked repository is several orders of magnitude larger."
zhaopingsun@1049 3244 msgstr "Mercurial的版本库不需要维护,而Git的版本库需要频繁的手工将其元数据<quote>repacks</quote>"
zhaopingsun@1049 3245 "如果不这样做,性能就会下降,磁盘空间也会迅速增加。有多个Git版本库的服务器需要严格和频繁的重新打包"
zhaopingsun@1049 3246 "否则在备份的时候就会成为严重的磁盘瓶颈,曾经有日备份超过24小时的例子。一个新打包的Git版本库"
zhaopingsun@1049 3247 "比Mercurial稍小一些,但是未打包的版本库则会大几个数量级。"
dongsheng@714 3248 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3249 #: ../en/ch01-intro.xml:520
dongsheng@653 3250 msgid ""
dongsheng@653 3251 "The core of Git is written in C. Many Git commands are implemented as shell "
dongsheng@653 3252 "or Perl scripts, and the quality of these scripts varies widely. I have "
dongsheng@653 3253 "encountered several instances where scripts charged along blindly in the "
dongsheng@653 3254 "presence of errors that should have been fatal."
zhaopingsun@1049 3255 msgstr "Git核心由C语言编写,许多Git命令是用shell或者perl脚本实现的,这些脚本的质量差别很大。"
zhaopingsun@1049 3256 "我碰到过几次已经出现了致命错误了,那些脚本还在盲目的执行。"
dongsheng@653 3257
dongsheng@714 3258 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3259 #: ../en/ch01-intro.xml:526
dongsheng@653 3260 msgid "Mercurial can import revision history from a Git repository."
zhaopingsun@1049 3261 msgstr "Mercurial可以从Git的版本库中导入版本历史。"
dongsheng@653 3262
dongsheng@714 3263 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3264 #: ../en/ch01-intro.xml:534
dongsheng@653 3265 msgid ""
dongsheng@653 3266 "CVS is probably the most widely used revision control tool in the world. Due "
dongsheng@653 3267 "to its age and internal untidiness, it has been only lightly maintained for "
dongsheng@653 3268 "many years."
zhaopingsun@1049 3269 msgstr "CVS可能是世界上使用最广泛的版本控制工具。因为它是太古老和核心复杂,许多年来都处于维护状态。"
dongsheng@653 3270
dongsheng@714 3271 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3272 #: ../en/ch01-intro.xml:538
dongsheng@653 3273 msgid ""
dongsheng@653 3274 "It has a centralised client/server architecture. It does not group related "
dongsheng@653 3275 "file changes into atomic commits, making it easy for people to <quote>break "
dongsheng@653 3276 "the build</quote>: one person can successfully commit part of a change and "
dongsheng@653 3277 "then be blocked by the need for a merge, causing other people to see only a "
dongsheng@653 3278 "portion of the work they intended to do. This also affects how you work with "
dongsheng@653 3279 "project history. If you want to see all of the modifications someone made as "
dongsheng@653 3280 "part of a task, you will need to manually inspect the descriptions and "
dongsheng@653 3281 "timestamps of the changes made to each file involved (if you even know what "
dongsheng@653 3282 "those files were)."
zhaopingsun@1049 3283 msgstr "它采用的是集中式客户/服务器结构。它不会将相关的文件变更作为原子提交,"
zhaopingsun@1049 3284 "这使得它很容易<quote>毁坏创建</quote>:一个人成功的提交了一部分更改,然后他必须停下来"
zhaopingsun@1049 3285 "处理合并,这使得其他人只能看见他们的部分工作。这样影响力你如何和版本史进行工作。"
zhaopingsun@1049 3286 "如果你想看到其他人作为一部分任务的全部修改,你必须手动检查每个文件的变更描述和时间戳"
zhaopingsun@1049 3287 "(假如你知道是那些文件)。"
dongsheng@714 3288 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3289 #: ../en/ch01-intro.xml:550
dongsheng@653 3290 msgid ""
dongsheng@653 3291 "CVS has a muddled notion of tags and branches that I will not attempt to even "
dongsheng@653 3292 "describe. It does not support renaming of files or directories well, making "
dongsheng@653 3293 "it easy to corrupt a repository. It has almost no internal consistency "
dongsheng@653 3294 "checking capabilities, so it is usually not even possible to tell whether or "
dongsheng@653 3295 "how a repository is corrupt. I would not recommend CVS for any project, "
dongsheng@653 3296 "existing or new."
zhaopingsun@1056 3297 msgstr "CVS的分支和标签的概念实在是太混乱了,我都不想给你介绍。它也不支持文件和目录的重命名。"
zhaopingsun@1056 3298 "这使得版本库非常容易崩溃。它几乎没任何的内部一致性检查的功能,"
zhaopingsun@1056 3299 "所以通常你不可能知道版本库是不是崩溃了。"
zhaopingsun@1051 3300 "不管是新项目还是老项目,我都不推荐使用CVS。"
dongsheng@653 3301
dongsheng@714 3302 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3303 #: ../en/ch01-intro.xml:558
dongsheng@653 3304 msgid ""
dongsheng@653 3305 "Mercurial can import CVS revision history. However, there are a few caveats "
dongsheng@653 3306 "that apply; these are true of every other revision control tool's CVS "
dongsheng@653 3307 "importer, too. Due to CVS's lack of atomic changes and unversioned "
dongsheng@653 3308 "filesystem hierarchy, it is not possible to reconstruct CVS history "
dongsheng@653 3309 "completely accurately; some guesswork is involved, and renames will usually "
dongsheng@653 3310 "not show up. Because a lot of advanced CVS administration has to be done by "
dongsheng@653 3311 "hand and is hence error-prone, it's common for CVS importers to run into "
dongsheng@653 3312 "multiple problems with corrupted repositories (completely bogus revision "
dongsheng@653 3313 "timestamps and files that have remained locked for over a decade are just two "
dongsheng@653 3314 "of the less interesting problems I can recall from personal experience)."
zhaopingsun@1056 3315 msgstr "Mercurial可以导入CVS的版本历史。然而,这里面有很多限制;"
zhaopingsun@1056 3316 "对其版本控制工具的CVS导入程序也是一样。因为CVS缺少原子更改并且不支持文件系统层次的版本控制,"
zhaopingsun@1056 3317 "所以不可能完全精确的重建CVS的历史。有些需要猜测,重命名通常发现不了。因为CVS的很多的高级管理"
zhaopingsun@1052 3318 "功能必须手动完成,因此非常容易出错。碰到崩溃的版本库,CVS导入程序通常会出现很多问题"
zhaopingsun@1056 3319 "(完全伪造的版本时间戳,若干文件被锁定十多年,这是我个人经历的两个不太有趣的问题)。"
dongsheng@653 3320
dongsheng@714 3321 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3322 #: ../en/ch01-intro.xml:572
dongsheng@653 3323 msgid "Mercurial can import revision history from a CVS repository."
zhaopingsun@1051 3324 msgstr "Mercurial可以从CVS版本库导入版本历史。"
dongsheng@653 3325
dongsheng@714 3326 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 3327 #: ../en/ch01-intro.xml:578
dongsheng@653 3328 msgid "Commercial tools"
dongsheng@653 3329 msgstr "商业工具"
dongsheng@653 3330
dongsheng@714 3331 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3332 #: ../en/ch01-intro.xml:580
dongsheng@653 3333 msgid ""
dongsheng@653 3334 "Perforce has a centralised client/server architecture, with no client-side "
dongsheng@653 3335 "caching of any data. Unlike modern revision control tools, Perforce requires "
dongsheng@653 3336 "that a user run a command to inform the server about every file they intend "
dongsheng@653 3337 "to edit."
zhaopingsun@1053 3338 msgstr "Perforce采用的是集中式客户/服务器结构,客户端不缓存任何数据。和现代的"
zhaopingsun@1056 3339 "版本控制工具不同,每次想要编辑的一个文件,用户必须运行一个命令通知Perforce服务器。"
dongsheng@653 3340
dongsheng@714 3341 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3342 #: ../en/ch01-intro.xml:586
dongsheng@653 3343 msgid ""
dongsheng@653 3344 "The performance of Perforce is quite good for small teams, but it falls off "
dongsheng@653 3345 "rapidly as the number of users grows beyond a few dozen. Modestly large "
dongsheng@653 3346 "Perforce installations require the deployment of proxies to cope with the "
dongsheng@653 3347 "load their users generate."
zhaopingsun@1056 3348 msgstr "对于小的团队而言,Perforce相当好,但是当用户数目超过数十个以后,性能急剧下降。"
zhaopingsun@1056 3349 "中等大小Perforce安装需要部署代理来处理用户产生的负载。"
dongsheng@653 3350
dongsheng@714 3351 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 3352 #: ../en/ch01-intro.xml:595
dongsheng@653 3353 msgid "Choosing a revision control tool"
dongsheng@653 3354 msgstr "选择版本控制工具"
dongsheng@653 3355
dongsheng@714 3356 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3357 #: ../en/ch01-intro.xml:597
dongsheng@653 3358 msgid ""
dongsheng@653 3359 "With the exception of CVS, all of the tools listed above have unique "
dongsheng@653 3360 "strengths that suit them to particular styles of work. There is no single "
dongsheng@653 3361 "revision control tool that is best in all situations."
zhaopingsun@1054 3362 msgstr "除了CVS之外,以上列出的所有工具都各有所长,没有一个版本控制工具适合所有情况。"
dongsheng@653 3363
dongsheng@714 3364 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3365 #: ../en/ch01-intro.xml:602
dongsheng@653 3366 msgid ""
dongsheng@653 3367 "As an example, Subversion is a good choice for working with frequently edited "
dongsheng@653 3368 "binary files, due to its centralised nature and support for file locking."
zhaopingsun@1055 3369 msgstr "比如说,因为采用集中式的结构并且支持文件锁定,Subversion非常适合频繁编辑二进制文件的场合,"
zhaopingsun@1055 3370 ""
dongsheng@653 3371
dongsheng@714 3372 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3373 #: ../en/ch01-intro.xml:606
dongsheng@653 3374 msgid ""
dongsheng@653 3375 "I personally find Mercurial's properties of simplicity, performance, and good "
dongsheng@653 3376 "merge support to be a compelling combination that has served me well for "
dongsheng@653 3377 "several years."
zhaopingsun@1055 3378 msgstr "我已经使用Mercurial很多年了,个人认为它有简洁,高性能,良好的合并支持诸多特点,"
zhaopingsun@1055 3379 ""
dongsheng@653 3380
dongsheng@714 3381 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 3382 #: ../en/ch01-intro.xml:614
dongsheng@653 3383 msgid "Switching from another tool to Mercurial"
dongsheng@653 3384 msgstr "从其它工具切换到 Mercurial"
dongsheng@653 3385
dongsheng@714 3386 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3387 #: ../en/ch01-intro.xml:616
dongsheng@653 3388 msgid ""
dongsheng@653 3389 "Mercurial is bundled with an extension named <literal role=\"hg-ext"
dongsheng@653 3390 "\">convert</literal>, which can incrementally import revision history from "
dongsheng@653 3391 "several other revision control tools. By <quote>incremental</quote>, I mean "
dongsheng@653 3392 "that you can convert all of a project's history to date in one go, then rerun "
dongsheng@653 3393 "the conversion later to obtain new changes that happened after the initial "
dongsheng@653 3394 "conversion."
zhaopingsun@1058 3395 msgstr "Mercurial包括一个叫<literal role=\"hg-ext"
zhaopingsun@1058 3396 "\">convert</literal>的扩展,它可以递增的从几个其他的版本控制工具导入版本历史。"
zhaopingsun@1058 3397 " <quote>增量</quote>的意思是你可以在某天将整个项目历史转换,以后再次进行转换获得"
zhaopingsun@1058 3398 "初始版本以后新增的变更。"
dongsheng@653 3399
dongsheng@714 3400 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3401 #: ../en/ch01-intro.xml:624
dongsheng@653 3402 msgid ""
dongsheng@653 3403 "The revision control tools supported by <literal role=\"hg-ext\">convert</"
dongsheng@653 3404 "literal> are as follows:"
dongsheng@653 3405 msgstr "<literal role=\"hg-ext\">convert</literal> 支持的版本控制工具有:"
dongsheng@653 3406
dongsheng@714 3407 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3408 #: ../en/ch01-intro.xml:632
dongsheng@653 3409 msgid ""
dongsheng@653 3410 "In addition, <literal role=\"hg-ext\">convert</literal> can export changes "
dongsheng@653 3411 "from Mercurial to Subversion. This makes it possible to try Subversion and "
dongsheng@653 3412 "Mercurial in parallel before committing to a switchover, without risking the "
dongsheng@653 3413 "loss of any work."
zhaopingsun@1059 3414 msgstr "另外<literal role=\"hg-ext\">convert</literal>可以从Mercurial向Subversion"
zhaopingsun@1059 3415 "导出历史,这可以让你在切换之前让Mercurial和Subversion并行工作,而不会丢失任何工作。"
dongsheng@653 3416
dongsheng@714 3417 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3418 #: ../en/ch01-intro.xml:638
dongsheng@653 3419 msgid ""
dongsheng@653 3420 "The <command role=\"hg-ext-convert\">convert</command> command is easy to "
dongsheng@653 3421 "use. Simply point it at the path or URL of the source repository, optionally "
dongsheng@653 3422 "give it the name of the destination repository, and it will start working. "
dongsheng@653 3423 "After the initial conversion, just run the same command again to import new "
dongsheng@653 3424 "changes."
zhaopingsun@1059 3425 msgstr "<command role=\"hg-ext-convert\">convert</command>命令非常简单。只要给出"
zhaopingsun@1059 3426 "源版本库的URL或者路径,给出目标版本库的名称(可选),它就开始工作了。第一次转换之后,"
zhaopingsun@1059 3427 "只要运行同样的命令就可以导入新的变更。"
dongsheng@653 3428
dongsheng@714 3429 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 3430 #: ../en/ch01-intro.xml:647
dongsheng@653 3431 msgid "A short history of revision control"
dongsheng@653 3432 msgstr "版本控制简史"
dongsheng@653 3433
dongsheng@714 3434 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3435 #: ../en/ch01-intro.xml:649
dongsheng@653 3436 msgid ""
dongsheng@653 3437 "The best known of the old-time revision control tools is SCCS (Source Code "
dongsheng@653 3438 "Control System), which Marc Rochkind wrote at Bell Labs, in the early 1970s. "
dongsheng@653 3439 "SCCS operated on individual files, and required every person working on a "
dongsheng@653 3440 "project to have access to a shared workspace on a single system. Only one "
dongsheng@653 3441 "person could modify a file at any time; arbitration for access to files was "
dongsheng@653 3442 "via locks. It was common for people to lock files, and later forget to "
dongsheng@653 3443 "unlock them, preventing anyone else from modifying those files without the "
dongsheng@653 3444 "help of an administrator."
dongsheng@653 3445 msgstr ""
dongsheng@653 3446
dongsheng@714 3447 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3448 #: ../en/ch01-intro.xml:660
dongsheng@653 3449 msgid ""
dongsheng@653 3450 "Walter Tichy developed a free alternative to SCCS in the early 1980s; he "
dongsheng@653 3451 "called his program RCS (Revision Control System). Like SCCS, RCS required "
dongsheng@653 3452 "developers to work in a single shared workspace, and to lock files to prevent "
dongsheng@653 3453 "multiple people from modifying them simultaneously."
dongsheng@653 3454 msgstr ""
dongsheng@653 3455
dongsheng@714 3456 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3457 #: ../en/ch01-intro.xml:666
dongsheng@653 3458 msgid ""
dongsheng@653 3459 "Later in the 1980s, Dick Grune used RCS as a building block for a set of "
dongsheng@653 3460 "shell scripts he initially called cmt, but then renamed to CVS (Concurrent "
dongsheng@653 3461 "Versions System). The big innovation of CVS was that it let developers work "
dongsheng@653 3462 "simultaneously and somewhat independently in their own personal workspaces. "
dongsheng@653 3463 "The personal workspaces prevented developers from stepping on each other's "
dongsheng@653 3464 "toes all the time, as was common with SCCS and RCS. Each developer had a copy "
dongsheng@653 3465 "of every project file, and could modify their copies independently. They had "
dongsheng@653 3466 "to merge their edits prior to committing changes to the central repository."
dongsheng@653 3467 msgstr ""
dongsheng@653 3468
dongsheng@714 3469 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3470 #: ../en/ch01-intro.xml:677
dongsheng@653 3471 msgid ""
dongsheng@653 3472 "Brian Berliner took Grune's original scripts and rewrote them in C, releasing "
dongsheng@653 3473 "in 1989 the code that has since developed into the modern version of CVS. "
dongsheng@653 3474 "CVS subsequently acquired the ability to operate over a network connection, "
dongsheng@653 3475 "giving it a client/server architecture. CVS's architecture is centralised; "
dongsheng@653 3476 "only the server has a copy of the history of the project. Client workspaces "
dongsheng@653 3477 "just contain copies of recent versions of the project's files, and a little "
dongsheng@653 3478 "metadata to tell them where the server is. CVS has been enormously "
dongsheng@653 3479 "successful; it is probably the world's most widely used revision control "
dongsheng@653 3480 "system."
dongsheng@653 3481 msgstr ""
dongsheng@653 3482
dongsheng@714 3483 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3484 #: ../en/ch01-intro.xml:688
dongsheng@653 3485 msgid ""
dongsheng@653 3486 "In the early 1990s, Sun Microsystems developed an early distributed revision "
dongsheng@653 3487 "control system, called TeamWare. A TeamWare workspace contains a complete "
dongsheng@653 3488 "copy of the project's history. TeamWare has no notion of a central "
dongsheng@653 3489 "repository. (CVS relied upon RCS for its history storage; TeamWare used "
dongsheng@653 3490 "SCCS.)"
dongsheng@653 3491 msgstr ""
dongsheng@653 3492
dongsheng@714 3493 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3494 #: ../en/ch01-intro.xml:695
dongsheng@653 3495 msgid ""
dongsheng@653 3496 "As the 1990s progressed, awareness grew of a number of problems with CVS. It "
dongsheng@653 3497 "records simultaneous changes to multiple files individually, instead of "
dongsheng@653 3498 "grouping them together as a single logically atomic operation. It does not "
dongsheng@653 3499 "manage its file hierarchy well; it is easy to make a mess of a repository by "
dongsheng@653 3500 "renaming files and directories. Worse, its source code is difficult to read "
dongsheng@653 3501 "and maintain, which made the <quote>pain level</quote> of fixing these "
dongsheng@653 3502 "architectural problems prohibitive."
dongsheng@653 3503 msgstr ""
dongsheng@653 3504
dongsheng@714 3505 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3506 #: ../en/ch01-intro.xml:705
dongsheng@653 3507 msgid ""
dongsheng@653 3508 "In 2001, Jim Blandy and Karl Fogel, two developers who had worked on CVS, "
dongsheng@653 3509 "started a project to replace it with a tool that would have a better "
dongsheng@653 3510 "architecture and cleaner code. The result, Subversion, does not stray from "
dongsheng@653 3511 "CVS's centralised client/server model, but it adds multi-file atomic commits, "
dongsheng@653 3512 "better namespace management, and a number of other features that make it a "
dongsheng@653 3513 "generally better tool than CVS. Since its initial release, it has rapidly "
dongsheng@653 3514 "grown in popularity."
dongsheng@653 3515 msgstr ""
dongsheng@653 3516
dongsheng@714 3517 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3518 #: ../en/ch01-intro.xml:714
dongsheng@653 3519 msgid ""
dongsheng@653 3520 "More or less simultaneously, Graydon Hoare began working on an ambitious "
dongsheng@653 3521 "distributed revision control system that he named Monotone. While Monotone "
dongsheng@653 3522 "addresses many of CVS's design flaws and has a peer-to-peer architecture, it "
dongsheng@653 3523 "goes beyond earlier (and subsequent) revision control tools in a number of "
dongsheng@653 3524 "innovative ways. It uses cryptographic hashes as identifiers, and has an "
dongsheng@653 3525 "integral notion of <quote>trust</quote> for code from different sources."
dongsheng@653 3526 msgstr ""
dongsheng@653 3527
dongsheng@714 3528 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3529 #: ../en/ch01-intro.xml:723
dongsheng@653 3530 msgid ""
dongsheng@653 3531 "Mercurial began life in 2005. While a few aspects of its design are "
dongsheng@653 3532 "influenced by Monotone, Mercurial focuses on ease of use, high performance, "
dongsheng@653 3533 "and scalability to very large projects."
dongsheng@653 3534 msgstr ""
dongsheng@653 3535
dongsheng@627 3536 #. type: Content of: <book><chapter><title>
dongsheng@714 3537 #: ../en/ch02-tour-basic.xml:5
dongsheng@627 3538 msgid "A tour of Mercurial: the basics"
dongsheng@627 3539 msgstr "Mercurial 教程: 基础知识"
dongsheng@627 3540
dongsheng@627 3541 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 3542 #: ../en/ch02-tour-basic.xml:8
dongsheng@627 3543 msgid "Installing Mercurial on your system"
dongsheng@627 3544 msgstr "安装 Mercurial"
dongsheng@627 3545
dongsheng@627 3546 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3547 #: ../en/ch02-tour-basic.xml:10
dongsheng@627 3548 msgid ""
dongsheng@627 3549 "Prebuilt binary packages of Mercurial are available for every popular "
dongsheng@627 3550 "operating system. These make it easy to start using Mercurial on your "
dongsheng@627 3551 "computer immediately."
dongsheng@627 3552 msgstr ""
dongsheng@644 3553 "对于每种流行的操作系统,都有已经构建的二进制软件包。这让在你的计算机上开始使"
dongsheng@644 3554 "用 Mercurial 变得很容易。"
dongsheng@627 3555
dongsheng@627 3556 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 3557 #: ../en/ch02-tour-basic.xml:15
songdongsheng@667 3558 msgid "Windows"
songdongsheng@668 3559 msgstr "Windows"
songdongsheng@667 3560
songdongsheng@667 3561 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3562 #: ../en/ch02-tour-basic.xml:17
songdongsheng@667 3563 msgid ""
songdongsheng@667 3564 "The best version of Mercurial for Windows is TortoiseHg, which can be found "
songdongsheng@667 3565 "at <ulink url=\"http://bitbucket.org/tortoisehg/stable/wiki/Home\">http://"
songdongsheng@667 3566 "bitbucket.org/tortoisehg/stable/wiki/Home</ulink>. This package has no "
songdongsheng@667 3567 "external dependencies; it <quote>just works</quote>. It provides both "
songdongsheng@667 3568 "command line and graphical user interfaces."
songdongsheng@667 3569 msgstr ""
songdongsheng@711 3570 "Windows 中最好的 Mercurial 版本是TortoiseHg,它的主页地址是 <ulink url="
songdongsheng@711 3571 "\"http://bitbucket.org/tortoisehg/stable/wiki/Home\">http://bitbucket.org/"
songdongsheng@711 3572 "tortoisehg/stable/wiki/Home</ulink>。这个软件没有外部依赖,它可以<quote>独立工"
songdongsheng@711 3573 "作</quote>,同时提供了命令行和图形用户界面。"
songdongsheng@667 3574
songdongsheng@667 3575 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 3576 #: ../en/ch02-tour-basic.xml:27
songdongsheng@667 3577 msgid "Mac OS X"
songdongsheng@667 3578 msgstr "Mac OS X"
songdongsheng@667 3579
songdongsheng@667 3580 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3581 #: ../en/ch02-tour-basic.xml:29
songdongsheng@667 3582 msgid ""
songdongsheng@667 3583 "Lee Cantey publishes an installer of Mercurial for Mac OS X at <ulink url="
songdongsheng@667 3584 "\"http://mercurial.berkwood.com\">http://mercurial.berkwood.com</ulink>."
songdongsheng@667 3585 msgstr ""
songdongsheng@711 3586 "Lee Cantey 为 Mac OS X 在 <ulink url=\"http://mercurial.berkwood.com"
songdongsheng@711 3587 "\">http://mercurial.berkwood.com</ulink> 发布了 Mercurial 安装程序。"
songdongsheng@667 3588
songdongsheng@667 3589 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 3590 #: ../en/ch02-tour-basic.xml:35
dongsheng@627 3591 msgid "Linux"
dongsheng@644 3592 msgstr "Linux"
dongsheng@627 3593
dongsheng@627 3594 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3595 #: ../en/ch02-tour-basic.xml:37
dongsheng@627 3596 msgid ""
dongsheng@627 3597 "Because each Linux distribution has its own packaging tools, policies, and "
dongsheng@627 3598 "rate of development, it's difficult to give a comprehensive set of "
dongsheng@627 3599 "instructions on how to install Mercurial binaries. The version of Mercurial "
dongsheng@627 3600 "that you will end up with can vary depending on how active the person is who "
dongsheng@627 3601 "maintains the package for your distribution."
dongsheng@627 3602 msgstr ""
dongsheng@644 3603 "由于每种 Linux 发行版都有自己的包管理工具,开发策略和进度,从而很难给出安装 "
dongsheng@644 3604 "Mercurial 二进制包的全面说明。你安装的 Mercurial 版本,在很大程度上依赖于你所"
dongsheng@644 3605 "使用的发行版的 Mercurial 维护者的活跃程度。"
dongsheng@627 3606
dongsheng@627 3607 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3608 #: ../en/ch02-tour-basic.xml:44
dongsheng@627 3609 msgid ""
dongsheng@627 3610 "To keep things simple, I will focus on installing Mercurial from the command "
dongsheng@627 3611 "line under the most popular Linux distributions. Most of these distributions "
dongsheng@627 3612 "provide graphical package managers that will let you install Mercurial with a "
dongsheng@627 3613 "single click; the package name to look for is <literal>mercurial</literal>."
dongsheng@627 3614 msgstr ""
dongsheng@644 3615 "为了让事情简单,我会致力于说明在最流行的 Linux 发行版中,从命令行安装 "
dongsheng@644 3616 "Mercurial 的方法。这些发行版都提供了图形界面的包管理器,让你通过点击鼠标安装 "
dongsheng@644 3617 "Mercurial;寻找的包名称是 <literal>mercurial</literal>。"
dongsheng@627 3618
dongsheng@627 3619 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 3620 #: ../en/ch02-tour-basic.xml:52
songdongsheng@667 3621 msgid "Ubuntu and Debian:"
songdongsheng@668 3622 msgstr "Ubuntu 与 Debian:"
dongsheng@627 3623
dongsheng@627 3624 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 3625 #: ../en/ch02-tour-basic.xml:54
dongsheng@714 3626 msgid "Fedora:"
dongsheng@715 3627 msgstr "Fedora:"
dongsheng@714 3628
dongsheng@714 3629 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 3630 #: ../en/ch02-tour-basic.xml:56
dongsheng@714 3631 msgid "OpenSUSE:"
dongsheng@715 3632 msgstr "OpenSUSE:"
dongsheng@627 3633
dongsheng@627 3634 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 3635 #: ../en/ch02-tour-basic.xml:58
dongsheng@627 3636 msgid "Gentoo:"
dongsheng@644 3637 msgstr "Gentoo:"
dongsheng@627 3638
dongsheng@646 3639 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 3640 #: ../en/ch02-tour-basic.xml:64
dongsheng@627 3641 msgid "Solaris"
dongsheng@646 3642 msgstr "Solaris"
dongsheng@646 3643
dongsheng@646 3644 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3645 #: ../en/ch02-tour-basic.xml:66
dongsheng@627 3646 msgid ""
dongsheng@627 3647 "SunFreeWare, at <ulink url=\"http://www.sunfreeware.com\">http://www."
songdongsheng@667 3648 "sunfreeware.com</ulink>, provides prebuilt packages of Mercurial."
dongsheng@627 3649 msgstr ""
dongsheng@646 3650 "位于 <ulink url=\"http://www.sunfreeware.com\">http://www.sunfreeware.com</"
songdongsheng@668 3651 "ulink> 的 SunFreeWare 提供了 Mercurial 的二进制安装包。"
dongsheng@646 3652
dongsheng@627 3653 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 3654 #: ../en/ch02-tour-basic.xml:75
dongsheng@627 3655 msgid "Getting started"
dongsheng@627 3656 msgstr "开始"
dongsheng@627 3657
dongsheng@627 3658 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3659 #: ../en/ch02-tour-basic.xml:77
dongsheng@627 3660 msgid ""
dongsheng@627 3661 "To begin, we'll use the <command role=\"hg-cmd\">hg version</command> command "
dongsheng@714 3662 "to find out whether Mercurial is installed properly. The actual version "
dongsheng@714 3663 "information that it prints isn't so important; we simply care whether the "
dongsheng@714 3664 "command runs and prints anything at all."
dongsheng@627 3665 msgstr ""
songdongsheng@711 3666 "首先,我们使用 <command role=\"hg-cmd\">hg version</command> 命令检查 "
dongsheng@715 3667 "Mercurial 是否已经正确安装。它打印出来的实际版本信息并不重要;我们只关心它是否"
dongsheng@715 3668 "能够运行,打印出信息。"
dongsheng@627 3669
dongsheng@627 3670 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 3671 #: ../en/ch02-tour-basic.xml:86
dongsheng@627 3672 msgid "Built-in help"
dongsheng@627 3673 msgstr "内置帮助"
dongsheng@627 3674
dongsheng@627 3675 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3676 #: ../en/ch02-tour-basic.xml:88
dongsheng@627 3677 msgid ""
dongsheng@627 3678 "Mercurial provides a built-in help system. This is invaluable for those "
dongsheng@627 3679 "times when you find yourself stuck trying to remember how to run a command. "
dongsheng@627 3680 "If you are completely stuck, simply run <command role=\"hg-cmd\">hg help</"
dongsheng@627 3681 "command>; it will print a brief list of commands, along with a description of "
dongsheng@627 3682 "what each does. If you ask for help on a specific command (as below), it "
dongsheng@627 3683 "prints more detailed information."
dongsheng@627 3684 msgstr ""
songdongsheng@711 3685 "Mercurial 内置了帮助系统。当你不记得如何执行一个命令时,它会给你重要的帮助。如"
songdongsheng@711 3686 "果你完全没有头绪,那就直接运行 <command role=\"hg-cmd\">hg help</command>;它"
songdongsheng@711 3687 "会给出命令的简短列表,还描述了每个命令的作用。如果你需要具体命令的帮助(下述),"
songdongsheng@711 3688 "它会给出更详细的信息。"
dongsheng@627 3689
dongsheng@627 3690 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3691 #: ../en/ch02-tour-basic.xml:99
dongsheng@627 3692 msgid ""
dongsheng@627 3693 "For a more impressive level of detail (which you won't usually need) run "
dongsheng@627 3694 "<command role=\"hg-cmd\">hg help <option role=\"hg-opt-global\">-v</option></"
dongsheng@627 3695 "command>. The <option role=\"hg-opt-global\">-v</option> option is short for "
dongsheng@627 3696 "<option role=\"hg-opt-global\">--verbose</option>, and tells Mercurial to "
dongsheng@627 3697 "print more information than it usually would."
dongsheng@627 3698 msgstr ""
songdongsheng@711 3699 "要获得更多的详细信息(通常不需要),可以执行 <command role=\"hg-cmd\">hg help "
songdongsheng@711 3700 "<option role=\"hg-opt-global\">-v</option></command>。选项 <option role=\"hg-"
songdongsheng@711 3701 "opt-global\">-v</option> 是 <option role=\"hg-opt-global\">--verbose</option> "
songdongsheng@711 3702 "的短格式,告诉 Mercurial 要打印通常不需要的更多信息。"
dongsheng@627 3703
dongsheng@627 3704 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 3705 #: ../en/ch02-tour-basic.xml:110
dongsheng@627 3706 msgid "Working with a repository"
dongsheng@627 3707 msgstr "使用版本库"
dongsheng@627 3708
dongsheng@627 3709 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3710 #: ../en/ch02-tour-basic.xml:112
dongsheng@627 3711 msgid ""
dongsheng@627 3712 "In Mercurial, everything happens inside a <emphasis>repository</emphasis>. "
dongsheng@627 3713 "The repository for a project contains all of the files that <quote>belong to</"
dongsheng@627 3714 "quote> that project, along with a historical record of the project's files."
dongsheng@627 3715 msgstr ""
dongsheng@627 3716
dongsheng@627 3717 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3718 #: ../en/ch02-tour-basic.xml:118
dongsheng@627 3719 msgid ""
dongsheng@627 3720 "There's nothing particularly magical about a repository; it is simply a "
dongsheng@627 3721 "directory tree in your filesystem that Mercurial treats as special. You can "
dongsheng@627 3722 "rename or delete a repository any time you like, using either the command "
dongsheng@627 3723 "line or your file browser."
dongsheng@627 3724 msgstr ""
dongsheng@627 3725
dongsheng@627 3726 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 3727 #: ../en/ch02-tour-basic.xml:125
dongsheng@627 3728 msgid "Making a local copy of a repository"
dongsheng@627 3729 msgstr "创建版本库的工作副本"
dongsheng@627 3730
dongsheng@627 3731 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3732 #: ../en/ch02-tour-basic.xml:127
dongsheng@627 3733 msgid ""
dongsheng@627 3734 "<emphasis>Copying</emphasis> a repository is just a little bit special. "
dongsheng@627 3735 "While you could use a normal file copying command to make a copy of a "
dongsheng@627 3736 "repository, it's best to use a built-in command that Mercurial provides. "
dongsheng@627 3737 "This command is called <command role=\"hg-cmd\">hg clone</command>, because "
songdongsheng@667 3738 "it makes an identical copy of an existing repository."
songdongsheng@667 3739 msgstr ""
songdongsheng@667 3740
songdongsheng@667 3741 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3742 #: ../en/ch02-tour-basic.xml:136
songdongsheng@667 3743 msgid ""
songdongsheng@667 3744 "One advantage of using <command role=\"hg-cmd\">hg clone</command> is that, "
songdongsheng@667 3745 "as we can see above, it lets us clone repositories over the network. Another "
songdongsheng@667 3746 "is that it remembers where we cloned from, which we'll find useful soon when "
songdongsheng@667 3747 "we want to fetch new changes from another repository."
songdongsheng@667 3748 msgstr ""
songdongsheng@667 3749
songdongsheng@667 3750 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3751 #: ../en/ch02-tour-basic.xml:142
dongsheng@627 3752 msgid ""
dongsheng@627 3753 "If our clone succeeded, we should now have a local directory called <filename "
dongsheng@627 3754 "class=\"directory\">hello</filename>. This directory will contain some files."
dongsheng@627 3755 msgstr ""
dongsheng@627 3756
dongsheng@627 3757 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3758 #: ../en/ch02-tour-basic.xml:148
dongsheng@627 3759 msgid ""
dongsheng@627 3760 "These files have the same contents and history in our repository as they do "
dongsheng@627 3761 "in the repository we cloned."
dongsheng@627 3762 msgstr ""
dongsheng@627 3763
dongsheng@627 3764 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3765 #: ../en/ch02-tour-basic.xml:151
dongsheng@627 3766 msgid ""
dongsheng@627 3767 "Every Mercurial repository is complete, self-contained, and independent. It "
songdongsheng@667 3768 "contains its own private copy of a project's files and history. As we just "
songdongsheng@667 3769 "mentioned, a cloned repository remembers the location of the repository it "
songdongsheng@667 3770 "was cloned from, but Mercurial will not communicate with that repository, or "
songdongsheng@667 3771 "any other, unless you tell it to."
songdongsheng@667 3772 msgstr ""
songdongsheng@667 3773
songdongsheng@667 3774 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3775 #: ../en/ch02-tour-basic.xml:158
dongsheng@627 3776 msgid ""
dongsheng@627 3777 "What this means for now is that we're free to experiment with our repository, "
dongsheng@627 3778 "safe in the knowledge that it's a private <quote>sandbox</quote> that won't "
dongsheng@627 3779 "affect anyone else."
dongsheng@627 3780 msgstr ""
dongsheng@627 3781
dongsheng@627 3782 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 3783 #: ../en/ch02-tour-basic.xml:164
dongsheng@627 3784 msgid "What's in a repository?"
dongsheng@627 3785 msgstr "什么是版本库?"
dongsheng@627 3786
dongsheng@627 3787 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3788 #: ../en/ch02-tour-basic.xml:166
dongsheng@627 3789 msgid ""
dongsheng@627 3790 "When we take a more detailed look inside a repository, we can see that it "
dongsheng@627 3791 "contains a directory named <filename class=\"directory\">.hg</filename>. "
dongsheng@627 3792 "This is where Mercurial keeps all of its metadata for the repository."
dongsheng@627 3793 msgstr ""
dongsheng@627 3794
dongsheng@627 3795 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3796 #: ../en/ch02-tour-basic.xml:173
dongsheng@627 3797 msgid ""
dongsheng@627 3798 "The contents of the <filename class=\"directory\">.hg</filename> directory "
dongsheng@627 3799 "and its subdirectories are private to Mercurial. Every other file and "
dongsheng@627 3800 "directory in the repository is yours to do with as you please."
dongsheng@627 3801 msgstr ""
dongsheng@627 3802
dongsheng@627 3803 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3804 #: ../en/ch02-tour-basic.xml:179
dongsheng@627 3805 msgid ""
dongsheng@627 3806 "To introduce a little terminology, the <filename class=\"directory\">.hg</"
dongsheng@627 3807 "filename> directory is the <quote>real</quote> repository, and all of the "
dongsheng@627 3808 "files and directories that coexist with it are said to live in the "
dongsheng@627 3809 "<emphasis>working directory</emphasis>. An easy way to remember the "
dongsheng@627 3810 "distinction is that the <emphasis>repository</emphasis> contains the "
dongsheng@627 3811 "<emphasis>history</emphasis> of your project, while the <emphasis>working "
dongsheng@627 3812 "directory</emphasis> contains a <emphasis>snapshot</emphasis> of your project "
dongsheng@627 3813 "at a particular point in history."
dongsheng@627 3814 msgstr ""
dongsheng@627 3815
dongsheng@627 3816 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 3817 #: ../en/ch02-tour-basic.xml:194
dongsheng@627 3818 msgid "A tour through history"
dongsheng@627 3819 msgstr "回溯历史"
dongsheng@627 3820
dongsheng@627 3821 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3822 #: ../en/ch02-tour-basic.xml:196
dongsheng@627 3823 msgid ""
dongsheng@627 3824 "One of the first things we might want to do with a new, unfamiliar repository "
dongsheng@627 3825 "is understand its history. The <command role=\"hg-cmd\">hg log</command> "
songdongsheng@667 3826 "command gives us a view of the history of changes in the repository."
songdongsheng@667 3827 msgstr ""
songdongsheng@667 3828
songdongsheng@667 3829 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3830 #: ../en/ch02-tour-basic.xml:203
dongsheng@627 3831 msgid ""
dongsheng@627 3832 "By default, this command prints a brief paragraph of output for each change "
dongsheng@627 3833 "to the project that was recorded. In Mercurial terminology, we call each of "
dongsheng@627 3834 "these recorded events a <emphasis>changeset</emphasis>, because it can "
dongsheng@627 3835 "contain a record of changes to several files."
dongsheng@627 3836 msgstr ""
dongsheng@627 3837
dongsheng@627 3838 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3839 #: ../en/ch02-tour-basic.xml:209
dongsheng@627 3840 msgid ""
dongsheng@627 3841 "The fields in a record of output from <command role=\"hg-cmd\">hg log</"
dongsheng@627 3842 "command> are as follows."
dongsheng@627 3843 msgstr ""
dongsheng@627 3844
dongsheng@627 3845 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 3846 #: ../en/ch02-tour-basic.xml:213
dongsheng@627 3847 msgid ""
dongsheng@627 3848 "<literal>changeset</literal>: This field has the format of a number, followed "
songdongsheng@667 3849 "by a colon, followed by a hexadecimal (or <emphasis>hex</emphasis>) string. "
songdongsheng@667 3850 "These are <emphasis>identifiers</emphasis> for the changeset. The hex string "
songdongsheng@667 3851 "is a unique identifier: the same hex string will always refer to the same "
dongsheng@714 3852 "changeset in every copy of this repository. The number is shorter and easier "
dongsheng@714 3853 "to type than the hex string, but it isn't unique: the same number in two "
dongsheng@714 3854 "different clones of a repository may identify different changesets."
dongsheng@627 3855 msgstr ""
dongsheng@627 3856
dongsheng@627 3857 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 3858 #: ../en/ch02-tour-basic.xml:224
dongsheng@627 3859 msgid ""
dongsheng@627 3860 "<literal>user</literal>: The identity of the person who created the "
dongsheng@627 3861 "changeset. This is a free-form field, but it most often contains a person's "
dongsheng@627 3862 "name and email address."
dongsheng@627 3863 msgstr ""
dongsheng@627 3864
dongsheng@627 3865 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 3866 #: ../en/ch02-tour-basic.xml:228
dongsheng@627 3867 msgid ""
dongsheng@627 3868 "<literal>date</literal>: The date and time on which the changeset was "
dongsheng@627 3869 "created, and the timezone in which it was created. (The date and time are "
dongsheng@627 3870 "local to that timezone; they display what time and date it was for the person "
dongsheng@627 3871 "who created the changeset.)"
dongsheng@627 3872 msgstr ""
dongsheng@627 3873
dongsheng@627 3874 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 3875 #: ../en/ch02-tour-basic.xml:233
dongsheng@627 3876 msgid ""
dongsheng@627 3877 "<literal>summary</literal>: The first line of the text message that the "
dongsheng@627 3878 "creator of the changeset entered to describe the changeset."
dongsheng@627 3879 msgstr ""
dongsheng@627 3880
songdongsheng@667 3881 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 3882 #: ../en/ch02-tour-basic.xml:237
songdongsheng@667 3883 msgid ""
songdongsheng@667 3884 "Some changesets, such as the first in the list above, have a <literal>tag</"
songdongsheng@667 3885 "literal> field. A tag is another way to identify a changeset, by giving it "
songdongsheng@667 3886 "an easy-to-remember name. (The tag named <literal>tip</literal> is special: "
songdongsheng@667 3887 "it always refers to the newest change in a repository.)"
songdongsheng@667 3888 msgstr ""
songdongsheng@667 3889
songdongsheng@667 3890 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3891 #: ../en/ch02-tour-basic.xml:245
dongsheng@627 3892 msgid ""
dongsheng@627 3893 "The default output printed by <command role=\"hg-cmd\">hg log</command> is "
dongsheng@627 3894 "purely a summary; it is missing a lot of detail."
dongsheng@627 3895 msgstr ""
dongsheng@627 3896
dongsheng@627 3897 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 3898 #: ../en/ch02-tour-basic.xml:249
dongsheng@627 3899 msgid ""
songdongsheng@658 3900 "<xref linkend=\"fig:tour-basic:history\"/> provides a graphical "
songdongsheng@658 3901 "representation of the history of the <filename class=\"directory\">hello</"
songdongsheng@658 3902 "filename> repository, to make it a little easier to see which direction "
songdongsheng@658 3903 "history is <quote>flowing</quote> in. We'll be returning to this figure "
songdongsheng@658 3904 "several times in this chapter and the chapter that follows."
songdongsheng@658 3905 msgstr ""
songdongsheng@658 3906
songdongsheng@658 3907 #. type: Content of: <book><chapter><sect1><figure><title>
dongsheng@714 3908 #: ../en/ch02-tour-basic.xml:258
dongsheng@627 3909 msgid ""
dongsheng@627 3910 "Graphical history of the <filename class=\"directory\">hello</filename> "
dongsheng@627 3911 "repository"
dongsheng@660 3912 msgstr "版本库 <filename class=\"directory\">hello</filename> 的历史图"
dongsheng@627 3913
songdongsheng@658 3914 #. type: Content of: <book><chapter><sect1><figure>
dongsheng@714 3915 #: ../en/ch02-tour-basic.xml:260 ../en/ch03-tour-merge.xml:61
dongsheng@714 3916 #: ../en/ch03-tour-merge.xml:207 ../en/ch04-concepts.xml:290
songdongsheng@658 3917 msgid "<placeholder type=\"mediaobject\" id=\"0\"/>"
songdongsheng@658 3918 msgstr ""
songdongsheng@658 3919
songdongsheng@658 3920 #. type: Content of: <book><chapter><sect1><figure><mediaobject>
dongsheng@714 3921 #: ../en/ch02-tour-basic.xml:261
songdongsheng@658 3922 msgid ""
songdongsheng@658 3923 "<imageobject><imagedata fileref=\"figs/tour-history.png\"/></imageobject>"
songdongsheng@658 3924 msgstr ""
songdongsheng@658 3925
songdongsheng@658 3926 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject><textobject><phrase>
dongsheng@714 3927 #: ../en/ch02-tour-basic.xml:262 ../en/ch03-tour-merge.xml:63
dongsheng@714 3928 #: ../en/ch03-tour-merge.xml:95 ../en/ch03-tour-merge.xml:182
dongsheng@714 3929 #: ../en/ch03-tour-merge.xml:209 ../en/ch03-tour-merge.xml:279
dongsheng@714 3930 #: ../en/ch04-concepts.xml:59 ../en/ch04-concepts.xml:108
dongsheng@714 3931 #: ../en/ch04-concepts.xml:198 ../en/ch04-concepts.xml:292
dongsheng@714 3932 #: ../en/ch04-concepts.xml:347 ../en/ch04-concepts.xml:362
dongsheng@714 3933 #: ../en/ch04-concepts.xml:403 ../en/ch04-concepts.xml:423
dongsheng@714 3934 #: ../en/ch04-concepts.xml:469 ../en/ch06-collab.xml:316
dongsheng@714 3935 #: ../en/ch09-undo.xml:344 ../en/ch09-undo.xml:391 ../en/ch09-undo.xml:464
dongsheng@714 3936 #: ../en/ch09-undo.xml:502 ../en/ch09-undo.xml:658 ../en/ch09-undo.xml:682
dongsheng@714 3937 #: ../en/ch09-undo.xml:700 ../en/ch09-undo.xml:714 ../en/ch09-undo.xml:727
dongsheng@714 3938 #: ../en/ch12-mq.xml:413
songdongsheng@658 3939 msgid "XXX add text"
songdongsheng@658 3940 msgstr ""
songdongsheng@658 3941
dongsheng@627 3942 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 3943 #: ../en/ch02-tour-basic.xml:267
dongsheng@627 3944 msgid "Changesets, revisions, and talking to other people"
songdongsheng@665 3945 msgstr "修改集,版本,与其它用户交互"
dongsheng@627 3946
dongsheng@627 3947 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3948 #: ../en/ch02-tour-basic.xml:270
dongsheng@627 3949 msgid ""
dongsheng@627 3950 "As English is a notoriously sloppy language, and computer science has a "
dongsheng@627 3951 "hallowed history of terminological confusion (why use one term when four will "
dongsheng@627 3952 "do?), revision control has a variety of words and phrases that mean the same "
dongsheng@627 3953 "thing. If you are talking about Mercurial history with other people, you "
dongsheng@627 3954 "will find that the word <quote>changeset</quote> is often compressed to "
dongsheng@627 3955 "<quote>change</quote> or (when written) <quote>cset</quote>, and sometimes a "
dongsheng@627 3956 "changeset is referred to as a <quote>revision</quote> or a <quote>rev</quote>."
dongsheng@627 3957 msgstr ""
dongsheng@627 3958
dongsheng@627 3959 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3960 #: ../en/ch02-tour-basic.xml:280
dongsheng@627 3961 msgid ""
dongsheng@627 3962 "While it doesn't matter what <emphasis>word</emphasis> you use to refer to "
dongsheng@627 3963 "the concept of <quote>a changeset</quote>, the <emphasis>identifier</"
dongsheng@627 3964 "emphasis> that you use to refer to <quote>a <emphasis>specific</emphasis> "
dongsheng@627 3965 "changeset</quote> is of great importance. Recall that the <literal>changeset</"
dongsheng@627 3966 "literal> field in the output from <command role=\"hg-cmd\">hg log</command> "
dongsheng@627 3967 "identifies a changeset using both a number and a hexadecimal string."
dongsheng@627 3968 msgstr ""
dongsheng@627 3969
dongsheng@627 3970 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 3971 #: ../en/ch02-tour-basic.xml:289
songdongsheng@667 3972 msgid ""
songdongsheng@667 3973 "The revision number is a handy notation that is <emphasis>only valid in that "
songdongsheng@667 3974 "repository</emphasis>."
songdongsheng@658 3975 msgstr ""
songdongsheng@658 3976
songdongsheng@658 3977 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 3978 #: ../en/ch02-tour-basic.xml:292
dongsheng@627 3979 msgid ""
songdongsheng@667 3980 "The hexadecimal string is the <emphasis>permanent, unchanging identifier</"
dongsheng@627 3981 "emphasis> that will always identify that exact changeset in <emphasis>every</"
dongsheng@627 3982 "emphasis> copy of the repository."
dongsheng@627 3983 msgstr ""
dongsheng@627 3984
dongsheng@627 3985 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3986 #: ../en/ch02-tour-basic.xml:298
dongsheng@627 3987 msgid ""
dongsheng@627 3988 "This distinction is important. If you send someone an email talking about "
dongsheng@627 3989 "<quote>revision 33</quote>, there's a high likelihood that their revision 33 "
dongsheng@627 3990 "will <emphasis>not be the same</emphasis> as yours. The reason for this is "
dongsheng@627 3991 "that a revision number depends on the order in which changes arrived in a "
dongsheng@627 3992 "repository, and there is no guarantee that the same changes will happen in "
songdongsheng@667 3993 "the same order in different repositories. Three changes <literal>a,b,c</"
songdongsheng@667 3994 "literal> can easily appear in one repository as <literal>0,1,2</literal>, "
songdongsheng@667 3995 "while in another as <literal>0,2,1</literal>."
songdongsheng@667 3996 msgstr ""
songdongsheng@667 3997
songdongsheng@667 3998 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 3999 #: ../en/ch02-tour-basic.xml:310
dongsheng@627 4000 msgid ""
dongsheng@627 4001 "Mercurial uses revision numbers purely as a convenient shorthand. If you "
dongsheng@627 4002 "need to discuss a changeset with someone, or make a record of a changeset for "
dongsheng@627 4003 "some other reason (for example, in a bug report), use the hexadecimal "
dongsheng@627 4004 "identifier."
dongsheng@627 4005 msgstr ""
dongsheng@627 4006
dongsheng@627 4007 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 4008 #: ../en/ch02-tour-basic.xml:318
dongsheng@627 4009 msgid "Viewing specific revisions"
dongsheng@627 4010 msgstr "察看指定版本"
dongsheng@627 4011
dongsheng@627 4012 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4013 #: ../en/ch02-tour-basic.xml:320
dongsheng@627 4014 msgid ""
dongsheng@627 4015 "To narrow the output of <command role=\"hg-cmd\">hg log</command> down to a "
dongsheng@627 4016 "single revision, use the <option role=\"hg-opt-log\">-r</option> (or <option "
dongsheng@627 4017 "role=\"hg-opt-log\">--rev</option>) option. You can use either a revision "
songdongsheng@667 4018 "number or a hexadecimal identifier, and you can provide as many revisions as "
songdongsheng@667 4019 "you want."
songdongsheng@667 4020 msgstr ""
songdongsheng@667 4021
songdongsheng@667 4022 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4023 #: ../en/ch02-tour-basic.xml:329
dongsheng@627 4024 msgid ""
dongsheng@627 4025 "If you want to see the history of several revisions without having to list "
dongsheng@627 4026 "each one, you can use <emphasis>range notation</emphasis>; this lets you "
dongsheng@627 4027 "express the idea <quote>I want all revisions between <literal>abc</literal> "
dongsheng@627 4028 "and <literal>def</literal>, inclusive</quote>."
dongsheng@627 4029 msgstr ""
dongsheng@627 4030
dongsheng@627 4031 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4032 #: ../en/ch02-tour-basic.xml:337
dongsheng@627 4033 msgid ""
dongsheng@627 4034 "Mercurial also honours the order in which you specify revisions, so <command "
dongsheng@627 4035 "role=\"hg-cmd\">hg log -r 2:4</command> prints 2, 3, and 4. while <command "
dongsheng@627 4036 "role=\"hg-cmd\">hg log -r 4:2</command> prints 4, 3, and 2."
dongsheng@627 4037 msgstr ""
dongsheng@627 4038
dongsheng@627 4039 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 4040 #: ../en/ch02-tour-basic.xml:344
dongsheng@627 4041 msgid "More detailed information"
dongsheng@627 4042 msgstr "更详细的信息"
dongsheng@627 4043
dongsheng@627 4044 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4045 #: ../en/ch02-tour-basic.xml:346
dongsheng@627 4046 msgid ""
dongsheng@627 4047 "While the summary information printed by <command role=\"hg-cmd\">hg log</"
dongsheng@627 4048 "command> is useful if you already know what you're looking for, you may need "
dongsheng@627 4049 "to see a complete description of the change, or a list of the files changed, "
dongsheng@627 4050 "if you're trying to decide whether a changeset is the one you're looking for. "
dongsheng@627 4051 "The <command role=\"hg-cmd\">hg log</command> command's <option role=\"hg-opt-"
dongsheng@627 4052 "global\">-v</option> (or <option role=\"hg-opt-global\">--verbose</option>) "
dongsheng@627 4053 "option gives you this extra detail."
dongsheng@627 4054 msgstr ""
dongsheng@627 4055
dongsheng@627 4056 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4057 #: ../en/ch02-tour-basic.xml:358
dongsheng@627 4058 msgid ""
dongsheng@627 4059 "If you want to see both the description and content of a change, add the "
dongsheng@627 4060 "<option role=\"hg-opt-log\">-p</option> (or <option role=\"hg-opt-log\">--"
dongsheng@627 4061 "patch</option>) option. This displays the content of a change as a "
dongsheng@627 4062 "<emphasis>unified diff</emphasis> (if you've never seen a unified diff "
songdongsheng@658 4063 "before, see <xref linkend=\"sec:mq:patch\"/> for an overview)."
dongsheng@627 4064 msgstr ""
dongsheng@627 4065
songdongsheng@667 4066 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4067 #: ../en/ch02-tour-basic.xml:368
songdongsheng@667 4068 msgid ""
songdongsheng@667 4069 "The <option role=\"hg-opt-log\">-p</option> option is tremendously useful, so "
songdongsheng@667 4070 "it's well worth remembering."
songdongsheng@667 4071 msgstr ""
songdongsheng@667 4072
dongsheng@627 4073 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 4074 #: ../en/ch02-tour-basic.xml:375
dongsheng@627 4075 msgid "All about command options"
dongsheng@627 4076 msgstr "命令选项"
dongsheng@627 4077
dongsheng@627 4078 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4079 #: ../en/ch02-tour-basic.xml:377
dongsheng@627 4080 msgid ""
dongsheng@627 4081 "Let's take a brief break from exploring Mercurial commands to discuss a "
dongsheng@627 4082 "pattern in the way that they work; you may find this useful to keep in mind "
dongsheng@627 4083 "as we continue our tour."
dongsheng@627 4084 msgstr ""
dongsheng@627 4085
dongsheng@627 4086 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4087 #: ../en/ch02-tour-basic.xml:381
dongsheng@627 4088 msgid ""
dongsheng@627 4089 "Mercurial has a consistent and straightforward approach to dealing with the "
dongsheng@627 4090 "options that you can pass to commands. It follows the conventions for "
dongsheng@627 4091 "options that are common to modern Linux and Unix systems."
dongsheng@627 4092 msgstr ""
dongsheng@627 4093
dongsheng@627 4094 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 4095 #: ../en/ch02-tour-basic.xml:388
dongsheng@627 4096 msgid ""
dongsheng@627 4097 "Every option has a long name. For example, as we've already seen, the "
dongsheng@627 4098 "<command role=\"hg-cmd\">hg log</command> command accepts a <option role=\"hg-"
dongsheng@627 4099 "opt-log\">--rev</option> option."
dongsheng@627 4100 msgstr ""
dongsheng@627 4101
dongsheng@627 4102 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 4103 #: ../en/ch02-tour-basic.xml:394
dongsheng@627 4104 msgid ""
dongsheng@627 4105 "Most options have short names, too. Instead of <option role=\"hg-opt-log\">--"
dongsheng@627 4106 "rev</option>, we can use <option role=\"hg-opt-log\">-r</option>. (The "
dongsheng@627 4107 "reason that some options don't have short names is that the options in "
dongsheng@627 4108 "question are rarely used.)"
dongsheng@627 4109 msgstr ""
dongsheng@627 4110
dongsheng@627 4111 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 4112 #: ../en/ch02-tour-basic.xml:401
songdongsheng@667 4113 msgid ""
songdongsheng@667 4114 "Long options start with two dashes (e.g. <option role=\"hg-opt-log\">--rev</"
dongsheng@627 4115 "option>), while short options start with one (e.g. <option role=\"hg-opt-log"
dongsheng@627 4116 "\">-r</option>)."
dongsheng@627 4117 msgstr ""
dongsheng@627 4118
dongsheng@627 4119 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 4120 #: ../en/ch02-tour-basic.xml:407
dongsheng@627 4121 msgid ""
dongsheng@627 4122 "Option naming and usage is consistent across commands. For example, every "
dongsheng@627 4123 "command that lets you specify a changeset ID or revision number accepts both "
dongsheng@627 4124 "<option role=\"hg-opt-log\">-r</option> and <option role=\"hg-opt-log\">--"
dongsheng@627 4125 "rev</option> arguments."
dongsheng@627 4126 msgstr ""
dongsheng@627 4127
songdongsheng@667 4128 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 4129 #: ../en/ch02-tour-basic.xml:414
songdongsheng@667 4130 msgid ""
songdongsheng@667 4131 "If you are using short options, you can save typing by running them together. "
songdongsheng@667 4132 "For example, the command <command role=\"hg-cmd\">hg log -v -p -r 2</command> "
songdongsheng@667 4133 "can be written as <command role=\"hg-cmd\">hg log -vpr2</command>."
songdongsheng@667 4134 msgstr ""
songdongsheng@667 4135
songdongsheng@667 4136 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4137 #: ../en/ch02-tour-basic.xml:421
dongsheng@714 4138 msgid ""
dongsheng@714 4139 "In the examples throughout this book, I usually use short options instead of "
dongsheng@714 4140 "long. This simply reflects my own preference, so don't read anything "
dongsheng@714 4141 "significant into it."
dongsheng@714 4142 msgstr ""
dongsheng@714 4143
dongsheng@714 4144 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4145 #: ../en/ch02-tour-basic.xml:425
dongsheng@627 4146 msgid ""
dongsheng@627 4147 "Most commands that print output of some kind will print more output when "
dongsheng@627 4148 "passed a <option role=\"hg-opt-global\">-v</option> (or <option role=\"hg-opt-"
dongsheng@627 4149 "global\">--verbose</option>) option, and less when passed <option role=\"hg-"
dongsheng@627 4150 "opt-global\">-q</option> (or <option role=\"hg-opt-global\">--quiet</option>)."
dongsheng@627 4151 msgstr ""
dongsheng@627 4152
songdongsheng@667 4153 #. type: Content of: <book><chapter><sect1><note><title>
dongsheng@714 4154 #: ../en/ch02-tour-basic.xml:432
songdongsheng@667 4155 msgid "Option naming consistency"
songdongsheng@667 4156 msgstr ""
songdongsheng@667 4157
songdongsheng@667 4158 #. type: Content of: <book><chapter><sect1><note><para>
dongsheng@714 4159 #: ../en/ch02-tour-basic.xml:434
songdongsheng@667 4160 msgid ""
songdongsheng@667 4161 "Almost always, Mercurial commands use consistent option names to refer to the "
songdongsheng@667 4162 "same concepts. For instance, if a command deals with changesets, you'll "
songdongsheng@667 4163 "always identify them with <option role=\"hg-opt-log\">--rev</option> or "
songdongsheng@667 4164 "<option role=\"hg-opt-log\">-r</option>. This consistent use of option names "
songdongsheng@667 4165 "makes it easier to remember what options a particular command takes."
songdongsheng@667 4166 msgstr ""
songdongsheng@667 4167
dongsheng@627 4168 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 4169 #: ../en/ch02-tour-basic.xml:445
dongsheng@627 4170 msgid "Making and reviewing changes"
dongsheng@627 4171 msgstr "创建和复审修改"
dongsheng@627 4172
dongsheng@627 4173 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4174 #: ../en/ch02-tour-basic.xml:447
dongsheng@627 4175 msgid ""
dongsheng@627 4176 "Now that we have a grasp of viewing history in Mercurial, let's take a look "
dongsheng@627 4177 "at making some changes and examining them."
dongsheng@627 4178 msgstr ""
dongsheng@627 4179
dongsheng@627 4180 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4181 #: ../en/ch02-tour-basic.xml:451
dongsheng@627 4182 msgid ""
dongsheng@627 4183 "The first thing we'll do is isolate our experiment in a repository of its "
dongsheng@627 4184 "own. We use the <command role=\"hg-cmd\">hg clone</command> command, but we "
dongsheng@627 4185 "don't need to clone a copy of the remote repository. Since we already have a "
dongsheng@627 4186 "copy of it locally, we can just clone that instead. This is much faster than "
dongsheng@627 4187 "cloning over the network, and cloning a local repository uses less disk space "
songdongsheng@667 4188 "in most cases, too<placeholder type=\"footnote\" id=\"0\"/>."
songdongsheng@667 4189 msgstr ""
songdongsheng@667 4190
songdongsheng@667 4191 #. type: Content of: <book><chapter><sect1><para><footnote><para>
dongsheng@714 4192 #: ../en/ch02-tour-basic.xml:458
songdongsheng@667 4193 msgid ""
songdongsheng@667 4194 "The saving of space arises when source and destination repositories are on "
songdongsheng@667 4195 "the same filesystem, in which case Mercurial will use hardlinks to do copy-on-"
songdongsheng@667 4196 "write sharing of its internal metadata. If that explanation meant nothing to "
songdongsheng@667 4197 "you, don't worry: everything happens transparently and automatically, and you "
songdongsheng@667 4198 "don't need to understand it."
songdongsheng@667 4199 msgstr ""
songdongsheng@667 4200
songdongsheng@667 4201 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4202 #: ../en/ch02-tour-basic.xml:468
dongsheng@627 4203 msgid ""
dongsheng@627 4204 "As an aside, it's often good practice to keep a <quote>pristine</quote> copy "
dongsheng@627 4205 "of a remote repository around, which you can then make temporary clones of to "
dongsheng@627 4206 "create sandboxes for each task you want to work on. This lets you work on "
dongsheng@627 4207 "multiple tasks in parallel, each isolated from the others until it's complete "
dongsheng@627 4208 "and you're ready to integrate it back. Because local clones are so cheap, "
dongsheng@627 4209 "there's almost no overhead to cloning and destroying repositories whenever "
dongsheng@627 4210 "you want."
dongsheng@627 4211 msgstr ""
dongsheng@627 4212
dongsheng@627 4213 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4214 #: ../en/ch02-tour-basic.xml:477
dongsheng@627 4215 msgid ""
dongsheng@627 4216 "In our <filename class=\"directory\">my-hello</filename> repository, we have "
dongsheng@627 4217 "a file <filename>hello.c</filename> that contains the classic <quote>hello, "
songdongsheng@667 4218 "world</quote> program."
songdongsheng@667 4219 msgstr ""
songdongsheng@667 4220
songdongsheng@667 4221 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4222 #: ../en/ch02-tour-basic.xml:483
songdongsheng@667 4223 msgid "Let's edit this file so that it prints a second line of output."
songdongsheng@667 4224 msgstr ""
songdongsheng@667 4225
songdongsheng@667 4226 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4227 #: ../en/ch02-tour-basic.xml:488
dongsheng@627 4228 msgid ""
dongsheng@627 4229 "Mercurial's <command role=\"hg-cmd\">hg status</command> command will tell us "
dongsheng@627 4230 "what Mercurial knows about the files in the repository."
dongsheng@627 4231 msgstr ""
dongsheng@627 4232
dongsheng@627 4233 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4234 #: ../en/ch02-tour-basic.xml:494
dongsheng@627 4235 msgid ""
dongsheng@627 4236 "The <command role=\"hg-cmd\">hg status</command> command prints no output for "
dongsheng@627 4237 "some files, but a line starting with <quote><literal>M</literal></quote> for "
dongsheng@627 4238 "<filename>hello.c</filename>. Unless you tell it to, <command role=\"hg-cmd"
dongsheng@627 4239 "\">hg status</command> will not print any output for files that have not been "
dongsheng@627 4240 "modified."
dongsheng@627 4241 msgstr ""
dongsheng@627 4242
dongsheng@627 4243 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4244 #: ../en/ch02-tour-basic.xml:501
dongsheng@627 4245 msgid ""
dongsheng@627 4246 "The <quote><literal>M</literal></quote> indicates that Mercurial has noticed "
dongsheng@627 4247 "that we modified <filename>hello.c</filename>. We didn't need to "
dongsheng@627 4248 "<emphasis>inform</emphasis> Mercurial that we were going to modify the file "
dongsheng@627 4249 "before we started, or that we had modified the file after we were done; it "
dongsheng@627 4250 "was able to figure this out itself."
dongsheng@627 4251 msgstr ""
dongsheng@627 4252
dongsheng@627 4253 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4254 #: ../en/ch02-tour-basic.xml:509
songdongsheng@667 4255 msgid ""
songdongsheng@667 4256 "It's somewhat helpful to know that we've modified <filename>hello.c</"
dongsheng@627 4257 "filename>, but we might prefer to know exactly <emphasis>what</emphasis> "
dongsheng@627 4258 "changes we've made to it. To do this, we use the <command role=\"hg-cmd\">hg "
dongsheng@627 4259 "diff</command> command."
dongsheng@627 4260 msgstr ""
dongsheng@627 4261
dongsheng@627 4262 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 4263 #: ../en/ch02-tour-basic.xml:518 ../en/ch12-mq.xml:187
songdongsheng@667 4264 msgid "Understanding patches"
songdongsheng@667 4265 msgstr "理解补丁"
songdongsheng@667 4266
songdongsheng@667 4267 #. type: Content of: <book><chapter><sect1><tip><para>
dongsheng@714 4268 #: ../en/ch02-tour-basic.xml:520
songdongsheng@667 4269 msgid ""
songdongsheng@667 4270 "Remember to take a look at <xref linkend=\"sec:mq:patch\"/> if you don't know "
songdongsheng@667 4271 "how to read output above."
songdongsheng@667 4272 msgstr ""
songdongsheng@667 4273
songdongsheng@667 4274 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 4275 #: ../en/ch02-tour-basic.xml:526
dongsheng@627 4276 msgid "Recording changes in a new changeset"
dongsheng@627 4277 msgstr "在新修改集中记录修改"
dongsheng@627 4278
dongsheng@627 4279 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4280 #: ../en/ch02-tour-basic.xml:528
dongsheng@627 4281 msgid ""
dongsheng@627 4282 "We can modify files, build and test our changes, and use <command role=\"hg-"
dongsheng@627 4283 "cmd\">hg status</command> and <command role=\"hg-cmd\">hg diff</command> to "
dongsheng@627 4284 "review our changes, until we're satisfied with what we've done and arrive at "
dongsheng@627 4285 "a natural stopping point where we want to record our work in a new changeset."
dongsheng@627 4286 msgstr ""
dongsheng@627 4287
dongsheng@627 4288 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4289 #: ../en/ch02-tour-basic.xml:535
dongsheng@627 4290 msgid ""
dongsheng@627 4291 "The <command role=\"hg-cmd\">hg commit</command> command lets us create a new "
dongsheng@627 4292 "changeset; we'll usually refer to this as <quote>making a commit</quote> or "
dongsheng@627 4293 "<quote>committing</quote>."
dongsheng@627 4294 msgstr ""
dongsheng@627 4295
dongsheng@627 4296 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 4297 #: ../en/ch02-tour-basic.xml:541
dongsheng@627 4298 msgid "Setting up a username"
dongsheng@627 4299 msgstr "配置用户名称"
dongsheng@627 4300
dongsheng@627 4301 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4302 #: ../en/ch02-tour-basic.xml:543
dongsheng@627 4303 msgid ""
dongsheng@627 4304 "When you try to run <command role=\"hg-cmd\">hg commit</command> for the "
dongsheng@627 4305 "first time, it is not guaranteed to succeed. Mercurial records your name and "
dongsheng@627 4306 "address with each change that you commit, so that you and others will later "
dongsheng@627 4307 "be able to tell who made each change. Mercurial tries to automatically "
dongsheng@627 4308 "figure out a sensible username to commit the change with. It will attempt "
dongsheng@627 4309 "each of the following methods, in order:"
dongsheng@627 4310 msgstr ""
dongsheng@627 4311
dongsheng@627 4312 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 4313 #: ../en/ch02-tour-basic.xml:552
dongsheng@627 4314 msgid ""
dongsheng@627 4315 "If you specify a <option role=\"hg-opt-commit\">-u</option> option to the "
dongsheng@627 4316 "<command role=\"hg-cmd\">hg commit</command> command on the command line, "
dongsheng@627 4317 "followed by a username, this is always given the highest precedence."
dongsheng@627 4318 msgstr ""
dongsheng@627 4319
dongsheng@627 4320 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 4321 #: ../en/ch02-tour-basic.xml:557
dongsheng@627 4322 msgid ""
dongsheng@627 4323 "If you have set the <envar>HGUSER</envar> environment variable, this is "
dongsheng@627 4324 "checked next."
dongsheng@627 4325 msgstr ""
dongsheng@627 4326
dongsheng@627 4327 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 4328 #: ../en/ch02-tour-basic.xml:560
dongsheng@627 4329 msgid ""
dongsheng@627 4330 "If you create a file in your home directory called <filename role=\"special"
dongsheng@627 4331 "\">.hgrc</filename>, with a <envar role=\"rc-item-ui\">username</envar> "
dongsheng@627 4332 "entry, that will be used next. To see what the contents of this file should "
songdongsheng@658 4333 "look like, refer to <xref linkend=\"sec:tour-basic:username\"/> below."
dongsheng@627 4334 msgstr ""
dongsheng@627 4335
dongsheng@627 4336 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 4337 #: ../en/ch02-tour-basic.xml:568
dongsheng@627 4338 msgid ""
dongsheng@627 4339 "If you have set the <envar>EMAIL</envar> environment variable, this will be "
dongsheng@627 4340 "used next."
dongsheng@627 4341 msgstr ""
dongsheng@627 4342
dongsheng@627 4343 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 4344 #: ../en/ch02-tour-basic.xml:571
dongsheng@627 4345 msgid ""
dongsheng@627 4346 "Mercurial will query your system to find out your local user name and host "
dongsheng@627 4347 "name, and construct a username from these components. Since this often "
dongsheng@627 4348 "results in a username that is not very useful, it will print a warning if it "
dongsheng@627 4349 "has to do this."
dongsheng@627 4350 msgstr ""
dongsheng@627 4351
dongsheng@627 4352 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4353 #: ../en/ch02-tour-basic.xml:578
dongsheng@627 4354 msgid ""
dongsheng@627 4355 "If all of these mechanisms fail, Mercurial will fail, printing an error "
dongsheng@627 4356 "message. In this case, it will not let you commit until you set up a "
dongsheng@627 4357 "username."
dongsheng@627 4358 msgstr ""
dongsheng@627 4359
dongsheng@627 4360 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4361 #: ../en/ch02-tour-basic.xml:582
dongsheng@627 4362 msgid ""
dongsheng@627 4363 "You should think of the <envar>HGUSER</envar> environment variable and the "
dongsheng@627 4364 "<option role=\"hg-opt-commit\">-u</option> option to the <command role=\"hg-"
dongsheng@627 4365 "cmd\">hg commit</command> command as ways to <emphasis>override</emphasis> "
dongsheng@627 4366 "Mercurial's default selection of username. For normal use, the simplest and "
dongsheng@627 4367 "most robust way to set a username for yourself is by creating a <filename "
dongsheng@627 4368 "role=\"special\">.hgrc</filename> file; see below for details."
dongsheng@627 4369 msgstr ""
dongsheng@627 4370
dongsheng@627 4371 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 4372 #: ../en/ch02-tour-basic.xml:591
dongsheng@627 4373 msgid "Creating a Mercurial configuration file"
dongsheng@627 4374 msgstr "创建 Mercurial 的配置文件"
dongsheng@627 4375
dongsheng@627 4376 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 4377 #: ../en/ch02-tour-basic.xml:593
dongsheng@627 4378 msgid ""
songdongsheng@710 4379 "To set a user name, use your favorite editor to create a file called "
dongsheng@627 4380 "<filename role=\"special\">.hgrc</filename> in your home directory. "
dongsheng@627 4381 "Mercurial will use this file to look up your personalised configuration "
dongsheng@627 4382 "settings. The initial contents of your <filename role=\"special\">.hgrc</"
dongsheng@627 4383 "filename> should look like this."
dongsheng@627 4384 msgstr ""
dongsheng@627 4385
dongsheng@714 4386 #. type: Content of: <book><chapter><sect1><sect2><sect3><tip><title>
dongsheng@714 4387 #: ../en/ch02-tour-basic.xml:602
dongsheng@714 4388 msgid "<quote>Home directory</quote> on Windows"
dongsheng@714 4389 msgstr ""
dongsheng@714 4390
dongsheng@714 4391 #. type: Content of: <book><chapter><sect1><sect2><sect3><tip><para>
dongsheng@714 4392 #: ../en/ch02-tour-basic.xml:604
dongsheng@714 4393 msgid ""
dongsheng@714 4394 "When we refer to your home directory, on an English language installation of "
dongsheng@714 4395 "Windows this will usually be a folder named after your user name in "
dongsheng@714 4396 "<filename>C:\\Documents and Settings</filename>. You can find out the exact "
dongsheng@714 4397 "name of your home directory by opening a command prompt window and running "
dongsheng@714 4398 "the following command."
dongsheng@714 4399 msgstr ""
dongsheng@714 4400
dongsheng@714 4401 #. type: Content of: <book><chapter><sect1><sect2><sect3><tip><screen><prompt>
dongsheng@714 4402 #: ../en/ch02-tour-basic.xml:612
dongsheng@714 4403 msgid "C:\\>"
dongsheng@715 4404 msgstr "C:\\>"
dongsheng@714 4405
dongsheng@714 4406 #. type: Content of: <book><chapter><sect1><sect2><sect3><tip><screen><userinput>
dongsheng@714 4407 #: ../en/ch02-tour-basic.xml:612
dongsheng@714 4408 msgid "echo %UserProfile%"
dongsheng@715 4409 msgstr "echo %UserProfile%"
songdongsheng@667 4410
dongsheng@627 4411 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 4412 #: ../en/ch02-tour-basic.xml:619
dongsheng@627 4413 msgid ""
dongsheng@627 4414 "The <quote><literal>[ui]</literal></quote> line begins a <emphasis>section</"
dongsheng@627 4415 "emphasis> of the config file, so you can read the <quote><literal>username "
dongsheng@627 4416 "= ...</literal></quote> line as meaning <quote>set the value of the "
dongsheng@627 4417 "<literal>username</literal> item in the <literal>ui</literal> section</"
dongsheng@627 4418 "quote>. A section continues until a new section begins, or the end of the "
dongsheng@627 4419 "file. Mercurial ignores empty lines and treats any text from "
dongsheng@627 4420 "<quote><literal>#</literal></quote> to the end of a line as a comment."
dongsheng@627 4421 msgstr ""
dongsheng@627 4422
dongsheng@627 4423 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 4424 #: ../en/ch02-tour-basic.xml:632
dongsheng@627 4425 msgid "Choosing a user name"
dongsheng@627 4426 msgstr "选择用户名称"
dongsheng@627 4427
dongsheng@627 4428 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 4429 #: ../en/ch02-tour-basic.xml:634
dongsheng@627 4430 msgid ""
dongsheng@627 4431 "You can use any text you like as the value of the <literal>username</literal> "
songdongsheng@667 4432 "config item, since this information is for reading by other people, but will "
songdongsheng@667 4433 "not be interpreted by Mercurial. The convention that most people follow is "
songdongsheng@667 4434 "to use their name and email address, as in the example above."
dongsheng@627 4435 msgstr ""
dongsheng@627 4436
dongsheng@627 4437 #. type: Content of: <book><chapter><sect1><sect2><sect3><note><para>
dongsheng@714 4438 #: ../en/ch02-tour-basic.xml:641
dongsheng@627 4439 msgid ""
dongsheng@627 4440 "Mercurial's built-in web server obfuscates email addresses, to make it more "
dongsheng@627 4441 "difficult for the email harvesting tools that spammers use. This reduces the "
dongsheng@627 4442 "likelihood that you'll start receiving more junk email if you publish a "
dongsheng@627 4443 "Mercurial repository on the web."
dongsheng@627 4444 msgstr ""
dongsheng@627 4445
dongsheng@627 4446 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 4447 #: ../en/ch02-tour-basic.xml:650
dongsheng@627 4448 msgid "Writing a commit message"
dongsheng@627 4449 msgstr "写提交日志"
dongsheng@627 4450
dongsheng@627 4451 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4452 #: ../en/ch02-tour-basic.xml:652
dongsheng@627 4453 msgid ""
dongsheng@627 4454 "When we commit a change, Mercurial drops us into a text editor, to enter a "
dongsheng@627 4455 "message that will describe the modifications we've made in this changeset. "
dongsheng@627 4456 "This is called the <emphasis>commit message</emphasis>. It will be a record "
dongsheng@627 4457 "for readers of what we did and why, and it will be printed by <command role="
dongsheng@627 4458 "\"hg-cmd\">hg log</command> after we've finished committing."
dongsheng@627 4459 msgstr ""
dongsheng@627 4460
dongsheng@627 4461 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4462 #: ../en/ch02-tour-basic.xml:662
dongsheng@627 4463 msgid ""
dongsheng@627 4464 "The editor that the <command role=\"hg-cmd\">hg commit</command> command "
songdongsheng@667 4465 "drops us into will contain an empty line or two, followed by a number of "
songdongsheng@667 4466 "lines starting with <quote><literal>HG:</literal></quote>."
songdongsheng@667 4467 msgstr ""
songdongsheng@667 4468
songdongsheng@667 4469 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4470 #: ../en/ch02-tour-basic.xml:676
dongsheng@627 4471 msgid ""
dongsheng@627 4472 "Mercurial ignores the lines that start with <quote><literal>HG:</literal></"
dongsheng@627 4473 "quote>; it uses them only to tell us which files it's recording changes to. "
dongsheng@627 4474 "Modifying or deleting these lines has no effect."
dongsheng@627 4475 msgstr ""
dongsheng@627 4476
dongsheng@627 4477 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 4478 #: ../en/ch02-tour-basic.xml:682
dongsheng@627 4479 msgid "Writing a good commit message"
dongsheng@627 4480 msgstr "写好提交日志"
dongsheng@627 4481
dongsheng@627 4482 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4483 #: ../en/ch02-tour-basic.xml:684
dongsheng@627 4484 msgid ""
dongsheng@627 4485 "Since <command role=\"hg-cmd\">hg log</command> only prints the first line of "
dongsheng@627 4486 "a commit message by default, it's best to write a commit message whose first "
dongsheng@627 4487 "line stands alone. Here's a real example of a commit message that "
dongsheng@627 4488 "<emphasis>doesn't</emphasis> follow this guideline, and hence has a summary "
dongsheng@627 4489 "that is not readable."
dongsheng@627 4490 msgstr ""
dongsheng@627 4491
dongsheng@627 4492 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4493 #: ../en/ch02-tour-basic.xml:697
dongsheng@627 4494 msgid ""
dongsheng@627 4495 "As far as the remainder of the contents of the commit message are concerned, "
dongsheng@627 4496 "there are no hard-and-fast rules. Mercurial itself doesn't interpret or care "
dongsheng@627 4497 "about the contents of the commit message, though your project may have "
dongsheng@627 4498 "policies that dictate a certain kind of formatting."
dongsheng@627 4499 msgstr ""
dongsheng@627 4500
dongsheng@627 4501 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4502 #: ../en/ch02-tour-basic.xml:702
dongsheng@627 4503 msgid ""
dongsheng@627 4504 "My personal preference is for short, but informative, commit messages that "
dongsheng@627 4505 "tell me something that I can't figure out with a quick glance at the output "
dongsheng@627 4506 "of <command role=\"hg-cmd\">hg log --patch</command>."
dongsheng@627 4507 msgstr ""
dongsheng@627 4508
dongsheng@714 4509 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4510 #: ../en/ch02-tour-basic.xml:706
dongsheng@714 4511 msgid ""
dongsheng@714 4512 "If we run the <command role=\"hg-cmd\">hg commit</command> command without "
dongsheng@714 4513 "any arguments, it records all of the changes we've made, as reported by "
dongsheng@714 4514 "<command role=\"hg-cmd\">hg status</command> and <command role=\"hg-cmd\">hg "
dongsheng@714 4515 "diff</command>."
dongsheng@714 4516 msgstr ""
dongsheng@714 4517
dongsheng@714 4518 #. type: Content of: <book><chapter><sect1><sect2><note><title>
dongsheng@714 4519 #: ../en/ch02-tour-basic.xml:713
dongsheng@714 4520 msgid "A surprise for Subversion users"
dongsheng@714 4521 msgstr ""
dongsheng@714 4522
dongsheng@714 4523 #. type: Content of: <book><chapter><sect1><sect2><note><para>
dongsheng@714 4524 #: ../en/ch02-tour-basic.xml:715
dongsheng@714 4525 msgid ""
dongsheng@714 4526 "Like other Mercurial commands, if we don't supply explicit names to commit to "
dongsheng@714 4527 "the <command role=\"hg-cmd\">hg commit</command>, it will operate across a "
dongsheng@714 4528 "repository's entire working directory. Be wary of this if you're coming from "
dongsheng@714 4529 "the Subversion or CVS world, since you might expect it to operate only on the "
dongsheng@714 4530 "current directory that you happen to be visiting and its subdirectories."
dongsheng@714 4531 msgstr ""
dongsheng@714 4532
dongsheng@627 4533 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 4534 #: ../en/ch02-tour-basic.xml:726
dongsheng@627 4535 msgid "Aborting a commit"
dongsheng@627 4536 msgstr "终止提交"
dongsheng@627 4537
dongsheng@627 4538 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4539 #: ../en/ch02-tour-basic.xml:728
dongsheng@627 4540 msgid ""
dongsheng@627 4541 "If you decide that you don't want to commit while in the middle of editing a "
dongsheng@627 4542 "commit message, simply exit from your editor without saving the file that "
dongsheng@627 4543 "it's editing. This will cause nothing to happen to either the repository or "
dongsheng@627 4544 "the working directory."
dongsheng@627 4545 msgstr ""
dongsheng@627 4546
dongsheng@627 4547 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 4548 #: ../en/ch02-tour-basic.xml:736
dongsheng@627 4549 msgid "Admiring our new handiwork"
songdongsheng@665 4550 msgstr "欣赏我们的成果"
dongsheng@627 4551
dongsheng@627 4552 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4553 #: ../en/ch02-tour-basic.xml:738
dongsheng@627 4554 msgid ""
dongsheng@627 4555 "Once we've finished the commit, we can use the <command role=\"hg-cmd\">hg "
dongsheng@627 4556 "tip</command> command to display the changeset we just created. This command "
dongsheng@627 4557 "produces output that is identical to <command role=\"hg-cmd\">hg log</"
dongsheng@627 4558 "command>, but it only displays the newest revision in the repository."
dongsheng@627 4559 msgstr ""
dongsheng@627 4560
dongsheng@627 4561 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4562 #: ../en/ch02-tour-basic.xml:746
songdongsheng@667 4563 msgid ""
songdongsheng@667 4564 "We refer to the newest revision in the repository as the <emphasis>tip "
songdongsheng@667 4565 "revision</emphasis>, or simply the <emphasis>tip</emphasis>."
songdongsheng@667 4566 msgstr ""
songdongsheng@667 4567
songdongsheng@667 4568 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4569 #: ../en/ch02-tour-basic.xml:750
songdongsheng@667 4570 msgid ""
songdongsheng@667 4571 "By the way, the <command role=\"hg-cmd\">hg tip</command> command accepts "
songdongsheng@667 4572 "many of the same options as <command role=\"hg-cmd\">hg log</command>, so "
songdongsheng@667 4573 "<option role=\"hg-opt-global\">-v</option> above indicates <quote>be verbose</"
songdongsheng@667 4574 "quote>, <option role=\"hg-opt-tip\">-p</option> specifies <quote>print a "
songdongsheng@667 4575 "patch</quote>. The use of <option role=\"hg-opt-tip\">-p</option> to print "
songdongsheng@667 4576 "patches is another example of the consistent naming we mentioned earlier."
dongsheng@627 4577 msgstr ""
dongsheng@627 4578
dongsheng@627 4579 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 4580 #: ../en/ch02-tour-basic.xml:762
dongsheng@627 4581 msgid "Sharing changes"
dongsheng@627 4582 msgstr "共享修改"
dongsheng@627 4583
dongsheng@627 4584 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4585 #: ../en/ch02-tour-basic.xml:764
dongsheng@627 4586 msgid ""
dongsheng@627 4587 "We mentioned earlier that repositories in Mercurial are self-contained. This "
dongsheng@627 4588 "means that the changeset we just created exists only in our <filename class="
dongsheng@627 4589 "\"directory\">my-hello</filename> repository. Let's look at a few ways that "
dongsheng@627 4590 "we can propagate this change into other repositories."
dongsheng@627 4591 msgstr ""
dongsheng@627 4592
dongsheng@627 4593 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 4594 #: ../en/ch02-tour-basic.xml:772
dongsheng@627 4595 msgid "Pulling changes from another repository"
dongsheng@627 4596 msgstr "从其它版本库取得修改"
dongsheng@627 4597
dongsheng@627 4598 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4599 #: ../en/ch02-tour-basic.xml:774
dongsheng@627 4600 msgid ""
dongsheng@627 4601 "To get started, let's clone our original <filename class=\"directory\">hello</"
dongsheng@627 4602 "filename> repository, which does not contain the change we just committed. "
dongsheng@627 4603 "We'll call our temporary repository <filename class=\"directory\">hello-pull</"
dongsheng@627 4604 "filename>."
dongsheng@627 4605 msgstr ""
dongsheng@627 4606
dongsheng@627 4607 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4608 #: ../en/ch02-tour-basic.xml:782
dongsheng@627 4609 msgid ""
dongsheng@627 4610 "We'll use the <command role=\"hg-cmd\">hg pull</command> command to bring "
dongsheng@627 4611 "changes from <filename class=\"directory\">my-hello</filename> into <filename "
dongsheng@627 4612 "class=\"directory\">hello-pull</filename>. However, blindly pulling unknown "
dongsheng@627 4613 "changes into a repository is a somewhat scary prospect. Mercurial provides "
dongsheng@627 4614 "the <command role=\"hg-cmd\">hg incoming</command> command to tell us what "
dongsheng@627 4615 "changes the <command role=\"hg-cmd\">hg pull</command> command "
dongsheng@627 4616 "<emphasis>would</emphasis> pull into the repository, without actually pulling "
dongsheng@627 4617 "the changes in."
dongsheng@627 4618 msgstr ""
dongsheng@627 4619
dongsheng@627 4620 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4621 #: ../en/ch02-tour-basic.xml:795
dongsheng@714 4622 msgid ""
dongsheng@714 4623 "Bringing changes into a repository is a simple matter of running the <command "
dongsheng@714 4624 "role=\"hg-cmd\">hg pull</command> command, and optionally telling it which "
dongsheng@714 4625 "repository to pull from."
dongsheng@714 4626 msgstr ""
dongsheng@714 4627
dongsheng@714 4628 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4629 #: ../en/ch02-tour-basic.xml:801
dongsheng@714 4630 msgid ""
dongsheng@714 4631 "As you can see from the before-and-after output of <command role=\"hg-cmd"
dongsheng@714 4632 "\">hg tip</command>, we have successfully pulled changes into our "
dongsheng@714 4633 "repository. However, Mercurial separates pulling changes in from updating "
dongsheng@714 4634 "the working directory. There remains one step before we will see the changes "
dongsheng@714 4635 "that we just pulled appear in the working directory."
dongsheng@714 4636 msgstr ""
dongsheng@714 4637
dongsheng@714 4638 #. type: Content of: <book><chapter><sect1><sect2><tip><title>
dongsheng@714 4639 #: ../en/ch02-tour-basic.xml:810
dongsheng@714 4640 msgid "Pulling specific changes"
dongsheng@715 4641 msgstr "提取指定的修改"
dongsheng@714 4642
dongsheng@714 4643 #. type: Content of: <book><chapter><sect1><sect2><tip><para>
dongsheng@714 4644 #: ../en/ch02-tour-basic.xml:812
dongsheng@714 4645 msgid ""
dongsheng@714 4646 "It is possible that due to the delay between running <command role=\"hg-cmd"
dongsheng@714 4647 "\">hg incoming</command> and <command role=\"hg-cmd\">hg pull</command>, you "
dongsheng@714 4648 "may not see all changesets that will be brought from the other repository. "
songdongsheng@667 4649 "Suppose you're pulling changes from a repository on the network somewhere. "
songdongsheng@667 4650 "While you are looking at the <command role=\"hg-cmd\">hg incoming</command> "
songdongsheng@667 4651 "output, and before you pull those changes, someone might have committed "
songdongsheng@667 4652 "something in the remote repository. This means that it's possible to pull "
songdongsheng@667 4653 "more changes than you saw when using <command role=\"hg-cmd\">hg incoming</"
songdongsheng@667 4654 "command>."
songdongsheng@667 4655 msgstr ""
songdongsheng@667 4656
dongsheng@714 4657 #. type: Content of: <book><chapter><sect1><sect2><tip><para>
dongsheng@714 4658 #: ../en/ch02-tour-basic.xml:824
dongsheng@714 4659 msgid ""
dongsheng@714 4660 "If you only want to pull precisely the changes that were listed by <command "
dongsheng@714 4661 "role=\"hg-cmd\">hg incoming</command>, or you have some other reason to pull "
dongsheng@714 4662 "a subset of changes, simply identify the change that you want to pull by its "
dongsheng@714 4663 "changeset ID, e.g. <command>hg pull -r7e95bb</command>."
dongsheng@627 4664 msgstr ""
dongsheng@627 4665
dongsheng@627 4666 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 4667 #: ../en/ch02-tour-basic.xml:834
dongsheng@627 4668 msgid "Updating the working directory"
dongsheng@627 4669 msgstr "更新工作目录"
dongsheng@627 4670
dongsheng@627 4671 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4672 #: ../en/ch02-tour-basic.xml:836
dongsheng@627 4673 msgid ""
dongsheng@627 4674 "We have so far glossed over the relationship between a repository and its "
dongsheng@627 4675 "working directory. The <command role=\"hg-cmd\">hg pull</command> command "
songdongsheng@658 4676 "that we ran in <xref linkend=\"sec:tour:pull\"/> brought changes into the "
songdongsheng@658 4677 "repository, but if we check, there's no sign of those changes in the working "
songdongsheng@658 4678 "directory. This is because <command role=\"hg-cmd\">hg pull</command> does "
songdongsheng@658 4679 "not (by default) touch the working directory. Instead, we use the <command "
songdongsheng@658 4680 "role=\"hg-cmd\">hg update</command> command to do this."
songdongsheng@658 4681 msgstr ""
songdongsheng@658 4682
songdongsheng@658 4683 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4684 #: ../en/ch02-tour-basic.xml:848
dongsheng@627 4685 msgid ""
dongsheng@627 4686 "It might seem a bit strange that <command role=\"hg-cmd\">hg pull</command> "
dongsheng@627 4687 "doesn't update the working directory automatically. There's actually a good "
dongsheng@627 4688 "reason for this: you can use <command role=\"hg-cmd\">hg update</command> to "
dongsheng@627 4689 "update the working directory to the state it was in at <emphasis>any "
dongsheng@627 4690 "revision</emphasis> in the history of the repository. If you had the working "
songdongsheng@668 4691 "directory updated to an old revision&emdash;to hunt down the origin of a bug, "
songdongsheng@668 4692 "say&emdash;and ran a <command role=\"hg-cmd\">hg pull</command> which "
songdongsheng@668 4693 "automatically updated the working directory to a new revision, you might not "
songdongsheng@668 4694 "be terribly happy."
songdongsheng@667 4695 msgstr ""
songdongsheng@667 4696
songdongsheng@667 4697 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4698 #: ../en/ch02-tour-basic.xml:860
dongsheng@714 4699 msgid ""
dongsheng@714 4700 "Since pull-then-update is such a common sequence of operations, Mercurial "
dongsheng@714 4701 "lets you combine the two by passing the <option role=\"hg-opt-pull\">-u</"
dongsheng@714 4702 "option> option to <command role=\"hg-cmd\">hg pull</command>."
dongsheng@714 4703 msgstr ""
dongsheng@714 4704
dongsheng@714 4705 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4706 #: ../en/ch02-tour-basic.xml:865
dongsheng@627 4707 msgid ""
dongsheng@627 4708 "If you look back at the output of <command role=\"hg-cmd\">hg pull</command> "
songdongsheng@658 4709 "in <xref linkend=\"sec:tour:pull\"/> when we ran it without <option role=\"hg-"
songdongsheng@658 4710 "opt-pull\">-u</option>, you can see that it printed a helpful reminder that "
dongsheng@714 4711 "we'd have to take an explicit step to update the working directory."
dongsheng@714 4712 msgstr ""
dongsheng@714 4713
dongsheng@714 4714 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4715 #: ../en/ch02-tour-basic.xml:872
dongsheng@627 4716 msgid ""
dongsheng@627 4717 "To find out what revision the working directory is at, use the <command role="
dongsheng@627 4718 "\"hg-cmd\">hg parents</command> command."
dongsheng@627 4719 msgstr ""
dongsheng@627 4720
dongsheng@627 4721 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4722 #: ../en/ch02-tour-basic.xml:878
songdongsheng@658 4723 msgid ""
songdongsheng@658 4724 "If you look back at <xref linkend=\"fig:tour-basic:history\"/>, you'll see "
songdongsheng@658 4725 "arrows connecting each changeset. The node that the arrow leads "
songdongsheng@658 4726 "<emphasis>from</emphasis> in each case is a parent, and the node that the "
songdongsheng@658 4727 "arrow leads <emphasis>to</emphasis> is its child. The working directory has "
songdongsheng@658 4728 "a parent in just the same way; this is the changeset that the working "
songdongsheng@658 4729 "directory currently contains."
songdongsheng@658 4730 msgstr ""
songdongsheng@658 4731
songdongsheng@658 4732 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4733 #: ../en/ch02-tour-basic.xml:887
dongsheng@627 4734 msgid ""
dongsheng@627 4735 "To update the working directory to a particular revision, give a revision "
dongsheng@627 4736 "number or changeset ID to the <command role=\"hg-cmd\">hg update</command> "
dongsheng@627 4737 "command."
dongsheng@627 4738 msgstr ""
dongsheng@627 4739
dongsheng@627 4740 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4741 #: ../en/ch02-tour-basic.xml:893
dongsheng@627 4742 msgid ""
dongsheng@627 4743 "If you omit an explicit revision, <command role=\"hg-cmd\">hg update</"
dongsheng@627 4744 "command> will update to the tip revision, as shown by the second call to "
dongsheng@627 4745 "<command role=\"hg-cmd\">hg update</command> in the example above."
dongsheng@627 4746 msgstr ""
dongsheng@627 4747
dongsheng@627 4748 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 4749 #: ../en/ch02-tour-basic.xml:901
dongsheng@627 4750 msgid "Pushing changes to another repository"
dongsheng@627 4751 msgstr "发布修改到其它版本库"
dongsheng@627 4752
dongsheng@627 4753 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4754 #: ../en/ch02-tour-basic.xml:903
dongsheng@627 4755 msgid ""
dongsheng@627 4756 "Mercurial lets us push changes to another repository, from the repository "
dongsheng@714 4757 "we're currently visiting. As with the example of <command role=\"hg-cmd\">hg "
dongsheng@627 4758 "pull</command> above, we'll create a temporary repository to push our changes "
dongsheng@627 4759 "into."
dongsheng@627 4760 msgstr ""
dongsheng@627 4761
dongsheng@627 4762 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4763 #: ../en/ch02-tour-basic.xml:911
dongsheng@627 4764 msgid ""
dongsheng@627 4765 "The <command role=\"hg-cmd\">hg outgoing</command> command tells us what "
dongsheng@627 4766 "changes would be pushed into another repository."
dongsheng@627 4767 msgstr ""
dongsheng@627 4768
dongsheng@627 4769 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4770 #: ../en/ch02-tour-basic.xml:917
dongsheng@627 4771 msgid ""
dongsheng@627 4772 "And the <command role=\"hg-cmd\">hg push</command> command does the actual "
dongsheng@627 4773 "push."
dongsheng@627 4774 msgstr ""
dongsheng@627 4775
dongsheng@627 4776 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4777 #: ../en/ch02-tour-basic.xml:922
dongsheng@627 4778 msgid ""
dongsheng@627 4779 "As with <command role=\"hg-cmd\">hg pull</command>, the <command role=\"hg-cmd"
dongsheng@627 4780 "\">hg push</command> command does not update the working directory in the "
songdongsheng@667 4781 "repository that it's pushing changes into. Unlike <command role=\"hg-cmd\">hg "
songdongsheng@667 4782 "pull</command>, <command role=\"hg-cmd\">hg push</command> does not provide a "
songdongsheng@667 4783 "<literal>-u</literal> option that updates the other repository's working "
songdongsheng@667 4784 "directory. This asymmetry is deliberate: the repository we're pushing to "
songdongsheng@667 4785 "might be on a remote server and shared between several people. If we were to "
songdongsheng@667 4786 "update its working directory while someone was working in it, their work "
songdongsheng@667 4787 "would be disrupted."
songdongsheng@667 4788 msgstr ""
songdongsheng@667 4789
songdongsheng@667 4790 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4791 #: ../en/ch02-tour-basic.xml:934
dongsheng@627 4792 msgid ""
dongsheng@627 4793 "What happens if we try to pull or push changes and the receiving repository "
dongsheng@627 4794 "already has those changes? Nothing too exciting."
dongsheng@627 4795 msgstr ""
dongsheng@627 4796
dongsheng@627 4797 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 4798 #: ../en/ch02-tour-basic.xml:942
dongsheng@714 4799 msgid "Default locations"
dongsheng@716 4800 msgstr "默认位置"
dongsheng@714 4801
dongsheng@714 4802 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4803 #: ../en/ch02-tour-basic.xml:944
dongsheng@714 4804 msgid ""
dongsheng@714 4805 "When we clone a repository, Mercurial records the location of the repository "
dongsheng@714 4806 "we cloned in the <filename>.hg/hgrc</filename> file of the new repository. "
dongsheng@714 4807 "If we don't supply a location to <command>hg pull</command> from or "
dongsheng@714 4808 "<command>hg push</command> to, those commands will use this location as a "
dongsheng@714 4809 "default. The <command>hg incoming</command> and <command>hg outgoing</"
dongsheng@714 4810 "command> commands do so too."
dongsheng@714 4811 msgstr ""
dongsheng@714 4812
dongsheng@714 4813 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4814 #: ../en/ch02-tour-basic.xml:952
dongsheng@714 4815 msgid ""
dongsheng@714 4816 "If you open a repository's <filename>.hg/hgrc</filename> file in a text "
dongsheng@714 4817 "editor, you will see contents like the following."
dongsheng@714 4818 msgstr ""
dongsheng@714 4819
dongsheng@714 4820 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4821 #: ../en/ch02-tour-basic.xml:959
dongsheng@714 4822 msgid ""
dongsheng@714 4823 "It is possible&emdash;and often useful&emdash;to have the default location "
dongsheng@714 4824 "for <command>hg push</command> and <command>hg outgoing</command> be "
dongsheng@714 4825 "different from those for <command>hg pull</command> and <command>hg incoming</"
dongsheng@714 4826 "command>. We can do this by adding a <literal>default-push</literal> entry "
dongsheng@714 4827 "to the <literal>[paths]</literal> section of the <filename>.hg/hgrc</"
dongsheng@714 4828 "filename> file, as follows."
dongsheng@714 4829 msgstr ""
dongsheng@714 4830
dongsheng@714 4831 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 4832 #: ../en/ch02-tour-basic.xml:973
dongsheng@627 4833 msgid "Sharing changes over a network"
dongsheng@627 4834 msgstr "通过网络共享修改"
dongsheng@627 4835
dongsheng@627 4836 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4837 #: ../en/ch02-tour-basic.xml:975
dongsheng@627 4838 msgid ""
dongsheng@627 4839 "The commands we have covered in the previous few sections are not limited to "
dongsheng@627 4840 "working with local repositories. Each works in exactly the same fashion over "
dongsheng@627 4841 "a network connection; simply pass in a URL instead of a local path."
dongsheng@627 4842 msgstr ""
dongsheng@627 4843
dongsheng@627 4844 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 4845 #: ../en/ch02-tour-basic.xml:983
dongsheng@627 4846 msgid ""
dongsheng@627 4847 "In this example, we can see what changes we could push to the remote "
dongsheng@627 4848 "repository, but the repository is understandably not set up to let anonymous "
dongsheng@627 4849 "users push to it."
dongsheng@627 4850 msgstr ""
dongsheng@627 4851
dongsheng@714 4852 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 4853 #: ../en/ch02-tour-basic.xml:993
dongsheng@714 4854 msgid "Starting a new project"
dongsheng@715 4855 msgstr "开始新项目"
dongsheng@714 4856
dongsheng@714 4857 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4858 #: ../en/ch02-tour-basic.xml:995
dongsheng@714 4859 msgid ""
dongsheng@714 4860 "It is just as easy to begin a new project as to work on one that already "
dongsheng@714 4861 "exists. The <command>hg init</command> command creates a new, empty "
dongsheng@714 4862 "Mercurial repository."
dongsheng@714 4863 msgstr ""
dongsheng@714 4864
dongsheng@714 4865 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4866 #: ../en/ch02-tour-basic.xml:1001
dongsheng@714 4867 msgid ""
dongsheng@714 4868 "This simply creates a repository named <filename>myproject</filename> in the "
dongsheng@714 4869 "current directory."
dongsheng@714 4870 msgstr ""
dongsheng@714 4871
dongsheng@714 4872 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4873 #: ../en/ch02-tour-basic.xml:1006
dongsheng@714 4874 msgid ""
dongsheng@714 4875 "We can tell that <filename>myproject</filename> is a Mercurial repository, "
dongsheng@714 4876 "because it contains a <filename>.hg</filename> directory."
dongsheng@714 4877 msgstr ""
dongsheng@714 4878
dongsheng@714 4879 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4880 #: ../en/ch02-tour-basic.xml:1012
dongsheng@714 4881 msgid ""
dongsheng@714 4882 "If we want to add some pre-existing files to the repository, we copy them "
dongsheng@714 4883 "into place, and tell Mercurial to start tracking them using the <command>hg "
dongsheng@714 4884 "add</command> command."
dongsheng@714 4885 msgstr ""
dongsheng@714 4886
dongsheng@714 4887 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4888 #: ../en/ch02-tour-basic.xml:1018
dongsheng@714 4889 msgid ""
dongsheng@714 4890 "Once we are satisfied that our project looks right, we commit our changes."
dongsheng@714 4891 msgstr ""
dongsheng@714 4892
dongsheng@714 4893 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4894 #: ../en/ch02-tour-basic.xml:1023
dongsheng@714 4895 msgid ""
dongsheng@714 4896 "It takes just a few moments to start using Mercurial on a new project, which "
dongsheng@714 4897 "is part of its appeal. Revision control is now so easy to work with, we can "
dongsheng@714 4898 "use it on the smallest of projects that we might not have considered with a "
dongsheng@714 4899 "more complicated tool."
dongsheng@714 4900 msgstr ""
dongsheng@714 4901
dongsheng@627 4902 #. type: Content of: <book><chapter><title>
dongsheng@714 4903 #: ../en/ch03-tour-merge.xml:5
dongsheng@627 4904 msgid "A tour of Mercurial: merging work"
dongsheng@627 4905 msgstr "Mercurial 教程: 合并工作"
dongsheng@627 4906
dongsheng@627 4907 #. type: Content of: <book><chapter><para>
dongsheng@714 4908 #: ../en/ch03-tour-merge.xml:7
dongsheng@627 4909 msgid ""
dongsheng@627 4910 "We've now covered cloning a repository, making changes in a repository, and "
dongsheng@627 4911 "pulling or pushing changes from one repository into another. Our next step "
dongsheng@627 4912 "is <emphasis>merging</emphasis> changes from separate repositories."
dongsheng@627 4913 msgstr ""
dongsheng@627 4914
dongsheng@627 4915 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 4916 #: ../en/ch03-tour-merge.xml:13
dongsheng@627 4917 msgid "Merging streams of work"
dongsheng@627 4918 msgstr "合并的流程"
dongsheng@627 4919
dongsheng@627 4920 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4921 #: ../en/ch03-tour-merge.xml:15
dongsheng@627 4922 msgid ""
dongsheng@627 4923 "Merging is a fundamental part of working with a distributed revision control "
dongsheng@714 4924 "tool. Here are a few cases in which the need to merge work arises."
dongsheng@627 4925 msgstr ""
dongsheng@627 4926
dongsheng@627 4927 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 4928 #: ../en/ch03-tour-merge.xml:20
dongsheng@627 4929 msgid ""
dongsheng@627 4930 "Alice and Bob each have a personal copy of a repository for a project they're "
dongsheng@627 4931 "collaborating on. Alice fixes a bug in her repository; Bob adds a new "
dongsheng@627 4932 "feature in his. They want the shared repository to contain both the bug fix "
dongsheng@627 4933 "and the new feature."
dongsheng@627 4934 msgstr ""
dongsheng@627 4935
dongsheng@627 4936 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 4937 #: ../en/ch03-tour-merge.xml:27
dongsheng@714 4938 msgid ""
dongsheng@714 4939 "Cynthia frequently works on several different tasks for a single project at "
dongsheng@714 4940 "once, each safely isolated in its own repository. Working this way means that "
dongsheng@714 4941 "she often needs to merge one piece of her own work with another."
dongsheng@714 4942 msgstr ""
dongsheng@714 4943
dongsheng@714 4944 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4945 #: ../en/ch03-tour-merge.xml:35
dongsheng@714 4946 msgid ""
dongsheng@714 4947 "Because we need to merge often, Mercurial makes the process easy. Let's walk "
dongsheng@714 4948 "through a merge. We'll begin by cloning yet another repository (see how "
dongsheng@714 4949 "often they spring up?) and making a change in it."
dongsheng@714 4950 msgstr ""
dongsheng@714 4951
dongsheng@714 4952 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4953 #: ../en/ch03-tour-merge.xml:42
dongsheng@627 4954 msgid ""
dongsheng@627 4955 "We should now have two copies of <filename>hello.c</filename> with different "
dongsheng@627 4956 "contents. The histories of the two repositories have also diverged, as "
dongsheng@714 4957 "illustrated in <xref linkend=\"fig:tour-merge:sep-repos\"/>. Here is a copy "
dongsheng@714 4958 "of our file from one repository."
dongsheng@714 4959 msgstr ""
dongsheng@714 4960
dongsheng@714 4961 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4962 #: ../en/ch03-tour-merge.xml:51
dongsheng@714 4963 msgid "And here is our slightly different version from the other repository."
songdongsheng@658 4964 msgstr ""
songdongsheng@658 4965
songdongsheng@658 4966 #. type: Content of: <book><chapter><sect1><figure><title>
dongsheng@714 4967 #: ../en/ch03-tour-merge.xml:57
dongsheng@627 4968 msgid ""
dongsheng@627 4969 "Divergent recent histories of the <filename class=\"directory\">my-hello</"
dongsheng@627 4970 "filename> and <filename class=\"directory\">my-new-hello</filename> "
dongsheng@627 4971 "repositories"
dongsheng@627 4972 msgstr ""
dongsheng@660 4973 "<filename class=\"directory\">my-hello</filename> 与 <filename class="
dongsheng@660 4974 "\"directory\">my-new-hello</filename> 最新的历史分叉"
dongsheng@627 4975
songdongsheng@658 4976 #. type: Content of: <book><chapter><sect1><figure><mediaobject>
dongsheng@714 4977 #: ../en/ch03-tour-merge.xml:62
songdongsheng@658 4978 msgid ""
songdongsheng@658 4979 "<imageobject><imagedata fileref=\"figs/tour-merge-sep-repos.png\"/></"
songdongsheng@658 4980 "imageobject>"
songdongsheng@658 4981 msgstr ""
songdongsheng@658 4982
songdongsheng@658 4983 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4984 #: ../en/ch03-tour-merge.xml:67
dongsheng@627 4985 msgid ""
dongsheng@627 4986 "We already know that pulling changes from our <filename class=\"directory"
dongsheng@627 4987 "\">my-hello</filename> repository will have no effect on the working "
dongsheng@627 4988 "directory."
dongsheng@627 4989 msgstr ""
dongsheng@627 4990
dongsheng@627 4991 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 4992 #: ../en/ch03-tour-merge.xml:73
dongsheng@627 4993 msgid ""
dongsheng@627 4994 "However, the <command role=\"hg-cmd\">hg pull</command> command says "
dongsheng@627 4995 "something about <quote>heads</quote>."
dongsheng@627 4996 msgstr ""
dongsheng@627 4997
dongsheng@627 4998 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 4999 #: ../en/ch03-tour-merge.xml:77
dongsheng@627 5000 msgid "Head changesets"
songdongsheng@665 5001 msgstr "顶点修改集"
dongsheng@627 5002
dongsheng@627 5003 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5004 #: ../en/ch03-tour-merge.xml:79
dongsheng@714 5005 msgid ""
dongsheng@714 5006 "Remember that Mercurial records what the parent of each change is. If a "
dongsheng@714 5007 "change has a parent, we call it a child or descendant of the parent. A head "
dongsheng@714 5008 "is a change that has no children. The tip revision is thus a head, because "
dongsheng@714 5009 "the newest revision in a repository doesn't have any children. There are "
dongsheng@714 5010 "times when a repository can contain more than one head."
dongsheng@627 5011 msgstr ""
dongsheng@627 5012
songdongsheng@658 5013 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
dongsheng@714 5014 #: ../en/ch03-tour-merge.xml:88
dongsheng@627 5015 msgid ""
dongsheng@627 5016 "Repository contents after pulling from <filename class=\"directory\">my-"
dongsheng@627 5017 "hello</filename> into <filename class=\"directory\">my-new-hello</filename>"
dongsheng@627 5018 msgstr ""
dongsheng@660 5019 "从 <filename class=\"directory\">my-hello</filename> 拉到 <filename class="
dongsheng@660 5020 "\"directory\">my-new-hello</filename> 之后版本库的内容"
dongsheng@627 5021
songdongsheng@658 5022 #. type: Content of: <book><chapter><sect1><sect2><figure>
dongsheng@714 5023 #: ../en/ch03-tour-merge.xml:91 ../en/ch03-tour-merge.xml:178
dongsheng@714 5024 #: ../en/ch03-tour-merge.xml:275 ../en/ch04-concepts.xml:57
dongsheng@714 5025 #: ../en/ch04-concepts.xml:106 ../en/ch04-concepts.xml:196
dongsheng@714 5026 #: ../en/ch04-concepts.xml:345 ../en/ch04-concepts.xml:360
dongsheng@714 5027 #: ../en/ch04-concepts.xml:401 ../en/ch04-concepts.xml:421
dongsheng@714 5028 #: ../en/ch04-concepts.xml:465 ../en/ch06-collab.xml:314
dongsheng@714 5029 #: ../en/ch09-undo.xml:342 ../en/ch09-undo.xml:389 ../en/ch09-undo.xml:462
dongsheng@714 5030 #: ../en/ch09-undo.xml:500 ../en/ch09-undo.xml:656 ../en/ch09-undo.xml:680
dongsheng@714 5031 #: ../en/ch09-undo.xml:698 ../en/ch09-undo.xml:712 ../en/ch09-undo.xml:725
dongsheng@714 5032 #: ../en/ch12-mq.xml:411
songdongsheng@658 5033 msgid " <placeholder type=\"mediaobject\" id=\"0\"/>"
songdongsheng@658 5034 msgstr ""
songdongsheng@658 5035
songdongsheng@658 5036 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
dongsheng@714 5037 #: ../en/ch03-tour-merge.xml:92
songdongsheng@658 5038 msgid ""
songdongsheng@658 5039 "<imageobject> <imagedata fileref=\"figs/tour-merge-pull.png\"/> </imageobject>"
songdongsheng@658 5040 msgstr ""
songdongsheng@658 5041
songdongsheng@658 5042 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5043 #: ../en/ch03-tour-merge.xml:99
songdongsheng@658 5044 msgid ""
songdongsheng@658 5045 "In <xref linkend=\"fig:tour-merge:pull\"/>, you can see the effect of the "
songdongsheng@658 5046 "pull from <filename class=\"directory\">my-hello</filename> into <filename "
songdongsheng@658 5047 "class=\"directory\">my-new-hello</filename>. The history that was already "
songdongsheng@658 5048 "present in <filename class=\"directory\">my-new-hello</filename> is "
songdongsheng@658 5049 "untouched, but a new revision has been added. By referring to <xref linkend="
songdongsheng@658 5050 "\"fig:tour-merge:sep-repos\"/>, we can see that the <emphasis>changeset ID</"
songdongsheng@658 5051 "emphasis> remains the same in the new repository, but the <emphasis>revision "
songdongsheng@658 5052 "number</emphasis> has changed. (This, incidentally, is a fine example of why "
songdongsheng@658 5053 "it's not safe to use revision numbers when discussing changesets.) We can "
songdongsheng@658 5054 "view the heads in a repository using the <command role=\"hg-cmd\">hg heads</"
songdongsheng@658 5055 "command> command."
dongsheng@627 5056 msgstr ""
dongsheng@627 5057
dongsheng@627 5058 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 5059 #: ../en/ch03-tour-merge.xml:118
dongsheng@627 5060 msgid "Performing 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:120
dongsheng@627 5065 msgid ""
dongsheng@627 5066 "What happens if we try to use the normal <command role=\"hg-cmd\">hg update</"
dongsheng@627 5067 "command> command to update to the new tip?"
dongsheng@627 5068 msgstr ""
dongsheng@627 5069
dongsheng@627 5070 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5071 #: ../en/ch03-tour-merge.xml:126
dongsheng@627 5072 msgid ""
dongsheng@627 5073 "Mercurial is telling us that the <command role=\"hg-cmd\">hg update</command> "
dongsheng@627 5074 "command won't do a merge; it won't update the working directory when it "
dongsheng@714 5075 "thinks we might want to do a merge, unless we force it to do so. "
dongsheng@714 5076 "(Incidentally, forcing the update with <command>hg update -C</command> would "
dongsheng@714 5077 "revert any uncommitted changes in the working directory.)"
dongsheng@714 5078 msgstr ""
dongsheng@714 5079
dongsheng@714 5080 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5081 #: ../en/ch03-tour-merge.xml:134
dongsheng@714 5082 msgid ""
dongsheng@714 5083 "To start a merge between the two heads, we use the <command role=\"hg-cmd"
dongsheng@714 5084 "\">hg merge</command> command."
dongsheng@715 5085 msgstr ""
dongsheng@715 5086 "我们使用 <command role=\"hg-cmd\">hg merge</command> 命令来合并两个顶点。"
dongsheng@714 5087
dongsheng@714 5088 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5089 #: ../en/ch03-tour-merge.xml:139
dongsheng@714 5090 msgid ""
dongsheng@714 5091 "We resolve the contents of <filename>hello.c</filename> This updates the "
dongsheng@714 5092 "working directory so that it contains changes from <emphasis>both</emphasis> "
dongsheng@714 5093 "heads, which is reflected in both the output of <command role=\"hg-cmd\">hg "
dongsheng@714 5094 "parents</command> and the contents of <filename>hello.c</filename>."
dongsheng@627 5095 msgstr ""
dongsheng@627 5096
dongsheng@627 5097 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 5098 #: ../en/ch03-tour-merge.xml:151
dongsheng@627 5099 msgid "Committing the results of the merge"
dongsheng@627 5100 msgstr "提交合并结果"
dongsheng@627 5101
dongsheng@627 5102 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5103 #: ../en/ch03-tour-merge.xml:153
dongsheng@627 5104 msgid ""
dongsheng@627 5105 "Whenever we've done a merge, <command role=\"hg-cmd\">hg parents</command> "
dongsheng@627 5106 "will display two parents until we <command role=\"hg-cmd\">hg commit</"
dongsheng@627 5107 "command> the results of the merge."
dongsheng@627 5108 msgstr ""
dongsheng@627 5109
dongsheng@627 5110 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5111 #: ../en/ch03-tour-merge.xml:160
dongsheng@627 5112 msgid ""
dongsheng@627 5113 "We now have a new tip revision; notice that it has <emphasis>both</emphasis> "
dongsheng@627 5114 "of our former heads as its parents. These are the same revisions that were "
dongsheng@627 5115 "previously displayed by <command role=\"hg-cmd\">hg parents</command>."
dongsheng@627 5116 msgstr ""
dongsheng@627 5117
dongsheng@627 5118 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5119 #: ../en/ch03-tour-merge.xml:167
songdongsheng@658 5120 msgid ""
songdongsheng@658 5121 "In <xref linkend=\"fig:tour-merge:merge\"/>, you can see a representation of "
songdongsheng@658 5122 "what happens to the working directory during the merge, and how this affects "
songdongsheng@658 5123 "the repository when the commit happens. During the merge, the working "
songdongsheng@658 5124 "directory has two parent changesets, and these become the parents of the new "
songdongsheng@658 5125 "changeset."
dongsheng@627 5126 msgstr ""
dongsheng@627 5127
songdongsheng@710 5128 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
dongsheng@714 5129 #: ../en/ch03-tour-merge.xml:176
songdongsheng@710 5130 msgid "Working directory and repository during merge, and following commit"
songdongsheng@710 5131 msgstr "在合并期间,以及提交之后的工作目录与版本库"
songdongsheng@710 5132
songdongsheng@710 5133 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
dongsheng@714 5134 #: ../en/ch03-tour-merge.xml:179
songdongsheng@710 5135 msgid ""
songdongsheng@710 5136 "<imageobject> <imagedata fileref=\"figs/tour-merge-merge.png\"/> </"
songdongsheng@710 5137 "imageobject>"
songdongsheng@710 5138 msgstr ""
songdongsheng@710 5139
songdongsheng@710 5140 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5141 #: ../en/ch03-tour-merge.xml:186
songdongsheng@710 5142 msgid ""
songdongsheng@710 5143 "We sometimes talk about a merge having <emphasis>sides</emphasis>: the left "
songdongsheng@710 5144 "side is the first parent in the output of <command role=\"hg-cmd\">hg "
songdongsheng@710 5145 "parents</command>, and the right side is the second. If the working "
songdongsheng@710 5146 "directory was at e.g. revision 5 before we began a merge, that revision will "
songdongsheng@710 5147 "become the left side of the merge."
songdongsheng@710 5148 msgstr ""
songdongsheng@710 5149
dongsheng@627 5150 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 5151 #: ../en/ch03-tour-merge.xml:196
dongsheng@627 5152 msgid "Merging conflicting changes"
dongsheng@627 5153 msgstr "合并有冲突的改变"
dongsheng@627 5154
dongsheng@627 5155 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5156 #: ../en/ch03-tour-merge.xml:198
dongsheng@627 5157 msgid ""
dongsheng@627 5158 "Most merges are simple affairs, but sometimes you'll find yourself merging "
songdongsheng@710 5159 "changes where each side modifies the same portions of the same files. Unless "
songdongsheng@710 5160 "both modifications are identical, this results in a <emphasis>conflict</"
songdongsheng@710 5161 "emphasis>, where you have to decide how to reconcile the different changes "
songdongsheng@710 5162 "into something coherent."
dongsheng@627 5163 msgstr ""
dongsheng@627 5164
songdongsheng@658 5165 #. type: Content of: <book><chapter><sect1><figure><title>
dongsheng@714 5166 #: ../en/ch03-tour-merge.xml:206
songdongsheng@658 5167 msgid "Conflicting changes to a document"
dongsheng@660 5168 msgstr "冲突的修改"
songdongsheng@658 5169
songdongsheng@658 5170 #. type: Content of: <book><chapter><sect1><figure><mediaobject>
dongsheng@714 5171 #: ../en/ch03-tour-merge.xml:208
songdongsheng@658 5172 msgid ""
songdongsheng@658 5173 "<imageobject><imagedata fileref=\"figs/tour-merge-conflict.png\"/></"
dongsheng@627 5174 "imageobject>"
dongsheng@627 5175 msgstr ""
dongsheng@627 5176
songdongsheng@658 5177 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5178 #: ../en/ch03-tour-merge.xml:213
songdongsheng@658 5179 msgid ""
songdongsheng@658 5180 "<xref linkend=\"fig:tour-merge:conflict\"/> illustrates an instance of two "
songdongsheng@658 5181 "conflicting changes to a document. We started with a single version of the "
songdongsheng@658 5182 "file; then we made some changes; while someone else made different changes to "
songdongsheng@658 5183 "the same text. Our task in resolving the conflicting changes is to decide "
songdongsheng@658 5184 "what the file should look like."
songdongsheng@658 5185 msgstr ""
songdongsheng@658 5186
songdongsheng@658 5187 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5188 #: ../en/ch03-tour-merge.xml:220
dongsheng@627 5189 msgid ""
dongsheng@627 5190 "Mercurial doesn't have a built-in facility for handling conflicts. Instead, "
songdongsheng@710 5191 "it runs an external program, usually one that displays some kind of graphical "
songdongsheng@710 5192 "conflict resolution interface. By default, Mercurial tries to find one of "
songdongsheng@710 5193 "several different merging tools that are likely to be installed on your "
songdongsheng@710 5194 "system. It first tries a few fully automatic merging tools; if these don't "
songdongsheng@710 5195 "succeed (because the resolution process requires human guidance) or aren't "
songdongsheng@710 5196 "present, it tries a few different graphical merging tools."
songdongsheng@710 5197 msgstr ""
songdongsheng@710 5198
songdongsheng@710 5199 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5200 #: ../en/ch03-tour-merge.xml:230
dongsheng@714 5201 msgid ""
dongsheng@714 5202 "It's also possible to get Mercurial to run a specific program or script, by "
dongsheng@714 5203 "setting the <envar>HGMERGE</envar> environment variable to the name of your "
dongsheng@714 5204 "preferred program."
dongsheng@627 5205 msgstr ""
dongsheng@627 5206
dongsheng@627 5207 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 5208 #: ../en/ch03-tour-merge.xml:236
dongsheng@627 5209 msgid "Using a graphical merge tool"
dongsheng@627 5210 msgstr "使用图形合并工具"
dongsheng@627 5211
dongsheng@627 5212 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5213 #: ../en/ch03-tour-merge.xml:238
dongsheng@627 5214 msgid ""
dongsheng@627 5215 "My preferred graphical merge tool is <command>kdiff3</command>, which I'll "
dongsheng@627 5216 "use to describe the features that are common to graphical file merging "
dongsheng@627 5217 "tools. You can see a screenshot of <command>kdiff3</command> in action in "
songdongsheng@658 5218 "<xref linkend=\"fig:tour-merge:kdiff3\"/>. The kind of merge it is "
songdongsheng@658 5219 "performing is called a <emphasis>three-way merge</emphasis>, because there "
songdongsheng@658 5220 "are three different versions of the file of interest to us. The tool thus "
songdongsheng@658 5221 "splits the upper portion of the window into three panes:"
dongsheng@627 5222 msgstr ""
dongsheng@627 5223
dongsheng@627 5224 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 5225 #: ../en/ch03-tour-merge.xml:248
dongsheng@627 5226 msgid ""
dongsheng@627 5227 "At the left is the <emphasis>base</emphasis> version of the file, i.e. the "
dongsheng@627 5228 "most recent version from which the two versions we're trying to merge are "
dongsheng@627 5229 "descended."
dongsheng@627 5230 msgstr ""
dongsheng@627 5231
dongsheng@627 5232 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 5233 #: ../en/ch03-tour-merge.xml:253
dongsheng@627 5234 msgid ""
dongsheng@627 5235 "In the middle is <quote>our</quote> version of the file, with the contents "
dongsheng@627 5236 "that we modified."
dongsheng@627 5237 msgstr ""
dongsheng@627 5238
dongsheng@627 5239 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 5240 #: ../en/ch03-tour-merge.xml:256
dongsheng@627 5241 msgid ""
dongsheng@627 5242 "On the right is <quote>their</quote> version of the file, the one that from "
dongsheng@627 5243 "the changeset that we're trying to merge with."
dongsheng@627 5244 msgstr ""
dongsheng@627 5245
dongsheng@627 5246 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5247 #: ../en/ch03-tour-merge.xml:260
dongsheng@627 5248 msgid ""
dongsheng@627 5249 "In the pane below these is the current <emphasis>result</emphasis> of the "
dongsheng@627 5250 "merge. Our task is to replace all of the red text, which indicates unresolved "
dongsheng@627 5251 "conflicts, with some sensible merger of the <quote>ours</quote> and "
dongsheng@627 5252 "<quote>theirs</quote> versions of the file."
dongsheng@627 5253 msgstr ""
dongsheng@627 5254
dongsheng@627 5255 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5256 #: ../en/ch03-tour-merge.xml:267
dongsheng@627 5257 msgid ""
dongsheng@627 5258 "All four of these panes are <emphasis>locked together</emphasis>; if we "
dongsheng@627 5259 "scroll vertically or horizontally in any of them, the others are updated to "
dongsheng@627 5260 "display the corresponding sections of their respective files."
dongsheng@627 5261 msgstr ""
dongsheng@627 5262
songdongsheng@658 5263 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
dongsheng@714 5264 #: ../en/ch03-tour-merge.xml:273
songdongsheng@658 5265 msgid "Using <command>kdiff3</command> to merge versions of a file"
dongsheng@660 5266 msgstr "使用 <command>kdiff3</command> 合并文件的不同版本"
songdongsheng@658 5267
songdongsheng@658 5268 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
dongsheng@714 5269 #: ../en/ch03-tour-merge.xml:276
songdongsheng@658 5270 msgid ""
songdongsheng@658 5271 "<imageobject> <imagedata width=\"100%\" fileref=\"figs/kdiff3.png\"/></"
dongsheng@630 5272 "imageobject>"
dongsheng@627 5273 msgstr ""
dongsheng@627 5274
songdongsheng@658 5275 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5276 #: ../en/ch03-tour-merge.xml:284
dongsheng@627 5277 msgid ""
dongsheng@627 5278 "For each conflicting portion of the file, we can choose to resolve the "
dongsheng@627 5279 "conflict using some combination of text from the base version, ours, or "
dongsheng@627 5280 "theirs. We can also manually edit the merged file at any time, in case we "
dongsheng@627 5281 "need to make further modifications."
dongsheng@627 5282 msgstr ""
dongsheng@627 5283
dongsheng@627 5284 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5285 #: ../en/ch03-tour-merge.xml:290
dongsheng@627 5286 msgid ""
dongsheng@627 5287 "There are <emphasis>many</emphasis> file merging tools available, too many to "
dongsheng@627 5288 "cover here. They vary in which platforms they are available for, and in "
dongsheng@627 5289 "their particular strengths and weaknesses. Most are tuned for merging files "
dongsheng@627 5290 "containing plain text, while a few are aimed at specialised file formats "
dongsheng@627 5291 "(generally XML)."
dongsheng@627 5292 msgstr ""
dongsheng@627 5293
dongsheng@627 5294 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 5295 #: ../en/ch03-tour-merge.xml:299
dongsheng@627 5296 msgid "A worked example"
dongsheng@627 5297 msgstr "合并实例"
dongsheng@627 5298
dongsheng@627 5299 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5300 #: ../en/ch03-tour-merge.xml:301
songdongsheng@658 5301 msgid ""
songdongsheng@658 5302 "In this example, we will reproduce the file modification history of <xref "
songdongsheng@658 5303 "linkend=\"fig:tour-merge:conflict\"/> above. Let's begin by creating a "
songdongsheng@658 5304 "repository with a base version of our document."
songdongsheng@658 5305 msgstr ""
songdongsheng@658 5306
songdongsheng@658 5307 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5308 #: ../en/ch03-tour-merge.xml:308
dongsheng@627 5309 msgid "We'll clone the repository and make a change to the file."
dongsheng@627 5310 msgstr ""
dongsheng@627 5311
dongsheng@627 5312 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5313 #: ../en/ch03-tour-merge.xml:313
dongsheng@627 5314 msgid ""
dongsheng@627 5315 "And another clone, to simulate someone else making a change to the file. "
dongsheng@627 5316 "(This hints at the idea that it's not all that unusual to merge with yourself "
dongsheng@627 5317 "when you isolate tasks in separate repositories, and indeed to find and "
dongsheng@627 5318 "resolve conflicts while doing so.)"
dongsheng@627 5319 msgstr ""
dongsheng@627 5320
dongsheng@627 5321 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5322 #: ../en/ch03-tour-merge.xml:321
dongsheng@627 5323 msgid ""
dongsheng@627 5324 "Having created two different versions of the file, we'll set up an "
dongsheng@627 5325 "environment suitable for running our merge."
dongsheng@627 5326 msgstr ""
dongsheng@627 5327
dongsheng@627 5328 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5329 #: ../en/ch03-tour-merge.xml:327
songdongsheng@710 5330 msgid ""
songdongsheng@710 5331 "In this example, I'll set <envar>HGMERGE</envar> to tell Mercurial to use the "
songdongsheng@710 5332 "non-interactive <command>merge</command> command. This is bundled with many "
songdongsheng@710 5333 "Unix-like systems. (If you're following this example on your computer, don't "
dongsheng@714 5334 "bother setting <envar>HGMERGE</envar>. You'll get dropped into a GUI file "
dongsheng@714 5335 "merge tool instead, which is much preferable.)"
dongsheng@714 5336 msgstr ""
dongsheng@714 5337
dongsheng@714 5338 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5339 #: ../en/ch03-tour-merge.xml:337
dongsheng@627 5340 msgid ""
dongsheng@627 5341 "Because <command>merge</command> can't resolve the conflicting changes, it "
dongsheng@627 5342 "leaves <emphasis>merge markers</emphasis> inside the file that has conflicts, "
dongsheng@627 5343 "indicating which lines have conflicts, and whether they came from our version "
dongsheng@627 5344 "of the file or theirs."
dongsheng@627 5345 msgstr ""
dongsheng@627 5346
dongsheng@627 5347 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5348 #: ../en/ch03-tour-merge.xml:343
dongsheng@627 5349 msgid ""
dongsheng@627 5350 "Mercurial can tell from the way <command>merge</command> exits that it wasn't "
dongsheng@627 5351 "able to merge successfully, so it tells us what commands we'll need to run if "
dongsheng@627 5352 "we want to redo the merging operation. This could be useful if, for example, "
dongsheng@627 5353 "we were running a graphical merge tool and quit because we were confused or "
dongsheng@627 5354 "realised we had made a mistake."
dongsheng@627 5355 msgstr ""
dongsheng@627 5356
dongsheng@627 5357 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5358 #: ../en/ch03-tour-merge.xml:350
dongsheng@627 5359 msgid ""
dongsheng@627 5360 "If automatic or manual merges fail, there's nothing to prevent us from "
dongsheng@627 5361 "<quote>fixing up</quote> the affected files ourselves, and committing the "
dongsheng@627 5362 "results of our merge:"
dongsheng@627 5363 msgstr ""
dongsheng@627 5364
dongsheng@714 5365 #. type: Content of: <book><chapter><sect1><sect2><note><title>
dongsheng@714 5366 #: ../en/ch03-tour-merge.xml:357
dongsheng@714 5367 msgid "Where is the <command>hg resolve</command> command?"
dongsheng@715 5368 msgstr "在哪里能找到 <command role=\"hg-cmd\">hg resolve</command> 命令?"
dongsheng@714 5369
dongsheng@714 5370 #. type: Content of: <book><chapter><sect1><sect2><note><para>
dongsheng@714 5371 #: ../en/ch03-tour-merge.xml:359
dongsheng@714 5372 msgid ""
dongsheng@714 5373 "The <command>hg resolve</command> command was introduced in Mercurial 1.1, "
dongsheng@714 5374 "which was released in December 2008. If you are using an older version of "
dongsheng@714 5375 "Mercurial (run <command>hg version</command> to see), this command will not "
dongsheng@714 5376 "be present. If your version of Mercurial is older than 1.1, you should "
dongsheng@714 5377 "strongly consider upgrading to a newer version before trying to tackle "
dongsheng@714 5378 "complicated merges."
dongsheng@714 5379 msgstr ""
dongsheng@714 5380
dongsheng@627 5381 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 5382 #: ../en/ch03-tour-merge.xml:371
dongsheng@627 5383 msgid "Simplifying the pull-merge-commit sequence"
dongsheng@627 5384 msgstr "简化拉-合并-提交程序"
dongsheng@627 5385
dongsheng@627 5386 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5387 #: ../en/ch03-tour-merge.xml:373
dongsheng@627 5388 msgid ""
dongsheng@627 5389 "The process of merging changes as outlined above is straightforward, but "
dongsheng@627 5390 "requires running three commands in sequence."
dongsheng@627 5391 msgstr ""
dongsheng@627 5392
dongsheng@627 5393 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5394 #: ../en/ch03-tour-merge.xml:379
dongsheng@627 5395 msgid ""
dongsheng@627 5396 "In the case of the final commit, you also need to enter a commit message, "
dongsheng@627 5397 "which is almost always going to be a piece of uninteresting "
dongsheng@627 5398 "<quote>boilerplate</quote> text."
dongsheng@627 5399 msgstr ""
dongsheng@627 5400
dongsheng@627 5401 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5402 #: ../en/ch03-tour-merge.xml:383
dongsheng@627 5403 msgid ""
dongsheng@627 5404 "It would be nice to reduce the number of steps needed, if this were "
dongsheng@627 5405 "possible. Indeed, Mercurial is distributed with an extension called <literal "
dongsheng@627 5406 "role=\"hg-ext\">fetch</literal> that does just this."
dongsheng@627 5407 msgstr ""
dongsheng@627 5408
dongsheng@627 5409 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5410 #: ../en/ch03-tour-merge.xml:388
dongsheng@627 5411 msgid ""
dongsheng@627 5412 "Mercurial provides a flexible extension mechanism that lets people extend its "
dongsheng@627 5413 "functionality, while keeping the core of Mercurial small and easy to deal "
dongsheng@627 5414 "with. Some extensions add new commands that you can use from the command "
dongsheng@627 5415 "line, while others work <quote>behind the scenes,</quote> for example adding "
dongsheng@714 5416 "capabilities to Mercurial's built-in server mode."
dongsheng@714 5417 msgstr ""
dongsheng@714 5418
dongsheng@714 5419 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5420 #: ../en/ch03-tour-merge.xml:395
dongsheng@627 5421 msgid ""
dongsheng@627 5422 "The <literal role=\"hg-ext\">fetch</literal> extension adds a new command "
dongsheng@627 5423 "called, not surprisingly, <command role=\"hg-cmd\">hg fetch</command>. This "
songdongsheng@710 5424 "extension acts as a combination of <command role=\"hg-cmd\">hg pull -u</"
songdongsheng@710 5425 "command>, <command role=\"hg-cmd\">hg merge</command> and <command role=\"hg-"
songdongsheng@710 5426 "cmd\">hg commit</command>. It begins by pulling changes from another "
dongsheng@627 5427 "repository into the current repository. If it finds that the changes added a "
dongsheng@714 5428 "new head to the repository, it updates to the new head, begins a merge, then "
dongsheng@714 5429 "(if the merge succeeded) commits the result of the merge with an "
dongsheng@714 5430 "automatically-generated commit message. If no new heads were added, it "
dongsheng@714 5431 "updates the working directory to the new tip changeset."
dongsheng@714 5432 msgstr ""
dongsheng@714 5433
dongsheng@714 5434 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5435 #: ../en/ch03-tour-merge.xml:409
dongsheng@627 5436 msgid ""
dongsheng@627 5437 "Enabling the <literal role=\"hg-ext\">fetch</literal> extension is easy. "
songdongsheng@710 5438 "Edit the <filename role=\"special\">.hgrc</filename> file in your home "
songdongsheng@710 5439 "directory, and either go to the <literal role=\"rc-extensions\">extensions</"
songdongsheng@710 5440 "literal> section or create an <literal role=\"rc-extensions\">extensions</"
songdongsheng@710 5441 "literal> section. Then add a line that simply reads <quote><literal>fetch=</"
songdongsheng@710 5442 "literal></quote>."
songdongsheng@710 5443 msgstr ""
songdongsheng@710 5444
songdongsheng@710 5445 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5446 #: ../en/ch03-tour-merge.xml:421
songdongsheng@710 5447 msgid ""
songdongsheng@710 5448 "(Normally, the right-hand side of the <quote><literal>=</literal></quote> "
songdongsheng@710 5449 "would indicate where to find the extension, but since the <literal role=\"hg-"
dongsheng@627 5450 "ext\">fetch</literal> extension is in the standard distribution, Mercurial "
dongsheng@627 5451 "knows where to search for it.)"
dongsheng@627 5452 msgstr ""
dongsheng@627 5453
dongsheng@714 5454 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 5455 #: ../en/ch03-tour-merge.xml:429
dongsheng@714 5456 msgid "Renaming, copying, and merging"
dongsheng@715 5457 msgstr "改名,复制与合并"
dongsheng@714 5458
dongsheng@714 5459 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5460 #: ../en/ch03-tour-merge.xml:431
dongsheng@714 5461 msgid ""
dongsheng@714 5462 "During the life of a project, we will often want to change the layout of its "
dongsheng@714 5463 "files and directories. This can be as simple as renaming a single file, or as "
dongsheng@714 5464 "complex as restructuring the entire hierarchy of files within the project."
dongsheng@714 5465 msgstr ""
dongsheng@714 5466
dongsheng@714 5467 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5468 #: ../en/ch03-tour-merge.xml:436
dongsheng@714 5469 msgid ""
dongsheng@714 5470 "Mercurial supports these kinds of complex changes fluently, provided we tell "
dongsheng@714 5471 "it what we're doing. If we want to rename a file, we should use the "
dongsheng@714 5472 "<command>hg rename</command><placeholder type=\"footnote\" id=\"0\"/> command "
dongsheng@714 5473 "to rename it, so that Mercurial can do the right thing later when we merge."
dongsheng@714 5474 msgstr ""
dongsheng@714 5475
dongsheng@714 5476 #. type: Content of: <book><chapter><sect1><para><footnote><para>
dongsheng@714 5477 #: ../en/ch03-tour-merge.xml:439
dongsheng@714 5478 msgid ""
dongsheng@714 5479 "If you're a Unix user, you'll be glad to know that the <command>hg rename</"
dongsheng@714 5480 "command> command can be abbreviated as <command>hg mv</command>."
dongsheng@714 5481 msgstr ""
dongsheng@714 5482
dongsheng@714 5483 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5484 #: ../en/ch03-tour-merge.xml:445
dongsheng@714 5485 msgid ""
dongsheng@714 5486 "We will cover the use of these commands in more detail in <xref linkend="
dongsheng@714 5487 "\"chap:daily.copy\"/>."
dongsheng@714 5488 msgstr ""
dongsheng@714 5489
dongsheng@627 5490 #. type: Content of: <book><chapter><title>
dongsheng@714 5491 #: ../en/ch04-concepts.xml:5
dongsheng@627 5492 msgid "Behind the scenes"
dongsheng@627 5493 msgstr "Mercurial 内幕"
dongsheng@627 5494
dongsheng@627 5495 #. type: Content of: <book><chapter><para>
dongsheng@714 5496 #: ../en/ch04-concepts.xml:7
dongsheng@627 5497 msgid ""
dongsheng@627 5498 "Unlike many revision control systems, the concepts upon which Mercurial is "
dongsheng@627 5499 "built are simple enough that it's easy to understand how the software really "
songdongsheng@710 5500 "works. Knowing these details certainly isn't necessary, so it is certainly "
songdongsheng@710 5501 "safe to skip this chapter. However, I think you will get more out of the "
songdongsheng@710 5502 "software with a <quote>mental model</quote> of what's going on."
dongsheng@627 5503 msgstr ""
dongsheng@627 5504
dongsheng@627 5505 #. type: Content of: <book><chapter><para>
dongsheng@714 5506 #: ../en/ch04-concepts.xml:14
songdongsheng@710 5507 msgid ""
songdongsheng@710 5508 "Being able to understand what's going on behind the scenes gives me "
songdongsheng@710 5509 "confidence that Mercurial has been carefully designed to be both "
songdongsheng@710 5510 "<emphasis>safe</emphasis> and <emphasis>efficient</emphasis>. And just as "
songdongsheng@710 5511 "importantly, if it's easy for me to retain a good idea of what the software "
songdongsheng@710 5512 "is doing when I perform a revision control task, I'm less likely to be "
songdongsheng@710 5513 "surprised by its behavior."
dongsheng@627 5514 msgstr ""
dongsheng@627 5515
dongsheng@627 5516 #. type: Content of: <book><chapter><para>
dongsheng@714 5517 #: ../en/ch04-concepts.xml:22
dongsheng@627 5518 msgid ""
dongsheng@627 5519 "In this chapter, we'll initially cover the core concepts behind Mercurial's "
dongsheng@627 5520 "design, then continue to discuss some of the interesting details of its "
dongsheng@627 5521 "implementation."
dongsheng@627 5522 msgstr ""
dongsheng@627 5523
dongsheng@627 5524 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 5525 #: ../en/ch04-concepts.xml:27
dongsheng@627 5526 msgid "Mercurial's historical record"
dongsheng@627 5527 msgstr "Mercurial 的历史记录"
dongsheng@627 5528
dongsheng@627 5529 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 5530 #: ../en/ch04-concepts.xml:30
dongsheng@627 5531 msgid "Tracking the history of a single file"
dongsheng@627 5532 msgstr "跟踪单一文件的历史"
dongsheng@627 5533
dongsheng@627 5534 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5535 #: ../en/ch04-concepts.xml:32
dongsheng@627 5536 msgid ""
dongsheng@627 5537 "When Mercurial tracks modifications to a file, it stores the history of that "
dongsheng@627 5538 "file in a metadata object called a <emphasis>filelog</emphasis>. Each entry "
dongsheng@627 5539 "in the filelog contains enough information to reconstruct one revision of the "
dongsheng@627 5540 "file that is being tracked. Filelogs are stored as files in the <filename "
dongsheng@627 5541 "role=\"special\" class=\"directory\">.hg/store/data</filename> directory. A "
dongsheng@627 5542 "filelog contains two kinds of information: revision data, and an index to "
dongsheng@627 5543 "help Mercurial to find a revision efficiently."
dongsheng@627 5544 msgstr ""
dongsheng@627 5545
dongsheng@627 5546 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5547 #: ../en/ch04-concepts.xml:43
dongsheng@627 5548 msgid ""
dongsheng@627 5549 "A file that is large, or has a lot of history, has its filelog stored in "
dongsheng@627 5550 "separate data (<quote><literal>.d</literal></quote> suffix) and index "
dongsheng@627 5551 "(<quote><literal>.i</literal></quote> suffix) files. For small files without "
dongsheng@627 5552 "much history, the revision data and index are combined in a single "
dongsheng@627 5553 "<quote><literal>.i</literal></quote> file. The correspondence between a file "
dongsheng@627 5554 "in the working directory and the filelog that tracks its history in the "
songdongsheng@658 5555 "repository is illustrated in <xref linkend=\"fig:concepts:filelog\"/>."
songdongsheng@658 5556 msgstr ""
songdongsheng@658 5557
songdongsheng@658 5558 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
dongsheng@714 5559 #: ../en/ch04-concepts.xml:55
dongsheng@627 5560 msgid ""
dongsheng@627 5561 "Relationships between files in working directory and filelogs in repository"
dongsheng@660 5562 msgstr "工作目录中的文件与版本库中的文件日志之间的关系"
dongsheng@627 5563
songdongsheng@658 5564 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
dongsheng@714 5565 #: ../en/ch04-concepts.xml:58
songdongsheng@658 5566 msgid "<imageobject><imagedata fileref=\"figs/filelog.png\"/></imageobject>"
songdongsheng@658 5567 msgstr ""
songdongsheng@658 5568
dongsheng@627 5569 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 5570 #: ../en/ch04-concepts.xml:65
dongsheng@627 5571 msgid "Managing tracked files"
dongsheng@627 5572 msgstr "管理跟踪的文件"
dongsheng@627 5573
dongsheng@627 5574 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5575 #: ../en/ch04-concepts.xml:67
dongsheng@627 5576 msgid ""
dongsheng@627 5577 "Mercurial uses a structure called a <emphasis>manifest</emphasis> to collect "
dongsheng@627 5578 "together information about the files that it tracks. Each entry in the "
dongsheng@627 5579 "manifest contains information about the files present in a single changeset. "
dongsheng@627 5580 "An entry records which files are present in the changeset, the revision of "
dongsheng@627 5581 "each file, and a few other pieces of file metadata."
dongsheng@627 5582 msgstr ""
dongsheng@627 5583
dongsheng@627 5584 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 5585 #: ../en/ch04-concepts.xml:77
dongsheng@627 5586 msgid "Recording changeset information"
dongsheng@627 5587 msgstr "记录修改集信息"
dongsheng@627 5588
dongsheng@627 5589 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5590 #: ../en/ch04-concepts.xml:79
dongsheng@627 5591 msgid ""
dongsheng@627 5592 "The <emphasis>changelog</emphasis> contains information about each "
dongsheng@627 5593 "changeset. Each revision records who committed a change, the changeset "
dongsheng@627 5594 "comment, other pieces of changeset-related information, and the revision of "
dongsheng@627 5595 "the manifest to use."
dongsheng@627 5596 msgstr ""
dongsheng@627 5597
dongsheng@627 5598 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 5599 #: ../en/ch04-concepts.xml:87
dongsheng@627 5600 msgid "Relationships between revisions"
dongsheng@627 5601 msgstr "版本之间的关系"
dongsheng@627 5602
dongsheng@627 5603 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5604 #: ../en/ch04-concepts.xml:89
dongsheng@627 5605 msgid ""
dongsheng@627 5606 "Within a changelog, a manifest, or a filelog, each revision stores a pointer "
dongsheng@627 5607 "to its immediate parent (or to its two parents, if it's a merge revision). "
dongsheng@627 5608 "As I mentioned above, there are also relationships between revisions "
dongsheng@627 5609 "<emphasis>across</emphasis> these structures, and they are hierarchical in "
dongsheng@627 5610 "nature."
dongsheng@627 5611 msgstr ""
dongsheng@627 5612
dongsheng@627 5613 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5614 #: ../en/ch04-concepts.xml:96
dongsheng@627 5615 msgid ""
dongsheng@627 5616 "For every changeset in a repository, there is exactly one revision stored in "
dongsheng@627 5617 "the changelog. Each revision of the changelog contains a pointer to a single "
dongsheng@627 5618 "revision of the manifest. A revision of the manifest stores a pointer to a "
dongsheng@627 5619 "single revision of each filelog tracked when that changeset was created. "
songdongsheng@658 5620 "These relationships are illustrated in <xref linkend=\"fig:concepts:metadata"
songdongsheng@658 5621 "\"/>."
songdongsheng@658 5622 msgstr ""
songdongsheng@658 5623
songdongsheng@658 5624 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
dongsheng@714 5625 #: ../en/ch04-concepts.xml:105
dongsheng@627 5626 msgid "Metadata relationships"
dongsheng@660 5627 msgstr "元数据之间的关系"
dongsheng@627 5628
songdongsheng@658 5629 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
dongsheng@714 5630 #: ../en/ch04-concepts.xml:107
songdongsheng@658 5631 msgid "<imageobject><imagedata fileref=\"figs/metadata.png\"/></imageobject>"
songdongsheng@658 5632 msgstr ""
songdongsheng@658 5633
songdongsheng@658 5634 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5635 #: ../en/ch04-concepts.xml:112
dongsheng@627 5636 msgid ""
dongsheng@627 5637 "As the illustration shows, there is <emphasis>not</emphasis> a <quote>one to "
dongsheng@627 5638 "one</quote> relationship between revisions in the changelog, manifest, or "
dongsheng@714 5639 "filelog. If a file that Mercurial tracks hasn't changed between two "
dongsheng@627 5640 "changesets, the entry for that file in the two revisions of the manifest will "
dongsheng@714 5641 "point to the same revision of its filelog<placeholder type=\"footnote\" id=\"0"
dongsheng@714 5642 "\"/>."
dongsheng@714 5643 msgstr ""
dongsheng@714 5644
dongsheng@714 5645 #. type: Content of: <book><chapter><sect1><sect2><para><footnote><para>
dongsheng@714 5646 #: ../en/ch04-concepts.xml:119
dongsheng@714 5647 msgid ""
dongsheng@714 5648 "It is possible (though unusual) for the manifest to remain the same between "
dongsheng@714 5649 "two changesets, in which case the changelog entries for those changesets will "
dongsheng@714 5650 "point to the same revision of the manifest."
dongsheng@627 5651 msgstr ""
dongsheng@627 5652
dongsheng@627 5653 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 5654 #: ../en/ch04-concepts.xml:128
dongsheng@627 5655 msgid "Safe, efficient storage"
dongsheng@627 5656 msgstr "安全,高效的存储"
dongsheng@627 5657
dongsheng@627 5658 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5659 #: ../en/ch04-concepts.xml:130
dongsheng@627 5660 msgid ""
dongsheng@627 5661 "The underpinnings of changelogs, manifests, and filelogs are provided by a "
dongsheng@627 5662 "single structure called the <emphasis>revlog</emphasis>."
dongsheng@627 5663 msgstr ""
dongsheng@627 5664
dongsheng@627 5665 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 5666 #: ../en/ch04-concepts.xml:135
dongsheng@627 5667 msgid "Efficient storage"
dongsheng@627 5668 msgstr "高效存储"
dongsheng@627 5669
dongsheng@627 5670 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5671 #: ../en/ch04-concepts.xml:137
dongsheng@627 5672 msgid ""
dongsheng@627 5673 "The revlog provides efficient storage of revisions using a <emphasis>delta</"
dongsheng@627 5674 "emphasis> mechanism. Instead of storing a complete copy of a file for each "
dongsheng@627 5675 "revision, it stores the changes needed to transform an older revision into "
dongsheng@627 5676 "the new revision. For many kinds of file data, these deltas are typically a "
dongsheng@627 5677 "fraction of a percent of the size of a full copy of a file."
dongsheng@627 5678 msgstr ""
dongsheng@627 5679
dongsheng@627 5680 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5681 #: ../en/ch04-concepts.xml:145
dongsheng@627 5682 msgid ""
dongsheng@627 5683 "Some obsolete revision control systems can only work with deltas of text "
dongsheng@627 5684 "files. They must either store binary files as complete snapshots or encoded "
dongsheng@627 5685 "into a text representation, both of which are wasteful approaches. Mercurial "
dongsheng@627 5686 "can efficiently handle deltas of files with arbitrary binary contents; it "
dongsheng@627 5687 "doesn't need to treat text as special."
dongsheng@627 5688 msgstr ""
dongsheng@627 5689
dongsheng@627 5690 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 5691 #: ../en/ch04-concepts.xml:154
dongsheng@627 5692 msgid "Safe operation"
dongsheng@627 5693 msgstr "安全操作"
dongsheng@627 5694
dongsheng@627 5695 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5696 #: ../en/ch04-concepts.xml:156
dongsheng@627 5697 msgid ""
dongsheng@627 5698 "Mercurial only ever <emphasis>appends</emphasis> data to the end of a revlog "
dongsheng@627 5699 "file. It never modifies a section of a file after it has written it. This is "
dongsheng@627 5700 "both more robust and efficient than schemes that need to modify or rewrite "
dongsheng@627 5701 "data."
dongsheng@627 5702 msgstr ""
dongsheng@627 5703
dongsheng@627 5704 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5705 #: ../en/ch04-concepts.xml:162
dongsheng@627 5706 msgid ""
dongsheng@627 5707 "In addition, Mercurial treats every write as part of a <emphasis>transaction</"
dongsheng@627 5708 "emphasis> that can span a number of files. A transaction is "
dongsheng@627 5709 "<emphasis>atomic</emphasis>: either the entire transaction succeeds and its "
dongsheng@627 5710 "effects are all visible to readers in one go, or the whole thing is undone. "
dongsheng@627 5711 "This guarantee of atomicity means that if you're running two copies of "
dongsheng@627 5712 "Mercurial, where one is reading data and one is writing it, the reader will "
dongsheng@627 5713 "never see a partially written result that might confuse it."
dongsheng@627 5714 msgstr ""
dongsheng@627 5715
dongsheng@627 5716 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5717 #: ../en/ch04-concepts.xml:172
dongsheng@627 5718 msgid ""
dongsheng@627 5719 "The fact that Mercurial only appends to files makes it easier to provide this "
dongsheng@627 5720 "transactional guarantee. The easier it is to do stuff like this, the more "
dongsheng@627 5721 "confident you should be that it's done correctly."
dongsheng@627 5722 msgstr ""
dongsheng@627 5723
dongsheng@627 5724 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 5725 #: ../en/ch04-concepts.xml:179
dongsheng@627 5726 msgid "Fast retrieval"
dongsheng@627 5727 msgstr "快速检索"
dongsheng@627 5728
dongsheng@627 5729 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5730 #: ../en/ch04-concepts.xml:181
dongsheng@627 5731 msgid ""
dongsheng@627 5732 "Mercurial cleverly avoids a pitfall common to all earlier revision control "
dongsheng@627 5733 "systems: the problem of <emphasis>inefficient retrieval</emphasis>. Most "
dongsheng@627 5734 "revision control systems store the contents of a revision as an incremental "
dongsheng@714 5735 "series of modifications against a <quote>snapshot</quote>. (Some base the "
dongsheng@714 5736 "snapshot on the oldest revision, others on the newest.) To reconstruct a "
dongsheng@627 5737 "specific revision, you must first read the snapshot, and then every one of "
dongsheng@627 5738 "the revisions between the snapshot and your target revision. The more "
dongsheng@627 5739 "history that a file accumulates, the more revisions you must read, hence the "
dongsheng@627 5740 "longer it takes to reconstruct a particular revision."
dongsheng@627 5741 msgstr ""
dongsheng@627 5742
songdongsheng@658 5743 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
dongsheng@714 5744 #: ../en/ch04-concepts.xml:195
songdongsheng@658 5745 msgid "Snapshot of a revlog, with incremental deltas"
dongsheng@660 5746 msgstr "版本日志的快照,以及增量差异"
songdongsheng@658 5747
songdongsheng@658 5748 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
dongsheng@714 5749 #: ../en/ch04-concepts.xml:197
songdongsheng@658 5750 msgid "<imageobject><imagedata fileref=\"figs/snapshot.png\"/></imageobject>"
songdongsheng@658 5751 msgstr ""
songdongsheng@658 5752
songdongsheng@658 5753 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5754 #: ../en/ch04-concepts.xml:202
dongsheng@627 5755 msgid ""
dongsheng@627 5756 "The innovation that Mercurial applies to this problem is simple but "
dongsheng@627 5757 "effective. Once the cumulative amount of delta information stored since the "
dongsheng@627 5758 "last snapshot exceeds a fixed threshold, it stores a new snapshot "
dongsheng@627 5759 "(compressed, of course), instead of another delta. This makes it possible to "
dongsheng@627 5760 "reconstruct <emphasis>any</emphasis> revision of a file quickly. This "
dongsheng@627 5761 "approach works so well that it has since been copied by several other "
dongsheng@627 5762 "revision control systems."
dongsheng@627 5763 msgstr ""
dongsheng@627 5764
dongsheng@627 5765 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5766 #: ../en/ch04-concepts.xml:211
songdongsheng@658 5767 msgid ""
songdongsheng@658 5768 "<xref linkend=\"fig:concepts:snapshot\"/> illustrates the idea. In an entry "
songdongsheng@658 5769 "in a revlog's index file, Mercurial stores the range of entries from the data "
songdongsheng@658 5770 "file that it must read to reconstruct a particular revision."
dongsheng@627 5771 msgstr ""
dongsheng@627 5772
dongsheng@627 5773 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 5774 #: ../en/ch04-concepts.xml:217
dongsheng@627 5775 msgid "Aside: the influence of video compression"
dongsheng@660 5776 msgstr "旁白: 视频压缩的影响"
dongsheng@627 5777
dongsheng@627 5778 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 5779 #: ../en/ch04-concepts.xml:219
dongsheng@627 5780 msgid ""
dongsheng@627 5781 "If you're familiar with video compression or have ever watched a TV feed "
dongsheng@627 5782 "through a digital cable or satellite service, you may know that most video "
dongsheng@627 5783 "compression schemes store each frame of video as a delta against its "
dongsheng@714 5784 "predecessor frame."
dongsheng@627 5785 msgstr ""
dongsheng@627 5786
dongsheng@627 5787 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 5788 #: ../en/ch04-concepts.xml:225
dongsheng@714 5789 msgid ""
dongsheng@714 5790 "Mercurial borrows this idea to make it possible to reconstruct a revision "
dongsheng@714 5791 "from a snapshot and a small number of deltas."
dongsheng@627 5792 msgstr ""
dongsheng@627 5793
dongsheng@627 5794 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 5795 #: ../en/ch04-concepts.xml:232
dongsheng@627 5796 msgid "Identification and strong integrity"
dongsheng@627 5797 msgstr "鉴别和强完整性"
dongsheng@627 5798
dongsheng@627 5799 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5800 #: ../en/ch04-concepts.xml:234
dongsheng@627 5801 msgid ""
dongsheng@627 5802 "Along with delta or snapshot information, a revlog entry contains a "
dongsheng@627 5803 "cryptographic hash of the data that it represents. This makes it difficult "
dongsheng@627 5804 "to forge the contents of a revision, and easy to detect accidental corruption."
dongsheng@627 5805 msgstr ""
dongsheng@627 5806
dongsheng@627 5807 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5808 #: ../en/ch04-concepts.xml:239
dongsheng@627 5809 msgid ""
dongsheng@627 5810 "Hashes provide more than a mere check against corruption; they are used as "
dongsheng@627 5811 "the identifiers for revisions. The changeset identification hashes that you "
dongsheng@627 5812 "see as an end user are from revisions of the changelog. Although filelogs "
dongsheng@627 5813 "and the manifest also use hashes, Mercurial only uses these behind the scenes."
dongsheng@627 5814 msgstr ""
dongsheng@627 5815
dongsheng@627 5816 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5817 #: ../en/ch04-concepts.xml:246
dongsheng@627 5818 msgid ""
dongsheng@627 5819 "Mercurial verifies that hashes are correct when it retrieves file revisions "
dongsheng@627 5820 "and when it pulls changes from another repository. If it encounters an "
dongsheng@627 5821 "integrity problem, it will complain and stop whatever it's doing."
dongsheng@627 5822 msgstr ""
dongsheng@627 5823
dongsheng@627 5824 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5825 #: ../en/ch04-concepts.xml:251
dongsheng@627 5826 msgid ""
dongsheng@627 5827 "In addition to the effect it has on retrieval efficiency, Mercurial's use of "
dongsheng@627 5828 "periodic snapshots makes it more robust against partial data corruption. If "
dongsheng@627 5829 "a revlog becomes partly corrupted due to a hardware error or system bug, it's "
dongsheng@627 5830 "often possible to reconstruct some or most revisions from the uncorrupted "
dongsheng@627 5831 "sections of the revlog, both before and after the corrupted section. This "
dongsheng@627 5832 "would not be possible with a delta-only storage model."
dongsheng@627 5833 msgstr ""
dongsheng@627 5834
dongsheng@627 5835 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 5836 #: ../en/ch04-concepts.xml:263
dongsheng@627 5837 msgid "Revision history, branching, and merging"
dongsheng@627 5838 msgstr "修订历史,分支与合并"
dongsheng@627 5839
dongsheng@627 5840 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5841 #: ../en/ch04-concepts.xml:265
dongsheng@627 5842 msgid ""
dongsheng@627 5843 "Every entry in a Mercurial revlog knows the identity of its immediate "
dongsheng@627 5844 "ancestor revision, usually referred to as its <emphasis>parent</emphasis>. "
dongsheng@627 5845 "In fact, a revision contains room for not one parent, but two. Mercurial "
dongsheng@627 5846 "uses a special hash, called the <quote>null ID</quote>, to represent the idea "
dongsheng@627 5847 "<quote>there is no parent here</quote>. This hash is simply a string of "
dongsheng@627 5848 "zeroes."
dongsheng@627 5849 msgstr ""
dongsheng@627 5850
dongsheng@627 5851 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5852 #: ../en/ch04-concepts.xml:273
songdongsheng@658 5853 msgid ""
songdongsheng@658 5854 "In <xref linkend=\"fig:concepts:revlog\"/>, you can see an example of the "
songdongsheng@658 5855 "conceptual structure of a revlog. Filelogs, manifests, and changelogs all "
songdongsheng@658 5856 "have this same structure; they differ only in the kind of data stored in each "
songdongsheng@658 5857 "delta or snapshot."
songdongsheng@658 5858 msgstr ""
songdongsheng@658 5859
songdongsheng@658 5860 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5861 #: ../en/ch04-concepts.xml:279
dongsheng@627 5862 msgid ""
dongsheng@627 5863 "The first revision in a revlog (at the bottom of the image) has the null ID "
dongsheng@627 5864 "in both of its parent slots. For a <quote>normal</quote> revision, its first "
dongsheng@627 5865 "parent slot contains the ID of its parent revision, and its second contains "
dongsheng@627 5866 "the null ID, indicating that the revision has only one real parent. Any two "
dongsheng@627 5867 "revisions that have the same parent ID are branches. A revision that "
dongsheng@627 5868 "represents a merge between branches has two normal revision IDs in its parent "
dongsheng@627 5869 "slots."
dongsheng@627 5870 msgstr ""
dongsheng@627 5871
songdongsheng@658 5872 #. type: Content of: <book><chapter><sect1><figure><title>
dongsheng@714 5873 #: ../en/ch04-concepts.xml:289
songdongsheng@658 5874 msgid "The conceptual structure of a revlog"
dongsheng@660 5875 msgstr "版本日志的设计结构"
songdongsheng@658 5876
songdongsheng@658 5877 #. type: Content of: <book><chapter><sect1><figure><mediaobject>
dongsheng@714 5878 #: ../en/ch04-concepts.xml:291
songdongsheng@658 5879 msgid "<imageobject><imagedata fileref=\"figs/revlog.png\"/></imageobject>"
dongsheng@641 5880 msgstr ""
dongsheng@641 5881
dongsheng@627 5882 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 5883 #: ../en/ch04-concepts.xml:298
dongsheng@627 5884 msgid "The working directory"
dongsheng@627 5885 msgstr "工作目录"
dongsheng@627 5886
dongsheng@627 5887 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5888 #: ../en/ch04-concepts.xml:300
dongsheng@627 5889 msgid ""
dongsheng@627 5890 "In the working directory, Mercurial stores a snapshot of the files from the "
dongsheng@627 5891 "repository as of a particular changeset."
dongsheng@627 5892 msgstr ""
dongsheng@627 5893
dongsheng@627 5894 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5895 #: ../en/ch04-concepts.xml:303
dongsheng@627 5896 msgid ""
dongsheng@627 5897 "The working directory <quote>knows</quote> which changeset it contains. When "
dongsheng@627 5898 "you update the working directory to contain a particular changeset, Mercurial "
dongsheng@627 5899 "looks up the appropriate revision of the manifest to find out which files it "
dongsheng@627 5900 "was tracking at the time that changeset was committed, and which revision of "
dongsheng@627 5901 "each file was then current. It then recreates a copy of each of those files, "
dongsheng@627 5902 "with the same contents it had when the changeset was committed."
dongsheng@627 5903 msgstr ""
dongsheng@627 5904
dongsheng@627 5905 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5906 #: ../en/ch04-concepts.xml:312
dongsheng@714 5907 msgid ""
dongsheng@714 5908 "The <emphasis>dirstate</emphasis> is a special structure that contains "
dongsheng@714 5909 "Mercurial's knowledge of the working directory. It is maintained as a file "
dongsheng@714 5910 "named <filename>.hg/dirstate</filename> inside a repository. The dirstate "
dongsheng@714 5911 "details which changeset the working directory is updated to, and all of the "
dongsheng@714 5912 "files that Mercurial is tracking in the working directory. It also lets "
dongsheng@714 5913 "Mercurial quickly notice changed files, by recording their checkout times and "
dongsheng@714 5914 "sizes."
dongsheng@714 5915 msgstr ""
dongsheng@714 5916
dongsheng@714 5917 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 5918 #: ../en/ch04-concepts.xml:322
dongsheng@627 5919 msgid ""
dongsheng@627 5920 "Just as a revision of a revlog has room for two parents, so that it can "
dongsheng@627 5921 "represent either a normal revision (with one parent) or a merge of two "
dongsheng@627 5922 "earlier revisions, the dirstate has slots for two parents. When you use the "
dongsheng@627 5923 "<command role=\"hg-cmd\">hg update</command> command, the changeset that you "
dongsheng@627 5924 "update to is stored in the <quote>first parent</quote> slot, and the null ID "
dongsheng@627 5925 "in the second. When you <command role=\"hg-cmd\">hg merge</command> with "
dongsheng@627 5926 "another changeset, the first parent remains unchanged, and the second parent "
dongsheng@627 5927 "is filled in with the changeset you're merging with. The <command role=\"hg-"
dongsheng@627 5928 "cmd\">hg parents</command> command tells you what the parents of the dirstate "
dongsheng@627 5929 "are."
dongsheng@627 5930 msgstr ""
dongsheng@627 5931
dongsheng@627 5932 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 5933 #: ../en/ch04-concepts.xml:336
dongsheng@627 5934 msgid "What happens when you commit"
dongsheng@627 5935 msgstr "当你提交时发生的事情"
dongsheng@627 5936
dongsheng@627 5937 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5938 #: ../en/ch04-concepts.xml:338
dongsheng@627 5939 msgid ""
dongsheng@627 5940 "The dirstate stores parent information for more than just book-keeping "
dongsheng@627 5941 "purposes. Mercurial uses the parents of the dirstate as <emphasis>the "
dongsheng@627 5942 "parents of a new changeset</emphasis> when you perform a commit."
dongsheng@627 5943 msgstr ""
dongsheng@627 5944
songdongsheng@658 5945 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
dongsheng@714 5946 #: ../en/ch04-concepts.xml:344
dongsheng@627 5947 msgid "The working directory can have two parents"
dongsheng@660 5948 msgstr "工作目录可以有两个父亲"
dongsheng@627 5949
songdongsheng@658 5950 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
dongsheng@714 5951 #: ../en/ch04-concepts.xml:346
songdongsheng@658 5952 msgid "<imageobject><imagedata fileref=\"figs/wdir.png\"/></imageobject>"
songdongsheng@658 5953 msgstr ""
songdongsheng@658 5954
songdongsheng@658 5955 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5956 #: ../en/ch04-concepts.xml:351
songdongsheng@658 5957 msgid ""
songdongsheng@658 5958 "<xref linkend=\"fig:concepts:wdir\"/> shows the normal state of the working "
songdongsheng@658 5959 "directory, where it has a single changeset as parent. That changeset is the "
songdongsheng@658 5960 "<emphasis>tip</emphasis>, the newest changeset in the repository that has no "
songdongsheng@658 5961 "children."
songdongsheng@658 5962 msgstr ""
songdongsheng@658 5963
songdongsheng@658 5964 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
dongsheng@714 5965 #: ../en/ch04-concepts.xml:358
dongsheng@627 5966 msgid "The working directory gains new parents after a commit"
dongsheng@660 5967 msgstr "提交之后,工作目录的父亲就改变了"
dongsheng@627 5968
songdongsheng@658 5969 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
dongsheng@714 5970 #: ../en/ch04-concepts.xml:361
songdongsheng@658 5971 msgid ""
songdongsheng@658 5972 "<imageobject><imagedata fileref=\"figs/wdir-after-commit.png\"/></imageobject>"
songdongsheng@658 5973 msgstr ""
songdongsheng@658 5974
songdongsheng@658 5975 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5976 #: ../en/ch04-concepts.xml:366
dongsheng@627 5977 msgid ""
dongsheng@627 5978 "It's useful to think of the working directory as <quote>the changeset I'm "
dongsheng@627 5979 "about to commit</quote>. Any files that you tell Mercurial that you've "
dongsheng@627 5980 "added, removed, renamed, or copied will be reflected in that changeset, as "
dongsheng@627 5981 "will modifications to any files that Mercurial is already tracking; the new "
dongsheng@627 5982 "changeset will have the parents of the working directory as its parents."
dongsheng@627 5983 msgstr ""
dongsheng@627 5984
dongsheng@627 5985 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 5986 #: ../en/ch04-concepts.xml:374
dongsheng@627 5987 msgid ""
dongsheng@627 5988 "After a commit, Mercurial will update the parents of the working directory, "
dongsheng@627 5989 "so that the first parent is the ID of the new changeset, and the second is "
songdongsheng@658 5990 "the null ID. This is shown in <xref linkend=\"fig:concepts:wdir-after-commit"
songdongsheng@658 5991 "\"/>. Mercurial doesn't touch any of the files in the working directory when "
songdongsheng@658 5992 "you commit; it just modifies the dirstate to note its new parents."
dongsheng@641 5993 msgstr ""
dongsheng@641 5994
dongsheng@641 5995 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 5996 #: ../en/ch04-concepts.xml:385
dongsheng@627 5997 msgid "Creating a new head"
dongsheng@627 5998 msgstr "创建新顶点"
dongsheng@627 5999
dongsheng@627 6000 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6001 #: ../en/ch04-concepts.xml:387
dongsheng@627 6002 msgid ""
dongsheng@627 6003 "It's perfectly normal to update the working directory to a changeset other "
dongsheng@627 6004 "than the current tip. For example, you might want to know what your project "
dongsheng@627 6005 "looked like last Tuesday, or you could be looking through changesets to see "
dongsheng@627 6006 "which one introduced a bug. In cases like this, the natural thing to do is "
dongsheng@627 6007 "update the working directory to the changeset you're interested in, and then "
dongsheng@627 6008 "examine the files in the working directory directly to see their contents as "
dongsheng@627 6009 "they were when you committed that changeset. The effect of this is shown in "
songdongsheng@658 6010 "<xref linkend=\"fig:concepts:wdir-pre-branch\"/>."
songdongsheng@658 6011 msgstr ""
songdongsheng@658 6012
songdongsheng@658 6013 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
dongsheng@714 6014 #: ../en/ch04-concepts.xml:399
dongsheng@627 6015 msgid "The working directory, updated to an older changeset"
dongsheng@660 6016 msgstr "同步到旧修改集的工作目录"
dongsheng@627 6017
songdongsheng@658 6018 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
dongsheng@714 6019 #: ../en/ch04-concepts.xml:402
songdongsheng@658 6020 msgid ""
songdongsheng@658 6021 "<imageobject><imagedata fileref=\"figs/wdir-pre-branch.png\"/></imageobject>"
songdongsheng@658 6022 msgstr ""
songdongsheng@658 6023
songdongsheng@658 6024 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6025 #: ../en/ch04-concepts.xml:407
dongsheng@627 6026 msgid ""
dongsheng@627 6027 "Having updated the working directory to an older changeset, what happens if "
dongsheng@627 6028 "you make some changes, and then commit? Mercurial behaves in the same way as "
dongsheng@627 6029 "I outlined above. The parents of the working directory become the parents of "
dongsheng@627 6030 "the new changeset. This new changeset has no children, so it becomes the new "
dongsheng@627 6031 "tip. And the repository now contains two changesets that have no children; "
dongsheng@627 6032 "we call these <emphasis>heads</emphasis>. You can see the structure that "
songdongsheng@658 6033 "this creates in <xref linkend=\"fig:concepts:wdir-branch\"/>."
songdongsheng@658 6034 msgstr ""
songdongsheng@658 6035
songdongsheng@658 6036 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
dongsheng@714 6037 #: ../en/ch04-concepts.xml:419
dongsheng@627 6038 msgid "After a commit made while synced to an older changeset"
dongsheng@660 6039 msgstr "对同步到旧修改集的工作目录提交之后"
dongsheng@627 6040
songdongsheng@658 6041 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
dongsheng@714 6042 #: ../en/ch04-concepts.xml:422
songdongsheng@658 6043 msgid "<imageobject><imagedata fileref=\"figs/wdir-branch.png\"/></imageobject>"
songdongsheng@658 6044 msgstr ""
songdongsheng@658 6045
dongsheng@627 6046 #. type: Content of: <book><chapter><sect1><sect2><note><para>
dongsheng@714 6047 #: ../en/ch04-concepts.xml:428
dongsheng@627 6048 msgid ""
dongsheng@627 6049 "If you're new to Mercurial, you should keep in mind a common <quote>error</"
dongsheng@627 6050 "quote>, which is to use the <command role=\"hg-cmd\">hg pull</command> "
dongsheng@627 6051 "command without any options. By default, the <command role=\"hg-cmd\">hg "
dongsheng@627 6052 "pull</command> command <emphasis>does not</emphasis> update the working "
dongsheng@627 6053 "directory, so you'll bring new changesets into your repository, but the "
dongsheng@627 6054 "working directory will stay synced at the same changeset as before the pull. "
dongsheng@627 6055 "If you make some changes and commit afterwards, you'll thus create a new "
dongsheng@627 6056 "head, because your working directory isn't synced to whatever the current tip "
dongsheng@714 6057 "is. To combine the operation of a pull, followed by an update, run "
dongsheng@714 6058 "<command>hg pull -u</command>."
dongsheng@627 6059 msgstr ""
dongsheng@627 6060
dongsheng@627 6061 #. type: Content of: <book><chapter><sect1><sect2><note><para>
dongsheng@714 6062 #: ../en/ch04-concepts.xml:442
dongsheng@627 6063 msgid ""
dongsheng@627 6064 "I put the word <quote>error</quote> in quotes because all that you need to do "
dongsheng@714 6065 "to rectify the situation where you created a new head by accident is <command "
dongsheng@714 6066 "role=\"hg-cmd\">hg merge</command>, then <command role=\"hg-cmd\">hg commit</"
dongsheng@714 6067 "command>. In other words, this almost never has negative consequences; it's "
dongsheng@714 6068 "just something of a surprise for newcomers. I'll discuss other ways to avoid "
dongsheng@714 6069 "this behavior, and why Mercurial behaves in this initially surprising way, "
dongsheng@714 6070 "later on."
songdongsheng@710 6071 msgstr ""
songdongsheng@710 6072
songdongsheng@710 6073 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 6074 #: ../en/ch04-concepts.xml:455
songdongsheng@710 6075 msgid "Merging changes"
songdongsheng@711 6076 msgstr "合并修改"
songdongsheng@710 6077
songdongsheng@710 6078 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6079 #: ../en/ch04-concepts.xml:457
dongsheng@627 6080 msgid ""
dongsheng@627 6081 "When you run the <command role=\"hg-cmd\">hg merge</command> command, "
dongsheng@627 6082 "Mercurial leaves the first parent of the working directory unchanged, and "
dongsheng@627 6083 "sets the second parent to the changeset you're merging with, as shown in "
songdongsheng@658 6084 "<xref linkend=\"fig:concepts:wdir-merge\"/>."
songdongsheng@658 6085 msgstr ""
songdongsheng@658 6086
songdongsheng@658 6087 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
dongsheng@714 6088 #: ../en/ch04-concepts.xml:464
dongsheng@627 6089 msgid "Merging two heads"
dongsheng@660 6090 msgstr "合并两个顶点"
dongsheng@627 6091
songdongsheng@658 6092 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
dongsheng@714 6093 #: ../en/ch04-concepts.xml:466
songdongsheng@658 6094 msgid ""
songdongsheng@658 6095 "<imageobject> <imagedata fileref=\"figs/wdir-merge.png\"/> </imageobject>"
songdongsheng@658 6096 msgstr ""
songdongsheng@658 6097
songdongsheng@658 6098 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6099 #: ../en/ch04-concepts.xml:473
dongsheng@627 6100 msgid ""
dongsheng@627 6101 "Mercurial also has to modify the working directory, to merge the files "
dongsheng@627 6102 "managed in the two changesets. Simplified a little, the merging process goes "
dongsheng@627 6103 "like this, for every file in the manifests of both changesets."
dongsheng@627 6104 msgstr ""
dongsheng@627 6105
dongsheng@627 6106 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 6107 #: ../en/ch04-concepts.xml:478
dongsheng@627 6108 msgid "If neither changeset has modified a file, do nothing with that file."
dongsheng@627 6109 msgstr ""
dongsheng@627 6110
dongsheng@627 6111 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 6112 #: ../en/ch04-concepts.xml:481
dongsheng@627 6113 msgid ""
dongsheng@627 6114 "If one changeset has modified a file, and the other hasn't, create the "
dongsheng@627 6115 "modified copy of the file in the working directory."
dongsheng@627 6116 msgstr ""
dongsheng@627 6117
dongsheng@627 6118 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 6119 #: ../en/ch04-concepts.xml:485
dongsheng@627 6120 msgid ""
dongsheng@627 6121 "If one changeset has removed a file, and the other hasn't (or has also "
dongsheng@627 6122 "deleted it), delete the file from the working directory."
dongsheng@627 6123 msgstr ""
dongsheng@627 6124
dongsheng@627 6125 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 6126 #: ../en/ch04-concepts.xml:489
dongsheng@627 6127 msgid ""
dongsheng@627 6128 "If one changeset has removed a file, but the other has modified the file, ask "
dongsheng@627 6129 "the user what to do: keep the modified file, or remove it?"
dongsheng@627 6130 msgstr ""
dongsheng@627 6131
dongsheng@627 6132 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 6133 #: ../en/ch04-concepts.xml:493
dongsheng@627 6134 msgid ""
dongsheng@627 6135 "If both changesets have modified a file, invoke an external merge program to "
dongsheng@627 6136 "choose the new contents for the merged file. This may require input from the "
dongsheng@627 6137 "user."
dongsheng@627 6138 msgstr ""
dongsheng@627 6139
dongsheng@627 6140 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 6141 #: ../en/ch04-concepts.xml:498
dongsheng@627 6142 msgid ""
dongsheng@627 6143 "If one changeset has modified a file, and the other has renamed or copied the "
dongsheng@627 6144 "file, make sure that the changes follow the new name of the file."
dongsheng@627 6145 msgstr ""
dongsheng@627 6146
dongsheng@627 6147 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6148 #: ../en/ch04-concepts.xml:502
dongsheng@627 6149 msgid ""
songdongsheng@668 6150 "There are more details&emdash;merging has plenty of corner cases&emdash;but "
songdongsheng@668 6151 "these are the most common choices that are involved in a merge. As you can "
songdongsheng@668 6152 "see, most cases are completely automatic, and indeed most merges finish "
dongsheng@627 6153 "automatically, without requiring your input to resolve any conflicts."
dongsheng@627 6154 msgstr ""
dongsheng@627 6155
dongsheng@627 6156 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6157 #: ../en/ch04-concepts.xml:509
dongsheng@627 6158 msgid ""
dongsheng@627 6159 "When you're thinking about what happens when you commit after a merge, once "
dongsheng@627 6160 "again the working directory is <quote>the changeset I'm about to commit</"
dongsheng@627 6161 "quote>. After the <command role=\"hg-cmd\">hg merge</command> command "
dongsheng@627 6162 "completes, the working directory has two parents; these will become the "
dongsheng@627 6163 "parents of the new changeset."
dongsheng@627 6164 msgstr ""
dongsheng@627 6165
dongsheng@627 6166 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6167 #: ../en/ch04-concepts.xml:516
dongsheng@627 6168 msgid ""
dongsheng@627 6169 "Mercurial lets you perform multiple merges, but you must commit the results "
dongsheng@627 6170 "of each individual merge as you go. This is necessary because Mercurial only "
dongsheng@627 6171 "tracks two parents for both revisions and the working directory. While it "
dongsheng@714 6172 "would be technically feasible to merge multiple changesets at once, Mercurial "
dongsheng@714 6173 "avoids this for simplicity. With multi-way merges, the risks of user "
dongsheng@714 6174 "confusion, nasty conflict resolution, and making a terrible mess of a merge "
dongsheng@714 6175 "would grow intolerable."
dongsheng@627 6176 msgstr ""
dongsheng@627 6177
songdongsheng@710 6178 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 6179 #: ../en/ch04-concepts.xml:529
songdongsheng@710 6180 msgid "Merging and renames"
songdongsheng@711 6181 msgstr "合并与改名"
songdongsheng@710 6182
songdongsheng@710 6183 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6184 #: ../en/ch04-concepts.xml:531
songdongsheng@710 6185 msgid ""
songdongsheng@710 6186 "A surprising number of revision control systems pay little or no attention to "
songdongsheng@710 6187 "a file's <emphasis>name</emphasis> over time. For instance, it used to be "
songdongsheng@710 6188 "common that if a file got renamed on one side of a merge, the changes from "
songdongsheng@710 6189 "the other side would be silently dropped."
songdongsheng@710 6190 msgstr ""
songdongsheng@710 6191
songdongsheng@710 6192 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6193 #: ../en/ch04-concepts.xml:537
songdongsheng@710 6194 msgid ""
songdongsheng@710 6195 "Mercurial records metadata when you tell it to perform a rename or copy. It "
songdongsheng@710 6196 "uses this metadata during a merge to do the right thing in the case of a "
songdongsheng@710 6197 "merge. For instance, if I rename a file, and you edit it without renaming "
songdongsheng@710 6198 "it, when we merge our work the file will be renamed and have your edits "
songdongsheng@710 6199 "applied."
songdongsheng@710 6200 msgstr ""
songdongsheng@710 6201
dongsheng@627 6202 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 6203 #: ../en/ch04-concepts.xml:547
dongsheng@627 6204 msgid "Other interesting design features"
dongsheng@627 6205 msgstr "其它有趣的设计特性"
dongsheng@627 6206
dongsheng@627 6207 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 6208 #: ../en/ch04-concepts.xml:549
dongsheng@627 6209 msgid ""
dongsheng@627 6210 "In the sections above, I've tried to highlight some of the most important "
dongsheng@627 6211 "aspects of Mercurial's design, to illustrate that it pays careful attention "
dongsheng@627 6212 "to reliability and performance. However, the attention to detail doesn't "
dongsheng@627 6213 "stop there. There are a number of other aspects of Mercurial's construction "
dongsheng@627 6214 "that I personally find interesting. I'll detail a few of them here, separate "
dongsheng@627 6215 "from the <quote>big ticket</quote> items above, so that if you're interested, "
dongsheng@627 6216 "you can gain a better idea of the amount of thinking that goes into a well-"
dongsheng@627 6217 "designed system."
dongsheng@627 6218 msgstr ""
dongsheng@627 6219
dongsheng@627 6220 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 6221 #: ../en/ch04-concepts.xml:560
dongsheng@627 6222 msgid "Clever compression"
dongsheng@627 6223 msgstr "智能压缩"
dongsheng@627 6224
dongsheng@627 6225 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6226 #: ../en/ch04-concepts.xml:562
dongsheng@627 6227 msgid ""
dongsheng@627 6228 "When appropriate, Mercurial will store both snapshots and deltas in "
dongsheng@627 6229 "compressed form. It does this by always <emphasis>trying to</emphasis> "
dongsheng@627 6230 "compress a snapshot or delta, but only storing the compressed version if it's "
dongsheng@627 6231 "smaller than the uncompressed version."
dongsheng@627 6232 msgstr ""
dongsheng@627 6233
dongsheng@627 6234 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6235 #: ../en/ch04-concepts.xml:568
dongsheng@627 6236 msgid ""
dongsheng@627 6237 "This means that Mercurial does <quote>the right thing</quote> when storing a "
dongsheng@627 6238 "file whose native form is compressed, such as a <literal>zip</literal> "
dongsheng@627 6239 "archive or a JPEG image. When these types of files are compressed a second "
dongsheng@627 6240 "time, the resulting file is usually bigger than the once-compressed form, and "
dongsheng@627 6241 "so Mercurial will store the plain <literal>zip</literal> or JPEG."
dongsheng@627 6242 msgstr ""
dongsheng@627 6243
dongsheng@627 6244 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6245 #: ../en/ch04-concepts.xml:576
dongsheng@627 6246 msgid ""
dongsheng@627 6247 "Deltas between revisions of a compressed file are usually larger than "
dongsheng@627 6248 "snapshots of the file, and Mercurial again does <quote>the right thing</"
dongsheng@627 6249 "quote> in these cases. It finds that such a delta exceeds the threshold at "
dongsheng@627 6250 "which it should store a complete snapshot of the file, so it stores the "
dongsheng@627 6251 "snapshot, again saving space compared to a naive delta-only approach."
dongsheng@627 6252 msgstr ""
dongsheng@627 6253
dongsheng@627 6254 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 6255 #: ../en/ch04-concepts.xml:585
dongsheng@627 6256 msgid "Network recompression"
dongsheng@627 6257 msgstr "网络重新压缩"
dongsheng@627 6258
dongsheng@627 6259 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 6260 #: ../en/ch04-concepts.xml:587
dongsheng@627 6261 msgid ""
dongsheng@627 6262 "When storing revisions on disk, Mercurial uses the <quote>deflate</quote> "
dongsheng@627 6263 "compression algorithm (the same one used by the popular <literal>zip</"
dongsheng@627 6264 "literal> archive format), which balances good speed with a respectable "
dongsheng@627 6265 "compression ratio. However, when transmitting revision data over a network "
dongsheng@627 6266 "connection, Mercurial uncompresses the compressed revision data."
dongsheng@627 6267 msgstr ""
dongsheng@627 6268
dongsheng@627 6269 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 6270 #: ../en/ch04-concepts.xml:595
dongsheng@627 6271 msgid ""
dongsheng@627 6272 "If the connection is over HTTP, Mercurial recompresses the entire stream of "
dongsheng@627 6273 "data using a compression algorithm that gives a better compression ratio (the "
dongsheng@627 6274 "Burrows-Wheeler algorithm from the widely used <literal>bzip2</literal> "
dongsheng@627 6275 "compression package). This combination of algorithm and compression of the "
dongsheng@627 6276 "entire stream (instead of a revision at a time) substantially reduces the "
dongsheng@627 6277 "number of bytes to be transferred, yielding better network performance over "
songdongsheng@710 6278 "most kinds of network."
dongsheng@627 6279 msgstr ""
dongsheng@627 6280
dongsheng@627 6281 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 6282 #: ../en/ch04-concepts.xml:605
dongsheng@714 6283 msgid ""
dongsheng@714 6284 "If the connection is over <command>ssh</command>, Mercurial "
dongsheng@627 6285 "<emphasis>doesn't</emphasis> recompress the stream, because <command>ssh</"
dongsheng@714 6286 "command> can already do this itself. You can tell Mercurial to always use "
dongsheng@714 6287 "<command>ssh</command>'s compression feature by editing the <filename>.hgrc</"
dongsheng@714 6288 "filename> file in your home directory as follows."
dongsheng@627 6289 msgstr ""
dongsheng@627 6290
dongsheng@627 6291 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 6292 #: ../en/ch04-concepts.xml:620
dongsheng@627 6293 msgid "Read/write ordering and atomicity"
dongsheng@627 6294 msgstr "读写顺序与原子性"
dongsheng@627 6295
dongsheng@627 6296 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6297 #: ../en/ch04-concepts.xml:622
dongsheng@627 6298 msgid ""
dongsheng@627 6299 "Appending to files isn't the whole story when it comes to guaranteeing that a "
songdongsheng@658 6300 "reader won't see a partial write. If you recall <xref linkend=\"fig:concepts:"
songdongsheng@658 6301 "metadata\"/>, revisions in the changelog point to revisions in the manifest, "
songdongsheng@658 6302 "and revisions in the manifest point to revisions in filelogs. This hierarchy "
songdongsheng@658 6303 "is deliberate."
songdongsheng@658 6304 msgstr ""
songdongsheng@658 6305
songdongsheng@658 6306 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6307 #: ../en/ch04-concepts.xml:629
dongsheng@627 6308 msgid ""
dongsheng@627 6309 "A writer starts a transaction by writing filelog and manifest data, and "
dongsheng@627 6310 "doesn't write any changelog data until those are finished. A reader starts "
dongsheng@627 6311 "by reading changelog data, then manifest data, followed by filelog data."
dongsheng@627 6312 msgstr ""
dongsheng@627 6313
dongsheng@627 6314 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6315 #: ../en/ch04-concepts.xml:634
dongsheng@627 6316 msgid ""
dongsheng@627 6317 "Since the writer has always finished writing filelog and manifest data before "
dongsheng@627 6318 "it writes to the changelog, a reader will never read a pointer to a partially "
dongsheng@627 6319 "written manifest revision from the changelog, and it will never read a "
dongsheng@627 6320 "pointer to a partially written filelog revision from the manifest."
dongsheng@627 6321 msgstr ""
dongsheng@627 6322
dongsheng@627 6323 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 6324 #: ../en/ch04-concepts.xml:642
dongsheng@627 6325 msgid "Concurrent access"
dongsheng@627 6326 msgstr "并发访问"
dongsheng@627 6327
dongsheng@627 6328 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6329 #: ../en/ch04-concepts.xml:644
dongsheng@627 6330 msgid ""
dongsheng@627 6331 "The read/write ordering and atomicity guarantees mean that Mercurial never "
dongsheng@627 6332 "needs to <emphasis>lock</emphasis> a repository when it's reading data, even "
dongsheng@627 6333 "if the repository is being written to while the read is occurring. This has a "
dongsheng@627 6334 "big effect on scalability; you can have an arbitrary number of Mercurial "
dongsheng@714 6335 "processes safely reading data from a repository all at once, no matter "
dongsheng@627 6336 "whether it's being written to or not."
dongsheng@627 6337 msgstr ""
dongsheng@627 6338
dongsheng@627 6339 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6340 #: ../en/ch04-concepts.xml:653
dongsheng@627 6341 msgid ""
dongsheng@627 6342 "The lockless nature of reading means that if you're sharing a repository on a "
dongsheng@627 6343 "multi-user system, you don't need to grant other local users permission to "
dongsheng@627 6344 "<emphasis>write</emphasis> to your repository in order for them to be able to "
dongsheng@627 6345 "clone it or pull changes from it; they only need <emphasis>read</emphasis> "
dongsheng@627 6346 "permission. (This is <emphasis>not</emphasis> a common feature among "
dongsheng@627 6347 "revision control systems, so don't take it for granted! Most require readers "
dongsheng@627 6348 "to be able to lock a repository to access it safely, and this requires write "
dongsheng@627 6349 "permission on at least one directory, which of course makes for all kinds of "
dongsheng@627 6350 "nasty and annoying security and administrative problems.)"
dongsheng@627 6351 msgstr ""
dongsheng@627 6352
dongsheng@627 6353 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6354 #: ../en/ch04-concepts.xml:666
dongsheng@627 6355 msgid ""
dongsheng@627 6356 "Mercurial uses locks to ensure that only one process can write to a "
dongsheng@627 6357 "repository at a time (the locking mechanism is safe even over filesystems "
dongsheng@627 6358 "that are notoriously hostile to locking, such as NFS). If a repository is "
dongsheng@627 6359 "locked, a writer will wait for a while to retry if the repository becomes "
dongsheng@627 6360 "unlocked, but if the repository remains locked for too long, the process "
dongsheng@627 6361 "attempting to write will time out after a while. This means that your daily "
dongsheng@627 6362 "automated scripts won't get stuck forever and pile up if a system crashes "
dongsheng@627 6363 "unnoticed, for example. (Yes, the timeout is configurable, from zero to "
dongsheng@627 6364 "infinity.)"
dongsheng@627 6365 msgstr ""
dongsheng@627 6366
dongsheng@627 6367 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 6368 #: ../en/ch04-concepts.xml:678
dongsheng@627 6369 msgid "Safe dirstate access"
dongsheng@627 6370 msgstr "安全的目录状态访问"
dongsheng@627 6371
dongsheng@627 6372 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 6373 #: ../en/ch04-concepts.xml:680
dongsheng@627 6374 msgid ""
dongsheng@627 6375 "As with revision data, Mercurial doesn't take a lock to read the dirstate "
dongsheng@627 6376 "file; it does acquire a lock to write it. To avoid the possibility of "
dongsheng@627 6377 "reading a partially written copy of the dirstate file, Mercurial writes to a "
dongsheng@627 6378 "file with a unique name in the same directory as the dirstate file, then "
dongsheng@627 6379 "renames the temporary file atomically to <filename>dirstate</filename>. The "
dongsheng@627 6380 "file named <filename>dirstate</filename> is thus guaranteed to be complete, "
dongsheng@627 6381 "not partially written."
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:693
dongsheng@627 6386 msgid "Avoiding seeks"
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:695
dongsheng@627 6391 msgid ""
dongsheng@627 6392 "Critical to Mercurial's performance is the avoidance of seeks of the disk "
dongsheng@627 6393 "head, since any seek is far more expensive than even a comparatively large "
dongsheng@627 6394 "read operation."
dongsheng@627 6395 msgstr ""
dongsheng@627 6396
dongsheng@627 6397 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6398 #: ../en/ch04-concepts.xml:699
dongsheng@627 6399 msgid ""
dongsheng@627 6400 "This is why, for example, the dirstate is stored in a single file. If there "
dongsheng@627 6401 "were a dirstate file per directory that Mercurial tracked, the disk would "
dongsheng@627 6402 "seek once per directory. Instead, Mercurial reads the entire single dirstate "
dongsheng@627 6403 "file in one step."
dongsheng@627 6404 msgstr ""
dongsheng@627 6405
dongsheng@627 6406 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6407 #: ../en/ch04-concepts.xml:705
dongsheng@627 6408 msgid ""
dongsheng@627 6409 "Mercurial also uses a <quote>copy on write</quote> scheme when cloning a "
dongsheng@627 6410 "repository on local storage. Instead of copying every revlog file from the "
dongsheng@627 6411 "old repository into the new repository, it makes a <quote>hard link</quote>, "
dongsheng@627 6412 "which is a shorthand way to say <quote>these two names point to the same "
dongsheng@627 6413 "file</quote>. When Mercurial is about to write to one of a revlog's files, "
dongsheng@627 6414 "it checks to see if the number of names pointing at the file is greater than "
dongsheng@627 6415 "one. If it is, more than one repository is using the file, so Mercurial "
dongsheng@627 6416 "makes a new copy of the file that is private to this repository."
dongsheng@627 6417 msgstr ""
dongsheng@627 6418
dongsheng@627 6419 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6420 #: ../en/ch04-concepts.xml:716
dongsheng@627 6421 msgid ""
dongsheng@627 6422 "A few revision control developers have pointed out that this idea of making a "
dongsheng@627 6423 "complete private copy of a file is not very efficient in its use of storage. "
dongsheng@627 6424 "While this is true, storage is cheap, and this method gives the highest "
dongsheng@627 6425 "performance while deferring most book-keeping to the operating system. An "
dongsheng@627 6426 "alternative scheme would most likely reduce performance and increase the "
dongsheng@714 6427 "complexity of the software, but speed and simplicity are key to the "
dongsheng@627 6428 "<quote>feel</quote> of day-to-day use."
dongsheng@627 6429 msgstr ""
dongsheng@627 6430
dongsheng@627 6431 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 6432 #: ../en/ch04-concepts.xml:728
dongsheng@627 6433 msgid "Other contents of the dirstate"
dongsheng@627 6434 msgstr "目录状态的其它内容"
dongsheng@627 6435
dongsheng@627 6436 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6437 #: ../en/ch04-concepts.xml:730
dongsheng@627 6438 msgid ""
dongsheng@627 6439 "Because Mercurial doesn't force you to tell it when you're modifying a file, "
dongsheng@627 6440 "it uses the dirstate to store some extra information so it can determine "
dongsheng@627 6441 "efficiently whether you have modified a file. For each file in the working "
dongsheng@627 6442 "directory, it stores the time that it last modified the file itself, and the "
dongsheng@627 6443 "size of the file at that time."
dongsheng@627 6444 msgstr ""
dongsheng@627 6445
dongsheng@627 6446 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6447 #: ../en/ch04-concepts.xml:737
dongsheng@627 6448 msgid ""
dongsheng@627 6449 "When you explicitly <command role=\"hg-cmd\">hg add</command>, <command role="
dongsheng@627 6450 "\"hg-cmd\">hg remove</command>, <command role=\"hg-cmd\">hg rename</command> "
dongsheng@627 6451 "or <command role=\"hg-cmd\">hg copy</command> files, Mercurial updates the "
dongsheng@627 6452 "dirstate so that it knows what to do with those files when you commit."
dongsheng@627 6453 msgstr ""
dongsheng@627 6454
dongsheng@627 6455 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6456 #: ../en/ch04-concepts.xml:744
dongsheng@714 6457 msgid ""
dongsheng@714 6458 "The dirstate helps Mercurial to efficiently check the status of files in a "
dongsheng@714 6459 "repository."
dongsheng@714 6460 msgstr ""
dongsheng@714 6461
dongsheng@714 6462 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 6463 #: ../en/ch04-concepts.xml:749
dongsheng@714 6464 msgid ""
dongsheng@714 6465 "When Mercurial checks the state of a file in the working directory, it first "
dongsheng@714 6466 "checks a file's modification time against the time in the dirstate that "
dongsheng@714 6467 "records when Mercurial last wrote the file. If the last modified time is the "
dongsheng@714 6468 "same as the time when Mercurial wrote the file, the file must not have been "
dongsheng@714 6469 "modified, so Mercurial does not need to check any further."
dongsheng@714 6470 msgstr ""
dongsheng@714 6471
dongsheng@714 6472 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 6473 #: ../en/ch04-concepts.xml:758
dongsheng@714 6474 msgid ""
dongsheng@714 6475 "If the file's size has changed, the file must have been modified. If the "
dongsheng@714 6476 "modification time has changed, but the size has not, only then does Mercurial "
dongsheng@714 6477 "need to actually read the contents of the file to see if it has changed."
dongsheng@714 6478 msgstr ""
dongsheng@714 6479
dongsheng@714 6480 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6481 #: ../en/ch04-concepts.xml:766
dongsheng@714 6482 msgid ""
dongsheng@714 6483 "Storing the modification time and size dramatically reduces the number of "
dongsheng@714 6484 "read operations that Mercurial needs to perform when we run commands like "
dongsheng@714 6485 "<command>hg status</command>. This results in large performance improvements."
dongsheng@627 6486 msgstr ""
dongsheng@627 6487
dongsheng@627 6488 #. type: Content of: <book><chapter><title>
dongsheng@714 6489 #: ../en/ch05-daily.xml:5
dongsheng@627 6490 msgid "Mercurial in daily use"
dongsheng@627 6491 msgstr "Mercurial 的日常使用"
dongsheng@627 6492
dongsheng@627 6493 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 6494 #: ../en/ch05-daily.xml:8
dongsheng@627 6495 msgid "Telling Mercurial which files to track"
dongsheng@627 6496 msgstr "告诉 Mercurial 要跟踪哪些文件"
dongsheng@627 6497
dongsheng@627 6498 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 6499 #: ../en/ch05-daily.xml:10
dongsheng@627 6500 msgid ""
dongsheng@627 6501 "Mercurial does not work with files in your repository unless you tell it to "
dongsheng@627 6502 "manage them. The <command role=\"hg-cmd\">hg status</command> command will "
dongsheng@627 6503 "tell you which files Mercurial doesn't know about; it uses a <quote><literal>?"
dongsheng@627 6504 "</literal></quote> to display such files."
dongsheng@627 6505 msgstr ""
dongsheng@627 6506
dongsheng@627 6507 #
dongsheng@627 6508 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 6509 #: ../en/ch05-daily.xml:17
dongsheng@627 6510 msgid ""
dongsheng@627 6511 "To tell Mercurial to track a file, use the <command role=\"hg-cmd\">hg add</"
dongsheng@627 6512 "command> command. Once you have added a file, the entry in the output of "
dongsheng@627 6513 "<command role=\"hg-cmd\">hg status</command> for that file changes from "
dongsheng@627 6514 "<quote><literal>?</literal></quote> to <quote><literal>A</literal></quote>."
dongsheng@627 6515 msgstr ""
dongsheng@627 6516
dongsheng@627 6517 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 6518 #: ../en/ch05-daily.xml:26
dongsheng@627 6519 msgid ""
dongsheng@627 6520 "After you run a <command role=\"hg-cmd\">hg commit</command>, the files that "
dongsheng@627 6521 "you added before the commit will no longer be listed in the output of "
songdongsheng@710 6522 "<command role=\"hg-cmd\">hg status</command>. The reason for this is that by "
songdongsheng@710 6523 "default, <command role=\"hg-cmd\">hg status</command> only tells you about "
songdongsheng@710 6524 "<quote>interesting</quote> files&emdash;those that you have (for example) "
songdongsheng@710 6525 "modified, removed, or renamed. If you have a repository that contains "
songdongsheng@710 6526 "thousands of files, you will rarely want to know about files that Mercurial "
songdongsheng@710 6527 "is tracking, but that have not changed. (You can still get this information; "
songdongsheng@710 6528 "we'll return to this later.)"
dongsheng@627 6529 msgstr ""
dongsheng@627 6530
dongsheng@627 6531 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 6532 #: ../en/ch05-daily.xml:38
dongsheng@627 6533 msgid ""
dongsheng@627 6534 "Once you add a file, Mercurial doesn't do anything with it immediately. "
dongsheng@627 6535 "Instead, it will take a snapshot of the file's state the next time you "
dongsheng@627 6536 "perform a commit. It will then continue to track the changes you make to the "
dongsheng@627 6537 "file every time you commit, until you remove the file."
dongsheng@627 6538 msgstr ""
dongsheng@627 6539
dongsheng@627 6540 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 6541 #: ../en/ch05-daily.xml:45
dongsheng@627 6542 msgid "Explicit versus implicit file naming"
dongsheng@627 6543 msgstr "明确与隐含文件命名"
dongsheng@627 6544
dongsheng@627 6545 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6546 #: ../en/ch05-daily.xml:47
dongsheng@627 6547 msgid ""
songdongsheng@710 6548 "A useful behavior that Mercurial has is that if you pass the name of a "
dongsheng@627 6549 "directory to a command, every Mercurial command will treat this as <quote>I "
dongsheng@627 6550 "want to operate on every file in this directory and its subdirectories</"
dongsheng@627 6551 "quote>."
dongsheng@627 6552 msgstr ""
dongsheng@627 6553
dongsheng@627 6554 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6555 #: ../en/ch05-daily.xml:54
dongsheng@627 6556 msgid ""
dongsheng@627 6557 "Notice in this example that Mercurial printed the names of the files it "
songdongsheng@710 6558 "added, whereas it didn't do so when we added the file named <filename>myfile."
songdongsheng@710 6559 "txt</filename> in the earlier example."
dongsheng@627 6560 msgstr ""
dongsheng@627 6561
dongsheng@627 6562 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6563 #: ../en/ch05-daily.xml:59
dongsheng@627 6564 msgid ""
dongsheng@627 6565 "What's going on is that in the former case, we explicitly named the file to "
songdongsheng@710 6566 "add on the command line. The assumption that Mercurial makes in such cases "
songdongsheng@710 6567 "is that we know what we are doing, and it doesn't print any output."
dongsheng@627 6568 msgstr ""
dongsheng@627 6569
dongsheng@627 6570 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6571 #: ../en/ch05-daily.xml:64
dongsheng@627 6572 msgid ""
dongsheng@627 6573 "However, when we <emphasis>imply</emphasis> the names of files by giving the "
dongsheng@627 6574 "name of a directory, Mercurial takes the extra step of printing the name of "
dongsheng@627 6575 "each file that it does something with. This makes it more clear what is "
dongsheng@627 6576 "happening, and reduces the likelihood of a silent and nasty surprise. This "
songdongsheng@710 6577 "behavior is common to most Mercurial commands."
dongsheng@627 6578 msgstr ""
dongsheng@627 6579
dongsheng@627 6580 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 6581 #: ../en/ch05-daily.xml:73
songdongsheng@710 6582 msgid "Mercurial tracks files, not directories"
songdongsheng@711 6583 msgstr "Mercurial 只跟踪文件,不跟踪目录"
dongsheng@627 6584
dongsheng@627 6585 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6586 #: ../en/ch05-daily.xml:75
dongsheng@627 6587 msgid ""
dongsheng@627 6588 "Mercurial does not track directory information. Instead, it tracks the path "
dongsheng@627 6589 "to a file. Before creating a file, it first creates any missing directory "
dongsheng@627 6590 "components of the path. After it deletes a file, it then deletes any empty "
dongsheng@627 6591 "directories that were in the deleted file's path. This sounds like a trivial "
dongsheng@627 6592 "distinction, but it has one minor practical consequence: it is not possible "
dongsheng@627 6593 "to represent a completely empty directory in Mercurial."
dongsheng@627 6594 msgstr ""
dongsheng@627 6595
dongsheng@627 6596 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6597 #: ../en/ch05-daily.xml:84
dongsheng@627 6598 msgid ""
dongsheng@627 6599 "Empty directories are rarely useful, and there are unintrusive workarounds "
dongsheng@627 6600 "that you can use to achieve an appropriate effect. The developers of "
dongsheng@627 6601 "Mercurial thus felt that the complexity that would be required to manage "
dongsheng@627 6602 "empty directories was not worth the limited benefit this feature would bring."
dongsheng@627 6603 msgstr ""
dongsheng@627 6604
dongsheng@627 6605 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6606 #: ../en/ch05-daily.xml:91
dongsheng@627 6607 msgid ""
dongsheng@627 6608 "If you need an empty directory in your repository, there are a few ways to "
dongsheng@627 6609 "achieve this. One is to create a directory, then <command role=\"hg-cmd\">hg "
dongsheng@627 6610 "add</command> a <quote>hidden</quote> file to that directory. On Unix-like "
dongsheng@627 6611 "systems, any file name that begins with a period (<quote><literal>.</"
dongsheng@627 6612 "literal></quote>) is treated as hidden by most commands and GUI tools. This "
dongsheng@627 6613 "approach is illustrated below."
dongsheng@627 6614 msgstr ""
dongsheng@627 6615
dongsheng@627 6616 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6617 #: ../en/ch05-daily.xml:102
dongsheng@627 6618 msgid ""
dongsheng@627 6619 "Another way to tackle a need for an empty directory is to simply create one "
dongsheng@627 6620 "in your automated build scripts before they will need it."
dongsheng@627 6621 msgstr ""
dongsheng@627 6622
dongsheng@627 6623 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 6624 #: ../en/ch05-daily.xml:109
dongsheng@627 6625 msgid "How to stop tracking a file"
dongsheng@627 6626 msgstr "如何停止跟踪文件"
dongsheng@627 6627
dongsheng@627 6628 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 6629 #: ../en/ch05-daily.xml:111
dongsheng@627 6630 msgid ""
dongsheng@627 6631 "Once you decide that a file no longer belongs in your repository, use the "
songdongsheng@710 6632 "<command role=\"hg-cmd\">hg remove</command> command. This deletes the file, "
dongsheng@714 6633 "and tells Mercurial to stop tracking it (which will occur at the next "
dongsheng@714 6634 "commit). A removed file is represented in the output of <command role=\"hg-"
dongsheng@714 6635 "cmd\">hg status</command> with a <quote><literal>R</literal></quote>."
dongsheng@714 6636 msgstr ""
dongsheng@714 6637
dongsheng@714 6638 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 6639 #: ../en/ch05-daily.xml:121
dongsheng@627 6640 msgid ""
dongsheng@627 6641 "After you <command role=\"hg-cmd\">hg remove</command> a file, Mercurial will "
dongsheng@627 6642 "no longer track changes to that file, even if you recreate a file with the "
dongsheng@627 6643 "same name in your working directory. If you do recreate a file with the same "
dongsheng@627 6644 "name and want Mercurial to track the new file, simply <command role=\"hg-cmd"
dongsheng@627 6645 "\">hg add</command> it. Mercurial will know that the newly added file is not "
dongsheng@627 6646 "related to the old file of the same name."
dongsheng@627 6647 msgstr ""
dongsheng@627 6648
dongsheng@627 6649 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 6650 #: ../en/ch05-daily.xml:130
dongsheng@627 6651 msgid "Removing a file does not affect its history"
dongsheng@627 6652 msgstr "删除文件不影响历史"
dongsheng@627 6653
dongsheng@627 6654 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6655 #: ../en/ch05-daily.xml:132
dongsheng@627 6656 msgid "It is important to understand that removing a file has only two effects."
dongsheng@627 6657 msgstr ""
dongsheng@627 6658
dongsheng@627 6659 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 6660 #: ../en/ch05-daily.xml:135
dongsheng@627 6661 msgid "It removes the current version of the file from the working directory."
dongsheng@627 6662 msgstr ""
dongsheng@627 6663
dongsheng@627 6664 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 6665 #: ../en/ch05-daily.xml:138
dongsheng@627 6666 msgid ""
dongsheng@627 6667 "It stops Mercurial from tracking changes to the file, from the time of the "
dongsheng@627 6668 "next commit."
dongsheng@627 6669 msgstr ""
dongsheng@627 6670
dongsheng@627 6671 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6672 #: ../en/ch05-daily.xml:141
dongsheng@627 6673 msgid ""
dongsheng@627 6674 "Removing a file <emphasis>does not</emphasis> in any way alter the "
dongsheng@627 6675 "<emphasis>history</emphasis> of the file."
dongsheng@627 6676 msgstr ""
dongsheng@627 6677
dongsheng@627 6678 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6679 #: ../en/ch05-daily.xml:144
dongsheng@627 6680 msgid ""
songdongsheng@710 6681 "If you update the working directory to a changeset that was committed when it "
songdongsheng@710 6682 "was still tracking a file that you later removed, the file will reappear in "
songdongsheng@710 6683 "the working directory, with the contents it had when you committed that "
songdongsheng@710 6684 "changeset. If you then update the working directory to a later changeset, in "
songdongsheng@710 6685 "which the file had been removed, Mercurial will once again remove the file "
songdongsheng@710 6686 "from the working directory."
songdongsheng@710 6687 msgstr ""
songdongsheng@710 6688
songdongsheng@710 6689 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 6690 #: ../en/ch05-daily.xml:155
dongsheng@627 6691 msgid "Missing files"
dongsheng@627 6692 msgstr "丢失的文件"
dongsheng@627 6693
dongsheng@627 6694 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6695 #: ../en/ch05-daily.xml:157
dongsheng@627 6696 msgid ""
dongsheng@627 6697 "Mercurial considers a file that you have deleted, but not used <command role="
dongsheng@627 6698 "\"hg-cmd\">hg remove</command> to delete, to be <emphasis>missing</"
dongsheng@627 6699 "emphasis>. A missing file is represented with <quote><literal>!</literal></"
dongsheng@627 6700 "quote> in the output of <command role=\"hg-cmd\">hg status</command>. "
dongsheng@627 6701 "Mercurial commands will not generally do anything with missing files."
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:167
dongsheng@627 6706 msgid ""
dongsheng@627 6707 "If your repository contains a file that <command role=\"hg-cmd\">hg status</"
dongsheng@627 6708 "command> reports as missing, and you want the file to stay gone, you can run "
dongsheng@627 6709 "<command role=\"hg-cmd\">hg remove <option role=\"hg-opt-remove\">--after</"
dongsheng@627 6710 "option></command> at any time later on, to tell Mercurial that you really did "
dongsheng@627 6711 "mean to remove the file."
dongsheng@627 6712 msgstr ""
dongsheng@627 6713
dongsheng@627 6714 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6715 #: ../en/ch05-daily.xml:177
dongsheng@627 6716 msgid ""
dongsheng@627 6717 "On the other hand, if you deleted the missing file by accident, give <command "
dongsheng@627 6718 "role=\"hg-cmd\">hg revert</command> the name of the file to recover. It will "
dongsheng@627 6719 "reappear, in unmodified form."
dongsheng@627 6720 msgstr ""
dongsheng@627 6721
dongsheng@627 6722 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 6723 #: ../en/ch05-daily.xml:186
dongsheng@627 6724 msgid "Aside: why tell Mercurial explicitly to remove a file?"
dongsheng@627 6725 msgstr "旁白: 为什么要明确告诉 Mercurial 删除文件?"
dongsheng@627 6726
dongsheng@627 6727 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6728 #: ../en/ch05-daily.xml:189
dongsheng@627 6729 msgid ""
dongsheng@627 6730 "You might wonder why Mercurial requires you to explicitly tell it that you "
dongsheng@627 6731 "are deleting a file. Early during the development of Mercurial, it let you "
dongsheng@627 6732 "delete a file however you pleased; Mercurial would notice the absence of the "
dongsheng@627 6733 "file automatically when you next ran a <command role=\"hg-cmd\">hg commit</"
dongsheng@627 6734 "command>, and stop tracking the file. In practice, this made it too easy to "
dongsheng@627 6735 "accidentally remove a file without noticing."
dongsheng@627 6736 msgstr ""
dongsheng@627 6737
dongsheng@627 6738 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 6739 #: ../en/ch05-daily.xml:200
songdongsheng@668 6740 msgid "Useful shorthand&emdash;adding and removing files in one step"
dongsheng@661 6741 msgstr "有用的速记—一个步骤添加和删除文件"
dongsheng@627 6742
dongsheng@627 6743 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6744 #: ../en/ch05-daily.xml:203
dongsheng@627 6745 msgid ""
dongsheng@627 6746 "Mercurial offers a combination command, <command role=\"hg-cmd\">hg "
dongsheng@627 6747 "addremove</command>, that adds untracked files and marks missing files as "
dongsheng@627 6748 "removed."
dongsheng@627 6749 msgstr ""
dongsheng@627 6750
dongsheng@627 6751 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6752 #: ../en/ch05-daily.xml:209
dongsheng@627 6753 msgid ""
dongsheng@627 6754 "The <command role=\"hg-cmd\">hg commit</command> command also provides a "
dongsheng@627 6755 "<option role=\"hg-opt-commit\">-A</option> option that performs this same add-"
dongsheng@627 6756 "and-remove, immediately followed by a commit."
dongsheng@627 6757 msgstr ""
dongsheng@627 6758
dongsheng@627 6759 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 6760 #: ../en/ch05-daily.xml:219
dongsheng@627 6761 msgid "Copying files"
dongsheng@627 6762 msgstr "复制文件"
dongsheng@627 6763
dongsheng@627 6764 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 6765 #: ../en/ch05-daily.xml:221
dongsheng@627 6766 msgid ""
dongsheng@627 6767 "Mercurial provides a <command role=\"hg-cmd\">hg copy</command> command that "
dongsheng@627 6768 "lets you make a new copy of a file. When you copy a file using this command, "
dongsheng@627 6769 "Mercurial makes a record of the fact that the new file is a copy of the "
dongsheng@627 6770 "original file. It treats these copied files specially when you merge your "
dongsheng@627 6771 "work with someone else's."
dongsheng@627 6772 msgstr ""
dongsheng@627 6773
dongsheng@627 6774 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 6775 #: ../en/ch05-daily.xml:229
dongsheng@627 6776 msgid "The results of copying during a merge"
dongsheng@627 6777 msgstr "合并期间的复制结果"
dongsheng@627 6778
dongsheng@627 6779 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6780 #: ../en/ch05-daily.xml:231
dongsheng@627 6781 msgid ""
dongsheng@627 6782 "What happens during a merge is that changes <quote>follow</quote> a copy. To "
dongsheng@627 6783 "best illustrate what this means, let's create an example. We'll start with "
dongsheng@627 6784 "the usual tiny repository that contains a single file."
dongsheng@627 6785 msgstr ""
dongsheng@627 6786
dongsheng@627 6787 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6788 #: ../en/ch05-daily.xml:238
dongsheng@627 6789 msgid ""
dongsheng@627 6790 "We need to do some work in parallel, so that we'll have something to merge. "
dongsheng@627 6791 "So let's clone our repository."
dongsheng@627 6792 msgstr ""
dongsheng@627 6793
dongsheng@627 6794 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6795 #: ../en/ch05-daily.xml:244
dongsheng@627 6796 msgid ""
dongsheng@627 6797 "Back in our initial repository, let's use the <command role=\"hg-cmd\">hg "
dongsheng@627 6798 "copy</command> command to make a copy of the first file we created."
dongsheng@627 6799 msgstr ""
dongsheng@627 6800
dongsheng@627 6801 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6802 #: ../en/ch05-daily.xml:250
dongsheng@627 6803 msgid ""
dongsheng@627 6804 "If we look at the output of the <command role=\"hg-cmd\">hg status</command> "
dongsheng@627 6805 "command afterwards, the copied file looks just like a normal added file."
dongsheng@627 6806 msgstr ""
dongsheng@627 6807
dongsheng@627 6808 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6809 #: ../en/ch05-daily.xml:256
dongsheng@627 6810 msgid ""
dongsheng@627 6811 "But if we pass the <option role=\"hg-opt-status\">-C</option> option to "
dongsheng@627 6812 "<command role=\"hg-cmd\">hg status</command>, it prints another line of "
dongsheng@627 6813 "output: this is the file that our newly-added file was copied <emphasis>from</"
dongsheng@627 6814 "emphasis>."
dongsheng@627 6815 msgstr ""
dongsheng@627 6816
dongsheng@627 6817 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6818 #: ../en/ch05-daily.xml:264
dongsheng@627 6819 msgid ""
dongsheng@627 6820 "Now, back in the repository we cloned, let's make a change in parallel. "
dongsheng@627 6821 "We'll add a line of content to the original file that we created."
dongsheng@627 6822 msgstr ""
dongsheng@627 6823
dongsheng@627 6824 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6825 #: ../en/ch05-daily.xml:270
dongsheng@627 6826 msgid ""
dongsheng@627 6827 "Now we have a modified <filename>file</filename> in this repository. When we "
dongsheng@627 6828 "pull the changes from the first repository, and merge the two heads, "
dongsheng@627 6829 "Mercurial will propagate the changes that we made locally to <filename>file</"
dongsheng@627 6830 "filename> into its copy, <filename>new-file</filename>."
dongsheng@627 6831 msgstr ""
dongsheng@627 6832
dongsheng@627 6833 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 6834 #: ../en/ch05-daily.xml:280
dongsheng@627 6835 msgid "Why should changes follow copies?"
dongsheng@627 6836 msgstr "为什么复制后需要后续修改?"
dongsheng@627 6837
dongsheng@627 6838 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6839 #: ../en/ch05-daily.xml:282
songdongsheng@710 6840 msgid ""
songdongsheng@710 6841 "This behavior&emdash;of changes to a file propagating out to copies of the "
songdongsheng@710 6842 "file&emdash;might seem esoteric, but in most cases it's highly desirable."
songdongsheng@710 6843 msgstr ""
songdongsheng@710 6844
songdongsheng@710 6845 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6846 #: ../en/ch05-daily.xml:286
dongsheng@627 6847 msgid ""
dongsheng@627 6848 "First of all, remember that this propagation <emphasis>only</emphasis> "
dongsheng@627 6849 "happens when you merge. So if you <command role=\"hg-cmd\">hg copy</command> "
dongsheng@627 6850 "a file, and subsequently modify the original file during the normal course of "
dongsheng@627 6851 "your work, nothing will happen."
dongsheng@627 6852 msgstr ""
dongsheng@627 6853
dongsheng@627 6854 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6855 #: ../en/ch05-daily.xml:292
dongsheng@627 6856 msgid ""
dongsheng@627 6857 "The second thing to know is that modifications will only propagate across a "
songdongsheng@710 6858 "copy as long as the changeset that you're merging changes from "
songdongsheng@710 6859 "<emphasis>hasn't yet seen</emphasis> the copy."
songdongsheng@710 6860 msgstr ""
songdongsheng@710 6861
songdongsheng@710 6862 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6863 #: ../en/ch05-daily.xml:297
dongsheng@627 6864 msgid ""
dongsheng@627 6865 "The reason that Mercurial does this is as follows. Let's say I make an "
dongsheng@627 6866 "important bug fix in a source file, and commit my changes. Meanwhile, you've "
dongsheng@627 6867 "decided to <command role=\"hg-cmd\">hg copy</command> the file in your "
dongsheng@627 6868 "repository, without knowing about the bug or having seen the fix, and you "
dongsheng@627 6869 "have started hacking on your copy of the file."
dongsheng@627 6870 msgstr ""
dongsheng@627 6871
dongsheng@627 6872 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6873 #: ../en/ch05-daily.xml:304
dongsheng@627 6874 msgid ""
dongsheng@627 6875 "If you pulled and merged my changes, and Mercurial <emphasis>didn't</"
songdongsheng@710 6876 "emphasis> propagate changes across copies, your new source file would now "
songdongsheng@710 6877 "contain the bug, and unless you knew to propagate the bug fix by hand, the "
songdongsheng@710 6878 "bug would <emphasis>remain</emphasis> in your copy of the file."
songdongsheng@710 6879 msgstr ""
songdongsheng@710 6880
songdongsheng@710 6881 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6882 #: ../en/ch05-daily.xml:310
dongsheng@627 6883 msgid ""
dongsheng@627 6884 "By automatically propagating the change that fixed the bug from the original "
dongsheng@627 6885 "file to the copy, Mercurial prevents this class of problem. To my knowledge, "
dongsheng@627 6886 "Mercurial is the <emphasis>only</emphasis> revision control system that "
dongsheng@627 6887 "propagates changes across copies like this."
dongsheng@627 6888 msgstr ""
dongsheng@627 6889
dongsheng@627 6890 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6891 #: ../en/ch05-daily.xml:316
dongsheng@627 6892 msgid ""
dongsheng@627 6893 "Once your change history has a record that the copy and subsequent merge "
dongsheng@627 6894 "occurred, there's usually no further need to propagate changes from the "
dongsheng@627 6895 "original file to the copied file, and that's why Mercurial only propagates "
songdongsheng@710 6896 "changes across copies at the first merge, and not afterwards."
songdongsheng@710 6897 msgstr ""
songdongsheng@710 6898
songdongsheng@710 6899 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 6900 #: ../en/ch05-daily.xml:324
dongsheng@627 6901 msgid "How to make changes <emphasis>not</emphasis> follow a copy"
dongsheng@627 6902 msgstr "如何让复制后<emphasis>不</emphasis>修改?"
dongsheng@627 6903
dongsheng@627 6904 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6905 #: ../en/ch05-daily.xml:327
dongsheng@627 6906 msgid ""
dongsheng@627 6907 "If, for some reason, you decide that this business of automatically "
dongsheng@627 6908 "propagating changes across copies is not for you, simply use your system's "
dongsheng@627 6909 "normal file copy command (on Unix-like systems, that's <command>cp</command>) "
dongsheng@627 6910 "to make a copy of a file, then <command role=\"hg-cmd\">hg add</command> the "
songdongsheng@658 6911 "new copy by hand. Before you do so, though, please do reread <xref linkend="
songdongsheng@710 6912 "\"sec:daily:why-copy\"/>, and make an informed decision that this behavior is "
songdongsheng@710 6913 "not appropriate to your specific case."
songdongsheng@710 6914 msgstr ""
songdongsheng@710 6915
songdongsheng@710 6916 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 6917 #: ../en/ch05-daily.xml:340
songdongsheng@710 6918 msgid "Behavior of the <command role=\"hg-cmd\">hg copy</command> command"
dongsheng@627 6919 msgstr "命令 <command role=\"hg-cmd\">hg copy</command> 的特性"
dongsheng@627 6920
dongsheng@627 6921 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6922 #: ../en/ch05-daily.xml:343
dongsheng@627 6923 msgid ""
dongsheng@627 6924 "When you use the <command role=\"hg-cmd\">hg copy</command> command, "
dongsheng@627 6925 "Mercurial makes a copy of each source file as it currently stands in the "
dongsheng@627 6926 "working directory. This means that if you make some modifications to a file, "
dongsheng@627 6927 "then <command role=\"hg-cmd\">hg copy</command> it without first having "
dongsheng@627 6928 "committed those changes, the new copy will also contain the modifications you "
songdongsheng@710 6929 "have made up until that point. (I find this behavior a little "
dongsheng@627 6930 "counterintuitive, which is why I mention it here.)"
dongsheng@627 6931 msgstr ""
dongsheng@627 6932
dongsheng@627 6933 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6934 #: ../en/ch05-daily.xml:353
dongsheng@627 6935 msgid ""
dongsheng@627 6936 "The <command role=\"hg-cmd\">hg copy</command> command acts similarly to the "
dongsheng@627 6937 "Unix <command>cp</command> command (you can use the <command role=\"hg-cmd"
songdongsheng@710 6938 "\">hg cp</command> alias if you prefer). We must supply two or more "
songdongsheng@710 6939 "arguments, of which the last is treated as the <emphasis>destination</"
songdongsheng@710 6940 "emphasis>, and all others are <emphasis>sources</emphasis>."
songdongsheng@710 6941 msgstr ""
songdongsheng@710 6942
songdongsheng@710 6943 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6944 #: ../en/ch05-daily.xml:361
songdongsheng@710 6945 msgid ""
songdongsheng@710 6946 "If you pass <command role=\"hg-cmd\">hg copy</command> a single file as the "
songdongsheng@710 6947 "source, and the destination does not exist, it creates a new file with that "
songdongsheng@710 6948 "name."
songdongsheng@710 6949 msgstr ""
songdongsheng@710 6950
songdongsheng@710 6951 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6952 #: ../en/ch05-daily.xml:367
dongsheng@627 6953 msgid ""
dongsheng@627 6954 "If the destination is a directory, Mercurial copies its sources into that "
dongsheng@627 6955 "directory."
dongsheng@627 6956 msgstr ""
dongsheng@627 6957
dongsheng@627 6958 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6959 #: ../en/ch05-daily.xml:372
dongsheng@627 6960 msgid ""
dongsheng@627 6961 "Copying a directory is recursive, and preserves the directory structure of "
dongsheng@627 6962 "the source."
dongsheng@627 6963 msgstr ""
dongsheng@627 6964
dongsheng@627 6965 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6966 #: ../en/ch05-daily.xml:378
dongsheng@627 6967 msgid ""
dongsheng@627 6968 "If the source and destination are both directories, the source tree is "
dongsheng@627 6969 "recreated in the destination directory."
dongsheng@627 6970 msgstr ""
dongsheng@627 6971
songdongsheng@710 6972 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 6973 #: ../en/ch05-daily.xml:383
songdongsheng@710 6974 msgid ""
songdongsheng@710 6975 "As with the <command role=\"hg-cmd\">hg remove</command> command, if you copy "
dongsheng@627 6976 "a file manually and then want Mercurial to know that you've copied the file, "
dongsheng@627 6977 "simply use the <option role=\"hg-opt-copy\">--after</option> option to "
dongsheng@627 6978 "<command role=\"hg-cmd\">hg copy</command>."
dongsheng@627 6979 msgstr ""
dongsheng@627 6980
dongsheng@627 6981 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 6982 #: ../en/ch05-daily.xml:394
dongsheng@627 6983 msgid "Renaming files"
dongsheng@627 6984 msgstr "改名文件"
dongsheng@627 6985
dongsheng@627 6986 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 6987 #: ../en/ch05-daily.xml:396
dongsheng@627 6988 msgid ""
dongsheng@627 6989 "It's rather more common to need to rename a file than to make a copy of it. "
dongsheng@627 6990 "The reason I discussed the <command role=\"hg-cmd\">hg copy</command> command "
dongsheng@627 6991 "before talking about renaming files is that Mercurial treats a rename in "
dongsheng@627 6992 "essentially the same way as a copy. Therefore, knowing what Mercurial does "
dongsheng@627 6993 "when you copy a file tells you what to expect when you rename a file."
dongsheng@627 6994 msgstr ""
dongsheng@627 6995
dongsheng@627 6996 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 6997 #: ../en/ch05-daily.xml:404
dongsheng@627 6998 msgid ""
dongsheng@627 6999 "When you use the <command role=\"hg-cmd\">hg rename</command> command, "
dongsheng@627 7000 "Mercurial makes a copy of each source file, then deletes it and marks the "
dongsheng@627 7001 "file as removed."
dongsheng@627 7002 msgstr ""
dongsheng@627 7003
dongsheng@627 7004 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7005 #: ../en/ch05-daily.xml:410
dongsheng@627 7006 msgid ""
dongsheng@627 7007 "The <command role=\"hg-cmd\">hg status</command> command shows the newly "
dongsheng@627 7008 "copied file as added, and the copied-from file as removed."
dongsheng@627 7009 msgstr ""
dongsheng@627 7010
dongsheng@627 7011 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7012 #: ../en/ch05-daily.xml:416
dongsheng@627 7013 msgid ""
dongsheng@627 7014 "As with the results of a <command role=\"hg-cmd\">hg copy</command>, we must "
dongsheng@627 7015 "use the <option role=\"hg-opt-status\">-C</option> option to <command role="
dongsheng@627 7016 "\"hg-cmd\">hg status</command> to see that the added file is really being "
dongsheng@627 7017 "tracked by Mercurial as a copy of the original, now removed, file."
dongsheng@627 7018 msgstr ""
dongsheng@627 7019
dongsheng@627 7020 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7021 #: ../en/ch05-daily.xml:425
dongsheng@627 7022 msgid ""
dongsheng@627 7023 "As with <command role=\"hg-cmd\">hg remove</command> and <command role=\"hg-"
dongsheng@627 7024 "cmd\">hg copy</command>, you can tell Mercurial about a rename after the fact "
dongsheng@627 7025 "using the <option role=\"hg-opt-rename\">--after</option> option. In most "
songdongsheng@710 7026 "other respects, the behavior of the <command role=\"hg-cmd\">hg rename</"
dongsheng@627 7027 "command> command, and the options it accepts, are similar to the <command "
dongsheng@627 7028 "role=\"hg-cmd\">hg copy</command> command."
dongsheng@627 7029 msgstr ""
dongsheng@627 7030
songdongsheng@710 7031 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7032 #: ../en/ch05-daily.xml:434
songdongsheng@710 7033 msgid ""
songdongsheng@710 7034 "If you're familiar with the Unix command line, you'll be glad to know that "
songdongsheng@710 7035 "<command role=\"hg-cmd\">hg rename</command> command can be invoked as "
songdongsheng@710 7036 "<command role=\"hg-cmd\">hg mv</command>."
songdongsheng@710 7037 msgstr ""
songdongsheng@710 7038
songdongsheng@710 7039 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 7040 #: ../en/ch05-daily.xml:440
dongsheng@627 7041 msgid "Renaming files and merging changes"
dongsheng@627 7042 msgstr "改名文件与合并修改"
dongsheng@627 7043
dongsheng@627 7044 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7045 #: ../en/ch05-daily.xml:442
dongsheng@627 7046 msgid ""
dongsheng@627 7047 "Since Mercurial's rename is implemented as copy-and-remove, the same "
dongsheng@627 7048 "propagation of changes happens when you merge after a rename as after a copy."
dongsheng@627 7049 msgstr ""
dongsheng@627 7050
dongsheng@627 7051 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7052 #: ../en/ch05-daily.xml:446
dongsheng@627 7053 msgid ""
dongsheng@627 7054 "If I modify a file, and you rename it to a new name, and then we merge our "
dongsheng@627 7055 "respective changes, my modifications to the file under its original name will "
dongsheng@627 7056 "be propagated into the file under its new name. (This is something you might "
dongsheng@627 7057 "expect to <quote>simply work,</quote> but not all revision control systems "
dongsheng@627 7058 "actually do this.)"
dongsheng@627 7059 msgstr ""
dongsheng@627 7060
dongsheng@627 7061 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7062 #: ../en/ch05-daily.xml:453
dongsheng@627 7063 msgid ""
dongsheng@627 7064 "Whereas having changes follow a copy is a feature where you can perhaps nod "
dongsheng@627 7065 "and say <quote>yes, that might be useful,</quote> it should be clear that "
dongsheng@627 7066 "having them follow a rename is definitely important. Without this facility, "
dongsheng@627 7067 "it would simply be too easy for changes to become orphaned when files are "
dongsheng@627 7068 "renamed."
dongsheng@627 7069 msgstr ""
dongsheng@627 7070
dongsheng@627 7071 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 7072 #: ../en/ch05-daily.xml:462
dongsheng@627 7073 msgid "Divergent renames and merging"
dongsheng@627 7074 msgstr "改名与合并的分歧"
dongsheng@627 7075
dongsheng@627 7076 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7077 #: ../en/ch05-daily.xml:464
dongsheng@627 7078 msgid ""
songdongsheng@668 7079 "The case of diverging names occurs when two developers start with a "
songdongsheng@668 7080 "file&emdash;let's call it <filename>foo</filename>&emdash;in their respective "
dongsheng@627 7081 "repositories."
dongsheng@627 7082 msgstr ""
dongsheng@627 7083
dongsheng@627 7084 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7085 #: ../en/ch05-daily.xml:471
dongsheng@627 7086 msgid "Anne renames the file to <filename>bar</filename>."
dongsheng@627 7087 msgstr ""
dongsheng@627 7088
dongsheng@627 7089 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7090 #: ../en/ch05-daily.xml:475
songdongsheng@710 7091 msgid ""
songdongsheng@710 7092 "Meanwhile, Bob renames it to <filename>quux</filename>. (Remember that "
songdongsheng@710 7093 "<command role=\"hg-cmd\">hg mv</command> is an alias for <command role=\"hg-"
songdongsheng@710 7094 "cmd\">hg rename</command>.)"
songdongsheng@710 7095 msgstr ""
songdongsheng@710 7096
songdongsheng@710 7097 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7098 #: ../en/ch05-daily.xml:482
dongsheng@627 7099 msgid ""
dongsheng@627 7100 "I like to think of this as a conflict because each developer has expressed "
dongsheng@627 7101 "different intentions about what the file ought to be named."
dongsheng@627 7102 msgstr ""
dongsheng@627 7103
songdongsheng@710 7104 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7105 #: ../en/ch05-daily.xml:486
dongsheng@627 7106 msgid ""
dongsheng@627 7107 "What do you think should happen when they merge their work? Mercurial's "
songdongsheng@710 7108 "actual behavior is that it always preserves <emphasis>both</emphasis> names "
dongsheng@627 7109 "when it merges changesets that contain divergent renames."
dongsheng@627 7110 msgstr ""
dongsheng@627 7111
dongsheng@627 7112 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7113 #: ../en/ch05-daily.xml:493
songdongsheng@710 7114 msgid ""
songdongsheng@710 7115 "Notice that while Mercurial warns about the divergent renames, it leaves it "
dongsheng@627 7116 "up to you to do something about the divergence after the merge."
dongsheng@627 7117 msgstr ""
dongsheng@627 7118
dongsheng@627 7119 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 7120 #: ../en/ch05-daily.xml:499
dongsheng@627 7121 msgid "Convergent renames and merging"
dongsheng@627 7122 msgstr "收敛改名与合并"
dongsheng@627 7123
dongsheng@627 7124 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7125 #: ../en/ch05-daily.xml:501
dongsheng@627 7126 msgid ""
dongsheng@627 7127 "Another kind of rename conflict occurs when two people choose to rename "
dongsheng@627 7128 "different <emphasis>source</emphasis> files to the same "
dongsheng@627 7129 "<emphasis>destination</emphasis>. In this case, Mercurial runs its normal "
dongsheng@627 7130 "merge machinery, and lets you guide it to a suitable resolution."
dongsheng@627 7131 msgstr ""
dongsheng@627 7132
dongsheng@627 7133 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 7134 #: ../en/ch05-daily.xml:509
dongsheng@627 7135 msgid "Other name-related corner cases"
dongsheng@627 7136 msgstr "其它名称相关的角落"
dongsheng@627 7137
dongsheng@627 7138 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7139 #: ../en/ch05-daily.xml:511
dongsheng@627 7140 msgid ""
dongsheng@627 7141 "Mercurial has a longstanding bug in which it fails to handle a merge where "
dongsheng@627 7142 "one side has a file with a given name, while another has a directory with the "
dongsheng@627 7143 "same name. This is documented as <ulink role=\"hg-bug\" url=\"http://www."
dongsheng@627 7144 "selenic.com/mercurial/bts/issue29\">issue 29</ulink>."
dongsheng@627 7145 msgstr ""
dongsheng@627 7146
dongsheng@627 7147 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 7148 #: ../en/ch05-daily.xml:524
dongsheng@627 7149 msgid "Recovering from mistakes"
dongsheng@627 7150 msgstr "从错误恢复"
dongsheng@627 7151
dongsheng@627 7152 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7153 #: ../en/ch05-daily.xml:526
dongsheng@627 7154 msgid ""
dongsheng@627 7155 "Mercurial has some useful commands that will help you to recover from some "
dongsheng@627 7156 "common mistakes."
dongsheng@627 7157 msgstr ""
dongsheng@627 7158
dongsheng@627 7159 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7160 #: ../en/ch05-daily.xml:529
dongsheng@627 7161 msgid ""
dongsheng@627 7162 "The <command role=\"hg-cmd\">hg revert</command> command lets you undo "
dongsheng@627 7163 "changes that you have made to your working directory. For example, if you "
dongsheng@627 7164 "<command role=\"hg-cmd\">hg add</command> a file by accident, just run "
dongsheng@627 7165 "<command role=\"hg-cmd\">hg revert</command> with the name of the file you "
dongsheng@627 7166 "added, and while the file won't be touched in any way, it won't be tracked "
dongsheng@627 7167 "for adding by Mercurial any longer, either. You can also use <command role="
dongsheng@627 7168 "\"hg-cmd\">hg revert</command> to get rid of erroneous changes to a file."
dongsheng@627 7169 msgstr ""
dongsheng@627 7170
dongsheng@627 7171 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7172 #: ../en/ch05-daily.xml:539
dongsheng@714 7173 msgid ""
dongsheng@714 7174 "It is helpful to remember that the <command role=\"hg-cmd\">hg revert</"
dongsheng@714 7175 "command> command is useful for changes that you have not yet committed. Once "
dongsheng@714 7176 "you've committed a change, if you decide it was a mistake, you can still do "
dongsheng@627 7177 "something about it, though your options may be more limited."
dongsheng@627 7178 msgstr ""
dongsheng@627 7179
dongsheng@627 7180 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7181 #: ../en/ch05-daily.xml:546
dongsheng@627 7182 msgid ""
dongsheng@627 7183 "For more information about the <command role=\"hg-cmd\">hg revert</command> "
dongsheng@627 7184 "command, and details about how to deal with changes you have already "
songdongsheng@658 7185 "committed, see <xref linkend=\"chap:undo\"/>."
dongsheng@627 7186 msgstr ""
dongsheng@627 7187
songdongsheng@710 7188 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 7189 #: ../en/ch05-daily.xml:553
songdongsheng@710 7190 msgid "Dealing with tricky merges"
songdongsheng@711 7191 msgstr "合并的技巧"
songdongsheng@710 7192
songdongsheng@710 7193 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7194 #: ../en/ch05-daily.xml:555
songdongsheng@710 7195 msgid ""
songdongsheng@710 7196 "In a complicated or large project, it's not unusual for a merge of two "
songdongsheng@710 7197 "changesets to result in some headaches. Suppose there's a big source file "
songdongsheng@710 7198 "that's been extensively edited by each side of a merge: this is almost "
songdongsheng@710 7199 "inevitably going to result in conflicts, some of which can take a few tries "
songdongsheng@710 7200 "to sort out."
songdongsheng@710 7201 msgstr ""
songdongsheng@710 7202
songdongsheng@710 7203 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7204 #: ../en/ch05-daily.xml:562
songdongsheng@710 7205 msgid ""
songdongsheng@710 7206 "Let's develop a simple case of this and see how to deal with it. We'll start "
songdongsheng@710 7207 "off with a repository containing one file, and clone it twice."
songdongsheng@710 7208 msgstr ""
songdongsheng@710 7209
songdongsheng@710 7210 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7211 #: ../en/ch05-daily.xml:568
songdongsheng@710 7212 msgid "In one clone, we'll modify the file in one way."
songdongsheng@710 7213 msgstr ""
songdongsheng@710 7214
songdongsheng@710 7215 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7216 #: ../en/ch05-daily.xml:572
songdongsheng@710 7217 msgid "In another, we'll modify the file differently."
songdongsheng@710 7218 msgstr ""
songdongsheng@710 7219
songdongsheng@710 7220 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7221 #: ../en/ch05-daily.xml:576
songdongsheng@710 7222 msgid "Next, we'll pull each set of changes into our original repo."
songdongsheng@710 7223 msgstr ""
songdongsheng@710 7224
songdongsheng@710 7225 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7226 #: ../en/ch05-daily.xml:581
songdongsheng@710 7227 msgid "We expect our repository to now contain two heads."
songdongsheng@710 7228 msgstr ""
songdongsheng@710 7229
songdongsheng@710 7230 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7231 #: ../en/ch05-daily.xml:585
songdongsheng@710 7232 msgid ""
songdongsheng@710 7233 "Normally, if we run <command role=\"hg-cmd\">hg merge</command> at this "
songdongsheng@710 7234 "point, it will drop us into a GUI that will let us manually resolve the "
songdongsheng@710 7235 "conflicting edits to <filename>myfile.txt</filename>. However, to simplify "
songdongsheng@710 7236 "things for presentation here, we'd like the merge to fail immediately "
songdongsheng@710 7237 "instead. Here's one way we can do so."
songdongsheng@710 7238 msgstr ""
songdongsheng@710 7239
songdongsheng@710 7240 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7241 #: ../en/ch05-daily.xml:594
songdongsheng@710 7242 msgid ""
songdongsheng@710 7243 "We've told Mercurial's merge machinery to run the command <command>false</"
songdongsheng@710 7244 "command> (which, as we desire, fails immediately) if it detects a merge that "
songdongsheng@710 7245 "it can't sort out automatically."
songdongsheng@710 7246 msgstr ""
songdongsheng@710 7247
songdongsheng@710 7248 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7249 #: ../en/ch05-daily.xml:599
songdongsheng@710 7250 msgid ""
songdongsheng@710 7251 "If we now fire up <command role=\"hg-cmd\">hg merge</command>, it should "
songdongsheng@710 7252 "grind to a halt and report a failure."
songdongsheng@710 7253 msgstr ""
songdongsheng@710 7254
songdongsheng@710 7255 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7256 #: ../en/ch05-daily.xml:605
songdongsheng@710 7257 msgid ""
songdongsheng@710 7258 "Even if we don't notice that the merge failed, Mercurial will prevent us from "
songdongsheng@710 7259 "accidentally committing the result of a failed merge."
songdongsheng@710 7260 msgstr ""
songdongsheng@710 7261
songdongsheng@710 7262 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7263 #: ../en/ch05-daily.xml:611
songdongsheng@710 7264 msgid ""
songdongsheng@710 7265 "When <command role=\"hg-cmd\">hg commit</command> fails in this case, it "
songdongsheng@710 7266 "suggests that we use the unfamiliar <command role=\"hg-cmd\">hg resolve</"
songdongsheng@710 7267 "command> command. As usual, <command role=\"hg-cmd\">hg help resolve</"
songdongsheng@710 7268 "command> will print a helpful synopsis."
songdongsheng@710 7269 msgstr ""
songdongsheng@710 7270
songdongsheng@710 7271 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 7272 #: ../en/ch05-daily.xml:618
songdongsheng@710 7273 msgid "File resolution states"
dongsheng@716 7274 msgstr "文件的解决状态"
songdongsheng@710 7275
songdongsheng@710 7276 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7277 #: ../en/ch05-daily.xml:620
songdongsheng@710 7278 msgid ""
songdongsheng@710 7279 "When a merge occurs, most files will usually remain unmodified. For each "
songdongsheng@710 7280 "file where Mercurial has to do something, it tracks the state of the file."
songdongsheng@710 7281 msgstr ""
songdongsheng@710 7282
songdongsheng@710 7283 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 7284 #: ../en/ch05-daily.xml:626
songdongsheng@710 7285 msgid ""
songdongsheng@710 7286 "A <emphasis>resolved</emphasis> file has been successfully merged, either "
songdongsheng@710 7287 "automatically by Mercurial or manually with human intervention."
songdongsheng@710 7288 msgstr ""
songdongsheng@710 7289
songdongsheng@710 7290 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 7291 #: ../en/ch05-daily.xml:631
songdongsheng@710 7292 msgid ""
songdongsheng@710 7293 "An <emphasis>unresolved</emphasis> file was not merged successfully, and "
songdongsheng@710 7294 "needs more attention."
songdongsheng@710 7295 msgstr ""
songdongsheng@710 7296
songdongsheng@710 7297 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7298 #: ../en/ch05-daily.xml:636
songdongsheng@710 7299 msgid ""
songdongsheng@710 7300 "If Mercurial sees <emphasis>any</emphasis> file in the unresolved state after "
songdongsheng@710 7301 "a merge, it considers the merge to have failed. Fortunately, we do not need "
songdongsheng@710 7302 "to restart the entire merge from scratch."
songdongsheng@710 7303 msgstr ""
songdongsheng@710 7304
songdongsheng@710 7305 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7306 #: ../en/ch05-daily.xml:641
songdongsheng@710 7307 msgid ""
songdongsheng@710 7308 "The <option role=\"hg-opt-resolve\">--list</option> or <option role=\"hg-opt-"
songdongsheng@710 7309 "resolve\">-l</option> option to <command role=\"hg-cmd\">hg resolve</command> "
songdongsheng@710 7310 "prints out the state of each merged file."
songdongsheng@710 7311 msgstr ""
songdongsheng@710 7312
songdongsheng@710 7313 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7314 #: ../en/ch05-daily.xml:648
songdongsheng@710 7315 msgid ""
songdongsheng@710 7316 "In the output from <command role=\"hg-cmd\">hg resolve</command>, a resolved "
songdongsheng@710 7317 "file is marked with <literal>R</literal>, while an unresolved file is marked "
songdongsheng@710 7318 "with <literal>U</literal>. If any files are listed with <literal>U</"
songdongsheng@710 7319 "literal>, we know that an attempt to commit the results of the merge will "
songdongsheng@710 7320 "fail."
songdongsheng@710 7321 msgstr ""
songdongsheng@710 7322
songdongsheng@710 7323 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 7324 #: ../en/ch05-daily.xml:657
songdongsheng@710 7325 msgid "Resolving a file merge"
songdongsheng@711 7326 msgstr "合并文件"
songdongsheng@710 7327
songdongsheng@710 7328 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7329 #: ../en/ch05-daily.xml:659
songdongsheng@710 7330 msgid ""
songdongsheng@710 7331 "We have several options to move a file from the unresolved into the resolved "
songdongsheng@710 7332 "state. By far the most common is to rerun <command role=\"hg-cmd\">hg "
songdongsheng@710 7333 "resolve</command>. If we pass the names of individual files or directories, "
songdongsheng@710 7334 "it will retry the merges of any unresolved files present in those locations. "
songdongsheng@710 7335 "We can also pass the <option role=\"hg-opt-resolve\">--all</option> or "
songdongsheng@710 7336 "<option role=\"hg-opt-resolve\">-a</option> option, which will retry the "
songdongsheng@710 7337 "merges of <emphasis>all</emphasis> unresolved files."
songdongsheng@710 7338 msgstr ""
songdongsheng@710 7339
songdongsheng@710 7340 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7341 #: ../en/ch05-daily.xml:669
songdongsheng@710 7342 msgid ""
songdongsheng@710 7343 "Mercurial also lets us modify the resolution state of a file directly. We "
songdongsheng@710 7344 "can manually mark a file as resolved using the <option role=\"hg-opt-resolve"
songdongsheng@710 7345 "\">--mark</option> option, or as unresolved using the <option role=\"hg-opt-"
songdongsheng@710 7346 "resolve\">--unmark</option> option. This allows us to clean up a "
songdongsheng@710 7347 "particularly messy merge by hand, and to keep track of our progress with each "
songdongsheng@710 7348 "file as we go."
songdongsheng@710 7349 msgstr ""
songdongsheng@710 7350
dongsheng@714 7351 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 7352 #: ../en/ch05-daily.xml:680
dongsheng@714 7353 msgid "More useful diffs"
dongsheng@716 7354 msgstr "更有用的差异"
dongsheng@714 7355
dongsheng@714 7356 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7357 #: ../en/ch05-daily.xml:682
dongsheng@714 7358 msgid ""
dongsheng@714 7359 "The default output of the <command role=\"hg-cmd\">hg diff</command> command "
dongsheng@714 7360 "is backwards compatible with the regular <command>diff</command> command, but "
dongsheng@714 7361 "this has some drawbacks."
dongsheng@714 7362 msgstr ""
dongsheng@714 7363
dongsheng@714 7364 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7365 #: ../en/ch05-daily.xml:687
dongsheng@714 7366 msgid ""
dongsheng@714 7367 "Consider the case where we use <command role=\"hg-cmd\">hg rename</command> "
dongsheng@714 7368 "to rename a file."
dongsheng@715 7369 msgstr ""
dongsheng@715 7370 "设想我们使用 <command role=\"hg-cmd\">hg rename</command> 命令来改名文件。"
dongsheng@714 7371
dongsheng@714 7372 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7373 #: ../en/ch05-daily.xml:692
dongsheng@714 7374 msgid ""
dongsheng@714 7375 "The output of <command role=\"hg-cmd\">hg diff</command> above obscures the "
dongsheng@714 7376 "fact that we simply renamed a file. The <command role=\"hg-cmd\">hg diff</"
dongsheng@714 7377 "command> command accepts an option, <option>--git</option> or <option>-g</"
dongsheng@714 7378 "option>, to use a newer diff format that displays such information in a more "
dongsheng@714 7379 "readable form."
dongsheng@714 7380 msgstr ""
dongsheng@714 7381
dongsheng@714 7382 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7383 #: ../en/ch05-daily.xml:701
dongsheng@714 7384 msgid ""
dongsheng@714 7385 "This option also helps with a case that can otherwise be confusing: a file "
dongsheng@714 7386 "that appears to be modified according to <command role=\"hg-cmd\">hg status</"
dongsheng@714 7387 "command>, but for which <command role=\"hg-cmd\">hg diff</command> prints "
dongsheng@714 7388 "nothing. This situation can arise if we change the file's execute permissions."
dongsheng@714 7389 msgstr ""
dongsheng@714 7390
dongsheng@714 7391 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7392 #: ../en/ch05-daily.xml:710
dongsheng@714 7393 msgid ""
dongsheng@714 7394 "The normal <command>diff</command> command pays no attention to file "
dongsheng@714 7395 "permissions, which is why <command role=\"hg-cmd\">hg diff</command> prints "
dongsheng@714 7396 "nothing by default. If we supply it with the <option>-g</option> option, it "
dongsheng@714 7397 "tells us what really happened."
dongsheng@714 7398 msgstr ""
dongsheng@714 7399
dongsheng@714 7400 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 7401 #: ../en/ch05-daily.xml:720
dongsheng@714 7402 msgid "Which files to manage, and which to avoid"
dongsheng@716 7403 msgstr "需要管理哪些文件,应该避免的事情"
dongsheng@714 7404
dongsheng@714 7405 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7406 #: ../en/ch05-daily.xml:722
dongsheng@714 7407 msgid ""
dongsheng@714 7408 "Revision control systems are generally best at managing text files that are "
dongsheng@714 7409 "written by humans, such as source code, where the files do not change much "
dongsheng@714 7410 "from one revision to the next. Some centralized revision control systems can "
dongsheng@714 7411 "also deal tolerably well with binary files, such as bitmap images."
dongsheng@714 7412 msgstr ""
dongsheng@714 7413
dongsheng@714 7414 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7415 #: ../en/ch05-daily.xml:728
dongsheng@714 7416 msgid ""
dongsheng@714 7417 "For instance, a game development team will typically manage both its source "
dongsheng@714 7418 "code and all of its binary assets (e.g. geometry data, textures, map layouts) "
dongsheng@714 7419 "in a revision control system."
dongsheng@714 7420 msgstr ""
dongsheng@714 7421
dongsheng@714 7422 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7423 #: ../en/ch05-daily.xml:733
dongsheng@714 7424 msgid ""
dongsheng@714 7425 "Because it is usually impossible to merge two conflicting modifications to a "
dongsheng@714 7426 "binary file, centralized systems often provide a file locking mechanism that "
dongsheng@714 7427 "allow a user to say <quote>I am the only person who can edit this file</"
dongsheng@714 7428 "quote>."
dongsheng@714 7429 msgstr ""
dongsheng@714 7430
dongsheng@714 7431 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7432 #: ../en/ch05-daily.xml:739
dongsheng@714 7433 msgid ""
dongsheng@714 7434 "Compared to a centralized system, a distributed revision control system "
dongsheng@714 7435 "changes some of the factors that guide decisions over which files to manage "
dongsheng@714 7436 "and how."
dongsheng@714 7437 msgstr ""
dongsheng@714 7438
dongsheng@714 7439 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7440 #: ../en/ch05-daily.xml:743
dongsheng@714 7441 msgid ""
dongsheng@714 7442 "For instance, a distributed revision control system cannot, by its nature, "
dongsheng@714 7443 "offer a file locking facility. There is thus no built-in mechanism to "
dongsheng@714 7444 "prevent two people from making conflicting changes to a binary file. If you "
dongsheng@714 7445 "have a team where several people may be editing binary files frequently, it "
dongsheng@714 7446 "may not be a good idea to use Mercurial&emdash;or any other distributed "
dongsheng@714 7447 "revision control system&emdash;to manage those files."
dongsheng@714 7448 msgstr ""
dongsheng@714 7449
dongsheng@714 7450 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7451 #: ../en/ch05-daily.xml:751
dongsheng@714 7452 msgid ""
dongsheng@714 7453 "When storing modifications to a file, Mercurial usually saves only the "
dongsheng@714 7454 "differences between the previous and current versions of the file. For most "
dongsheng@714 7455 "text files, this is extremely efficient. However, some files (particularly "
dongsheng@714 7456 "binary files) are laid out in such a way that even a small change to a file's "
dongsheng@714 7457 "logical content results in many or most of the bytes inside the file "
dongsheng@714 7458 "changing. For instance, compressed files are particularly susceptible to "
dongsheng@714 7459 "this. If the differences between each successive version of a file are always "
dongsheng@714 7460 "large, Mercurial will not be able to store the file's revision history very "
dongsheng@714 7461 "efficiently. This can affect both local storage needs and the amount of time "
dongsheng@714 7462 "it takes to clone a repository."
dongsheng@714 7463 msgstr ""
dongsheng@714 7464
dongsheng@714 7465 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7466 #: ../en/ch05-daily.xml:764
dongsheng@714 7467 msgid ""
dongsheng@714 7468 "To get an idea of how this could affect you in practice, suppose you want to "
dongsheng@714 7469 "use Mercurial to manage an OpenOffice document. OpenOffice stores documents "
dongsheng@714 7470 "on disk as compressed zip files. Edit even a single letter of your document "
dongsheng@714 7471 "in OpenOffice, and almost every byte in the entire file will change when you "
dongsheng@714 7472 "save it. Now suppose that file is 2MB in size. Because most of the file "
dongsheng@714 7473 "changes every time you save, Mercurial will have to store all 2MB of the file "
dongsheng@714 7474 "every time you commit, even though from your perspective, perhaps only a few "
dongsheng@714 7475 "words are changing each time. A single frequently-edited file that is not "
dongsheng@714 7476 "friendly to Mercurial's storage assumptions can easily have an outsized "
dongsheng@714 7477 "effect on the size of the repository."
dongsheng@714 7478 msgstr ""
dongsheng@714 7479
dongsheng@714 7480 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7481 #: ../en/ch05-daily.xml:777
dongsheng@714 7482 msgid ""
dongsheng@714 7483 "Even worse, if both you and someone else edit the OpenOffice document you're "
dongsheng@714 7484 "working on, there is no useful way to merge your work. In fact, there isn't "
dongsheng@714 7485 "even a good way to tell what the differences are between your respective "
dongsheng@714 7486 "changes."
dongsheng@714 7487 msgstr ""
dongsheng@714 7488
dongsheng@714 7489 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7490 #: ../en/ch05-daily.xml:782
dongsheng@714 7491 msgid ""
dongsheng@714 7492 "There are thus a few clear recommendations about specific kinds of files to "
dongsheng@714 7493 "be very careful with."
dongsheng@714 7494 msgstr ""
dongsheng@714 7495
dongsheng@714 7496 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 7497 #: ../en/ch05-daily.xml:787
dongsheng@714 7498 msgid ""
dongsheng@714 7499 "Files that are very large and incompressible, e.g. ISO CD-ROM images, will by "
dongsheng@714 7500 "virtue of sheer size make clones over a network very slow."
dongsheng@714 7501 msgstr ""
dongsheng@714 7502
dongsheng@714 7503 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 7504 #: ../en/ch05-daily.xml:792
dongsheng@714 7505 msgid ""
dongsheng@714 7506 "Files that change a lot from one revision to the next may be expensive to "
dongsheng@714 7507 "store if you edit them frequently, and conflicts due to concurrent edits may "
dongsheng@714 7508 "be difficult to resolve."
dongsheng@714 7509 msgstr ""
dongsheng@714 7510
dongsheng@714 7511 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 7512 #: ../en/ch05-daily.xml:801
dongsheng@714 7513 msgid "Backups and mirroring"
dongsheng@715 7514 msgstr "备份与镜像"
dongsheng@714 7515
dongsheng@714 7516 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7517 #: ../en/ch05-daily.xml:803
dongsheng@714 7518 msgid ""
dongsheng@714 7519 "Since Mercurial maintains a complete copy of history in each clone, everyone "
dongsheng@714 7520 "who uses Mercurial to collaborate on a project can potentially act as a "
dongsheng@714 7521 "source of backups in the event of a catastrophe. If a central repository "
dongsheng@714 7522 "becomes unavailable, you can construct a replacement simply by cloning a copy "
dongsheng@714 7523 "of the repository from one contributor, and pulling any changes they may not "
dongsheng@714 7524 "have seen from others."
dongsheng@714 7525 msgstr ""
dongsheng@714 7526
dongsheng@714 7527 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7528 #: ../en/ch05-daily.xml:811
dongsheng@714 7529 msgid ""
dongsheng@714 7530 "It is simple to use Mercurial to perform off-site backups and remote "
dongsheng@714 7531 "mirrors. Set up a periodic job (e.g. via the <command>cron</command> "
dongsheng@714 7532 "command) on a remote server to pull changes from your master repositories "
dongsheng@714 7533 "every hour. This will only be tricky in the unlikely case that the number of "
dongsheng@714 7534 "master repositories you maintain changes frequently, in which case you'll "
dongsheng@714 7535 "need to do a little scripting to refresh the list of repositories to back up."
dongsheng@714 7536 msgstr ""
dongsheng@714 7537
dongsheng@714 7538 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7539 #: ../en/ch05-daily.xml:820
dongsheng@714 7540 msgid ""
dongsheng@714 7541 "If you perform traditional backups of your master repositories to tape or "
dongsheng@714 7542 "disk, and you want to back up a repository named <filename>myrepo</filename>, "
dongsheng@714 7543 "use <command>hg clone -U myrepo myrepo.bak</command> to create a clone of "
dongsheng@714 7544 "<filename>myrepo</filename> before you start your backups. The <option>-U</"
dongsheng@714 7545 "option> option doesn't check out a working directory after the clone "
dongsheng@714 7546 "completes, since that would be superfluous and make the backup take longer."
dongsheng@714 7547 msgstr ""
dongsheng@714 7548
dongsheng@714 7549 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7550 #: ../en/ch05-daily.xml:829
dongsheng@714 7551 msgid ""
dongsheng@714 7552 "If you then back up <filename>myrepo.bak</filename> instead of "
dongsheng@714 7553 "<filename>myrepo</filename>, you will be guaranteed to have a consistent "
dongsheng@714 7554 "snapshot of your repository that won't be pushed to by an insomniac developer "
dongsheng@714 7555 "in mid-backup."
dongsheng@714 7556 msgstr ""
dongsheng@714 7557
dongsheng@627 7558 #. type: Content of: <book><chapter><title>
dongsheng@714 7559 #: ../en/ch06-collab.xml:5
dongsheng@627 7560 msgid "Collaborating with other people"
dongsheng@627 7561 msgstr "团体协作"
dongsheng@627 7562
dongsheng@627 7563 #. type: Content of: <book><chapter><para>
dongsheng@714 7564 #: ../en/ch06-collab.xml:7
dongsheng@627 7565 msgid ""
dongsheng@627 7566 "As a completely decentralised tool, Mercurial doesn't impose any policy on "
dongsheng@627 7567 "how people ought to work with each other. However, if you're new to "
dongsheng@627 7568 "distributed revision control, it helps to have some tools and examples in "
dongsheng@627 7569 "mind when you're thinking about possible workflow models."
dongsheng@627 7570 msgstr ""
dongsheng@627 7571
dongsheng@627 7572 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 7573 #: ../en/ch06-collab.xml:14
dongsheng@627 7574 msgid "Mercurial's web interface"
dongsheng@630 7575 msgstr "Mercurial 的 web 接口"
dongsheng@627 7576
dongsheng@627 7577 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7578 #: ../en/ch06-collab.xml:16
dongsheng@627 7579 msgid ""
dongsheng@627 7580 "Mercurial has a powerful web interface that provides several useful "
dongsheng@627 7581 "capabilities."
dongsheng@627 7582 msgstr ""
dongsheng@627 7583
dongsheng@627 7584 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7585 #: ../en/ch06-collab.xml:19
dongsheng@627 7586 msgid ""
dongsheng@627 7587 "For interactive use, the web interface lets you browse a single repository or "
dongsheng@627 7588 "a collection of repositories. You can view the history of a repository, "
dongsheng@627 7589 "examine each change (comments and diffs), and view the contents of each "
songdongsheng@710 7590 "directory and file. You can even get a view of history that gives a "
songdongsheng@710 7591 "graphical view of the relationships between individual changes and merges."
songdongsheng@710 7592 msgstr ""
songdongsheng@710 7593
songdongsheng@710 7594 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7595 #: ../en/ch06-collab.xml:26
songdongsheng@710 7596 msgid ""
songdongsheng@710 7597 "Also for human consumption, the web interface provides Atom and RSS feeds of "
songdongsheng@710 7598 "the changes in a repository. This lets you <quote>subscribe</quote> to a "
songdongsheng@710 7599 "repository using your favorite feed reader, and be automatically notified of "
dongsheng@627 7600 "activity in that repository as soon as it happens. I find this capability "
dongsheng@627 7601 "much more convenient than the model of subscribing to a mailing list to which "
dongsheng@627 7602 "notifications are sent, as it requires no additional configuration on the "
dongsheng@627 7603 "part of whoever is serving the repository."
dongsheng@627 7604 msgstr ""
dongsheng@627 7605
dongsheng@627 7606 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7607 #: ../en/ch06-collab.xml:36
dongsheng@627 7608 msgid ""
dongsheng@627 7609 "The web interface also lets remote users clone a repository, pull changes "
dongsheng@627 7610 "from it, and (when the server is configured to permit it) push changes back "
dongsheng@627 7611 "to it. Mercurial's HTTP tunneling protocol aggressively compresses data, so "
dongsheng@627 7612 "that it works efficiently even over low-bandwidth network connections."
dongsheng@627 7613 msgstr ""
dongsheng@627 7614
dongsheng@627 7615 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7616 #: ../en/ch06-collab.xml:42
dongsheng@627 7617 msgid ""
dongsheng@627 7618 "The easiest way to get started with the web interface is to use your web "
dongsheng@627 7619 "browser to visit an existing repository, such as the master Mercurial "
songdongsheng@710 7620 "repository at <ulink url=\"http://www.selenic.com/repo/hg\">http://www."
songdongsheng@710 7621 "selenic.com/repo/hg</ulink>."
songdongsheng@710 7622 msgstr ""
songdongsheng@710 7623
songdongsheng@710 7624 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7625 #: ../en/ch06-collab.xml:47
dongsheng@627 7626 msgid ""
dongsheng@627 7627 "If you're interested in providing a web interface to your own repositories, "
songdongsheng@710 7628 "there are several good ways to do this."
songdongsheng@710 7629 msgstr ""
songdongsheng@710 7630
songdongsheng@710 7631 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7632 #: ../en/ch06-collab.xml:51
songdongsheng@710 7633 msgid ""
songdongsheng@710 7634 "The easiest and fastest way to get started in an informal environment is to "
songdongsheng@710 7635 "use the <command role=\"hg-cmd\">hg serve</command> command, which is best "
songdongsheng@710 7636 "suited to short-term <quote>lightweight</quote> serving. See <xref linkend="
songdongsheng@710 7637 "\"sec:collab:serve\"/> below for details of how to use this command."
songdongsheng@710 7638 msgstr ""
songdongsheng@710 7639
songdongsheng@710 7640 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7641 #: ../en/ch06-collab.xml:58
songdongsheng@710 7642 msgid ""
songdongsheng@710 7643 "For longer-lived repositories that you'd like to have permanently available, "
dongsheng@714 7644 "there are several public hosting services available. Some are free to open "
dongsheng@714 7645 "source projects, while others offer paid commercial hosting. An up-to-date "
dongsheng@714 7646 "list is available at <ulink url=\"http://www.selenic.com/mercurial/wiki/index."
dongsheng@714 7647 "cgi/MercurialHosting\">http://www.selenic.com/mercurial/wiki/index.cgi/"
dongsheng@714 7648 "MercurialHosting</ulink>."
dongsheng@714 7649 msgstr ""
dongsheng@714 7650
dongsheng@714 7651 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7652 #: ../en/ch06-collab.xml:65
songdongsheng@710 7653 msgid ""
songdongsheng@710 7654 "If you would prefer to host your own repositories, Mercurial has built-in "
songdongsheng@710 7655 "support for several popular hosting technologies, most notably CGI (Common "
songdongsheng@710 7656 "Gateway Interface), and WSGI (Web Services Gateway Interface). See <xref "
songdongsheng@710 7657 "linkend=\"sec:collab:cgi\"/> for details of CGI and WSGI configuration."
dongsheng@627 7658 msgstr ""
dongsheng@627 7659
dongsheng@627 7660 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 7661 #: ../en/ch06-collab.xml:74
dongsheng@627 7662 msgid "Collaboration models"
dongsheng@630 7663 msgstr "协作模型"
dongsheng@627 7664
dongsheng@627 7665 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 7666 #: ../en/ch06-collab.xml:76
dongsheng@627 7667 msgid ""
dongsheng@627 7668 "With a suitably flexible tool, making decisions about workflow is much more "
dongsheng@627 7669 "of a social engineering challenge than a technical one. Mercurial imposes few "
dongsheng@627 7670 "limitations on how you can structure the flow of work in a project, so it's "
dongsheng@627 7671 "up to you and your group to set up and live with a model that matches your "
dongsheng@627 7672 "own particular needs."
dongsheng@627 7673 msgstr ""
dongsheng@627 7674
dongsheng@627 7675 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 7676 #: ../en/ch06-collab.xml:84
dongsheng@627 7677 msgid "Factors to keep in mind"
dongsheng@630 7678 msgstr "要牢记的因素"
dongsheng@627 7679
dongsheng@627 7680 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7681 #: ../en/ch06-collab.xml:86
dongsheng@627 7682 msgid ""
dongsheng@627 7683 "The most important aspect of any model that you must keep in mind is how well "
dongsheng@627 7684 "it matches the needs and capabilities of the people who will be using it. "
dongsheng@627 7685 "This might seem self-evident; even so, you still can't afford to forget it "
dongsheng@627 7686 "for a moment."
dongsheng@627 7687 msgstr ""
dongsheng@627 7688
dongsheng@627 7689 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7690 #: ../en/ch06-collab.xml:92
dongsheng@627 7691 msgid ""
dongsheng@627 7692 "I once put together a workflow model that seemed to make perfect sense to me, "
dongsheng@627 7693 "but that caused a considerable amount of consternation and strife within my "
dongsheng@627 7694 "development team. In spite of my attempts to explain why we needed a complex "
dongsheng@627 7695 "set of branches, and how changes ought to flow between them, a few team "
dongsheng@627 7696 "members revolted. Even though they were smart people, they didn't want to "
dongsheng@627 7697 "pay attention to the constraints we were operating under, or face the "
dongsheng@627 7698 "consequences of those constraints in the details of the model that I was "
dongsheng@627 7699 "advocating."
dongsheng@627 7700 msgstr ""
dongsheng@627 7701
dongsheng@627 7702 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7703 #: ../en/ch06-collab.xml:102
dongsheng@627 7704 msgid ""
dongsheng@627 7705 "Don't sweep foreseeable social or technical problems under the rug. Whatever "
dongsheng@627 7706 "scheme you put into effect, you should plan for mistakes and problem "
dongsheng@627 7707 "scenarios. Consider adding automated machinery to prevent, or quickly "
dongsheng@627 7708 "recover from, trouble that you can anticipate. As an example, if you intend "
dongsheng@627 7709 "to have a branch with not-for-release changes in it, you'd do well to think "
dongsheng@627 7710 "early about the possibility that someone might accidentally merge those "
dongsheng@627 7711 "changes into a release branch. You could avoid this particular problem by "
dongsheng@627 7712 "writing a hook that prevents changes from being merged from an inappropriate "
dongsheng@627 7713 "branch."
dongsheng@627 7714 msgstr ""
dongsheng@627 7715
dongsheng@627 7716 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 7717 #: ../en/ch06-collab.xml:116
dongsheng@627 7718 msgid "Informal anarchy"
dongsheng@630 7719 msgstr "无政府状态"
dongsheng@627 7720
dongsheng@627 7721 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7722 #: ../en/ch06-collab.xml:118
dongsheng@627 7723 msgid ""
dongsheng@627 7724 "I wouldn't suggest an <quote>anything goes</quote> approach as something "
dongsheng@627 7725 "sustainable, but it's a model that's easy to grasp, and it works perfectly "
dongsheng@627 7726 "well in a few unusual situations."
dongsheng@627 7727 msgstr ""
dongsheng@627 7728
dongsheng@627 7729 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7730 #: ../en/ch06-collab.xml:123
dongsheng@627 7731 msgid ""
dongsheng@627 7732 "As one example, many projects have a loose-knit group of collaborators who "
dongsheng@627 7733 "rarely physically meet each other. Some groups like to overcome the "
songdongsheng@710 7734 "isolation of working at a distance by organizing occasional <quote>sprints</"
dongsheng@627 7735 "quote>. In a sprint, a number of people get together in a single location (a "
dongsheng@627 7736 "company's conference room, a hotel meeting room, that kind of place) and "
dongsheng@627 7737 "spend several days more or less locked in there, hacking intensely on a "
dongsheng@627 7738 "handful of projects."
dongsheng@627 7739 msgstr ""
dongsheng@627 7740
dongsheng@627 7741 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7742 #: ../en/ch06-collab.xml:132
songdongsheng@710 7743 msgid ""
songdongsheng@710 7744 "A sprint or a hacking session in a coffee shop are the perfect places to use "
songdongsheng@710 7745 "the <command role=\"hg-cmd\">hg serve</command> command, since <command role="
songdongsheng@710 7746 "\"hg-cmd\">hg serve</command> does not require any fancy server "
songdongsheng@710 7747 "infrastructure. You can get started with <command role=\"hg-cmd\">hg serve</"
songdongsheng@710 7748 "command> in moments, by reading <xref linkend=\"sec:collab:serve\"/> below. "
songdongsheng@710 7749 "Then simply tell the person next to you that you're running a server, send "
songdongsheng@710 7750 "the URL to them in an instant message, and you immediately have a quick-"
songdongsheng@710 7751 "turnaround way to work together. They can type your URL into their web "
songdongsheng@710 7752 "browser and quickly review your changes; or they can pull a bugfix from you "
songdongsheng@710 7753 "and verify it; or they can clone a branch containing a new feature and try it "
songdongsheng@710 7754 "out."
songdongsheng@710 7755 msgstr ""
songdongsheng@710 7756
songdongsheng@710 7757 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7758 #: ../en/ch06-collab.xml:146
dongsheng@627 7759 msgid ""
dongsheng@627 7760 "The charm, and the problem, with doing things in an ad hoc fashion like this "
dongsheng@627 7761 "is that only people who know about your changes, and where they are, can see "
dongsheng@627 7762 "them. Such an informal approach simply doesn't scale beyond a handful "
songdongsheng@710 7763 "people, because each individual needs to know about <emphasis>n</emphasis> "
songdongsheng@710 7764 "different repositories to pull from."
songdongsheng@710 7765 msgstr ""
songdongsheng@710 7766
songdongsheng@710 7767 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 7768 #: ../en/ch06-collab.xml:156
dongsheng@627 7769 msgid "A single central repository"
dongsheng@630 7770 msgstr "单一中央版本库"
dongsheng@627 7771
dongsheng@627 7772 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7773 #: ../en/ch06-collab.xml:158
dongsheng@627 7774 msgid ""
dongsheng@627 7775 "For smaller projects migrating from a centralised revision control tool, "
dongsheng@627 7776 "perhaps the easiest way to get started is to have changes flow through a "
dongsheng@627 7777 "single shared central repository. This is also the most common "
dongsheng@627 7778 "<quote>building block</quote> for more ambitious workflow schemes."
dongsheng@627 7779 msgstr ""
dongsheng@627 7780
dongsheng@627 7781 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7782 #: ../en/ch06-collab.xml:164
dongsheng@627 7783 msgid ""
dongsheng@627 7784 "Contributors start by cloning a copy of this repository. They can pull "
dongsheng@627 7785 "changes from it whenever they need to, and some (perhaps all) developers have "
dongsheng@627 7786 "permission to push a change back when they're ready for other people to see "
dongsheng@627 7787 "it."
dongsheng@627 7788 msgstr ""
dongsheng@627 7789
dongsheng@627 7790 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7791 #: ../en/ch06-collab.xml:169
dongsheng@627 7792 msgid ""
dongsheng@627 7793 "Under this model, it can still often make sense for people to pull changes "
dongsheng@627 7794 "directly from each other, without going through the central repository. "
dongsheng@627 7795 "Consider a case in which I have a tentative bug fix, but I am worried that if "
dongsheng@627 7796 "I were to publish it to the central repository, it might subsequently break "
dongsheng@627 7797 "everyone else's trees as they pull it. To reduce the potential for damage, I "
dongsheng@627 7798 "can ask you to clone my repository into a temporary repository of your own "
dongsheng@627 7799 "and test it. This lets us put off publishing the potentially unsafe change "
dongsheng@627 7800 "until it has had a little testing."
dongsheng@627 7801 msgstr ""
dongsheng@627 7802
dongsheng@627 7803 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7804 #: ../en/ch06-collab.xml:180
songdongsheng@710 7805 msgid ""
songdongsheng@710 7806 "If a team is hosting its own repository in this kind of scenario, people will "
songdongsheng@710 7807 "usually use the <command>ssh</command> protocol to securely push changes to "
songdongsheng@710 7808 "the central repository, as documented in <xref linkend=\"sec:collab:ssh\"/>. "
songdongsheng@710 7809 "It's also usual to publish a read-only copy of the repository over HTTP, as "
songdongsheng@710 7810 "in <xref linkend=\"sec:collab:cgi\"/>. Publishing over HTTP satisfies the "
songdongsheng@710 7811 "needs of people who don't have push access, and those who want to use web "
songdongsheng@710 7812 "browsers to browse the repository's history."
songdongsheng@710 7813 msgstr ""
songdongsheng@710 7814
songdongsheng@710 7815 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 7816 #: ../en/ch06-collab.xml:193
songdongsheng@710 7817 msgid "A hosted central repository"
songdongsheng@711 7818 msgstr "托管的中央版本库"
songdongsheng@710 7819
songdongsheng@710 7820 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7821 #: ../en/ch06-collab.xml:195
songdongsheng@710 7822 msgid ""
songdongsheng@710 7823 "A wonderful thing about public hosting services like <ulink url=\"http://"
songdongsheng@710 7824 "bitbucket.org/\">Bitbucket</ulink> is that not only do they handle the fiddly "
songdongsheng@710 7825 "server configuration details, such as user accounts, authentication, and "
songdongsheng@710 7826 "secure wire protocols, they provide additional infrastructure to make this "
songdongsheng@710 7827 "model work well."
songdongsheng@710 7828 msgstr ""
songdongsheng@710 7829
songdongsheng@710 7830 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7831 #: ../en/ch06-collab.xml:202
songdongsheng@710 7832 msgid ""
songdongsheng@710 7833 "For instance, a well-engineered hosting service will let people clone their "
songdongsheng@710 7834 "own copies of a repository with a single click. This lets people work in "
songdongsheng@710 7835 "separate spaces and share their changes when they're ready."
songdongsheng@710 7836 msgstr ""
songdongsheng@710 7837
songdongsheng@710 7838 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7839 #: ../en/ch06-collab.xml:207
songdongsheng@710 7840 msgid ""
songdongsheng@710 7841 "In addition, a good hosting service will let people communicate with each "
songdongsheng@710 7842 "other, for instance to say <quote>there are changes ready for you to review "
songdongsheng@710 7843 "in this tree</quote>."
songdongsheng@710 7844 msgstr ""
songdongsheng@710 7845
songdongsheng@710 7846 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 7847 #: ../en/ch06-collab.xml:214
dongsheng@627 7848 msgid "Working with multiple branches"
dongsheng@630 7849 msgstr "使用多个分支工作"
dongsheng@627 7850
dongsheng@627 7851 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7852 #: ../en/ch06-collab.xml:216
dongsheng@627 7853 msgid ""
dongsheng@627 7854 "Projects of any significant size naturally tend to make progress on several "
dongsheng@627 7855 "fronts simultaneously. In the case of software, it's common for a project to "
dongsheng@627 7856 "go through periodic official releases. A release might then go into "
dongsheng@627 7857 "<quote>maintenance mode</quote> for a while after its first publication; "
dongsheng@627 7858 "maintenance releases tend to contain only bug fixes, not new features. In "
dongsheng@627 7859 "parallel with these maintenance releases, one or more future releases may be "
dongsheng@627 7860 "under development. People normally use the word <quote>branch</quote> to "
dongsheng@627 7861 "refer to one of these many slightly different directions in which development "
dongsheng@627 7862 "is proceeding."
dongsheng@627 7863 msgstr ""
dongsheng@627 7864
dongsheng@627 7865 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7866 #: ../en/ch06-collab.xml:229
dongsheng@627 7867 msgid ""
dongsheng@627 7868 "Mercurial is particularly well suited to managing a number of simultaneous, "
dongsheng@627 7869 "but not identical, branches. Each <quote>development direction</quote> can "
dongsheng@627 7870 "live in its own central repository, and you can merge changes from one to "
dongsheng@627 7871 "another as the need arises. Because repositories are independent of each "
dongsheng@627 7872 "other, unstable changes in a development branch will never affect a stable "
songdongsheng@710 7873 "branch unless someone explicitly merges those changes into the stable branch."
songdongsheng@710 7874 msgstr ""
songdongsheng@710 7875
songdongsheng@710 7876 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7877 #: ../en/ch06-collab.xml:238
dongsheng@627 7878 msgid ""
dongsheng@627 7879 "Here's an example of how this can work in practice. Let's say you have one "
dongsheng@627 7880 "<quote>main branch</quote> on a central server."
dongsheng@627 7881 msgstr ""
dongsheng@627 7882
dongsheng@627 7883 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7884 #: ../en/ch06-collab.xml:244
dongsheng@627 7885 msgid "People clone it, make changes locally, test them, and push them back."
dongsheng@627 7886 msgstr ""
dongsheng@627 7887
dongsheng@627 7888 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7889 #: ../en/ch06-collab.xml:247
dongsheng@627 7890 msgid ""
dongsheng@627 7891 "Once the main branch reaches a release milestone, you can use the <command "
dongsheng@627 7892 "role=\"hg-cmd\">hg tag</command> command to give a permanent name to the "
dongsheng@627 7893 "milestone revision."
dongsheng@627 7894 msgstr ""
dongsheng@627 7895
dongsheng@627 7896 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7897 #: ../en/ch06-collab.xml:253
dongsheng@627 7898 msgid "Let's say some ongoing development occurs on the main branch."
dongsheng@627 7899 msgstr ""
dongsheng@627 7900
dongsheng@627 7901 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7902 #: ../en/ch06-collab.xml:258
dongsheng@627 7903 msgid ""
dongsheng@627 7904 "Using the tag that was recorded at the milestone, people who clone that "
dongsheng@627 7905 "repository at any time in the future can use <command role=\"hg-cmd\">hg "
dongsheng@627 7906 "update</command> to get a copy of the working directory exactly as it was "
dongsheng@627 7907 "when that tagged revision was committed."
dongsheng@627 7908 msgstr ""
dongsheng@627 7909
songdongsheng@710 7910 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7911 #: ../en/ch06-collab.xml:266
songdongsheng@710 7912 msgid ""
songdongsheng@710 7913 "In addition, immediately after the main branch is tagged, we can then clone "
songdongsheng@710 7914 "the main branch on the server to a new <quote>stable</quote> branch, also on "
songdongsheng@710 7915 "the server."
songdongsheng@710 7916 msgstr ""
songdongsheng@710 7917
songdongsheng@710 7918 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7919 #: ../en/ch06-collab.xml:272
songdongsheng@710 7920 msgid ""
songdongsheng@710 7921 "If we need to make a change to the stable branch, we can then clone "
songdongsheng@710 7922 "<emphasis>that</emphasis> repository, make our changes, commit, and push our "
songdongsheng@710 7923 "changes back there."
songdongsheng@710 7924 msgstr ""
songdongsheng@710 7925
songdongsheng@710 7926 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7927 #: ../en/ch06-collab.xml:279
dongsheng@627 7928 msgid ""
dongsheng@627 7929 "Because Mercurial repositories are independent, and Mercurial doesn't move "
dongsheng@627 7930 "changes around automatically, the stable and main branches are "
songdongsheng@710 7931 "<emphasis>isolated</emphasis> from each other. The changes that we made on "
dongsheng@627 7932 "the main branch don't <quote>leak</quote> to the stable branch, and vice "
dongsheng@627 7933 "versa."
dongsheng@627 7934 msgstr ""
dongsheng@627 7935
dongsheng@627 7936 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7937 #: ../en/ch06-collab.xml:286
songdongsheng@710 7938 msgid ""
songdongsheng@710 7939 "We'll often want all of our bugfixes on the stable branch to show up on the "
songdongsheng@710 7940 "main branch, too. Rather than rewrite a bugfix on the main branch, we can "
dongsheng@627 7941 "simply pull and merge changes from the stable to the main branch, and "
songdongsheng@710 7942 "Mercurial will bring those bugfixes in for us."
songdongsheng@710 7943 msgstr ""
songdongsheng@710 7944
songdongsheng@710 7945 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7946 #: ../en/ch06-collab.xml:294
dongsheng@627 7947 msgid ""
dongsheng@627 7948 "The main branch will still contain changes that are not on the stable branch, "
dongsheng@627 7949 "but it will also contain all of the bugfixes from the stable branch. The "
songdongsheng@710 7950 "stable branch remains unaffected by these changes, since changes are only "
songdongsheng@710 7951 "flowing from the stable to the main branch, and not the other way."
dongsheng@627 7952 msgstr ""
dongsheng@627 7953
songdongsheng@658 7954 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
dongsheng@714 7955 #: ../en/ch06-collab.xml:303 ../en/ch06-collab.xml:313
dongsheng@627 7956 msgid "Feature branches"
dongsheng@630 7957 msgstr "特性分支"
dongsheng@627 7958
dongsheng@627 7959 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7960 #: ../en/ch06-collab.xml:305
dongsheng@627 7961 msgid ""
dongsheng@627 7962 "For larger projects, an effective way to manage change is to break up a team "
dongsheng@627 7963 "into smaller groups. Each group has a shared branch of its own, cloned from "
dongsheng@627 7964 "a single <quote>master</quote> branch used by the entire project. People "
dongsheng@627 7965 "working on an individual branch are typically quite isolated from "
dongsheng@627 7966 "developments on other branches."
dongsheng@627 7967 msgstr ""
dongsheng@627 7968
songdongsheng@658 7969 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
dongsheng@714 7970 #: ../en/ch06-collab.xml:315
dongsheng@641 7971 msgid ""
songdongsheng@658 7972 "<imageobject><imagedata width=\"100%\" fileref=\"figs/feature-branches.png\"/"
songdongsheng@658 7973 "></imageobject>"
songdongsheng@658 7974 msgstr ""
songdongsheng@658 7975
songdongsheng@658 7976 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7977 #: ../en/ch06-collab.xml:320
dongsheng@627 7978 msgid ""
dongsheng@627 7979 "When a particular feature is deemed to be in suitable shape, someone on that "
dongsheng@627 7980 "feature team pulls and merges from the master branch into the feature branch, "
dongsheng@627 7981 "then pushes back up to the master branch."
dongsheng@627 7982 msgstr ""
dongsheng@627 7983
dongsheng@627 7984 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 7985 #: ../en/ch06-collab.xml:327
dongsheng@627 7986 msgid "The release train"
dongsheng@630 7987 msgstr "发布列车"
dongsheng@627 7988
dongsheng@627 7989 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7990 #: ../en/ch06-collab.xml:329
songdongsheng@710 7991 msgid ""
songdongsheng@710 7992 "Some projects are organized on a <quote>train</quote> basis: a release is "
dongsheng@627 7993 "scheduled to happen every few months, and whatever features are ready when "
dongsheng@627 7994 "the <quote>train</quote> is ready to leave are allowed in."
dongsheng@627 7995 msgstr ""
dongsheng@627 7996
dongsheng@627 7997 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 7998 #: ../en/ch06-collab.xml:334
dongsheng@627 7999 msgid ""
dongsheng@627 8000 "This model resembles working with feature branches. The difference is that "
dongsheng@627 8001 "when a feature branch misses a train, someone on the feature team pulls and "
dongsheng@627 8002 "merges the changes that went out on that train release into the feature "
dongsheng@627 8003 "branch, and the team continues its work on top of that release so that their "
dongsheng@627 8004 "feature can make the next release."
dongsheng@627 8005 msgstr ""
dongsheng@627 8006
dongsheng@627 8007 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 8008 #: ../en/ch06-collab.xml:343
dongsheng@627 8009 msgid "The Linux kernel model"
dongsheng@630 8010 msgstr "Linux 内核模型"
dongsheng@627 8011
dongsheng@627 8012 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8013 #: ../en/ch06-collab.xml:345
dongsheng@627 8014 msgid ""
dongsheng@627 8015 "The development of the Linux kernel has a shallow hierarchical structure, "
dongsheng@627 8016 "surrounded by a cloud of apparent chaos. Because most Linux developers use "
dongsheng@627 8017 "<command>git</command>, a distributed revision control tool with capabilities "
dongsheng@627 8018 "similar to Mercurial, it's useful to describe the way work flows in that "
dongsheng@627 8019 "environment; if you like the ideas, the approach translates well across tools."
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:353
dongsheng@627 8024 msgid ""
dongsheng@627 8025 "At the center of the community sits Linus Torvalds, the creator of Linux. He "
dongsheng@627 8026 "publishes a single source repository that is considered the "
dongsheng@627 8027 "<quote>authoritative</quote> current tree by the entire developer community. "
dongsheng@627 8028 "Anyone can clone Linus's tree, but he is very choosy about whose trees he "
dongsheng@627 8029 "pulls from."
dongsheng@627 8030 msgstr ""
dongsheng@627 8031
dongsheng@627 8032 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8033 #: ../en/ch06-collab.xml:360
dongsheng@627 8034 msgid ""
dongsheng@627 8035 "Linus has a number of <quote>trusted lieutenants</quote>. As a general rule, "
dongsheng@627 8036 "he pulls whatever changes they publish, in most cases without even reviewing "
dongsheng@627 8037 "those changes. Some of those lieutenants are generally agreed to be "
dongsheng@627 8038 "<quote>maintainers</quote>, responsible for specific subsystems within the "
dongsheng@627 8039 "kernel. If a random kernel hacker wants to make a change to a subsystem that "
dongsheng@627 8040 "they want to end up in Linus's tree, they must find out who the subsystem's "
dongsheng@627 8041 "maintainer is, and ask that maintainer to take their change. If the "
dongsheng@627 8042 "maintainer reviews their changes and agrees to take them, they'll pass them "
dongsheng@627 8043 "along to Linus in due course."
dongsheng@627 8044 msgstr ""
dongsheng@627 8045
dongsheng@627 8046 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8047 #: ../en/ch06-collab.xml:372
dongsheng@627 8048 msgid ""
dongsheng@627 8049 "Individual lieutenants have their own approaches to reviewing, accepting, and "
dongsheng@627 8050 "publishing changes; and for deciding when to feed them to Linus. In "
dongsheng@627 8051 "addition, there are several well known branches that people use for different "
dongsheng@627 8052 "purposes. For example, a few people maintain <quote>stable</quote> "
dongsheng@627 8053 "repositories of older versions of the kernel, to which they apply critical "
dongsheng@627 8054 "fixes as needed. Some maintainers publish multiple trees: one for "
dongsheng@627 8055 "experimental changes; one for changes that they are about to feed upstream; "
dongsheng@627 8056 "and so on. Others just publish a single tree."
dongsheng@627 8057 msgstr ""
dongsheng@627 8058
dongsheng@627 8059 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8060 #: ../en/ch06-collab.xml:383
dongsheng@627 8061 msgid ""
dongsheng@627 8062 "This model has two notable features. The first is that it's <quote>pull "
dongsheng@627 8063 "only</quote>. You have to ask, convince, or beg another developer to take a "
dongsheng@627 8064 "change from you, because there are almost no trees to which more than one "
dongsheng@627 8065 "person can push, and there's no way to push changes into a tree that someone "
dongsheng@627 8066 "else controls."
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:390
dongsheng@627 8071 msgid ""
dongsheng@627 8072 "The second is that it's based on reputation and acclaim. If you're an "
dongsheng@627 8073 "unknown, Linus will probably ignore changes from you without even "
dongsheng@627 8074 "responding. But a subsystem maintainer will probably review them, and will "
dongsheng@627 8075 "likely take them if they pass their criteria for suitability. The more "
dongsheng@627 8076 "<quote>good</quote> changes you contribute to a maintainer, the more likely "
dongsheng@627 8077 "they are to trust your judgment and accept your changes. If you're well-"
dongsheng@627 8078 "known and maintain a long-lived branch for something Linus hasn't yet "
dongsheng@627 8079 "accepted, people with similar interests may pull your changes regularly to "
dongsheng@627 8080 "keep up with your work."
dongsheng@627 8081 msgstr ""
dongsheng@627 8082
dongsheng@627 8083 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8084 #: ../en/ch06-collab.xml:401
dongsheng@627 8085 msgid ""
dongsheng@627 8086 "Reputation and acclaim don't necessarily cross subsystem or <quote>people</"
dongsheng@627 8087 "quote> boundaries. If you're a respected but specialised storage hacker, and "
dongsheng@627 8088 "you try to fix a networking bug, that change will receive a level of scrutiny "
dongsheng@627 8089 "from a network maintainer comparable to a change from a complete stranger."
dongsheng@627 8090 msgstr ""
dongsheng@627 8091
dongsheng@627 8092 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8093 #: ../en/ch06-collab.xml:408
dongsheng@627 8094 msgid ""
dongsheng@627 8095 "To people who come from more orderly project backgrounds, the comparatively "
dongsheng@627 8096 "chaotic Linux kernel development process often seems completely insane. It's "
dongsheng@627 8097 "subject to the whims of individuals; people make sweeping changes whenever "
dongsheng@627 8098 "they deem it appropriate; and the pace of development is astounding. And yet "
dongsheng@627 8099 "Linux is a highly successful, well-regarded piece of software."
dongsheng@627 8100 msgstr ""
dongsheng@627 8101
dongsheng@627 8102 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 8103 #: ../en/ch06-collab.xml:418
dongsheng@627 8104 msgid "Pull-only versus shared-push collaboration"
dongsheng@630 8105 msgstr "只读与共享写协作"
dongsheng@627 8106
dongsheng@627 8107 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8108 #: ../en/ch06-collab.xml:420
dongsheng@627 8109 msgid ""
dongsheng@627 8110 "A perpetual source of heat in the open source community is whether a "
dongsheng@627 8111 "development model in which people only ever pull changes from others is "
dongsheng@627 8112 "<quote>better than</quote> one in which multiple people can push changes to a "
dongsheng@627 8113 "shared repository."
dongsheng@627 8114 msgstr ""
dongsheng@627 8115
dongsheng@627 8116 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8117 #: ../en/ch06-collab.xml:426
dongsheng@627 8118 msgid ""
dongsheng@627 8119 "Typically, the backers of the shared-push model use tools that actively "
dongsheng@627 8120 "enforce this approach. If you're using a centralised revision control tool "
dongsheng@627 8121 "such as Subversion, there's no way to make a choice over which model you'll "
dongsheng@627 8122 "use: the tool gives you shared-push, and if you want to do anything else, "
dongsheng@627 8123 "you'll have to roll your own approach on top (such as applying a patch by "
dongsheng@627 8124 "hand)."
dongsheng@627 8125 msgstr ""
dongsheng@627 8126
dongsheng@627 8127 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8128 #: ../en/ch06-collab.xml:434
songdongsheng@710 8129 msgid ""
songdongsheng@710 8130 "A good distributed revision control tool will support both models. You and "
songdongsheng@710 8131 "your collaborators can then structure how you work together based on your own "
songdongsheng@710 8132 "needs and preferences, not on what contortions your tools force you into."
songdongsheng@710 8133 msgstr ""
songdongsheng@710 8134
songdongsheng@710 8135 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 8136 #: ../en/ch06-collab.xml:441
dongsheng@627 8137 msgid "Where collaboration meets branch management"
dongsheng@630 8138 msgstr "协作与分支管理"
dongsheng@627 8139
dongsheng@627 8140 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8141 #: ../en/ch06-collab.xml:443
dongsheng@627 8142 msgid ""
dongsheng@627 8143 "Once you and your team set up some shared repositories and start propagating "
dongsheng@627 8144 "changes back and forth between local and shared repos, you begin to face a "
dongsheng@627 8145 "related, but slightly different challenge: that of managing the multiple "
dongsheng@627 8146 "directions in which your team may be moving at once. Even though this "
dongsheng@627 8147 "subject is intimately related to how your team collaborates, it's dense "
songdongsheng@658 8148 "enough to merit treatment of its own, in <xref linkend=\"chap:branch\"/>."
dongsheng@627 8149 msgstr ""
dongsheng@627 8150
dongsheng@627 8151 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 8152 #: ../en/ch06-collab.xml:455
dongsheng@627 8153 msgid "The technical side of sharing"
dongsheng@630 8154 msgstr "共享的技术因素"
dongsheng@627 8155
dongsheng@627 8156 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 8157 #: ../en/ch06-collab.xml:457
songdongsheng@710 8158 msgid ""
songdongsheng@710 8159 "The remainder of this chapter is devoted to the question of sharing changes "
songdongsheng@710 8160 "with your collaborators."
dongsheng@627 8161 msgstr ""
dongsheng@627 8162
dongsheng@627 8163 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 8164 #: ../en/ch06-collab.xml:462
dongsheng@627 8165 msgid "Informal sharing with <command role=\"hg-cmd\">hg serve</command>"
dongsheng@630 8166 msgstr "使用 <command role=\"hg-cmd\">hg serve</command> 进行非正式共享"
dongsheng@627 8167
dongsheng@627 8168 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 8169 #: ../en/ch06-collab.xml:465
dongsheng@627 8170 msgid ""
dongsheng@627 8171 "Mercurial's <command role=\"hg-cmd\">hg serve</command> command is "
dongsheng@627 8172 "wonderfully suited to small, tight-knit, and fast-paced group environments. "
dongsheng@627 8173 "It also provides a great way to get a feel for using Mercurial commands over "
dongsheng@627 8174 "a network."
dongsheng@627 8175 msgstr ""
dongsheng@627 8176
dongsheng@627 8177 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 8178 #: ../en/ch06-collab.xml:470
dongsheng@627 8179 msgid ""
dongsheng@627 8180 "Run <command role=\"hg-cmd\">hg serve</command> inside a repository, and in "
dongsheng@627 8181 "under a second it will bring up a specialised HTTP server; this will accept "
dongsheng@627 8182 "connections from any client, and serve up data for that repository until you "
dongsheng@627 8183 "terminate it. Anyone who knows the URL of the server you just started, and "
dongsheng@627 8184 "can talk to your computer over the network, can then use a web browser or "
dongsheng@627 8185 "Mercurial to read data from that repository. A URL for a <command role=\"hg-"
dongsheng@627 8186 "cmd\">hg serve</command> instance running on a laptop is likely to look "
dongsheng@627 8187 "something like <literal>http://my-laptop.local:8000/</literal>."
dongsheng@627 8188 msgstr ""
dongsheng@627 8189
dongsheng@627 8190 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 8191 #: ../en/ch06-collab.xml:481
dongsheng@627 8192 msgid ""
dongsheng@627 8193 "The <command role=\"hg-cmd\">hg serve</command> command is <emphasis>not</"
dongsheng@627 8194 "emphasis> a general-purpose web server. It can do only two things:"
dongsheng@627 8195 msgstr ""
dongsheng@627 8196
dongsheng@627 8197 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 8198 #: ../en/ch06-collab.xml:485
dongsheng@627 8199 msgid ""
dongsheng@627 8200 "Allow people to browse the history of the repository it's serving, from their "
dongsheng@627 8201 "normal web browsers."
dongsheng@627 8202 msgstr ""
dongsheng@627 8203
dongsheng@627 8204 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 8205 #: ../en/ch06-collab.xml:489
dongsheng@627 8206 msgid ""
dongsheng@627 8207 "Speak Mercurial's wire protocol, so that people can <command role=\"hg-cmd"
dongsheng@627 8208 "\">hg clone</command> or <command role=\"hg-cmd\">hg pull</command> changes "
dongsheng@627 8209 "from that repository."
dongsheng@627 8210 msgstr ""
dongsheng@627 8211
dongsheng@627 8212 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 8213 #: ../en/ch06-collab.xml:494
dongsheng@627 8214 msgid ""
dongsheng@627 8215 "In particular, <command role=\"hg-cmd\">hg serve</command> won't allow remote "
dongsheng@627 8216 "users to <emphasis>modify</emphasis> your repository. It's intended for read-"
dongsheng@627 8217 "only use."
dongsheng@627 8218 msgstr ""
dongsheng@627 8219
dongsheng@627 8220 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 8221 #: ../en/ch06-collab.xml:498
dongsheng@627 8222 msgid ""
dongsheng@627 8223 "If you're getting started with Mercurial, there's nothing to prevent you from "
dongsheng@627 8224 "using <command role=\"hg-cmd\">hg serve</command> to serve up a repository on "
dongsheng@627 8225 "your own computer, then use commands like <command role=\"hg-cmd\">hg clone</"
dongsheng@627 8226 "command>, <command role=\"hg-cmd\">hg incoming</command>, and so on to talk "
dongsheng@627 8227 "to that server as if the repository was hosted remotely. This can help you to "
dongsheng@627 8228 "quickly get acquainted with using commands on network-hosted repositories."
dongsheng@627 8229 msgstr ""
dongsheng@627 8230
dongsheng@627 8231 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 8232 #: ../en/ch06-collab.xml:508
dongsheng@627 8233 msgid "A few things to keep in mind"
dongsheng@630 8234 msgstr "要牢记的几件事"
dongsheng@627 8235
dongsheng@627 8236 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8237 #: ../en/ch06-collab.xml:510
dongsheng@627 8238 msgid ""
dongsheng@627 8239 "Because it provides unauthenticated read access to all clients, you should "
dongsheng@627 8240 "only use <command role=\"hg-cmd\">hg serve</command> in an environment where "
dongsheng@627 8241 "you either don't care, or have complete control over, who can access your "
dongsheng@627 8242 "network and pull data from your repository."
dongsheng@627 8243 msgstr ""
dongsheng@627 8244
dongsheng@627 8245 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8246 #: ../en/ch06-collab.xml:516
dongsheng@627 8247 msgid ""
dongsheng@627 8248 "The <command role=\"hg-cmd\">hg serve</command> command knows nothing about "
dongsheng@627 8249 "any firewall software you might have installed on your system or network. It "
dongsheng@627 8250 "cannot detect or control your firewall software. If other people are unable "
dongsheng@627 8251 "to talk to a running <command role=\"hg-cmd\">hg serve</command> instance, "
dongsheng@627 8252 "the second thing you should do (<emphasis>after</emphasis> you make sure that "
dongsheng@627 8253 "they're using the correct URL) is check your firewall configuration."
dongsheng@627 8254 msgstr ""
dongsheng@627 8255
dongsheng@627 8256 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8257 #: ../en/ch06-collab.xml:525
dongsheng@627 8258 msgid ""
dongsheng@627 8259 "By default, <command role=\"hg-cmd\">hg serve</command> listens for incoming "
dongsheng@627 8260 "connections on port 8000. If another process is already listening on the "
dongsheng@627 8261 "port you want to use, you can specify a different port to listen on using the "
dongsheng@627 8262 "<option role=\"hg-opt-serve\">-p</option> option."
dongsheng@627 8263 msgstr ""
dongsheng@627 8264
dongsheng@627 8265 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8266 #: ../en/ch06-collab.xml:531
dongsheng@627 8267 msgid ""
dongsheng@627 8268 "Normally, when <command role=\"hg-cmd\">hg serve</command> starts, it prints "
dongsheng@627 8269 "no output, which can be a bit unnerving. If you'd like to confirm that it is "
dongsheng@627 8270 "indeed running correctly, and find out what URL you should send to your "
dongsheng@627 8271 "collaborators, start it with the <option role=\"hg-opt-global\">-v</option> "
dongsheng@627 8272 "option."
dongsheng@627 8273 msgstr ""
dongsheng@627 8274
dongsheng@627 8275 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 8276 #: ../en/ch06-collab.xml:541
dongsheng@627 8277 msgid "Using the Secure Shell (ssh) protocol"
dongsheng@630 8278 msgstr "使用 ssh 协议"
dongsheng@627 8279
dongsheng@627 8280 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 8281 #: ../en/ch06-collab.xml:543
dongsheng@627 8282 msgid ""
dongsheng@627 8283 "You can pull and push changes securely over a network connection using the "
dongsheng@627 8284 "Secure Shell (<literal>ssh</literal>) protocol. To use this successfully, "
dongsheng@627 8285 "you may have to do a little bit of configuration on the client or server "
dongsheng@627 8286 "sides."
dongsheng@627 8287 msgstr ""
dongsheng@627 8288
dongsheng@627 8289 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 8290 #: ../en/ch06-collab.xml:548
songdongsheng@710 8291 msgid ""
songdongsheng@710 8292 "If you're not familiar with ssh, it's the name of both a command and a "
songdongsheng@710 8293 "network protocol that let you securely communicate with another computer. To "
songdongsheng@710 8294 "use it with Mercurial, you'll be setting up one or more user accounts on a "
songdongsheng@710 8295 "server so that remote users can log in and execute commands."
songdongsheng@710 8296 msgstr ""
songdongsheng@710 8297
songdongsheng@710 8298 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 8299 #: ../en/ch06-collab.xml:554
dongsheng@627 8300 msgid ""
dongsheng@627 8301 "(If you <emphasis>are</emphasis> familiar with ssh, you'll probably find some "
dongsheng@627 8302 "of the material that follows to be elementary in nature.)"
dongsheng@627 8303 msgstr ""
dongsheng@627 8304
dongsheng@627 8305 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 8306 #: ../en/ch06-collab.xml:559
dongsheng@627 8307 msgid "How to read and write ssh URLs"
dongsheng@630 8308 msgstr "如何读写 ssh 路径"
dongsheng@627 8309
dongsheng@627 8310 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8311 #: ../en/ch06-collab.xml:561
songdongsheng@658 8312 msgid "An ssh URL tends to look like this:"
songdongsheng@658 8313 msgstr ""
songdongsheng@658 8314
songdongsheng@658 8315 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 8316 #: ../en/ch06-collab.xml:564
songdongsheng@658 8317 msgid ""
songdongsheng@658 8318 "The <quote><literal>ssh://</literal></quote> part tells Mercurial to use the "
songdongsheng@658 8319 "ssh protocol."
dongsheng@627 8320 msgstr ""
dongsheng@627 8321
dongsheng@627 8322 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 8323 #: ../en/ch06-collab.xml:567
dongsheng@627 8324 msgid ""
dongsheng@627 8325 "The <quote><literal>bos@</literal></quote> component indicates what username "
dongsheng@627 8326 "to log into the server as. You can leave this out if the remote username is "
dongsheng@627 8327 "the same as your local username."
dongsheng@627 8328 msgstr ""
dongsheng@627 8329
dongsheng@627 8330 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 8331 #: ../en/ch06-collab.xml:572
dongsheng@627 8332 msgid ""
dongsheng@627 8333 "The <quote><literal>hg.serpentine.com</literal></quote> gives the hostname of "
dongsheng@627 8334 "the server to log into."
dongsheng@627 8335 msgstr ""
dongsheng@627 8336
dongsheng@627 8337 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 8338 #: ../en/ch06-collab.xml:576
dongsheng@627 8339 msgid ""
dongsheng@627 8340 "The <quote>:22</quote> identifies the port number to connect to the server "
dongsheng@650 8341 "on. The default port is 22, so you only need to specify a colon and port "
dongsheng@650 8342 "number if you're <emphasis>not</emphasis> using port 22."
dongsheng@627 8343 msgstr ""
dongsheng@627 8344
dongsheng@627 8345 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 8346 #: ../en/ch06-collab.xml:581
dongsheng@627 8347 msgid ""
dongsheng@627 8348 "The remainder of the URL is the local path to the repository on the server."
dongsheng@627 8349 msgstr ""
dongsheng@627 8350
dongsheng@627 8351 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8352 #: ../en/ch06-collab.xml:585
dongsheng@627 8353 msgid ""
dongsheng@627 8354 "There's plenty of scope for confusion with the path component of ssh URLs, as "
dongsheng@627 8355 "there is no standard way for tools to interpret it. Some programs behave "
dongsheng@627 8356 "differently than others when dealing with these paths. This isn't an ideal "
dongsheng@627 8357 "situation, but it's unlikely to change. Please read the following paragraphs "
dongsheng@627 8358 "carefully."
dongsheng@627 8359 msgstr ""
dongsheng@627 8360
dongsheng@627 8361 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8362 #: ../en/ch06-collab.xml:592
dongsheng@627 8363 msgid ""
dongsheng@627 8364 "Mercurial treats the path to a repository on the server as relative to the "
dongsheng@627 8365 "remote user's home directory. For example, if user <literal>foo</literal> on "
dongsheng@627 8366 "the server has a home directory of <filename class=\"directory\">/home/foo</"
dongsheng@627 8367 "filename>, then an ssh URL that contains a path component of <filename class="
dongsheng@627 8368 "\"directory\">bar</filename> <emphasis>really</emphasis> refers to the "
dongsheng@627 8369 "directory <filename class=\"directory\">/home/foo/bar</filename>."
dongsheng@627 8370 msgstr ""
dongsheng@627 8371
dongsheng@627 8372 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8373 #: ../en/ch06-collab.xml:601
dongsheng@627 8374 msgid ""
dongsheng@627 8375 "If you want to specify a path relative to another user's home directory, you "
dongsheng@627 8376 "can use a path that starts with a tilde character followed by the user's name "
dongsheng@627 8377 "(let's call them <literal>otheruser</literal>), like this."
dongsheng@627 8378 msgstr ""
dongsheng@627 8379
dongsheng@627 8380 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8381 #: ../en/ch06-collab.xml:607
dongsheng@627 8382 msgid ""
dongsheng@627 8383 "And if you really want to specify an <emphasis>absolute</emphasis> path on "
dongsheng@627 8384 "the server, begin the path component with two slashes, as in this example."
dongsheng@627 8385 msgstr ""
dongsheng@627 8386
dongsheng@627 8387 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 8388 #: ../en/ch06-collab.xml:614
dongsheng@627 8389 msgid "Finding an ssh client for your system"
dongsheng@630 8390 msgstr "为你的系统寻找 ssh 客户端"
dongsheng@627 8391
dongsheng@627 8392 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8393 #: ../en/ch06-collab.xml:616
dongsheng@627 8394 msgid ""
dongsheng@627 8395 "Almost every Unix-like system comes with OpenSSH preinstalled. If you're "
dongsheng@627 8396 "using such a system, run <literal>which ssh</literal> to find out if the "
dongsheng@627 8397 "<command>ssh</command> command is installed (it's usually in <filename class="
dongsheng@627 8398 "\"directory\">/usr/bin</filename>). In the unlikely event that it isn't "
dongsheng@627 8399 "present, take a look at your system documentation to figure out how to "
dongsheng@627 8400 "install it."
dongsheng@627 8401 msgstr ""
dongsheng@627 8402
dongsheng@627 8403 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8404 #: ../en/ch06-collab.xml:624
songdongsheng@710 8405 msgid ""
songdongsheng@710 8406 "On Windows, the TortoiseHg package is bundled with a version of Simon "
songdongsheng@710 8407 "Tatham's excellent <command>plink</command> command, and you should not need "
songdongsheng@710 8408 "to do any further configuration."
songdongsheng@710 8409 msgstr ""
songdongsheng@710 8410
songdongsheng@710 8411 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 8412 #: ../en/ch06-collab.xml:631
dongsheng@627 8413 msgid "Generating a key pair"
dongsheng@630 8414 msgstr "产生密钥对"
dongsheng@627 8415
dongsheng@627 8416 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8417 #: ../en/ch06-collab.xml:633
dongsheng@627 8418 msgid ""
dongsheng@627 8419 "To avoid the need to repetitively type a password every time you need to use "
songdongsheng@710 8420 "your ssh client, I recommend generating a key pair."
songdongsheng@710 8421 msgstr ""
songdongsheng@710 8422
songdongsheng@710 8423 #. type: Content of: <book><chapter><sect1><sect2><tip><title>
dongsheng@714 8424 #: ../en/ch06-collab.xml:638
songdongsheng@710 8425 msgid "Key pairs are not mandatory"
songdongsheng@710 8426 msgstr ""
songdongsheng@710 8427
songdongsheng@710 8428 #. type: Content of: <book><chapter><sect1><sect2><tip><para>
dongsheng@714 8429 #: ../en/ch06-collab.xml:640
songdongsheng@710 8430 msgid ""
songdongsheng@710 8431 "Mercurial knows nothing about ssh authentication or key pairs. You can, if "
songdongsheng@710 8432 "you like, safely ignore this section and the one that follows until you grow "
songdongsheng@710 8433 "tired of repeatedly typing ssh passwords."
songdongsheng@710 8434 msgstr ""
songdongsheng@710 8435
songdongsheng@710 8436 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 8437 #: ../en/ch06-collab.xml:648
songdongsheng@710 8438 msgid ""
songdongsheng@710 8439 "On a Unix-like system, the <command>ssh-keygen</command> command will do the "
songdongsheng@710 8440 "trick."
songdongsheng@710 8441 msgstr ""
songdongsheng@710 8442
songdongsheng@710 8443 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 8444 #: ../en/ch06-collab.xml:651
songdongsheng@710 8445 msgid ""
songdongsheng@710 8446 "On Windows, if you're using TortoiseHg, you may need to download a command "
songdongsheng@710 8447 "named <command>puttygen</command> from <ulink url=\"http://www.chiark."
songdongsheng@710 8448 "greenend.org.uk/~sgtatham/putty\">the PuTTY web site</ulink> to generate a "
songdongsheng@710 8449 "key pair. See <ulink url=\"http://the.earth.li/~sgtatham/putty/0.60/htmldoc/"
songdongsheng@710 8450 "Chapter8.html#pubkey-puttygen\">the <command>puttygen</command> "
songdongsheng@710 8451 "documentation</ulink> for details of how use the command."
songdongsheng@710 8452 msgstr ""
songdongsheng@710 8453
songdongsheng@710 8454 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8455 #: ../en/ch06-collab.xml:663
dongsheng@627 8456 msgid ""
dongsheng@627 8457 "When you generate a key pair, it's usually <emphasis>highly</emphasis> "
dongsheng@627 8458 "advisable to protect it with a passphrase. (The only time that you might not "
dongsheng@627 8459 "want to do this is when you're using the ssh protocol for automated tasks on "
dongsheng@627 8460 "a secure network.)"
dongsheng@627 8461 msgstr ""
dongsheng@627 8462
dongsheng@627 8463 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8464 #: ../en/ch06-collab.xml:669
dongsheng@627 8465 msgid ""
dongsheng@627 8466 "Simply generating a key pair isn't enough, however. You'll need to add the "
dongsheng@627 8467 "public key to the set of authorised keys for whatever user you're logging in "
dongsheng@627 8468 "remotely as. For servers using OpenSSH (the vast majority), this will mean "
dongsheng@627 8469 "adding the public key to a list in a file called <filename role=\"special"
dongsheng@627 8470 "\">authorized_keys</filename> in their <filename role=\"special\" class="
dongsheng@627 8471 "\"directory\">.ssh</filename> directory."
dongsheng@627 8472 msgstr ""
dongsheng@627 8473
dongsheng@627 8474 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8475 #: ../en/ch06-collab.xml:678
dongsheng@627 8476 msgid ""
dongsheng@627 8477 "On a Unix-like system, your public key will have a <filename>.pub</filename> "
dongsheng@627 8478 "extension. If you're using <command>puttygen</command> on Windows, you can "
dongsheng@627 8479 "save the public key to a file of your choosing, or paste it from the window "
dongsheng@627 8480 "it's displayed in straight into the <filename role=\"special"
dongsheng@627 8481 "\">authorized_keys</filename> file."
dongsheng@627 8482 msgstr ""
dongsheng@627 8483
dongsheng@627 8484 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 8485 #: ../en/ch06-collab.xml:686
dongsheng@627 8486 msgid "Using an authentication agent"
dongsheng@630 8487 msgstr "使用认证代理"
dongsheng@627 8488
dongsheng@627 8489 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8490 #: ../en/ch06-collab.xml:688
dongsheng@627 8491 msgid ""
dongsheng@627 8492 "An authentication agent is a daemon that stores passphrases in memory (so it "
dongsheng@627 8493 "will forget passphrases if you log out and log back in again). An ssh client "
dongsheng@627 8494 "will notice if it's running, and query it for a passphrase. If there's no "
dongsheng@627 8495 "authentication agent running, or the agent doesn't store the necessary "
dongsheng@627 8496 "passphrase, you'll have to type your passphrase every time Mercurial tries to "
dongsheng@627 8497 "communicate with a server on your behalf (e.g. whenever you pull or push "
dongsheng@627 8498 "changes)."
dongsheng@627 8499 msgstr ""
dongsheng@627 8500
dongsheng@627 8501 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8502 #: ../en/ch06-collab.xml:697
dongsheng@627 8503 msgid ""
dongsheng@627 8504 "The downside of storing passphrases in an agent is that it's possible for a "
dongsheng@627 8505 "well-prepared attacker to recover the plain text of your passphrases, in some "
dongsheng@627 8506 "cases even if your system has been power-cycled. You should make your own "
dongsheng@627 8507 "judgment as to whether this is an acceptable risk. It certainly saves a lot "
dongsheng@627 8508 "of repeated typing."
dongsheng@627 8509 msgstr ""
dongsheng@627 8510
songdongsheng@710 8511 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 8512 #: ../en/ch06-collab.xml:706
dongsheng@627 8513 msgid ""
dongsheng@627 8514 "On Unix-like systems, the agent is called <command>ssh-agent</command>, and "
dongsheng@627 8515 "it's often run automatically for you when you log in. You'll need to use the "
songdongsheng@710 8516 "<command>ssh-add</command> command to add passphrases to the agent's store."
songdongsheng@710 8517 msgstr ""
songdongsheng@710 8518
songdongsheng@710 8519 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 8520 #: ../en/ch06-collab.xml:713
songdongsheng@710 8521 msgid ""
songdongsheng@710 8522 "On Windows, if you're using TortoiseHg, the <command>pageant</command> "
songdongsheng@710 8523 "command acts as the agent. As with <command>puttygen</command>, you'll need "
songdongsheng@710 8524 "to <ulink url=\"http://www.chiark.greenend.org.uk/%7Esgtatham/putty/download."
songdongsheng@710 8525 "html\">download <command>pageant</command></ulink> from the PuTTY web site "
songdongsheng@710 8526 "and read <ulink url=\"http://the.earth.li/~sgtatham/putty/0.60/htmldoc/"
songdongsheng@710 8527 "Chapter9.html#pageant\">its documentation</ulink>. The <command>pageant</"
songdongsheng@710 8528 "command> command adds an icon to your system tray that will let you manage "
songdongsheng@710 8529 "stored passphrases."
songdongsheng@710 8530 msgstr ""
songdongsheng@710 8531
songdongsheng@710 8532 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 8533 #: ../en/ch06-collab.xml:728
dongsheng@627 8534 msgid "Configuring the server side properly"
dongsheng@630 8535 msgstr "正确配置服务器端"
dongsheng@627 8536
dongsheng@627 8537 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8538 #: ../en/ch06-collab.xml:730
songdongsheng@710 8539 msgid ""
songdongsheng@710 8540 "Because ssh can be fiddly to set up if you're new to it, a variety of things "
songdongsheng@710 8541 "can go wrong. Add Mercurial on top, and there's plenty more scope for head-"
songdongsheng@710 8542 "scratching. Most of these potential problems occur on the server side, not "
songdongsheng@710 8543 "the client side. The good news is that once you've gotten a configuration "
songdongsheng@710 8544 "working, it will usually continue to work indefinitely."
songdongsheng@710 8545 msgstr ""
songdongsheng@710 8546
songdongsheng@710 8547 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8548 #: ../en/ch06-collab.xml:738
dongsheng@627 8549 msgid ""
dongsheng@627 8550 "Before you try using Mercurial to talk to an ssh server, it's best to make "
dongsheng@627 8551 "sure that you can use the normal <command>ssh</command> or <command>putty</"
dongsheng@627 8552 "command> command to talk to the server first. If you run into problems with "
dongsheng@627 8553 "using these commands directly, Mercurial surely won't work. Worse, it will "
dongsheng@627 8554 "obscure the underlying problem. Any time you want to debug ssh-related "
dongsheng@627 8555 "Mercurial problems, you should drop back to making sure that plain ssh client "
dongsheng@627 8556 "commands work first, <emphasis>before</emphasis> you worry about whether "
dongsheng@627 8557 "there's a problem with Mercurial."
dongsheng@627 8558 msgstr ""
dongsheng@627 8559
dongsheng@627 8560 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8561 #: ../en/ch06-collab.xml:749
dongsheng@627 8562 msgid ""
dongsheng@627 8563 "The first thing to be sure of on the server side is that you can actually log "
dongsheng@627 8564 "in from another machine at all. If you can't use <command>ssh</command> or "
dongsheng@627 8565 "<command>putty</command> to log in, the error message you get may give you a "
dongsheng@627 8566 "few hints as to what's wrong. The most common problems are as follows."
dongsheng@627 8567 msgstr ""
dongsheng@627 8568
dongsheng@627 8569 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 8570 #: ../en/ch06-collab.xml:756
dongsheng@627 8571 msgid ""
dongsheng@627 8572 "If you get a <quote>connection refused</quote> error, either there isn't an "
dongsheng@627 8573 "SSH daemon running on the server at all, or it's inaccessible due to firewall "
dongsheng@627 8574 "configuration."
dongsheng@627 8575 msgstr ""
dongsheng@627 8576
dongsheng@627 8577 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 8578 #: ../en/ch06-collab.xml:761
dongsheng@627 8579 msgid ""
dongsheng@627 8580 "If you get a <quote>no route to host</quote> error, you either have an "
dongsheng@627 8581 "incorrect address for the server or a seriously locked down firewall that "
dongsheng@627 8582 "won't admit its existence at all."
dongsheng@627 8583 msgstr ""
dongsheng@627 8584
dongsheng@627 8585 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 8586 #: ../en/ch06-collab.xml:766
dongsheng@627 8587 msgid ""
dongsheng@627 8588 "If you get a <quote>permission denied</quote> error, you may have mistyped "
dongsheng@627 8589 "the username on the server, or you could have mistyped your key's passphrase "
dongsheng@627 8590 "or the remote user's password."
dongsheng@627 8591 msgstr ""
dongsheng@627 8592
dongsheng@627 8593 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8594 #: ../en/ch06-collab.xml:771
dongsheng@627 8595 msgid ""
dongsheng@627 8596 "In summary, if you're having trouble talking to the server's ssh daemon, "
dongsheng@627 8597 "first make sure that one is running at all. On many systems it will be "
dongsheng@627 8598 "installed, but disabled, by default. Once you're done with this step, you "
dongsheng@627 8599 "should then check that the server's firewall is configured to allow incoming "
dongsheng@627 8600 "connections on the port the ssh daemon is listening on (usually 22). Don't "
dongsheng@627 8601 "worry about more exotic possibilities for misconfiguration until you've "
dongsheng@627 8602 "checked these two first."
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:781
dongsheng@627 8607 msgid ""
dongsheng@627 8608 "If you're using an authentication agent on the client side to store "
dongsheng@627 8609 "passphrases for your keys, you ought to be able to log into the server "
dongsheng@627 8610 "without being prompted for a passphrase or a password. If you're prompted "
dongsheng@627 8611 "for a passphrase, there are a few possible culprits."
dongsheng@627 8612 msgstr ""
dongsheng@627 8613
dongsheng@627 8614 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 8615 #: ../en/ch06-collab.xml:787
dongsheng@627 8616 msgid ""
dongsheng@627 8617 "You might have forgotten to use <command>ssh-add</command> or "
dongsheng@627 8618 "<command>pageant</command> to store the passphrase."
dongsheng@627 8619 msgstr ""
dongsheng@627 8620
dongsheng@627 8621 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 8622 #: ../en/ch06-collab.xml:791
songdongsheng@658 8623 msgid "You might have stored the passphrase for the wrong key."
songdongsheng@658 8624 msgstr ""
songdongsheng@658 8625
songdongsheng@658 8626 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8627 #: ../en/ch06-collab.xml:794
dongsheng@627 8628 msgid ""
dongsheng@627 8629 "If you're being prompted for the remote user's password, there are another "
dongsheng@627 8630 "few possible problems to check."
dongsheng@627 8631 msgstr ""
dongsheng@627 8632
dongsheng@627 8633 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 8634 #: ../en/ch06-collab.xml:797
dongsheng@627 8635 msgid ""
dongsheng@627 8636 "Either the user's home directory or their <filename role=\"special\" class="
dongsheng@627 8637 "\"directory\">.ssh</filename> directory might have excessively liberal "
dongsheng@627 8638 "permissions. As a result, the ssh daemon will not trust or read their "
dongsheng@627 8639 "<filename role=\"special\">authorized_keys</filename> file. For example, a "
dongsheng@627 8640 "group-writable home or <filename role=\"special\" class=\"directory\">.ssh</"
dongsheng@627 8641 "filename> directory will often cause this symptom."
dongsheng@627 8642 msgstr ""
dongsheng@627 8643
dongsheng@627 8644 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 8645 #: ../en/ch06-collab.xml:806
dongsheng@627 8646 msgid ""
dongsheng@627 8647 "The user's <filename role=\"special\">authorized_keys</filename> file may "
dongsheng@627 8648 "have a problem. If anyone other than the user owns or can write to that file, "
dongsheng@627 8649 "the ssh daemon will not trust or read it."
dongsheng@627 8650 msgstr ""
dongsheng@627 8651
dongsheng@627 8652 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8653 #: ../en/ch06-collab.xml:813
dongsheng@627 8654 msgid ""
dongsheng@627 8655 "In the ideal world, you should be able to run the following command "
dongsheng@627 8656 "successfully, and it should print exactly one line of output, the current "
dongsheng@627 8657 "date and time."
dongsheng@627 8658 msgstr ""
dongsheng@627 8659
dongsheng@627 8660 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8661 #: ../en/ch06-collab.xml:818
dongsheng@627 8662 msgid ""
dongsheng@627 8663 "If, on your server, you have login scripts that print banners or other junk "
dongsheng@627 8664 "even when running non-interactive commands like this, you should fix them "
dongsheng@627 8665 "before you continue, so that they only print output if they're run "
dongsheng@627 8666 "interactively. Otherwise these banners will at least clutter up Mercurial's "
dongsheng@627 8667 "output. Worse, they could potentially cause problems with running Mercurial "
dongsheng@714 8668 "commands remotely. Mercurial tries to detect and ignore banners in non-"
dongsheng@627 8669 "interactive <command>ssh</command> sessions, but it is not foolproof. (If "
dongsheng@627 8670 "you're editing your login scripts on your server, the usual way to see if a "
dongsheng@627 8671 "login script is running in an interactive shell is to check the return code "
dongsheng@627 8672 "from the command <literal>tty -s</literal>.)"
dongsheng@627 8673 msgstr ""
dongsheng@627 8674
dongsheng@627 8675 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8676 #: ../en/ch06-collab.xml:832
dongsheng@627 8677 msgid ""
dongsheng@627 8678 "Once you've verified that plain old ssh is working with your server, the next "
dongsheng@627 8679 "step is to ensure that Mercurial runs on the server. The following command "
dongsheng@627 8680 "should run successfully:"
dongsheng@627 8681 msgstr ""
dongsheng@627 8682
dongsheng@627 8683 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8684 #: ../en/ch06-collab.xml:839
dongsheng@627 8685 msgid ""
dongsheng@627 8686 "If you see an error message instead of normal <command role=\"hg-cmd\">hg "
dongsheng@627 8687 "version</command> output, this is usually because you haven't installed "
dongsheng@627 8688 "Mercurial to <filename class=\"directory\">/usr/bin</filename>. Don't worry "
dongsheng@627 8689 "if this is the case; you don't need to do that. But you should check for a "
dongsheng@627 8690 "few possible problems."
dongsheng@627 8691 msgstr ""
dongsheng@627 8692
dongsheng@627 8693 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 8694 #: ../en/ch06-collab.xml:846
dongsheng@627 8695 msgid ""
dongsheng@627 8696 "Is Mercurial really installed on the server at all? I know this sounds "
dongsheng@627 8697 "trivial, but it's worth checking!"
dongsheng@627 8698 msgstr ""
dongsheng@627 8699
dongsheng@627 8700 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 8701 #: ../en/ch06-collab.xml:850
dongsheng@627 8702 msgid ""
dongsheng@627 8703 "Maybe your shell's search path (usually set via the <envar>PATH</envar> "
dongsheng@627 8704 "environment variable) is simply misconfigured."
dongsheng@627 8705 msgstr ""
dongsheng@627 8706
dongsheng@627 8707 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 8708 #: ../en/ch06-collab.xml:854
dongsheng@627 8709 msgid ""
dongsheng@627 8710 "Perhaps your <envar>PATH</envar> environment variable is only being set to "
dongsheng@627 8711 "point to the location of the <command>hg</command> executable if the login "
dongsheng@627 8712 "session is interactive. This can happen if you're setting the path in the "
dongsheng@627 8713 "wrong shell login script. See your shell's documentation for details."
dongsheng@627 8714 msgstr ""
dongsheng@627 8715
dongsheng@627 8716 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 8717 #: ../en/ch06-collab.xml:861
dongsheng@627 8718 msgid ""
dongsheng@627 8719 "The <envar>PYTHONPATH</envar> environment variable may need to contain the "
dongsheng@627 8720 "path to the Mercurial Python modules. It might not be set at all; it could "
dongsheng@627 8721 "be incorrect; or it may be set only if the login is interactive."
dongsheng@627 8722 msgstr ""
dongsheng@627 8723
dongsheng@627 8724 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8725 #: ../en/ch06-collab.xml:868
dongsheng@627 8726 msgid ""
dongsheng@627 8727 "If you can run <command role=\"hg-cmd\">hg version</command> over an ssh "
dongsheng@627 8728 "connection, well done! You've got the server and client sorted out. You "
dongsheng@627 8729 "should now be able to use Mercurial to access repositories hosted by that "
dongsheng@627 8730 "username on that server. If you run into problems with Mercurial and ssh at "
dongsheng@627 8731 "this point, try using the <option role=\"hg-opt-global\">--debug</option> "
dongsheng@627 8732 "option to get a clearer picture of what's going on."
dongsheng@627 8733 msgstr ""
dongsheng@627 8734
dongsheng@627 8735 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 8736 #: ../en/ch06-collab.xml:877
dongsheng@627 8737 msgid "Using compression with ssh"
dongsheng@630 8738 msgstr "通过 ssh 使用压缩"
dongsheng@627 8739
dongsheng@627 8740 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8741 #: ../en/ch06-collab.xml:879
dongsheng@627 8742 msgid ""
dongsheng@627 8743 "Mercurial does not compress data when it uses the ssh protocol, because the "
songdongsheng@710 8744 "ssh protocol can transparently compress data. However, the default behavior "
dongsheng@627 8745 "of ssh clients is <emphasis>not</emphasis> to request compression."
dongsheng@627 8746 msgstr ""
dongsheng@627 8747
dongsheng@627 8748 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8749 #: ../en/ch06-collab.xml:884
dongsheng@627 8750 msgid ""
dongsheng@627 8751 "Over any network other than a fast LAN (even a wireless network), using "
dongsheng@627 8752 "compression is likely to significantly speed up Mercurial's network "
dongsheng@627 8753 "operations. For example, over a WAN, someone measured compression as "
dongsheng@627 8754 "reducing the amount of time required to clone a particularly large repository "
dongsheng@627 8755 "from 51 minutes to 17 minutes."
dongsheng@627 8756 msgstr ""
dongsheng@627 8757
dongsheng@627 8758 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8759 #: ../en/ch06-collab.xml:891
dongsheng@627 8760 msgid ""
dongsheng@627 8761 "Both <command>ssh</command> and <command>plink</command> accept a <option "
dongsheng@627 8762 "role=\"cmd-opt-ssh\">-C</option> option which turns on compression. You can "
dongsheng@650 8763 "easily edit your <filename role=\"special\">~/.hgrc</filename> to enable "
songdongsheng@710 8764 "compression for all of Mercurial's uses of the ssh protocol. Here is how to "
songdongsheng@710 8765 "do so for regular <command>ssh</command> on Unix-like systems, for example."
songdongsheng@710 8766 msgstr ""
songdongsheng@710 8767
songdongsheng@710 8768 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8769 #: ../en/ch06-collab.xml:901
songdongsheng@710 8770 msgid ""
songdongsheng@710 8771 "If you use <command>ssh</command> on a Unix-like system, you can configure it "
songdongsheng@710 8772 "to always use compression when talking to your server. To do this, edit your "
songdongsheng@710 8773 "<filename role=\"special\">.ssh/config</filename> file (which may not yet "
songdongsheng@710 8774 "exist), as follows."
songdongsheng@710 8775 msgstr ""
songdongsheng@710 8776
songdongsheng@710 8777 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8778 #: ../en/ch06-collab.xml:911
songdongsheng@710 8779 msgid ""
songdongsheng@710 8780 "This defines a hostname alias, <literal>hg</literal>. When you use that "
songdongsheng@710 8781 "hostname on the <command>ssh</command> command line or in a Mercurial "
songdongsheng@710 8782 "<literal>ssh</literal>-protocol URL, it will cause <command>ssh</command> to "
songdongsheng@710 8783 "connect to <literal>hg.example.com</literal> and use compression. This gives "
songdongsheng@710 8784 "you both a shorter name to type and compression, each of which is a good "
songdongsheng@710 8785 "thing in its own right."
dongsheng@627 8786 msgstr ""
dongsheng@627 8787
dongsheng@627 8788 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 8789 #: ../en/ch06-collab.xml:923
dongsheng@627 8790 msgid "Serving over HTTP using CGI"
dongsheng@630 8791 msgstr "使用 CGI 通过 HTTP 提供服务"
dongsheng@627 8792
dongsheng@627 8793 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 8794 #: ../en/ch06-collab.xml:925
songdongsheng@710 8795 msgid ""
songdongsheng@710 8796 "The simplest way to host one or more repositories in a permanent way is to "
songdongsheng@710 8797 "use a web server and Mercurial's CGI support."
songdongsheng@710 8798 msgstr ""
songdongsheng@710 8799
songdongsheng@710 8800 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 8801 #: ../en/ch06-collab.xml:929
dongsheng@627 8802 msgid ""
dongsheng@627 8803 "Depending on how ambitious you are, configuring Mercurial's CGI interface can "
dongsheng@627 8804 "take anything from a few moments to several hours."
dongsheng@627 8805 msgstr ""
dongsheng@627 8806
dongsheng@627 8807 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 8808 #: ../en/ch06-collab.xml:933
dongsheng@627 8809 msgid ""
dongsheng@627 8810 "We'll begin with the simplest of examples, and work our way towards a more "
dongsheng@627 8811 "complex configuration. Even for the most basic case, you're almost certainly "
dongsheng@627 8812 "going to need to read and modify your web server's configuration."
dongsheng@627 8813 msgstr ""
dongsheng@627 8814
songdongsheng@710 8815 #. type: Content of: <book><chapter><sect1><note><title>
dongsheng@714 8816 #: ../en/ch06-collab.xml:939
songdongsheng@710 8817 msgid "High pain tolerance required"
songdongsheng@710 8818 msgstr ""
songdongsheng@710 8819
dongsheng@627 8820 #. type: Content of: <book><chapter><sect1><note><para>
dongsheng@714 8821 #: ../en/ch06-collab.xml:941
dongsheng@627 8822 msgid ""
dongsheng@627 8823 "Configuring a web server is a complex, fiddly, and highly system-dependent "
dongsheng@627 8824 "activity. I can't possibly give you instructions that will cover anything "
dongsheng@627 8825 "like all of the cases you will encounter. Please use your discretion and "
dongsheng@627 8826 "judgment in following the sections below. Be prepared to make plenty of "
dongsheng@627 8827 "mistakes, and to spend a lot of time reading your server's error logs."
dongsheng@627 8828 msgstr ""
dongsheng@627 8829
songdongsheng@710 8830 #. type: Content of: <book><chapter><sect1><note><para>
dongsheng@714 8831 #: ../en/ch06-collab.xml:949
songdongsheng@710 8832 msgid ""
songdongsheng@710 8833 "If you don't have a strong stomach for tweaking configurations over and over, "
songdongsheng@710 8834 "or a compelling need to host your own services, you might want to try one of "
songdongsheng@710 8835 "the public hosting services that I mentioned earlier."
songdongsheng@710 8836 msgstr ""
songdongsheng@710 8837
songdongsheng@710 8838 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 8839 #: ../en/ch06-collab.xml:956
dongsheng@627 8840 msgid "Web server configuration checklist"
dongsheng@630 8841 msgstr "Web 服务器配置检查表"
dongsheng@627 8842
dongsheng@627 8843 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8844 #: ../en/ch06-collab.xml:958
dongsheng@627 8845 msgid ""
dongsheng@627 8846 "Before you continue, do take a few moments to check a few aspects of your "
dongsheng@627 8847 "system's setup."
dongsheng@627 8848 msgstr ""
dongsheng@627 8849
dongsheng@627 8850 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 8851 #: ../en/ch06-collab.xml:962
songdongsheng@710 8852 msgid ""
songdongsheng@710 8853 "Do you have a web server installed at all? Mac OS X and some Linux "
songdongsheng@710 8854 "distributions ship with Apache, but many other systems may not have a web "
songdongsheng@710 8855 "server installed."
dongsheng@627 8856 msgstr ""
dongsheng@627 8857
dongsheng@627 8858 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 8859 #: ../en/ch06-collab.xml:967
dongsheng@627 8860 msgid ""
dongsheng@627 8861 "If you have a web server installed, is it actually running? On most systems, "
dongsheng@627 8862 "even if one is present, it will be disabled by default."
dongsheng@627 8863 msgstr ""
dongsheng@627 8864
dongsheng@627 8865 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 8866 #: ../en/ch06-collab.xml:971
dongsheng@627 8867 msgid ""
dongsheng@627 8868 "Is your server configured to allow you to run CGI programs in the directory "
dongsheng@627 8869 "where you plan to do so? Most servers default to explicitly disabling the "
dongsheng@627 8870 "ability to run CGI programs."
dongsheng@627 8871 msgstr ""
dongsheng@627 8872
dongsheng@627 8873 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8874 #: ../en/ch06-collab.xml:977
dongsheng@627 8875 msgid ""
dongsheng@627 8876 "If you don't have a web server installed, and don't have substantial "
dongsheng@627 8877 "experience configuring Apache, you should consider using the "
dongsheng@627 8878 "<literal>lighttpd</literal> web server instead of Apache. Apache has a well-"
dongsheng@627 8879 "deserved reputation for baroque and confusing configuration. While "
dongsheng@627 8880 "<literal>lighttpd</literal> is less capable in some ways than Apache, most of "
dongsheng@627 8881 "these capabilities are not relevant to serving Mercurial repositories. And "
dongsheng@627 8882 "<literal>lighttpd</literal> is undeniably <emphasis>much</emphasis> easier to "
dongsheng@627 8883 "get started with than Apache."
dongsheng@627 8884 msgstr ""
dongsheng@627 8885
dongsheng@627 8886 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 8887 #: ../en/ch06-collab.xml:990
dongsheng@627 8888 msgid "Basic CGI configuration"
dongsheng@630 8889 msgstr "基本 CGI 配置"
dongsheng@627 8890
dongsheng@627 8891 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8892 #: ../en/ch06-collab.xml:992
dongsheng@627 8893 msgid ""
dongsheng@627 8894 "On Unix-like systems, it's common for users to have a subdirectory named "
dongsheng@627 8895 "something like <filename class=\"directory\">public_html</filename> in their "
dongsheng@627 8896 "home directory, from which they can serve up web pages. A file named "
dongsheng@627 8897 "<filename>foo</filename> in this directory will be accessible at a URL of the "
dongsheng@650 8898 "form <literal>http://www.example.com/username/foo</literal>."
dongsheng@650 8899 msgstr ""
dongsheng@650 8900
dongsheng@650 8901 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8902 #: ../en/ch06-collab.xml:1000
dongsheng@627 8903 msgid ""
dongsheng@627 8904 "To get started, find the <filename role=\"special\">hgweb.cgi</filename> "
dongsheng@627 8905 "script that should be present in your Mercurial installation. If you can't "
dongsheng@627 8906 "quickly find a local copy on your system, simply download one from the master "
dongsheng@627 8907 "Mercurial repository at <ulink url=\"http://www.selenic.com/repo/hg/raw-file/"
dongsheng@627 8908 "tip/hgweb.cgi\">http://www.selenic.com/repo/hg/raw-file/tip/hgweb.cgi</ulink>."
dongsheng@627 8909 msgstr ""
dongsheng@627 8910
dongsheng@627 8911 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8912 #: ../en/ch06-collab.xml:1007 ../en/ch06-collab.xml:1175
dongsheng@627 8913 msgid ""
dongsheng@627 8914 "You'll need to copy this script into your <filename class=\"directory"
dongsheng@627 8915 "\">public_html</filename> directory, and ensure that it's executable."
dongsheng@627 8916 msgstr ""
dongsheng@627 8917
dongsheng@627 8918 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 8919 #: ../en/ch06-collab.xml:1012
dongsheng@627 8920 msgid ""
dongsheng@627 8921 "The <literal>755</literal> argument to <command>chmod</command> is a little "
dongsheng@627 8922 "more general than just making the script executable: it ensures that the "
dongsheng@627 8923 "script is executable by anyone, and that <quote>group</quote> and "
dongsheng@627 8924 "<quote>other</quote> write permissions are <emphasis>not</emphasis> set. If "
dongsheng@627 8925 "you were to leave those write permissions enabled, Apache's <literal>suexec</"
dongsheng@627 8926 "literal> subsystem would likely refuse to execute the script. In fact, "
dongsheng@627 8927 "<literal>suexec</literal> also insists that the <emphasis>directory</"
dongsheng@627 8928 "emphasis> in which the script resides must not be writable by others."
dongsheng@627 8929 msgstr ""
dongsheng@627 8930
dongsheng@627 8931 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 8932 #: ../en/ch06-collab.xml:1026
dongsheng@627 8933 msgid "What could <emphasis>possibly</emphasis> go wrong?"
dongsheng@630 8934 msgstr "什么<emphasis>可能</emphasis>会出错?"
dongsheng@627 8935
dongsheng@627 8936 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 8937 #: ../en/ch06-collab.xml:1029
dongsheng@627 8938 msgid ""
dongsheng@627 8939 "Once you've copied the CGI script into place, go into a web browser, and try "
dongsheng@714 8940 "to open the URL <literal>http://myhostname/~myuser/hgweb.cgi</literal>, "
dongsheng@714 8941 "<emphasis>but</emphasis> brace yourself for instant failure. There's a high "
dongsheng@714 8942 "probability that trying to visit this URL will fail, and there are many "
dongsheng@714 8943 "possible reasons for this. In fact, you're likely to stumble over almost "
dongsheng@714 8944 "every one of the possible errors below, so please read carefully. The "
dongsheng@714 8945 "following are all of the problems I ran into on a system running Fedora 7, "
dongsheng@714 8946 "with a fresh installation of Apache, and a user account that I created "
dongsheng@714 8947 "specially to perform this exercise."
dongsheng@627 8948 msgstr ""
dongsheng@627 8949
dongsheng@627 8950 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 8951 #: ../en/ch06-collab.xml:1042
dongsheng@627 8952 msgid ""
dongsheng@627 8953 "Your web server may have per-user directories disabled. If you're using "
dongsheng@627 8954 "Apache, search your config file for a <literal>UserDir</literal> directive. "
dongsheng@627 8955 "If there's none present, per-user directories will be disabled. If one "
dongsheng@627 8956 "exists, but its value is <literal>disabled</literal>, then per-user "
dongsheng@627 8957 "directories will be disabled. Otherwise, the string after <literal>UserDir</"
dongsheng@627 8958 "literal> gives the name of the subdirectory that Apache will look in under "
dongsheng@627 8959 "your home directory, for example <filename class=\"directory\">public_html</"
dongsheng@627 8960 "filename>."
dongsheng@627 8961 msgstr ""
dongsheng@627 8962
dongsheng@627 8963 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 8964 #: ../en/ch06-collab.xml:1053
dongsheng@627 8965 msgid ""
dongsheng@627 8966 "Your file access permissions may be too restrictive. The web server must be "
dongsheng@627 8967 "able to traverse your home directory and directories under your <filename "
dongsheng@627 8968 "class=\"directory\">public_html</filename> directory, and read files under "
dongsheng@627 8969 "the latter too. Here's a quick recipe to help you to make your permissions "
dongsheng@627 8970 "more appropriate."
dongsheng@627 8971 msgstr ""
dongsheng@627 8972
dongsheng@627 8973 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 8974 #: ../en/ch06-collab.xml:1063
dongsheng@627 8975 msgid ""
dongsheng@627 8976 "The other possibility with permissions is that you might get a completely "
dongsheng@627 8977 "empty window when you try to load the script. In this case, it's likely that "
dongsheng@627 8978 "your access permissions are <emphasis>too permissive</emphasis>. Apache's "
dongsheng@627 8979 "<literal>suexec</literal> subsystem won't execute a script that's group- or "
dongsheng@627 8980 "world-writable, for example."
dongsheng@627 8981 msgstr ""
dongsheng@627 8982
dongsheng@627 8983 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 8984 #: ../en/ch06-collab.xml:1070
dongsheng@627 8985 msgid ""
dongsheng@627 8986 "Your web server may be configured to disallow execution of CGI programs in "
dongsheng@627 8987 "your per-user web directory. Here's Apache's default per-user configuration "
dongsheng@627 8988 "from my Fedora system."
dongsheng@627 8989 msgstr ""
dongsheng@627 8990
dongsheng@627 8991 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 8992 #: ../en/ch06-collab.xml:1077
dongsheng@627 8993 msgid ""
dongsheng@627 8994 "If you find a similar-looking <literal>Directory</literal> group in your "
dongsheng@627 8995 "Apache configuration, the directive to look at inside it is <literal>Options</"
dongsheng@627 8996 "literal>. Add <literal>ExecCGI</literal> to the end of this list if it's "
dongsheng@627 8997 "missing, and restart the web server."
dongsheng@627 8998 msgstr ""
dongsheng@627 8999
dongsheng@627 9000 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 9001 #: ../en/ch06-collab.xml:1084
dongsheng@627 9002 msgid ""
dongsheng@627 9003 "If you find that Apache serves you the text of the CGI script instead of "
dongsheng@627 9004 "executing it, you may need to either uncomment (if already present) or add a "
dongsheng@627 9005 "directive like this."
dongsheng@627 9006 msgstr ""
dongsheng@627 9007
dongsheng@627 9008 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 9009 #: ../en/ch06-collab.xml:1090
dongsheng@627 9010 msgid ""
dongsheng@627 9011 "The next possibility is that you might be served with a colourful Python "
dongsheng@627 9012 "backtrace claiming that it can't import a <literal>mercurial</literal>-"
dongsheng@627 9013 "related module. This is actually progress! The server is now capable of "
dongsheng@627 9014 "executing your CGI script. This error is only likely to occur if you're "
dongsheng@627 9015 "running a private installation of Mercurial, instead of a system-wide "
dongsheng@627 9016 "version. Remember that the web server runs the CGI program without any of "
dongsheng@627 9017 "the environment variables that you take for granted in an interactive "
dongsheng@627 9018 "session. If this error happens to you, edit your copy of <filename role="
dongsheng@627 9019 "\"special\">hgweb.cgi</filename> and follow the directions inside it to "
dongsheng@627 9020 "correctly set your <envar>PYTHONPATH</envar> environment variable."
dongsheng@627 9021 msgstr ""
dongsheng@627 9022
dongsheng@627 9023 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 9024 #: ../en/ch06-collab.xml:1104
dongsheng@714 9025 msgid ""
dongsheng@714 9026 "Finally, you are <emphasis>certain</emphasis> to be served with another "
dongsheng@627 9027 "colourful Python backtrace: this one will complain that it can't find "
dongsheng@627 9028 "<filename class=\"directory\">/path/to/repository</filename>. Edit your "
dongsheng@627 9029 "<filename role=\"special\">hgweb.cgi</filename> script and replace the "
dongsheng@627 9030 "<filename class=\"directory\">/path/to/repository</filename> string with the "
dongsheng@627 9031 "complete path to the repository you want to serve up."
dongsheng@627 9032 msgstr ""
dongsheng@627 9033
dongsheng@627 9034 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 9035 #: ../en/ch06-collab.xml:1114
dongsheng@627 9036 msgid ""
dongsheng@627 9037 "At this point, when you try to reload the page, you should be presented with "
dongsheng@627 9038 "a nice HTML view of your repository's history. Whew!"
dongsheng@627 9039 msgstr ""
dongsheng@627 9040
dongsheng@627 9041 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 9042 #: ../en/ch06-collab.xml:1120
dongsheng@627 9043 msgid "Configuring lighttpd"
dongsheng@630 9044 msgstr "配置 lighttpd"
dongsheng@627 9045
dongsheng@627 9046 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 9047 #: ../en/ch06-collab.xml:1122
dongsheng@627 9048 msgid ""
dongsheng@627 9049 "To be exhaustive in my experiments, I tried configuring the increasingly "
dongsheng@627 9050 "popular <literal>lighttpd</literal> web server to serve the same repository "
dongsheng@627 9051 "as I described with Apache above. I had already overcome all of the problems "
dongsheng@627 9052 "I outlined with Apache, many of which are not server-specific. As a result, "
dongsheng@627 9053 "I was fairly sure that my file and directory permissions were good, and that "
dongsheng@627 9054 "my <filename role=\"special\">hgweb.cgi</filename> script was properly edited."
dongsheng@627 9055 msgstr ""
dongsheng@627 9056
dongsheng@627 9057 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 9058 #: ../en/ch06-collab.xml:1132
dongsheng@627 9059 msgid ""
dongsheng@627 9060 "Once I had Apache running, getting <literal>lighttpd</literal> to serve the "
dongsheng@627 9061 "repository was a snap (in other words, even if you're trying to use "
dongsheng@627 9062 "<literal>lighttpd</literal>, you should read the Apache section). I first "
dongsheng@627 9063 "had to edit the <literal>mod_access</literal> section of its config file to "
dongsheng@627 9064 "enable <literal>mod_cgi</literal> and <literal>mod_userdir</literal>, both of "
dongsheng@627 9065 "which were disabled by default on my system. I then added a few lines to the "
dongsheng@627 9066 "end of the config file, to configure these modules."
dongsheng@627 9067 msgstr ""
dongsheng@627 9068
dongsheng@627 9069 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 9070 #: ../en/ch06-collab.xml:1144
dongsheng@627 9071 msgid ""
dongsheng@627 9072 "With this done, <literal>lighttpd</literal> ran immediately for me. If I had "
dongsheng@627 9073 "configured <literal>lighttpd</literal> before Apache, I'd almost certainly "
dongsheng@627 9074 "have run into many of the same system-level configuration problems as I did "
dongsheng@627 9075 "with Apache. However, I found <literal>lighttpd</literal> to be noticeably "
dongsheng@627 9076 "easier to configure than Apache, even though I've used Apache for over a "
dongsheng@627 9077 "decade, and this was my first exposure to <literal>lighttpd</literal>."
dongsheng@627 9078 msgstr ""
dongsheng@627 9079
dongsheng@627 9080 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 9081 #: ../en/ch06-collab.xml:1157
dongsheng@627 9082 msgid "Sharing multiple repositories with one CGI script"
dongsheng@630 9083 msgstr "使用一个 CGI 脚本共享多个版本库"
dongsheng@627 9084
dongsheng@627 9085 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9086 #: ../en/ch06-collab.xml:1159
dongsheng@627 9087 msgid ""
dongsheng@627 9088 "The <filename role=\"special\">hgweb.cgi</filename> script only lets you "
dongsheng@627 9089 "publish a single repository, which is an annoying restriction. If you want "
dongsheng@627 9090 "to publish more than one without wracking yourself with multiple copies of "
dongsheng@627 9091 "the same script, each with different names, a better choice is to use the "
dongsheng@627 9092 "<filename role=\"special\">hgwebdir.cgi</filename> script."
dongsheng@627 9093 msgstr ""
dongsheng@627 9094
dongsheng@627 9095 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9096 #: ../en/ch06-collab.xml:1167
dongsheng@627 9097 msgid ""
dongsheng@627 9098 "The procedure to configure <filename role=\"special\">hgwebdir.cgi</filename> "
dongsheng@627 9099 "is only a little more involved than for <filename role=\"special\">hgweb.cgi</"
dongsheng@627 9100 "filename>. First, you must obtain a copy of the script. If you don't have "
dongsheng@627 9101 "one handy, you can download a copy from the master Mercurial repository at "
dongsheng@627 9102 "<ulink url=\"http://www.selenic.com/repo/hg/raw-file/tip/hgwebdir.cgi"
dongsheng@627 9103 "\">http://www.selenic.com/repo/hg/raw-file/tip/hgwebdir.cgi</ulink>."
dongsheng@627 9104 msgstr ""
dongsheng@627 9105
dongsheng@627 9106 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9107 #: ../en/ch06-collab.xml:1182
dongsheng@714 9108 msgid ""
dongsheng@714 9109 "With basic configuration out of the way, try to visit <literal>http://"
dongsheng@714 9110 "myhostname/~myuser/hgwebdir.cgi</literal> in your\tbrowser. It should "
dongsheng@714 9111 "display an empty list of repositories. If you get a blank window or error "
dongsheng@714 9112 "message, try walking through the list of potential problems in <xref linkend="
dongsheng@714 9113 "\"sec:collab:wtf\"/>."
dongsheng@714 9114 msgstr ""
dongsheng@714 9115
dongsheng@714 9116 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9117 #: ../en/ch06-collab.xml:1190
dongsheng@627 9118 msgid ""
dongsheng@627 9119 "The <filename role=\"special\">hgwebdir.cgi</filename> script relies on an "
dongsheng@627 9120 "external configuration file. By default, it searches for a file named "
dongsheng@627 9121 "<filename role=\"special\">hgweb.config</filename> in the same directory as "
dongsheng@627 9122 "itself. You'll need to create this file, and make it world-readable. The "
dongsheng@627 9123 "format of the file is similar to a Windows <quote>ini</quote> file, as "
dongsheng@627 9124 "understood by Python's <literal>ConfigParser</literal> <citation>web:"
dongsheng@627 9125 "configparser</citation> module."
dongsheng@627 9126 msgstr ""
dongsheng@627 9127
dongsheng@627 9128 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9129 #: ../en/ch06-collab.xml:1200
dongsheng@627 9130 msgid ""
dongsheng@627 9131 "The easiest way to configure <filename role=\"special\">hgwebdir.cgi</"
dongsheng@627 9132 "filename> is with a section named <literal>collections</literal>. This will "
dongsheng@627 9133 "automatically publish <emphasis>every</emphasis> repository under the "
dongsheng@627 9134 "directories you name. The section should look like this:"
dongsheng@627 9135 msgstr ""
dongsheng@627 9136
dongsheng@627 9137 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9138 #: ../en/ch06-collab.xml:1208
dongsheng@627 9139 msgid ""
dongsheng@627 9140 "Mercurial interprets this by looking at the directory name on the "
dongsheng@627 9141 "<emphasis>right</emphasis> hand side of the <quote><literal>=</literal></"
dongsheng@627 9142 "quote> sign; finding repositories in that directory hierarchy; and using the "
dongsheng@627 9143 "text on the <emphasis>left</emphasis> to strip off matching text from the "
dongsheng@627 9144 "names it will actually list in the web interface. The remaining component of "
dongsheng@627 9145 "a path after this stripping has occurred is called a <quote>virtual path</"
dongsheng@627 9146 "quote>."
dongsheng@627 9147 msgstr ""
dongsheng@627 9148
dongsheng@627 9149 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9150 #: ../en/ch06-collab.xml:1217
dongsheng@627 9151 msgid ""
dongsheng@627 9152 "Given the example above, if we have a repository whose local path is "
dongsheng@627 9153 "<filename class=\"directory\">/my/root/this/repo</filename>, the CGI script "
dongsheng@627 9154 "will strip the leading <filename class=\"directory\">/my/root</filename> from "
dongsheng@627 9155 "the name, and publish the repository with a virtual path of <filename class="
dongsheng@627 9156 "\"directory\">this/repo</filename>. If the base URL for our CGI script is "
dongsheng@714 9157 "<literal>http://myhostname/~myuser/hgwebdir.cgi</literal>, the complete URL "
dongsheng@714 9158 "for that repository will be <literal>http://myhostname/~myuser/hgwebdir.cgi/"
dongsheng@714 9159 "this/repo</literal>."
dongsheng@714 9160 msgstr ""
dongsheng@714 9161
dongsheng@714 9162 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9163 #: ../en/ch06-collab.xml:1229
dongsheng@627 9164 msgid ""
dongsheng@627 9165 "If we replace <filename class=\"directory\">/my/root</filename> on the left "
dongsheng@627 9166 "hand side of this example with <filename class=\"directory\">/my</filename>, "
dongsheng@627 9167 "then <filename role=\"special\">hgwebdir.cgi</filename> will only strip off "
dongsheng@627 9168 "<filename class=\"directory\">/my</filename> from the repository name, and "
dongsheng@627 9169 "will give us a virtual path of <filename class=\"directory\">root/this/repo</"
dongsheng@627 9170 "filename> instead of <filename class=\"directory\">this/repo</filename>."
dongsheng@627 9171 msgstr ""
dongsheng@627 9172
dongsheng@627 9173 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9174 #: ../en/ch06-collab.xml:1239
dongsheng@627 9175 msgid ""
dongsheng@627 9176 "The <filename role=\"special\">hgwebdir.cgi</filename> script will "
dongsheng@627 9177 "recursively search each directory listed in the <literal>collections</"
dongsheng@627 9178 "literal> section of its configuration file, but it will <literal>not</"
dongsheng@627 9179 "literal> recurse into the repositories it finds."
dongsheng@627 9180 msgstr ""
dongsheng@627 9181
dongsheng@627 9182 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9183 #: ../en/ch06-collab.xml:1245
dongsheng@627 9184 msgid ""
dongsheng@627 9185 "The <literal>collections</literal> mechanism makes it easy to publish many "
dongsheng@627 9186 "repositories in a <quote>fire and forget</quote> manner. You only need to "
dongsheng@627 9187 "set up the CGI script and configuration file one time. Afterwards, you can "
dongsheng@627 9188 "publish or unpublish a repository at any time by simply moving it into, or "
dongsheng@627 9189 "out of, the directory hierarchy in which you've configured <filename role="
dongsheng@627 9190 "\"special\">hgwebdir.cgi</filename> to look."
dongsheng@627 9191 msgstr ""
dongsheng@627 9192
dongsheng@627 9193 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 9194 #: ../en/ch06-collab.xml:1255
dongsheng@627 9195 msgid "Explicitly specifying which repositories to publish"
dongsheng@630 9196 msgstr "明确指出要发布的版本库"
dongsheng@627 9197
dongsheng@627 9198 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 9199 #: ../en/ch06-collab.xml:1258
dongsheng@627 9200 msgid ""
dongsheng@627 9201 "In addition to the <literal>collections</literal> mechanism, the <filename "
dongsheng@627 9202 "role=\"special\">hgwebdir.cgi</filename> script allows you to publish a "
dongsheng@627 9203 "specific list of repositories. To do so, create a <literal>paths</literal> "
dongsheng@627 9204 "section, with contents of the following form."
dongsheng@627 9205 msgstr ""
dongsheng@627 9206
dongsheng@627 9207 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 9208 #: ../en/ch06-collab.xml:1267
dongsheng@627 9209 msgid ""
dongsheng@627 9210 "In this case, the virtual path (the component that will appear in a URL) is "
dongsheng@627 9211 "on the left hand side of each definition, while the path to the repository is "
dongsheng@627 9212 "on the right. Notice that there does not need to be any relationship between "
dongsheng@627 9213 "the virtual path you choose and the location of a repository in your "
dongsheng@627 9214 "filesystem."
dongsheng@627 9215 msgstr ""
dongsheng@627 9216
dongsheng@627 9217 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 9218 #: ../en/ch06-collab.xml:1274
dongsheng@627 9219 msgid ""
dongsheng@627 9220 "If you wish, you can use both the <literal>collections</literal> and "
dongsheng@627 9221 "<literal>paths</literal> mechanisms simultaneously in a single configuration "
dongsheng@627 9222 "file."
dongsheng@627 9223 msgstr ""
dongsheng@627 9224
songdongsheng@710 9225 #. type: Content of: <book><chapter><sect1><sect2><sect3><note><title>
dongsheng@714 9226 #: ../en/ch06-collab.xml:1280
songdongsheng@710 9227 msgid "Beware duplicate virtual paths"
songdongsheng@710 9228 msgstr ""
songdongsheng@710 9229
dongsheng@627 9230 #. type: Content of: <book><chapter><sect1><sect2><sect3><note><para>
dongsheng@714 9231 #: ../en/ch06-collab.xml:1282
songdongsheng@710 9232 msgid ""
songdongsheng@710 9233 "If several repositories have the same virtual path, <filename role=\"special"
dongsheng@627 9234 "\">hgwebdir.cgi</filename> will not report an error. Instead, it will behave "
dongsheng@627 9235 "unpredictably."
dongsheng@627 9236 msgstr ""
dongsheng@627 9237
dongsheng@627 9238 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 9239 #: ../en/ch06-collab.xml:1291
dongsheng@627 9240 msgid "Downloading source archives"
dongsheng@630 9241 msgstr "下载源代码档案包"
dongsheng@627 9242
dongsheng@627 9243 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9244 #: ../en/ch06-collab.xml:1293
dongsheng@627 9245 msgid ""
dongsheng@627 9246 "Mercurial's web interface lets users download an archive of any revision. "
dongsheng@627 9247 "This archive will contain a snapshot of the working directory as of that "
dongsheng@627 9248 "revision, but it will not contain a copy of the repository data."
dongsheng@627 9249 msgstr ""
dongsheng@627 9250
dongsheng@627 9251 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9252 #: ../en/ch06-collab.xml:1298
dongsheng@627 9253 msgid ""
dongsheng@627 9254 "By default, this feature is not enabled. To enable it, you'll need to add an "
dongsheng@627 9255 "<envar role=\"rc-item-web\">allow_archive</envar> item to the <literal role="
dongsheng@650 9256 "\"rc-web\">web</literal> section of your <filename role=\"special\">~/.hgrc</"
songdongsheng@710 9257 "filename>; see below for details."
songdongsheng@710 9258 msgstr ""
songdongsheng@710 9259
songdongsheng@710 9260 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 9261 #: ../en/ch06-collab.xml:1305
dongsheng@627 9262 msgid "Web configuration options"
dongsheng@630 9263 msgstr "Web 配置选项"
dongsheng@627 9264
dongsheng@627 9265 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9266 #: ../en/ch06-collab.xml:1307
dongsheng@627 9267 msgid ""
dongsheng@627 9268 "Mercurial's web interfaces (the <command role=\"hg-cmd\">hg serve</command> "
dongsheng@627 9269 "command, and the <filename role=\"special\">hgweb.cgi</filename> and "
dongsheng@627 9270 "<filename role=\"special\">hgwebdir.cgi</filename> scripts) have a number of "
dongsheng@627 9271 "configuration options that you can set. These belong in a section named "
dongsheng@627 9272 "<literal role=\"rc-web\">web</literal>."
dongsheng@627 9273 msgstr ""
dongsheng@627 9274
dongsheng@627 9275 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 9276 #: ../en/ch06-collab.xml:1315
dongsheng@627 9277 msgid ""
dongsheng@627 9278 "<envar role=\"rc-item-web\">allow_archive</envar>: Determines which (if any) "
dongsheng@627 9279 "archive download mechanisms Mercurial supports. If you enable this feature, "
dongsheng@627 9280 "users of the web interface will be able to download an archive of whatever "
dongsheng@627 9281 "revision of a repository they are viewing. To enable the archive feature, "
dongsheng@627 9282 "this item must take the form of a sequence of words drawn from the list below."
dongsheng@627 9283 msgstr ""
dongsheng@627 9284
dongsheng@627 9285 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
dongsheng@714 9286 #: ../en/ch06-collab.xml:1324
dongsheng@627 9287 msgid ""
dongsheng@627 9288 "<literal>bz2</literal>: A <command>tar</command> archive, compressed using "
dongsheng@627 9289 "<literal>bzip2</literal> compression. This has the best compression ratio, "
dongsheng@627 9290 "but uses the most CPU time on the server."
dongsheng@627 9291 msgstr ""
dongsheng@627 9292
dongsheng@627 9293 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
dongsheng@714 9294 #: ../en/ch06-collab.xml:1330
dongsheng@627 9295 msgid ""
dongsheng@627 9296 "<literal>gz</literal>: A <command>tar</command> archive, compressed using "
dongsheng@627 9297 "<literal>gzip</literal> compression."
dongsheng@627 9298 msgstr ""
dongsheng@627 9299
dongsheng@627 9300 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
dongsheng@714 9301 #: ../en/ch06-collab.xml:1334
dongsheng@627 9302 msgid ""
dongsheng@627 9303 "<literal>zip</literal>: A <command>zip</command> archive, compressed using "
dongsheng@627 9304 "LZW compression. This format has the worst compression ratio, but is widely "
dongsheng@627 9305 "used in the Windows world."
dongsheng@627 9306 msgstr ""
dongsheng@627 9307
dongsheng@627 9308 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 9309 #: ../en/ch06-collab.xml:1340
dongsheng@627 9310 msgid ""
dongsheng@627 9311 "If you provide an empty list, or don't have an <envar role=\"rc-item-web"
dongsheng@627 9312 "\">allow_archive</envar> entry at all, this feature will be disabled. Here "
dongsheng@627 9313 "is an example of how to enable all three supported formats."
dongsheng@627 9314 msgstr ""
dongsheng@627 9315
dongsheng@627 9316 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 9317 #: ../en/ch06-collab.xml:1347
dongsheng@627 9318 msgid ""
dongsheng@627 9319 "<envar role=\"rc-item-web\">allowpull</envar>: Boolean. Determines whether "
dongsheng@627 9320 "the web interface allows remote users to <command role=\"hg-cmd\">hg pull</"
dongsheng@627 9321 "command> and <command role=\"hg-cmd\">hg clone</command> this repository over "
dongsheng@627 9322 "HTTP. If set to <literal>no</literal> or <literal>false</literal>, only the "
dongsheng@627 9323 "<quote>human-oriented</quote> portion of the web interface is available."
dongsheng@627 9324 msgstr ""
dongsheng@627 9325
dongsheng@627 9326 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 9327 #: ../en/ch06-collab.xml:1356
dongsheng@627 9328 msgid ""
dongsheng@627 9329 "<envar role=\"rc-item-web\">contact</envar>: String. A free-form (but "
dongsheng@627 9330 "preferably brief) string identifying the person or group in charge of the "
dongsheng@627 9331 "repository. This often contains the name and email address of a person or "
dongsheng@627 9332 "mailing list. It often makes sense to place this entry in a repository's own "
dongsheng@627 9333 "<filename role=\"special\">.hg/hgrc</filename> file, but it can make sense to "
dongsheng@650 9334 "use in a global <filename role=\"special\">~/.hgrc</filename> if every "
dongsheng@627 9335 "repository has a single maintainer."
dongsheng@627 9336 msgstr ""
dongsheng@627 9337
dongsheng@627 9338 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 9339 #: ../en/ch06-collab.xml:1367
dongsheng@627 9340 msgid ""
dongsheng@627 9341 "<envar role=\"rc-item-web\">maxchanges</envar>: Integer. The default maximum "
dongsheng@627 9342 "number of changesets to display in a single page of output."
dongsheng@627 9343 msgstr ""
dongsheng@627 9344
dongsheng@627 9345 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 9346 #: ../en/ch06-collab.xml:1371
dongsheng@627 9347 msgid ""
dongsheng@627 9348 "<envar role=\"rc-item-web\">maxfiles</envar>: Integer. The default maximum "
dongsheng@627 9349 "number of modified files to display in a single page of output."
dongsheng@627 9350 msgstr ""
dongsheng@627 9351
dongsheng@627 9352 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 9353 #: ../en/ch06-collab.xml:1375
dongsheng@627 9354 msgid ""
dongsheng@627 9355 "<envar role=\"rc-item-web\">stripes</envar>: Integer. If the web interface "
dongsheng@627 9356 "displays alternating <quote>stripes</quote> to make it easier to visually "
dongsheng@627 9357 "align rows when you are looking at a table, this number controls the number "
dongsheng@627 9358 "of rows in each stripe."
dongsheng@627 9359 msgstr ""
dongsheng@627 9360
dongsheng@627 9361 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 9362 #: ../en/ch06-collab.xml:1381
dongsheng@627 9363 msgid ""
dongsheng@627 9364 "<envar role=\"rc-item-web\">style</envar>: Controls the template Mercurial "
songdongsheng@710 9365 "uses to display the web interface. Mercurial ships with several web "
songdongsheng@710 9366 "templates."
songdongsheng@710 9367 msgstr ""
songdongsheng@710 9368
songdongsheng@710 9369 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
dongsheng@714 9370 #: ../en/ch06-collab.xml:1387
songdongsheng@710 9371 msgid "<literal>coal</literal> is monochromatic."
songdongsheng@710 9372 msgstr ""
songdongsheng@710 9373
songdongsheng@710 9374 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
dongsheng@714 9375 #: ../en/ch06-collab.xml:1390
songdongsheng@710 9376 msgid ""
songdongsheng@710 9377 "<literal>gitweb</literal> emulates the visual style of git's web interface."
songdongsheng@710 9378 msgstr ""
songdongsheng@710 9379
songdongsheng@710 9380 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
dongsheng@714 9381 #: ../en/ch06-collab.xml:1394
songdongsheng@710 9382 msgid "<literal>monoblue</literal> uses solid blues and greys."
songdongsheng@710 9383 msgstr ""
songdongsheng@710 9384
songdongsheng@710 9385 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
dongsheng@714 9386 #: ../en/ch06-collab.xml:1398
songdongsheng@710 9387 msgid "<literal>paper</literal> is the default."
songdongsheng@710 9388 msgstr ""
songdongsheng@710 9389
songdongsheng@710 9390 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><itemizedlist><listitem><para>
dongsheng@714 9391 #: ../en/ch06-collab.xml:1401
songdongsheng@710 9392 msgid "<literal>spartan</literal> was the default for a long time."
dongsheng@627 9393 msgstr ""
dongsheng@627 9394
dongsheng@627 9395 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 9396 #: ../en/ch06-collab.xml:1405
songdongsheng@710 9397 msgid ""
songdongsheng@710 9398 "You can also specify a custom template of your own; see <xref linkend=\"chap:"
songdongsheng@710 9399 "template\"/> for details. Here, you can see how to enable the "
songdongsheng@710 9400 "<literal>gitweb</literal> style."
songdongsheng@710 9401 msgstr ""
songdongsheng@710 9402
songdongsheng@710 9403 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 9404 #: ../en/ch06-collab.xml:1413
dongsheng@627 9405 msgid ""
dongsheng@627 9406 "<envar role=\"rc-item-web\">templates</envar>: Path. The directory in which "
dongsheng@627 9407 "to search for template files. By default, Mercurial searches in the "
dongsheng@627 9408 "directory in which it was installed."
dongsheng@627 9409 msgstr ""
dongsheng@627 9410
dongsheng@627 9411 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9412 #: ../en/ch06-collab.xml:1418
dongsheng@627 9413 msgid ""
dongsheng@627 9414 "If you are using <filename role=\"special\">hgwebdir.cgi</filename>, you can "
dongsheng@627 9415 "place a few configuration items in a <literal role=\"rc-web\">web</literal> "
dongsheng@627 9416 "section of the <filename role=\"special\">hgweb.config</filename> file "
dongsheng@650 9417 "instead of a <filename role=\"special\">~/.hgrc</filename> file, for "
dongsheng@627 9418 "convenience. These items are <envar role=\"rc-item-web\">motd</envar> and "
dongsheng@627 9419 "<envar role=\"rc-item-web\">style</envar>."
dongsheng@627 9420 msgstr ""
dongsheng@627 9421
dongsheng@627 9422 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 9423 #: ../en/ch06-collab.xml:1429
dongsheng@627 9424 msgid "Options specific to an individual repository"
dongsheng@630 9425 msgstr "针对单个版本库的选项"
dongsheng@627 9426
dongsheng@627 9427 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 9428 #: ../en/ch06-collab.xml:1431
dongsheng@627 9429 msgid ""
dongsheng@627 9430 "A few <literal role=\"rc-web\">web</literal> configuration items ought to be "
dongsheng@627 9431 "placed in a repository's local <filename role=\"special\">.hg/hgrc</"
dongsheng@650 9432 "filename>, rather than a user's or global <filename role=\"special\">~/.hgrc</"
dongsheng@627 9433 "filename>."
dongsheng@627 9434 msgstr ""
dongsheng@627 9435
dongsheng@627 9436 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 9437 #: ../en/ch06-collab.xml:1436
dongsheng@627 9438 msgid ""
dongsheng@627 9439 "<envar role=\"rc-item-web\">description</envar>: String. A free-form (but "
dongsheng@627 9440 "preferably brief) string that describes the contents or purpose of the "
dongsheng@627 9441 "repository."
dongsheng@627 9442 msgstr ""
dongsheng@627 9443
dongsheng@627 9444 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 9445 #: ../en/ch06-collab.xml:1441
dongsheng@627 9446 msgid ""
dongsheng@627 9447 "<envar role=\"rc-item-web\">name</envar>: String. The name to use for the "
dongsheng@627 9448 "repository in the web interface. This overrides the default name, which is "
dongsheng@627 9449 "the last component of the repository's path."
dongsheng@627 9450 msgstr ""
dongsheng@627 9451
dongsheng@627 9452 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 9453 #: ../en/ch06-collab.xml:1449
dongsheng@627 9454 msgid ""
dongsheng@627 9455 "Options specific to the <command role=\"hg-cmd\">hg serve</command> command"
dongsheng@630 9456 msgstr "命令 <command role=\"hg-cmd\">hg serve</command> 的选项"
dongsheng@627 9457
dongsheng@627 9458 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 9459 #: ../en/ch06-collab.xml:1452
dongsheng@627 9460 msgid ""
dongsheng@627 9461 "Some of the items in the <literal role=\"rc-web\">web</literal> section of a "
dongsheng@650 9462 "<filename role=\"special\">~/.hgrc</filename> file are only for use with the "
dongsheng@650 9463 "<command role=\"hg-cmd\">hg serve</command> command."
dongsheng@627 9464 msgstr ""
dongsheng@627 9465
dongsheng@627 9466 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 9467 #: ../en/ch06-collab.xml:1458
dongsheng@627 9468 msgid ""
dongsheng@627 9469 "<envar role=\"rc-item-web\">accesslog</envar>: Path. The name of a file into "
dongsheng@627 9470 "which to write an access log. By default, the <command role=\"hg-cmd\">hg "
dongsheng@627 9471 "serve</command> command writes this information to standard output, not to a "
dongsheng@627 9472 "file. Log entries are written in the standard <quote>combined</quote> file "
dongsheng@627 9473 "format used by almost all web servers."
dongsheng@627 9474 msgstr ""
dongsheng@627 9475
dongsheng@627 9476 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 9477 #: ../en/ch06-collab.xml:1466
dongsheng@627 9478 msgid ""
dongsheng@627 9479 "<envar role=\"rc-item-web\">address</envar>: String. The local address on "
dongsheng@627 9480 "which the server should listen for incoming connections. By default, the "
dongsheng@627 9481 "server listens on all addresses."
dongsheng@627 9482 msgstr ""
dongsheng@627 9483
dongsheng@627 9484 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 9485 #: ../en/ch06-collab.xml:1471
dongsheng@627 9486 msgid ""
dongsheng@627 9487 "<envar role=\"rc-item-web\">errorlog</envar>: Path. The name of a file into "
dongsheng@627 9488 "which to write an error log. By default, the <command role=\"hg-cmd\">hg "
dongsheng@627 9489 "serve</command> command writes this information to standard error, not to a "
dongsheng@627 9490 "file."
dongsheng@627 9491 msgstr ""
dongsheng@627 9492
dongsheng@627 9493 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 9494 #: ../en/ch06-collab.xml:1477
dongsheng@627 9495 msgid ""
dongsheng@627 9496 "<envar role=\"rc-item-web\">ipv6</envar>: Boolean. Whether to use the IPv6 "
dongsheng@627 9497 "protocol. By default, IPv6 is not used."
dongsheng@627 9498 msgstr ""
dongsheng@627 9499
dongsheng@627 9500 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 9501 #: ../en/ch06-collab.xml:1481
dongsheng@627 9502 msgid ""
dongsheng@627 9503 "<envar role=\"rc-item-web\">port</envar>: Integer. The TCP port number on "
dongsheng@627 9504 "which the server should listen. The default port number used is 8000."
dongsheng@627 9505 msgstr ""
dongsheng@627 9506
dongsheng@627 9507 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 9508 #: ../en/ch06-collab.xml:1488
dongsheng@650 9509 msgid ""
dongsheng@650 9510 "Choosing the right <filename role=\"special\">~/.hgrc</filename> file to add "
dongsheng@650 9511 "<literal role=\"rc-web\">web</literal> items to"
dongsheng@627 9512 msgstr ""
dongsheng@653 9513 "选择正确的 <filename role=\"special\"> ~/.hgrc</filename> 文件增加到 <literal "
dongsheng@630 9514 "role=\"rc-web\">web</literal> 条目"
dongsheng@627 9515
dongsheng@627 9516 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 9517 #: ../en/ch06-collab.xml:1492
dongsheng@627 9518 msgid ""
dongsheng@627 9519 "It is important to remember that a web server like Apache or "
dongsheng@627 9520 "<literal>lighttpd</literal> will run under a user ID that is different to "
dongsheng@627 9521 "yours. CGI scripts run by your server, such as <filename role=\"special"
dongsheng@627 9522 "\">hgweb.cgi</filename>, will usually also run under that user ID."
dongsheng@627 9523 msgstr ""
dongsheng@627 9524
dongsheng@627 9525 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 9526 #: ../en/ch06-collab.xml:1499
dongsheng@627 9527 msgid ""
dongsheng@627 9528 "If you add <literal role=\"rc-web\">web</literal> items to your own personal "
dongsheng@650 9529 "<filename role=\"special\">~/.hgrc</filename> file, CGI scripts won't read "
dongsheng@650 9530 "that <filename role=\"special\">~/.hgrc</filename> file. Those settings will "
songdongsheng@710 9531 "thus only affect the behavior of the <command role=\"hg-cmd\">hg serve</"
dongsheng@627 9532 "command> command when you run it. To cause CGI scripts to see your settings, "
dongsheng@650 9533 "either create a <filename role=\"special\">~/.hgrc</filename> file in the "
dongsheng@627 9534 "home directory of the user ID that runs your web server, or add those "
songdongsheng@710 9535 "settings to a system-wide <filename role=\"special\">hgrc</filename> file."
songdongsheng@710 9536 msgstr ""
songdongsheng@710 9537
songdongsheng@710 9538 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 9539 #: ../en/ch06-collab.xml:1514
songdongsheng@710 9540 msgid "System-wide configuration"
songdongsheng@711 9541 msgstr "全局配置"
songdongsheng@710 9542
songdongsheng@710 9543 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9544 #: ../en/ch06-collab.xml:1516
songdongsheng@710 9545 msgid ""
songdongsheng@710 9546 "On Unix-like systems shared by multiple users (such as a server to which "
songdongsheng@710 9547 "people publish changes), it often makes sense to set up some global default "
songdongsheng@710 9548 "behaviors, such as what theme to use in web interfaces."
songdongsheng@710 9549 msgstr ""
songdongsheng@710 9550
songdongsheng@710 9551 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9552 #: ../en/ch06-collab.xml:1521
songdongsheng@710 9553 msgid ""
songdongsheng@710 9554 "If a file named <filename>/etc/mercurial/hgrc</filename> exists, Mercurial "
songdongsheng@710 9555 "will read it at startup time and apply any configuration settings it finds in "
songdongsheng@710 9556 "that file. It will also look for files ending in a <literal>.rc</literal> "
songdongsheng@710 9557 "extension in a directory named <filename>/etc/mercurial/hgrc.d</filename>, "
songdongsheng@710 9558 "and apply any configuration settings it finds in each of those files."
songdongsheng@710 9559 msgstr ""
songdongsheng@710 9560
songdongsheng@710 9561 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 9562 #: ../en/ch06-collab.xml:1530
songdongsheng@710 9563 msgid "Making Mercurial more trusting"
songdongsheng@711 9564 msgstr "让 Mercurial 更可信"
songdongsheng@710 9565
songdongsheng@710 9566 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9567 #: ../en/ch06-collab.xml:1532
songdongsheng@710 9568 msgid ""
songdongsheng@710 9569 "One situation in which a global <filename>hgrc</filename> can be useful is if "
songdongsheng@710 9570 "users are pulling changes owned by other users. By default, Mercurial will "
songdongsheng@710 9571 "not trust most of the configuration items in a <filename>.hg/hgrc</filename> "
songdongsheng@710 9572 "file inside a repository that is owned by a different user. If we clone or "
songdongsheng@710 9573 "pull changes from such a repository, Mercurial will print a warning stating "
songdongsheng@710 9574 "that it does not trust their <filename>.hg/hgrc</filename>."
songdongsheng@710 9575 msgstr ""
songdongsheng@710 9576
songdongsheng@710 9577 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9578 #: ../en/ch06-collab.xml:1541
songdongsheng@710 9579 msgid ""
songdongsheng@710 9580 "If everyone in a particular Unix group is on the same team and "
songdongsheng@710 9581 "<emphasis>should</emphasis> trust each other's configuration settings, or we "
songdongsheng@710 9582 "want to trust particular users, we can override Mercurial's skeptical "
songdongsheng@710 9583 "defaults by creating a system-wide <filename>hgrc</filename> file such as the "
songdongsheng@710 9584 "following:"
dongsheng@627 9585 msgstr ""
dongsheng@627 9586
dongsheng@627 9587 #. type: Content of: <book><chapter><title>
dongsheng@714 9588 #: ../en/ch07-filenames.xml:5
dongsheng@627 9589 msgid "File names and pattern matching"
dongsheng@627 9590 msgstr "文件名称与模式匹配"
dongsheng@627 9591
dongsheng@627 9592 #. type: Content of: <book><chapter><para>
dongsheng@714 9593 #: ../en/ch07-filenames.xml:7
dongsheng@627 9594 msgid ""
dongsheng@627 9595 "Mercurial provides mechanisms that let you work with file names in a "
dongsheng@627 9596 "consistent and expressive way."
dongsheng@627 9597 msgstr ""
dongsheng@627 9598
dongsheng@627 9599 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 9600 #: ../en/ch07-filenames.xml:11
dongsheng@627 9601 msgid "Simple file naming"
dongsheng@630 9602 msgstr "简单文件名称"
dongsheng@627 9603
dongsheng@627 9604 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9605 #: ../en/ch07-filenames.xml:13
dongsheng@627 9606 msgid ""
dongsheng@627 9607 "Mercurial uses a unified piece of machinery <quote>under the hood</quote> to "
dongsheng@627 9608 "handle file names. Every command behaves uniformly with respect to file "
dongsheng@627 9609 "names. The way in which commands work with file names is as follows."
dongsheng@627 9610 msgstr ""
dongsheng@627 9611
dongsheng@627 9612 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9613 #: ../en/ch07-filenames.xml:18
dongsheng@627 9614 msgid ""
dongsheng@627 9615 "If you explicitly name real files on the command line, Mercurial works with "
dongsheng@627 9616 "exactly those files, as you would expect. &interaction.filenames.files;"
dongsheng@627 9617 msgstr ""
dongsheng@627 9618
dongsheng@627 9619 #
dongsheng@627 9620 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9621 #: ../en/ch07-filenames.xml:22
dongsheng@627 9622 msgid ""
dongsheng@627 9623 "When you provide a directory name, Mercurial will interpret this as "
dongsheng@627 9624 "<quote>operate on every file in this directory and its subdirectories</"
dongsheng@627 9625 "quote>. Mercurial traverses the files and subdirectories in a directory in "
dongsheng@627 9626 "alphabetical order. When it encounters a subdirectory, it will traverse that "
dongsheng@627 9627 "subdirectory before continuing with the current directory."
dongsheng@627 9628 msgstr ""
dongsheng@627 9629
dongsheng@627 9630 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 9631 #: ../en/ch07-filenames.xml:33
dongsheng@627 9632 msgid "Running commands without any file names"
dongsheng@630 9633 msgstr "不提供文件名称的执行命令"
dongsheng@627 9634
dongsheng@627 9635 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9636 #: ../en/ch07-filenames.xml:35
dongsheng@627 9637 msgid ""
songdongsheng@710 9638 "Mercurial's commands that work with file names have useful default behaviors "
dongsheng@627 9639 "when you invoke them without providing any file names or patterns. What kind "
songdongsheng@710 9640 "of behavior you should expect depends on what the command does. Here are a "
dongsheng@627 9641 "few rules of thumb you can use to predict what a command is likely to do if "
dongsheng@627 9642 "you don't give it any names to work with."
dongsheng@627 9643 msgstr ""
dongsheng@627 9644
dongsheng@627 9645 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 9646 #: ../en/ch07-filenames.xml:42
dongsheng@627 9647 msgid ""
dongsheng@627 9648 "Most commands will operate on the entire working directory. This is what the "
dongsheng@627 9649 "<command role=\"hg-cmd\">hg add</command> command does, for example."
dongsheng@627 9650 msgstr ""
dongsheng@627 9651
dongsheng@627 9652 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 9653 #: ../en/ch07-filenames.xml:46
dongsheng@627 9654 msgid ""
dongsheng@627 9655 "If the command has effects that are difficult or impossible to reverse, it "
dongsheng@627 9656 "will force you to explicitly provide at least one name or pattern (see "
dongsheng@627 9657 "below). This protects you from accidentally deleting files by running "
dongsheng@627 9658 "<command role=\"hg-cmd\">hg remove</command> with no arguments, for example."
dongsheng@627 9659 msgstr ""
dongsheng@627 9660
dongsheng@627 9661 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9662 #: ../en/ch07-filenames.xml:54
dongsheng@627 9663 msgid ""
songdongsheng@710 9664 "It's easy to work around these default behaviors if they don't suit you. If "
dongsheng@627 9665 "a command normally operates on the whole working directory, you can invoke it "
dongsheng@627 9666 "on just the current directory and its subdirectories by giving it the name "
dongsheng@627 9667 "<quote><filename class=\"directory\">.</filename></quote>."
dongsheng@627 9668 msgstr ""
dongsheng@627 9669
dongsheng@627 9670 #
dongsheng@627 9671 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9672 #: ../en/ch07-filenames.xml:62
dongsheng@627 9673 msgid ""
dongsheng@627 9674 "Along the same lines, some commands normally print file names relative to the "
dongsheng@627 9675 "root of the repository, even if you're invoking them from a subdirectory. "
dongsheng@627 9676 "Such a command will print file names relative to your subdirectory if you "
dongsheng@627 9677 "give it explicit names. Here, we're going to run <command role=\"hg-cmd\">hg "
dongsheng@627 9678 "status</command> from a subdirectory, and get it to operate on the entire "
dongsheng@627 9679 "working directory while printing file names relative to our subdirectory, by "
dongsheng@627 9680 "passing it the output of the <command role=\"hg-cmd\">hg root</command> "
dongsheng@627 9681 "command."
dongsheng@627 9682 msgstr ""
dongsheng@627 9683
dongsheng@627 9684 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 9685 #: ../en/ch07-filenames.xml:76
dongsheng@627 9686 msgid "Telling you what's going on"
dongsheng@630 9687 msgstr "告诉你正在做什么"
dongsheng@627 9688
dongsheng@627 9689 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9690 #: ../en/ch07-filenames.xml:78
dongsheng@627 9691 msgid ""
dongsheng@627 9692 "The <command role=\"hg-cmd\">hg add</command> example in the preceding "
dongsheng@627 9693 "section illustrates something else that's helpful about Mercurial commands. "
dongsheng@627 9694 "If a command operates on a file that you didn't name explicitly on the "
dongsheng@627 9695 "command line, it will usually print the name of the file, so that you will "
dongsheng@627 9696 "not be surprised what's going on."
dongsheng@627 9697 msgstr ""
dongsheng@627 9698
dongsheng@627 9699 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9700 #: ../en/ch07-filenames.xml:85
dongsheng@627 9701 msgid ""
dongsheng@627 9702 "The principle here is of <emphasis>least surprise</emphasis>. If you've "
dongsheng@627 9703 "exactly named a file on the command line, there's no point in repeating it "
dongsheng@627 9704 "back at you. If Mercurial is acting on a file <emphasis>implicitly</"
songdongsheng@710 9705 "emphasis>, e.g. because you provided no names, or a directory, or a pattern "
songdongsheng@710 9706 "(see below), it is safest to tell you what files it's operating on."
dongsheng@627 9707 msgstr ""
dongsheng@627 9708
dongsheng@627 9709 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9710 #: ../en/ch07-filenames.xml:92
dongsheng@627 9711 msgid ""
dongsheng@627 9712 "For commands that behave this way, you can silence them using the <option "
dongsheng@627 9713 "role=\"hg-opt-global\">-q</option> option. You can also get them to print "
dongsheng@627 9714 "the name of every file, even those you've named explicitly, using the <option "
dongsheng@627 9715 "role=\"hg-opt-global\">-v</option> option."
dongsheng@627 9716 msgstr ""
dongsheng@627 9717
dongsheng@627 9718 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 9719 #: ../en/ch07-filenames.xml:100
dongsheng@627 9720 msgid "Using patterns to identify files"
dongsheng@630 9721 msgstr "使用模式标识文件"
dongsheng@627 9722
dongsheng@627 9723 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9724 #: ../en/ch07-filenames.xml:102
dongsheng@627 9725 msgid ""
dongsheng@627 9726 "In addition to working with file and directory names, Mercurial lets you use "
dongsheng@627 9727 "<emphasis>patterns</emphasis> to identify files. Mercurial's pattern "
dongsheng@627 9728 "handling is expressive."
dongsheng@627 9729 msgstr ""
dongsheng@627 9730
dongsheng@627 9731 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9732 #: ../en/ch07-filenames.xml:106
dongsheng@627 9733 msgid ""
dongsheng@627 9734 "On Unix-like systems (Linux, MacOS, etc.), the job of matching file names to "
dongsheng@627 9735 "patterns normally falls to the shell. On these systems, you must explicitly "
dongsheng@627 9736 "tell Mercurial that a name is a pattern. On Windows, the shell does not "
dongsheng@627 9737 "expand patterns, so Mercurial will automatically identify names that are "
dongsheng@627 9738 "patterns, and expand them for you."
dongsheng@627 9739 msgstr ""
dongsheng@627 9740
dongsheng@627 9741 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9742 #: ../en/ch07-filenames.xml:113
dongsheng@627 9743 msgid ""
dongsheng@627 9744 "To provide a pattern in place of a regular name on the command line, the "
dongsheng@627 9745 "mechanism is simple:"
dongsheng@627 9746 msgstr ""
dongsheng@627 9747
dongsheng@627 9748 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9749 #: ../en/ch07-filenames.xml:116
dongsheng@627 9750 msgid ""
dongsheng@627 9751 "That is, a pattern is identified by a short text string that says what kind "
dongsheng@627 9752 "of pattern this is, followed by a colon, followed by the actual pattern."
dongsheng@627 9753 msgstr ""
dongsheng@627 9754
dongsheng@627 9755 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9756 #: ../en/ch07-filenames.xml:120
dongsheng@627 9757 msgid ""
dongsheng@627 9758 "Mercurial supports two kinds of pattern syntax. The most frequently used is "
dongsheng@627 9759 "called <literal>glob</literal>; this is the same kind of pattern matching "
dongsheng@627 9760 "used by the Unix shell, and should be familiar to Windows command prompt "
dongsheng@627 9761 "users, too."
dongsheng@627 9762 msgstr ""
dongsheng@627 9763
dongsheng@627 9764 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9765 #: ../en/ch07-filenames.xml:125
dongsheng@627 9766 msgid ""
dongsheng@627 9767 "When Mercurial does automatic pattern matching on Windows, it uses "
dongsheng@627 9768 "<literal>glob</literal> syntax. You can thus omit the <quote><literal>glob:</"
dongsheng@627 9769 "literal></quote> prefix on Windows, but it's safe to use it, too."
dongsheng@627 9770 msgstr ""
dongsheng@627 9771
dongsheng@627 9772 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9773 #: ../en/ch07-filenames.xml:130
dongsheng@627 9774 msgid ""
dongsheng@627 9775 "The <literal>re</literal> syntax is more powerful; it lets you specify "
dongsheng@627 9776 "patterns using regular expressions, also known as regexps."
dongsheng@627 9777 msgstr ""
dongsheng@627 9778
dongsheng@627 9779 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9780 #: ../en/ch07-filenames.xml:134
dongsheng@627 9781 msgid ""
dongsheng@627 9782 "By the way, in the examples that follow, notice that I'm careful to wrap all "
dongsheng@627 9783 "of my patterns in quote characters, so that they won't get expanded by the "
dongsheng@627 9784 "shell before Mercurial sees them."
dongsheng@627 9785 msgstr ""
dongsheng@627 9786
dongsheng@627 9787 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 9788 #: ../en/ch07-filenames.xml:140
dongsheng@627 9789 msgid "Shell-style <literal>glob</literal> patterns"
dongsheng@630 9790 msgstr "外壳风格的 <literal>glob</literal> 模式"
dongsheng@627 9791
dongsheng@627 9792 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9793 #: ../en/ch07-filenames.xml:142
dongsheng@627 9794 msgid ""
dongsheng@627 9795 "This is an overview of the kinds of patterns you can use when you're matching "
dongsheng@627 9796 "on glob patterns."
dongsheng@627 9797 msgstr ""
dongsheng@627 9798
dongsheng@627 9799 #
dongsheng@627 9800 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9801 #: ../en/ch07-filenames.xml:145
dongsheng@627 9802 msgid ""
dongsheng@627 9803 "The <quote><literal>*</literal></quote> character matches any string, within "
dongsheng@627 9804 "a single directory."
dongsheng@627 9805 msgstr ""
dongsheng@627 9806
dongsheng@627 9807 #
dongsheng@627 9808 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9809 #: ../en/ch07-filenames.xml:150
dongsheng@627 9810 msgid ""
dongsheng@627 9811 "The <quote><literal>**</literal></quote> pattern matches any string, and "
dongsheng@627 9812 "crosses directory boundaries. It's not a standard Unix glob token, but it's "
dongsheng@627 9813 "accepted by several popular Unix shells, and is very useful."
dongsheng@627 9814 msgstr ""
dongsheng@627 9815
dongsheng@627 9816 #
dongsheng@627 9817 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9818 #: ../en/ch07-filenames.xml:157
dongsheng@627 9819 msgid ""
dongsheng@627 9820 "The <quote><literal>?</literal></quote> pattern matches any single character."
dongsheng@627 9821 msgstr ""
dongsheng@627 9822
dongsheng@627 9823 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9824 #: ../en/ch07-filenames.xml:162
dongsheng@627 9825 msgid ""
dongsheng@627 9826 "The <quote><literal>[</literal></quote> character begins a "
dongsheng@627 9827 "<emphasis>character class</emphasis>. This matches any single character "
dongsheng@627 9828 "within the class. The class ends with a <quote><literal>]</literal></quote> "
dongsheng@627 9829 "character. A class may contain multiple <emphasis>range</emphasis>s of the "
dongsheng@627 9830 "form <quote><literal>a-f</literal></quote>, which is shorthand for "
dongsheng@627 9831 "<quote><literal>abcdef</literal></quote>."
dongsheng@627 9832 msgstr ""
dongsheng@627 9833
dongsheng@627 9834 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9835 #: ../en/ch07-filenames.xml:172
dongsheng@627 9836 msgid ""
dongsheng@627 9837 "If the first character after the <quote><literal>[</literal></quote> in a "
dongsheng@627 9838 "character class is a <quote><literal>!</literal></quote>, it "
dongsheng@627 9839 "<emphasis>negates</emphasis> the class, making it match any single character "
dongsheng@627 9840 "not in the class."
dongsheng@627 9841 msgstr ""
dongsheng@627 9842
dongsheng@627 9843 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9844 #: ../en/ch07-filenames.xml:178
dongsheng@627 9845 msgid ""
dongsheng@627 9846 "A <quote><literal>{</literal></quote> begins a group of subpatterns, where "
dongsheng@627 9847 "the whole group matches if any subpattern in the group matches. The "
dongsheng@627 9848 "<quote><literal>,</literal></quote> character separates subpatterns, and "
dongsheng@627 9849 "<quote><literal>}</literal></quote> ends the group."
dongsheng@627 9850 msgstr ""
dongsheng@627 9851
dongsheng@627 9852 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 9853 #: ../en/ch07-filenames.xml:187
dongsheng@627 9854 msgid "Watch out!"
dongsheng@630 9855 msgstr "千万小心!"
dongsheng@627 9856
dongsheng@627 9857 #
dongsheng@627 9858 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 9859 #: ../en/ch07-filenames.xml:189
dongsheng@627 9860 msgid ""
dongsheng@627 9861 "Don't forget that if you want to match a pattern in any directory, you should "
dongsheng@627 9862 "not be using the <quote><literal>*</literal></quote> match-any token, as this "
dongsheng@627 9863 "will only match within one directory. Instead, use the <quote><literal>**</"
dongsheng@627 9864 "literal></quote> token. This small example illustrates the difference "
dongsheng@627 9865 "between the two."
dongsheng@627 9866 msgstr ""
dongsheng@627 9867
dongsheng@627 9868 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 9869 #: ../en/ch07-filenames.xml:201
dongsheng@627 9870 msgid "Regular expression matching with <literal>re</literal> patterns"
dongsheng@630 9871 msgstr "使用 <literal>re</literal> 模式的正则表达式匹配"
dongsheng@627 9872
dongsheng@627 9873 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9874 #: ../en/ch07-filenames.xml:204
dongsheng@627 9875 msgid ""
dongsheng@627 9876 "Mercurial accepts the same regular expression syntax as the Python "
dongsheng@627 9877 "programming language (it uses Python's regexp engine internally). This is "
dongsheng@627 9878 "based on the Perl language's regexp syntax, which is the most popular dialect "
dongsheng@627 9879 "in use (it's also used in Java, for example)."
dongsheng@627 9880 msgstr ""
dongsheng@627 9881
dongsheng@627 9882 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9883 #: ../en/ch07-filenames.xml:210
dongsheng@627 9884 msgid ""
dongsheng@627 9885 "I won't discuss Mercurial's regexp dialect in any detail here, as regexps are "
dongsheng@627 9886 "not often used. Perl-style regexps are in any case already exhaustively "
dongsheng@627 9887 "documented on a multitude of web sites, and in many books. Instead, I will "
dongsheng@627 9888 "focus here on a few things you should know if you find yourself needing to "
dongsheng@627 9889 "use regexps with Mercurial."
dongsheng@627 9890 msgstr ""
dongsheng@627 9891
dongsheng@627 9892 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9893 #: ../en/ch07-filenames.xml:217
dongsheng@627 9894 msgid ""
dongsheng@627 9895 "A regexp is matched against an entire file name, relative to the root of the "
dongsheng@627 9896 "repository. In other words, even if you're already in subbdirectory "
dongsheng@627 9897 "<filename class=\"directory\">foo</filename>, if you want to match files "
dongsheng@627 9898 "under this directory, your pattern must start with <quote><literal>foo/</"
dongsheng@627 9899 "literal></quote>."
dongsheng@627 9900 msgstr ""
dongsheng@627 9901
dongsheng@627 9902 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 9903 #: ../en/ch07-filenames.xml:224
dongsheng@627 9904 msgid ""
dongsheng@627 9905 "One thing to note, if you're familiar with Perl-style regexps, is that "
dongsheng@627 9906 "Mercurial's are <emphasis>rooted</emphasis>. That is, a regexp starts "
dongsheng@627 9907 "matching against the beginning of a string; it doesn't look for a match "
dongsheng@627 9908 "anywhere within the string. To match anywhere in a string, start your "
dongsheng@627 9909 "pattern with <quote><literal>.*</literal></quote>."
dongsheng@627 9910 msgstr ""
dongsheng@627 9911
dongsheng@627 9912 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 9913 #: ../en/ch07-filenames.xml:234
dongsheng@627 9914 msgid "Filtering files"
dongsheng@630 9915 msgstr "过滤文件"
dongsheng@627 9916
dongsheng@627 9917 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9918 #: ../en/ch07-filenames.xml:236
dongsheng@627 9919 msgid ""
dongsheng@627 9920 "Not only does Mercurial give you a variety of ways to specify files; it lets "
dongsheng@627 9921 "you further winnow those files using <emphasis>filters</emphasis>. Commands "
dongsheng@627 9922 "that work with file names accept two filtering options."
dongsheng@627 9923 msgstr ""
dongsheng@627 9924
dongsheng@627 9925 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 9926 #: ../en/ch07-filenames.xml:241
dongsheng@627 9927 msgid ""
dongsheng@627 9928 "<option role=\"hg-opt-global\">-I</option>, or <option role=\"hg-opt-global"
dongsheng@627 9929 "\">--include</option>, lets you specify a pattern that file names must match "
dongsheng@627 9930 "in order to be processed."
dongsheng@627 9931 msgstr ""
dongsheng@627 9932
dongsheng@627 9933 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 9934 #: ../en/ch07-filenames.xml:246
dongsheng@627 9935 msgid ""
dongsheng@627 9936 "<option role=\"hg-opt-global\">-X</option>, or <option role=\"hg-opt-global"
dongsheng@627 9937 "\">--exclude</option>, gives you a way to <emphasis>avoid</emphasis> "
dongsheng@627 9938 "processing files, if they match this pattern."
dongsheng@627 9939 msgstr ""
dongsheng@627 9940
dongsheng@627 9941 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9942 #: ../en/ch07-filenames.xml:251
dongsheng@627 9943 msgid ""
dongsheng@627 9944 "You can provide multiple <option role=\"hg-opt-global\">-I</option> and "
dongsheng@627 9945 "<option role=\"hg-opt-global\">-X</option> options on the command line, and "
dongsheng@627 9946 "intermix them as you please. Mercurial interprets the patterns you provide "
dongsheng@627 9947 "using glob syntax by default (but you can use regexps if you need to)."
dongsheng@627 9948 msgstr ""
dongsheng@627 9949
dongsheng@627 9950 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9951 #: ../en/ch07-filenames.xml:258
dongsheng@627 9952 msgid ""
dongsheng@627 9953 "You can read a <option role=\"hg-opt-global\">-I</option> filter as "
dongsheng@627 9954 "<quote>process only the files that match this filter</quote>."
dongsheng@627 9955 msgstr ""
dongsheng@627 9956
dongsheng@627 9957 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9958 #: ../en/ch07-filenames.xml:264
dongsheng@627 9959 msgid ""
dongsheng@627 9960 "The <option role=\"hg-opt-global\">-X</option> filter is best read as "
dongsheng@627 9961 "<quote>process only the files that don't match this pattern</quote>."
dongsheng@627 9962 msgstr ""
dongsheng@627 9963
dongsheng@627 9964 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 9965 #: ../en/ch07-filenames.xml:272
songdongsheng@710 9966 msgid "Permanently ignoring unwanted files and directories"
songdongsheng@711 9967 msgstr "始终忽略不需要的文件和目录"
dongsheng@627 9968
dongsheng@627 9969 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9970 #: ../en/ch07-filenames.xml:274
songdongsheng@710 9971 msgid ""
songdongsheng@710 9972 "When you create a new repository, the chances are that over time it will grow "
songdongsheng@710 9973 "to contain files that ought to <emphasis>not</emphasis> be managed by "
songdongsheng@710 9974 "Mercurial, but which you don't want to see listed every time you run "
songdongsheng@710 9975 "<command>hg status</command>. For instance, <quote>build products</quote> "
songdongsheng@710 9976 "are files that are created as part of a build but which should not be managed "
songdongsheng@710 9977 "by a revision control system. The most common build products are output "
songdongsheng@710 9978 "files produced by software tools such as compilers. As another example, many "
songdongsheng@710 9979 "text editors litter a directory with lock files, temporary working files, and "
songdongsheng@710 9980 "backup files, which it also makes no sense to manage."
songdongsheng@710 9981 msgstr ""
songdongsheng@710 9982
songdongsheng@710 9983 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9984 #: ../en/ch07-filenames.xml:286
songdongsheng@710 9985 msgid ""
songdongsheng@710 9986 "To have Mercurial permanently ignore such files, create a file named "
songdongsheng@710 9987 "<filename>.hgignore</filename> in the root of your repository. You "
songdongsheng@710 9988 "<emphasis>should</emphasis> <command>hg add</command> this file so that it "
songdongsheng@710 9989 "gets tracked with the rest of your repository contents, since your "
songdongsheng@710 9990 "collaborators will probably find it useful too."
songdongsheng@710 9991 msgstr ""
songdongsheng@710 9992
songdongsheng@710 9993 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 9994 #: ../en/ch07-filenames.xml:293
songdongsheng@710 9995 msgid ""
songdongsheng@710 9996 "By default, the <filename>.hgignore</filename> file should contain a list of "
songdongsheng@710 9997 "regular expressions, one per line. Empty lines are skipped. Most people "
songdongsheng@710 9998 "prefer to describe the files they want to ignore using the <quote>glob</"
songdongsheng@710 9999 "quote> syntax that we described above, so a typical <filename>.hgignore</"
songdongsheng@710 10000 "filename> file will start with this directive:"
songdongsheng@710 10001 msgstr ""
songdongsheng@710 10002
songdongsheng@710 10003 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10004 #: ../en/ch07-filenames.xml:302
songdongsheng@710 10005 msgid ""
songdongsheng@710 10006 "This tells Mercurial to interpret the lines that follow as glob patterns, not "
songdongsheng@710 10007 "regular expressions."
songdongsheng@710 10008 msgstr ""
songdongsheng@710 10009
songdongsheng@710 10010 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10011 #: ../en/ch07-filenames.xml:305
songdongsheng@710 10012 msgid "Here is a typical-looking <filename>.hgignore</filename> file."
dongsheng@627 10013 msgstr ""
dongsheng@627 10014
dongsheng@627 10015 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 10016 #: ../en/ch07-filenames.xml:329
dongsheng@627 10017 msgid "Case sensitivity"
dongsheng@630 10018 msgstr "大小写敏感性"
dongsheng@627 10019
dongsheng@627 10020 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10021 #: ../en/ch07-filenames.xml:331
dongsheng@627 10022 msgid ""
dongsheng@627 10023 "If you're working in a mixed development environment that contains both Linux "
dongsheng@627 10024 "(or other Unix) systems and Macs or Windows systems, you should keep in the "
dongsheng@627 10025 "back of your mind the knowledge that they treat the case (<quote>N</quote> "
dongsheng@627 10026 "versus <quote>n</quote>) of file names in incompatible ways. This is not "
dongsheng@627 10027 "very likely to affect you, and it's easy to deal with if it does, but it "
dongsheng@627 10028 "could surprise you if you don't know about it."
dongsheng@627 10029 msgstr ""
dongsheng@627 10030
dongsheng@627 10031 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10032 #: ../en/ch07-filenames.xml:340
dongsheng@627 10033 msgid ""
dongsheng@627 10034 "Operating systems and filesystems differ in the way they handle the "
dongsheng@627 10035 "<emphasis>case</emphasis> of characters in file and directory names. There "
dongsheng@627 10036 "are three common ways to handle case in names."
dongsheng@627 10037 msgstr ""
dongsheng@627 10038
dongsheng@627 10039 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 10040 #: ../en/ch07-filenames.xml:345
dongsheng@627 10041 msgid ""
dongsheng@627 10042 "Completely case insensitive. Uppercase and lowercase versions of a letter "
dongsheng@627 10043 "are treated as identical, both when creating a file and during subsequent "
dongsheng@627 10044 "accesses. This is common on older DOS-based systems."
dongsheng@627 10045 msgstr ""
dongsheng@627 10046
dongsheng@627 10047 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 10048 #: ../en/ch07-filenames.xml:350
dongsheng@627 10049 msgid ""
dongsheng@627 10050 "Case preserving, but insensitive. When a file or directory is created, the "
dongsheng@627 10051 "case of its name is stored, and can be retrieved and displayed by the "
dongsheng@627 10052 "operating system. When an existing file is being looked up, its case is "
dongsheng@627 10053 "ignored. This is the standard arrangement on Windows and MacOS. The names "
dongsheng@627 10054 "<filename>foo</filename> and <filename>FoO</filename> identify the same "
dongsheng@627 10055 "file. This treatment of uppercase and lowercase letters as interchangeable "
dongsheng@627 10056 "is also referred to as <emphasis>case folding</emphasis>."
dongsheng@627 10057 msgstr ""
dongsheng@627 10058
dongsheng@627 10059 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 10060 #: ../en/ch07-filenames.xml:361
dongsheng@627 10061 msgid ""
dongsheng@627 10062 "Case sensitive. The case of a name is significant at all times. The names "
dongsheng@714 10063 "<filename>foo</filename> and <filename>FoO</filename> identify different "
dongsheng@714 10064 "files. This is the way Linux and Unix systems normally work."
dongsheng@714 10065 msgstr ""
dongsheng@714 10066
dongsheng@714 10067 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10068 #: ../en/ch07-filenames.xml:368
dongsheng@627 10069 msgid ""
dongsheng@627 10070 "On Unix-like systems, it is possible to have any or all of the above ways of "
dongsheng@627 10071 "handling case in action at once. For example, if you use a USB thumb drive "
dongsheng@627 10072 "formatted with a FAT32 filesystem on a Linux system, Linux will handle names "
dongsheng@627 10073 "on that filesystem in a case preserving, but insensitive, way."
dongsheng@627 10074 msgstr ""
dongsheng@627 10075
dongsheng@627 10076 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 10077 #: ../en/ch07-filenames.xml:375
dongsheng@627 10078 msgid "Safe, portable repository storage"
dongsheng@630 10079 msgstr "安全,可移植的版本库存储"
dongsheng@627 10080
dongsheng@627 10081 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10082 #: ../en/ch07-filenames.xml:377
dongsheng@627 10083 msgid ""
dongsheng@627 10084 "Mercurial's repository storage mechanism is <emphasis>case safe</emphasis>. "
dongsheng@627 10085 "It translates file names so that they can be safely stored on both case "
dongsheng@627 10086 "sensitive and case insensitive filesystems. This means that you can use "
dongsheng@627 10087 "normal file copying tools to transfer a Mercurial repository onto, for "
dongsheng@627 10088 "example, a USB thumb drive, and safely move that drive and repository back "
dongsheng@627 10089 "and forth between a Mac, a PC running Windows, and a Linux box."
dongsheng@627 10090 msgstr ""
dongsheng@627 10091
dongsheng@627 10092 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 10093 #: ../en/ch07-filenames.xml:388
dongsheng@627 10094 msgid "Detecting case conflicts"
dongsheng@630 10095 msgstr "检测大小写冲突"
dongsheng@627 10096
dongsheng@627 10097 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10098 #: ../en/ch07-filenames.xml:390
dongsheng@627 10099 msgid ""
dongsheng@627 10100 "When operating in the working directory, Mercurial honours the naming policy "
dongsheng@627 10101 "of the filesystem where the working directory is located. If the filesystem "
dongsheng@627 10102 "is case preserving, but insensitive, Mercurial will treat names that differ "
dongsheng@627 10103 "only in case as the same."
dongsheng@627 10104 msgstr ""
dongsheng@627 10105
dongsheng@627 10106 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10107 #: ../en/ch07-filenames.xml:396
dongsheng@627 10108 msgid ""
dongsheng@627 10109 "An important aspect of this approach is that it is possible to commit a "
dongsheng@627 10110 "changeset on a case sensitive (typically Linux or Unix) filesystem that will "
dongsheng@627 10111 "cause trouble for users on case insensitive (usually Windows and MacOS) "
dongsheng@627 10112 "users. If a Linux user commits changes to two files, one named "
dongsheng@627 10113 "<filename>myfile.c</filename> and the other named <filename>MyFile.C</"
dongsheng@627 10114 "filename>, they will be stored correctly in the repository. And in the "
dongsheng@627 10115 "working directories of other Linux users, they will be correctly represented "
dongsheng@627 10116 "as separate files."
dongsheng@627 10117 msgstr ""
dongsheng@627 10118
dongsheng@627 10119 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10120 #: ../en/ch07-filenames.xml:407
dongsheng@627 10121 msgid ""
dongsheng@627 10122 "If a Windows or Mac user pulls this change, they will not initially have a "
dongsheng@627 10123 "problem, because Mercurial's repository storage mechanism is case safe. "
dongsheng@627 10124 "However, once they try to <command role=\"hg-cmd\">hg update</command> the "
dongsheng@627 10125 "working directory to that changeset, or <command role=\"hg-cmd\">hg merge</"
dongsheng@627 10126 "command> with that changeset, Mercurial will spot the conflict between the "
dongsheng@627 10127 "two file names that the filesystem would treat as the same, and forbid the "
dongsheng@627 10128 "update or merge from occurring."
dongsheng@627 10129 msgstr ""
dongsheng@627 10130
dongsheng@627 10131 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 10132 #: ../en/ch07-filenames.xml:419
dongsheng@627 10133 msgid "Fixing a case conflict"
dongsheng@630 10134 msgstr "修正大小写冲突"
dongsheng@627 10135
dongsheng@627 10136 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10137 #: ../en/ch07-filenames.xml:421
dongsheng@627 10138 msgid ""
dongsheng@627 10139 "If you are using Windows or a Mac in a mixed environment where some of your "
dongsheng@627 10140 "collaborators are using Linux or Unix, and Mercurial reports a case folding "
dongsheng@627 10141 "conflict when you try to <command role=\"hg-cmd\">hg update</command> or "
dongsheng@627 10142 "<command role=\"hg-cmd\">hg merge</command>, the procedure to fix the problem "
dongsheng@627 10143 "is simple."
dongsheng@627 10144 msgstr ""
dongsheng@627 10145
dongsheng@627 10146 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10147 #: ../en/ch07-filenames.xml:428
dongsheng@627 10148 msgid ""
dongsheng@627 10149 "Just find a nearby Linux or Unix box, clone the problem repository onto it, "
dongsheng@627 10150 "and use Mercurial's <command role=\"hg-cmd\">hg rename</command> command to "
dongsheng@627 10151 "change the names of any offending files or directories so that they will no "
dongsheng@627 10152 "longer cause case folding conflicts. Commit this change, <command role=\"hg-"
dongsheng@627 10153 "cmd\">hg pull</command> or <command role=\"hg-cmd\">hg push</command> it "
dongsheng@627 10154 "across to your Windows or MacOS system, and <command role=\"hg-cmd\">hg "
dongsheng@627 10155 "update</command> to the revision with the non-conflicting names."
dongsheng@627 10156 msgstr ""
dongsheng@627 10157
dongsheng@627 10158 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10159 #: ../en/ch07-filenames.xml:438
dongsheng@627 10160 msgid ""
dongsheng@627 10161 "The changeset with case-conflicting names will remain in your project's "
dongsheng@627 10162 "history, and you still won't be able to <command role=\"hg-cmd\">hg update</"
dongsheng@627 10163 "command> your working directory to that changeset on a Windows or MacOS "
dongsheng@627 10164 "system, but you can continue development unimpeded."
dongsheng@627 10165 msgstr ""
dongsheng@627 10166
dongsheng@627 10167 #. type: Content of: <book><chapter><title>
dongsheng@714 10168 #: ../en/ch08-branch.xml:5
dongsheng@627 10169 msgid "Managing releases and branchy development"
dongsheng@627 10170 msgstr "发布管理与分支开发"
dongsheng@627 10171
dongsheng@627 10172 #. type: Content of: <book><chapter><para>
dongsheng@714 10173 #: ../en/ch08-branch.xml:7
dongsheng@627 10174 msgid ""
dongsheng@627 10175 "Mercurial provides several mechanisms for you to manage a project that is "
dongsheng@627 10176 "making progress on multiple fronts at once. To understand these mechanisms, "
dongsheng@627 10177 "let's first take a brief look at a fairly normal software project structure."
dongsheng@627 10178 msgstr ""
dongsheng@627 10179
dongsheng@627 10180 #. type: Content of: <book><chapter><para>
dongsheng@714 10181 #: ../en/ch08-branch.xml:12
dongsheng@627 10182 msgid ""
dongsheng@627 10183 "Many software projects issue periodic <quote>major</quote> releases that "
dongsheng@627 10184 "contain substantial new features. In parallel, they may issue <quote>minor</"
dongsheng@627 10185 "quote> releases. These are usually identical to the major releases off which "
dongsheng@627 10186 "they're based, but with a few bugs fixed."
dongsheng@627 10187 msgstr ""
dongsheng@627 10188
dongsheng@627 10189 #. type: Content of: <book><chapter><para>
dongsheng@714 10190 #: ../en/ch08-branch.xml:18
dongsheng@627 10191 msgid ""
dongsheng@627 10192 "In this chapter, we'll start by talking about how to keep records of project "
dongsheng@627 10193 "milestones such as releases. We'll then continue on to talk about the flow "
dongsheng@627 10194 "of work between different phases of a project, and how Mercurial can help you "
dongsheng@627 10195 "to isolate and manage this work."
dongsheng@627 10196 msgstr ""
dongsheng@627 10197
dongsheng@627 10198 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 10199 #: ../en/ch08-branch.xml:25
dongsheng@627 10200 msgid "Giving a persistent name to a revision"
dongsheng@635 10201 msgstr "给版本指定一个永久的名称"
dongsheng@627 10202
dongsheng@627 10203 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10204 #: ../en/ch08-branch.xml:27
dongsheng@627 10205 msgid ""
dongsheng@627 10206 "Once you decide that you'd like to call a particular revision a "
dongsheng@627 10207 "<quote>release</quote>, it's a good idea to record the identity of that "
dongsheng@627 10208 "revision. This will let you reproduce that release at a later date, for "
dongsheng@627 10209 "whatever purpose you might need at the time (reproducing a bug, porting to a "
dongsheng@627 10210 "new platform, etc). &interaction.tag.init;"
dongsheng@627 10211 msgstr ""
dongsheng@627 10212
dongsheng@627 10213 #
dongsheng@627 10214 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10215 #: ../en/ch08-branch.xml:34
dongsheng@627 10216 msgid ""
dongsheng@627 10217 "Mercurial lets you give a permanent name to any revision using the <command "
dongsheng@627 10218 "role=\"hg-cmd\">hg tag</command> command. Not surprisingly, these names are "
dongsheng@627 10219 "called <quote>tags</quote>."
dongsheng@627 10220 msgstr ""
dongsheng@627 10221
dongsheng@627 10222 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10223 #: ../en/ch08-branch.xml:40
dongsheng@627 10224 msgid ""
dongsheng@627 10225 "A tag is nothing more than a <quote>symbolic name</quote> for a revision. "
dongsheng@627 10226 "Tags exist purely for your convenience, so that you have a handy permanent "
dongsheng@627 10227 "way to refer to a revision; Mercurial doesn't interpret the tag names you use "
dongsheng@627 10228 "in any way. Neither does Mercurial place any restrictions on the name of a "
dongsheng@627 10229 "tag, beyond a few that are necessary to ensure that a tag can be parsed "
dongsheng@627 10230 "unambiguously. A tag name cannot contain any of the following characters:"
dongsheng@627 10231 msgstr ""
dongsheng@627 10232
dongsheng@627 10233 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 10234 #: ../en/ch08-branch.xml:49
dongsheng@627 10235 msgid "Colon (ASCII 58, <quote><literal>:</literal></quote>)"
dongsheng@627 10236 msgstr ""
dongsheng@627 10237
dongsheng@627 10238 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 10239 #: ../en/ch08-branch.xml:52
dongsheng@627 10240 msgid "Carriage return (ASCII 13, <quote><literal>\\r</literal></quote>)"
dongsheng@627 10241 msgstr ""
dongsheng@627 10242
dongsheng@627 10243 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 10244 #: ../en/ch08-branch.xml:55
dongsheng@627 10245 msgid "Newline (ASCII 10, <quote><literal>\\n</literal></quote>)"
dongsheng@627 10246 msgstr ""
dongsheng@627 10247
dongsheng@627 10248 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10249 #: ../en/ch08-branch.xml:59
dongsheng@627 10250 msgid ""
dongsheng@627 10251 "You can use the <command role=\"hg-cmd\">hg tags</command> command to display "
dongsheng@627 10252 "the tags present in your repository. In the output, each tagged revision is "
dongsheng@627 10253 "identified first by its name, then by revision number, and finally by the "
dongsheng@627 10254 "unique hash of the revision."
dongsheng@627 10255 msgstr ""
dongsheng@627 10256
dongsheng@627 10257 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10258 #: ../en/ch08-branch.xml:67
dongsheng@627 10259 msgid ""
dongsheng@627 10260 "Notice that <literal>tip</literal> is listed in the output of <command role="
dongsheng@627 10261 "\"hg-cmd\">hg tags</command>. The <literal>tip</literal> tag is a special "
dongsheng@627 10262 "<quote>floating</quote> tag, which always identifies the newest revision in "
dongsheng@627 10263 "the repository."
dongsheng@627 10264 msgstr ""
dongsheng@627 10265
dongsheng@627 10266 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10267 #: ../en/ch08-branch.xml:73
dongsheng@627 10268 msgid ""
dongsheng@627 10269 "In the output of the <command role=\"hg-cmd\">hg tags</command> command, tags "
dongsheng@627 10270 "are listed in reverse order, by revision number. This usually means that "
dongsheng@627 10271 "recent tags are listed before older tags. It also means that <literal>tip</"
dongsheng@627 10272 "literal> is always going to be the first tag listed in the output of <command "
dongsheng@627 10273 "role=\"hg-cmd\">hg tags</command>."
dongsheng@627 10274 msgstr ""
dongsheng@627 10275
dongsheng@627 10276 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10277 #: ../en/ch08-branch.xml:80
dongsheng@627 10278 msgid ""
dongsheng@627 10279 "When you run <command role=\"hg-cmd\">hg log</command>, if it displays a "
dongsheng@627 10280 "revision that has tags associated with it, it will print those tags."
dongsheng@627 10281 msgstr ""
dongsheng@627 10282
dongsheng@627 10283 #
dongsheng@627 10284 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10285 #: ../en/ch08-branch.xml:86
dongsheng@627 10286 msgid ""
dongsheng@627 10287 "Any time you need to provide a revision ID to a Mercurial command, the "
dongsheng@627 10288 "command will accept a tag name in its place. Internally, Mercurial will "
dongsheng@627 10289 "translate your tag name into the corresponding revision ID, then use that."
dongsheng@627 10290 msgstr ""
dongsheng@627 10291
dongsheng@627 10292 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10293 #: ../en/ch08-branch.xml:93
dongsheng@627 10294 msgid ""
dongsheng@627 10295 "There's no limit on the number of tags you can have in a repository, or on "
dongsheng@627 10296 "the number of tags that a single revision can have. As a practical matter, "
dongsheng@627 10297 "it's not a great idea to have <quote>too many</quote> (a number which will "
dongsheng@627 10298 "vary from project to project), simply because tags are supposed to help you "
dongsheng@627 10299 "to find revisions. If you have lots of tags, the ease of using them to "
dongsheng@627 10300 "identify revisions diminishes rapidly."
dongsheng@627 10301 msgstr ""
dongsheng@627 10302
dongsheng@627 10303 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10304 #: ../en/ch08-branch.xml:101
dongsheng@627 10305 msgid ""
dongsheng@627 10306 "For example, if your project has milestones as frequent as every few days, "
dongsheng@627 10307 "it's perfectly reasonable to tag each one of those. But if you have a "
dongsheng@627 10308 "continuous build system that makes sure every revision can be built cleanly, "
dongsheng@627 10309 "you'd be introducing a lot of noise if you were to tag every clean build. "
dongsheng@627 10310 "Instead, you could tag failed builds (on the assumption that they're rare!), "
dongsheng@627 10311 "or simply not use tags to track buildability."
dongsheng@627 10312 msgstr ""
dongsheng@627 10313
dongsheng@627 10314 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10315 #: ../en/ch08-branch.xml:109
dongsheng@627 10316 msgid ""
dongsheng@627 10317 "If you want to remove a tag that you no longer want, use <command role=\"hg-"
dongsheng@627 10318 "cmd\">hg tag --remove</command>."
dongsheng@627 10319 msgstr ""
dongsheng@627 10320
dongsheng@627 10321 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10322 #: ../en/ch08-branch.xml:114
dongsheng@627 10323 msgid ""
dongsheng@627 10324 "You can also modify a tag at any time, so that it identifies a different "
dongsheng@627 10325 "revision, by simply issuing a new <command role=\"hg-cmd\">hg tag</command> "
dongsheng@627 10326 "command. You'll have to use the <option role=\"hg-opt-tag\">-f</option> "
dongsheng@627 10327 "option to tell Mercurial that you <emphasis>really</emphasis> want to update "
dongsheng@627 10328 "the tag."
dongsheng@627 10329 msgstr ""
dongsheng@627 10330
dongsheng@627 10331 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10332 #: ../en/ch08-branch.xml:123
dongsheng@627 10333 msgid ""
dongsheng@627 10334 "There will still be a permanent record of the previous identity of the tag, "
dongsheng@627 10335 "but Mercurial will no longer use it. There's thus no penalty to tagging the "
dongsheng@627 10336 "wrong revision; all you have to do is turn around and tag the correct "
dongsheng@627 10337 "revision once you discover your error."
dongsheng@627 10338 msgstr ""
dongsheng@627 10339
dongsheng@627 10340 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10341 #: ../en/ch08-branch.xml:129
dongsheng@627 10342 msgid ""
dongsheng@627 10343 "Mercurial stores tags in a normal revision-controlled file in your "
songdongsheng@710 10344 "repository. If you've created any tags, you'll find them in a file in the "
songdongsheng@710 10345 "root of your repository named <filename role=\"special\">.hgtags</filename>. "
songdongsheng@710 10346 "When you run the <command role=\"hg-cmd\">hg tag</command> command, Mercurial "
songdongsheng@710 10347 "modifies this file, then automatically commits the change to it. This means "
songdongsheng@710 10348 "that every time you run <command role=\"hg-cmd\">hg tag</command>, you'll see "
songdongsheng@710 10349 "a corresponding changeset in the output of <command role=\"hg-cmd\">hg log</"
songdongsheng@710 10350 "command>."
dongsheng@627 10351 msgstr ""
dongsheng@627 10352
dongsheng@627 10353 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 10354 #: ../en/ch08-branch.xml:142
dongsheng@627 10355 msgid "Handling tag conflicts during a merge"
dongsheng@635 10356 msgstr "在合并期间处理标签冲突"
dongsheng@627 10357
dongsheng@627 10358 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10359 #: ../en/ch08-branch.xml:144
dongsheng@627 10360 msgid ""
dongsheng@627 10361 "You won't often need to care about the <filename role=\"special\">.hgtags</"
dongsheng@627 10362 "filename> file, but it sometimes makes its presence known during a merge. "
dongsheng@627 10363 "The format of the file is simple: it consists of a series of lines. Each "
dongsheng@627 10364 "line starts with a changeset hash, followed by a space, followed by the name "
dongsheng@627 10365 "of a tag."
dongsheng@627 10366 msgstr ""
dongsheng@627 10367
dongsheng@627 10368 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10369 #: ../en/ch08-branch.xml:151
dongsheng@627 10370 msgid ""
dongsheng@627 10371 "If you're resolving a conflict in the <filename role=\"special\">.hgtags</"
dongsheng@627 10372 "filename> file during a merge, there's one twist to modifying the <filename "
dongsheng@627 10373 "role=\"special\">.hgtags</filename> file: when Mercurial is parsing the tags "
dongsheng@627 10374 "in a repository, it <emphasis>never</emphasis> reads the working copy of the "
dongsheng@627 10375 "<filename role=\"special\">.hgtags</filename> file. Instead, it reads the "
dongsheng@627 10376 "<emphasis>most recently committed</emphasis> revision of the file."
dongsheng@627 10377 msgstr ""
dongsheng@627 10378
dongsheng@627 10379 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10380 #: ../en/ch08-branch.xml:161
dongsheng@627 10381 msgid ""
dongsheng@627 10382 "An unfortunate consequence of this design is that you can't actually verify "
dongsheng@627 10383 "that your merged <filename role=\"special\">.hgtags</filename> file is "
dongsheng@627 10384 "correct until <emphasis>after</emphasis> you've committed a change. So if "
dongsheng@627 10385 "you find yourself resolving a conflict on <filename role=\"special\">.hgtags</"
dongsheng@627 10386 "filename> during a merge, be sure to run <command role=\"hg-cmd\">hg tags</"
dongsheng@627 10387 "command> after you commit. If it finds an error in the <filename role="
dongsheng@627 10388 "\"special\">.hgtags</filename> file, it will report the location of the "
dongsheng@627 10389 "error, which you can then fix and commit. You should then run <command role="
dongsheng@627 10390 "\"hg-cmd\">hg tags</command> again, just to be sure that your fix is correct."
dongsheng@627 10391 msgstr ""
dongsheng@627 10392
dongsheng@627 10393 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 10394 #: ../en/ch08-branch.xml:176
dongsheng@627 10395 msgid "Tags and cloning"
dongsheng@635 10396 msgstr "标签与克隆"
dongsheng@627 10397
dongsheng@627 10398 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10399 #: ../en/ch08-branch.xml:178
dongsheng@627 10400 msgid ""
dongsheng@627 10401 "You may have noticed that the <command role=\"hg-cmd\">hg clone</command> "
dongsheng@627 10402 "command has a <option role=\"hg-opt-clone\">-r</option> option that lets you "
dongsheng@627 10403 "clone an exact copy of the repository as of a particular changeset. The new "
dongsheng@627 10404 "clone will not contain any project history that comes after the revision you "
dongsheng@627 10405 "specified. This has an interaction with tags that can surprise the unwary."
dongsheng@627 10406 msgstr ""
dongsheng@627 10407
dongsheng@627 10408 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10409 #: ../en/ch08-branch.xml:186
dongsheng@627 10410 msgid ""
dongsheng@627 10411 "Recall that a tag is stored as a revision to the <filename role=\"special\">."
dongsheng@714 10412 "hgtags</filename> file. When you create a tag, the changeset in which its "
dongsheng@714 10413 "recorded refers to an older changeset. When you run <command role=\"hg-cmd"
dongsheng@714 10414 "\">hg clone -r foo</command> to clone a repository as of tag <literal>foo</"
dongsheng@714 10415 "literal>, the new clone <emphasis>will not contain any revision newer than "
dongsheng@714 10416 "the one the tag refers to, including the revision where the tag was created</"
dongsheng@714 10417 "emphasis>. The result is that you'll get exactly the right subset of the "
dongsheng@627 10418 "project's history in the new repository, but <emphasis>not</emphasis> the tag "
dongsheng@627 10419 "you might have expected."
dongsheng@627 10420 msgstr ""
dongsheng@627 10421
dongsheng@627 10422 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 10423 #: ../en/ch08-branch.xml:201
dongsheng@627 10424 msgid "When permanent tags are too much"
dongsheng@635 10425 msgstr "当永久标签太多的时候"
dongsheng@627 10426
dongsheng@627 10427 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10428 #: ../en/ch08-branch.xml:203
dongsheng@627 10429 msgid ""
dongsheng@627 10430 "Since Mercurial's tags are revision controlled and carried around with a "
dongsheng@627 10431 "project's history, everyone you work with will see the tags you create. But "
dongsheng@627 10432 "giving names to revisions has uses beyond simply noting that revision "
dongsheng@627 10433 "<literal>4237e45506ee</literal> is really <literal>v2.0.2</literal>. If "
dongsheng@627 10434 "you're trying to track down a subtle bug, you might want a tag to remind you "
dongsheng@627 10435 "of something like <quote>Anne saw the symptoms with this revision</quote>."
dongsheng@627 10436 msgstr ""
dongsheng@627 10437
dongsheng@627 10438 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10439 #: ../en/ch08-branch.xml:213
dongsheng@627 10440 msgid ""
dongsheng@627 10441 "For cases like this, what you might want to use are <emphasis>local</"
dongsheng@627 10442 "emphasis> tags. You can create a local tag with the <option role=\"hg-opt-tag"
dongsheng@627 10443 "\">-l</option> option to the <command role=\"hg-cmd\">hg tag</command> "
dongsheng@627 10444 "command. This will store the tag in a file called <filename role=\"special"
dongsheng@627 10445 "\">.hg/localtags</filename>. Unlike <filename role=\"special\">.hgtags</"
dongsheng@627 10446 "filename>, <filename role=\"special\">.hg/localtags</filename> is not "
dongsheng@627 10447 "revision controlled. Any tags you create using <option role=\"hg-opt-tag\">-"
dongsheng@627 10448 "l</option> remain strictly local to the repository you're currently working "
dongsheng@627 10449 "in."
dongsheng@627 10450 msgstr ""
dongsheng@627 10451
dongsheng@627 10452 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 10453 #: ../en/ch08-branch.xml:228
songdongsheng@668 10454 msgid "The flow of changes&emdash;big picture vs. little"
dongsheng@661 10455 msgstr "修改流程—宏观与微观"
dongsheng@627 10456
dongsheng@627 10457 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10458 #: ../en/ch08-branch.xml:230
dongsheng@714 10459 msgid ""
dongsheng@714 10460 "To return to the outline I sketched at the beginning of the chapter, let's "
dongsheng@627 10461 "think about a project that has multiple concurrent pieces of work under "
dongsheng@627 10462 "development at once."
dongsheng@627 10463 msgstr ""
dongsheng@627 10464
dongsheng@627 10465 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10466 #: ../en/ch08-branch.xml:235
dongsheng@627 10467 msgid ""
dongsheng@627 10468 "There might be a push for a new <quote>main</quote> release; a new minor "
dongsheng@627 10469 "bugfix release to the last main release; and an unexpected <quote>hot fix</"
dongsheng@627 10470 "quote> to an old release that is now in maintenance mode."
dongsheng@627 10471 msgstr ""
dongsheng@627 10472
dongsheng@627 10473 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10474 #: ../en/ch08-branch.xml:240
dongsheng@627 10475 msgid ""
dongsheng@627 10476 "The usual way people refer to these different concurrent directions of "
dongsheng@627 10477 "development is as <quote>branches</quote>. However, we've already seen "
dongsheng@627 10478 "numerous times that Mercurial treats <emphasis>all of history</emphasis> as a "
dongsheng@627 10479 "series of branches and merges. Really, what we have here is two ideas that "
dongsheng@627 10480 "are peripherally related, but which happen to share a name."
dongsheng@627 10481 msgstr ""
dongsheng@627 10482
dongsheng@627 10483 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 10484 #: ../en/ch08-branch.xml:247
dongsheng@627 10485 msgid ""
dongsheng@627 10486 "<quote>Big picture</quote> branches represent the sweep of a project's "
dongsheng@627 10487 "evolution; people give them names, and talk about them in conversation."
dongsheng@627 10488 msgstr ""
dongsheng@627 10489
dongsheng@627 10490 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 10491 #: ../en/ch08-branch.xml:251
dongsheng@627 10492 msgid ""
dongsheng@627 10493 "<quote>Little picture</quote> branches are artefacts of the day-to-day "
dongsheng@627 10494 "activity of developing and merging changes. They expose the narrative of how "
dongsheng@627 10495 "the code was developed."
dongsheng@627 10496 msgstr ""
dongsheng@627 10497
dongsheng@627 10498 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 10499 #: ../en/ch08-branch.xml:259
dongsheng@627 10500 msgid "Managing big-picture branches in repositories"
dongsheng@635 10501 msgstr "在版本库中管理分支"
dongsheng@627 10502
dongsheng@627 10503 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10504 #: ../en/ch08-branch.xml:261
dongsheng@627 10505 msgid ""
dongsheng@627 10506 "The easiest way to isolate a <quote>big picture</quote> branch in Mercurial "
songdongsheng@668 10507 "is in a dedicated repository. If you have an existing shared "
songdongsheng@668 10508 "repository&emdash;let's call it <literal>myproject</literal>&emdash;that "
songdongsheng@668 10509 "reaches a <quote>1.0</quote> milestone, you can start to prepare for future "
songdongsheng@668 10510 "maintenance releases on top of version 1.0 by tagging the revision from which "
songdongsheng@668 10511 "you prepared the 1.0 release."
dongsheng@627 10512 msgstr ""
dongsheng@627 10513
dongsheng@627 10514 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10515 #: ../en/ch08-branch.xml:271
dongsheng@627 10516 msgid ""
dongsheng@627 10517 "You can then clone a new shared <literal>myproject-1.0.1</literal> repository "
dongsheng@627 10518 "as of that tag."
dongsheng@627 10519 msgstr ""
dongsheng@627 10520
dongsheng@627 10521 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10522 #: ../en/ch08-branch.xml:277
dongsheng@627 10523 msgid ""
dongsheng@627 10524 "Afterwards, if someone needs to work on a bug fix that ought to go into an "
dongsheng@627 10525 "upcoming 1.0.1 minor release, they clone the <literal>myproject-1.0.1</"
dongsheng@627 10526 "literal> repository, make their changes, and push them back."
dongsheng@627 10527 msgstr ""
dongsheng@627 10528
dongsheng@627 10529 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10530 #: ../en/ch08-branch.xml:284
dongsheng@627 10531 msgid ""
dongsheng@627 10532 "Meanwhile, development for the next major release can continue, isolated and "
dongsheng@627 10533 "unabated, in the <literal>myproject</literal> repository."
dongsheng@627 10534 msgstr ""
dongsheng@627 10535
dongsheng@627 10536 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 10537 #: ../en/ch08-branch.xml:292
dongsheng@627 10538 msgid "Don't repeat yourself: merging across branches"
dongsheng@635 10539 msgstr "不要重复劳动:在分支间合并"
dongsheng@627 10540
dongsheng@627 10541 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10542 #: ../en/ch08-branch.xml:294
dongsheng@627 10543 msgid ""
dongsheng@627 10544 "In many cases, if you have a bug to fix on a maintenance branch, the chances "
dongsheng@627 10545 "are good that the bug exists on your project's main branch (and possibly "
dongsheng@627 10546 "other maintenance branches, too). It's a rare developer who wants to fix the "
dongsheng@627 10547 "same bug multiple times, so let's look at a few ways that Mercurial can help "
dongsheng@627 10548 "you to manage these bugfixes without duplicating your work."
dongsheng@627 10549 msgstr ""
dongsheng@627 10550
dongsheng@627 10551 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10552 #: ../en/ch08-branch.xml:302
dongsheng@627 10553 msgid ""
dongsheng@627 10554 "In the simplest instance, all you need to do is pull changes from your "
dongsheng@627 10555 "maintenance branch into your local clone of the target branch."
dongsheng@627 10556 msgstr ""
dongsheng@627 10557
dongsheng@627 10558 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10559 #: ../en/ch08-branch.xml:308
dongsheng@627 10560 msgid ""
dongsheng@627 10561 "You'll then need to merge the heads of the two branches, and push back to the "
dongsheng@627 10562 "main branch."
dongsheng@627 10563 msgstr ""
dongsheng@627 10564
dongsheng@627 10565 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 10566 #: ../en/ch08-branch.xml:315
dongsheng@627 10567 msgid "Naming branches within one repository"
dongsheng@635 10568 msgstr "版本库中的命名分支"
dongsheng@627 10569
dongsheng@627 10570 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10571 #: ../en/ch08-branch.xml:317
dongsheng@627 10572 msgid ""
dongsheng@627 10573 "In most instances, isolating branches in repositories is the right approach. "
dongsheng@627 10574 "Its simplicity makes it easy to understand; and so it's hard to make "
dongsheng@627 10575 "mistakes. There's a one-to-one relationship between branches you're working "
dongsheng@627 10576 "in and directories on your system. This lets you use normal (non-Mercurial-"
dongsheng@627 10577 "aware) tools to work on files within a branch/repository."
dongsheng@627 10578 msgstr ""
dongsheng@627 10579
dongsheng@627 10580 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10581 #: ../en/ch08-branch.xml:324
dongsheng@627 10582 msgid ""
dongsheng@627 10583 "If you're more in the <quote>power user</quote> category (<emphasis>and</"
dongsheng@627 10584 "emphasis> your collaborators are too), there is an alternative way of "
dongsheng@627 10585 "handling branches that you can consider. I've already mentioned the human-"
dongsheng@627 10586 "level distinction between <quote>small picture</quote> and <quote>big "
dongsheng@627 10587 "picture</quote> branches. While Mercurial works with multiple <quote>small "
dongsheng@627 10588 "picture</quote> branches in a repository all the time (for example after you "
dongsheng@627 10589 "pull changes in, but before you merge them), it can <emphasis>also</emphasis> "
dongsheng@627 10590 "work with multiple <quote>big picture</quote> branches."
dongsheng@627 10591 msgstr ""
dongsheng@627 10592
dongsheng@627 10593 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10594 #: ../en/ch08-branch.xml:335
dongsheng@627 10595 msgid ""
dongsheng@627 10596 "The key to working this way is that Mercurial lets you assign a persistent "
dongsheng@627 10597 "<emphasis>name</emphasis> to a branch. There always exists a branch named "
dongsheng@627 10598 "<literal>default</literal>. Even before you start naming branches yourself, "
dongsheng@627 10599 "you can find traces of the <literal>default</literal> branch if you look for "
dongsheng@627 10600 "them."
dongsheng@627 10601 msgstr ""
dongsheng@627 10602
dongsheng@627 10603 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10604 #: ../en/ch08-branch.xml:342
dongsheng@627 10605 msgid ""
dongsheng@627 10606 "As an example, when you run the <command role=\"hg-cmd\">hg commit</command> "
dongsheng@627 10607 "command, and it pops up your editor so that you can enter a commit message, "
dongsheng@627 10608 "look for a line that contains the text <quote><literal>HG: branch default</"
dongsheng@627 10609 "literal></quote> at the bottom. This is telling you that your commit will "
dongsheng@627 10610 "occur on the branch named <literal>default</literal>."
dongsheng@627 10611 msgstr ""
dongsheng@627 10612
dongsheng@627 10613 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10614 #: ../en/ch08-branch.xml:349
dongsheng@627 10615 msgid ""
dongsheng@627 10616 "To start working with named branches, use the <command role=\"hg-cmd\">hg "
dongsheng@627 10617 "branches</command> command. This command lists the named branches already "
dongsheng@627 10618 "present in your repository, telling you which changeset is the tip of each."
dongsheng@627 10619 msgstr ""
dongsheng@627 10620
dongsheng@627 10621 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10622 #: ../en/ch08-branch.xml:356
dongsheng@627 10623 msgid ""
dongsheng@627 10624 "Since you haven't created any named branches yet, the only one that exists is "
dongsheng@627 10625 "<literal>default</literal>."
dongsheng@627 10626 msgstr ""
dongsheng@627 10627
dongsheng@627 10628 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10629 #: ../en/ch08-branch.xml:359
dongsheng@627 10630 msgid ""
dongsheng@627 10631 "To find out what the <quote>current</quote> branch is, run the <command role="
dongsheng@627 10632 "\"hg-cmd\">hg branch</command> command, giving it no arguments. This tells "
dongsheng@627 10633 "you what branch the parent of the current changeset is on."
dongsheng@627 10634 msgstr ""
dongsheng@627 10635
dongsheng@627 10636 #
dongsheng@627 10637 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10638 #: ../en/ch08-branch.xml:366
dongsheng@627 10639 msgid ""
dongsheng@627 10640 "To create a new branch, run the <command role=\"hg-cmd\">hg branch</command> "
dongsheng@627 10641 "command again. This time, give it one argument: the name of the branch you "
dongsheng@627 10642 "want to create."
dongsheng@627 10643 msgstr ""
dongsheng@627 10644
dongsheng@627 10645 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10646 #: ../en/ch08-branch.xml:372
dongsheng@627 10647 msgid ""
dongsheng@627 10648 "After you've created a branch, you might wonder what effect the <command role="
dongsheng@627 10649 "\"hg-cmd\">hg branch</command> command has had. What do the <command role="
dongsheng@627 10650 "\"hg-cmd\">hg status</command> and <command role=\"hg-cmd\">hg tip</command> "
dongsheng@627 10651 "commands report?"
dongsheng@627 10652 msgstr ""
dongsheng@627 10653
dongsheng@627 10654 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10655 #: ../en/ch08-branch.xml:379
dongsheng@627 10656 msgid ""
dongsheng@627 10657 "Nothing has changed in the working directory, and there's been no new history "
dongsheng@627 10658 "created. As this suggests, running the <command role=\"hg-cmd\">hg branch</"
dongsheng@627 10659 "command> command has no permanent effect; it only tells Mercurial what branch "
dongsheng@627 10660 "name to use the <emphasis>next</emphasis> time you commit a changeset."
dongsheng@627 10661 msgstr ""
dongsheng@627 10662
dongsheng@627 10663 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10664 #: ../en/ch08-branch.xml:386
dongsheng@627 10665 msgid ""
dongsheng@627 10666 "When you commit a change, Mercurial records the name of the branch on which "
dongsheng@627 10667 "you committed. Once you've switched from the <literal>default</literal> "
dongsheng@627 10668 "branch to another and committed, you'll see the name of the new branch show "
dongsheng@627 10669 "up in the output of <command role=\"hg-cmd\">hg log</command>, <command role="
dongsheng@627 10670 "\"hg-cmd\">hg tip</command>, and other commands that display the same kind of "
dongsheng@627 10671 "output."
dongsheng@627 10672 msgstr ""
dongsheng@627 10673
dongsheng@627 10674 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10675 #: ../en/ch08-branch.xml:396
dongsheng@627 10676 msgid ""
dongsheng@627 10677 "The <command role=\"hg-cmd\">hg log</command>-like commands will print the "
dongsheng@627 10678 "branch name of every changeset that's not on the <literal>default</literal> "
dongsheng@627 10679 "branch. As a result, if you never use named branches, you'll never see this "
dongsheng@627 10680 "information."
dongsheng@627 10681 msgstr ""
dongsheng@627 10682
dongsheng@627 10683 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10684 #: ../en/ch08-branch.xml:401
dongsheng@627 10685 msgid ""
dongsheng@627 10686 "Once you've named a branch and committed a change with that name, every "
dongsheng@627 10687 "subsequent commit that descends from that change will inherit the same branch "
dongsheng@627 10688 "name. You can change the name of a branch at any time, using the <command "
dongsheng@627 10689 "role=\"hg-cmd\">hg branch</command> command."
dongsheng@627 10690 msgstr ""
dongsheng@627 10691
dongsheng@627 10692 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10693 #: ../en/ch08-branch.xml:409
dongsheng@627 10694 msgid ""
dongsheng@627 10695 "In practice, this is something you won't do very often, as branch names tend "
dongsheng@627 10696 "to have fairly long lifetimes. (This isn't a rule, just an observation.)"
dongsheng@627 10697 msgstr ""
dongsheng@627 10698
dongsheng@627 10699 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 10700 #: ../en/ch08-branch.xml:415
dongsheng@627 10701 msgid "Dealing with multiple named branches in a repository"
dongsheng@635 10702 msgstr "在版本库中处理多个命名分支"
dongsheng@627 10703
dongsheng@627 10704 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10705 #: ../en/ch08-branch.xml:418
dongsheng@627 10706 msgid ""
dongsheng@627 10707 "If you have more than one named branch in a repository, Mercurial will "
dongsheng@714 10708 "remember the branch that your working directory is on when you start a "
dongsheng@714 10709 "command like <command role=\"hg-cmd\">hg update</command> or <command role="
dongsheng@714 10710 "\"hg-cmd\">hg pull -u</command>. It will update the working directory to the "
dongsheng@714 10711 "tip of this branch, no matter what the <quote>repo-wide</quote> tip is. To "
dongsheng@714 10712 "update to a revision that's on a different named branch, you may need to use "
dongsheng@714 10713 "the <option role=\"hg-opt-update\">-C</option> option to <command role=\"hg-"
dongsheng@714 10714 "cmd\">hg update</command>."
dongsheng@714 10715 msgstr ""
dongsheng@714 10716
dongsheng@714 10717 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10718 #: ../en/ch08-branch.xml:428
dongsheng@627 10719 msgid ""
songdongsheng@710 10720 "This behavior is a little subtle, so let's see it in action. First, let's "
dongsheng@627 10721 "remind ourselves what branch we're currently on, and what branches are in our "
dongsheng@627 10722 "repository."
dongsheng@627 10723 msgstr ""
dongsheng@627 10724
dongsheng@627 10725 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10726 #: ../en/ch08-branch.xml:434
dongsheng@627 10727 msgid ""
dongsheng@627 10728 "We're on the <literal>bar</literal> branch, but there also exists an older "
dongsheng@627 10729 "<command role=\"hg-cmd\">hg foo</command> branch."
dongsheng@627 10730 msgstr ""
dongsheng@627 10731
dongsheng@627 10732 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10733 #: ../en/ch08-branch.xml:438
dongsheng@627 10734 msgid ""
dongsheng@627 10735 "We can <command role=\"hg-cmd\">hg update</command> back and forth between "
dongsheng@627 10736 "the tips of the <literal>foo</literal> and <literal>bar</literal> branches "
dongsheng@627 10737 "without needing to use the <option role=\"hg-opt-update\">-C</option> option, "
dongsheng@627 10738 "because this only involves going backwards and forwards linearly through our "
dongsheng@627 10739 "change history."
dongsheng@627 10740 msgstr ""
dongsheng@627 10741
dongsheng@627 10742 #
dongsheng@627 10743 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10744 #: ../en/ch08-branch.xml:447
dongsheng@627 10745 msgid ""
dongsheng@627 10746 "If we go back to the <literal>foo</literal> branch and then run <command role="
dongsheng@627 10747 "\"hg-cmd\">hg update</command>, it will keep us on <literal>foo</literal>, "
dongsheng@627 10748 "not move us to the tip of <literal>bar</literal>."
dongsheng@627 10749 msgstr ""
dongsheng@627 10750
dongsheng@627 10751 #
dongsheng@627 10752 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10753 #: ../en/ch08-branch.xml:454
dongsheng@627 10754 msgid ""
dongsheng@627 10755 "Committing a new change on the <literal>foo</literal> branch introduces a new "
dongsheng@627 10756 "head."
dongsheng@627 10757 msgstr ""
dongsheng@627 10758
dongsheng@627 10759 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 10760 #: ../en/ch08-branch.xml:461
dongsheng@627 10761 msgid "Branch names and merging"
dongsheng@635 10762 msgstr "分支名称与合并"
dongsheng@627 10763
dongsheng@627 10764 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10765 #: ../en/ch08-branch.xml:463
dongsheng@627 10766 msgid ""
dongsheng@627 10767 "As you've probably noticed, merges in Mercurial are not symmetrical. Let's "
dongsheng@627 10768 "say our repository has two heads, 17 and 23. If I <command role=\"hg-cmd"
dongsheng@627 10769 "\">hg update</command> to 17 and then <command role=\"hg-cmd\">hg merge</"
dongsheng@627 10770 "command> with 23, Mercurial records 17 as the first parent of the merge, and "
dongsheng@627 10771 "23 as the second. Whereas if I <command role=\"hg-cmd\">hg update</command> "
dongsheng@627 10772 "to 23 and then <command role=\"hg-cmd\">hg merge</command> with 17, it "
dongsheng@627 10773 "records 23 as the first parent, and 17 as the second."
dongsheng@627 10774 msgstr ""
dongsheng@627 10775
dongsheng@627 10776 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10777 #: ../en/ch08-branch.xml:473
dongsheng@627 10778 msgid ""
dongsheng@627 10779 "This affects Mercurial's choice of branch name when you merge. After a "
dongsheng@627 10780 "merge, Mercurial will retain the branch name of the first parent when you "
dongsheng@627 10781 "commit the result of the merge. If your first parent's branch name is "
dongsheng@627 10782 "<literal>foo</literal>, and you merge with <literal>bar</literal>, the branch "
dongsheng@627 10783 "name will still be <literal>foo</literal> after you merge."
dongsheng@627 10784 msgstr ""
dongsheng@627 10785
dongsheng@627 10786 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10787 #: ../en/ch08-branch.xml:480
dongsheng@627 10788 msgid ""
dongsheng@627 10789 "It's not unusual for a repository to contain multiple heads, each with the "
dongsheng@627 10790 "same branch name. Let's say I'm working on the <literal>foo</literal> "
dongsheng@627 10791 "branch, and so are you. We commit different changes; I pull your changes; I "
dongsheng@627 10792 "now have two heads, each claiming to be on the <literal>foo</literal> "
dongsheng@627 10793 "branch. The result of a merge will be a single head on the <literal>foo</"
dongsheng@627 10794 "literal> branch, as you might hope."
dongsheng@627 10795 msgstr ""
dongsheng@627 10796
dongsheng@627 10797 #
dongsheng@627 10798 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10799 #: ../en/ch08-branch.xml:488
dongsheng@627 10800 msgid ""
dongsheng@627 10801 "But if I'm working on the <literal>bar</literal> branch, and I merge work "
dongsheng@627 10802 "from the <literal>foo</literal> branch, the result will remain on the "
dongsheng@627 10803 "<literal>bar</literal> branch."
dongsheng@627 10804 msgstr ""
dongsheng@627 10805
dongsheng@627 10806 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10807 #: ../en/ch08-branch.xml:494
dongsheng@627 10808 msgid ""
dongsheng@627 10809 "To give a more concrete example, if I'm working on the <literal>bleeding-"
dongsheng@627 10810 "edge</literal> branch, and I want to bring in the latest fixes from the "
dongsheng@627 10811 "<literal>stable</literal> branch, Mercurial will choose the <quote>right</"
dongsheng@627 10812 "quote> (<literal>bleeding-edge</literal>) branch name when I pull and merge "
dongsheng@627 10813 "from <literal>stable</literal>."
dongsheng@627 10814 msgstr ""
dongsheng@627 10815
dongsheng@627 10816 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 10817 #: ../en/ch08-branch.xml:503
dongsheng@627 10818 msgid "Branch naming is generally useful"
dongsheng@635 10819 msgstr "分支名称通常都很有用"
dongsheng@627 10820
dongsheng@627 10821 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10822 #: ../en/ch08-branch.xml:505
dongsheng@627 10823 msgid ""
dongsheng@627 10824 "You shouldn't think of named branches as applicable only to situations where "
dongsheng@627 10825 "you have multiple long-lived branches cohabiting in a single repository. "
dongsheng@627 10826 "They're very useful even in the one-branch-per-repository case."
dongsheng@627 10827 msgstr ""
dongsheng@627 10828
dongsheng@627 10829 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10830 #: ../en/ch08-branch.xml:510
dongsheng@627 10831 msgid ""
dongsheng@627 10832 "In the simplest case, giving a name to each branch gives you a permanent "
dongsheng@627 10833 "record of which branch a changeset originated on. This gives you more "
dongsheng@627 10834 "context when you're trying to follow the history of a long-lived branchy "
dongsheng@627 10835 "project."
dongsheng@627 10836 msgstr ""
dongsheng@627 10837
dongsheng@627 10838 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 10839 #: ../en/ch08-branch.xml:515
dongsheng@627 10840 msgid ""
dongsheng@627 10841 "If you're working with shared repositories, you can set up a <literal role="
dongsheng@627 10842 "\"hook\">pretxnchangegroup</literal> hook on each that will block incoming "
dongsheng@627 10843 "changes that have the <quote>wrong</quote> branch name. This provides a "
dongsheng@627 10844 "simple, but effective, defence against people accidentally pushing changes "
dongsheng@627 10845 "from a <quote>bleeding edge</quote> branch to a <quote>stable</quote> "
dongsheng@627 10846 "branch. Such a hook might look like this inside the shared repo's <filename "
dongsheng@627 10847 "role=\"special\"> /.hgrc</filename>."
dongsheng@627 10848 msgstr ""
dongsheng@627 10849
dongsheng@627 10850 #. type: Content of: <book><chapter><title>
dongsheng@714 10851 #: ../en/ch09-undo.xml:5
dongsheng@627 10852 msgid "Finding and fixing mistakes"
dongsheng@627 10853 msgstr "查找和修改错误"
dongsheng@627 10854
dongsheng@627 10855 #. type: Content of: <book><chapter><para>
dongsheng@714 10856 #: ../en/ch09-undo.xml:7
dongsheng@627 10857 msgid ""
dongsheng@627 10858 "To err might be human, but to really handle the consequences well takes a top-"
dongsheng@627 10859 "notch revision control system. In this chapter, we'll discuss some of the "
dongsheng@627 10860 "techniques you can use when you find that a problem has crept into your "
dongsheng@627 10861 "project. Mercurial has some highly capable features that will help you to "
dongsheng@627 10862 "isolate the sources of problems, and to handle them appropriately."
dongsheng@627 10863 msgstr ""
dongsheng@627 10864
dongsheng@627 10865 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 10866 #: ../en/ch09-undo.xml:15
dongsheng@627 10867 msgid "Erasing local history"
dongsheng@635 10868 msgstr "销毁本地历史"
dongsheng@627 10869
dongsheng@627 10870 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 10871 #: ../en/ch09-undo.xml:18
dongsheng@627 10872 msgid "The accidental commit"
dongsheng@635 10873 msgstr "意外的提交"
dongsheng@627 10874
dongsheng@627 10875 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10876 #: ../en/ch09-undo.xml:20
dongsheng@627 10877 msgid ""
dongsheng@627 10878 "I have the occasional but persistent problem of typing rather more quickly "
dongsheng@627 10879 "than I can think, which sometimes results in me committing a changeset that "
dongsheng@627 10880 "is either incomplete or plain wrong. In my case, the usual kind of "
dongsheng@627 10881 "incomplete changeset is one in which I've created a new source file, but "
dongsheng@627 10882 "forgotten to <command role=\"hg-cmd\">hg add</command> it. A <quote>plain "
dongsheng@627 10883 "wrong</quote> changeset is not as common, but no less annoying."
dongsheng@627 10884 msgstr ""
dongsheng@627 10885
dongsheng@627 10886 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 10887 #: ../en/ch09-undo.xml:31
dongsheng@627 10888 msgid "Rolling back a transaction"
dongsheng@635 10889 msgstr "回滚一个事务"
dongsheng@627 10890
dongsheng@627 10891 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10892 #: ../en/ch09-undo.xml:33
dongsheng@627 10893 msgid ""
songdongsheng@658 10894 "In <xref linkend=\"sec:concepts:txn\"/>, I mentioned that Mercurial treats "
songdongsheng@658 10895 "each modification of a repository as a <emphasis>transaction</emphasis>. "
songdongsheng@658 10896 "Every time you commit a changeset or pull changes from another repository, "
songdongsheng@658 10897 "Mercurial remembers what you did. You can undo, or <emphasis>roll back</"
songdongsheng@658 10898 "emphasis>, exactly one of these actions using the <command role=\"hg-cmd\">hg "
songdongsheng@658 10899 "rollback</command> command. (See <xref linkend=\"sec:undo:rollback-after-push"
songdongsheng@658 10900 "\"/> for an important caveat about the use of this command.)"
dongsheng@627 10901 msgstr ""
dongsheng@627 10902
dongsheng@627 10903 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10904 #: ../en/ch09-undo.xml:43
dongsheng@627 10905 msgid ""
dongsheng@627 10906 "Here's a mistake that I often find myself making: committing a change in "
dongsheng@627 10907 "which I've created a new file, but forgotten to <command role=\"hg-cmd\">hg "
dongsheng@627 10908 "add</command> it."
dongsheng@627 10909 msgstr ""
dongsheng@627 10910
dongsheng@627 10911 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10912 #: ../en/ch09-undo.xml:50
dongsheng@627 10913 msgid ""
dongsheng@627 10914 "Looking at the output of <command role=\"hg-cmd\">hg status</command> after "
dongsheng@627 10915 "the commit immediately confirms the error."
dongsheng@627 10916 msgstr ""
dongsheng@627 10917
dongsheng@627 10918 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10919 #: ../en/ch09-undo.xml:56
dongsheng@627 10920 msgid ""
dongsheng@627 10921 "The commit captured the changes to the file <filename>a</filename>, but not "
dongsheng@627 10922 "the new file <filename>b</filename>. If I were to push this changeset to a "
dongsheng@627 10923 "repository that I shared with a colleague, the chances are high that "
dongsheng@627 10924 "something in <filename>a</filename> would refer to <filename>b</filename>, "
dongsheng@627 10925 "which would not be present in their repository when they pulled my changes. "
dongsheng@627 10926 "I would thus become the object of some indignation."
dongsheng@627 10927 msgstr ""
dongsheng@627 10928
dongsheng@627 10929 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10930 #: ../en/ch09-undo.xml:65
dongsheng@627 10931 msgid ""
songdongsheng@668 10932 "However, luck is with me&emdash;I've caught my error before I pushed the "
songdongsheng@668 10933 "changeset. I use the <command role=\"hg-cmd\">hg rollback</command> command, "
songdongsheng@668 10934 "and Mercurial makes that last changeset vanish."
dongsheng@627 10935 msgstr ""
dongsheng@627 10936
dongsheng@627 10937 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10938 #: ../en/ch09-undo.xml:72
dongsheng@627 10939 msgid ""
dongsheng@627 10940 "Notice that the changeset is no longer present in the repository's history, "
dongsheng@627 10941 "and the working directory once again thinks that the file <filename>a</"
dongsheng@627 10942 "filename> is modified. The commit and rollback have left the working "
dongsheng@627 10943 "directory exactly as it was prior to the commit; the changeset has been "
dongsheng@627 10944 "completely erased. I can now safely <command role=\"hg-cmd\">hg add</"
dongsheng@627 10945 "command> the file <filename>b</filename>, and rerun my commit."
dongsheng@627 10946 msgstr ""
dongsheng@627 10947
dongsheng@627 10948 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 10949 #: ../en/ch09-undo.xml:85
dongsheng@627 10950 msgid "The erroneous pull"
dongsheng@635 10951 msgstr "错误的抓取"
dongsheng@627 10952
dongsheng@627 10953 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10954 #: ../en/ch09-undo.xml:87
dongsheng@627 10955 msgid ""
dongsheng@627 10956 "It's common practice with Mercurial to maintain separate development branches "
dongsheng@627 10957 "of a project in different repositories. Your development team might have one "
dongsheng@627 10958 "shared repository for your project's <quote>0.9</quote> release, and another, "
dongsheng@627 10959 "containing different changes, for the <quote>1.0</quote> release."
dongsheng@627 10960 msgstr ""
dongsheng@627 10961
dongsheng@627 10962 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10963 #: ../en/ch09-undo.xml:94
dongsheng@627 10964 msgid ""
dongsheng@627 10965 "Given this, you can imagine that the consequences could be messy if you had a "
dongsheng@627 10966 "local <quote>0.9</quote> repository, and accidentally pulled changes from the "
dongsheng@627 10967 "shared <quote>1.0</quote> repository into it. At worst, you could be paying "
dongsheng@627 10968 "insufficient attention, and push those changes into the shared <quote>0.9</"
dongsheng@627 10969 "quote> tree, confusing your entire team (but don't worry, we'll return to "
dongsheng@627 10970 "this horror scenario later). However, it's more likely that you'll notice "
dongsheng@627 10971 "immediately, because Mercurial will display the URL it's pulling from, or you "
dongsheng@627 10972 "will see it pull a suspiciously large number of changes into the repository."
dongsheng@627 10973 msgstr ""
dongsheng@627 10974
dongsheng@627 10975 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10976 #: ../en/ch09-undo.xml:106
dongsheng@627 10977 msgid ""
dongsheng@627 10978 "The <command role=\"hg-cmd\">hg rollback</command> command will work nicely "
dongsheng@627 10979 "to expunge all of the changesets that you just pulled. Mercurial groups all "
dongsheng@627 10980 "changes from one <command role=\"hg-cmd\">hg pull</command> into a single "
dongsheng@627 10981 "transaction, so one <command role=\"hg-cmd\">hg rollback</command> is all you "
dongsheng@627 10982 "need to undo this mistake."
dongsheng@627 10983 msgstr ""
dongsheng@627 10984
dongsheng@627 10985 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 10986 #: ../en/ch09-undo.xml:115
dongsheng@627 10987 msgid "Rolling back is useless once you've pushed"
dongsheng@635 10988 msgstr "当完成推送后,回滚是无效的"
dongsheng@627 10989
dongsheng@627 10990 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 10991 #: ../en/ch09-undo.xml:117
dongsheng@627 10992 msgid ""
dongsheng@627 10993 "The value of the <command role=\"hg-cmd\">hg rollback</command> command drops "
dongsheng@627 10994 "to zero once you've pushed your changes to another repository. Rolling back "
dongsheng@627 10995 "a change makes it disappear entirely, but <emphasis>only</emphasis> in the "
dongsheng@627 10996 "repository in which you perform the <command role=\"hg-cmd\">hg rollback</"
dongsheng@627 10997 "command>. Because a rollback eliminates history, there's no way for the "
dongsheng@627 10998 "disappearance of a change to propagate between repositories."
dongsheng@627 10999 msgstr ""
dongsheng@627 11000
dongsheng@627 11001 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11002 #: ../en/ch09-undo.xml:126
dongsheng@627 11003 msgid ""
songdongsheng@668 11004 "If you've pushed a change to another repository&emdash;particularly if it's a "
songdongsheng@668 11005 "shared repository&emdash;it has essentially <quote>escaped into the wild,</"
dongsheng@714 11006 "quote> and you'll have to recover from your mistake in a different way. If "
dongsheng@714 11007 "you push a changeset somewhere, then roll it back, then pull from the "
dongsheng@714 11008 "repository you pushed to, the changeset you thought you'd gotten rid of will "
dongsheng@714 11009 "simply reappear in your repository."
dongsheng@714 11010 msgstr ""
dongsheng@714 11011
dongsheng@714 11012 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11013 #: ../en/ch09-undo.xml:135
dongsheng@627 11014 msgid ""
dongsheng@627 11015 "(If you absolutely know for sure that the change you want to roll back is the "
dongsheng@627 11016 "most recent change in the repository that you pushed to, <emphasis>and</"
dongsheng@627 11017 "emphasis> you know that nobody else could have pulled it from that "
dongsheng@627 11018 "repository, you can roll back the changeset there, too, but you really should "
dongsheng@714 11019 "not expect this to work reliably. Sooner or later a change really will make "
dongsheng@714 11020 "it into a repository that you don't directly control (or have forgotten "
dongsheng@714 11021 "about), and come back to bite you.)"
dongsheng@627 11022 msgstr ""
dongsheng@627 11023
dongsheng@627 11024 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 11025 #: ../en/ch09-undo.xml:147
dongsheng@627 11026 msgid "You can only roll back once"
dongsheng@635 11027 msgstr "你只能回滚一次"
dongsheng@627 11028
dongsheng@627 11029 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11030 #: ../en/ch09-undo.xml:149
dongsheng@627 11031 msgid ""
dongsheng@627 11032 "Mercurial stores exactly one transaction in its transaction log; that "
dongsheng@627 11033 "transaction is the most recent one that occurred in the repository. This "
dongsheng@627 11034 "means that you can only roll back one transaction. If you expect to be able "
songdongsheng@710 11035 "to roll back one transaction, then its predecessor, this is not the behavior "
dongsheng@627 11036 "you will get."
dongsheng@627 11037 msgstr ""
dongsheng@627 11038
dongsheng@627 11039 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11040 #: ../en/ch09-undo.xml:158
dongsheng@627 11041 msgid ""
dongsheng@627 11042 "Once you've rolled back one transaction in a repository, you can't roll back "
dongsheng@627 11043 "again in that repository until you perform another commit or pull."
dongsheng@627 11044 msgstr ""
dongsheng@627 11045
dongsheng@627 11046 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 11047 #: ../en/ch09-undo.xml:165
dongsheng@627 11048 msgid "Reverting the mistaken change"
dongsheng@635 11049 msgstr "撤销错误的修改"
dongsheng@627 11050
dongsheng@627 11051 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11052 #: ../en/ch09-undo.xml:167
dongsheng@627 11053 msgid ""
dongsheng@627 11054 "If you make a modification to a file, and decide that you really didn't want "
dongsheng@627 11055 "to change the file at all, and you haven't yet committed your changes, the "
dongsheng@627 11056 "<command role=\"hg-cmd\">hg revert</command> command is the one you'll need. "
dongsheng@627 11057 "It looks at the changeset that's the parent of the working directory, and "
dongsheng@627 11058 "restores the contents of the file to their state as of that changeset. "
dongsheng@627 11059 "(That's a long-winded way of saying that, in the normal case, it undoes your "
dongsheng@627 11060 "modifications.)"
dongsheng@627 11061 msgstr ""
dongsheng@627 11062
dongsheng@627 11063 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11064 #: ../en/ch09-undo.xml:176
dongsheng@627 11065 msgid ""
dongsheng@627 11066 "Let's illustrate how the <command role=\"hg-cmd\">hg revert</command> command "
dongsheng@627 11067 "works with yet another small example. We'll begin by modifying a file that "
dongsheng@627 11068 "Mercurial is already tracking."
dongsheng@627 11069 msgstr ""
dongsheng@627 11070
dongsheng@627 11071 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11072 #: ../en/ch09-undo.xml:183
dongsheng@627 11073 msgid ""
dongsheng@627 11074 "If we don't want that change, we can simply <command role=\"hg-cmd\">hg "
dongsheng@627 11075 "revert</command> the file."
dongsheng@627 11076 msgstr ""
dongsheng@627 11077
dongsheng@627 11078 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11079 #: ../en/ch09-undo.xml:189
dongsheng@627 11080 msgid ""
dongsheng@627 11081 "The <command role=\"hg-cmd\">hg revert</command> command provides us with an "
dongsheng@627 11082 "extra degree of safety by saving our modified file with a <filename>.orig</"
dongsheng@627 11083 "filename> extension."
dongsheng@627 11084 msgstr ""
dongsheng@627 11085
dongsheng@714 11086 #. type: Content of: <book><chapter><sect1><tip><title>
dongsheng@714 11087 #: ../en/ch09-undo.xml:197
dongsheng@714 11088 msgid "Be careful with <filename>.orig</filename> files"
dongsheng@715 11089 msgstr "小心 <filename>.orig</filename> 文件"
dongsheng@714 11090
dongsheng@714 11091 #. type: Content of: <book><chapter><sect1><tip><para>
dongsheng@714 11092 #: ../en/ch09-undo.xml:199
dongsheng@714 11093 msgid ""
dongsheng@714 11094 "It's extremely unlikely that you are either using Mercurial to manage files "
dongsheng@714 11095 "with <filename>.orig</filename> extensions or that you even care about the "
dongsheng@714 11096 "contents of such files. Just in case, though, it's useful to remember that "
dongsheng@714 11097 "<command role=\"hg-cmd\">hg revert</command> will unconditionally overwrite "
dongsheng@714 11098 "an existing file with a <filename>.orig</filename> extension. For instance, "
dongsheng@714 11099 "if you already have a file named <filename>foo.orig</filename> when you "
dongsheng@714 11100 "revert <filename>foo</filename>, the contents of <filename>foo.orig</"
dongsheng@714 11101 "filename> will be clobbered."
dongsheng@714 11102 msgstr ""
dongsheng@714 11103
dongsheng@714 11104 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11105 #: ../en/ch09-undo.xml:211
dongsheng@627 11106 msgid ""
dongsheng@627 11107 "Here is a summary of the cases that the <command role=\"hg-cmd\">hg revert</"
dongsheng@627 11108 "command> command can deal with. We will describe each of these in more "
dongsheng@627 11109 "detail in the section that follows."
dongsheng@627 11110 msgstr ""
dongsheng@627 11111
dongsheng@627 11112 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 11113 #: ../en/ch09-undo.xml:216
dongsheng@627 11114 msgid "If you modify a file, it will restore the file to its unmodified state."
dongsheng@627 11115 msgstr ""
dongsheng@627 11116
dongsheng@627 11117 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 11118 #: ../en/ch09-undo.xml:219
dongsheng@627 11119 msgid ""
dongsheng@627 11120 "If you <command role=\"hg-cmd\">hg add</command> a file, it will undo the "
dongsheng@627 11121 "<quote>added</quote> state of the file, but leave the file itself untouched."
dongsheng@627 11122 msgstr ""
dongsheng@627 11123
dongsheng@627 11124 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 11125 #: ../en/ch09-undo.xml:223
dongsheng@627 11126 msgid ""
dongsheng@627 11127 "If you delete a file without telling Mercurial, it will restore the file to "
dongsheng@627 11128 "its unmodified contents."
dongsheng@627 11129 msgstr ""
dongsheng@627 11130
dongsheng@627 11131 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 11132 #: ../en/ch09-undo.xml:226
dongsheng@627 11133 msgid ""
dongsheng@627 11134 "If you use the <command role=\"hg-cmd\">hg remove</command> command to remove "
dongsheng@627 11135 "a file, it will undo the <quote>removed</quote> state of the file, and "
dongsheng@627 11136 "restore the file to its unmodified contents."
dongsheng@627 11137 msgstr ""
dongsheng@627 11138
dongsheng@627 11139 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 11140 #: ../en/ch09-undo.xml:233
dongsheng@627 11141 msgid "File management errors"
dongsheng@635 11142 msgstr "文件管理错误"
dongsheng@627 11143
dongsheng@627 11144 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11145 #: ../en/ch09-undo.xml:235
dongsheng@627 11146 msgid ""
dongsheng@627 11147 "The <command role=\"hg-cmd\">hg revert</command> command is useful for more "
dongsheng@627 11148 "than just modified files. It lets you reverse the results of all of "
songdongsheng@668 11149 "Mercurial's file management commands&emdash;<command role=\"hg-cmd\">hg add</"
dongsheng@627 11150 "command>, <command role=\"hg-cmd\">hg remove</command>, and so on."
dongsheng@627 11151 msgstr ""
dongsheng@627 11152
dongsheng@627 11153 #
dongsheng@627 11154 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11155 #: ../en/ch09-undo.xml:241
dongsheng@627 11156 msgid ""
dongsheng@627 11157 "If you <command role=\"hg-cmd\">hg add</command> a file, then decide that in "
dongsheng@627 11158 "fact you don't want Mercurial to track it, use <command role=\"hg-cmd\">hg "
dongsheng@627 11159 "revert</command> to undo the add. Don't worry; Mercurial will not modify the "
dongsheng@627 11160 "file in any way. It will just <quote>unmark</quote> the file."
dongsheng@627 11161 msgstr ""
dongsheng@627 11162
dongsheng@627 11163 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11164 #: ../en/ch09-undo.xml:249
dongsheng@627 11165 msgid ""
dongsheng@627 11166 "Similarly, if you ask Mercurial to <command role=\"hg-cmd\">hg remove</"
dongsheng@627 11167 "command> a file, you can use <command role=\"hg-cmd\">hg revert</command> to "
dongsheng@627 11168 "restore it to the contents it had as of the parent of the working directory. "
dongsheng@627 11169 "&interaction.daily.revert.remove; This works just as well for a file that you "
dongsheng@627 11170 "deleted by hand, without telling Mercurial (recall that in Mercurial "
dongsheng@627 11171 "terminology, this kind of file is called <quote>missing</quote>)."
dongsheng@627 11172 msgstr ""
dongsheng@627 11173
dongsheng@627 11174 #
dongsheng@627 11175 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11176 #: ../en/ch09-undo.xml:260
dongsheng@627 11177 msgid ""
dongsheng@627 11178 "If you revert a <command role=\"hg-cmd\">hg copy</command>, the copied-to "
dongsheng@627 11179 "file remains in your working directory afterwards, untracked. Since a copy "
dongsheng@627 11180 "doesn't affect the copied-from file in any way, Mercurial doesn't do anything "
dongsheng@627 11181 "with the copied-from file."
dongsheng@627 11182 msgstr ""
dongsheng@627 11183
dongsheng@627 11184 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 11185 #: ../en/ch09-undo.xml:271
dongsheng@627 11186 msgid "Dealing with committed changes"
dongsheng@635 11187 msgstr "处理已经提交的修改"
dongsheng@627 11188
dongsheng@627 11189 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11190 #: ../en/ch09-undo.xml:273
dongsheng@714 11191 msgid ""
dongsheng@714 11192 "Consider a case where you have committed a change <emphasis>a</emphasis>, and "
dongsheng@714 11193 "another change <emphasis>b</emphasis> on top of it; you then realise that "
dongsheng@714 11194 "change <emphasis>a</emphasis> was incorrect. Mercurial lets you <quote>back "
dongsheng@714 11195 "out</quote> an entire changeset automatically, and building blocks that let "
dongsheng@714 11196 "you reverse part of a changeset by hand."
dongsheng@714 11197 msgstr ""
dongsheng@714 11198
dongsheng@714 11199 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11200 #: ../en/ch09-undo.xml:281
dongsheng@627 11201 msgid ""
dongsheng@627 11202 "Before you read this section, here's something to keep in mind: the <command "
dongsheng@714 11203 "role=\"hg-cmd\">hg backout</command> command undoes the effect of a change by "
dongsheng@714 11204 "<emphasis>adding</emphasis> to your repository's history, not by modifying or "
dongsheng@714 11205 "erasing it. It's the right tool to use if you're fixing bugs, but not if "
dongsheng@714 11206 "you're trying to undo some change that has catastrophic consequences. To "
dongsheng@714 11207 "deal with those, see <xref linkend=\"sec:undo:aaaiiieee\"/>."
dongsheng@627 11208 msgstr ""
dongsheng@627 11209
dongsheng@627 11210 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 11211 #: ../en/ch09-undo.xml:291
dongsheng@627 11212 msgid "Backing out a changeset"
dongsheng@635 11213 msgstr "恢复一个修改集"
dongsheng@627 11214
dongsheng@627 11215 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11216 #: ../en/ch09-undo.xml:293
dongsheng@627 11217 msgid ""
dongsheng@627 11218 "The <command role=\"hg-cmd\">hg backout</command> command lets you "
dongsheng@627 11219 "<quote>undo</quote> the effects of an entire changeset in an automated "
dongsheng@627 11220 "fashion. Because Mercurial's history is immutable, this command "
dongsheng@627 11221 "<emphasis>does not</emphasis> get rid of the changeset you want to undo. "
dongsheng@627 11222 "Instead, it creates a new changeset that <emphasis>reverses</emphasis> the "
dongsheng@627 11223 "effect of the to-be-undone changeset."
dongsheng@627 11224 msgstr ""
dongsheng@627 11225
dongsheng@627 11226 #
dongsheng@627 11227 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11228 #: ../en/ch09-undo.xml:302
dongsheng@627 11229 msgid ""
dongsheng@627 11230 "The operation of the <command role=\"hg-cmd\">hg backout</command> command is "
dongsheng@627 11231 "a little intricate, so let's illustrate it with some examples. First, we'll "
dongsheng@627 11232 "create a repository with some simple changes."
dongsheng@627 11233 msgstr ""
dongsheng@627 11234
dongsheng@627 11235 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11236 #: ../en/ch09-undo.xml:309
dongsheng@627 11237 msgid ""
dongsheng@627 11238 "The <command role=\"hg-cmd\">hg backout</command> command takes a single "
dongsheng@627 11239 "changeset ID as its argument; this is the changeset to back out. Normally, "
dongsheng@627 11240 "<command role=\"hg-cmd\">hg backout</command> will drop you into a text "
dongsheng@627 11241 "editor to write a commit message, so you can record why you're backing the "
dongsheng@627 11242 "change out. In this example, we provide a commit message on the command line "
dongsheng@627 11243 "using the <option role=\"hg-opt-backout\">-m</option> option."
dongsheng@627 11244 msgstr ""
dongsheng@627 11245
dongsheng@627 11246 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 11247 #: ../en/ch09-undo.xml:320
dongsheng@627 11248 msgid "Backing out the tip changeset"
dongsheng@635 11249 msgstr "恢复顶点修改集"
dongsheng@627 11250
dongsheng@627 11251 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11252 #: ../en/ch09-undo.xml:322
dongsheng@627 11253 msgid "We're going to start by backing out the last changeset we committed."
dongsheng@627 11254 msgstr ""
dongsheng@627 11255
dongsheng@627 11256 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11257 #: ../en/ch09-undo.xml:327
dongsheng@627 11258 msgid ""
dongsheng@627 11259 "You can see that the second line from <filename>myfile</filename> is no "
dongsheng@627 11260 "longer present. Taking a look at the output of <command role=\"hg-cmd\">hg "
dongsheng@627 11261 "log</command> gives us an idea of what the <command role=\"hg-cmd\">hg "
dongsheng@627 11262 "backout</command> command has done. &interaction.backout.simple.log; Notice "
dongsheng@627 11263 "that the new changeset that <command role=\"hg-cmd\">hg backout</command> has "
dongsheng@627 11264 "created is a child of the changeset we backed out. It's easier to see this "
songdongsheng@658 11265 "in <xref linkend=\"fig:undo:backout\"/>, which presents a graphical view of "
songdongsheng@658 11266 "the change history. As you can see, the history is nice and linear."
songdongsheng@658 11267 msgstr ""
songdongsheng@658 11268
songdongsheng@658 11269 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
dongsheng@714 11270 #: ../en/ch09-undo.xml:340 ../en/ch09-undo.xml:460
dongsheng@627 11271 msgid ""
dongsheng@627 11272 "Backing out a change using the <command role=\"hg-cmd\">hg backout</command> "
dongsheng@627 11273 "command"
dongsheng@660 11274 msgstr "使用 <command role=\"hg-cmd\">hg backout</command> 恢复一个修改"
dongsheng@627 11275
songdongsheng@658 11276 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
dongsheng@714 11277 #: ../en/ch09-undo.xml:343
songdongsheng@658 11278 msgid "<imageobject><imagedata fileref=\"figs/undo-simple.png\"/></imageobject>"
songdongsheng@658 11279 msgstr ""
songdongsheng@658 11280
dongsheng@627 11281 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 11282 #: ../en/ch09-undo.xml:350
dongsheng@627 11283 msgid "Backing out a non-tip change"
dongsheng@635 11284 msgstr "恢复非顶点的修改"
dongsheng@627 11285
dongsheng@627 11286 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11287 #: ../en/ch09-undo.xml:352
dongsheng@627 11288 msgid ""
dongsheng@627 11289 "If you want to back out a change other than the last one you committed, pass "
dongsheng@627 11290 "the <option role=\"hg-opt-backout\">--merge</option> option to the <command "
dongsheng@627 11291 "role=\"hg-cmd\">hg backout</command> command."
dongsheng@627 11292 msgstr ""
dongsheng@627 11293
dongsheng@627 11294 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11295 #: ../en/ch09-undo.xml:359
dongsheng@627 11296 msgid ""
dongsheng@627 11297 "This makes backing out any changeset a <quote>one-shot</quote> operation "
dongsheng@627 11298 "that's usually simple and fast."
dongsheng@627 11299 msgstr ""
dongsheng@627 11300
dongsheng@627 11301 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11302 #: ../en/ch09-undo.xml:365
dongsheng@627 11303 msgid ""
dongsheng@627 11304 "If you take a look at the contents of <filename>myfile</filename> after the "
dongsheng@627 11305 "backout finishes, you'll see that the first and third changes are present, "
dongsheng@627 11306 "but not the second."
dongsheng@627 11307 msgstr ""
dongsheng@627 11308
dongsheng@627 11309 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11310 #: ../en/ch09-undo.xml:372
songdongsheng@658 11311 msgid ""
songdongsheng@658 11312 "As the graphical history in <xref linkend=\"fig:undo:backout-non-tip\"/> "
dongsheng@714 11313 "illustrates, Mercurial still commits one change in this kind of situation "
dongsheng@714 11314 "(the box-shaped node is the ones that Mercurial commits automatically), but "
dongsheng@714 11315 "the revision graph now looks different. Before Mercurial begins the backout "
dongsheng@714 11316 "process, it first remembers what the current parent of the working directory "
dongsheng@714 11317 "is. It then backs out the target changeset, and commits that as a "
dongsheng@714 11318 "changeset. Finally, it merges back to the previous parent of the working "
dongsheng@714 11319 "directory, but notice that it <emphasis>does not commit</emphasis> the result "
dongsheng@714 11320 "of the merge. The repository now contains two heads, and the working "
dongsheng@714 11321 "directory is in a merge state."
dongsheng@627 11322 msgstr ""
dongsheng@627 11323
songdongsheng@658 11324 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
dongsheng@714 11325 #: ../en/ch09-undo.xml:387
dongsheng@627 11326 msgid ""
dongsheng@627 11327 "Automated backout of a non-tip change using the <command role=\"hg-cmd\">hg "
dongsheng@627 11328 "backout</command> command"
dongsheng@660 11329 msgstr "使用 <command role=\"hg-cmd\">hg backout</command> 自动恢复非顶点的修改"
dongsheng@627 11330
songdongsheng@658 11331 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
dongsheng@714 11332 #: ../en/ch09-undo.xml:390
songdongsheng@658 11333 msgid ""
songdongsheng@658 11334 "<imageobject><imagedata fileref=\"figs/undo-non-tip.png\"/></imageobject>"
songdongsheng@658 11335 msgstr ""
songdongsheng@658 11336
songdongsheng@658 11337 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11338 #: ../en/ch09-undo.xml:395
dongsheng@627 11339 msgid ""
dongsheng@627 11340 "The result is that you end up <quote>back where you were</quote>, only with "
dongsheng@627 11341 "some extra history that undoes the effect of the changeset you wanted to back "
dongsheng@627 11342 "out."
dongsheng@627 11343 msgstr ""
dongsheng@627 11344
dongsheng@714 11345 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11346 #: ../en/ch09-undo.xml:399
dongsheng@714 11347 msgid ""
dongsheng@714 11348 "You might wonder why Mercurial does not commit the result of the merge that "
dongsheng@714 11349 "it performed. The reason lies in Mercurial behaving conservatively: a merge "
dongsheng@714 11350 "naturally has more scope for error than simply undoing the effect of the tip "
dongsheng@714 11351 "changeset, so your work will be safest if you first inspect (and test!) the "
dongsheng@714 11352 "result of the merge, <emphasis>then</emphasis> commit it."
dongsheng@714 11353 msgstr ""
dongsheng@714 11354
dongsheng@627 11355 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 11356 #: ../en/ch09-undo.xml:408
dongsheng@627 11357 msgid "Always use the <option role=\"hg-opt-backout\">--merge</option> option"
dongsheng@635 11358 msgstr "始终使用选项 <option role=\"hg-opt-backout\">--merge</option>"
dongsheng@627 11359
dongsheng@627 11360 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 11361 #: ../en/ch09-undo.xml:411
dongsheng@627 11362 msgid ""
dongsheng@627 11363 "In fact, since the <option role=\"hg-opt-backout\">--merge</option> option "
dongsheng@627 11364 "will do the <quote>right thing</quote> whether or not the changeset you're "
dongsheng@627 11365 "backing out is the tip (i.e. it won't try to merge if it's backing out the "
dongsheng@627 11366 "tip, since there's no need), you should <emphasis>always</emphasis> use this "
dongsheng@627 11367 "option when you run the <command role=\"hg-cmd\">hg backout</command> command."
dongsheng@627 11368 msgstr ""
dongsheng@627 11369
dongsheng@627 11370 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 11371 #: ../en/ch09-undo.xml:422
dongsheng@627 11372 msgid "Gaining more control of the backout process"
dongsheng@635 11373 msgstr "在恢复处理中获得更多控制"
dongsheng@627 11374
dongsheng@627 11375 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11376 #: ../en/ch09-undo.xml:424
dongsheng@627 11377 msgid ""
dongsheng@627 11378 "While I've recommended that you always use the <option role=\"hg-opt-backout"
dongsheng@627 11379 "\">--merge</option> option when backing out a change, the <command role=\"hg-"
dongsheng@627 11380 "cmd\">hg backout</command> command lets you decide how to merge a backout "
dongsheng@627 11381 "changeset. Taking control of the backout process by hand is something you "
dongsheng@627 11382 "will rarely need to do, but it can be useful to understand what the <command "
dongsheng@627 11383 "role=\"hg-cmd\">hg backout</command> command is doing for you automatically. "
dongsheng@627 11384 "To illustrate this, let's clone our first repository, but omit the backout "
dongsheng@627 11385 "change that it contains."
dongsheng@627 11386 msgstr ""
dongsheng@627 11387
dongsheng@627 11388 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11389 #: ../en/ch09-undo.xml:437
dongsheng@627 11390 msgid ""
dongsheng@627 11391 "As with our earlier example, We'll commit a third changeset, then back out "
dongsheng@627 11392 "its parent, and see what happens."
dongsheng@627 11393 msgstr ""
dongsheng@627 11394
dongsheng@627 11395 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11396 #: ../en/ch09-undo.xml:443
dongsheng@627 11397 msgid ""
dongsheng@627 11398 "Our new changeset is again a descendant of the changeset we backout out; it's "
dongsheng@627 11399 "thus a new head, <emphasis>not</emphasis> a descendant of the changeset that "
dongsheng@627 11400 "was the tip. The <command role=\"hg-cmd\">hg backout</command> command was "
dongsheng@627 11401 "quite explicit in telling us this."
dongsheng@627 11402 msgstr ""
dongsheng@627 11403
dongsheng@627 11404 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11405 #: ../en/ch09-undo.xml:451
dongsheng@627 11406 msgid ""
dongsheng@627 11407 "Again, it's easier to see what has happened by looking at a graph of the "
songdongsheng@658 11408 "revision history, in <xref linkend=\"fig:undo:backout-manual\"/>. This makes "
songdongsheng@658 11409 "it clear that when we use <command role=\"hg-cmd\">hg backout</command> to "
songdongsheng@658 11410 "back out a change other than the tip, Mercurial adds a new head to the "
songdongsheng@658 11411 "repository (the change it committed is box-shaped)."
songdongsheng@658 11412 msgstr ""
songdongsheng@658 11413
songdongsheng@658 11414 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
dongsheng@714 11415 #: ../en/ch09-undo.xml:463
songdongsheng@658 11416 msgid "<imageobject><imagedata fileref=\"figs/undo-manual.png\"/></imageobject>"
songdongsheng@658 11417 msgstr ""
songdongsheng@658 11418
songdongsheng@658 11419 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11420 #: ../en/ch09-undo.xml:468
dongsheng@627 11421 msgid ""
dongsheng@627 11422 "After the <command role=\"hg-cmd\">hg backout</command> command has "
dongsheng@627 11423 "completed, it leaves the new <quote>backout</quote> changeset as the parent "
dongsheng@627 11424 "of the working directory."
dongsheng@627 11425 msgstr ""
dongsheng@627 11426
dongsheng@627 11427 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11428 #: ../en/ch09-undo.xml:475
dongsheng@627 11429 msgid "Now we have two isolated sets of changes."
dongsheng@627 11430 msgstr ""
dongsheng@627 11431
dongsheng@627 11432 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11433 #: ../en/ch09-undo.xml:479
dongsheng@627 11434 msgid ""
dongsheng@627 11435 "Let's think about what we expect to see as the contents of <filename>myfile</"
dongsheng@627 11436 "filename> now. The first change should be present, because we've never "
dongsheng@627 11437 "backed it out. The second change should be missing, as that's the change we "
dongsheng@627 11438 "backed out. Since the history graph shows the third change as a separate "
dongsheng@627 11439 "head, we <emphasis>don't</emphasis> expect to see the third change present in "
dongsheng@627 11440 "<filename>myfile</filename>."
dongsheng@627 11441 msgstr ""
dongsheng@627 11442
dongsheng@627 11443 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11444 #: ../en/ch09-undo.xml:489
dongsheng@627 11445 msgid ""
dongsheng@627 11446 "To get the third change back into the file, we just do a normal merge of our "
dongsheng@627 11447 "two heads."
dongsheng@627 11448 msgstr ""
dongsheng@627 11449
dongsheng@627 11450 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11451 #: ../en/ch09-undo.xml:494
songdongsheng@658 11452 msgid ""
songdongsheng@658 11453 "Afterwards, the graphical history of our repository looks like <xref linkend="
songdongsheng@658 11454 "\"fig:undo:backout-manual-merge\"/>."
songdongsheng@658 11455 msgstr ""
songdongsheng@658 11456
songdongsheng@658 11457 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
dongsheng@714 11458 #: ../en/ch09-undo.xml:499
dongsheng@627 11459 msgid "Manually merging a backout change"
dongsheng@660 11460 msgstr "手工合并恢复修改"
dongsheng@627 11461
songdongsheng@658 11462 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
dongsheng@714 11463 #: ../en/ch09-undo.xml:501
songdongsheng@658 11464 msgid ""
songdongsheng@658 11465 "<imageobject><imagedata fileref=\"figs/undo-manual-merge.png\"/></imageobject>"
songdongsheng@658 11466 msgstr ""
songdongsheng@658 11467
dongsheng@627 11468 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 11469 #: ../en/ch09-undo.xml:508
dongsheng@627 11470 msgid "Why <command role=\"hg-cmd\">hg backout</command> works as it does"
dongsheng@635 11471 msgstr "<command role=\"hg-cmd\">hg backout</command> 的内幕"
dongsheng@627 11472
dongsheng@627 11473 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11474 #: ../en/ch09-undo.xml:511
dongsheng@627 11475 msgid ""
dongsheng@627 11476 "Here's a brief description of how the <command role=\"hg-cmd\">hg backout</"
dongsheng@627 11477 "command> command works."
dongsheng@627 11478 msgstr ""
dongsheng@627 11479
dongsheng@627 11480 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 11481 #: ../en/ch09-undo.xml:514
dongsheng@627 11482 msgid ""
dongsheng@627 11483 "It ensures that the working directory is <quote>clean</quote>, i.e. that the "
dongsheng@627 11484 "output of <command role=\"hg-cmd\">hg status</command> would be empty."
dongsheng@627 11485 msgstr ""
dongsheng@627 11486
dongsheng@627 11487 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 11488 #: ../en/ch09-undo.xml:518
dongsheng@627 11489 msgid ""
dongsheng@627 11490 "It remembers the current parent of the working directory. Let's call this "
dongsheng@714 11491 "changeset <literal>orig</literal>."
dongsheng@627 11492 msgstr ""
dongsheng@627 11493
dongsheng@627 11494 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 11495 #: ../en/ch09-undo.xml:522
dongsheng@627 11496 msgid ""
dongsheng@627 11497 "It does the equivalent of a <command role=\"hg-cmd\">hg update</command> to "
dongsheng@627 11498 "sync the working directory to the changeset you want to back out. Let's call "
dongsheng@714 11499 "this changeset <literal>backout</literal>."
dongsheng@627 11500 msgstr ""
dongsheng@627 11501
dongsheng@627 11502 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 11503 #: ../en/ch09-undo.xml:527
dongsheng@627 11504 msgid ""
dongsheng@627 11505 "It finds the parent of that changeset. Let's call that changeset "
dongsheng@627 11506 "<literal>parent</literal>."
dongsheng@627 11507 msgstr ""
dongsheng@627 11508
dongsheng@627 11509 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 11510 #: ../en/ch09-undo.xml:530
dongsheng@627 11511 msgid ""
dongsheng@627 11512 "For each file that the <literal>backout</literal> changeset affected, it does "
dongsheng@627 11513 "the equivalent of a <command role=\"hg-cmd\">hg revert -r parent</command> on "
dongsheng@627 11514 "that file, to restore it to the contents it had before that changeset was "
dongsheng@627 11515 "committed."
dongsheng@627 11516 msgstr ""
dongsheng@627 11517
dongsheng@627 11518 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 11519 #: ../en/ch09-undo.xml:537
dongsheng@627 11520 msgid ""
dongsheng@627 11521 "It commits the result as a new changeset. This changeset has "
dongsheng@627 11522 "<literal>backout</literal> as its parent."
dongsheng@627 11523 msgstr ""
dongsheng@627 11524
dongsheng@627 11525 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 11526 #: ../en/ch09-undo.xml:541
dongsheng@627 11527 msgid ""
dongsheng@627 11528 "If you specify <option role=\"hg-opt-backout\">--merge</option> on the "
dongsheng@627 11529 "command line, it merges with <literal>orig</literal>, and commits the result "
dongsheng@627 11530 "of the merge."
dongsheng@627 11531 msgstr ""
dongsheng@627 11532
dongsheng@627 11533 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11534 #: ../en/ch09-undo.xml:547
dongsheng@627 11535 msgid ""
dongsheng@627 11536 "An alternative way to implement the <command role=\"hg-cmd\">hg backout</"
dongsheng@627 11537 "command> command would be to <command role=\"hg-cmd\">hg export</command> the "
dongsheng@627 11538 "to-be-backed-out changeset as a diff, then use the <option role=\"cmd-opt-"
dongsheng@627 11539 "patch\">--reverse</option> option to the <command>patch</command> command to "
dongsheng@627 11540 "reverse the effect of the change without fiddling with the working "
dongsheng@627 11541 "directory. This sounds much simpler, but it would not work nearly as well."
dongsheng@627 11542 msgstr ""
dongsheng@627 11543
dongsheng@627 11544 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11545 #: ../en/ch09-undo.xml:557
dongsheng@627 11546 msgid ""
dongsheng@627 11547 "The reason that <command role=\"hg-cmd\">hg backout</command> does an update, "
dongsheng@627 11548 "a commit, a merge, and another commit is to give the merge machinery the best "
dongsheng@627 11549 "chance to do a good job when dealing with all the changes <emphasis>between</"
dongsheng@627 11550 "emphasis> the change you're backing out and the current tip."
dongsheng@627 11551 msgstr ""
dongsheng@627 11552
dongsheng@627 11553 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11554 #: ../en/ch09-undo.xml:564
dongsheng@627 11555 msgid ""
dongsheng@627 11556 "If you're backing out a changeset that's 100 revisions back in your project's "
dongsheng@627 11557 "history, the chances that the <command>patch</command> command will be able "
dongsheng@627 11558 "to apply a reverse diff cleanly are not good, because intervening changes are "
dongsheng@627 11559 "likely to have <quote>broken the context</quote> that <command>patch</"
dongsheng@627 11560 "command> uses to determine whether it can apply a patch (if this sounds like "
songdongsheng@658 11561 "gibberish, see <xref linkend=\"sec:mq:patch\"/> for a discussion of the "
dongsheng@627 11562 "<command>patch</command> command). Also, Mercurial's merge machinery will "
dongsheng@627 11563 "handle files and directories being renamed, permission changes, and "
dongsheng@627 11564 "modifications to binary files, none of which <command>patch</command> can "
dongsheng@627 11565 "deal with."
dongsheng@627 11566 msgstr ""
dongsheng@627 11567
dongsheng@627 11568 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 11569 #: ../en/ch09-undo.xml:581
dongsheng@627 11570 msgid "Changes that should never have been"
dongsheng@635 11571 msgstr "不该发生的修改"
dongsheng@627 11572
dongsheng@627 11573 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11574 #: ../en/ch09-undo.xml:583
dongsheng@627 11575 msgid ""
dongsheng@627 11576 "Most of the time, the <command role=\"hg-cmd\">hg backout</command> command "
dongsheng@627 11577 "is exactly what you need if you want to undo the effects of a change. It "
dongsheng@627 11578 "leaves a permanent record of exactly what you did, both when committing the "
dongsheng@627 11579 "original changeset and when you cleaned up after it."
dongsheng@627 11580 msgstr ""
dongsheng@627 11581
dongsheng@627 11582 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11583 #: ../en/ch09-undo.xml:589
dongsheng@627 11584 msgid ""
dongsheng@627 11585 "On rare occasions, though, you may find that you've committed a change that "
dongsheng@627 11586 "really should not be present in the repository at all. For example, it would "
dongsheng@627 11587 "be very unusual, and usually considered a mistake, to commit a software "
dongsheng@627 11588 "project's object files as well as its source files. Object files have almost "
dongsheng@627 11589 "no intrinsic value, and they're <emphasis>big</emphasis>, so they increase "
dongsheng@627 11590 "the size of the repository and the amount of time it takes to clone or pull "
dongsheng@627 11591 "changes."
dongsheng@627 11592 msgstr ""
dongsheng@627 11593
dongsheng@627 11594 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11595 #: ../en/ch09-undo.xml:598
dongsheng@627 11596 msgid ""
dongsheng@627 11597 "Before I discuss the options that you have if you commit a <quote>brown paper "
dongsheng@627 11598 "bag</quote> change (the kind that's so bad that you want to pull a brown "
dongsheng@627 11599 "paper bag over your head), let me first discuss some approaches that probably "
dongsheng@627 11600 "won't work."
dongsheng@627 11601 msgstr ""
dongsheng@627 11602
dongsheng@627 11603 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11604 #: ../en/ch09-undo.xml:603
dongsheng@627 11605 msgid ""
songdongsheng@668 11606 "Since Mercurial treats history as accumulative&emdash;every change builds on "
songdongsheng@668 11607 "top of all changes that preceded it&emdash;you generally can't just make "
songdongsheng@668 11608 "disastrous changes disappear. The one exception is when you've just "
songdongsheng@668 11609 "committed a change, and it hasn't been pushed or pulled into another "
songdongsheng@668 11610 "repository. That's when you can safely use the <command role=\"hg-cmd\">hg "
songdongsheng@668 11611 "rollback</command> command, as I detailed in <xref linkend=\"sec:undo:rollback"
songdongsheng@668 11612 "\"/>."
songdongsheng@658 11613 msgstr ""
songdongsheng@658 11614
songdongsheng@658 11615 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11616 #: ../en/ch09-undo.xml:612
dongsheng@627 11617 msgid ""
dongsheng@627 11618 "After you've pushed a bad change to another repository, you <emphasis>could</"
dongsheng@627 11619 "emphasis> still use <command role=\"hg-cmd\">hg rollback</command> to make "
dongsheng@627 11620 "your local copy of the change disappear, but it won't have the consequences "
dongsheng@627 11621 "you want. The change will still be present in the remote repository, so it "
dongsheng@627 11622 "will reappear in your local repository the next time you pull."
dongsheng@627 11623 msgstr ""
dongsheng@627 11624
dongsheng@627 11625 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11626 #: ../en/ch09-undo.xml:620
dongsheng@627 11627 msgid ""
dongsheng@627 11628 "If a situation like this arises, and you know which repositories your bad "
dongsheng@627 11629 "change has propagated into, you can <emphasis>try</emphasis> to get rid of "
dongsheng@714 11630 "the change from <emphasis>every</emphasis> one of those repositories. This "
dongsheng@627 11631 "is, of course, not a satisfactory solution: if you miss even a single "
dongsheng@627 11632 "repository while you're expunging, the change is still <quote>in the wild</"
dongsheng@627 11633 "quote>, and could propagate further."
dongsheng@627 11634 msgstr ""
dongsheng@627 11635
dongsheng@627 11636 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11637 #: ../en/ch09-undo.xml:628
dongsheng@627 11638 msgid ""
dongsheng@627 11639 "If you've committed one or more changes <emphasis>after</emphasis> the change "
dongsheng@627 11640 "that you'd like to see disappear, your options are further reduced. Mercurial "
dongsheng@627 11641 "doesn't provide a way to <quote>punch a hole</quote> in history, leaving "
dongsheng@627 11642 "changesets intact."
dongsheng@627 11643 msgstr ""
dongsheng@627 11644
dongsheng@627 11645 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 11646 #: ../en/ch09-undo.xml:635
dongsheng@714 11647 msgid "Backing out a merge"
dongsheng@715 11648 msgstr "撤销一个合并"
dongsheng@714 11649
dongsheng@714 11650 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11651 #: ../en/ch09-undo.xml:637
dongsheng@714 11652 msgid ""
dongsheng@714 11653 "Since merges are often complicated, it is not unheard of for a merge to be "
dongsheng@714 11654 "mangled badly, but committed erroneously. Mercurial provides an important "
dongsheng@714 11655 "safeguard against bad merges by refusing to commit unresolved files, but "
dongsheng@714 11656 "human ingenuity guarantees that it is still possible to mess a merge up and "
dongsheng@714 11657 "commit it."
dongsheng@714 11658 msgstr ""
dongsheng@714 11659
dongsheng@714 11660 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11661 #: ../en/ch09-undo.xml:644
dongsheng@714 11662 msgid ""
dongsheng@714 11663 "Given a bad merge that has been committed, usually the best way to approach "
dongsheng@714 11664 "it is to simply try to repair the damage by hand. A complete disaster that "
dongsheng@714 11665 "cannot be easily fixed up by hand ought to be very rare, but the <command "
dongsheng@714 11666 "role=\"hg-cmd\">hg backout</command> command may help in making the cleanup "
dongsheng@714 11667 "easier. It offers a <option role=\"hg-opt-backout\">--parent</option> option, "
dongsheng@714 11668 "which lets you specify which parent to revert to when backing out a merge."
dongsheng@714 11669 msgstr ""
dongsheng@714 11670
dongsheng@714 11671 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
dongsheng@714 11672 #: ../en/ch09-undo.xml:655
dongsheng@714 11673 msgid "A bad merge"
dongsheng@716 11674 msgstr "错误的合并"
dongsheng@714 11675
dongsheng@714 11676 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
dongsheng@714 11677 #: ../en/ch09-undo.xml:657
dongsheng@714 11678 msgid "<imageobject><imagedata fileref=\"figs/bad-merge-1.png\"/></imageobject>"
dongsheng@714 11679 msgstr ""
dongsheng@714 11680
dongsheng@714 11681 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11682 #: ../en/ch09-undo.xml:662
dongsheng@714 11683 msgid ""
dongsheng@714 11684 "Suppose we have a revision graph like that in <xref linkend=\"fig:undo:bad-"
dongsheng@714 11685 "merge-1\"/>. What we'd like is to <emphasis>redo</emphasis> the merge of "
dongsheng@714 11686 "revisions 2 and 3."
dongsheng@714 11687 msgstr ""
dongsheng@714 11688
dongsheng@714 11689 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11690 #: ../en/ch09-undo.xml:667
dongsheng@714 11691 msgid "One way to do so would be as follows."
dongsheng@714 11692 msgstr ""
dongsheng@714 11693
dongsheng@714 11694 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 11695 #: ../en/ch09-undo.xml:671
dongsheng@714 11696 msgid ""
dongsheng@714 11697 "Call <command role=\"hg-cmd\">hg backout --rev=4 --parent=2</command>. This "
dongsheng@714 11698 "tells <command role=\"hg-cmd\">hg backout</command> to back out revision 4, "
dongsheng@714 11699 "which is the bad merge, and to when deciding which revision to prefer, to "
dongsheng@714 11700 "choose parent 2, one of the parents of the merge. The effect can be seen in "
dongsheng@714 11701 "<xref linkend=\"fig:undo:bad-merge-2\"/>."
dongsheng@714 11702 msgstr ""
dongsheng@714 11703
dongsheng@714 11704 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><figure><title>
dongsheng@714 11705 #: ../en/ch09-undo.xml:679
dongsheng@714 11706 msgid "Backing out the merge, favoring one parent"
dongsheng@715 11707 msgstr "拆除合并,关注一个父亲"
dongsheng@714 11708
dongsheng@714 11709 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><figure><mediaobject>
dongsheng@714 11710 #: ../en/ch09-undo.xml:681
dongsheng@714 11711 msgid "<imageobject><imagedata fileref=\"figs/bad-merge-2.png\"/></imageobject>"
dongsheng@714 11712 msgstr ""
dongsheng@715 11713 "<imageobject><imagedata fileref=\"figs/bad-merge-2.png\"/></imageobject>"
dongsheng@714 11714
dongsheng@714 11715 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 11716 #: ../en/ch09-undo.xml:688
dongsheng@714 11717 msgid ""
dongsheng@714 11718 "Call <command role=\"hg-cmd\">hg backout --rev=4 --parent=3</command>. This "
dongsheng@714 11719 "tells <command role=\"hg-cmd\">hg backout</command> to back out revision 4 "
dongsheng@714 11720 "again, but this time to choose parent 3, the other parent of the merge. The "
dongsheng@714 11721 "result is visible in <xref linkend=\"fig:undo:bad-merge-3\"/>, in which the "
dongsheng@714 11722 "repository now contains three heads."
dongsheng@714 11723 msgstr ""
dongsheng@714 11724
dongsheng@714 11725 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><figure><title>
dongsheng@714 11726 #: ../en/ch09-undo.xml:696
dongsheng@714 11727 msgid "Backing out the merge, favoring the other parent"
dongsheng@715 11728 msgstr "拆除合并,关注其它父亲"
dongsheng@714 11729
dongsheng@714 11730 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><figure><mediaobject>
dongsheng@714 11731 #: ../en/ch09-undo.xml:699
dongsheng@714 11732 msgid "<imageobject><imagedata fileref=\"figs/bad-merge-3.png\"/></imageobject>"
dongsheng@714 11733 msgstr ""
dongsheng@715 11734 "<imageobject><imagedata fileref=\"figs/bad-merge-3.png\"/></imageobject>"
dongsheng@714 11735
dongsheng@714 11736 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 11737 #: ../en/ch09-undo.xml:706
dongsheng@714 11738 msgid ""
dongsheng@714 11739 "Redo the bad merge by merging the two backout heads, which reduces the number "
dongsheng@714 11740 "of heads in the repository to two, as can be seen in <xref linkend=\"fig:undo:"
dongsheng@714 11741 "bad-merge-4\"/>."
dongsheng@714 11742 msgstr ""
dongsheng@714 11743
dongsheng@714 11744 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><figure><title>
dongsheng@714 11745 #: ../en/ch09-undo.xml:711 ../en/ch09-undo.xml:724
dongsheng@714 11746 msgid "Merging the backouts"
dongsheng@715 11747 msgstr "合并拆除"
dongsheng@714 11748
dongsheng@714 11749 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><figure><mediaobject>
dongsheng@714 11750 #: ../en/ch09-undo.xml:713
dongsheng@714 11751 msgid "<imageobject><imagedata fileref=\"figs/bad-merge-4.png\"/></imageobject>"
dongsheng@714 11752 msgstr ""
dongsheng@715 11753 "<imageobject><imagedata fileref=\"figs/bad-merge-4.png\"/></imageobject>"
dongsheng@714 11754
dongsheng@714 11755 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 11756 #: ../en/ch09-undo.xml:720
dongsheng@714 11757 msgid ""
dongsheng@714 11758 "Merge with the commit that was made after the bad merge, as shown in <xref "
dongsheng@714 11759 "linkend=\"fig:undo:bad-merge-5\"/>."
dongsheng@714 11760 msgstr ""
dongsheng@714 11761
dongsheng@714 11762 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><figure><mediaobject>
dongsheng@714 11763 #: ../en/ch09-undo.xml:726
dongsheng@714 11764 msgid "<imageobject><imagedata fileref=\"figs/bad-merge-5.png\"/></imageobject>"
dongsheng@714 11765 msgstr ""
dongsheng@714 11766
dongsheng@714 11767 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 11768 #: ../en/ch09-undo.xml:735
dongsheng@627 11769 msgid "Protect yourself from <quote>escaped</quote> changes"
dongsheng@635 11770 msgstr "使用<quote>校验</quote>修改来保护你自己"
dongsheng@627 11771
dongsheng@627 11772 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11773 #: ../en/ch09-undo.xml:738
dongsheng@627 11774 msgid ""
dongsheng@627 11775 "If you've committed some changes to your local repository and they've been "
dongsheng@627 11776 "pushed or pulled somewhere else, this isn't necessarily a disaster. You can "
dongsheng@627 11777 "protect yourself ahead of time against some classes of bad changeset. This "
dongsheng@627 11778 "is particularly easy if your team usually pulls changes from a central "
dongsheng@627 11779 "repository."
dongsheng@627 11780 msgstr ""
dongsheng@627 11781
dongsheng@627 11782 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11783 #: ../en/ch09-undo.xml:745
dongsheng@627 11784 msgid ""
dongsheng@627 11785 "By configuring some hooks on that repository to validate incoming changesets "
songdongsheng@658 11786 "(see chapter <xref linkend=\"chap:hook\"/>), you can automatically prevent "
dongsheng@627 11787 "some kinds of bad changeset from being pushed to the central repository at "
dongsheng@627 11788 "all. With such a configuration in place, some kinds of bad changeset will "
dongsheng@627 11789 "naturally tend to <quote>die out</quote> because they can't propagate into "
dongsheng@627 11790 "the central repository. Better yet, this happens without any need for "
dongsheng@627 11791 "explicit intervention."
dongsheng@627 11792 msgstr ""
dongsheng@627 11793
dongsheng@627 11794 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11795 #: ../en/ch09-undo.xml:755
dongsheng@627 11796 msgid ""
dongsheng@627 11797 "For instance, an incoming change hook that verifies that a changeset will "
dongsheng@714 11798 "actually compile can prevent people from inadvertently <quote>breaking the "
dongsheng@627 11799 "build</quote>."
dongsheng@627 11800 msgstr ""
dongsheng@627 11801
dongsheng@714 11802 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 11803 #: ../en/ch09-undo.xml:762
dongsheng@714 11804 msgid "What to do about sensitive changes that escape"
dongsheng@716 11805 msgstr "处理敏感信息泄漏的方法"
dongsheng@714 11806
dongsheng@714 11807 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11808 #: ../en/ch09-undo.xml:764
dongsheng@714 11809 msgid ""
dongsheng@714 11810 "Even a carefully run project can suffer an unfortunate event such as the "
dongsheng@714 11811 "committing and uncontrolled propagation of a file that contains important "
dongsheng@714 11812 "passwords."
dongsheng@714 11813 msgstr ""
dongsheng@714 11814
dongsheng@714 11815 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11816 #: ../en/ch09-undo.xml:768
dongsheng@714 11817 msgid ""
dongsheng@714 11818 "If something like this happens to you, and the information that gets "
dongsheng@714 11819 "accidentally propagated is truly sensitive, your first step should be to "
dongsheng@714 11820 "mitigate the effect of the leak without trying to control the leak itself. If "
dongsheng@714 11821 "you are not 100% certain that you know exactly who could have seen the "
dongsheng@714 11822 "changes, you should immediately change passwords, cancel credit cards, or "
dongsheng@714 11823 "find some other way to make sure that the information that has leaked is no "
dongsheng@714 11824 "longer useful. In other words, assume that the change has propagated far and "
dongsheng@714 11825 "wide, and that there's nothing more you can do."
dongsheng@714 11826 msgstr ""
dongsheng@714 11827
dongsheng@714 11828 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11829 #: ../en/ch09-undo.xml:779
dongsheng@714 11830 msgid ""
dongsheng@714 11831 "You might hope that there would be mechanisms you could use to either figure "
dongsheng@714 11832 "out who has seen a change or to erase the change permanently everywhere, but "
dongsheng@714 11833 "there are good reasons why these are not possible."
dongsheng@714 11834 msgstr ""
dongsheng@714 11835
dongsheng@714 11836 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11837 #: ../en/ch09-undo.xml:784
dongsheng@714 11838 msgid ""
dongsheng@714 11839 "Mercurial does not provide an audit trail of who has pulled changes from a "
dongsheng@714 11840 "repository, because it is usually either impossible to record such "
dongsheng@714 11841 "information or trivial to spoof it. In a multi-user or networked "
dongsheng@714 11842 "environment, you should thus be extremely skeptical of yourself if you think "
dongsheng@714 11843 "that you have identified every place that a sensitive changeset has "
dongsheng@714 11844 "propagated to. Don't forget that people can and will send bundles by email, "
dongsheng@714 11845 "have their backup software save data offsite, carry repositories on USB "
dongsheng@714 11846 "sticks, and find other completely innocent ways to confound your attempts to "
dongsheng@714 11847 "track down every copy of a problematic change."
dongsheng@714 11848 msgstr ""
dongsheng@714 11849
dongsheng@714 11850 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11851 #: ../en/ch09-undo.xml:796
dongsheng@714 11852 msgid ""
dongsheng@714 11853 "Mercurial also does not provide a way to make a file or changeset completely "
dongsheng@714 11854 "disappear from history, because there is no way to enforce its disappearance; "
dongsheng@714 11855 "someone could easily modify their copy of Mercurial to ignore such "
dongsheng@714 11856 "directives. In addition, even if Mercurial provided such a capability, "
dongsheng@714 11857 "someone who simply hadn't pulled a <quote>make this file disappear</quote> "
dongsheng@714 11858 "changeset wouldn't be affected by it, nor would web crawlers visiting at the "
dongsheng@714 11859 "wrong time, disk backups, or other mechanisms. Indeed, no distributed "
dongsheng@714 11860 "revision control system can make data reliably vanish. Providing the illusion "
dongsheng@714 11861 "of such control could easily give a false sense of security, and be worse "
dongsheng@714 11862 "than not providing it at all."
dongsheng@714 11863 msgstr ""
dongsheng@714 11864
dongsheng@627 11865 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 11866 #: ../en/ch09-undo.xml:812
dongsheng@627 11867 msgid "Finding the source of a bug"
dongsheng@635 11868 msgstr "查找问题的根源"
dongsheng@627 11869
dongsheng@627 11870 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11871 #: ../en/ch09-undo.xml:814
dongsheng@627 11872 msgid ""
dongsheng@627 11873 "While it's all very well to be able to back out a changeset that introduced a "
dongsheng@627 11874 "bug, this requires that you know which changeset to back out. Mercurial "
dongsheng@627 11875 "provides an invaluable command, called <command role=\"hg-cmd\">hg bisect</"
dongsheng@627 11876 "command>, that helps you to automate this process and accomplish it very "
dongsheng@627 11877 "efficiently."
dongsheng@627 11878 msgstr ""
dongsheng@627 11879
dongsheng@627 11880 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11881 #: ../en/ch09-undo.xml:821
dongsheng@627 11882 msgid ""
dongsheng@627 11883 "The idea behind the <command role=\"hg-cmd\">hg bisect</command> command is "
songdongsheng@710 11884 "that a changeset has introduced some change of behavior that you can identify "
dongsheng@714 11885 "with a simple pass/fail test. You don't know which piece of code introduced "
dongsheng@714 11886 "the change, but you know how to test for the presence of the bug. The "
dongsheng@714 11887 "<command role=\"hg-cmd\">hg bisect</command> command uses your test to direct "
dongsheng@714 11888 "its search for the changeset that introduced the code that caused the bug."
dongsheng@714 11889 msgstr ""
dongsheng@714 11890
dongsheng@714 11891 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11892 #: ../en/ch09-undo.xml:830
dongsheng@627 11893 msgid ""
dongsheng@627 11894 "Here are a few scenarios to help you understand how you might apply this "
dongsheng@627 11895 "command."
dongsheng@627 11896 msgstr ""
dongsheng@627 11897
dongsheng@627 11898 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 11899 #: ../en/ch09-undo.xml:833
dongsheng@627 11900 msgid ""
dongsheng@627 11901 "The most recent version of your software has a bug that you remember wasn't "
dongsheng@627 11902 "present a few weeks ago, but you don't know when it was introduced. Here, "
dongsheng@627 11903 "your binary test checks for the presence of that bug."
dongsheng@627 11904 msgstr ""
dongsheng@627 11905
dongsheng@627 11906 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 11907 #: ../en/ch09-undo.xml:838
dongsheng@627 11908 msgid ""
dongsheng@627 11909 "You fixed a bug in a rush, and now it's time to close the entry in your "
dongsheng@627 11910 "team's bug database. The bug database requires a changeset ID when you close "
dongsheng@627 11911 "an entry, but you don't remember which changeset you fixed the bug in. Once "
dongsheng@627 11912 "again, your binary test checks for the presence of the bug."
dongsheng@627 11913 msgstr ""
dongsheng@627 11914
dongsheng@627 11915 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 11916 #: ../en/ch09-undo.xml:845
dongsheng@627 11917 msgid ""
dongsheng@627 11918 "Your software works correctly, but runs 15% slower than the last time you "
dongsheng@627 11919 "measured it. You want to know which changeset introduced the performance "
dongsheng@627 11920 "regression. In this case, your binary test measures the performance of your "
dongsheng@627 11921 "software, to see whether it's <quote>fast</quote> or <quote>slow</quote>."
dongsheng@627 11922 msgstr ""
dongsheng@627 11923
dongsheng@627 11924 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 11925 #: ../en/ch09-undo.xml:852
dongsheng@627 11926 msgid ""
dongsheng@627 11927 "The sizes of the components of your project that you ship exploded recently, "
dongsheng@627 11928 "and you suspect that something changed in the way you build your project."
dongsheng@627 11929 msgstr ""
dongsheng@627 11930
dongsheng@627 11931 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11932 #: ../en/ch09-undo.xml:857
dongsheng@627 11933 msgid ""
dongsheng@627 11934 "From these examples, it should be clear that the <command role=\"hg-cmd\">hg "
dongsheng@627 11935 "bisect</command> command is not useful only for finding the sources of bugs. "
dongsheng@627 11936 "You can use it to find any <quote>emergent property</quote> of a repository "
dongsheng@627 11937 "(anything that you can't find from a simple text search of the files in the "
dongsheng@627 11938 "tree) for which you can write a binary test."
dongsheng@627 11939 msgstr ""
dongsheng@627 11940
dongsheng@627 11941 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11942 #: ../en/ch09-undo.xml:864
dongsheng@627 11943 msgid ""
dongsheng@627 11944 "We'll introduce a little bit of terminology here, just to make it clear which "
dongsheng@627 11945 "parts of the search process are your responsibility, and which are "
dongsheng@627 11946 "Mercurial's. A <emphasis>test</emphasis> is something that <emphasis>you</"
dongsheng@627 11947 "emphasis> run when <command role=\"hg-cmd\">hg bisect</command> chooses a "
dongsheng@627 11948 "changeset. A <emphasis>probe</emphasis> is what <command role=\"hg-cmd\">hg "
dongsheng@627 11949 "bisect</command> runs to tell whether a revision is good. Finally, we'll use "
dongsheng@627 11950 "the word <quote>bisect</quote>, as both a noun and a verb, to stand in for "
dongsheng@627 11951 "the phrase <quote>search using the <command role=\"hg-cmd\">hg bisect</"
dongsheng@627 11952 "command> command</quote>."
dongsheng@627 11953 msgstr ""
dongsheng@627 11954
dongsheng@627 11955 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11956 #: ../en/ch09-undo.xml:877
dongsheng@627 11957 msgid ""
dongsheng@627 11958 "One simple way to automate the searching process would be simply to probe "
dongsheng@627 11959 "every changeset. However, this scales poorly. If it took ten minutes to "
dongsheng@627 11960 "test a single changeset, and you had 10,000 changesets in your repository, "
dongsheng@627 11961 "the exhaustive approach would take on average 35 <emphasis>days</emphasis> to "
dongsheng@627 11962 "find the changeset that introduced a bug. Even if you knew that the bug was "
dongsheng@627 11963 "introduced by one of the last 500 changesets, and limited your search to "
dongsheng@627 11964 "those, you'd still be looking at over 40 hours to find the changeset that "
dongsheng@627 11965 "introduced your bug."
dongsheng@627 11966 msgstr ""
dongsheng@627 11967
dongsheng@627 11968 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11969 #: ../en/ch09-undo.xml:887
dongsheng@627 11970 msgid ""
dongsheng@627 11971 "What the <command role=\"hg-cmd\">hg bisect</command> command does is use its "
dongsheng@627 11972 "knowledge of the <quote>shape</quote> of your project's revision history to "
dongsheng@627 11973 "perform a search in time proportional to the <emphasis>logarithm</emphasis> "
dongsheng@627 11974 "of the number of changesets to check (the kind of search it performs is "
dongsheng@627 11975 "called a dichotomic search). With this approach, searching through 10,000 "
dongsheng@627 11976 "changesets will take less than three hours, even at ten minutes per test (the "
dongsheng@627 11977 "search will require about 14 tests). Limit your search to the last hundred "
dongsheng@627 11978 "changesets, and it will take only about an hour (roughly seven tests)."
dongsheng@627 11979 msgstr ""
dongsheng@627 11980
dongsheng@627 11981 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 11982 #: ../en/ch09-undo.xml:898
dongsheng@627 11983 msgid ""
dongsheng@627 11984 "The <command role=\"hg-cmd\">hg bisect</command> command is aware of the "
dongsheng@627 11985 "<quote>branchy</quote> nature of a Mercurial project's revision history, so "
dongsheng@627 11986 "it has no problems dealing with branches, merges, or multiple heads in a "
dongsheng@627 11987 "repository. It can prune entire branches of history with a single probe, "
dongsheng@627 11988 "which is how it operates so efficiently."
dongsheng@627 11989 msgstr ""
dongsheng@627 11990
dongsheng@627 11991 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 11992 #: ../en/ch09-undo.xml:906
dongsheng@627 11993 msgid "Using the <command role=\"hg-cmd\">hg bisect</command> command"
dongsheng@635 11994 msgstr "使用命令 <command role=\"hg-cmd\">hg bisect</command>"
dongsheng@627 11995
dongsheng@627 11996 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 11997 #: ../en/ch09-undo.xml:909
dongsheng@627 11998 msgid ""
dongsheng@627 11999 "Here's an example of <command role=\"hg-cmd\">hg bisect</command> in action."
dongsheng@627 12000 msgstr ""
dongsheng@627 12001
dongsheng@627 12002 #. type: Content of: <book><chapter><sect1><sect2><note><para>
dongsheng@714 12003 #: ../en/ch09-undo.xml:913
dongsheng@627 12004 msgid ""
dongsheng@627 12005 "In versions 0.9.5 and earlier of Mercurial, <command role=\"hg-cmd\">hg "
dongsheng@627 12006 "bisect</command> was not a core command: it was distributed with Mercurial as "
dongsheng@627 12007 "an extension. This section describes the built-in command, not the old "
dongsheng@627 12008 "extension."
dongsheng@627 12009 msgstr ""
dongsheng@627 12010
dongsheng@627 12011 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12012 #: ../en/ch09-undo.xml:920
dongsheng@627 12013 msgid ""
dongsheng@627 12014 "Now let's create a repository, so that we can try out the <command role=\"hg-"
dongsheng@627 12015 "cmd\">hg bisect</command> command in isolation."
dongsheng@627 12016 msgstr ""
dongsheng@627 12017
dongsheng@627 12018 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12019 #: ../en/ch09-undo.xml:926
dongsheng@627 12020 msgid ""
dongsheng@627 12021 "We'll simulate a project that has a bug in it in a simple-minded way: create "
dongsheng@627 12022 "trivial changes in a loop, and nominate one specific change that will have "
dongsheng@627 12023 "the <quote>bug</quote>. This loop creates 35 changesets, each adding a "
dongsheng@627 12024 "single file to the repository. We'll represent our <quote>bug</quote> with a "
dongsheng@627 12025 "file that contains the text <quote>i have a gub</quote>."
dongsheng@627 12026 msgstr ""
dongsheng@627 12027
dongsheng@627 12028 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12029 #: ../en/ch09-undo.xml:936
dongsheng@627 12030 msgid ""
dongsheng@627 12031 "The next thing that we'd like to do is figure out how to use the <command "
dongsheng@627 12032 "role=\"hg-cmd\">hg bisect</command> command. We can use Mercurial's normal "
dongsheng@627 12033 "built-in help mechanism for this."
dongsheng@627 12034 msgstr ""
dongsheng@627 12035
dongsheng@627 12036 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12037 #: ../en/ch09-undo.xml:943
dongsheng@627 12038 msgid ""
dongsheng@627 12039 "The <command role=\"hg-cmd\">hg bisect</command> command works in steps. "
dongsheng@627 12040 "Each step proceeds as follows."
dongsheng@627 12041 msgstr ""
dongsheng@627 12042
dongsheng@627 12043 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 12044 #: ../en/ch09-undo.xml:946
dongsheng@627 12045 msgid "You run your binary test."
dongsheng@627 12046 msgstr ""
dongsheng@627 12047
dongsheng@627 12048 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><itemizedlist><listitem><para>
dongsheng@714 12049 #: ../en/ch09-undo.xml:948
dongsheng@627 12050 msgid ""
dongsheng@627 12051 "If the test succeeded, you tell <command role=\"hg-cmd\">hg bisect</command> "
dongsheng@714 12052 "by running the <command role=\"hg-cmd\">hg bisect --good</command> command."
dongsheng@715 12053 msgstr ""
dongsheng@715 12054 "当测试成功后,使用 <command role=\"hg-cmd\">hg bisect --good</command> 命令告"
dongsheng@715 12055 "诉 <command role=\"hg-cmd\">hg bisect</command> 命令。"
dongsheng@627 12056
dongsheng@627 12057 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><itemizedlist><listitem><para>
dongsheng@714 12058 #: ../en/ch09-undo.xml:953
dongsheng@714 12059 msgid ""
dongsheng@714 12060 "If it failed, run the <command role=\"hg-cmd\">hg bisect --bad</command> "
dongsheng@627 12061 "command."
dongsheng@715 12062 msgstr ""
dongsheng@715 12063 "如果失败,执行 <command role=\"hg-cmd\">hg bisect --bad</command> 命令。"
dongsheng@627 12064
dongsheng@627 12065 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 12066 #: ../en/ch09-undo.xml:957
dongsheng@627 12067 msgid ""
dongsheng@627 12068 "The command uses your information to decide which changeset to test next."
dongsheng@627 12069 msgstr ""
dongsheng@627 12070
dongsheng@627 12071 #. type: Content of: <book><chapter><sect1><sect2><orderedlist><listitem><para>
dongsheng@714 12072 #: ../en/ch09-undo.xml:960
dongsheng@627 12073 msgid ""
dongsheng@627 12074 "It updates the working directory to that changeset, and the process begins "
dongsheng@627 12075 "again."
dongsheng@627 12076 msgstr ""
dongsheng@627 12077
dongsheng@627 12078 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12079 #: ../en/ch09-undo.xml:963
dongsheng@627 12080 msgid ""
dongsheng@627 12081 "The process ends when <command role=\"hg-cmd\">hg bisect</command> identifies "
dongsheng@627 12082 "a unique changeset that marks the point where your test transitioned from "
dongsheng@627 12083 "<quote>succeeding</quote> to <quote>failing</quote>."
dongsheng@627 12084 msgstr ""
dongsheng@627 12085
dongsheng@627 12086 #
dongsheng@627 12087 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12088 #: ../en/ch09-undo.xml:968
dongsheng@627 12089 msgid ""
dongsheng@627 12090 "To start the search, we must run the <command role=\"hg-cmd\">hg bisect --"
dongsheng@627 12091 "reset</command> command."
dongsheng@627 12092 msgstr ""
dongsheng@627 12093
dongsheng@627 12094 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12095 #: ../en/ch09-undo.xml:973
dongsheng@627 12096 msgid ""
dongsheng@627 12097 "In our case, the binary test we use is simple: we check to see if any file in "
dongsheng@627 12098 "the repository contains the string <quote>i have a gub</quote>. If it does, "
dongsheng@627 12099 "this changeset contains the change that <quote>caused the bug</quote>. By "
dongsheng@627 12100 "convention, a changeset that has the property we're searching for is "
dongsheng@627 12101 "<quote>bad</quote>, while one that doesn't is <quote>good</quote>."
dongsheng@627 12102 msgstr ""
dongsheng@627 12103
dongsheng@627 12104 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12105 #: ../en/ch09-undo.xml:981
dongsheng@627 12106 msgid ""
dongsheng@627 12107 "Most of the time, the revision to which the working directory is synced "
dongsheng@627 12108 "(usually the tip) already exhibits the problem introduced by the buggy "
dongsheng@627 12109 "change, so we'll mark it as <quote>bad</quote>."
dongsheng@627 12110 msgstr ""
dongsheng@627 12111
dongsheng@627 12112 #
dongsheng@627 12113 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12114 #: ../en/ch09-undo.xml:988
dongsheng@627 12115 msgid ""
dongsheng@627 12116 "Our next task is to nominate a changeset that we know <emphasis>doesn't</"
dongsheng@627 12117 "emphasis> have the bug; the <command role=\"hg-cmd\">hg bisect</command> "
dongsheng@627 12118 "command will <quote>bracket</quote> its search between the first pair of good "
dongsheng@627 12119 "and bad changesets. In our case, we know that revision 10 didn't have the "
dongsheng@627 12120 "bug. (I'll have more words about choosing the first <quote>good</quote> "
dongsheng@627 12121 "changeset later.)"
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:998
dongsheng@627 12126 msgid "Notice that this command printed some output."
dongsheng@627 12127 msgstr ""
dongsheng@627 12128
dongsheng@627 12129 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 12130 #: ../en/ch09-undo.xml:1000
dongsheng@627 12131 msgid ""
dongsheng@627 12132 "It told us how many changesets it must consider before it can identify the "
dongsheng@627 12133 "one that introduced the bug, and how many tests that will require."
dongsheng@627 12134 msgstr ""
dongsheng@627 12135
dongsheng@627 12136 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 12137 #: ../en/ch09-undo.xml:1004
dongsheng@627 12138 msgid ""
dongsheng@627 12139 "It updated the working directory to the next changeset to test, and told us "
dongsheng@627 12140 "which changeset it's testing."
dongsheng@627 12141 msgstr ""
dongsheng@627 12142
dongsheng@627 12143 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12144 #: ../en/ch09-undo.xml:1009
dongsheng@627 12145 msgid ""
dongsheng@627 12146 "We now run our test in the working directory. We use the <command>grep</"
dongsheng@627 12147 "command> command to see if our <quote>bad</quote> file is present in the "
dongsheng@627 12148 "working directory. If it is, this revision is bad; if not, this revision is "
dongsheng@627 12149 "good. &interaction.bisect.search.step1;"
dongsheng@627 12150 msgstr ""
dongsheng@627 12151
dongsheng@627 12152 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12153 #: ../en/ch09-undo.xml:1015
dongsheng@627 12154 msgid ""
dongsheng@627 12155 "This test looks like a perfect candidate for automation, so let's turn it "
dongsheng@627 12156 "into a shell function."
dongsheng@627 12157 msgstr ""
dongsheng@627 12158
dongsheng@627 12159 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12160 #: ../en/ch09-undo.xml:1019
dongsheng@627 12161 msgid ""
dongsheng@627 12162 "We can now run an entire test step with a single command, <literal>mytest</"
dongsheng@627 12163 "literal>."
dongsheng@627 12164 msgstr ""
dongsheng@627 12165
dongsheng@627 12166 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12167 #: ../en/ch09-undo.xml:1024
dongsheng@627 12168 msgid "A few more invocations of our canned test step command, and we're done."
dongsheng@627 12169 msgstr ""
dongsheng@627 12170
dongsheng@627 12171 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12172 #: ../en/ch09-undo.xml:1029
dongsheng@627 12173 msgid ""
dongsheng@627 12174 "Even though we had 40 changesets to search through, the <command role=\"hg-cmd"
dongsheng@627 12175 "\">hg bisect</command> command let us find the changeset that introduced our "
dongsheng@627 12176 "<quote>bug</quote> with only five tests. Because the number of tests that "
dongsheng@627 12177 "the <command role=\"hg-cmd\">hg bisect</command> command performs grows "
dongsheng@627 12178 "logarithmically with the number of changesets to search, the advantage that "
dongsheng@627 12179 "it has over the <quote>brute force</quote> search approach increases with "
dongsheng@627 12180 "every changeset you add."
dongsheng@627 12181 msgstr ""
dongsheng@627 12182
dongsheng@627 12183 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 12184 #: ../en/ch09-undo.xml:1040
dongsheng@627 12185 msgid "Cleaning up after your search"
dongsheng@635 12186 msgstr "搜索后的清理"
dongsheng@627 12187
dongsheng@714 12188 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12189 #: ../en/ch09-undo.xml:1042
dongsheng@627 12190 msgid ""
dongsheng@627 12191 "When you're finished using the <command role=\"hg-cmd\">hg bisect</command> "
dongsheng@714 12192 "command in a repository, you can use the <command role=\"hg-cmd\">hg bisect --"
dongsheng@627 12193 "reset</command> command to drop the information it was using to drive your "
dongsheng@627 12194 "search. The command doesn't use much space, so it doesn't matter if you "
dongsheng@627 12195 "forget to run this command. However, <command role=\"hg-cmd\">hg bisect</"
dongsheng@627 12196 "command> won't let you start a new search in that repository until you do a "
dongsheng@714 12197 "<command role=\"hg-cmd\">hg bisect --reset</command>."
dongsheng@627 12198 msgstr ""
dongsheng@627 12199
dongsheng@627 12200 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 12201 #: ../en/ch09-undo.xml:1057
dongsheng@627 12202 msgid "Tips for finding bugs effectively"
dongsheng@635 12203 msgstr "有效查找问题的技巧"
dongsheng@627 12204
dongsheng@627 12205 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 12206 #: ../en/ch09-undo.xml:1060
dongsheng@627 12207 msgid "Give consistent input"
dongsheng@635 12208 msgstr "给出一致的输入"
dongsheng@627 12209
dongsheng@627 12210 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12211 #: ../en/ch09-undo.xml:1062
dongsheng@627 12212 msgid ""
dongsheng@627 12213 "The <command role=\"hg-cmd\">hg bisect</command> command requires that you "
dongsheng@627 12214 "correctly report the result of every test you perform. If you tell it that a "
dongsheng@627 12215 "test failed when it really succeeded, it <emphasis>might</emphasis> be able "
dongsheng@627 12216 "to detect the inconsistency. If it can identify an inconsistency in your "
dongsheng@627 12217 "reports, it will tell you that a particular changeset is both good and bad. "
dongsheng@627 12218 "However, it can't do this perfectly; it's about as likely to report the wrong "
dongsheng@627 12219 "changeset as the source of the bug."
dongsheng@627 12220 msgstr ""
dongsheng@627 12221
dongsheng@627 12222 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 12223 #: ../en/ch09-undo.xml:1074
dongsheng@627 12224 msgid "Automate as much as possible"
dongsheng@635 12225 msgstr "尽量自动"
dongsheng@627 12226
dongsheng@627 12227 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12228 #: ../en/ch09-undo.xml:1076
dongsheng@627 12229 msgid ""
dongsheng@627 12230 "When I started using the <command role=\"hg-cmd\">hg bisect</command> "
dongsheng@627 12231 "command, I tried a few times to run my tests by hand, on the command line. "
dongsheng@627 12232 "This is an approach that I, at least, am not suited to. After a few tries, I "
dongsheng@627 12233 "found that I was making enough mistakes that I was having to restart my "
dongsheng@627 12234 "searches several times before finally getting correct results."
dongsheng@627 12235 msgstr ""
dongsheng@627 12236
dongsheng@627 12237 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12238 #: ../en/ch09-undo.xml:1084
dongsheng@627 12239 msgid ""
dongsheng@627 12240 "My initial problems with driving the <command role=\"hg-cmd\">hg bisect</"
dongsheng@627 12241 "command> command by hand occurred even with simple searches on small "
dongsheng@627 12242 "repositories; if the problem you're looking for is more subtle, or the number "
dongsheng@627 12243 "of tests that <command role=\"hg-cmd\">hg bisect</command> must perform "
dongsheng@627 12244 "increases, the likelihood of operator error ruining the search is much "
dongsheng@627 12245 "higher. Once I started automating my tests, I had much better results."
dongsheng@627 12246 msgstr ""
dongsheng@627 12247
dongsheng@627 12248 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12249 #: ../en/ch09-undo.xml:1093
dongsheng@627 12250 msgid "The key to automated testing is twofold:"
dongsheng@627 12251 msgstr ""
dongsheng@627 12252
dongsheng@627 12253 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 12254 #: ../en/ch09-undo.xml:1095
dongsheng@627 12255 msgid "always test for the same symptom, and"
dongsheng@627 12256 msgstr ""
dongsheng@627 12257
dongsheng@627 12258 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 12259 #: ../en/ch09-undo.xml:1097
dongsheng@627 12260 msgid ""
dongsheng@627 12261 "always feed consistent input to the <command role=\"hg-cmd\">hg bisect</"
dongsheng@627 12262 "command> command."
dongsheng@627 12263 msgstr ""
dongsheng@627 12264
dongsheng@627 12265 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12266 #: ../en/ch09-undo.xml:1100
dongsheng@627 12267 msgid ""
dongsheng@627 12268 "In my tutorial example above, the <command>grep</command> command tests for "
dongsheng@627 12269 "the symptom, and the <literal>if</literal> statement takes the result of this "
dongsheng@627 12270 "check and ensures that we always feed the same input to the <command role="
dongsheng@627 12271 "\"hg-cmd\">hg bisect</command> command. The <literal>mytest</literal> "
dongsheng@627 12272 "function marries these together in a reproducible way, so that every test is "
dongsheng@627 12273 "uniform and consistent."
dongsheng@627 12274 msgstr ""
dongsheng@627 12275
dongsheng@627 12276 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 12277 #: ../en/ch09-undo.xml:1110
dongsheng@627 12278 msgid "Check your results"
dongsheng@635 12279 msgstr "检查你的结果"
dongsheng@627 12280
dongsheng@627 12281 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12282 #: ../en/ch09-undo.xml:1112
dongsheng@627 12283 msgid ""
dongsheng@627 12284 "Because the output of a <command role=\"hg-cmd\">hg bisect</command> search "
dongsheng@627 12285 "is only as good as the input you give it, don't take the changeset it reports "
dongsheng@627 12286 "as the absolute truth. A simple way to cross-check its report is to manually "
dongsheng@627 12287 "run your test at each of the following changesets:"
dongsheng@627 12288 msgstr ""
dongsheng@627 12289
dongsheng@627 12290 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 12291 #: ../en/ch09-undo.xml:1118
dongsheng@627 12292 msgid ""
dongsheng@627 12293 "The changeset that it reports as the first bad revision. Your test should "
dongsheng@627 12294 "still report this as bad."
dongsheng@627 12295 msgstr ""
dongsheng@627 12296
dongsheng@627 12297 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 12298 #: ../en/ch09-undo.xml:1122
dongsheng@627 12299 msgid ""
dongsheng@627 12300 "The parent of that changeset (either parent, if it's a merge). Your test "
dongsheng@627 12301 "should report this changeset as good."
dongsheng@627 12302 msgstr ""
dongsheng@627 12303
dongsheng@627 12304 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 12305 #: ../en/ch09-undo.xml:1126
dongsheng@627 12306 msgid ""
dongsheng@627 12307 "A child of that changeset. Your test should report this changeset as bad."
dongsheng@627 12308 msgstr ""
dongsheng@627 12309
dongsheng@627 12310 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 12311 #: ../en/ch09-undo.xml:1132
dongsheng@627 12312 msgid "Beware interference between bugs"
dongsheng@635 12313 msgstr "谨防问题之间的冲突"
dongsheng@627 12314
dongsheng@627 12315 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12316 #: ../en/ch09-undo.xml:1134
dongsheng@627 12317 msgid ""
dongsheng@627 12318 "It's possible that your search for one bug could be disrupted by the presence "
dongsheng@627 12319 "of another. For example, let's say your software crashes at revision 100, "
dongsheng@627 12320 "and worked correctly at revision 50. Unknown to you, someone else introduced "
dongsheng@627 12321 "a different crashing bug at revision 60, and fixed it at revision 80. This "
dongsheng@627 12322 "could distort your results in one of several ways."
dongsheng@627 12323 msgstr ""
dongsheng@627 12324
dongsheng@627 12325 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12326 #: ../en/ch09-undo.xml:1142
dongsheng@627 12327 msgid ""
dongsheng@627 12328 "It is possible that this other bug completely <quote>masks</quote> yours, "
dongsheng@627 12329 "which is to say that it occurs before your bug has a chance to manifest "
dongsheng@627 12330 "itself. If you can't avoid that other bug (for example, it prevents your "
dongsheng@627 12331 "project from building), and so can't tell whether your bug is present in a "
dongsheng@627 12332 "particular changeset, the <command role=\"hg-cmd\">hg bisect</command> "
dongsheng@627 12333 "command cannot help you directly. Instead, you can mark a changeset as "
dongsheng@627 12334 "untested by running <command role=\"hg-cmd\">hg bisect --skip</command>."
dongsheng@627 12335 msgstr ""
dongsheng@627 12336
dongsheng@627 12337 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12338 #: ../en/ch09-undo.xml:1152
dongsheng@627 12339 msgid ""
dongsheng@627 12340 "A different problem could arise if your test for a bug's presence is not "
dongsheng@627 12341 "specific enough. If you check for <quote>my program crashes</quote>, then "
dongsheng@627 12342 "both your crashing bug and an unrelated crashing bug that masks it will look "
dongsheng@627 12343 "like the same thing, and mislead <command role=\"hg-cmd\">hg bisect</command>."
dongsheng@627 12344 msgstr ""
dongsheng@627 12345
dongsheng@627 12346 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12347 #: ../en/ch09-undo.xml:1159
dongsheng@627 12348 msgid ""
dongsheng@627 12349 "Another useful situation in which to use <command role=\"hg-cmd\">hg bisect --"
dongsheng@627 12350 "skip</command> is if you can't test a revision because your project was in a "
dongsheng@627 12351 "broken and hence untestable state at that revision, perhaps because someone "
dongsheng@627 12352 "checked in a change that prevented the project from building."
dongsheng@627 12353 msgstr ""
dongsheng@627 12354
dongsheng@627 12355 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 12356 #: ../en/ch09-undo.xml:1168
dongsheng@627 12357 msgid "Bracket your search lazily"
dongsheng@635 12358 msgstr "减少你的查找工作"
dongsheng@627 12359
dongsheng@627 12360 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12361 #: ../en/ch09-undo.xml:1170
dongsheng@627 12362 msgid ""
dongsheng@627 12363 "Choosing the first <quote>good</quote> and <quote>bad</quote> changesets that "
dongsheng@627 12364 "will mark the end points of your search is often easy, but it bears a little "
dongsheng@627 12365 "discussion nevertheless. From the perspective of <command role=\"hg-cmd\">hg "
dongsheng@627 12366 "bisect</command>, the <quote>newest</quote> changeset is conventionally "
dongsheng@627 12367 "<quote>bad</quote>, and the older changeset is <quote>good</quote>."
dongsheng@627 12368 msgstr ""
dongsheng@627 12369
dongsheng@627 12370 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12371 #: ../en/ch09-undo.xml:1178
dongsheng@627 12372 msgid ""
dongsheng@627 12373 "If you're having trouble remembering when a suitable <quote>good</quote> "
dongsheng@627 12374 "change was, so that you can tell <command role=\"hg-cmd\">hg bisect</"
dongsheng@627 12375 "command>, you could do worse than testing changesets at random. Just "
dongsheng@627 12376 "remember to eliminate contenders that can't possibly exhibit the bug (perhaps "
dongsheng@627 12377 "because the feature with the bug isn't present yet) and those where another "
dongsheng@627 12378 "problem masks the bug (as I discussed above)."
dongsheng@627 12379 msgstr ""
dongsheng@627 12380
dongsheng@627 12381 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12382 #: ../en/ch09-undo.xml:1187
dongsheng@627 12383 msgid ""
dongsheng@627 12384 "Even if you end up <quote>early</quote> by thousands of changesets or months "
dongsheng@627 12385 "of history, you will only add a handful of tests to the total number that "
dongsheng@627 12386 "<command role=\"hg-cmd\">hg bisect</command> must perform, thanks to its "
songdongsheng@710 12387 "logarithmic behavior."
dongsheng@627 12388 msgstr ""
dongsheng@627 12389
dongsheng@627 12390 #. type: Content of: <book><chapter><title>
dongsheng@714 12391 #: ../en/ch10-hook.xml:5
dongsheng@627 12392 msgid "Handling repository events with hooks"
dongsheng@627 12393 msgstr "使用钩子处理版本库事件"
dongsheng@627 12394
dongsheng@627 12395 #. type: Content of: <book><chapter><para>
dongsheng@714 12396 #: ../en/ch10-hook.xml:7
dongsheng@627 12397 msgid ""
dongsheng@627 12398 "Mercurial offers a powerful mechanism to let you perform automated actions in "
dongsheng@627 12399 "response to events that occur in a repository. In some cases, you can even "
dongsheng@627 12400 "control Mercurial's response to those events."
dongsheng@627 12401 msgstr ""
dongsheng@627 12402
dongsheng@627 12403 #. type: Content of: <book><chapter><para>
dongsheng@714 12404 #: ../en/ch10-hook.xml:12
dongsheng@627 12405 msgid ""
dongsheng@627 12406 "The name Mercurial uses for one of these actions is a <emphasis>hook</"
dongsheng@627 12407 "emphasis>. Hooks are called <quote>triggers</quote> in some revision control "
dongsheng@627 12408 "systems, but the two names refer to the same idea."
dongsheng@627 12409 msgstr ""
dongsheng@627 12410
dongsheng@627 12411 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 12412 #: ../en/ch10-hook.xml:18
dongsheng@627 12413 msgid "An overview of hooks in Mercurial"
dongsheng@635 12414 msgstr "Mercurial 钩子概述"
dongsheng@627 12415
dongsheng@627 12416 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 12417 #: ../en/ch10-hook.xml:20
dongsheng@627 12418 msgid ""
songdongsheng@658 12419 "Here is a brief list of the hooks that Mercurial supports. We will revisit "
songdongsheng@658 12420 "each of these hooks in more detail later, in <xref linkend=\"sec:hook:ref\"/>."
dongsheng@627 12421 msgstr ""
dongsheng@627 12422
dongsheng@714 12423 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 12424 #: ../en/ch10-hook.xml:24
dongsheng@714 12425 msgid ""
dongsheng@714 12426 "Each of the hooks whose description begins with the word <quote>Controlling</"
dongsheng@714 12427 "quote> has the ability to determine whether an activity can proceed. If the "
dongsheng@714 12428 "hook succeeds, the activity may proceed; if it fails, the activity is either "
dongsheng@714 12429 "not permitted or undone, depending on the hook."
dongsheng@714 12430 msgstr ""
dongsheng@714 12431
dongsheng@627 12432 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 12433 #: ../en/ch10-hook.xml:31
dongsheng@627 12434 msgid ""
dongsheng@627 12435 "<literal role=\"hook\">changegroup</literal>: This is run after a group of "
dongsheng@627 12436 "changesets has been brought into the repository from elsewhere."
dongsheng@627 12437 msgstr ""
dongsheng@627 12438
dongsheng@627 12439 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 12440 #: ../en/ch10-hook.xml:35
dongsheng@627 12441 msgid ""
dongsheng@627 12442 "<literal role=\"hook\">commit</literal>: This is run after a new changeset "
dongsheng@627 12443 "has been created in the local repository."
dongsheng@627 12444 msgstr ""
dongsheng@627 12445
dongsheng@627 12446 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 12447 #: ../en/ch10-hook.xml:39
dongsheng@627 12448 msgid ""
dongsheng@627 12449 "<literal role=\"hook\">incoming</literal>: This is run once for each new "
dongsheng@627 12450 "changeset that is brought into the repository from elsewhere. Notice the "
dongsheng@627 12451 "difference from <literal role=\"hook\">changegroup</literal>, which is run "
dongsheng@627 12452 "once per <emphasis>group</emphasis> of changesets brought in."
dongsheng@627 12453 msgstr ""
dongsheng@627 12454
dongsheng@627 12455 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 12456 #: ../en/ch10-hook.xml:46
dongsheng@627 12457 msgid ""
dongsheng@627 12458 "<literal role=\"hook\">outgoing</literal>: This is run after a group of "
dongsheng@627 12459 "changesets has been transmitted from this repository."
dongsheng@627 12460 msgstr ""
dongsheng@627 12461
dongsheng@627 12462 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 12463 #: ../en/ch10-hook.xml:50
dongsheng@627 12464 msgid ""
dongsheng@627 12465 "<literal role=\"hook\">prechangegroup</literal>: This is run before starting "
dongsheng@627 12466 "to bring a group of changesets into the repository."
dongsheng@627 12467 msgstr ""
dongsheng@627 12468
dongsheng@627 12469 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 12470 #: ../en/ch10-hook.xml:55
dongsheng@627 12471 msgid ""
dongsheng@627 12472 "<literal role=\"hook\">precommit</literal>: Controlling. This is run before "
dongsheng@627 12473 "starting a commit."
dongsheng@627 12474 msgstr ""
dongsheng@627 12475
dongsheng@627 12476 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 12477 #: ../en/ch10-hook.xml:59
dongsheng@627 12478 msgid ""
dongsheng@627 12479 "<literal role=\"hook\">preoutgoing</literal>: Controlling. This is run before "
dongsheng@627 12480 "starting to transmit a group of changesets from this repository."
dongsheng@627 12481 msgstr ""
dongsheng@627 12482
dongsheng@627 12483 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 12484 #: ../en/ch10-hook.xml:64
dongsheng@627 12485 msgid ""
dongsheng@627 12486 "<literal role=\"hook\">pretag</literal>: Controlling. This is run before "
dongsheng@627 12487 "creating a tag."
dongsheng@627 12488 msgstr ""
dongsheng@627 12489
dongsheng@627 12490 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 12491 #: ../en/ch10-hook.xml:68
dongsheng@627 12492 msgid ""
dongsheng@627 12493 "<literal role=\"hook\">pretxnchangegroup</literal>: Controlling. This is run "
dongsheng@627 12494 "after a group of changesets has been brought into the local repository from "
dongsheng@627 12495 "another, but before the transaction completes that will make the changes "
dongsheng@627 12496 "permanent in the repository."
dongsheng@627 12497 msgstr ""
dongsheng@627 12498
dongsheng@627 12499 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 12500 #: ../en/ch10-hook.xml:76
dongsheng@627 12501 msgid ""
dongsheng@627 12502 "<literal role=\"hook\">pretxncommit</literal>: Controlling. This is run after "
dongsheng@627 12503 "a new changeset has been created in the local repository, but before the "
dongsheng@627 12504 "transaction completes that will make it permanent."
dongsheng@627 12505 msgstr ""
dongsheng@627 12506
dongsheng@627 12507 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 12508 #: ../en/ch10-hook.xml:82
dongsheng@627 12509 msgid ""
dongsheng@627 12510 "<literal role=\"hook\">preupdate</literal>: Controlling. This is run before "
dongsheng@627 12511 "starting an update or merge of the working directory."
dongsheng@627 12512 msgstr ""
dongsheng@627 12513
dongsheng@627 12514 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 12515 #: ../en/ch10-hook.xml:87
dongsheng@627 12516 msgid ""
dongsheng@627 12517 "<literal role=\"hook\">tag</literal>: This is run after a tag is created."
dongsheng@627 12518 msgstr ""
dongsheng@627 12519
dongsheng@627 12520 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 12521 #: ../en/ch10-hook.xml:91
dongsheng@627 12522 msgid ""
dongsheng@627 12523 "<literal role=\"hook\">update</literal>: This is run after an update or merge "
dongsheng@627 12524 "of the working directory has finished."
dongsheng@627 12525 msgstr ""
dongsheng@627 12526
dongsheng@627 12527 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 12528 #: ../en/ch10-hook.xml:99
dongsheng@627 12529 msgid "Hooks and security"
dongsheng@635 12530 msgstr "钩子与安全性"
dongsheng@627 12531
dongsheng@627 12532 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 12533 #: ../en/ch10-hook.xml:102
dongsheng@627 12534 msgid "Hooks are run with your privileges"
dongsheng@635 12535 msgstr "钩子以你的特权执行"
dongsheng@627 12536
dongsheng@627 12537 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12538 #: ../en/ch10-hook.xml:104
dongsheng@627 12539 msgid ""
dongsheng@627 12540 "When you run a Mercurial command in a repository, and the command causes a "
dongsheng@627 12541 "hook to run, that hook runs on <emphasis>your</emphasis> system, under "
dongsheng@627 12542 "<emphasis>your</emphasis> user account, with <emphasis>your</emphasis> "
dongsheng@627 12543 "privilege level. Since hooks are arbitrary pieces of executable code, you "
dongsheng@627 12544 "should treat them with an appropriate level of suspicion. Do not install a "
dongsheng@627 12545 "hook unless you are confident that you know who created it and what it does."
dongsheng@627 12546 msgstr ""
dongsheng@627 12547
dongsheng@627 12548 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12549 #: ../en/ch10-hook.xml:115
dongsheng@627 12550 msgid ""
dongsheng@627 12551 "In some cases, you may be exposed to hooks that you did not install "
dongsheng@627 12552 "yourself. If you work with Mercurial on an unfamiliar system, Mercurial will "
dongsheng@650 12553 "run hooks defined in that system's global <filename role=\"special\">~/.hgrc</"
dongsheng@650 12554 "filename> file."
dongsheng@650 12555 msgstr ""
dongsheng@650 12556
dongsheng@650 12557 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12558 #: ../en/ch10-hook.xml:122
dongsheng@627 12559 msgid ""
dongsheng@627 12560 "If you are working with a repository owned by another user, Mercurial can run "
dongsheng@627 12561 "hooks defined in that user's repository, but it will still run them as "
dongsheng@627 12562 "<quote>you</quote>. For example, if you <command role=\"hg-cmd\">hg pull</"
dongsheng@627 12563 "command> from that repository, and its <filename role=\"special\">.hg/hgrc</"
dongsheng@627 12564 "filename> defines a local <literal role=\"hook\">outgoing</literal> hook, "
dongsheng@627 12565 "that hook will run under your user account, even though you don't own that "
dongsheng@627 12566 "repository."
dongsheng@627 12567 msgstr ""
dongsheng@627 12568
dongsheng@627 12569 #. type: Content of: <book><chapter><sect1><sect2><note><para>
dongsheng@714 12570 #: ../en/ch10-hook.xml:134
dongsheng@627 12571 msgid ""
dongsheng@627 12572 "This only applies if you are pulling from a repository on a local or network "
dongsheng@627 12573 "filesystem. If you're pulling over http or ssh, any <literal role=\"hook"
dongsheng@627 12574 "\">outgoing</literal> hook will run under whatever account is executing the "
dongsheng@627 12575 "server process, on the server."
dongsheng@627 12576 msgstr ""
dongsheng@627 12577
dongsheng@627 12578 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12579 #: ../en/ch10-hook.xml:142
dongsheng@714 12580 msgid ""
dongsheng@714 12581 "To see what hooks are defined in a repository, use the <command role=\"hg-cmd"
dongsheng@714 12582 "\">hg showconfig hooks</command> command. If you are working in one "
dongsheng@627 12583 "repository, but talking to another that you do not own (e.g. using <command "
dongsheng@627 12584 "role=\"hg-cmd\">hg pull</command> or <command role=\"hg-cmd\">hg incoming</"
dongsheng@627 12585 "command>), remember that it is the other repository's hooks you should be "
dongsheng@627 12586 "checking, not your own."
dongsheng@627 12587 msgstr ""
dongsheng@627 12588
dongsheng@627 12589 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 12590 #: ../en/ch10-hook.xml:153
dongsheng@627 12591 msgid "Hooks do not propagate"
dongsheng@635 12592 msgstr "钩子不会传播"
dongsheng@627 12593
dongsheng@627 12594 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12595 #: ../en/ch10-hook.xml:155
dongsheng@627 12596 msgid ""
dongsheng@627 12597 "In Mercurial, hooks are not revision controlled, and do not propagate when "
dongsheng@627 12598 "you clone, or pull from, a repository. The reason for this is simple: a hook "
dongsheng@627 12599 "is a completely arbitrary piece of executable code. It runs under your user "
dongsheng@627 12600 "identity, with your privilege level, on your machine."
dongsheng@627 12601 msgstr ""
dongsheng@627 12602
dongsheng@627 12603 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12604 #: ../en/ch10-hook.xml:162
dongsheng@627 12605 msgid ""
dongsheng@627 12606 "It would be extremely reckless for any distributed revision control system to "
dongsheng@627 12607 "implement revision-controlled hooks, as this would offer an easily "
dongsheng@627 12608 "exploitable way to subvert the accounts of users of the revision control "
dongsheng@627 12609 "system."
dongsheng@627 12610 msgstr ""
dongsheng@627 12611
dongsheng@627 12612 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12613 #: ../en/ch10-hook.xml:168
dongsheng@627 12614 msgid ""
dongsheng@627 12615 "Since Mercurial does not propagate hooks, if you are collaborating with other "
dongsheng@627 12616 "people on a common project, you should not assume that they are using the "
dongsheng@627 12617 "same Mercurial hooks as you are, or that theirs are correctly configured. "
dongsheng@627 12618 "You should document the hooks you expect people to use."
dongsheng@627 12619 msgstr ""
dongsheng@627 12620
dongsheng@627 12621 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12622 #: ../en/ch10-hook.xml:175
dongsheng@627 12623 msgid ""
dongsheng@627 12624 "In a corporate intranet, this is somewhat easier to control, as you can for "
dongsheng@627 12625 "example provide a <quote>standard</quote> installation of Mercurial on an NFS "
dongsheng@650 12626 "filesystem, and use a site-wide <filename role=\"special\">~/.hgrc</filename> "
dongsheng@650 12627 "file to define hooks that all users will see. However, this too has its "
dongsheng@627 12628 "limits; see below."
dongsheng@627 12629 msgstr ""
dongsheng@627 12630
dongsheng@627 12631 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 12632 #: ../en/ch10-hook.xml:184
dongsheng@627 12633 msgid "Hooks can be overridden"
dongsheng@635 12634 msgstr "钩子可以被覆盖"
dongsheng@627 12635
dongsheng@627 12636 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12637 #: ../en/ch10-hook.xml:186
dongsheng@627 12638 msgid ""
dongsheng@627 12639 "Mercurial allows you to override a hook definition by redefining the hook. "
dongsheng@627 12640 "You can disable it by setting its value to the empty string, or change its "
songdongsheng@710 12641 "behavior as you wish."
dongsheng@627 12642 msgstr ""
dongsheng@627 12643
dongsheng@627 12644 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12645 #: ../en/ch10-hook.xml:191
dongsheng@650 12646 msgid ""
dongsheng@650 12647 "If you deploy a system- or site-wide <filename role=\"special\">~/.hgrc</"
dongsheng@650 12648 "filename> file that defines some hooks, you should thus understand that your "
dongsheng@650 12649 "users can disable or override those hooks."
dongsheng@650 12650 msgstr ""
dongsheng@650 12651
dongsheng@650 12652 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 12653 #: ../en/ch10-hook.xml:199
dongsheng@627 12654 msgid "Ensuring that critical hooks are run"
dongsheng@635 12655 msgstr "确保关键钩子的执行"
dongsheng@627 12656
dongsheng@627 12657 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12658 #: ../en/ch10-hook.xml:201
dongsheng@627 12659 msgid ""
dongsheng@627 12660 "Sometimes you may want to enforce a policy that you do not want others to be "
dongsheng@627 12661 "able to work around. For example, you may have a requirement that every "
dongsheng@627 12662 "changeset must pass a rigorous set of tests. Defining this requirement via a "
dongsheng@650 12663 "hook in a site-wide <filename role=\"special\">~/.hgrc</filename> won't work "
dongsheng@650 12664 "for remote users on laptops, and of course local users can subvert it at will "
dongsheng@650 12665 "by overriding the hook."
dongsheng@650 12666 msgstr ""
dongsheng@650 12667
dongsheng@650 12668 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12669 #: ../en/ch10-hook.xml:210
dongsheng@627 12670 msgid ""
dongsheng@627 12671 "Instead, you can set up your policies for use of Mercurial so that people are "
dongsheng@627 12672 "expected to propagate changes through a well-known <quote>canonical</quote> "
dongsheng@627 12673 "server that you have locked down and configured appropriately."
dongsheng@627 12674 msgstr ""
dongsheng@627 12675
dongsheng@627 12676 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12677 #: ../en/ch10-hook.xml:216
dongsheng@627 12678 msgid ""
dongsheng@627 12679 "One way to do this is via a combination of social engineering and "
dongsheng@627 12680 "technology. Set up a restricted-access account; users can push changes over "
dongsheng@627 12681 "the network to repositories managed by this account, but they cannot log into "
dongsheng@627 12682 "the account and run normal shell commands. In this scenario, a user can "
dongsheng@627 12683 "commit a changeset that contains any old garbage they want."
dongsheng@627 12684 msgstr ""
dongsheng@627 12685
dongsheng@627 12686 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12687 #: ../en/ch10-hook.xml:225
dongsheng@627 12688 msgid ""
dongsheng@627 12689 "When someone pushes a changeset to the server that everyone pulls from, the "
dongsheng@627 12690 "server will test the changeset before it accepts it as permanent, and reject "
dongsheng@627 12691 "it if it fails to pass the test suite. If people only pull changes from this "
dongsheng@627 12692 "filtering server, it will serve to ensure that all changes that people pull "
dongsheng@627 12693 "have been automatically vetted."
dongsheng@627 12694 msgstr ""
dongsheng@627 12695
dongsheng@627 12696 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 12697 #: ../en/ch10-hook.xml:237
dongsheng@627 12698 msgid "A short tutorial on using hooks"
dongsheng@635 12699 msgstr "使用钩子的简短指南"
dongsheng@627 12700
dongsheng@627 12701 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 12702 #: ../en/ch10-hook.xml:239
dongsheng@627 12703 msgid ""
dongsheng@627 12704 "It is easy to write a Mercurial hook. Let's start with a hook that runs when "
dongsheng@627 12705 "you finish a <command role=\"hg-cmd\">hg commit</command>, and simply prints "
dongsheng@627 12706 "the hash of the changeset you just created. The hook is called <literal role="
dongsheng@627 12707 "\"hook\">commit</literal>."
dongsheng@627 12708 msgstr ""
dongsheng@627 12709
dongsheng@627 12710 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 12711 #: ../en/ch10-hook.xml:246
dongsheng@627 12712 msgid "All hooks follow the pattern in this example."
dongsheng@627 12713 msgstr ""
dongsheng@627 12714
dongsheng@627 12715 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 12716 #: ../en/ch10-hook.xml:250
dongsheng@627 12717 msgid ""
dongsheng@627 12718 "You add an entry to the <literal role=\"rc-hooks\">hooks</literal> section of "
dongsheng@650 12719 "your <filename role=\"special\">~/.hgrc</filename>. On the left is the name "
dongsheng@627 12720 "of the event to trigger on; on the right is the action to take. As you can "
dongsheng@627 12721 "see, you can run an arbitrary shell command in a hook. Mercurial passes "
dongsheng@627 12722 "extra information to the hook using environment variables (look for "
dongsheng@627 12723 "<envar>HG_NODE</envar> in the example)."
dongsheng@627 12724 msgstr ""
dongsheng@627 12725
dongsheng@627 12726 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 12727 #: ../en/ch10-hook.xml:260
dongsheng@627 12728 msgid "Performing multiple actions per event"
dongsheng@635 12729 msgstr "每个事件执行多个操作"
dongsheng@627 12730
dongsheng@627 12731 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12732 #: ../en/ch10-hook.xml:262
dongsheng@627 12733 msgid ""
dongsheng@627 12734 "Quite often, you will want to define more than one hook for a particular kind "
dongsheng@627 12735 "of event, as shown below."
dongsheng@627 12736 msgstr ""
dongsheng@627 12737
dongsheng@627 12738 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12739 #: ../en/ch10-hook.xml:267
dongsheng@627 12740 msgid ""
dongsheng@627 12741 "Mercurial lets you do this by adding an <emphasis>extension</emphasis> to the "
dongsheng@627 12742 "end of a hook's name. You extend a hook's name by giving the name of the "
dongsheng@627 12743 "hook, followed by a full stop (the <quote><literal>.</literal></quote> "
dongsheng@627 12744 "character), followed by some more text of your choosing. For example, "
dongsheng@627 12745 "Mercurial will run both <literal>commit.foo</literal> and <literal>commit."
dongsheng@627 12746 "bar</literal> when the <literal>commit</literal> event occurs."
dongsheng@627 12747 msgstr ""
dongsheng@627 12748
dongsheng@627 12749 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12750 #: ../en/ch10-hook.xml:278
dongsheng@627 12751 msgid ""
dongsheng@627 12752 "To give a well-defined order of execution when there are multiple hooks "
dongsheng@627 12753 "defined for an event, Mercurial sorts hooks by extension, and executes the "
dongsheng@627 12754 "hook commands in this sorted order. In the above example, it will execute "
dongsheng@627 12755 "<literal>commit.bar</literal> before <literal>commit.foo</literal>, and "
dongsheng@627 12756 "<literal>commit</literal> before both."
dongsheng@627 12757 msgstr ""
dongsheng@627 12758
dongsheng@627 12759 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12760 #: ../en/ch10-hook.xml:287
dongsheng@627 12761 msgid ""
dongsheng@627 12762 "It is a good idea to use a somewhat descriptive extension when you define a "
dongsheng@627 12763 "new hook. This will help you to remember what the hook was for. If the hook "
dongsheng@627 12764 "fails, you'll get an error message that contains the hook name and extension, "
dongsheng@627 12765 "so using a descriptive extension could give you an immediate hint as to why "
songdongsheng@658 12766 "the hook failed (see <xref linkend=\"sec:hook:perm\"/> for an example)."
dongsheng@627 12767 msgstr ""
dongsheng@627 12768
dongsheng@627 12769 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 12770 #: ../en/ch10-hook.xml:298
dongsheng@627 12771 msgid "Controlling whether an activity can proceed"
dongsheng@635 12772 msgstr "控制处理的活动"
dongsheng@627 12773
dongsheng@627 12774 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12775 #: ../en/ch10-hook.xml:300
dongsheng@627 12776 msgid ""
dongsheng@627 12777 "In our earlier examples, we used the <literal role=\"hook\">commit</literal> "
dongsheng@627 12778 "hook, which is run after a commit has completed. This is one of several "
dongsheng@627 12779 "Mercurial hooks that run after an activity finishes. Such hooks have no way "
dongsheng@627 12780 "of influencing the activity itself."
dongsheng@627 12781 msgstr ""
dongsheng@627 12782
dongsheng@627 12783 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12784 #: ../en/ch10-hook.xml:307
dongsheng@627 12785 msgid ""
dongsheng@627 12786 "Mercurial defines a number of events that occur before an activity starts; or "
dongsheng@627 12787 "after it starts, but before it finishes. Hooks that trigger on these events "
dongsheng@627 12788 "have the added ability to choose whether the activity can continue, or will "
dongsheng@627 12789 "abort."
dongsheng@627 12790 msgstr ""
dongsheng@627 12791
dongsheng@627 12792 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12793 #: ../en/ch10-hook.xml:313
dongsheng@627 12794 msgid ""
dongsheng@627 12795 "The <literal role=\"hook\">pretxncommit</literal> hook runs after a commit "
dongsheng@627 12796 "has all but completed. In other words, the metadata representing the "
dongsheng@627 12797 "changeset has been written out to disk, but the transaction has not yet been "
dongsheng@627 12798 "allowed to complete. The <literal role=\"hook\">pretxncommit</literal> hook "
dongsheng@627 12799 "has the ability to decide whether the transaction can complete, or must be "
dongsheng@627 12800 "rolled back."
dongsheng@627 12801 msgstr ""
dongsheng@627 12802
dongsheng@627 12803 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12804 #: ../en/ch10-hook.xml:322
dongsheng@627 12805 msgid ""
dongsheng@627 12806 "If the <literal role=\"hook\">pretxncommit</literal> hook exits with a status "
dongsheng@627 12807 "code of zero, the transaction is allowed to complete; the commit finishes; "
dongsheng@627 12808 "and the <literal role=\"hook\">commit</literal> hook is run. If the <literal "
dongsheng@627 12809 "role=\"hook\">pretxncommit</literal> hook exits with a non-zero status code, "
dongsheng@627 12810 "the transaction is rolled back; the metadata representing the changeset is "
dongsheng@627 12811 "erased; and the <literal role=\"hook\">commit</literal> hook is not run."
dongsheng@627 12812 msgstr ""
dongsheng@627 12813
dongsheng@627 12814 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12815 #: ../en/ch10-hook.xml:334
dongsheng@627 12816 msgid ""
dongsheng@627 12817 "The hook in the example above checks that a commit comment contains a bug "
dongsheng@627 12818 "ID. If it does, the commit can complete. If not, the commit is rolled back."
dongsheng@627 12819 msgstr ""
dongsheng@627 12820
dongsheng@627 12821 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 12822 #: ../en/ch10-hook.xml:342
dongsheng@627 12823 msgid "Writing your own hooks"
dongsheng@635 12824 msgstr "编写钩子"
dongsheng@627 12825
dongsheng@627 12826 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 12827 #: ../en/ch10-hook.xml:344
dongsheng@627 12828 msgid ""
dongsheng@627 12829 "When you are writing a hook, you might find it useful to run Mercurial either "
dongsheng@627 12830 "with the <option role=\"hg-opt-global\">-v</option> option, or the <envar "
dongsheng@627 12831 "role=\"rc-item-ui\">verbose</envar> config item set to <quote>true</quote>. "
dongsheng@627 12832 "When you do so, Mercurial will print a message before it calls each hook."
dongsheng@627 12833 msgstr ""
dongsheng@627 12834
dongsheng@627 12835 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 12836 #: ../en/ch10-hook.xml:353
dongsheng@627 12837 msgid "Choosing how your hook should run"
dongsheng@635 12838 msgstr "选择钩子的执行方式"
dongsheng@627 12839
dongsheng@627 12840 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12841 #: ../en/ch10-hook.xml:355
dongsheng@627 12842 msgid ""
songdongsheng@668 12843 "You can write a hook either as a normal program&emdash;typically a shell "
songdongsheng@668 12844 "script&emdash;or as a Python function that is executed within the Mercurial "
songdongsheng@668 12845 "process."
dongsheng@627 12846 msgstr ""
dongsheng@627 12847
dongsheng@627 12848 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12849 #: ../en/ch10-hook.xml:360
dongsheng@627 12850 msgid ""
dongsheng@627 12851 "Writing a hook as an external program has the advantage that it requires no "
dongsheng@627 12852 "knowledge of Mercurial's internals. You can call normal Mercurial commands "
dongsheng@627 12853 "to get any added information you need. The trade-off is that external hooks "
dongsheng@627 12854 "are slower than in-process hooks."
dongsheng@627 12855 msgstr ""
dongsheng@627 12856
dongsheng@627 12857 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12858 #: ../en/ch10-hook.xml:367
dongsheng@627 12859 msgid ""
dongsheng@627 12860 "An in-process Python hook has complete access to the Mercurial API, and does "
dongsheng@627 12861 "not <quote>shell out</quote> to another process, so it is inherently faster "
dongsheng@627 12862 "than an external hook. It is also easier to obtain much of the information "
dongsheng@627 12863 "that a hook requires by using the Mercurial API than by running Mercurial "
dongsheng@627 12864 "commands."
dongsheng@627 12865 msgstr ""
dongsheng@627 12866
dongsheng@627 12867 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12868 #: ../en/ch10-hook.xml:375
dongsheng@627 12869 msgid ""
dongsheng@627 12870 "If you are comfortable with Python, or require high performance, writing your "
dongsheng@627 12871 "hooks in Python may be a good choice. However, when you have a "
dongsheng@627 12872 "straightforward hook to write and you don't need to care about performance "
dongsheng@627 12873 "(probably the majority of hooks), a shell script is perfectly fine."
dongsheng@627 12874 msgstr ""
dongsheng@627 12875
dongsheng@627 12876 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 12877 #: ../en/ch10-hook.xml:384
dongsheng@627 12878 msgid "Hook parameters"
dongsheng@635 12879 msgstr "钩子的参数"
dongsheng@627 12880
dongsheng@627 12881 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12882 #: ../en/ch10-hook.xml:386
dongsheng@627 12883 msgid ""
dongsheng@627 12884 "Mercurial calls each hook with a set of well-defined parameters. In Python, "
dongsheng@627 12885 "a parameter is passed as a keyword argument to your hook function. For an "
dongsheng@627 12886 "external program, a parameter is passed as an environment variable."
dongsheng@627 12887 msgstr ""
dongsheng@627 12888
dongsheng@627 12889 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12890 #: ../en/ch10-hook.xml:392
dongsheng@627 12891 msgid ""
dongsheng@627 12892 "Whether your hook is written in Python or as a shell script, the hook-"
dongsheng@627 12893 "specific parameter names and values will be the same. A boolean parameter "
dongsheng@627 12894 "will be represented as a boolean value in Python, but as the number 1 (for "
dongsheng@627 12895 "<quote>true</quote>) or 0 (for <quote>false</quote>) as an environment "
dongsheng@627 12896 "variable for an external hook. If a hook parameter is named <literal>foo</"
dongsheng@627 12897 "literal>, the keyword argument for a Python hook will also be named "
dongsheng@627 12898 "<literal>foo</literal>, while the environment variable for an external hook "
dongsheng@627 12899 "will be named <literal>HG_FOO</literal>."
dongsheng@627 12900 msgstr ""
dongsheng@627 12901
dongsheng@627 12902 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 12903 #: ../en/ch10-hook.xml:406
dongsheng@627 12904 msgid "Hook return values and activity control"
dongsheng@635 12905 msgstr "钩子的返回值与活动控制"
dongsheng@627 12906
dongsheng@627 12907 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12908 #: ../en/ch10-hook.xml:408
dongsheng@627 12909 msgid ""
dongsheng@627 12910 "A hook that executes successfully must exit with a status of zero if "
dongsheng@627 12911 "external, or return boolean <quote>false</quote> if in-process. Failure is "
dongsheng@627 12912 "indicated with a non-zero exit status from an external hook, or an in-process "
dongsheng@627 12913 "hook returning boolean <quote>true</quote>. If an in-process hook raises an "
dongsheng@627 12914 "exception, the hook is considered to have failed."
dongsheng@627 12915 msgstr ""
dongsheng@627 12916
dongsheng@627 12917 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12918 #: ../en/ch10-hook.xml:416
dongsheng@627 12919 msgid ""
dongsheng@627 12920 "For a hook that controls whether an activity can proceed, zero/false means "
dongsheng@627 12921 "<quote>allow</quote>, while non-zero/true/exception means <quote>deny</quote>."
dongsheng@627 12922 msgstr ""
dongsheng@627 12923
dongsheng@627 12924 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 12925 #: ../en/ch10-hook.xml:423
dongsheng@627 12926 msgid "Writing an external hook"
dongsheng@635 12927 msgstr "编写外部钩子"
dongsheng@627 12928
dongsheng@627 12929 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12930 #: ../en/ch10-hook.xml:425
dongsheng@650 12931 msgid ""
dongsheng@650 12932 "When you define an external hook in your <filename role=\"special\">~/.hgrc</"
dongsheng@650 12933 "filename> and the hook is run, its value is passed to your shell, which "
dongsheng@627 12934 "interprets it. This means that you can use normal shell constructs in the "
dongsheng@627 12935 "body of the hook."
dongsheng@627 12936 msgstr ""
dongsheng@627 12937
dongsheng@627 12938 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12939 #: ../en/ch10-hook.xml:432
dongsheng@627 12940 msgid ""
dongsheng@627 12941 "An executable hook is always run with its current directory set to a "
dongsheng@627 12942 "repository's root directory."
dongsheng@627 12943 msgstr ""
dongsheng@627 12944
dongsheng@627 12945 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12946 #: ../en/ch10-hook.xml:436
dongsheng@627 12947 msgid ""
dongsheng@627 12948 "Each hook parameter is passed in as an environment variable; the name is "
dongsheng@627 12949 "upper-cased, and prefixed with the string <quote><literal>HG_</literal></"
dongsheng@627 12950 "quote>."
dongsheng@627 12951 msgstr ""
dongsheng@627 12952
dongsheng@627 12953 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12954 #: ../en/ch10-hook.xml:441
dongsheng@627 12955 msgid ""
dongsheng@627 12956 "With the exception of hook parameters, Mercurial does not set or modify any "
dongsheng@627 12957 "environment variables when running a hook. This is useful to remember if you "
dongsheng@627 12958 "are writing a site-wide hook that may be run by a number of different users "
dongsheng@627 12959 "with differing environment variables set. In multi-user situations, you "
dongsheng@627 12960 "should not rely on environment variables being set to the values you have in "
dongsheng@627 12961 "your environment when testing the hook."
dongsheng@627 12962 msgstr ""
dongsheng@627 12963
dongsheng@627 12964 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 12965 #: ../en/ch10-hook.xml:452
dongsheng@627 12966 msgid "Telling Mercurial to use an in-process hook"
dongsheng@642 12967 msgstr "让 Mercurial 使用进程内钩子"
dongsheng@627 12968
dongsheng@627 12969 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12970 #: ../en/ch10-hook.xml:454
dongsheng@650 12971 msgid ""
dongsheng@650 12972 "The <filename role=\"special\">~/.hgrc</filename> syntax for defining an in-"
dongsheng@627 12973 "process hook is slightly different than for an executable hook. The value of "
dongsheng@627 12974 "the hook must start with the text <quote><literal>python:</literal></quote>, "
dongsheng@627 12975 "and continue with the fully-qualified name of a callable object to use as the "
dongsheng@627 12976 "hook's value."
dongsheng@627 12977 msgstr ""
dongsheng@627 12978
dongsheng@627 12979 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12980 #: ../en/ch10-hook.xml:462
dongsheng@627 12981 msgid ""
dongsheng@627 12982 "The module in which a hook lives is automatically imported when a hook is "
dongsheng@627 12983 "run. So long as you have the module name and <envar>PYTHONPATH</envar> "
dongsheng@627 12984 "right, it should <quote>just work</quote>."
dongsheng@627 12985 msgstr ""
dongsheng@627 12986
dongsheng@627 12987 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12988 #: ../en/ch10-hook.xml:468
dongsheng@650 12989 msgid ""
dongsheng@650 12990 "The following <filename role=\"special\">~/.hgrc</filename> example snippet "
dongsheng@627 12991 "illustrates the syntax and meaning of the notions we just described."
dongsheng@627 12992 msgstr ""
dongsheng@627 12993
dongsheng@627 12994 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 12995 #: ../en/ch10-hook.xml:474
dongsheng@627 12996 msgid ""
dongsheng@627 12997 "When Mercurial runs the <literal>commit.example</literal> hook, it imports "
dongsheng@627 12998 "<literal>mymodule.submodule</literal>, looks for the callable object named "
dongsheng@627 12999 "<literal>myhook</literal>, and calls it."
dongsheng@627 13000 msgstr ""
dongsheng@627 13001
dongsheng@627 13002 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 13003 #: ../en/ch10-hook.xml:482
dongsheng@627 13004 msgid "Writing an in-process hook"
dongsheng@635 13005 msgstr "编写进程内钩子"
dongsheng@627 13006
dongsheng@627 13007 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13008 #: ../en/ch10-hook.xml:484
dongsheng@627 13009 msgid ""
dongsheng@627 13010 "The simplest in-process hook does nothing, but illustrates the basic shape of "
dongsheng@627 13011 "the hook API:"
dongsheng@627 13012 msgstr ""
dongsheng@627 13013
dongsheng@627 13014 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13015 #: ../en/ch10-hook.xml:489
dongsheng@627 13016 msgid ""
dongsheng@627 13017 "The first argument to a Python hook is always a <literal role=\"py-mod-"
dongsheng@627 13018 "mercurial.ui\">ui</literal> object. The second is a repository object; at "
dongsheng@627 13019 "the moment, it is always an instance of <literal role=\"py-mod-mercurial."
dongsheng@627 13020 "localrepo\">localrepository</literal>. Following these two arguments are "
dongsheng@627 13021 "other keyword arguments. Which ones are passed in depends on the hook being "
dongsheng@627 13022 "called, but a hook can ignore arguments it doesn't care about by dropping "
dongsheng@627 13023 "them into a keyword argument dict, as with <literal>**kwargs</literal> above."
dongsheng@627 13024 msgstr ""
dongsheng@627 13025
dongsheng@627 13026 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 13027 #: ../en/ch10-hook.xml:504
dongsheng@627 13028 msgid "Some hook examples"
dongsheng@635 13029 msgstr "钩子样例"
dongsheng@627 13030
dongsheng@627 13031 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 13032 #: ../en/ch10-hook.xml:507
dongsheng@627 13033 msgid "Writing meaningful commit messages"
dongsheng@635 13034 msgstr "编写有意义的提交日志"
dongsheng@627 13035
dongsheng@627 13036 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13037 #: ../en/ch10-hook.xml:509
dongsheng@627 13038 msgid ""
dongsheng@627 13039 "It's hard to imagine a useful commit message being very short. The simple "
dongsheng@627 13040 "<literal role=\"hook\">pretxncommit</literal> hook of the example below will "
dongsheng@627 13041 "prevent you from committing a changeset with a message that is less than ten "
dongsheng@627 13042 "bytes long."
dongsheng@627 13043 msgstr ""
dongsheng@627 13044
dongsheng@627 13045 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 13046 #: ../en/ch10-hook.xml:519
dongsheng@627 13047 msgid "Checking for trailing whitespace"
dongsheng@635 13048 msgstr "检查行尾空格"
dongsheng@627 13049
dongsheng@627 13050 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13051 #: ../en/ch10-hook.xml:521
dongsheng@627 13052 msgid ""
dongsheng@627 13053 "An interesting use of a commit-related hook is to help you to write cleaner "
dongsheng@627 13054 "code. A simple example of <quote>cleaner code</quote> is the dictum that a "
dongsheng@627 13055 "change should not add any new lines of text that contain <quote>trailing "
dongsheng@627 13056 "whitespace</quote>. Trailing whitespace is a series of space and tab "
dongsheng@627 13057 "characters at the end of a line of text. In most cases, trailing whitespace "
dongsheng@627 13058 "is unnecessary, invisible noise, but it is occasionally problematic, and "
dongsheng@627 13059 "people often prefer to get rid of it."
dongsheng@627 13060 msgstr ""
dongsheng@627 13061
dongsheng@627 13062 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13063 #: ../en/ch10-hook.xml:532
dongsheng@627 13064 msgid ""
dongsheng@627 13065 "You can use either the <literal role=\"hook\">precommit</literal> or <literal "
dongsheng@627 13066 "role=\"hook\">pretxncommit</literal> hook to tell whether you have a trailing "
dongsheng@627 13067 "whitespace problem. If you use the <literal role=\"hook\">precommit</"
dongsheng@627 13068 "literal> hook, the hook will not know which files you are committing, so it "
dongsheng@627 13069 "will have to check every modified file in the repository for trailing white "
dongsheng@627 13070 "space. If you want to commit a change to just the file <filename>foo</"
dongsheng@627 13071 "filename>, but the file <filename>bar</filename> contains trailing "
dongsheng@627 13072 "whitespace, doing a check in the <literal role=\"hook\">precommit</literal> "
dongsheng@627 13073 "hook will prevent you from committing <filename>foo</filename> due to the "
dongsheng@627 13074 "problem with <filename>bar</filename>. This doesn't seem right."
dongsheng@627 13075 msgstr ""
dongsheng@627 13076
dongsheng@627 13077 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13078 #: ../en/ch10-hook.xml:548
dongsheng@627 13079 msgid ""
dongsheng@627 13080 "Should you choose the <literal role=\"hook\">pretxncommit</literal> hook, the "
dongsheng@627 13081 "check won't occur until just before the transaction for the commit "
dongsheng@627 13082 "completes. This will allow you to check for problems only the exact files "
dongsheng@627 13083 "that are being committed. However, if you entered the commit message "
dongsheng@627 13084 "interactively and the hook fails, the transaction will roll back; you'll have "
dongsheng@627 13085 "to re-enter the commit message after you fix the trailing whitespace and run "
dongsheng@627 13086 "<command role=\"hg-cmd\">hg commit</command> again."
dongsheng@627 13087 msgstr ""
dongsheng@627 13088
dongsheng@627 13089 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13090 #: ../en/ch10-hook.xml:561
dongsheng@627 13091 msgid ""
dongsheng@627 13092 "In this example, we introduce a simple <literal role=\"hook\">pretxncommit</"
dongsheng@627 13093 "literal> hook that checks for trailing whitespace. This hook is short, but "
dongsheng@627 13094 "not very helpful. It exits with an error status if a change adds a line with "
dongsheng@627 13095 "trailing whitespace to any file, but does not print any information that "
dongsheng@627 13096 "might help us to identify the offending file or line. It also has the nice "
dongsheng@627 13097 "property of not paying attention to unmodified lines; only lines that "
dongsheng@627 13098 "introduce new trailing whitespace cause problems."
dongsheng@627 13099 msgstr ""
dongsheng@627 13100
dongsheng@627 13101 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13102 #: ../en/ch10-hook.xml:574
dongsheng@627 13103 msgid ""
dongsheng@627 13104 "The above version is much more complex, but also more useful. It parses a "
dongsheng@627 13105 "unified diff to see if any lines add trailing whitespace, and prints the name "
dongsheng@627 13106 "of the file and the line number of each such occurrence. Even better, if the "
dongsheng@627 13107 "change adds trailing whitespace, this hook saves the commit comment and "
dongsheng@627 13108 "prints the name of the save file before exiting and telling Mercurial to roll "
dongsheng@627 13109 "the transaction back, so you can use the <option role=\"hg-opt-commit\">-l "
dongsheng@627 13110 "filename</option> option to <command role=\"hg-cmd\">hg commit</command> to "
dongsheng@627 13111 "reuse the saved commit message once you've corrected the problem."
dongsheng@627 13112 msgstr ""
dongsheng@627 13113
dongsheng@627 13114 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13115 #: ../en/ch10-hook.xml:588
dongsheng@714 13116 msgid ""
dongsheng@714 13117 "As a final aside, note in the example above the use of <command>sed</"
dongsheng@627 13118 "command>'s in-place editing feature to get rid of trailing whitespace from a "
dongsheng@714 13119 "file. This is concise and useful enough that I will reproduce it here (using "
dongsheng@714 13120 "<command>perl</command> for good measure)."
dongsheng@627 13121 msgstr ""
dongsheng@627 13122
dongsheng@627 13123 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 13124 #: ../en/ch10-hook.xml:598
dongsheng@627 13125 msgid "Bundled hooks"
dongsheng@635 13126 msgstr "内置的钩子"
dongsheng@627 13127
dongsheng@627 13128 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 13129 #: ../en/ch10-hook.xml:600
dongsheng@627 13130 msgid ""
dongsheng@627 13131 "Mercurial ships with several bundled hooks. You can find them in the "
dongsheng@627 13132 "<filename class=\"directory\">hgext</filename> directory of a Mercurial "
dongsheng@627 13133 "source tree. If you are using a Mercurial binary package, the hooks will be "
dongsheng@627 13134 "located in the <filename class=\"directory\">hgext</filename> directory of "
dongsheng@627 13135 "wherever your package installer put Mercurial."
dongsheng@627 13136 msgstr ""
dongsheng@627 13137
dongsheng@627 13138 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 13139 #: ../en/ch10-hook.xml:609
songdongsheng@668 13140 msgid ""
songdongsheng@668 13141 "<literal role=\"hg-ext\">acl</literal>&emdash;access control for parts of a "
dongsheng@627 13142 "repository"
dongsheng@661 13143 msgstr "<literal role=\"hg-ext\">acl</literal>—版本库的访问控制"
dongsheng@627 13144
dongsheng@627 13145 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13146 #: ../en/ch10-hook.xml:612
dongsheng@627 13147 msgid ""
dongsheng@627 13148 "The <literal role=\"hg-ext\">acl</literal> extension lets you control which "
dongsheng@627 13149 "remote users are allowed to push changesets to a networked server. You can "
dongsheng@627 13150 "protect any portion of a repository (including the entire repo), so that a "
dongsheng@627 13151 "specific remote user can push changes that do not affect the protected "
dongsheng@627 13152 "portion."
dongsheng@627 13153 msgstr ""
dongsheng@627 13154
dongsheng@627 13155 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13156 #: ../en/ch10-hook.xml:620
dongsheng@627 13157 msgid ""
dongsheng@627 13158 "This extension implements access control based on the identity of the user "
dongsheng@627 13159 "performing a push, <emphasis>not</emphasis> on who committed the changesets "
dongsheng@627 13160 "they're pushing. It makes sense to use this hook only if you have a locked-"
dongsheng@627 13161 "down server environment that authenticates remote users, and you want to be "
dongsheng@627 13162 "sure that only specific users are allowed to push changes to that server."
dongsheng@627 13163 msgstr ""
dongsheng@627 13164
dongsheng@627 13165 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 13166 #: ../en/ch10-hook.xml:630
dongsheng@627 13167 msgid "Configuring the <literal role=\"hook\">acl</literal> hook"
dongsheng@635 13168 msgstr "配置 <literal role=\"hook\">acl</literal> 钩子"
dongsheng@627 13169
dongsheng@627 13170 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13171 #: ../en/ch10-hook.xml:633
dongsheng@627 13172 msgid ""
dongsheng@627 13173 "In order to manage incoming changesets, the <literal role=\"hg-ext\">acl</"
dongsheng@627 13174 "literal> hook must be used as a <literal role=\"hook\">pretxnchangegroup</"
dongsheng@627 13175 "literal> hook. This lets it see which files are modified by each incoming "
dongsheng@627 13176 "changeset, and roll back a group of changesets if they modify "
dongsheng@627 13177 "<quote>forbidden</quote> files. Example:"
dongsheng@627 13178 msgstr ""
dongsheng@627 13179
dongsheng@627 13180 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13181 #: ../en/ch10-hook.xml:643
dongsheng@627 13182 msgid ""
dongsheng@627 13183 "The <literal role=\"hg-ext\">acl</literal> extension is configured using "
dongsheng@627 13184 "three sections."
dongsheng@627 13185 msgstr ""
dongsheng@627 13186
dongsheng@627 13187 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13188 #: ../en/ch10-hook.xml:647
dongsheng@627 13189 msgid ""
dongsheng@627 13190 "The <literal role=\"rc-acl\">acl</literal> section has only one entry, <envar "
dongsheng@627 13191 "role=\"rc-item-acl\">sources</envar>, which lists the sources of incoming "
dongsheng@627 13192 "changesets that the hook should pay attention to. You don't normally need to "
dongsheng@627 13193 "configure this section."
dongsheng@627 13194 msgstr ""
dongsheng@627 13195
dongsheng@627 13196 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13197 #: ../en/ch10-hook.xml:654
dongsheng@627 13198 msgid ""
dongsheng@627 13199 "<envar role=\"rc-item-acl\">serve</envar>: Control incoming changesets that "
dongsheng@627 13200 "are arriving from a remote repository over http or ssh. This is the default "
dongsheng@627 13201 "value of <envar role=\"rc-item-acl\">sources</envar>, and usually the only "
dongsheng@627 13202 "setting you'll need for this configuration item."
dongsheng@627 13203 msgstr ""
dongsheng@627 13204
dongsheng@627 13205 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13206 #: ../en/ch10-hook.xml:662
dongsheng@627 13207 msgid ""
dongsheng@627 13208 "<envar role=\"rc-item-acl\">pull</envar>: Control incoming changesets that "
dongsheng@627 13209 "are arriving via a pull from a local repository."
dongsheng@627 13210 msgstr ""
dongsheng@627 13211
dongsheng@627 13212 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13213 #: ../en/ch10-hook.xml:667
dongsheng@627 13214 msgid ""
dongsheng@627 13215 "<envar role=\"rc-item-acl\">push</envar>: Control incoming changesets that "
dongsheng@627 13216 "are arriving via a push from a local repository."
dongsheng@627 13217 msgstr ""
dongsheng@627 13218
dongsheng@627 13219 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13220 #: ../en/ch10-hook.xml:672
dongsheng@627 13221 msgid ""
dongsheng@627 13222 "<envar role=\"rc-item-acl\">bundle</envar>: Control incoming changesets that "
dongsheng@627 13223 "are arriving from another repository via a bundle."
dongsheng@627 13224 msgstr ""
dongsheng@627 13225
dongsheng@627 13226 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13227 #: ../en/ch10-hook.xml:678
dongsheng@627 13228 msgid ""
dongsheng@627 13229 "The <literal role=\"rc-acl.allow\">acl.allow</literal> section controls the "
dongsheng@627 13230 "users that are allowed to add changesets to the repository. If this section "
dongsheng@627 13231 "is not present, all users that are not explicitly denied are allowed. If "
dongsheng@627 13232 "this section is present, all users that are not explicitly allowed are denied "
dongsheng@627 13233 "(so an empty section means that all users are denied)."
dongsheng@627 13234 msgstr ""
dongsheng@627 13235
dongsheng@627 13236 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13237 #: ../en/ch10-hook.xml:687
dongsheng@627 13238 msgid ""
dongsheng@627 13239 "The <literal role=\"rc-acl.deny\">acl.deny</literal> section determines which "
dongsheng@627 13240 "users are denied from adding changesets to the repository. If this section "
dongsheng@627 13241 "is not present or is empty, no users are denied."
dongsheng@627 13242 msgstr ""
dongsheng@627 13243
dongsheng@627 13244 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13245 #: ../en/ch10-hook.xml:693
dongsheng@627 13246 msgid ""
dongsheng@627 13247 "The syntaxes for the <literal role=\"rc-acl.allow\">acl.allow</literal> and "
dongsheng@627 13248 "<literal role=\"rc-acl.deny\">acl.deny</literal> sections are identical. On "
dongsheng@627 13249 "the left of each entry is a glob pattern that matches files or directories, "
dongsheng@627 13250 "relative to the root of the repository; on the right, a user name."
dongsheng@627 13251 msgstr ""
dongsheng@627 13252
dongsheng@627 13253 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13254 #: ../en/ch10-hook.xml:701
dongsheng@627 13255 msgid ""
dongsheng@627 13256 "In the following example, the user <literal>docwriter</literal> can only push "
dongsheng@627 13257 "changes to the <filename class=\"directory\">docs</filename> subtree of the "
dongsheng@627 13258 "repository, while <literal>intern</literal> can push changes to any file or "
dongsheng@627 13259 "directory except <filename class=\"directory\">source/sensitive</filename>."
dongsheng@627 13260 msgstr ""
dongsheng@627 13261
dongsheng@627 13262 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 13263 #: ../en/ch10-hook.xml:715 ../en/ch10-hook.xml:979 ../en/ch10-hook.xml:1169
dongsheng@627 13264 msgid "Testing and troubleshooting"
dongsheng@635 13265 msgstr "测试与问题处理"
dongsheng@627 13266
dongsheng@627 13267 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13268 #: ../en/ch10-hook.xml:717
dongsheng@627 13269 msgid ""
dongsheng@627 13270 "If you want to test the <literal role=\"hg-ext\">acl</literal> hook, run it "
dongsheng@627 13271 "with Mercurial's debugging output enabled. Since you'll probably be running "
dongsheng@627 13272 "it on a server where it's not convenient (or sometimes possible) to pass in "
dongsheng@627 13273 "the <option role=\"hg-opt-global\">--debug</option> option, don't forget that "
dongsheng@650 13274 "you can enable debugging output in your <filename role=\"special\">~/.hgrc</"
dongsheng@627 13275 "filename>:"
dongsheng@627 13276 msgstr ""
dongsheng@627 13277
dongsheng@627 13278 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13279 #: ../en/ch10-hook.xml:728
dongsheng@627 13280 msgid ""
dongsheng@627 13281 "With this enabled, the <literal role=\"hg-ext\">acl</literal> hook will print "
dongsheng@627 13282 "enough information to let you figure out why it is allowing or forbidding "
dongsheng@627 13283 "pushes from specific users."
dongsheng@627 13284 msgstr ""
dongsheng@627 13285
dongsheng@627 13286 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 13287 #: ../en/ch10-hook.xml:737
songdongsheng@668 13288 msgid ""
songdongsheng@668 13289 "<literal role=\"hg-ext\">bugzilla</literal>&emdash;integration with Bugzilla"
dongsheng@661 13290 msgstr "<literal role=\"hg-ext\">bugzilla</literal>—与 Bugzilla 的集成"
dongsheng@627 13291
dongsheng@627 13292 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13293 #: ../en/ch10-hook.xml:741
dongsheng@627 13294 msgid ""
dongsheng@627 13295 "The <literal role=\"hg-ext\">bugzilla</literal> extension adds a comment to a "
dongsheng@627 13296 "Bugzilla bug whenever it finds a reference to that bug ID in a commit "
dongsheng@627 13297 "comment. You can install this hook on a shared server, so that any time a "
dongsheng@627 13298 "remote user pushes changes to this server, the hook gets run."
dongsheng@627 13299 msgstr ""
dongsheng@627 13300
dongsheng@627 13301 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13302 #: ../en/ch10-hook.xml:748
dongsheng@627 13303 msgid ""
dongsheng@627 13304 "It adds a comment to the bug that looks like this (you can configure the "
songdongsheng@668 13305 "contents of the comment&emdash;see below):"
dongsheng@627 13306 msgstr ""
dongsheng@627 13307
dongsheng@627 13308 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13309 #: ../en/ch10-hook.xml:757
dongsheng@627 13310 msgid ""
dongsheng@627 13311 "The value of this hook is that it automates the process of updating a bug any "
dongsheng@627 13312 "time a changeset refers to it. If you configure the hook properly, it makes "
dongsheng@627 13313 "it easy for people to browse straight from a Bugzilla bug to a changeset that "
dongsheng@627 13314 "refers to that bug."
dongsheng@627 13315 msgstr ""
dongsheng@627 13316
dongsheng@627 13317 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13318 #: ../en/ch10-hook.xml:764
dongsheng@627 13319 msgid ""
dongsheng@627 13320 "You can use the code in this hook as a starting point for some more exotic "
dongsheng@627 13321 "Bugzilla integration recipes. Here are a few possibilities:"
dongsheng@627 13322 msgstr ""
dongsheng@627 13323
dongsheng@627 13324 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 13325 #: ../en/ch10-hook.xml:769
dongsheng@627 13326 msgid ""
dongsheng@627 13327 "Require that every changeset pushed to the server have a valid bug ID in its "
dongsheng@627 13328 "commit comment. In this case, you'd want to configure the hook as a <literal "
dongsheng@627 13329 "role=\"hook\">pretxncommit</literal> hook. This would allow the hook to "
dongsheng@627 13330 "reject changes that didn't contain bug IDs."
dongsheng@627 13331 msgstr ""
dongsheng@627 13332
dongsheng@627 13333 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 13334 #: ../en/ch10-hook.xml:777
dongsheng@627 13335 msgid ""
dongsheng@627 13336 "Allow incoming changesets to automatically modify the <emphasis>state</"
dongsheng@627 13337 "emphasis> of a bug, as well as simply adding a comment. For example, the "
dongsheng@627 13338 "hook could recognise the string <quote>fixed bug 31337</quote> as indicating "
dongsheng@627 13339 "that it should update the state of bug 31337 to <quote>requires testing</"
dongsheng@627 13340 "quote>."
dongsheng@627 13341 msgstr ""
dongsheng@627 13342
dongsheng@627 13343 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 13344 #: ../en/ch10-hook.xml:787
dongsheng@627 13345 msgid "Configuring the <literal role=\"hook\">bugzilla</literal> hook"
dongsheng@635 13346 msgstr "配置 <literal role=\"hook\">bugzilla</literal> 钩子"
dongsheng@627 13347
dongsheng@627 13348 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13349 #: ../en/ch10-hook.xml:790
dongsheng@650 13350 msgid ""
dongsheng@650 13351 "You should configure this hook in your server's <filename role=\"special\">~/."
dongsheng@650 13352 "hgrc</filename> as an <literal role=\"hook\">incoming</literal> hook, for "
dongsheng@627 13353 "example as follows:"
dongsheng@627 13354 msgstr ""
dongsheng@627 13355
dongsheng@627 13356 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13357 #: ../en/ch10-hook.xml:798
dongsheng@627 13358 msgid ""
dongsheng@627 13359 "Because of the specialised nature of this hook, and because Bugzilla was not "
dongsheng@627 13360 "written with this kind of integration in mind, configuring this hook is a "
dongsheng@627 13361 "somewhat involved process."
dongsheng@627 13362 msgstr ""
dongsheng@627 13363
dongsheng@627 13364 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13365 #: ../en/ch10-hook.xml:804
dongsheng@627 13366 msgid ""
dongsheng@627 13367 "Before you begin, you must install the MySQL bindings for Python on the host"
dongsheng@627 13368 "(s) where you'll be running the hook. If this is not available as a binary "
dongsheng@627 13369 "package for your system, you can download it from <citation>web:mysql-python</"
dongsheng@627 13370 "citation>."
dongsheng@627 13371 msgstr ""
dongsheng@627 13372
dongsheng@627 13373 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13374 #: ../en/ch10-hook.xml:811
dongsheng@627 13375 msgid ""
dongsheng@627 13376 "Configuration information for this hook lives in the <literal role=\"rc-"
dongsheng@650 13377 "bugzilla\">bugzilla</literal> section of your <filename role=\"special\">~/."
dongsheng@627 13378 "hgrc</filename>."
dongsheng@627 13379 msgstr ""
dongsheng@627 13380
dongsheng@627 13381 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13382 #: ../en/ch10-hook.xml:816
dongsheng@627 13383 msgid ""
dongsheng@627 13384 "<envar role=\"rc-item-bugzilla\">version</envar>: The version of Bugzilla "
dongsheng@627 13385 "installed on the server. The database schema that Bugzilla uses changes "
dongsheng@714 13386 "occasionally, so this hook has to know exactly which schema to use."
dongsheng@627 13387 msgstr ""
dongsheng@627 13388
dongsheng@627 13389 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13390 #: ../en/ch10-hook.xml:822
dongsheng@627 13391 msgid ""
dongsheng@627 13392 "<envar role=\"rc-item-bugzilla\">host</envar>: The hostname of the MySQL "
dongsheng@627 13393 "server that stores your Bugzilla data. The database must be configured to "
dongsheng@627 13394 "allow connections from whatever host you are running the <literal role=\"hook"
dongsheng@627 13395 "\">bugzilla</literal> hook on."
dongsheng@627 13396 msgstr ""
dongsheng@627 13397
dongsheng@627 13398 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13399 #: ../en/ch10-hook.xml:829
dongsheng@627 13400 msgid ""
dongsheng@627 13401 "<envar role=\"rc-item-bugzilla\">user</envar>: The username with which to "
dongsheng@627 13402 "connect to the MySQL server. The database must be configured to allow this "
dongsheng@627 13403 "user to connect from whatever host you are running the <literal role=\"hook"
dongsheng@627 13404 "\">bugzilla</literal> hook on. This user must be able to access and modify "
dongsheng@627 13405 "Bugzilla tables. The default value of this item is <literal>bugs</literal>, "
dongsheng@627 13406 "which is the standard name of the Bugzilla user in a MySQL database."
dongsheng@627 13407 msgstr ""
dongsheng@627 13408
dongsheng@627 13409 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13410 #: ../en/ch10-hook.xml:840
dongsheng@627 13411 msgid ""
dongsheng@627 13412 "<envar role=\"rc-item-bugzilla\">password</envar>: The MySQL password for the "
dongsheng@627 13413 "user you configured above. This is stored as plain text, so you should make "
dongsheng@650 13414 "sure that unauthorised users cannot read the <filename role=\"special\">~/."
dongsheng@650 13415 "hgrc</filename> file where you store this information."
dongsheng@627 13416 msgstr ""
dongsheng@627 13417
dongsheng@627 13418 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13419 #: ../en/ch10-hook.xml:849
dongsheng@627 13420 msgid ""
dongsheng@627 13421 "<envar role=\"rc-item-bugzilla\">db</envar>: The name of the Bugzilla "
dongsheng@627 13422 "database on the MySQL server. The default value of this item is "
dongsheng@627 13423 "<literal>bugs</literal>, which is the standard name of the MySQL database "
dongsheng@627 13424 "where Bugzilla stores its data."
dongsheng@627 13425 msgstr ""
dongsheng@627 13426
dongsheng@627 13427 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13428 #: ../en/ch10-hook.xml:856
dongsheng@627 13429 msgid ""
dongsheng@627 13430 "<envar role=\"rc-item-bugzilla\">notify</envar>: If you want Bugzilla to send "
dongsheng@627 13431 "out a notification email to subscribers after this hook has added a comment "
dongsheng@627 13432 "to a bug, you will need this hook to run a command whenever it updates the "
dongsheng@627 13433 "database. The command to run depends on where you have installed Bugzilla, "
dongsheng@627 13434 "but it will typically look something like this, if you have Bugzilla "
dongsheng@627 13435 "installed in <filename class=\"directory\">/var/www/html/bugzilla</filename>:"
dongsheng@627 13436 msgstr ""
dongsheng@627 13437
dongsheng@627 13438 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13439 #: ../en/ch10-hook.xml:869
dongsheng@627 13440 msgid ""
dongsheng@627 13441 "The Bugzilla <literal>processmail</literal> program expects to be given a bug "
dongsheng@627 13442 "ID (the hook replaces <quote><literal>%s</literal></quote> with the bug ID) "
dongsheng@627 13443 "and an email address. It also expects to be able to write to some files in "
dongsheng@627 13444 "the directory that it runs in. If Bugzilla and this hook are not installed "
dongsheng@627 13445 "on the same machine, you will need to find a way to run <literal>processmail</"
dongsheng@627 13446 "literal> on the server where Bugzilla is installed."
dongsheng@627 13447 msgstr ""
dongsheng@627 13448
dongsheng@627 13449 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 13450 #: ../en/ch10-hook.xml:884
dongsheng@627 13451 msgid "Mapping committer names to Bugzilla user names"
dongsheng@635 13452 msgstr "提交者的名称与 Bugzilla 用户名称的映射"
dongsheng@627 13453
dongsheng@627 13454 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13455 #: ../en/ch10-hook.xml:886
dongsheng@627 13456 msgid ""
dongsheng@627 13457 "By default, the <literal role=\"hg-ext\">bugzilla</literal> hook tries to use "
dongsheng@627 13458 "the email address of a changeset's committer as the Bugzilla user name with "
dongsheng@627 13459 "which to update a bug. If this does not suit your needs, you can map "
dongsheng@627 13460 "committer email addresses to Bugzilla user names using a <literal role=\"rc-"
dongsheng@627 13461 "usermap\">usermap</literal> section."
dongsheng@627 13462 msgstr ""
dongsheng@627 13463
dongsheng@627 13464 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13465 #: ../en/ch10-hook.xml:895
dongsheng@627 13466 msgid ""
dongsheng@627 13467 "Each item in the <literal role=\"rc-usermap\">usermap</literal> section "
dongsheng@627 13468 "contains an email address on the left, and a Bugzilla user name on the right."
dongsheng@627 13469 msgstr ""
dongsheng@627 13470
dongsheng@627 13471 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13472 #: ../en/ch10-hook.xml:902
dongsheng@627 13473 msgid ""
dongsheng@627 13474 "You can either keep the <literal role=\"rc-usermap\">usermap</literal> data "
dongsheng@627 13475 "in a normal <filename role=\"special\">~/.hgrc</filename>, or tell the "
dongsheng@627 13476 "<literal role=\"hg-ext\">bugzilla</literal> hook to read the information from "
dongsheng@627 13477 "an external <filename>usermap</filename> file. In the latter case, you can "
dongsheng@627 13478 "store <filename>usermap</filename> data by itself in (for example) a user-"
dongsheng@627 13479 "modifiable repository. This makes it possible to let your users maintain "
dongsheng@627 13480 "their own <envar role=\"rc-item-bugzilla\">usermap</envar> entries. The main "
dongsheng@650 13481 "<filename role=\"special\">~/.hgrc</filename> file might look like this:"
dongsheng@627 13482 msgstr ""
dongsheng@627 13483
dongsheng@627 13484 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13485 #: ../en/ch10-hook.xml:918
dongsheng@627 13486 msgid ""
dongsheng@627 13487 "While the <filename>usermap</filename> file that it refers to might look like "
dongsheng@627 13488 "this:"
dongsheng@627 13489 msgstr ""
dongsheng@627 13490
dongsheng@627 13491 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 13492 #: ../en/ch10-hook.xml:926
dongsheng@627 13493 msgid "Configuring the text that gets added to a bug"
dongsheng@635 13494 msgstr "配置增加到问题中的正文"
dongsheng@627 13495
dongsheng@627 13496 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13497 #: ../en/ch10-hook.xml:928
dongsheng@627 13498 msgid ""
dongsheng@627 13499 "You can configure the text that this hook adds as a comment; you specify it "
dongsheng@650 13500 "in the form of a Mercurial template. Several <filename role=\"special\">~/."
dongsheng@650 13501 "hgrc</filename> entries (still in the <literal role=\"rc-bugzilla\">bugzilla</"
songdongsheng@710 13502 "literal> section) control this behavior."
dongsheng@627 13503 msgstr ""
dongsheng@627 13504
dongsheng@627 13505 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13506 #: ../en/ch10-hook.xml:935
dongsheng@627 13507 msgid ""
dongsheng@627 13508 "<literal>strip</literal>: The number of leading path elements to strip from a "
dongsheng@627 13509 "repository's path name to construct a partial path for a URL. For example, if "
dongsheng@627 13510 "the repositories on your server live under <filename class=\"directory\">/"
dongsheng@627 13511 "home/hg/repos</filename>, and you have a repository whose path is <filename "
dongsheng@627 13512 "class=\"directory\">/home/hg/repos/app/tests</filename>, then setting "
dongsheng@627 13513 "<literal>strip</literal> to <literal>4</literal> will give a partial path of "
dongsheng@627 13514 "<filename class=\"directory\">app/tests</filename>. The hook will make this "
dongsheng@627 13515 "partial path available when expanding a template, as <literal>webroot</"
dongsheng@627 13516 "literal>."
dongsheng@627 13517 msgstr ""
dongsheng@627 13518
dongsheng@627 13519 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13520 #: ../en/ch10-hook.xml:949
dongsheng@627 13521 msgid ""
dongsheng@627 13522 "<literal>template</literal>: The text of the template to use. In addition to "
dongsheng@627 13523 "the usual changeset-related variables, this template can use <literal>hgweb</"
dongsheng@627 13524 "literal> (the value of the <literal>hgweb</literal> configuration item above) "
dongsheng@627 13525 "and <literal>webroot</literal> (the path constructed using <literal>strip</"
dongsheng@627 13526 "literal> above)."
dongsheng@627 13527 msgstr ""
dongsheng@627 13528
dongsheng@627 13529 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13530 #: ../en/ch10-hook.xml:959
dongsheng@627 13531 msgid ""
dongsheng@627 13532 "In addition, you can add a <envar role=\"rc-item-web\">baseurl</envar> item "
dongsheng@627 13533 "to the <literal role=\"rc-web\">web</literal> section of your <filename role="
dongsheng@650 13534 "\"special\">~/.hgrc</filename>. The <literal role=\"hg-ext\">bugzilla</"
dongsheng@627 13535 "literal> hook will make this available when expanding a template, as the base "
dongsheng@627 13536 "string to use when constructing a URL that will let users browse from a "
dongsheng@627 13537 "Bugzilla comment to view a changeset. Example:"
dongsheng@627 13538 msgstr ""
dongsheng@627 13539
dongsheng@627 13540 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13541 #: ../en/ch10-hook.xml:971
dongsheng@627 13542 msgid ""
dongsheng@627 13543 "Here is an example set of <literal role=\"hg-ext\">bugzilla</literal> hook "
dongsheng@627 13544 "config information."
dongsheng@627 13545 msgstr ""
dongsheng@627 13546
dongsheng@627 13547 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13548 #: ../en/ch10-hook.xml:981
dongsheng@627 13549 msgid ""
dongsheng@627 13550 "The most common problems with configuring the <literal role=\"hg-ext"
dongsheng@627 13551 "\">bugzilla</literal> hook relate to running Bugzilla's "
dongsheng@627 13552 "<filename>processmail</filename> script and mapping committer names to user "
dongsheng@627 13553 "names."
dongsheng@627 13554 msgstr ""
dongsheng@627 13555
dongsheng@627 13556 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13557 #: ../en/ch10-hook.xml:987
dongsheng@627 13558 msgid ""
songdongsheng@658 13559 "Recall from <xref linkend=\"sec:hook:bugzilla:config\"/> above that the user "
songdongsheng@658 13560 "that runs the Mercurial process on the server is also the one that will run "
songdongsheng@658 13561 "the <filename>processmail</filename> script. The <filename>processmail</"
songdongsheng@658 13562 "filename> script sometimes causes Bugzilla to write to files in its "
songdongsheng@658 13563 "configuration directory, and Bugzilla's configuration files are usually owned "
songdongsheng@658 13564 "by the user that your web server runs under."
dongsheng@627 13565 msgstr ""
dongsheng@627 13566
dongsheng@627 13567 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13568 #: ../en/ch10-hook.xml:998
dongsheng@627 13569 msgid ""
dongsheng@627 13570 "You can cause <filename>processmail</filename> to be run with the suitable "
dongsheng@627 13571 "user's identity using the <command>sudo</command> command. Here is an "
dongsheng@627 13572 "example entry for a <filename>sudoers</filename> file."
dongsheng@627 13573 msgstr ""
dongsheng@627 13574
dongsheng@627 13575 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13576 #: ../en/ch10-hook.xml:1005
dongsheng@627 13577 msgid ""
dongsheng@627 13578 "This allows the <literal>hg_user</literal> user to run a "
dongsheng@627 13579 "<filename>processmail-wrapper</filename> program under the identity of "
dongsheng@627 13580 "<literal>httpd_user</literal>."
dongsheng@627 13581 msgstr ""
dongsheng@627 13582
dongsheng@627 13583 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13584 #: ../en/ch10-hook.xml:1010
dongsheng@627 13585 msgid ""
dongsheng@627 13586 "This indirection through a wrapper script is necessary, because "
dongsheng@627 13587 "<filename>processmail</filename> expects to be run with its current directory "
dongsheng@627 13588 "set to wherever you installed Bugzilla; you can't specify that kind of "
dongsheng@627 13589 "constraint in a <filename>sudoers</filename> file. The contents of the "
dongsheng@627 13590 "wrapper script are simple:"
dongsheng@627 13591 msgstr ""
dongsheng@627 13592
dongsheng@627 13593 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13594 #: ../en/ch10-hook.xml:1019
dongsheng@627 13595 msgid ""
dongsheng@627 13596 "It doesn't seem to matter what email address you pass to "
dongsheng@627 13597 "<filename>processmail</filename>."
dongsheng@627 13598 msgstr ""
dongsheng@627 13599
dongsheng@627 13600 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13601 #: ../en/ch10-hook.xml:1023
dongsheng@627 13602 msgid ""
dongsheng@627 13603 "If your <literal role=\"rc-usermap\">usermap</literal> is not set up "
dongsheng@627 13604 "correctly, users will see an error message from the <literal role=\"hg-ext"
dongsheng@627 13605 "\">bugzilla</literal> hook when they push changes to the server. The error "
dongsheng@627 13606 "message will look like this:"
dongsheng@627 13607 msgstr ""
dongsheng@627 13608
dongsheng@627 13609 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13610 #: ../en/ch10-hook.xml:1030
dongsheng@627 13611 msgid ""
dongsheng@627 13612 "What this means is that the committer's address, <literal>john.q."
dongsheng@627 13613 "public@example.com</literal>, is not a valid Bugzilla user name, nor does it "
dongsheng@627 13614 "have an entry in your <literal role=\"rc-usermap\">usermap</literal> that "
dongsheng@627 13615 "maps it to a valid Bugzilla user name."
dongsheng@627 13616 msgstr ""
dongsheng@627 13617
dongsheng@627 13618 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 13619 #: ../en/ch10-hook.xml:1040
songdongsheng@668 13620 msgid ""
songdongsheng@668 13621 "<literal role=\"hg-ext\">notify</literal>&emdash;send email notifications"
dongsheng@661 13622 msgstr "<literal role=\"hg-ext\">notify</literal>—邮件通知"
dongsheng@627 13623
dongsheng@627 13624 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13625 #: ../en/ch10-hook.xml:1043
dongsheng@627 13626 msgid ""
dongsheng@627 13627 "Although Mercurial's built-in web server provides RSS feeds of changes in "
dongsheng@627 13628 "every repository, many people prefer to receive change notifications via "
dongsheng@627 13629 "email. The <literal role=\"hg-ext\">notify</literal> hook lets you send out "
dongsheng@627 13630 "notifications to a set of email addresses whenever changesets arrive that "
dongsheng@627 13631 "those subscribers are interested in."
dongsheng@627 13632 msgstr ""
dongsheng@627 13633
dongsheng@627 13634 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13635 #: ../en/ch10-hook.xml:1051
dongsheng@627 13636 msgid ""
dongsheng@627 13637 "As with the <literal role=\"hg-ext\">bugzilla</literal> hook, the <literal "
dongsheng@627 13638 "role=\"hg-ext\">notify</literal> hook is template-driven, so you can "
dongsheng@627 13639 "customise the contents of the notification messages that it sends."
dongsheng@627 13640 msgstr ""
dongsheng@627 13641
dongsheng@627 13642 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13643 #: ../en/ch10-hook.xml:1057
dongsheng@627 13644 msgid ""
dongsheng@627 13645 "By default, the <literal role=\"hg-ext\">notify</literal> hook includes a "
dongsheng@627 13646 "diff of every changeset that it sends out; you can limit the size of the "
dongsheng@627 13647 "diff, or turn this feature off entirely. It is useful for letting "
dongsheng@627 13648 "subscribers review changes immediately, rather than clicking to follow a URL."
dongsheng@627 13649 msgstr ""
dongsheng@627 13650
dongsheng@627 13651 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 13652 #: ../en/ch10-hook.xml:1065
dongsheng@627 13653 msgid "Configuring the <literal role=\"hg-ext\">notify</literal> hook"
dongsheng@635 13654 msgstr "配置 <literal role=\"hg-ext\">notify</literal> 钩子"
dongsheng@627 13655
dongsheng@627 13656 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13657 #: ../en/ch10-hook.xml:1068
dongsheng@627 13658 msgid ""
dongsheng@627 13659 "You can set up the <literal role=\"hg-ext\">notify</literal> hook to send one "
dongsheng@627 13660 "email message per incoming changeset, or one per incoming group of changesets "
dongsheng@627 13661 "(all those that arrived in a single pull or push)."
dongsheng@627 13662 msgstr ""
dongsheng@627 13663
dongsheng@627 13664 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13665 #: ../en/ch10-hook.xml:1080
dongsheng@627 13666 msgid ""
dongsheng@627 13667 "Configuration information for this hook lives in the <literal role=\"rc-notify"
dongsheng@650 13668 "\">notify</literal> section of a <filename role=\"special\">~/.hgrc</"
dongsheng@650 13669 "filename> file."
dongsheng@627 13670 msgstr ""
dongsheng@627 13671
dongsheng@627 13672 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13673 #: ../en/ch10-hook.xml:1085
dongsheng@627 13674 msgid ""
dongsheng@627 13675 "<envar role=\"rc-item-notify\">test</envar>: By default, this hook does not "
dongsheng@627 13676 "send out email at all; instead, it prints the message that it "
dongsheng@627 13677 "<emphasis>would</emphasis> send. Set this item to <literal>false</literal> "
dongsheng@627 13678 "to allow email to be sent. The reason that sending of email is turned off by "
dongsheng@627 13679 "default is that it takes several tries to configure this extension exactly as "
dongsheng@627 13680 "you would like, and it would be bad form to spam subscribers with a number of "
dongsheng@627 13681 "<quote>broken</quote> notifications while you debug your configuration."
dongsheng@627 13682 msgstr ""
dongsheng@627 13683
dongsheng@627 13684 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13685 #: ../en/ch10-hook.xml:1097
dongsheng@627 13686 msgid ""
dongsheng@627 13687 "<envar role=\"rc-item-notify\">config</envar>: The path to a configuration "
dongsheng@627 13688 "file that contains subscription information. This is kept separate from the "
dongsheng@650 13689 "main <filename role=\"special\">~/.hgrc</filename> so that you can maintain "
dongsheng@627 13690 "it in a repository of its own. People can then clone that repository, update "
dongsheng@627 13691 "their subscriptions, and push the changes back to your server."
dongsheng@627 13692 msgstr ""
dongsheng@627 13693
dongsheng@627 13694 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13695 #: ../en/ch10-hook.xml:1106
dongsheng@627 13696 msgid ""
dongsheng@627 13697 "<envar role=\"rc-item-notify\">strip</envar>: The number of leading path "
dongsheng@627 13698 "separator characters to strip from a repository's path, when deciding whether "
dongsheng@627 13699 "a repository has subscribers. For example, if the repositories on your "
dongsheng@627 13700 "server live in <filename class=\"directory\">/home/hg/repos</filename>, and "
dongsheng@627 13701 "<literal role=\"hg-ext\">notify</literal> is considering a repository named "
dongsheng@627 13702 "<filename class=\"directory\">/home/hg/repos/shared/test</filename>, setting "
dongsheng@627 13703 "<envar role=\"rc-item-notify\">strip</envar> to <literal>4</literal> will "
dongsheng@627 13704 "cause <literal role=\"hg-ext\">notify</literal> to trim the path it considers "
dongsheng@627 13705 "down to <filename class=\"directory\">shared/test</filename>, and it will "
dongsheng@627 13706 "match subscribers against that."
dongsheng@627 13707 msgstr ""
dongsheng@627 13708
dongsheng@627 13709 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13710 #: ../en/ch10-hook.xml:1123
dongsheng@627 13711 msgid ""
dongsheng@627 13712 "<envar role=\"rc-item-notify\">template</envar>: The template text to use "
dongsheng@627 13713 "when sending messages. This specifies both the contents of the message "
dongsheng@627 13714 "header and its body."
dongsheng@627 13715 msgstr ""
dongsheng@627 13716
dongsheng@627 13717 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13718 #: ../en/ch10-hook.xml:1129
dongsheng@627 13719 msgid ""
dongsheng@627 13720 "<envar role=\"rc-item-notify\">maxdiff</envar>: The maximum number of lines "
dongsheng@627 13721 "of diff data to append to the end of a message. If a diff is longer than "
dongsheng@627 13722 "this, it is truncated. By default, this is set to 300. Set this to "
dongsheng@627 13723 "<literal>0</literal> to omit diffs from notification emails."
dongsheng@627 13724 msgstr ""
dongsheng@627 13725
dongsheng@627 13726 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13727 #: ../en/ch10-hook.xml:1138
dongsheng@627 13728 msgid ""
dongsheng@627 13729 "<envar role=\"rc-item-notify\">sources</envar>: A list of sources of "
dongsheng@627 13730 "changesets to consider. This lets you limit <literal role=\"hg-ext\">notify</"
dongsheng@627 13731 "literal> to only sending out email about changes that remote users pushed "
songdongsheng@658 13732 "into this repository via a server, for example. See <xref linkend=\"sec:hook:"
songdongsheng@658 13733 "sources\"/> for the sources you can specify here."
dongsheng@627 13734 msgstr ""
dongsheng@627 13735
dongsheng@627 13736 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13737 #: ../en/ch10-hook.xml:1149
dongsheng@627 13738 msgid ""
dongsheng@627 13739 "If you set the <envar role=\"rc-item-web\">baseurl</envar> item in the "
dongsheng@627 13740 "<literal role=\"rc-web\">web</literal> section, you can use it in a template; "
dongsheng@627 13741 "it will be available as <literal>webroot</literal>."
dongsheng@627 13742 msgstr ""
dongsheng@627 13743
dongsheng@627 13744 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13745 #: ../en/ch10-hook.xml:1155
dongsheng@627 13746 msgid ""
dongsheng@627 13747 "Here is an example set of <literal role=\"hg-ext\">notify</literal> "
dongsheng@627 13748 "configuration information."
dongsheng@627 13749 msgstr ""
dongsheng@627 13750
dongsheng@627 13751 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13752 #: ../en/ch10-hook.xml:1161
dongsheng@627 13753 msgid "This will produce a message that looks like the following:"
dongsheng@627 13754 msgstr ""
dongsheng@627 13755
dongsheng@627 13756 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13757 #: ../en/ch10-hook.xml:1171
dongsheng@627 13758 msgid ""
dongsheng@627 13759 "Do not forget that by default, the <literal role=\"hg-ext\">notify</literal> "
dongsheng@627 13760 "extension <emphasis>will not send any mail</emphasis> until you explicitly "
dongsheng@627 13761 "configure it to do so, by setting <envar role=\"rc-item-notify\">test</envar> "
dongsheng@627 13762 "to <literal>false</literal>. Until you do that, it simply prints the message "
dongsheng@627 13763 "it <emphasis>would</emphasis> send."
dongsheng@627 13764 msgstr ""
dongsheng@627 13765
dongsheng@627 13766 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 13767 #: ../en/ch10-hook.xml:1183
dongsheng@627 13768 msgid "Information for writers of hooks"
dongsheng@635 13769 msgstr "编写钩子的信息"
dongsheng@627 13770
dongsheng@627 13771 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 13772 #: ../en/ch10-hook.xml:1186
dongsheng@627 13773 msgid "In-process hook execution"
dongsheng@635 13774 msgstr "进程内钩子的执行"
dongsheng@627 13775
dongsheng@627 13776 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13777 #: ../en/ch10-hook.xml:1188
dongsheng@627 13778 msgid "An in-process hook is called with arguments of the following form:"
dongsheng@627 13779 msgstr ""
dongsheng@627 13780
dongsheng@627 13781 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13782 #: ../en/ch10-hook.xml:1192
dongsheng@627 13783 msgid ""
dongsheng@627 13784 "The <literal>ui</literal> parameter is a <literal role=\"py-mod-mercurial.ui"
dongsheng@627 13785 "\">ui</literal> object. The <literal>repo</literal> parameter is a <literal "
dongsheng@627 13786 "role=\"py-mod-mercurial.localrepo\">localrepository</literal> object. The "
dongsheng@627 13787 "names and values of the <literal>**kwargs</literal> parameters depend on the "
dongsheng@627 13788 "hook being invoked, with the following common features:"
dongsheng@627 13789 msgstr ""
dongsheng@627 13790
dongsheng@627 13791 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 13792 #: ../en/ch10-hook.xml:1201
dongsheng@627 13793 msgid ""
dongsheng@627 13794 "If a parameter is named <literal>node</literal> or <literal>parentN</"
dongsheng@627 13795 "literal>, it will contain a hexadecimal changeset ID. The empty string is "
dongsheng@627 13796 "used to represent <quote>null changeset ID</quote> instead of a string of "
dongsheng@627 13797 "zeroes."
dongsheng@627 13798 msgstr ""
dongsheng@627 13799
dongsheng@627 13800 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 13801 #: ../en/ch10-hook.xml:1208
dongsheng@627 13802 msgid ""
dongsheng@627 13803 "If a parameter is named <literal>url</literal>, it will contain the URL of a "
dongsheng@627 13804 "remote repository, if that can be determined."
dongsheng@627 13805 msgstr ""
dongsheng@627 13806
dongsheng@627 13807 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 13808 #: ../en/ch10-hook.xml:1213
dongsheng@627 13809 msgid ""
dongsheng@627 13810 "Boolean-valued parameters are represented as Python <literal>bool</literal> "
dongsheng@627 13811 "objects."
dongsheng@627 13812 msgstr ""
dongsheng@627 13813
dongsheng@627 13814 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13815 #: ../en/ch10-hook.xml:1218
dongsheng@627 13816 msgid ""
dongsheng@627 13817 "An in-process hook is called without a change to the process's working "
dongsheng@627 13818 "directory (unlike external hooks, which are run in the root of the "
dongsheng@627 13819 "repository). It must not change the process's working directory, or it will "
dongsheng@627 13820 "cause any calls it makes into the Mercurial API to fail."
dongsheng@627 13821 msgstr ""
dongsheng@627 13822
dongsheng@627 13823 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13824 #: ../en/ch10-hook.xml:1225
dongsheng@627 13825 msgid ""
dongsheng@627 13826 "If a hook returns a boolean <quote>false</quote> value, it is considered to "
dongsheng@627 13827 "have succeeded. If it returns a boolean <quote>true</quote> value or raises "
dongsheng@627 13828 "an exception, it is considered to have failed. A useful way to think of the "
dongsheng@627 13829 "calling convention is <quote>tell me if you fail</quote>."
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:1232
dongsheng@627 13834 msgid ""
dongsheng@627 13835 "Note that changeset IDs are passed into Python hooks as hexadecimal strings, "
dongsheng@627 13836 "not the binary hashes that Mercurial's APIs normally use. To convert a hash "
dongsheng@650 13837 "from hex to binary, use the <literal>bin</literal> function."
dongsheng@650 13838 msgstr ""
dongsheng@650 13839
dongsheng@650 13840 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 13841 #: ../en/ch10-hook.xml:1240
dongsheng@627 13842 msgid "External hook execution"
dongsheng@635 13843 msgstr "外部钩子的执行"
dongsheng@627 13844
dongsheng@627 13845 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13846 #: ../en/ch10-hook.xml:1242
dongsheng@627 13847 msgid ""
dongsheng@627 13848 "An external hook is passed to the shell of the user running Mercurial. "
dongsheng@627 13849 "Features of that shell, such as variable substitution and command "
dongsheng@627 13850 "redirection, are available. The hook is run in the root directory of the "
dongsheng@627 13851 "repository (unlike in-process hooks, which are run in the same directory that "
dongsheng@627 13852 "Mercurial was run in)."
dongsheng@627 13853 msgstr ""
dongsheng@627 13854
dongsheng@627 13855 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13856 #: ../en/ch10-hook.xml:1250
dongsheng@627 13857 msgid ""
dongsheng@627 13858 "Hook parameters are passed to the hook as environment variables. Each "
dongsheng@627 13859 "environment variable's name is converted in upper case and prefixed with the "
dongsheng@627 13860 "string <quote><literal>HG_</literal></quote>. For example, if the name of a "
dongsheng@627 13861 "parameter is <quote><literal>node</literal></quote>, the name of the "
dongsheng@627 13862 "environment variable representing that parameter will be "
dongsheng@627 13863 "<quote><literal>HG_NODE</literal></quote>."
dongsheng@627 13864 msgstr ""
dongsheng@627 13865
dongsheng@627 13866 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13867 #: ../en/ch10-hook.xml:1259
dongsheng@627 13868 msgid ""
dongsheng@627 13869 "A boolean parameter is represented as the string <quote><literal>1</literal></"
dongsheng@627 13870 "quote> for <quote>true</quote>, <quote><literal>0</literal></quote> for "
dongsheng@627 13871 "<quote>false</quote>. If an environment variable is named <envar>HG_NODE</"
dongsheng@627 13872 "envar>, <envar>HG_PARENT1</envar> or <envar>HG_PARENT2</envar>, it contains a "
dongsheng@627 13873 "changeset ID represented as a hexadecimal string. The empty string is used "
dongsheng@627 13874 "to represent <quote>null changeset ID</quote> instead of a string of zeroes. "
dongsheng@627 13875 "If an environment variable is named <envar>HG_URL</envar>, it will contain "
dongsheng@627 13876 "the URL of a remote repository, if that can be determined."
dongsheng@627 13877 msgstr ""
dongsheng@627 13878
dongsheng@627 13879 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13880 #: ../en/ch10-hook.xml:1271
dongsheng@627 13881 msgid ""
dongsheng@627 13882 "If a hook exits with a status of zero, it is considered to have succeeded. "
dongsheng@627 13883 "If it exits with a non-zero status, it is considered to have failed."
dongsheng@627 13884 msgstr ""
dongsheng@627 13885
dongsheng@627 13886 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 13887 #: ../en/ch10-hook.xml:1278
dongsheng@627 13888 msgid "Finding out where changesets come from"
dongsheng@635 13889 msgstr "检查修改集来自何处"
dongsheng@627 13890
dongsheng@627 13891 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 13892 #: ../en/ch10-hook.xml:1280
dongsheng@627 13893 msgid ""
dongsheng@627 13894 "A hook that involves the transfer of changesets between a local repository "
dongsheng@627 13895 "and another may be able to find out information about the <quote>far side</"
dongsheng@627 13896 "quote>. Mercurial knows <emphasis>how</emphasis> changes are being "
dongsheng@627 13897 "transferred, and in many cases <emphasis>where</emphasis> they are being "
dongsheng@627 13898 "transferred to or from."
dongsheng@627 13899 msgstr ""
dongsheng@627 13900
dongsheng@627 13901 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 13902 #: ../en/ch10-hook.xml:1289
dongsheng@627 13903 msgid "Sources of changesets"
dongsheng@635 13904 msgstr "修改集的来源"
dongsheng@627 13905
dongsheng@627 13906 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13907 #: ../en/ch10-hook.xml:1291
dongsheng@627 13908 msgid ""
dongsheng@627 13909 "Mercurial will tell a hook what means are, or were, used to transfer "
dongsheng@627 13910 "changesets between repositories. This is provided by Mercurial in a Python "
dongsheng@627 13911 "parameter named <literal>source</literal>, or an environment variable named "
dongsheng@627 13912 "<envar>HG_SOURCE</envar>."
dongsheng@627 13913 msgstr ""
dongsheng@627 13914
dongsheng@627 13915 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13916 #: ../en/ch10-hook.xml:1299
dongsheng@627 13917 msgid ""
dongsheng@627 13918 "<literal>serve</literal>: Changesets are transferred to or from a remote "
dongsheng@627 13919 "repository over http or ssh."
dongsheng@627 13920 msgstr ""
dongsheng@627 13921
dongsheng@627 13922 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13923 #: ../en/ch10-hook.xml:1304
dongsheng@627 13924 msgid ""
dongsheng@627 13925 "<literal>pull</literal>: Changesets are being transferred via a pull from one "
dongsheng@627 13926 "repository into another."
dongsheng@627 13927 msgstr ""
dongsheng@627 13928
dongsheng@627 13929 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13930 #: ../en/ch10-hook.xml:1309
dongsheng@627 13931 msgid ""
dongsheng@627 13932 "<literal>push</literal>: Changesets are being transferred via a push from one "
dongsheng@627 13933 "repository into another."
dongsheng@627 13934 msgstr ""
dongsheng@627 13935
dongsheng@627 13936 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13937 #: ../en/ch10-hook.xml:1314
dongsheng@627 13938 msgid ""
dongsheng@627 13939 "<literal>bundle</literal>: Changesets are being transferred to or from a "
dongsheng@627 13940 "bundle."
dongsheng@627 13941 msgstr ""
dongsheng@627 13942
dongsheng@627 13943 #. type: Content of: <book><chapter><sect1><sect2><sect3><title>
dongsheng@714 13944 #: ../en/ch10-hook.xml:1321
songdongsheng@668 13945 msgid "Where changes are going&emdash;remote repository URLs"
dongsheng@661 13946 msgstr "修改集要到哪里—远程版本库的地址"
dongsheng@627 13947
dongsheng@627 13948 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13949 #: ../en/ch10-hook.xml:1324
dongsheng@627 13950 msgid ""
dongsheng@627 13951 "When possible, Mercurial will tell a hook the location of the <quote>far "
dongsheng@627 13952 "side</quote> of an activity that transfers changeset data between "
dongsheng@627 13953 "repositories. This is provided by Mercurial in a Python parameter named "
dongsheng@627 13954 "<literal>url</literal>, or an environment variable named <envar>HG_URL</"
dongsheng@627 13955 "envar>."
dongsheng@627 13956 msgstr ""
dongsheng@627 13957
dongsheng@627 13958 #. type: Content of: <book><chapter><sect1><sect2><sect3><para>
dongsheng@714 13959 #: ../en/ch10-hook.xml:1332
dongsheng@627 13960 msgid ""
dongsheng@627 13961 "This information is not always known. If a hook is invoked in a repository "
dongsheng@627 13962 "that is being served via http or ssh, Mercurial cannot tell where the remote "
dongsheng@627 13963 "repository is, but it may know where the client is connecting from. In such "
dongsheng@627 13964 "cases, the URL will take one of the following forms:"
dongsheng@627 13965 msgstr ""
dongsheng@627 13966
dongsheng@627 13967 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13968 #: ../en/ch10-hook.xml:1339
dongsheng@627 13969 msgid ""
songdongsheng@668 13970 "<literal>remote:ssh:1.2.3.4</literal>&emdash;remote ssh client, at the IP "
songdongsheng@668 13971 "address <literal>1.2.3.4</literal>."
dongsheng@627 13972 msgstr ""
dongsheng@627 13973
dongsheng@627 13974 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13975 #: ../en/ch10-hook.xml:1344
dongsheng@627 13976 msgid ""
songdongsheng@668 13977 "<literal>remote:http:1.2.3.4</literal>&emdash;remote http client, at the IP "
songdongsheng@668 13978 "address <literal>1.2.3.4</literal>. If the client is using SSL, this will be "
songdongsheng@668 13979 "of the form <literal>remote:https:1.2.3.4</literal>."
dongsheng@627 13980 msgstr ""
dongsheng@627 13981
dongsheng@627 13982 #. type: Content of: <book><chapter><sect1><sect2><sect3><itemizedlist><listitem><para>
dongsheng@714 13983 #: ../en/ch10-hook.xml:1351
songdongsheng@668 13984 msgid "Empty&emdash;no information could be discovered about the remote client."
dongsheng@627 13985 msgstr ""
dongsheng@627 13986
dongsheng@627 13987 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 13988 #: ../en/ch10-hook.xml:1359
dongsheng@627 13989 msgid "Hook reference"
dongsheng@635 13990 msgstr "钩子参考"
dongsheng@627 13991
dongsheng@627 13992 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 13993 #: ../en/ch10-hook.xml:1362
songdongsheng@668 13994 msgid ""
songdongsheng@668 13995 "<literal role=\"hook\">changegroup</literal>&emdash;after remote changesets "
songdongsheng@668 13996 "added"
dongsheng@661 13997 msgstr "<literal role=\"hook\">changegroup</literal>—增加远程修改集之后"
dongsheng@627 13998
dongsheng@627 13999 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14000 #: ../en/ch10-hook.xml:1365
dongsheng@627 14001 msgid ""
dongsheng@627 14002 "This hook is run after a group of pre-existing changesets has been added to "
dongsheng@627 14003 "the repository, for example via a <command role=\"hg-cmd\">hg pull</command> "
dongsheng@627 14004 "or <command role=\"hg-cmd\">hg unbundle</command>. This hook is run once per "
dongsheng@627 14005 "operation that added one or more changesets. This is in contrast to the "
dongsheng@627 14006 "<literal role=\"hook\">incoming</literal> hook, which is run once per "
dongsheng@627 14007 "changeset, regardless of whether the changesets arrive in a group."
dongsheng@627 14008 msgstr ""
dongsheng@627 14009
dongsheng@627 14010 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14011 #: ../en/ch10-hook.xml:1375
dongsheng@627 14012 msgid ""
dongsheng@627 14013 "Some possible uses for this hook include kicking off an automated build or "
dongsheng@627 14014 "test of the added changesets, updating a bug database, or notifying "
dongsheng@627 14015 "subscribers that a repository contains new changes."
dongsheng@627 14016 msgstr ""
dongsheng@627 14017
dongsheng@627 14018 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14019 #: ../en/ch10-hook.xml:1381 ../en/ch10-hook.xml:1421 ../en/ch10-hook.xml:1465
dongsheng@714 14020 #: ../en/ch10-hook.xml:1507 ../en/ch10-hook.xml:1562 ../en/ch10-hook.xml:1602
dongsheng@714 14021 #: ../en/ch10-hook.xml:1638 ../en/ch10-hook.xml:1672 ../en/ch10-hook.xml:1736
dongsheng@714 14022 #: ../en/ch10-hook.xml:1794 ../en/ch10-hook.xml:1830 ../en/ch10-hook.xml:1857
dongsheng@627 14023 msgid "Parameters to this hook:"
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:1384 ../en/ch10-hook.xml:1739
dongsheng@627 14028 msgid ""
dongsheng@627 14029 "<literal>node</literal>: A changeset ID. The changeset ID of the first "
dongsheng@627 14030 "changeset in the group that was added. All changesets between this and "
dongsheng@650 14031 "<literal role=\"tag\">tip</literal>, inclusive, were added by a single "
dongsheng@650 14032 "<command role=\"hg-cmd\">hg pull</command>, <command role=\"hg-cmd\">hg push</"
dongsheng@650 14033 "command> or <command role=\"hg-cmd\">hg unbundle</command>."
dongsheng@627 14034 msgstr ""
dongsheng@627 14035
dongsheng@627 14036 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14037 #: ../en/ch10-hook.xml:1393 ../en/ch10-hook.xml:1472 ../en/ch10-hook.xml:1565
dongsheng@714 14038 #: ../en/ch10-hook.xml:1749
dongsheng@627 14039 msgid ""
songdongsheng@658 14040 "<literal>source</literal>: A string. The source of these changes. See <xref "
songdongsheng@658 14041 "linkend=\"sec:hook:sources\"/> for details."
dongsheng@627 14042 msgstr ""
dongsheng@627 14043
dongsheng@627 14044 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14045 #: ../en/ch10-hook.xml:1398 ../en/ch10-hook.xml:1477 ../en/ch10-hook.xml:1528
dongsheng@714 14046 #: ../en/ch10-hook.xml:1570 ../en/ch10-hook.xml:1651 ../en/ch10-hook.xml:1754
dongsheng@627 14047 msgid ""
dongsheng@627 14048 "<literal>url</literal>: A URL. The location of the remote repository, if "
songdongsheng@658 14049 "known. See <xref linkend=\"sec:hook:url\"/> for more information."
songdongsheng@658 14050 msgstr ""
songdongsheng@658 14051
songdongsheng@658 14052 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14053 #: ../en/ch10-hook.xml:1404
songdongsheng@658 14054 msgid ""
songdongsheng@658 14055 "See also: <literal role=\"hook\">incoming</literal> (<xref linkend=\"sec:hook:"
songdongsheng@658 14056 "incoming\"/>), <literal role=\"hook\">prechangegroup</literal> (<xref linkend="
songdongsheng@658 14057 "\"sec:hook:prechangegroup\"/>), <literal role=\"hook\">pretxnchangegroup</"
songdongsheng@658 14058 "literal> (<xref linkend=\"sec:hook:pretxnchangegroup\"/>)"
dongsheng@627 14059 msgstr ""
dongsheng@627 14060
dongsheng@627 14061 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 14062 #: ../en/ch10-hook.xml:1415
songdongsheng@668 14063 msgid ""
songdongsheng@668 14064 "<literal role=\"hook\">commit</literal>&emdash;after a new changeset is "
songdongsheng@668 14065 "created"
dongsheng@661 14066 msgstr "<literal role=\"hook\">commit</literal>—创建新修改集之后"
dongsheng@627 14067
dongsheng@627 14068 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14069 #: ../en/ch10-hook.xml:1418
dongsheng@627 14070 msgid "This hook is run after a new changeset has been created."
dongsheng@627 14071 msgstr ""
dongsheng@627 14072
dongsheng@627 14073 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14074 #: ../en/ch10-hook.xml:1424 ../en/ch10-hook.xml:1797
dongsheng@627 14075 msgid ""
dongsheng@627 14076 "<literal>node</literal>: A changeset ID. The changeset ID of the newly "
dongsheng@627 14077 "committed 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:1428 ../en/ch10-hook.xml:1801
dongsheng@627 14082 msgid ""
dongsheng@627 14083 "<literal>parent1</literal>: A changeset ID. The changeset ID of the first "
dongsheng@627 14084 "parent of the newly committed changeset."
dongsheng@627 14085 msgstr ""
dongsheng@627 14086
dongsheng@627 14087 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14088 #: ../en/ch10-hook.xml:1433 ../en/ch10-hook.xml:1806
dongsheng@627 14089 msgid ""
dongsheng@627 14090 "<literal>parent2</literal>: A changeset ID. The changeset ID of the second "
dongsheng@627 14091 "parent of the newly committed changeset."
dongsheng@627 14092 msgstr ""
dongsheng@627 14093
dongsheng@627 14094 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14095 #: ../en/ch10-hook.xml:1439
songdongsheng@658 14096 msgid ""
songdongsheng@658 14097 "See also: <literal role=\"hook\">precommit</literal> (<xref linkend=\"sec:"
songdongsheng@658 14098 "hook:precommit\"/>), <literal role=\"hook\">pretxncommit</literal> (<xref "
songdongsheng@658 14099 "linkend=\"sec:hook:pretxncommit\"/>)"
dongsheng@627 14100 msgstr ""
dongsheng@627 14101
dongsheng@627 14102 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 14103 #: ../en/ch10-hook.xml:1448
songdongsheng@668 14104 msgid ""
songdongsheng@668 14105 "<literal role=\"hook\">incoming</literal>&emdash;after one remote changeset "
songdongsheng@668 14106 "is added"
dongsheng@661 14107 msgstr "<literal role=\"hook\">incoming</literal>—增加远程修改集之后"
dongsheng@627 14108
dongsheng@627 14109 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14110 #: ../en/ch10-hook.xml:1451
dongsheng@627 14111 msgid ""
dongsheng@627 14112 "This hook is run after a pre-existing changeset has been added to the "
dongsheng@627 14113 "repository, for example via a <command role=\"hg-cmd\">hg push</command>. If "
dongsheng@627 14114 "a group of changesets was added in a single operation, this hook is called "
dongsheng@627 14115 "once for each added changeset."
dongsheng@627 14116 msgstr ""
dongsheng@627 14117
dongsheng@627 14118 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14119 #: ../en/ch10-hook.xml:1458
dongsheng@627 14120 msgid ""
dongsheng@627 14121 "You can use this hook for the same purposes as the <literal role=\"hook"
songdongsheng@658 14122 "\">changegroup</literal> hook (<xref linkend=\"sec:hook:changegroup\"/>); "
songdongsheng@658 14123 "it's simply more convenient sometimes to run a hook once per group of "
dongsheng@627 14124 "changesets, while other times it's handier once per changeset."
dongsheng@627 14125 msgstr ""
dongsheng@627 14126
dongsheng@627 14127 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14128 #: ../en/ch10-hook.xml:1468
dongsheng@627 14129 msgid ""
dongsheng@627 14130 "<literal>node</literal>: A changeset ID. The ID of the newly added changeset."
dongsheng@627 14131 msgstr ""
dongsheng@627 14132
dongsheng@627 14133 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14134 #: ../en/ch10-hook.xml:1483
songdongsheng@658 14135 msgid ""
songdongsheng@658 14136 "See also: <literal role=\"hook\">changegroup</literal> (<xref linkend=\"sec:"
songdongsheng@658 14137 "hook:changegroup\"/>) <literal role=\"hook\">prechangegroup</literal> (<xref "
songdongsheng@658 14138 "linkend=\"sec:hook:prechangegroup\"/>), <literal role=\"hook"
songdongsheng@658 14139 "\">pretxnchangegroup</literal> (<xref linkend=\"sec:hook:pretxnchangegroup\"/"
songdongsheng@658 14140 ">)"
dongsheng@627 14141 msgstr ""
dongsheng@627 14142
dongsheng@627 14143 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 14144 #: ../en/ch10-hook.xml:1494
songdongsheng@668 14145 msgid ""
songdongsheng@668 14146 "<literal role=\"hook\">outgoing</literal>&emdash;after changesets are "
songdongsheng@668 14147 "propagated"
dongsheng@661 14148 msgstr "<literal role=\"hook\">outgoing</literal>—传播修改集之后"
dongsheng@627 14149
dongsheng@627 14150 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14151 #: ../en/ch10-hook.xml:1497
dongsheng@627 14152 msgid ""
dongsheng@627 14153 "This hook is run after a group of changesets has been propagated out of this "
dongsheng@627 14154 "repository, for example by a <command role=\"hg-cmd\">hg push</command> or "
dongsheng@627 14155 "<command role=\"hg-cmd\">hg bundle</command> command."
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:1503
dongsheng@627 14160 msgid ""
dongsheng@627 14161 "One possible use for this hook is to notify administrators that changes have "
dongsheng@627 14162 "been pulled."
dongsheng@627 14163 msgstr ""
dongsheng@627 14164
dongsheng@627 14165 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14166 #: ../en/ch10-hook.xml:1510
dongsheng@627 14167 msgid ""
dongsheng@627 14168 "<literal>node</literal>: A changeset ID. The changeset ID of the first "
dongsheng@627 14169 "changeset of the group that was sent."
dongsheng@627 14170 msgstr ""
dongsheng@627 14171
dongsheng@627 14172 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14173 #: ../en/ch10-hook.xml:1515
dongsheng@627 14174 msgid ""
dongsheng@627 14175 "<literal>source</literal>: A string. The source of the of the operation (see "
songdongsheng@658 14176 "<xref linkend=\"sec:hook:sources\"/>). If a remote client pulled changes "
songdongsheng@658 14177 "from this repository, <literal>source</literal> will be <literal>serve</"
songdongsheng@658 14178 "literal>. If the client that obtained changes from this repository was "
songdongsheng@658 14179 "local, <literal>source</literal> will be <literal>bundle</literal>, "
songdongsheng@658 14180 "<literal>pull</literal>, or <literal>push</literal>, depending on the "
songdongsheng@658 14181 "operation the client performed."
songdongsheng@658 14182 msgstr ""
songdongsheng@658 14183
songdongsheng@658 14184 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14185 #: ../en/ch10-hook.xml:1534
songdongsheng@658 14186 msgid ""
songdongsheng@658 14187 "See also: <literal role=\"hook\">preoutgoing</literal> (<xref linkend=\"sec:"
songdongsheng@658 14188 "hook:preoutgoing\"/>)"
dongsheng@627 14189 msgstr ""
dongsheng@627 14190
dongsheng@627 14191 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 14192 #: ../en/ch10-hook.xml:1541
songdongsheng@668 14193 msgid ""
songdongsheng@668 14194 "<literal role=\"hook\">prechangegroup</literal>&emdash;before starting to add "
songdongsheng@668 14195 "remote changesets"
dongsheng@661 14196 msgstr "<literal role=\"hook\">prechangegroup</literal>—增加远程修改集之前"
dongsheng@627 14197
dongsheng@627 14198 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14199 #: ../en/ch10-hook.xml:1545
dongsheng@627 14200 msgid ""
dongsheng@627 14201 "This controlling hook is run before Mercurial begins to add a group of "
dongsheng@627 14202 "changesets from another repository."
dongsheng@627 14203 msgstr ""
dongsheng@627 14204
dongsheng@627 14205 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14206 #: ../en/ch10-hook.xml:1549
dongsheng@627 14207 msgid ""
dongsheng@627 14208 "This hook does not have any information about the changesets to be added, "
dongsheng@627 14209 "because it is run before transmission of those changesets is allowed to "
dongsheng@627 14210 "begin. If this hook fails, the changesets will not be transmitted."
dongsheng@627 14211 msgstr ""
dongsheng@627 14212
dongsheng@627 14213 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14214 #: ../en/ch10-hook.xml:1555
dongsheng@627 14215 msgid ""
dongsheng@627 14216 "One use for this hook is to prevent external changes from being added to a "
dongsheng@627 14217 "repository. For example, you could use this to <quote>freeze</quote> a "
dongsheng@627 14218 "server-hosted branch temporarily or permanently so that users cannot push to "
dongsheng@627 14219 "it, while still allowing a local administrator to modify the repository."
dongsheng@627 14220 msgstr ""
dongsheng@627 14221
dongsheng@627 14222 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14223 #: ../en/ch10-hook.xml:1576
songdongsheng@658 14224 msgid ""
songdongsheng@658 14225 "See also: <literal role=\"hook\">changegroup</literal> (<xref linkend=\"sec:"
songdongsheng@658 14226 "hook:changegroup\"/>), <literal role=\"hook\">incoming</literal> (<xref "
songdongsheng@658 14227 "linkend=\"sec:hook:incoming\"/>), <literal role=\"hook\">pretxnchangegroup</"
songdongsheng@658 14228 "literal> (<xref linkend=\"sec:hook:pretxnchangegroup\"/>)"
dongsheng@627 14229 msgstr ""
dongsheng@627 14230
dongsheng@627 14231 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 14232 #: ../en/ch10-hook.xml:1587
songdongsheng@668 14233 msgid ""
songdongsheng@668 14234 "<literal role=\"hook\">precommit</literal>&emdash;before starting to commit a "
dongsheng@627 14235 "changeset"
dongsheng@661 14236 msgstr "<literal role=\"hook\">precommit</literal>—提交修改集之前"
dongsheng@627 14237
dongsheng@627 14238 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14239 #: ../en/ch10-hook.xml:1590
dongsheng@627 14240 msgid ""
dongsheng@627 14241 "This hook is run before Mercurial begins to commit a new changeset. It is run "
dongsheng@627 14242 "before Mercurial has any of the metadata for the commit, such as the files to "
dongsheng@627 14243 "be committed, the commit message, or the commit date."
dongsheng@627 14244 msgstr ""
dongsheng@627 14245
dongsheng@627 14246 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14247 #: ../en/ch10-hook.xml:1596
dongsheng@627 14248 msgid ""
dongsheng@627 14249 "One use for this hook is to disable the ability to commit new changesets, "
dongsheng@627 14250 "while still allowing incoming changesets. Another is to run a build or test, "
dongsheng@627 14251 "and only allow the commit to begin if the build or test succeeds."
dongsheng@627 14252 msgstr ""
dongsheng@627 14253
dongsheng@627 14254 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14255 #: ../en/ch10-hook.xml:1605
dongsheng@627 14256 msgid ""
dongsheng@627 14257 "<literal>parent1</literal>: A changeset ID. The changeset ID of the first "
dongsheng@627 14258 "parent of the working directory."
dongsheng@627 14259 msgstr ""
dongsheng@627 14260
dongsheng@627 14261 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14262 #: ../en/ch10-hook.xml:1610
dongsheng@627 14263 msgid ""
dongsheng@627 14264 "<literal>parent2</literal>: A changeset ID. The changeset ID of the second "
dongsheng@627 14265 "parent of the working directory."
dongsheng@627 14266 msgstr ""
dongsheng@627 14267
dongsheng@627 14268 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14269 #: ../en/ch10-hook.xml:1615
dongsheng@627 14270 msgid ""
dongsheng@627 14271 "If the commit proceeds, the parents of the working directory will become the "
dongsheng@627 14272 "parents of the new changeset."
dongsheng@627 14273 msgstr ""
dongsheng@627 14274
dongsheng@627 14275 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14276 #: ../en/ch10-hook.xml:1619
dongsheng@627 14277 msgid ""
songdongsheng@658 14278 "See also: <literal role=\"hook\">commit</literal> (<xref linkend=\"sec:hook:"
songdongsheng@658 14279 "commit\"/>), <literal role=\"hook\">pretxncommit</literal> (<xref linkend="
songdongsheng@658 14280 "\"sec:hook:pretxncommit\"/>)"
dongsheng@627 14281 msgstr ""
dongsheng@627 14282
dongsheng@627 14283 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 14284 #: ../en/ch10-hook.xml:1627
songdongsheng@668 14285 msgid ""
songdongsheng@668 14286 "<literal role=\"hook\">preoutgoing</literal>&emdash;before starting to "
songdongsheng@668 14287 "propagate changesets"
dongsheng@661 14288 msgstr "<literal role=\"hook\">preoutgoing</literal>—传播修改集之前"
dongsheng@627 14289
dongsheng@627 14290 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14291 #: ../en/ch10-hook.xml:1630
dongsheng@627 14292 msgid ""
dongsheng@627 14293 "This hook is invoked before Mercurial knows the identities of the changesets "
dongsheng@627 14294 "to be transmitted."
dongsheng@627 14295 msgstr ""
dongsheng@627 14296
dongsheng@627 14297 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14298 #: ../en/ch10-hook.xml:1634
dongsheng@627 14299 msgid ""
dongsheng@627 14300 "One use for this hook is to prevent changes from being transmitted to another "
dongsheng@627 14301 "repository."
dongsheng@627 14302 msgstr ""
dongsheng@627 14303
dongsheng@627 14304 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14305 #: ../en/ch10-hook.xml:1641
dongsheng@627 14306 msgid ""
dongsheng@627 14307 "<literal>source</literal>: A string. The source of the operation that is "
songdongsheng@658 14308 "attempting to obtain changes from this repository (see <xref linkend=\"sec:"
songdongsheng@658 14309 "hook:sources\"/>). See the documentation for the <literal>source</literal> "
songdongsheng@658 14310 "parameter to the <literal role=\"hook\">outgoing</literal> hook, in <xref "
songdongsheng@658 14311 "linkend=\"sec:hook:outgoing\"/>, for possible values of this parameter."
songdongsheng@658 14312 msgstr ""
songdongsheng@658 14313
songdongsheng@658 14314 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14315 #: ../en/ch10-hook.xml:1657
songdongsheng@658 14316 msgid ""
songdongsheng@658 14317 "See also: <literal role=\"hook\">outgoing</literal> (<xref linkend=\"sec:hook:"
songdongsheng@658 14318 "outgoing\"/>)"
dongsheng@627 14319 msgstr ""
dongsheng@627 14320
dongsheng@627 14321 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 14322 #: ../en/ch10-hook.xml:1664
songdongsheng@668 14323 msgid ""
songdongsheng@668 14324 "<literal role=\"hook\">pretag</literal>&emdash;before tagging a changeset"
dongsheng@661 14325 msgstr "<literal role=\"hook\">pretag</literal>—创建标签之前"
dongsheng@627 14326
dongsheng@627 14327 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14328 #: ../en/ch10-hook.xml:1667
dongsheng@627 14329 msgid ""
dongsheng@627 14330 "This controlling hook is run before a tag is created. If the hook succeeds, "
dongsheng@627 14331 "creation of the tag proceeds. If the hook fails, the tag is not created."
dongsheng@627 14332 msgstr ""
dongsheng@627 14333
dongsheng@627 14334 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14335 #: ../en/ch10-hook.xml:1675
dongsheng@627 14336 msgid ""
dongsheng@627 14337 "<literal>local</literal>: A boolean. Whether the tag is local to this "
dongsheng@627 14338 "repository instance (i.e. stored in <filename role=\"special\">.hg/localtags</"
dongsheng@627 14339 "filename>) or managed by Mercurial (stored in <filename role=\"special\">."
dongsheng@627 14340 "hgtags</filename>)."
dongsheng@627 14341 msgstr ""
dongsheng@627 14342
dongsheng@627 14343 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14344 #: ../en/ch10-hook.xml:1682
dongsheng@627 14345 msgid ""
dongsheng@627 14346 "<literal>node</literal>: A changeset ID. The ID of the changeset to be "
dongsheng@627 14347 "tagged."
dongsheng@627 14348 msgstr ""
dongsheng@627 14349
dongsheng@627 14350 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14351 #: ../en/ch10-hook.xml:1686
dongsheng@627 14352 msgid "<literal>tag</literal>: A string. The name of the tag to be created."
dongsheng@627 14353 msgstr ""
dongsheng@627 14354
dongsheng@627 14355 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14356 #: ../en/ch10-hook.xml:1691
dongsheng@627 14357 msgid ""
dongsheng@627 14358 "If the tag to be created is revision-controlled, the <literal role=\"hook"
dongsheng@627 14359 "\">precommit</literal> and <literal role=\"hook\">pretxncommit</literal> "
songdongsheng@658 14360 "hooks (<xref linkend=\"sec:hook:commit\"/> and <xref linkend=\"sec:hook:"
songdongsheng@658 14361 "pretxncommit\"/>) will also be run."
dongsheng@627 14362 msgstr ""
dongsheng@627 14363
dongsheng@627 14364 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14365 #: ../en/ch10-hook.xml:1699
dongsheng@627 14366 msgid ""
songdongsheng@658 14367 "See also: <literal role=\"hook\">tag</literal> (<xref linkend=\"sec:hook:tag"
songdongsheng@658 14368 "\"/>)"
dongsheng@627 14369 msgstr ""
dongsheng@627 14370
dongsheng@627 14371 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 14372 #: ../en/ch10-hook.xml:1705
songdongsheng@668 14373 msgid ""
songdongsheng@668 14374 "<literal role=\"hook\">pretxnchangegroup</literal>&emdash;before completing "
songdongsheng@668 14375 "addition of remote changesets"
dongsheng@661 14376 msgstr ""
dongsheng@661 14377 "<literal role=\"hook\">pretxnchangegroup</literal>—完成增加远程修改集之前"
dongsheng@627 14378
dongsheng@627 14379 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14380 #: ../en/ch10-hook.xml:1709
dongsheng@627 14381 msgid ""
songdongsheng@668 14382 "This controlling hook is run before a transaction&emdash;that manages the "
songdongsheng@668 14383 "addition of a group of new changesets from outside the repository&emdash;"
songdongsheng@668 14384 "completes. If the hook succeeds, the transaction completes, and all of the "
songdongsheng@668 14385 "changesets become permanent within this repository. If the hook fails, the "
songdongsheng@668 14386 "transaction is rolled back, and the data for the changesets is erased."
dongsheng@627 14387 msgstr ""
dongsheng@627 14388
dongsheng@627 14389 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14390 #: ../en/ch10-hook.xml:1718
dongsheng@627 14391 msgid ""
dongsheng@627 14392 "This hook can access the metadata associated with the almost-added "
dongsheng@627 14393 "changesets, but it should not do anything permanent with this data. It must "
dongsheng@627 14394 "also not modify the working directory."
dongsheng@627 14395 msgstr ""
dongsheng@627 14396
dongsheng@627 14397 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14398 #: ../en/ch10-hook.xml:1724
dongsheng@627 14399 msgid ""
dongsheng@627 14400 "While this hook is running, if other Mercurial processes access this "
dongsheng@627 14401 "repository, they will be able to see the almost-added changesets as if they "
dongsheng@627 14402 "are permanent. This may lead to race conditions if you do not take steps to "
dongsheng@627 14403 "avoid them."
dongsheng@627 14404 msgstr ""
dongsheng@627 14405
dongsheng@627 14406 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14407 #: ../en/ch10-hook.xml:1731
dongsheng@627 14408 msgid ""
dongsheng@627 14409 "This hook can be used to automatically vet a group of changesets. If the "
dongsheng@627 14410 "hook fails, all of the changesets are <quote>rejected</quote> when the "
dongsheng@627 14411 "transaction rolls back."
dongsheng@627 14412 msgstr ""
dongsheng@627 14413
dongsheng@627 14414 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14415 #: ../en/ch10-hook.xml:1760
songdongsheng@658 14416 msgid ""
songdongsheng@658 14417 "See also: <literal role=\"hook\">changegroup</literal> (<xref linkend=\"sec:"
songdongsheng@658 14418 "hook:changegroup\"/>), <literal role=\"hook\">incoming</literal> (<xref "
songdongsheng@658 14419 "linkend=\"sec:hook:incoming\"/>), <literal role=\"hook\">prechangegroup</"
songdongsheng@658 14420 "literal> (<xref linkend=\"sec:hook:prechangegroup\"/>)"
dongsheng@627 14421 msgstr ""
dongsheng@627 14422
dongsheng@627 14423 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 14424 #: ../en/ch10-hook.xml:1771
songdongsheng@668 14425 msgid ""
songdongsheng@668 14426 "<literal role=\"hook\">pretxncommit</literal>&emdash;before completing commit "
songdongsheng@668 14427 "of new changeset"
dongsheng@661 14428 msgstr "<literal role=\"hook\">pretxncommit</literal>—完成提交之前"
dongsheng@627 14429
dongsheng@627 14430 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14431 #: ../en/ch10-hook.xml:1774
dongsheng@627 14432 msgid ""
songdongsheng@668 14433 "This controlling hook is run before a transaction&emdash;that manages a new "
songdongsheng@668 14434 "commit&emdash;completes. If the hook succeeds, the transaction completes and "
songdongsheng@668 14435 "the changeset becomes permanent within this repository. If the hook fails, "
songdongsheng@668 14436 "the transaction is rolled back, and the commit data is erased."
dongsheng@627 14437 msgstr ""
dongsheng@627 14438
dongsheng@627 14439 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14440 #: ../en/ch10-hook.xml:1782
dongsheng@627 14441 msgid ""
dongsheng@627 14442 "This hook can access the metadata associated with the almost-new changeset, "
dongsheng@627 14443 "but it should not do anything permanent with this data. It must also not "
dongsheng@627 14444 "modify the working directory."
dongsheng@627 14445 msgstr ""
dongsheng@627 14446
dongsheng@627 14447 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14448 #: ../en/ch10-hook.xml:1788
dongsheng@627 14449 msgid ""
dongsheng@627 14450 "While this hook is running, if other Mercurial processes access this "
dongsheng@627 14451 "repository, they will be able to see the almost-new changeset as if it is "
dongsheng@627 14452 "permanent. This may lead to race conditions if you do not take steps to "
dongsheng@627 14453 "avoid them."
dongsheng@627 14454 msgstr ""
dongsheng@627 14455
dongsheng@627 14456 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14457 #: ../en/ch10-hook.xml:1812
songdongsheng@658 14458 msgid ""
songdongsheng@658 14459 "See also: <literal role=\"hook\">precommit</literal> (<xref linkend=\"sec:"
songdongsheng@658 14460 "hook:precommit\"/>)"
dongsheng@660 14461 msgstr ""
dongsheng@660 14462 "参见: <literal role=\"hook\">precommit</literal> (<xref linkend=\"sec:hook:"
dongsheng@660 14463 "precommit\"/>)"
dongsheng@627 14464
dongsheng@627 14465 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 14466 #: ../en/ch10-hook.xml:1819
songdongsheng@668 14467 msgid ""
songdongsheng@668 14468 "<literal role=\"hook\">preupdate</literal>&emdash;before updating or merging "
songdongsheng@668 14469 "working directory"
dongsheng@661 14470 msgstr "<literal role=\"hook\">preupdate</literal>—更新或合并工作目录之前"
dongsheng@627 14471
dongsheng@627 14472 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14473 #: ../en/ch10-hook.xml:1822
dongsheng@627 14474 msgid ""
dongsheng@627 14475 "This controlling hook is run before an update or merge of the working "
dongsheng@627 14476 "directory begins. It is run only if Mercurial's normal pre-update checks "
dongsheng@627 14477 "determine that the update or merge can proceed. If the hook succeeds, the "
dongsheng@627 14478 "update or merge may proceed; if it fails, the update or merge does not start."
dongsheng@627 14479 msgstr ""
dongsheng@627 14480
dongsheng@627 14481 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14482 #: ../en/ch10-hook.xml:1833
songdongsheng@658 14483 msgid ""
songdongsheng@658 14484 "<literal>parent1</literal>: A changeset ID. The ID of the parent that the "
dongsheng@627 14485 "working directory is to be updated to. If the working directory is being "
dongsheng@627 14486 "merged, it will not change this parent."
dongsheng@627 14487 msgstr ""
dongsheng@627 14488
dongsheng@627 14489 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14490 #: ../en/ch10-hook.xml:1839
songdongsheng@658 14491 msgid ""
songdongsheng@658 14492 "<literal>parent2</literal>: A changeset ID. Only set if the working directory "
songdongsheng@658 14493 "is being merged. The ID of the revision that the working directory is being "
songdongsheng@658 14494 "merged with."
songdongsheng@658 14495 msgstr ""
songdongsheng@658 14496
songdongsheng@658 14497 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14498 #: ../en/ch10-hook.xml:1846
songdongsheng@658 14499 msgid ""
songdongsheng@658 14500 "See also: <literal role=\"hook\">update</literal> (<xref linkend=\"sec:hook:"
songdongsheng@658 14501 "update\"/>)"
dongsheng@627 14502 msgstr ""
dongsheng@627 14503
dongsheng@627 14504 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 14505 #: ../en/ch10-hook.xml:1851
songdongsheng@668 14506 msgid "<literal role=\"hook\">tag</literal>&emdash;after tagging a changeset"
dongsheng@661 14507 msgstr "<literal role=\"hook\">tag</literal>—创建标签之后"
dongsheng@627 14508
dongsheng@627 14509 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14510 #: ../en/ch10-hook.xml:1854
dongsheng@627 14511 msgid "This hook is run after a tag has been created."
dongsheng@627 14512 msgstr ""
dongsheng@627 14513
dongsheng@627 14514 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14515 #: ../en/ch10-hook.xml:1860
dongsheng@627 14516 msgid ""
dongsheng@627 14517 "<literal>local</literal>: A boolean. Whether the new tag is local to this "
dongsheng@627 14518 "repository instance (i.e. stored in <filename role=\"special\">.hg/"
dongsheng@627 14519 "localtags</filename>) or managed by Mercurial (stored in <filename role="
dongsheng@627 14520 "\"special\">.hgtags</filename>)."
dongsheng@627 14521 msgstr ""
dongsheng@627 14522
dongsheng@627 14523 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14524 #: ../en/ch10-hook.xml:1868
dongsheng@627 14525 msgid ""
dongsheng@627 14526 "<literal>node</literal>: A changeset ID. The ID of the changeset that was "
dongsheng@627 14527 "tagged."
dongsheng@627 14528 msgstr ""
dongsheng@627 14529
dongsheng@627 14530 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14531 #: ../en/ch10-hook.xml:1872
dongsheng@627 14532 msgid "<literal>tag</literal>: A string. The name of the tag that was created."
dongsheng@627 14533 msgstr ""
dongsheng@627 14534
dongsheng@627 14535 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14536 #: ../en/ch10-hook.xml:1877
dongsheng@627 14537 msgid ""
dongsheng@627 14538 "If the created tag is revision-controlled, the <literal role=\"hook\">commit</"
songdongsheng@658 14539 "literal> hook (section <xref linkend=\"sec:hook:commit\"/>) is run before "
dongsheng@627 14540 "this hook."
dongsheng@627 14541 msgstr ""
dongsheng@627 14542
dongsheng@627 14543 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14544 #: ../en/ch10-hook.xml:1882
songdongsheng@658 14545 msgid ""
songdongsheng@658 14546 "See also: <literal role=\"hook\">pretag</literal> (<xref linkend=\"sec:hook:"
songdongsheng@658 14547 "pretag\"/>)"
dongsheng@660 14548 msgstr ""
dongsheng@660 14549 "参见: <literal role=\"hook\">pretag</literal> (<xref linkend=\"sec:hook:pretag"
dongsheng@660 14550 "\"/>)"
dongsheng@627 14551
dongsheng@627 14552 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 14553 #: ../en/ch10-hook.xml:1888
songdongsheng@668 14554 msgid ""
songdongsheng@668 14555 "<literal role=\"hook\">update</literal>&emdash;after updating or merging "
songdongsheng@668 14556 "working directory"
dongsheng@661 14557 msgstr "<literal role=\"hook\">update</literal>—更新或合并工作目录之后"
dongsheng@627 14558
dongsheng@627 14559 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14560 #: ../en/ch10-hook.xml:1891
dongsheng@627 14561 msgid ""
dongsheng@627 14562 "This hook is run after an update or merge of the working directory "
dongsheng@627 14563 "completes. Since a merge can fail (if the external <command>hgmerge</"
dongsheng@627 14564 "command> command fails to resolve conflicts in a file), this hook "
dongsheng@627 14565 "communicates whether the update or merge completed cleanly."
dongsheng@627 14566 msgstr ""
dongsheng@627 14567
dongsheng@627 14568 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14569 #: ../en/ch10-hook.xml:1899
dongsheng@627 14570 msgid ""
dongsheng@627 14571 "<literal>error</literal>: A boolean. Indicates whether the update or merge "
dongsheng@627 14572 "completed successfully."
dongsheng@627 14573 msgstr ""
dongsheng@627 14574
dongsheng@627 14575 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14576 #: ../en/ch10-hook.xml:1904
dongsheng@627 14577 msgid ""
dongsheng@627 14578 "<literal>parent1</literal>: A changeset ID. The ID of the parent that the "
dongsheng@627 14579 "working directory was updated to. If the working directory was merged, it "
dongsheng@627 14580 "will not have changed this parent."
dongsheng@627 14581 msgstr ""
dongsheng@627 14582
dongsheng@627 14583 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 14584 #: ../en/ch10-hook.xml:1910
dongsheng@627 14585 msgid ""
dongsheng@627 14586 "<literal>parent2</literal>: A changeset ID. Only set if the working "
dongsheng@627 14587 "directory was merged. The ID of the revision that the working directory was "
dongsheng@627 14588 "merged with."
dongsheng@627 14589 msgstr ""
dongsheng@627 14590
dongsheng@627 14591 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14592 #: ../en/ch10-hook.xml:1916
songdongsheng@658 14593 msgid ""
songdongsheng@658 14594 "See also: <literal role=\"hook\">preupdate</literal> (<xref linkend=\"sec:"
songdongsheng@658 14595 "hook:preupdate\"/>)"
dongsheng@627 14596 msgstr ""
dongsheng@627 14597
dongsheng@627 14598 #. type: Content of: <book><chapter><title>
dongsheng@714 14599 #: ../en/ch11-template.xml:5
dongsheng@714 14600 msgid "Customizing the output of Mercurial"
dongsheng@627 14601 msgstr "定制 Mercurial 的输出"
dongsheng@627 14602
dongsheng@627 14603 #. type: Content of: <book><chapter><para>
dongsheng@714 14604 #: ../en/ch11-template.xml:7
dongsheng@627 14605 msgid ""
dongsheng@627 14606 "Mercurial provides a powerful mechanism to let you control how it displays "
dongsheng@627 14607 "information. The mechanism is based on templates. You can use templates to "
dongsheng@714 14608 "generate specific output for a single command, or to customize the entire "
dongsheng@627 14609 "appearance of the built-in web interface."
dongsheng@627 14610 msgstr ""
dongsheng@627 14611
dongsheng@627 14612 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 14613 #: ../en/ch11-template.xml:14
dongsheng@627 14614 msgid "Using precanned output styles"
dongsheng@636 14615 msgstr "使用预定义的输出样式"
dongsheng@627 14616
dongsheng@627 14617 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14618 #: ../en/ch11-template.xml:16
dongsheng@627 14619 msgid ""
dongsheng@627 14620 "Packaged with Mercurial are some output styles that you can use immediately. "
dongsheng@627 14621 "A style is simply a precanned template that someone wrote and installed "
dongsheng@627 14622 "somewhere that Mercurial can find."
dongsheng@627 14623 msgstr ""
dongsheng@627 14624
dongsheng@627 14625 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14626 #: ../en/ch11-template.xml:21
dongsheng@627 14627 msgid ""
dongsheng@627 14628 "Before we take a look at Mercurial's bundled styles, let's review its normal "
dongsheng@627 14629 "output."
dongsheng@627 14630 msgstr ""
dongsheng@627 14631
dongsheng@627 14632 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14633 #: ../en/ch11-template.xml:26
dongsheng@627 14634 msgid ""
songdongsheng@668 14635 "This is somewhat informative, but it takes up a lot of space&emdash;five "
songdongsheng@668 14636 "lines of output per changeset. The <literal>compact</literal> style reduces "
songdongsheng@668 14637 "this to three lines, presented in a sparse manner."
dongsheng@627 14638 msgstr ""
dongsheng@627 14639
dongsheng@627 14640 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14641 #: ../en/ch11-template.xml:33
dongsheng@627 14642 msgid ""
dongsheng@627 14643 "The <literal>changelog</literal> style hints at the expressive power of "
dongsheng@627 14644 "Mercurial's templating engine. This style attempts to follow the GNU "
dongsheng@627 14645 "Project's changelog guidelines<citation>web:changelog</citation>."
dongsheng@627 14646 msgstr ""
dongsheng@627 14647
dongsheng@627 14648 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14649 #: ../en/ch11-template.xml:40
dongsheng@627 14650 msgid ""
dongsheng@627 14651 "You will not be shocked to learn that Mercurial's default output style is "
dongsheng@627 14652 "named <literal>default</literal>."
dongsheng@627 14653 msgstr ""
dongsheng@627 14654
dongsheng@627 14655 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 14656 #: ../en/ch11-template.xml:44
dongsheng@627 14657 msgid "Setting a default style"
dongsheng@636 14658 msgstr "设置默认样式"
dongsheng@627 14659
dongsheng@627 14660 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14661 #: ../en/ch11-template.xml:46
dongsheng@627 14662 msgid ""
dongsheng@627 14663 "You can modify the output style that Mercurial will use for every command by "
dongsheng@650 14664 "editing your <filename role=\"special\">~/.hgrc</filename> file, naming the "
dongsheng@627 14665 "style you would prefer to use."
dongsheng@627 14666 msgstr ""
dongsheng@627 14667
dongsheng@627 14668 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 14669 #: ../en/ch11-template.xml:54
dongsheng@627 14670 msgid ""
dongsheng@627 14671 "If you write a style of your own, you can use it by either providing the path "
dongsheng@627 14672 "to your style file, or copying your style file into a location where "
dongsheng@627 14673 "Mercurial can find it (typically the <literal>templates</literal> "
dongsheng@627 14674 "subdirectory of your Mercurial install directory)."
dongsheng@627 14675 msgstr ""
dongsheng@627 14676
dongsheng@627 14677 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 14678 #: ../en/ch11-template.xml:63
dongsheng@627 14679 msgid "Commands that support styles and templates"
dongsheng@636 14680 msgstr "支持样式和模版的命令"
dongsheng@627 14681
dongsheng@627 14682 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14683 #: ../en/ch11-template.xml:65
dongsheng@627 14684 msgid ""
dongsheng@627 14685 "All of Mercurial's <quote><literal>log</literal>-like</quote> commands let "
dongsheng@627 14686 "you use styles and templates: <command role=\"hg-cmd\">hg incoming</command>, "
dongsheng@627 14687 "<command role=\"hg-cmd\">hg log</command>, <command role=\"hg-cmd\">hg "
dongsheng@627 14688 "outgoing</command>, and <command role=\"hg-cmd\">hg tip</command>."
dongsheng@627 14689 msgstr ""
dongsheng@627 14690
dongsheng@627 14691 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14692 #: ../en/ch11-template.xml:72
dongsheng@627 14693 msgid ""
dongsheng@627 14694 "As I write this manual, these are so far the only commands that support "
dongsheng@627 14695 "styles and templates. Since these are the most important commands that need "
dongsheng@714 14696 "customizable output, there has been little pressure from the Mercurial user "
dongsheng@627 14697 "community to add style and template support to other commands."
dongsheng@627 14698 msgstr ""
dongsheng@627 14699
dongsheng@627 14700 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 14701 #: ../en/ch11-template.xml:80
dongsheng@627 14702 msgid "The basics of templating"
dongsheng@636 14703 msgstr "模版基础"
dongsheng@627 14704
dongsheng@627 14705 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14706 #: ../en/ch11-template.xml:82
dongsheng@627 14707 msgid ""
dongsheng@627 14708 "At its simplest, a Mercurial template is a piece of text. Some of the text "
dongsheng@627 14709 "never changes, while other parts are <emphasis>expanded</emphasis>, or "
dongsheng@627 14710 "replaced with new text, when necessary."
dongsheng@627 14711 msgstr ""
dongsheng@627 14712
dongsheng@627 14713 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14714 #: ../en/ch11-template.xml:87
dongsheng@627 14715 msgid ""
dongsheng@627 14716 "Before we continue, let's look again at a simple example of Mercurial's "
dongsheng@627 14717 "normal output."
dongsheng@627 14718 msgstr ""
dongsheng@627 14719
dongsheng@627 14720 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14721 #: ../en/ch11-template.xml:92
dongsheng@627 14722 msgid ""
dongsheng@627 14723 "Now, let's run the same command, but using a template to change its output."
dongsheng@627 14724 msgstr ""
dongsheng@627 14725
dongsheng@627 14726 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14727 #: ../en/ch11-template.xml:97
dongsheng@627 14728 msgid ""
dongsheng@627 14729 "The example above illustrates the simplest possible template; it's just a "
dongsheng@627 14730 "piece of static text, printed once for each changeset. The <option role=\"hg-"
dongsheng@627 14731 "opt-log\">--template</option> option to the <command role=\"hg-cmd\">hg log</"
dongsheng@627 14732 "command> command tells Mercurial to use the given text as the template when "
dongsheng@627 14733 "printing each changeset."
dongsheng@627 14734 msgstr ""
dongsheng@627 14735
dongsheng@627 14736 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14737 #: ../en/ch11-template.xml:105
dongsheng@627 14738 msgid ""
dongsheng@627 14739 "Notice that the template string above ends with the text <quote><literal>\\n</"
dongsheng@627 14740 "literal></quote>. This is an <emphasis>escape sequence</emphasis>, telling "
dongsheng@627 14741 "Mercurial to print a newline at the end of each template item. If you omit "
songdongsheng@658 14742 "this newline, Mercurial will run each piece of output together. See <xref "
songdongsheng@658 14743 "linkend=\"sec:template:escape\"/> for more details of escape sequences."
dongsheng@627 14744 msgstr ""
dongsheng@627 14745
dongsheng@627 14746 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14747 #: ../en/ch11-template.xml:113
dongsheng@627 14748 msgid ""
dongsheng@627 14749 "A template that prints a fixed string of text all the time isn't very useful; "
dongsheng@627 14750 "let's try something a bit more complex."
dongsheng@627 14751 msgstr ""
dongsheng@627 14752
dongsheng@627 14753 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14754 #: ../en/ch11-template.xml:119
dongsheng@627 14755 msgid ""
dongsheng@627 14756 "As you can see, the string <quote><literal>{desc}</literal></quote> in the "
dongsheng@627 14757 "template has been replaced in the output with the description of each "
dongsheng@627 14758 "changeset. Every time Mercurial finds text enclosed in curly braces "
dongsheng@627 14759 "(<quote><literal>{</literal></quote> and <quote><literal>}</literal></"
dongsheng@627 14760 "quote>), it will try to replace the braces and text with the expansion of "
dongsheng@627 14761 "whatever is inside. To print a literal curly brace, you must escape it, as "
songdongsheng@658 14762 "described in <xref linkend=\"sec:template:escape\"/>."
dongsheng@627 14763 msgstr ""
dongsheng@627 14764
dongsheng@627 14765 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 14766 #: ../en/ch11-template.xml:131
dongsheng@627 14767 msgid "Common template keywords"
dongsheng@636 14768 msgstr "模版关键字"
dongsheng@627 14769
dongsheng@627 14770 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14771 #: ../en/ch11-template.xml:133
dongsheng@627 14772 msgid ""
dongsheng@627 14773 "You can start writing simple templates immediately using the keywords below."
dongsheng@627 14774 msgstr ""
dongsheng@627 14775
dongsheng@627 14776 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14777 #: ../en/ch11-template.xml:137
dongsheng@627 14778 msgid ""
dongsheng@627 14779 "<literal role=\"template-keyword\">author</literal>: String. The unmodified "
dongsheng@627 14780 "author of the changeset."
dongsheng@627 14781 msgstr ""
dongsheng@627 14782
dongsheng@627 14783 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14784 #: ../en/ch11-template.xml:141
dongsheng@627 14785 msgid ""
dongsheng@627 14786 "<literal role=\"template-keyword\">branches</literal>: String. The name of "
dongsheng@627 14787 "the branch on which the changeset was committed. Will be empty if the branch "
dongsheng@627 14788 "name was <literal>default</literal>."
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:147
dongsheng@627 14793 msgid ""
dongsheng@627 14794 "<literal role=\"template-keyword\">date</literal>: Date information. The "
dongsheng@627 14795 "date when the changeset was committed. This is <emphasis>not</emphasis> "
dongsheng@627 14796 "human-readable; you must pass it through a filter that will render it "
songdongsheng@658 14797 "appropriately. See <xref linkend=\"sec:template:filter\"/> for more "
dongsheng@627 14798 "information on filters. The date is expressed as a pair of numbers. The "
dongsheng@627 14799 "first number is a Unix UTC timestamp (seconds since January 1, 1970); the "
dongsheng@627 14800 "second is the offset of the committer's timezone from UTC, in seconds."
dongsheng@627 14801 msgstr ""
dongsheng@627 14802
dongsheng@627 14803 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14804 #: ../en/ch11-template.xml:158
dongsheng@627 14805 msgid ""
dongsheng@627 14806 "<literal role=\"template-keyword\">desc</literal>: String. The text of the "
dongsheng@627 14807 "changeset description."
dongsheng@627 14808 msgstr ""
dongsheng@627 14809
dongsheng@627 14810 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14811 #: ../en/ch11-template.xml:161
dongsheng@627 14812 msgid ""
dongsheng@627 14813 "<literal role=\"template-keyword\">files</literal>: List of strings. All "
dongsheng@627 14814 "files modified, added, or removed by this changeset."
dongsheng@627 14815 msgstr ""
dongsheng@627 14816
dongsheng@627 14817 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14818 #: ../en/ch11-template.xml:166
dongsheng@627 14819 msgid ""
dongsheng@627 14820 "<literal role=\"template-keyword\">file_adds</literal>: List of strings. "
dongsheng@627 14821 "Files added by this changeset."
dongsheng@627 14822 msgstr ""
dongsheng@627 14823
dongsheng@627 14824 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14825 #: ../en/ch11-template.xml:170
dongsheng@627 14826 msgid ""
dongsheng@627 14827 "<literal role=\"template-keyword\">file_dels</literal>: List of strings. "
dongsheng@627 14828 "Files removed by this changeset."
dongsheng@627 14829 msgstr ""
dongsheng@627 14830
dongsheng@627 14831 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14832 #: ../en/ch11-template.xml:174
dongsheng@627 14833 msgid ""
dongsheng@627 14834 "<literal role=\"template-keyword\">node</literal>: String. The changeset "
dongsheng@627 14835 "identification hash, as a 40-character hexadecimal string."
dongsheng@627 14836 msgstr ""
dongsheng@627 14837
dongsheng@627 14838 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14839 #: ../en/ch11-template.xml:178
dongsheng@627 14840 msgid ""
dongsheng@627 14841 "<literal role=\"template-keyword\">parents</literal>: List of strings. The "
dongsheng@627 14842 "parents of the changeset."
dongsheng@627 14843 msgstr ""
dongsheng@627 14844
dongsheng@627 14845 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14846 #: ../en/ch11-template.xml:182
dongsheng@627 14847 msgid ""
dongsheng@627 14848 "<literal role=\"template-keyword\">rev</literal>: Integer. The repository-"
dongsheng@627 14849 "local changeset revision number."
dongsheng@627 14850 msgstr ""
dongsheng@627 14851
dongsheng@627 14852 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14853 #: ../en/ch11-template.xml:186
dongsheng@627 14854 msgid ""
dongsheng@627 14855 "<literal role=\"template-keyword\">tags</literal>: List of strings. Any tags "
dongsheng@627 14856 "associated with the changeset."
dongsheng@627 14857 msgstr ""
dongsheng@627 14858
dongsheng@627 14859 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14860 #: ../en/ch11-template.xml:192
dongsheng@627 14861 msgid ""
dongsheng@627 14862 "A few simple experiments will show us what to expect when we use these "
dongsheng@627 14863 "keywords; you can see the results below."
dongsheng@627 14864 msgstr ""
dongsheng@627 14865
dongsheng@627 14866 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14867 #: ../en/ch11-template.xml:197
dongsheng@627 14868 msgid ""
dongsheng@627 14869 "As we noted above, the date keyword does not produce human-readable output, "
dongsheng@627 14870 "so we must treat it specially. This involves using a <emphasis>filter</"
songdongsheng@658 14871 "emphasis>, about which more in <xref linkend=\"sec:template:filter\"/>."
dongsheng@627 14872 msgstr ""
dongsheng@627 14873
dongsheng@627 14874 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 14875 #: ../en/ch11-template.xml:206
dongsheng@627 14876 msgid "Escape sequences"
dongsheng@636 14877 msgstr "转义序列"
dongsheng@627 14878
dongsheng@627 14879 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14880 #: ../en/ch11-template.xml:208
dongsheng@627 14881 msgid ""
dongsheng@627 14882 "Mercurial's templating engine recognises the most commonly used escape "
dongsheng@627 14883 "sequences in strings. When it sees a backslash (<quote><literal>\\</"
dongsheng@627 14884 "literal></quote>) character, it looks at the following character and "
dongsheng@627 14885 "substitutes the two characters with a single replacement, as described below."
dongsheng@627 14886 msgstr ""
dongsheng@627 14887
dongsheng@627 14888 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14889 #: ../en/ch11-template.xml:215
dongsheng@650 14890 msgid ""
dongsheng@650 14891 "<literal>\\</literal>: Backslash, <quote><literal>\\</literal></quote>, ASCII "
dongsheng@650 14892 "134."
dongsheng@627 14893 msgstr ""
dongsheng@627 14894
dongsheng@627 14895 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14896 #: ../en/ch11-template.xml:219
dongsheng@650 14897 msgid "<literal>\\n</literal>: Newline, ASCII 12."
dongsheng@627 14898 msgstr ""
dongsheng@627 14899
dongsheng@627 14900 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14901 #: ../en/ch11-template.xml:222
dongsheng@650 14902 msgid "<literal>\\r</literal>: Carriage return, ASCII 15."
dongsheng@627 14903 msgstr ""
dongsheng@627 14904
dongsheng@627 14905 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14906 #: ../en/ch11-template.xml:225
dongsheng@650 14907 msgid "<literal>\\t</literal>: Tab, ASCII 11."
dongsheng@627 14908 msgstr ""
dongsheng@627 14909
dongsheng@627 14910 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14911 #: ../en/ch11-template.xml:228
dongsheng@650 14912 msgid "<literal>\\v</literal>: Vertical tab, ASCII 13."
dongsheng@627 14913 msgstr ""
dongsheng@627 14914
dongsheng@627 14915 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14916 #: ../en/ch11-template.xml:231
dongsheng@714 14917 msgid ""
dongsheng@714 14918 "<literal>\\{</literal>: Open curly brace, <quote><literal>{</literal></"
dongsheng@714 14919 "quote>, ASCII 173."
dongsheng@627 14920 msgstr ""
dongsheng@627 14921
dongsheng@627 14922 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14923 #: ../en/ch11-template.xml:235
dongsheng@714 14924 msgid ""
dongsheng@714 14925 "<literal>\\}</literal>: Close curly brace, <quote><literal>}</literal></"
dongsheng@714 14926 "quote>, ASCII 175."
dongsheng@714 14927 msgstr ""
dongsheng@714 14928
dongsheng@714 14929 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14930 #: ../en/ch11-template.xml:240
dongsheng@627 14931 msgid ""
dongsheng@627 14932 "As indicated above, if you want the expansion of a template to contain a "
dongsheng@627 14933 "literal <quote><literal>\\</literal></quote>, <quote><literal>{</literal></"
dongsheng@627 14934 "quote>, or <quote><literal>{</literal></quote> character, you must escape it."
dongsheng@627 14935 msgstr ""
dongsheng@627 14936
dongsheng@627 14937 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 14938 #: ../en/ch11-template.xml:248
dongsheng@627 14939 msgid "Filtering keywords to change their results"
dongsheng@636 14940 msgstr "通过过滤关键字来修改输出结果"
dongsheng@627 14941
dongsheng@627 14942 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14943 #: ../en/ch11-template.xml:250
dongsheng@627 14944 msgid ""
dongsheng@627 14945 "Some of the results of template expansion are not immediately easy to use. "
dongsheng@627 14946 "Mercurial lets you specify an optional chain of <emphasis>filters</emphasis> "
dongsheng@627 14947 "to modify the result of expanding a keyword. You have already seen a common "
dongsheng@627 14948 "filter, <literal role=\"template-kw-filt-date\">isodate</literal>, in action "
dongsheng@627 14949 "above, to make a date readable."
dongsheng@627 14950 msgstr ""
dongsheng@627 14951
dongsheng@627 14952 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 14953 #: ../en/ch11-template.xml:257
dongsheng@627 14954 msgid ""
dongsheng@627 14955 "Below is a list of the most commonly used filters that Mercurial supports. "
dongsheng@627 14956 "While some filters can be applied to any text, others can only be used in "
dongsheng@627 14957 "specific circumstances. The name of each filter is followed first by an "
dongsheng@627 14958 "indication of where it can be used, then a description of its effect."
dongsheng@627 14959 msgstr ""
dongsheng@627 14960
dongsheng@627 14961 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14962 #: ../en/ch11-template.xml:264
dongsheng@627 14963 msgid ""
dongsheng@627 14964 "<literal role=\"template-filter\">addbreaks</literal>: Any text. Add an XHTML "
dongsheng@627 14965 "<quote><literal>&lt;br/&gt;</literal></quote> tag before the end of every "
dongsheng@627 14966 "line except the last. For example, <quote><literal>foo\\nbar</literal></"
dongsheng@627 14967 "quote> becomes <quote><literal>foo&lt;br/&gt;\\nbar</literal></quote>."
dongsheng@627 14968 msgstr ""
dongsheng@627 14969
dongsheng@627 14970 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14971 #: ../en/ch11-template.xml:271
dongsheng@627 14972 msgid ""
dongsheng@627 14973 "<literal role=\"template-kw-filt-date\">age</literal>: <literal role="
dongsheng@627 14974 "\"template-keyword\">date</literal> keyword. Render the age of the date, "
dongsheng@627 14975 "relative to the current time. Yields a string like <quote><literal>10 "
dongsheng@627 14976 "minutes</literal></quote>."
dongsheng@627 14977 msgstr ""
dongsheng@627 14978
dongsheng@627 14979 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14980 #: ../en/ch11-template.xml:278
dongsheng@627 14981 msgid ""
dongsheng@627 14982 "<literal role=\"template-filter\">basename</literal>: Any text, but most "
dongsheng@627 14983 "useful for the <literal role=\"template-keyword\">files</literal> keyword and "
dongsheng@627 14984 "its relatives. Treat the text as a path, and return the basename. For "
dongsheng@627 14985 "example, <quote><literal>foo/bar/baz</literal></quote> becomes "
dongsheng@627 14986 "<quote><literal>baz</literal></quote>."
dongsheng@627 14987 msgstr ""
dongsheng@627 14988
dongsheng@627 14989 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 14990 #: ../en/ch11-template.xml:287
dongsheng@627 14991 msgid ""
dongsheng@627 14992 "<literal role=\"template-kw-filt-date\">date</literal>: <literal role="
dongsheng@627 14993 "\"template-keyword\">date</literal> keyword. Render a date in a similar "
dongsheng@627 14994 "format to the Unix <literal role=\"template-keyword\">date</literal> command, "
dongsheng@627 14995 "but with timezone included. Yields a string like <quote><literal>Mon Sep 04 "
dongsheng@627 14996 "15:13:13 2006 -0700</literal></quote>."
dongsheng@627 14997 msgstr ""
dongsheng@627 14998
dongsheng@627 14999 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 15000 #: ../en/ch11-template.xml:295
dongsheng@627 15001 msgid ""
dongsheng@627 15002 "<literal role=\"template-kw-filt-author\">domain</literal>: Any text, but "
dongsheng@627 15003 "most useful for the <literal role=\"template-keyword\">author</literal> "
dongsheng@627 15004 "keyword. Finds the first string that looks like an email address, and "
dongsheng@627 15005 "extract just the domain component. For example, <quote><literal>Bryan "
dongsheng@627 15006 "O'Sullivan &lt;bos@serpentine.com&gt;</literal></quote> becomes "
dongsheng@627 15007 "<quote><literal>serpentine.com</literal></quote>."
dongsheng@627 15008 msgstr ""
dongsheng@627 15009
dongsheng@627 15010 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 15011 #: ../en/ch11-template.xml:305
dongsheng@627 15012 msgid ""
dongsheng@627 15013 "<literal role=\"template-kw-filt-author\">email</literal>: Any text, but most "
dongsheng@627 15014 "useful for the <literal role=\"template-keyword\">author</literal> keyword. "
dongsheng@627 15015 "Extract the first string that looks like an email address. For example, "
dongsheng@627 15016 "<quote><literal>Bryan O'Sullivan &lt;bos@serpentine.com&gt;</literal></quote> "
dongsheng@627 15017 "becomes <quote><literal>bos@serpentine.com</literal></quote>."
dongsheng@627 15018 msgstr ""
dongsheng@627 15019
dongsheng@627 15020 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 15021 #: ../en/ch11-template.xml:314
dongsheng@627 15022 msgid ""
dongsheng@627 15023 "<literal role=\"template-filter\">escape</literal>: Any text. Replace the "
dongsheng@627 15024 "special XML/XHTML characters <quote><literal>&amp;</literal></quote>, "
dongsheng@627 15025 "<quote><literal>&lt;</literal></quote> and <quote><literal>&gt;</literal></"
dongsheng@627 15026 "quote> with XML entities."
dongsheng@627 15027 msgstr ""
dongsheng@627 15028
dongsheng@627 15029 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 15030 #: ../en/ch11-template.xml:322
dongsheng@627 15031 msgid ""
dongsheng@627 15032 "<literal role=\"template-filter\">fill68</literal>: Any text. Wrap the text "
dongsheng@627 15033 "to fit in 68 columns. This is useful before you pass text through the "
dongsheng@627 15034 "<literal role=\"template-filter\">tabindent</literal> filter, and still want "
dongsheng@627 15035 "it to fit in an 80-column fixed-font window."
dongsheng@627 15036 msgstr ""
dongsheng@627 15037
dongsheng@627 15038 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 15039 #: ../en/ch11-template.xml:330
dongsheng@627 15040 msgid ""
dongsheng@627 15041 "<literal role=\"template-filter\">fill76</literal>: Any text. Wrap the text "
dongsheng@627 15042 "to fit in 76 columns."
dongsheng@627 15043 msgstr ""
dongsheng@627 15044
dongsheng@627 15045 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 15046 #: ../en/ch11-template.xml:334
dongsheng@627 15047 msgid ""
dongsheng@627 15048 "<literal role=\"template-filter\">firstline</literal>: Any text. Yield the "
dongsheng@627 15049 "first line of text, without any trailing newlines."
dongsheng@627 15050 msgstr ""
dongsheng@627 15051
dongsheng@627 15052 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 15053 #: ../en/ch11-template.xml:339
dongsheng@627 15054 msgid ""
dongsheng@627 15055 "<literal role=\"template-kw-filt-date\">hgdate</literal>: <literal role="
dongsheng@627 15056 "\"template-keyword\">date</literal> keyword. Render the date as a pair of "
dongsheng@627 15057 "readable numbers. Yields a string like <quote><literal>1157407993 25200</"
dongsheng@627 15058 "literal></quote>."
dongsheng@627 15059 msgstr ""
dongsheng@627 15060
dongsheng@627 15061 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 15062 #: ../en/ch11-template.xml:346
dongsheng@627 15063 msgid ""
dongsheng@627 15064 "<literal role=\"template-kw-filt-date\">isodate</literal>: <literal role="
dongsheng@627 15065 "\"template-keyword\">date</literal> keyword. Render the date as a text "
dongsheng@627 15066 "string in ISO 8601 format. Yields a string like <quote><literal>2006-09-04 "
dongsheng@627 15067 "15:13:13 -0700</literal></quote>."
dongsheng@627 15068 msgstr ""
dongsheng@627 15069
dongsheng@627 15070 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 15071 #: ../en/ch11-template.xml:353
dongsheng@627 15072 msgid ""
dongsheng@627 15073 "<literal role=\"template-filter\">obfuscate</literal>: Any text, but most "
dongsheng@627 15074 "useful for the <literal role=\"template-keyword\">author</literal> keyword. "
dongsheng@627 15075 "Yield the input text rendered as a sequence of XML entities. This helps to "
dongsheng@627 15076 "defeat some particularly stupid screen-scraping email harvesting spambots."
dongsheng@627 15077 msgstr ""
dongsheng@627 15078
dongsheng@627 15079 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 15080 #: ../en/ch11-template.xml:361
dongsheng@627 15081 msgid ""
dongsheng@627 15082 "<literal role=\"template-kw-filt-author\">person</literal>: Any text, but "
dongsheng@627 15083 "most useful for the <literal role=\"template-keyword\">author</literal> "
dongsheng@627 15084 "keyword. Yield the text before an email address. For example, "
dongsheng@627 15085 "<quote><literal>Bryan O'Sullivan &lt;bos@serpentine.com&gt;</literal></quote> "
dongsheng@627 15086 "becomes <quote><literal>Bryan O'Sullivan</literal></quote>."
dongsheng@627 15087 msgstr ""
dongsheng@627 15088
dongsheng@627 15089 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 15090 #: ../en/ch11-template.xml:370
dongsheng@627 15091 msgid ""
dongsheng@627 15092 "<literal role=\"template-kw-filt-date\">rfc822date</literal>: <literal role="
dongsheng@627 15093 "\"template-keyword\">date</literal> keyword. Render a date using the same "
dongsheng@627 15094 "format used in email headers. Yields a string like <quote><literal>Mon, 04 "
dongsheng@627 15095 "Sep 2006 15:13:13 -0700</literal></quote>."
dongsheng@627 15096 msgstr ""
dongsheng@627 15097
dongsheng@627 15098 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 15099 #: ../en/ch11-template.xml:377
dongsheng@627 15100 msgid ""
dongsheng@627 15101 "<literal role=\"template-kw-filt-node\">short</literal>: Changeset hash. "
dongsheng@627 15102 "Yield the short form of a changeset hash, i.e. a 12-character hexadecimal "
dongsheng@627 15103 "string."
dongsheng@627 15104 msgstr ""
dongsheng@627 15105
dongsheng@627 15106 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 15107 #: ../en/ch11-template.xml:382
dongsheng@627 15108 msgid ""
dongsheng@627 15109 "<literal role=\"template-kw-filt-date\">shortdate</literal>: <literal role="
dongsheng@627 15110 "\"template-keyword\">date</literal> keyword. Render the year, month, and day "
dongsheng@627 15111 "of the date. Yields a string like <quote><literal>2006-09-04</literal></"
dongsheng@627 15112 "quote>."
dongsheng@627 15113 msgstr ""
dongsheng@627 15114
dongsheng@627 15115 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 15116 #: ../en/ch11-template.xml:388
dongsheng@627 15117 msgid ""
dongsheng@627 15118 "<literal role=\"template-filter\">strip</literal>: Any text. Strip all "
dongsheng@627 15119 "leading and trailing whitespace from the string."
dongsheng@627 15120 msgstr ""
dongsheng@627 15121
dongsheng@627 15122 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 15123 #: ../en/ch11-template.xml:392
dongsheng@627 15124 msgid ""
dongsheng@627 15125 "<literal role=\"template-filter\">tabindent</literal>: Any text. Yield the "
dongsheng@627 15126 "text, with every line except the first starting with a tab character."
dongsheng@627 15127 msgstr ""
dongsheng@627 15128
dongsheng@627 15129 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 15130 #: ../en/ch11-template.xml:397
dongsheng@627 15131 msgid ""
dongsheng@627 15132 "<literal role=\"template-filter\">urlescape</literal>: Any text. Escape all "
dongsheng@627 15133 "characters that are considered <quote>special</quote> by URL parsers. For "
dongsheng@627 15134 "example, <literal>foo bar</literal> becomes <literal>foo%20bar</literal>."
dongsheng@627 15135 msgstr ""
dongsheng@627 15136
dongsheng@627 15137 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 15138 #: ../en/ch11-template.xml:404
dongsheng@627 15139 msgid ""
dongsheng@627 15140 "<literal role=\"template-kw-filt-author\">user</literal>: Any text, but most "
dongsheng@627 15141 "useful for the <literal role=\"template-keyword\">author</literal> keyword. "
dongsheng@627 15142 "Return the <quote>user</quote> portion of an email address. For example, "
dongsheng@627 15143 "<quote><literal>Bryan O'Sullivan &lt;bos@serpentine.com&gt;</literal></quote> "
dongsheng@627 15144 "becomes <quote><literal>bos</literal></quote>."
dongsheng@627 15145 msgstr ""
dongsheng@627 15146
dongsheng@627 15147 #. type: Content of: <book><chapter><sect1><note><para>
dongsheng@714 15148 #: ../en/ch11-template.xml:418
dongsheng@627 15149 msgid ""
dongsheng@627 15150 "If you try to apply a filter to a piece of data that it cannot process, "
dongsheng@627 15151 "Mercurial will fail and print a Python exception. For example, trying to run "
dongsheng@627 15152 "the output of the <literal role=\"template-keyword\">desc</literal> keyword "
dongsheng@627 15153 "into the <literal role=\"template-kw-filt-date\">isodate</literal> filter is "
dongsheng@627 15154 "not a good idea."
dongsheng@627 15155 msgstr ""
dongsheng@627 15156
dongsheng@627 15157 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 15158 #: ../en/ch11-template.xml:427
dongsheng@627 15159 msgid "Combining filters"
dongsheng@636 15160 msgstr "组合过滤器"
dongsheng@627 15161
dongsheng@627 15162 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15163 #: ../en/ch11-template.xml:429
dongsheng@627 15164 msgid ""
dongsheng@627 15165 "It is easy to combine filters to yield output in the form you would like. "
dongsheng@627 15166 "The following chain of filters tidies up a description, then makes sure that "
dongsheng@627 15167 "it fits cleanly into 68 columns, then indents it by a further 8 characters "
dongsheng@627 15168 "(at least on Unix-like systems, where a tab is conventionally 8 characters "
dongsheng@627 15169 "wide)."
dongsheng@627 15170 msgstr ""
dongsheng@627 15171
dongsheng@627 15172 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15173 #: ../en/ch11-template.xml:438
dongsheng@627 15174 msgid ""
dongsheng@627 15175 "Note the use of <quote><literal>\\t</literal></quote> (a tab character) in "
dongsheng@627 15176 "the template to force the first line to be indented; this is necessary since "
dongsheng@627 15177 "<literal role=\"template-keyword\">tabindent</literal> indents all lines "
dongsheng@627 15178 "<emphasis>except</emphasis> the first."
dongsheng@627 15179 msgstr ""
dongsheng@627 15180
dongsheng@627 15181 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15182 #: ../en/ch11-template.xml:444
dongsheng@627 15183 msgid ""
dongsheng@627 15184 "Keep in mind that the order of filters in a chain is significant. The first "
dongsheng@627 15185 "filter is applied to the result of the keyword; the second to the result of "
dongsheng@627 15186 "the first filter; and so on. For example, using <literal>fill68|tabindent</"
dongsheng@627 15187 "literal> gives very different results from <literal>tabindent|fill68</"
dongsheng@627 15188 "literal>."
dongsheng@627 15189 msgstr ""
dongsheng@627 15190
dongsheng@627 15191 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 15192 #: ../en/ch11-template.xml:454
dongsheng@627 15193 msgid "From templates to styles"
dongsheng@636 15194 msgstr "从模版到样式"
dongsheng@627 15195
dongsheng@627 15196 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15197 #: ../en/ch11-template.xml:456
dongsheng@627 15198 msgid ""
dongsheng@627 15199 "A command line template provides a quick and simple way to format some "
dongsheng@627 15200 "output. Templates can become verbose, though, and it's useful to be able to "
dongsheng@627 15201 "give a template a name. A style file is a template with a name, stored in a "
dongsheng@627 15202 "file."
dongsheng@627 15203 msgstr ""
dongsheng@627 15204
dongsheng@627 15205 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15206 #: ../en/ch11-template.xml:461
dongsheng@627 15207 msgid ""
dongsheng@627 15208 "More than that, using a style file unlocks the power of Mercurial's "
dongsheng@627 15209 "templating engine in ways that are not possible using the command line "
dongsheng@627 15210 "<option role=\"hg-opt-log\">--template</option> option."
dongsheng@627 15211 msgstr ""
dongsheng@627 15212
dongsheng@627 15213 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 15214 #: ../en/ch11-template.xml:467
dongsheng@627 15215 msgid "The simplest of style files"
dongsheng@636 15216 msgstr "最简单的样式文件"
dongsheng@627 15217
dongsheng@627 15218 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15219 #: ../en/ch11-template.xml:469
dongsheng@627 15220 msgid "Our simple style file contains just one line:"
dongsheng@627 15221 msgstr ""
dongsheng@627 15222
dongsheng@627 15223 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15224 #: ../en/ch11-template.xml:473
dongsheng@627 15225 msgid ""
dongsheng@627 15226 "This tells Mercurial, <quote>if you're printing a changeset, use the text on "
dongsheng@627 15227 "the right as the template</quote>."
dongsheng@627 15228 msgstr ""
dongsheng@627 15229
dongsheng@627 15230 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 15231 #: ../en/ch11-template.xml:479
dongsheng@627 15232 msgid "Style file syntax"
dongsheng@636 15233 msgstr "样式文件语法"
dongsheng@627 15234
dongsheng@627 15235 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15236 #: ../en/ch11-template.xml:481
dongsheng@627 15237 msgid "The syntax rules for a style file are simple."
dongsheng@627 15238 msgstr ""
dongsheng@627 15239
dongsheng@627 15240 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15241 #: ../en/ch11-template.xml:484
dongsheng@627 15242 msgid "The file is processed one line at a time."
dongsheng@627 15243 msgstr ""
dongsheng@627 15244
dongsheng@627 15245 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15246 #: ../en/ch11-template.xml:487
dongsheng@627 15247 msgid "Leading and trailing white space are ignored."
dongsheng@627 15248 msgstr ""
dongsheng@627 15249
dongsheng@627 15250 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15251 #: ../en/ch11-template.xml:490
songdongsheng@658 15252 msgid "Empty lines are skipped."
songdongsheng@658 15253 msgstr ""
songdongsheng@658 15254
songdongsheng@658 15255 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15256 #: ../en/ch11-template.xml:492
dongsheng@627 15257 msgid ""
dongsheng@627 15258 "If a line starts with either of the characters <quote><literal>#</literal></"
dongsheng@627 15259 "quote> or <quote><literal>;</literal></quote>, the entire line is treated as "
dongsheng@627 15260 "a comment, and skipped as if empty."
dongsheng@627 15261 msgstr ""
dongsheng@627 15262
dongsheng@627 15263 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15264 #: ../en/ch11-template.xml:497
dongsheng@627 15265 msgid ""
dongsheng@627 15266 "A line starts with a keyword. This must start with an alphabetic character "
dongsheng@627 15267 "or underscore, and can subsequently contain any alphanumeric character or "
dongsheng@627 15268 "underscore. (In regexp notation, a keyword must match <literal>[A-Za-z_][A-"
dongsheng@627 15269 "Za-z0-9_]*</literal>.)"
dongsheng@627 15270 msgstr ""
dongsheng@627 15271
dongsheng@627 15272 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15273 #: ../en/ch11-template.xml:503
dongsheng@627 15274 msgid ""
dongsheng@627 15275 "The next element must be an <quote><literal>=</literal></quote> character, "
dongsheng@627 15276 "which can be preceded or followed by an arbitrary amount of white space."
dongsheng@627 15277 msgstr ""
dongsheng@627 15278
dongsheng@627 15279 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15280 #: ../en/ch11-template.xml:508
dongsheng@627 15281 msgid ""
dongsheng@627 15282 "If the rest of the line starts and ends with matching quote characters "
dongsheng@627 15283 "(either single or double quote), it is treated as a template body."
dongsheng@627 15284 msgstr ""
dongsheng@627 15285
dongsheng@627 15286 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15287 #: ../en/ch11-template.xml:512
dongsheng@627 15288 msgid ""
dongsheng@627 15289 "If the rest of the line <emphasis>does not</emphasis> start with a quote "
dongsheng@627 15290 "character, it is treated as the name of a file; the contents of this file "
dongsheng@627 15291 "will be read and used as a template body."
dongsheng@627 15292 msgstr ""
dongsheng@627 15293
dongsheng@627 15294 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 15295 #: ../en/ch11-template.xml:521
dongsheng@627 15296 msgid "Style files by example"
dongsheng@636 15297 msgstr "样式文件例子"
dongsheng@627 15298
dongsheng@627 15299 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15300 #: ../en/ch11-template.xml:523
dongsheng@627 15301 msgid ""
dongsheng@627 15302 "To illustrate how to write a style file, we will construct a few by example. "
dongsheng@627 15303 "Rather than provide a complete style file and walk through it, we'll mirror "
dongsheng@627 15304 "the usual process of developing a style file by starting with something very "
dongsheng@627 15305 "simple, and walking through a series of successively more complete examples."
dongsheng@627 15306 msgstr ""
dongsheng@627 15307
dongsheng@627 15308 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 15309 #: ../en/ch11-template.xml:530
dongsheng@627 15310 msgid "Identifying mistakes in style files"
dongsheng@636 15311 msgstr "在样式文件中定位错误"
dongsheng@627 15312
dongsheng@627 15313 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15314 #: ../en/ch11-template.xml:532
dongsheng@627 15315 msgid ""
dongsheng@627 15316 "If Mercurial encounters a problem in a style file you are working on, it "
dongsheng@627 15317 "prints a terse error message that, once you figure out what it means, is "
dongsheng@627 15318 "actually quite useful."
dongsheng@627 15319 msgstr ""
dongsheng@627 15320
dongsheng@627 15321 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15322 #: ../en/ch11-template.xml:538
dongsheng@627 15323 msgid ""
dongsheng@627 15324 "Notice that <filename>broken.style</filename> attempts to define a "
dongsheng@627 15325 "<literal>changeset</literal> keyword, but forgets to give any content for it. "
dongsheng@627 15326 "When instructed to use this style file, Mercurial promptly complains."
dongsheng@627 15327 msgstr ""
dongsheng@627 15328
dongsheng@627 15329 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15330 #: ../en/ch11-template.xml:545
dongsheng@627 15331 msgid "This error message looks intimidating, but it is not too hard to follow."
dongsheng@627 15332 msgstr ""
dongsheng@627 15333
dongsheng@627 15334 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15335 #: ../en/ch11-template.xml:549
dongsheng@627 15336 msgid ""
dongsheng@627 15337 "The first component is simply Mercurial's way of saying <quote>I am giving "
dongsheng@627 15338 "up</quote>."
dongsheng@627 15339 msgstr ""
dongsheng@627 15340
dongsheng@627 15341 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15342 #: ../en/ch11-template.xml:553
dongsheng@627 15343 msgid "Next comes the name of the style file that contains the error."
dongsheng@627 15344 msgstr ""
dongsheng@627 15345
dongsheng@627 15346 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15347 #: ../en/ch11-template.xml:557
dongsheng@627 15348 msgid ""
dongsheng@627 15349 "Following the file name is the line number where the error was encountered."
dongsheng@627 15350 msgstr ""
dongsheng@627 15351
dongsheng@627 15352 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15353 #: ../en/ch11-template.xml:561
dongsheng@627 15354 msgid "Finally, a description of what went wrong."
dongsheng@627 15355 msgstr ""
dongsheng@627 15356
dongsheng@627 15357 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15358 #: ../en/ch11-template.xml:565
dongsheng@627 15359 msgid ""
dongsheng@627 15360 "The description of the problem is not always clear (as in this case), but "
dongsheng@627 15361 "even when it is cryptic, it is almost always trivial to visually inspect the "
dongsheng@627 15362 "offending line in the style file and see what is wrong."
dongsheng@627 15363 msgstr ""
dongsheng@627 15364
dongsheng@627 15365 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 15366 #: ../en/ch11-template.xml:574
dongsheng@627 15367 msgid "Uniquely identifying a repository"
dongsheng@636 15368 msgstr "版本库的唯一标识"
dongsheng@627 15369
dongsheng@627 15370 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15371 #: ../en/ch11-template.xml:576
dongsheng@627 15372 msgid ""
dongsheng@627 15373 "If you would like to be able to identify a Mercurial repository <quote>fairly "
dongsheng@627 15374 "uniquely</quote> using a short string as an identifier, you can use the first "
dongsheng@627 15375 "revision in the repository."
dongsheng@627 15376 msgstr ""
dongsheng@627 15377
dongsheng@627 15378 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15379 #: ../en/ch11-template.xml:583
dongsheng@714 15380 msgid ""
dongsheng@714 15381 "This is likely to be unique, and so it is useful in many cases. There are a "
dongsheng@714 15382 "few caveats."
dongsheng@627 15383 msgstr ""
dongsheng@627 15384
dongsheng@627 15385 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15386 #: ../en/ch11-template.xml:586
dongsheng@627 15387 msgid ""
dongsheng@627 15388 "It will not work in a completely empty repository, because such a repository "
dongsheng@627 15389 "does not have a revision zero."
dongsheng@627 15390 msgstr ""
dongsheng@627 15391
dongsheng@627 15392 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15393 #: ../en/ch11-template.xml:590
dongsheng@627 15394 msgid ""
dongsheng@627 15395 "Neither will it work in the (extremely rare) case where a repository is a "
dongsheng@627 15396 "merge of two or more formerly independent repositories, and you still have "
dongsheng@627 15397 "those repositories around."
dongsheng@627 15398 msgstr ""
dongsheng@627 15399
dongsheng@627 15400 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15401 #: ../en/ch11-template.xml:595
dongsheng@627 15402 msgid "Here are some uses to which you could put this identifier:"
dongsheng@627 15403 msgstr ""
dongsheng@627 15404
dongsheng@627 15405 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15406 #: ../en/ch11-template.xml:598
dongsheng@627 15407 msgid ""
dongsheng@627 15408 "As a key into a table for a database that manages repositories on a server."
dongsheng@627 15409 msgstr ""
dongsheng@627 15410
dongsheng@627 15411 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15412 #: ../en/ch11-template.xml:601
dongsheng@627 15413 msgid ""
dongsheng@627 15414 "As half of a {<emphasis>repository ID</emphasis>, <emphasis>revision ID</"
dongsheng@627 15415 "emphasis>} tuple. Save this information away when you run an automated build "
dongsheng@627 15416 "or other activity, so that you can <quote>replay</quote> the build later if "
dongsheng@627 15417 "necessary."
dongsheng@627 15418 msgstr ""
dongsheng@627 15419
dongsheng@627 15420 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 15421 #: ../en/ch11-template.xml:611
dongsheng@714 15422 msgid "Listing files on multiple lines"
dongsheng@716 15423 msgstr "每行列出一个文件"
dongsheng@714 15424
dongsheng@714 15425 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15426 #: ../en/ch11-template.xml:613
dongsheng@714 15427 msgid ""
dongsheng@714 15428 "Suppose we want to list the files changed by a changeset, one per line, with "
dongsheng@714 15429 "a little indentation before each file name."
dongsheng@714 15430 msgstr ""
dongsheng@714 15431
dongsheng@714 15432 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 15433 #: ../en/ch11-template.xml:621
dongsheng@627 15434 msgid "Mimicking Subversion's output"
dongsheng@636 15435 msgstr "模仿 Subversion 的输出"
dongsheng@627 15436
dongsheng@627 15437 #
dongsheng@627 15438 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15439 #: ../en/ch11-template.xml:623
dongsheng@627 15440 msgid ""
dongsheng@627 15441 "Let's try to emulate the default output format used by another revision "
dongsheng@627 15442 "control tool, Subversion."
dongsheng@627 15443 msgstr ""
dongsheng@627 15444
dongsheng@627 15445 #
dongsheng@627 15446 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15447 #: ../en/ch11-template.xml:628
dongsheng@627 15448 msgid ""
dongsheng@627 15449 "Since Subversion's output style is fairly simple, it is easy to copy-and-"
dongsheng@627 15450 "paste a hunk of its output into a file, and replace the text produced above "
dongsheng@627 15451 "by Subversion with the template values we'd like to see expanded."
dongsheng@627 15452 msgstr ""
dongsheng@627 15453
dongsheng@627 15454 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15455 #: ../en/ch11-template.xml:635
dongsheng@627 15456 msgid ""
dongsheng@627 15457 "There are a few small ways in which this template deviates from the output "
dongsheng@627 15458 "produced by Subversion."
dongsheng@627 15459 msgstr ""
dongsheng@627 15460
dongsheng@627 15461 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15462 #: ../en/ch11-template.xml:638
dongsheng@627 15463 msgid ""
dongsheng@627 15464 "Subversion prints a <quote>readable</quote> date (the <quote><literal>Wed, 27 "
dongsheng@627 15465 "Sep 2006</literal></quote> in the example output above) in parentheses. "
dongsheng@627 15466 "Mercurial's templating engine does not provide a way to display a date in "
dongsheng@627 15467 "this format without also printing the time and time zone."
dongsheng@627 15468 msgstr ""
dongsheng@627 15469
dongsheng@627 15470 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15471 #: ../en/ch11-template.xml:645
dongsheng@627 15472 msgid ""
dongsheng@627 15473 "We emulate Subversion's printing of <quote>separator</quote> lines full of "
dongsheng@627 15474 "<quote><literal>-</literal></quote> characters by ending the template with "
dongsheng@627 15475 "such a line. We use the templating engine's <literal role=\"template-keyword"
dongsheng@627 15476 "\">header</literal> keyword to print a separator line as the first line of "
dongsheng@627 15477 "output (see below), thus achieving similar output to Subversion."
dongsheng@627 15478 msgstr ""
dongsheng@627 15479
dongsheng@627 15480 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15481 #: ../en/ch11-template.xml:654
dongsheng@627 15482 msgid ""
dongsheng@627 15483 "Subversion's output includes a count in the header of the number of lines in "
dongsheng@627 15484 "the commit message. We cannot replicate this in Mercurial; the templating "
dongsheng@627 15485 "engine does not currently provide a filter that counts the number of lines "
dongsheng@627 15486 "the template generates."
dongsheng@627 15487 msgstr ""
dongsheng@627 15488
dongsheng@627 15489 #
dongsheng@627 15490 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15491 #: ../en/ch11-template.xml:660
dongsheng@627 15492 msgid ""
dongsheng@627 15493 "It took me no more than a minute or two of work to replace literal text from "
dongsheng@627 15494 "an example of Subversion's output with some keywords and filters to give the "
dongsheng@627 15495 "template above. The style file simply refers to the template."
dongsheng@627 15496 msgstr ""
dongsheng@627 15497
dongsheng@627 15498 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15499 #: ../en/ch11-template.xml:667
dongsheng@627 15500 msgid ""
dongsheng@627 15501 "We could have included the text of the template file directly in the style "
dongsheng@627 15502 "file by enclosing it in quotes and replacing the newlines with "
dongsheng@627 15503 "<quote><literal>\\n</literal></quote> sequences, but it would have made the "
dongsheng@627 15504 "style file too difficult to read. Readability is a good guide when you're "
dongsheng@627 15505 "trying to decide whether some text belongs in a style file, or in a template "
dongsheng@627 15506 "file that the style file points to. If the style file will look too big or "
dongsheng@627 15507 "cluttered if you insert a literal piece of text, drop it into a template "
dongsheng@627 15508 "instead."
dongsheng@627 15509 msgstr ""
dongsheng@627 15510
dongsheng@627 15511 #. type: Content of: <book><chapter><title>
dongsheng@714 15512 #: ../en/ch12-mq.xml:5
dongsheng@627 15513 msgid "Managing change with Mercurial Queues"
dongsheng@627 15514 msgstr "使用 MQ 管理修改"
dongsheng@627 15515
dongsheng@627 15516 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 15517 #: ../en/ch12-mq.xml:8
dongsheng@627 15518 msgid "The patch management problem"
dongsheng@636 15519 msgstr "补丁的管理问题"
dongsheng@627 15520
dongsheng@627 15521 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15522 #: ../en/ch12-mq.xml:10
dongsheng@627 15523 msgid ""
dongsheng@627 15524 "Here is a common scenario: you need to install a software package from "
dongsheng@627 15525 "source, but you find a bug that you must fix in the source before you can "
dongsheng@627 15526 "start using the package. You make your changes, forget about the package for "
dongsheng@627 15527 "a while, and a few months later you need to upgrade to a newer version of the "
dongsheng@627 15528 "package. If the newer version of the package still has the bug, you must "
dongsheng@627 15529 "extract your fix from the older source tree and apply it against the newer "
dongsheng@627 15530 "version. This is a tedious task, and it's easy to make mistakes."
dongsheng@627 15531 msgstr ""
dongsheng@627 15532
dongsheng@627 15533 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15534 #: ../en/ch12-mq.xml:20
dongsheng@627 15535 msgid ""
dongsheng@627 15536 "This is a simple case of the <quote>patch management</quote> problem. You "
dongsheng@627 15537 "have an <quote>upstream</quote> source tree that you can't change; you need "
dongsheng@627 15538 "to make some local changes on top of the upstream tree; and you'd like to be "
dongsheng@627 15539 "able to keep those changes separate, so that you can apply them to newer "
dongsheng@627 15540 "versions of the upstream source."
dongsheng@627 15541 msgstr ""
dongsheng@627 15542
dongsheng@627 15543 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15544 #: ../en/ch12-mq.xml:27
dongsheng@627 15545 msgid ""
dongsheng@627 15546 "The patch management problem arises in many situations. Probably the most "
dongsheng@627 15547 "visible is that a user of an open source software project will contribute a "
dongsheng@627 15548 "bug fix or new feature to the project's maintainers in the form of a patch."
dongsheng@627 15549 msgstr ""
dongsheng@627 15550
dongsheng@627 15551 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15552 #: ../en/ch12-mq.xml:32
dongsheng@627 15553 msgid ""
dongsheng@627 15554 "Distributors of operating systems that include open source software often "
dongsheng@627 15555 "need to make changes to the packages they distribute so that they will build "
dongsheng@627 15556 "properly in their environments."
dongsheng@627 15557 msgstr ""
dongsheng@627 15558
dongsheng@627 15559 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15560 #: ../en/ch12-mq.xml:37
dongsheng@627 15561 msgid ""
dongsheng@627 15562 "When you have few changes to maintain, it is easy to manage a single patch "
dongsheng@627 15563 "using the standard <command>diff</command> and <command>patch</command> "
songdongsheng@658 15564 "programs (see <xref linkend=\"sec:mq:patch\"/> for a discussion of these "
songdongsheng@658 15565 "tools). Once the number of changes grows, it starts to make sense to maintain "
songdongsheng@658 15566 "patches as discrete <quote>chunks of work,</quote> so that for example a "
songdongsheng@658 15567 "single patch will contain only one bug fix (the patch might modify several "
songdongsheng@658 15568 "files, but it's doing <quote>only one thing</quote>), and you may have a "
songdongsheng@658 15569 "number of such patches for different bugs you need fixed and local changes "
songdongsheng@658 15570 "you require. In this situation, if you submit a bug fix patch to the "
dongsheng@627 15571 "upstream maintainers of a package and they include your fix in a subsequent "
dongsheng@627 15572 "release, you can simply drop that single patch when you're updating to the "
dongsheng@627 15573 "newer release."
dongsheng@627 15574 msgstr ""
dongsheng@627 15575
dongsheng@627 15576 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15577 #: ../en/ch12-mq.xml:52
dongsheng@627 15578 msgid ""
dongsheng@627 15579 "Maintaining a single patch against an upstream tree is a little tedious and "
dongsheng@627 15580 "error-prone, but not difficult. However, the complexity of the problem grows "
dongsheng@627 15581 "rapidly as the number of patches you have to maintain increases. With more "
dongsheng@627 15582 "than a tiny number of patches in hand, understanding which ones you have "
dongsheng@627 15583 "applied and maintaining them moves from messy to overwhelming."
dongsheng@627 15584 msgstr ""
dongsheng@627 15585
dongsheng@627 15586 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15587 #: ../en/ch12-mq.xml:59
dongsheng@627 15588 msgid ""
dongsheng@627 15589 "Fortunately, Mercurial includes a powerful extension, Mercurial Queues (or "
dongsheng@627 15590 "simply <quote>MQ</quote>), that massively simplifies the patch management "
dongsheng@627 15591 "problem."
dongsheng@627 15592 msgstr ""
dongsheng@627 15593
dongsheng@627 15594 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 15595 #: ../en/ch12-mq.xml:65
dongsheng@627 15596 msgid "The prehistory of Mercurial Queues"
dongsheng@636 15597 msgstr "MQ 的历史"
dongsheng@627 15598
dongsheng@627 15599 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15600 #: ../en/ch12-mq.xml:67
dongsheng@627 15601 msgid ""
dongsheng@627 15602 "During the late 1990s, several Linux kernel developers started to maintain "
songdongsheng@710 15603 "<quote>patch series</quote> that modified the behavior of the Linux kernel. "
dongsheng@627 15604 "Some of these series were focused on stability, some on feature coverage, and "
dongsheng@627 15605 "others were more speculative."
dongsheng@627 15606 msgstr ""
dongsheng@627 15607
dongsheng@627 15608 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15609 #: ../en/ch12-mq.xml:73
dongsheng@627 15610 msgid ""
dongsheng@627 15611 "The sizes of these patch series grew rapidly. In 2002, Andrew Morton "
dongsheng@627 15612 "published some shell scripts he had been using to automate the task of "
dongsheng@627 15613 "managing his patch queues. Andrew was successfully using these scripts to "
dongsheng@627 15614 "manage hundreds (sometimes thousands) of patches on top of the Linux kernel."
dongsheng@627 15615 msgstr ""
dongsheng@627 15616
dongsheng@627 15617 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 15618 #: ../en/ch12-mq.xml:80
dongsheng@627 15619 msgid "A patchwork quilt"
dongsheng@627 15620 msgstr ""
dongsheng@627 15621
dongsheng@627 15622 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15623 #: ../en/ch12-mq.xml:82
dongsheng@627 15624 msgid ""
dongsheng@627 15625 "In early 2003, Andreas Gruenbacher and Martin Quinson borrowed the approach "
dongsheng@627 15626 "of Andrew's scripts and published a tool called <quote>patchwork quilt</"
dongsheng@627 15627 "quote> <citation>web:quilt</citation>, or simply <quote>quilt</quote> (see "
dongsheng@627 15628 "<citation>gruenbacher:2005</citation> for a paper describing it). Because "
dongsheng@627 15629 "quilt substantially automated patch management, it rapidly gained a large "
dongsheng@627 15630 "following among open source software developers."
dongsheng@627 15631 msgstr ""
dongsheng@627 15632
dongsheng@627 15633 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15634 #: ../en/ch12-mq.xml:91
dongsheng@627 15635 msgid ""
dongsheng@627 15636 "Quilt manages a <emphasis>stack of patches</emphasis> on top of a directory "
dongsheng@627 15637 "tree. To begin, you tell quilt to manage a directory tree, and tell it which "
dongsheng@627 15638 "files you want to manage; it stores away the names and contents of those "
dongsheng@627 15639 "files. To fix a bug, you create a new patch (using a single command), edit "
dongsheng@627 15640 "the files you need to fix, then <quote>refresh</quote> the patch."
dongsheng@627 15641 msgstr ""
dongsheng@627 15642
dongsheng@627 15643 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15644 #: ../en/ch12-mq.xml:99
dongsheng@627 15645 msgid ""
dongsheng@627 15646 "The refresh step causes quilt to scan the directory tree; it updates the "
dongsheng@627 15647 "patch with all of the changes you have made. You can create another patch on "
dongsheng@627 15648 "top of the first, which will track the changes required to modify the tree "
dongsheng@627 15649 "from <quote>tree with one patch applied</quote> to <quote>tree with two "
dongsheng@627 15650 "patches applied</quote>."
dongsheng@627 15651 msgstr ""
dongsheng@627 15652
dongsheng@627 15653 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15654 #: ../en/ch12-mq.xml:106
dongsheng@627 15655 msgid ""
dongsheng@627 15656 "You can <emphasis>change</emphasis> which patches are applied to the tree. "
dongsheng@627 15657 "If you <quote>pop</quote> a patch, the changes made by that patch will vanish "
dongsheng@627 15658 "from the directory tree. Quilt remembers which patches you have popped, "
dongsheng@627 15659 "though, so you can <quote>push</quote> a popped patch again, and the "
dongsheng@627 15660 "directory tree will be restored to contain the modifications in the patch. "
dongsheng@627 15661 "Most importantly, you can run the <quote>refresh</quote> command at any time, "
dongsheng@627 15662 "and the topmost applied patch will be updated. This means that you can, at "
dongsheng@627 15663 "any time, change both which patches are applied and what modifications those "
dongsheng@627 15664 "patches make."
dongsheng@627 15665 msgstr ""
dongsheng@627 15666
dongsheng@627 15667 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15668 #: ../en/ch12-mq.xml:118
dongsheng@627 15669 msgid ""
dongsheng@627 15670 "Quilt knows nothing about revision control tools, so it works equally well on "
dongsheng@627 15671 "top of an unpacked tarball or a Subversion working copy."
dongsheng@627 15672 msgstr ""
dongsheng@627 15673
dongsheng@627 15674 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 15675 #: ../en/ch12-mq.xml:124
dongsheng@627 15676 msgid "From patchwork quilt to Mercurial Queues"
dongsheng@636 15677 msgstr "从 patchwork quilt 到 MQ"
dongsheng@627 15678
dongsheng@627 15679 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15680 #: ../en/ch12-mq.xml:126
dongsheng@627 15681 msgid ""
dongsheng@627 15682 "In mid-2005, Chris Mason took the features of quilt and wrote an extension "
songdongsheng@710 15683 "that he called Mercurial Queues, which added quilt-like behavior to Mercurial."
dongsheng@627 15684 msgstr ""
dongsheng@627 15685
dongsheng@627 15686 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15687 #: ../en/ch12-mq.xml:130
dongsheng@627 15688 msgid ""
dongsheng@627 15689 "The key difference between quilt and MQ is that quilt knows nothing about "
dongsheng@627 15690 "revision control systems, while MQ is <emphasis>integrated</emphasis> into "
dongsheng@627 15691 "Mercurial. Each patch that you push is represented as a Mercurial "
dongsheng@627 15692 "changeset. Pop a patch, and the changeset goes away."
dongsheng@627 15693 msgstr ""
dongsheng@627 15694
dongsheng@627 15695 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15696 #: ../en/ch12-mq.xml:136
dongsheng@627 15697 msgid ""
dongsheng@627 15698 "Because quilt does not care about revision control tools, it is still a "
dongsheng@627 15699 "tremendously useful piece of software to know about for situations where you "
dongsheng@627 15700 "cannot use Mercurial and MQ."
dongsheng@627 15701 msgstr ""
dongsheng@627 15702
dongsheng@627 15703 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 15704 #: ../en/ch12-mq.xml:144
dongsheng@627 15705 msgid "The huge advantage of MQ"
dongsheng@636 15706 msgstr "MQ 的巨大优势"
dongsheng@627 15707
dongsheng@627 15708 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15709 #: ../en/ch12-mq.xml:146
dongsheng@627 15710 msgid ""
dongsheng@627 15711 "I cannot overstate the value that MQ offers through the unification of "
dongsheng@627 15712 "patches and revision control."
dongsheng@627 15713 msgstr ""
dongsheng@627 15714
dongsheng@627 15715 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15716 #: ../en/ch12-mq.xml:149
dongsheng@627 15717 msgid ""
dongsheng@627 15718 "A major reason that patches have persisted in the free software and open "
songdongsheng@668 15719 "source world&emdash;in spite of the availability of increasingly capable "
songdongsheng@668 15720 "revision control tools over the years&emdash;is the <emphasis>agility</"
songdongsheng@668 15721 "emphasis> they offer."
dongsheng@627 15722 msgstr ""
dongsheng@627 15723
dongsheng@627 15724 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15725 #: ../en/ch12-mq.xml:155
dongsheng@627 15726 msgid ""
dongsheng@627 15727 "Traditional revision control tools make a permanent, irreversible record of "
dongsheng@627 15728 "everything that you do. While this has great value, it's also somewhat "
dongsheng@627 15729 "stifling. If you want to perform a wild-eyed experiment, you have to be "
songdongsheng@668 15730 "careful in how you go about it, or you risk leaving unneeded&emdash;or worse, "
songdongsheng@668 15731 "misleading or destabilising&emdash;traces of your missteps and errors in the "
dongsheng@627 15732 "permanent revision record."
dongsheng@627 15733 msgstr ""
dongsheng@627 15734
dongsheng@627 15735 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15736 #: ../en/ch12-mq.xml:163
dongsheng@627 15737 msgid ""
dongsheng@627 15738 "By contrast, MQ's marriage of distributed revision control with patches makes "
dongsheng@627 15739 "it much easier to isolate your work. Your patches live on top of normal "
dongsheng@627 15740 "revision history, and you can make them disappear or reappear at will. If "
dongsheng@627 15741 "you don't like a patch, you can drop it. If a patch isn't quite as you want "
songdongsheng@668 15742 "it to be, simply fix it&emdash;as many times as you need to, until you have "
songdongsheng@668 15743 "refined it into the form you desire."
dongsheng@627 15744 msgstr ""
dongsheng@627 15745
dongsheng@627 15746 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15747 #: ../en/ch12-mq.xml:171
dongsheng@627 15748 msgid ""
dongsheng@627 15749 "As an example, the integration of patches with revision control makes "
songdongsheng@668 15750 "understanding patches and debugging their effects&emdash;and their interplay "
songdongsheng@668 15751 "with the code they're based on&emdash;<emphasis>enormously</emphasis> easier. "
songdongsheng@668 15752 "Since every applied patch has an associated changeset, you can give <command "
songdongsheng@668 15753 "role=\"hg-cmd\">hg log</command> a file name to see which changesets and "
songdongsheng@668 15754 "patches affected the file. You can use the <command role=\"hg-cmd\">hg "
songdongsheng@668 15755 "bisect</command> command to binary-search through all changesets and applied "
songdongsheng@668 15756 "patches to see where a bug got introduced or fixed. You can use the <command "
songdongsheng@668 15757 "role=\"hg-cmd\">hg annotate</command> command to see which changeset or patch "
songdongsheng@668 15758 "modified a particular line of a source file. And so on."
dongsheng@627 15759 msgstr ""
dongsheng@627 15760
dongsheng@627 15761 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15762 #: ../en/ch12-mq.xml:189
dongsheng@627 15763 msgid ""
dongsheng@627 15764 "Because MQ doesn't hide its patch-oriented nature, it is helpful to "
dongsheng@627 15765 "understand what patches are, and a little about the tools that work with them."
dongsheng@627 15766 msgstr ""
dongsheng@627 15767
dongsheng@627 15768 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15769 #: ../en/ch12-mq.xml:193
dongsheng@627 15770 msgid ""
dongsheng@627 15771 "The traditional Unix <command>diff</command> command compares two files, and "
dongsheng@627 15772 "prints a list of differences between them. The <command>patch</command> "
dongsheng@627 15773 "command understands these differences as <emphasis>modifications</emphasis> "
dongsheng@627 15774 "to make to a file. Take a look below for a simple example of these commands "
dongsheng@627 15775 "in action."
dongsheng@627 15776 msgstr ""
dongsheng@627 15777
dongsheng@627 15778 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15779 #: ../en/ch12-mq.xml:202
dongsheng@627 15780 msgid ""
dongsheng@627 15781 "The type of file that <command>diff</command> generates (and <command>patch</"
dongsheng@627 15782 "command> takes as input) is called a <quote>patch</quote> or a <quote>diff</"
dongsheng@627 15783 "quote>; there is no difference between a patch and a diff. (We'll use the "
dongsheng@627 15784 "term <quote>patch</quote>, since it's more commonly used.)"
dongsheng@627 15785 msgstr ""
dongsheng@627 15786
dongsheng@627 15787 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15788 #: ../en/ch12-mq.xml:208
dongsheng@627 15789 msgid ""
dongsheng@627 15790 "A patch file can start with arbitrary text; the <command>patch</command> "
dongsheng@627 15791 "command ignores this text, but MQ uses it as the commit message when creating "
dongsheng@627 15792 "changesets. To find the beginning of the patch content, <command>patch</"
dongsheng@627 15793 "command> searches for the first line that starts with the string "
dongsheng@627 15794 "<quote><literal>diff -</literal></quote>."
dongsheng@627 15795 msgstr ""
dongsheng@627 15796
dongsheng@627 15797 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15798 #: ../en/ch12-mq.xml:215
dongsheng@627 15799 msgid ""
dongsheng@627 15800 "MQ works with <emphasis>unified</emphasis> diffs (<command>patch</command> "
dongsheng@627 15801 "can accept several other diff formats, but MQ doesn't). A unified diff "
dongsheng@627 15802 "contains two kinds of header. The <emphasis>file header</emphasis> describes "
dongsheng@627 15803 "the file being modified; it contains the name of the file to modify. When "
dongsheng@627 15804 "<command>patch</command> sees a new file header, it looks for a file with "
dongsheng@627 15805 "that name to start modifying."
dongsheng@627 15806 msgstr ""
dongsheng@627 15807
dongsheng@627 15808 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15809 #: ../en/ch12-mq.xml:223
dongsheng@627 15810 msgid ""
dongsheng@627 15811 "After the file header comes a series of <emphasis>hunks</emphasis>. Each "
dongsheng@627 15812 "hunk starts with a header; this identifies the range of line numbers within "
dongsheng@627 15813 "the file that the hunk should modify. Following the header, a hunk starts "
dongsheng@627 15814 "and ends with a few (usually three) lines of text from the unmodified file; "
dongsheng@627 15815 "these are called the <emphasis>context</emphasis> for the hunk. If there's "
dongsheng@627 15816 "only a small amount of context between successive hunks, <command>diff</"
dongsheng@627 15817 "command> doesn't print a new hunk header; it just runs the hunks together, "
dongsheng@627 15818 "with a few lines of context between modifications."
dongsheng@627 15819 msgstr ""
dongsheng@627 15820
dongsheng@627 15821 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15822 #: ../en/ch12-mq.xml:235
dongsheng@627 15823 msgid ""
dongsheng@627 15824 "Each line of context begins with a space character. Within the hunk, a line "
dongsheng@627 15825 "that begins with <quote><literal>-</literal></quote> means <quote>remove this "
dongsheng@627 15826 "line,</quote> while a line that begins with <quote><literal>+</literal></"
dongsheng@627 15827 "quote> means <quote>insert this line.</quote> For example, a line that is "
dongsheng@627 15828 "modified is represented by one deletion and one insertion."
dongsheng@627 15829 msgstr ""
dongsheng@627 15830
dongsheng@627 15831 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15832 #: ../en/ch12-mq.xml:243
dongsheng@627 15833 msgid ""
songdongsheng@658 15834 "We will return to some of the more subtle aspects of patches later (in <xref "
songdongsheng@658 15835 "linkend=\"sec:mq:adv-patch\"/>), but you should have enough information now "
songdongsheng@658 15836 "to use MQ."
dongsheng@627 15837 msgstr ""
dongsheng@627 15838
dongsheng@627 15839 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 15840 #: ../en/ch12-mq.xml:250
dongsheng@627 15841 msgid "Getting started with Mercurial Queues"
dongsheng@636 15842 msgstr "开始使用 MQ"
dongsheng@627 15843
dongsheng@627 15844 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15845 #: ../en/ch12-mq.xml:252
dongsheng@627 15846 msgid ""
dongsheng@627 15847 "Because MQ is implemented as an extension, you must explicitly enable before "
dongsheng@627 15848 "you can use it. (You don't need to download anything; MQ ships with the "
dongsheng@627 15849 "standard Mercurial distribution.) To enable MQ, edit your <filename role="
dongsheng@627 15850 "\"home\">~/.hgrc</filename> file, and add the lines below."
dongsheng@627 15851 msgstr ""
dongsheng@627 15852
dongsheng@627 15853 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15854 #: ../en/ch12-mq.xml:262
dongsheng@627 15855 msgid ""
dongsheng@627 15856 "Once the extension is enabled, it will make a number of new commands "
dongsheng@627 15857 "available. To verify that the extension is working, you can use <command "
dongsheng@627 15858 "role=\"hg-cmd\">hg help</command> to see if the <command role=\"hg-ext-mq"
dongsheng@627 15859 "\">qinit</command> command is now available."
dongsheng@627 15860 msgstr ""
dongsheng@627 15861
dongsheng@627 15862 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15863 #: ../en/ch12-mq.xml:270
dongsheng@627 15864 msgid ""
dongsheng@627 15865 "You can use MQ with <emphasis>any</emphasis> Mercurial repository, and its "
dongsheng@627 15866 "commands only operate within that repository. To get started, simply prepare "
dongsheng@627 15867 "the repository using the <command role=\"hg-ext-mq\">qinit</command> command."
dongsheng@627 15868 msgstr ""
dongsheng@627 15869
dongsheng@627 15870 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 15871 #: ../en/ch12-mq.xml:277
dongsheng@627 15872 msgid ""
dongsheng@627 15873 "This command creates an empty directory called <filename role=\"special\" "
dongsheng@627 15874 "class=\"directory\">.hg/patches</filename>, where MQ will keep its metadata. "
dongsheng@627 15875 "As with many Mercurial commands, the <command role=\"hg-ext-mq\">qinit</"
dongsheng@627 15876 "command> command prints nothing if it succeeds."
dongsheng@627 15877 msgstr ""
dongsheng@627 15878
dongsheng@627 15879 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 15880 #: ../en/ch12-mq.xml:284
dongsheng@627 15881 msgid "Creating a new patch"
dongsheng@636 15882 msgstr "创建新补丁"
dongsheng@627 15883
dongsheng@627 15884 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15885 #: ../en/ch12-mq.xml:286
dongsheng@627 15886 msgid ""
dongsheng@627 15887 "To begin work on a new patch, use the <command role=\"hg-ext-mq\">qnew</"
dongsheng@627 15888 "command> command. This command takes one argument, the name of the patch to "
dongsheng@627 15889 "create."
dongsheng@627 15890 msgstr ""
dongsheng@627 15891
dongsheng@627 15892 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15893 #: ../en/ch12-mq.xml:290
dongsheng@627 15894 msgid ""
dongsheng@627 15895 "MQ will use this as the name of an actual file in the <filename role=\"special"
dongsheng@627 15896 "\" class=\"directory\">.hg/patches</filename> directory, as you can see below."
dongsheng@627 15897 msgstr ""
dongsheng@627 15898
dongsheng@627 15899 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15900 #: ../en/ch12-mq.xml:297
dongsheng@627 15901 msgid ""
dongsheng@627 15902 "Also newly present in the <filename role=\"special\" class=\"directory\">.hg/"
dongsheng@627 15903 "patches</filename> directory are two other files, <filename role=\"special"
dongsheng@627 15904 "\">series</filename> and <filename role=\"special\">status</filename>. The "
dongsheng@627 15905 "<filename role=\"special\">series</filename> file lists all of the patches "
dongsheng@627 15906 "that MQ knows about for this repository, with one patch per line. Mercurial "
dongsheng@627 15907 "uses the <filename role=\"special\">status</filename> file for internal book-"
dongsheng@627 15908 "keeping; it tracks all of the patches that MQ has <emphasis>applied</"
dongsheng@627 15909 "emphasis> in this repository."
dongsheng@627 15910 msgstr ""
dongsheng@627 15911
dongsheng@627 15912 #. type: Content of: <book><chapter><sect1><sect2><note><para>
dongsheng@714 15913 #: ../en/ch12-mq.xml:309
dongsheng@627 15914 msgid ""
dongsheng@627 15915 "You may sometimes want to edit the <filename role=\"special\">series</"
dongsheng@627 15916 "filename> file by hand; for example, to change the sequence in which some "
dongsheng@627 15917 "patches are applied. However, manually editing the <filename role=\"special"
dongsheng@627 15918 "\">status</filename> file is almost always a bad idea, as it's easy to "
dongsheng@627 15919 "corrupt MQ's idea of what is happening."
dongsheng@627 15920 msgstr ""
dongsheng@627 15921
dongsheng@627 15922 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15923 #: ../en/ch12-mq.xml:318
dongsheng@627 15924 msgid ""
dongsheng@627 15925 "Once you have created your new patch, you can edit files in the working "
dongsheng@627 15926 "directory as you usually would. All of the normal Mercurial commands, such "
dongsheng@627 15927 "as <command role=\"hg-cmd\">hg diff</command> and <command role=\"hg-cmd\">hg "
dongsheng@627 15928 "annotate</command>, work exactly as they did before."
dongsheng@627 15929 msgstr ""
dongsheng@627 15930
dongsheng@627 15931 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 15932 #: ../en/ch12-mq.xml:326
dongsheng@627 15933 msgid "Refreshing a patch"
dongsheng@636 15934 msgstr "刷新补丁"
dongsheng@627 15935
dongsheng@627 15936 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15937 #: ../en/ch12-mq.xml:328
dongsheng@627 15938 msgid ""
dongsheng@627 15939 "When you reach a point where you want to save your work, use the <command "
dongsheng@627 15940 "role=\"hg-ext-mq\">qrefresh</command> command to update the patch you are "
dongsheng@627 15941 "working on."
dongsheng@627 15942 msgstr ""
dongsheng@627 15943
dongsheng@627 15944 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15945 #: ../en/ch12-mq.xml:334
dongsheng@627 15946 msgid ""
dongsheng@627 15947 "This command folds the changes you have made in the working directory into "
dongsheng@627 15948 "your patch, and updates its corresponding changeset to contain those changes."
dongsheng@627 15949 msgstr ""
dongsheng@627 15950
dongsheng@627 15951 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15952 #: ../en/ch12-mq.xml:338
dongsheng@627 15953 msgid ""
dongsheng@627 15954 "You can run <command role=\"hg-ext-mq\">qrefresh</command> as often as you "
dongsheng@627 15955 "like, so it's a good way to <quote>checkpoint</quote> your work. Refresh "
dongsheng@627 15956 "your patch at an opportune time; try an experiment; and if the experiment "
dongsheng@627 15957 "doesn't work out, <command role=\"hg-cmd\">hg revert</command> your "
dongsheng@627 15958 "modifications back to the last time you refreshed."
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:349
dongsheng@627 15963 msgid "Stacking and tracking patches"
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:351
dongsheng@627 15968 msgid ""
dongsheng@627 15969 "Once you have finished working on a patch, or need to work on another, you "
dongsheng@627 15970 "can use the <command role=\"hg-ext-mq\">qnew</command> command again to "
dongsheng@627 15971 "create a new patch. Mercurial will apply this patch on top of your existing "
dongsheng@627 15972 "patch."
dongsheng@627 15973 msgstr ""
dongsheng@627 15974
dongsheng@627 15975 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15976 #: ../en/ch12-mq.xml:359
dongsheng@627 15977 msgid ""
dongsheng@627 15978 "Notice that the patch contains the changes in our prior patch as part of its "
dongsheng@627 15979 "context (you can see this more clearly in the output of <command role=\"hg-cmd"
dongsheng@627 15980 "\">hg annotate</command>)."
dongsheng@627 15981 msgstr ""
dongsheng@627 15982
dongsheng@627 15983 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 15984 #: ../en/ch12-mq.xml:364
dongsheng@627 15985 msgid ""
dongsheng@627 15986 "So far, with the exception of <command role=\"hg-ext-mq\">qnew</command> and "
dongsheng@627 15987 "<command role=\"hg-ext-mq\">qrefresh</command>, we've been careful to only "
dongsheng@627 15988 "use regular Mercurial commands. However, MQ provides many commands that are "
dongsheng@627 15989 "easier to use when you are thinking about patches, as illustrated below."
dongsheng@627 15990 msgstr ""
dongsheng@627 15991
dongsheng@627 15992 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 15993 #: ../en/ch12-mq.xml:374
dongsheng@627 15994 msgid ""
dongsheng@627 15995 "The <command role=\"hg-ext-mq\">qseries</command> command lists every patch "
dongsheng@627 15996 "that MQ knows about in this repository, from oldest to newest (most recently "
dongsheng@627 15997 "<emphasis>created</emphasis>)."
dongsheng@627 15998 msgstr ""
dongsheng@627 15999
dongsheng@627 16000 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 16001 #: ../en/ch12-mq.xml:380
dongsheng@627 16002 msgid ""
dongsheng@627 16003 "The <command role=\"hg-ext-mq\">qapplied</command> command lists every patch "
dongsheng@627 16004 "that MQ has <emphasis>applied</emphasis> in this repository, again from "
dongsheng@627 16005 "oldest to newest (most recently applied)."
dongsheng@627 16006 msgstr ""
dongsheng@627 16007
dongsheng@627 16008 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 16009 #: ../en/ch12-mq.xml:389
dongsheng@627 16010 msgid "Manipulating the patch stack"
dongsheng@636 16011 msgstr "操作补丁堆栈"
dongsheng@627 16012
dongsheng@627 16013 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16014 #: ../en/ch12-mq.xml:391
dongsheng@627 16015 msgid ""
dongsheng@627 16016 "The previous discussion implied that there must be a difference between "
dongsheng@627 16017 "<quote>known</quote> and <quote>applied</quote> patches, and there is. MQ "
dongsheng@627 16018 "can manage a patch without it being applied in the repository."
dongsheng@627 16019 msgstr ""
dongsheng@627 16020
dongsheng@627 16021 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16022 #: ../en/ch12-mq.xml:396
dongsheng@627 16023 msgid ""
dongsheng@627 16024 "An <emphasis>applied</emphasis> patch has a corresponding changeset in the "
dongsheng@627 16025 "repository, and the effects of the patch and changeset are visible in the "
dongsheng@627 16026 "working directory. You can undo the application of a patch using the "
dongsheng@627 16027 "<command role=\"hg-ext-mq\">qpop</command> command. MQ still <emphasis>knows "
dongsheng@627 16028 "about</emphasis>, or manages, a popped patch, but the patch no longer has a "
dongsheng@627 16029 "corresponding changeset in the repository, and the working directory does not "
songdongsheng@658 16030 "contain the changes made by the patch. <xref linkend=\"fig:mq:stack\"/> "
songdongsheng@658 16031 "illustrates the difference between applied and tracked patches."
songdongsheng@658 16032 msgstr ""
songdongsheng@658 16033
songdongsheng@658 16034 #. type: Content of: <book><chapter><sect1><sect2><figure><title>
dongsheng@714 16035 #: ../en/ch12-mq.xml:409
songdongsheng@658 16036 msgid "Applied and unapplied patches in the MQ patch stack"
dongsheng@660 16037 msgstr "在 MQ 补丁堆栈中应用和撤销补丁"
songdongsheng@658 16038
songdongsheng@658 16039 #. type: Content of: <book><chapter><sect1><sect2><figure><mediaobject>
dongsheng@714 16040 #: ../en/ch12-mq.xml:412
songdongsheng@658 16041 msgid "<imageobject><imagedata fileref=\"figs/mq-stack.png\"/></imageobject>"
dongsheng@627 16042 msgstr ""
dongsheng@627 16043
dongsheng@627 16044 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16045 #: ../en/ch12-mq.xml:417
dongsheng@627 16046 msgid ""
dongsheng@627 16047 "You can reapply an unapplied, or popped, patch using the <command role=\"hg-"
dongsheng@627 16048 "ext-mq\">qpush</command> command. This creates a new changeset to correspond "
dongsheng@627 16049 "to the patch, and the patch's changes once again become present in the "
dongsheng@627 16050 "working directory. See below for examples of <command role=\"hg-ext-mq"
dongsheng@627 16051 "\">qpop</command> and <command role=\"hg-ext-mq\">qpush</command> in action."
dongsheng@627 16052 msgstr ""
dongsheng@627 16053
dongsheng@627 16054 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16055 #: ../en/ch12-mq.xml:427
dongsheng@627 16056 msgid ""
dongsheng@627 16057 "Notice that once we have popped a patch or two patches, the output of "
dongsheng@627 16058 "<command role=\"hg-ext-mq\">qseries</command> remains the same, while that of "
dongsheng@627 16059 "<command role=\"hg-ext-mq\">qapplied</command> has changed."
dongsheng@627 16060 msgstr ""
dongsheng@627 16061
dongsheng@627 16062 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 16063 #: ../en/ch12-mq.xml:435
dongsheng@627 16064 msgid "Pushing and popping many patches"
dongsheng@636 16065 msgstr "压入或弹出多个补丁"
dongsheng@627 16066
dongsheng@627 16067 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16068 #: ../en/ch12-mq.xml:437
dongsheng@627 16069 msgid ""
dongsheng@627 16070 "While <command role=\"hg-ext-mq\">qpush</command> and <command role=\"hg-ext-"
dongsheng@627 16071 "mq\">qpop</command> each operate on a single patch at a time by default, you "
dongsheng@627 16072 "can push and pop many patches in one go. The <option role=\"hg-ext-mq-cmd-"
dongsheng@1034 16073 "qpush-opt\">-a</option> option to <command role=\"hg-ext-mq\">qpush</command> "
dongsheng@1034 16074 "causes it to push all unapplied patches, while the <option role=\"hg-ext-mq-"
dongsheng@1034 16075 "cmd-qpop-opt\">-a</option> option to <command role=\"hg-ext-mq\">qpop</"
dongsheng@627 16076 "command> causes it to pop all applied patches. (For some more ways to push "
songdongsheng@658 16077 "and pop many patches, see <xref linkend=\"sec:mq:perf\"/> below.)"
dongsheng@627 16078 msgstr ""
dongsheng@627 16079
dongsheng@627 16080 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 16081 #: ../en/ch12-mq.xml:453
dongsheng@627 16082 msgid "Safety checks, and overriding them"
dongsheng@636 16083 msgstr "安全的检查,然后覆盖它们"
dongsheng@627 16084
dongsheng@627 16085 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16086 #: ../en/ch12-mq.xml:455
dongsheng@627 16087 msgid ""
dongsheng@627 16088 "Several MQ commands check the working directory before they do anything, and "
dongsheng@627 16089 "fail if they find any modifications. They do this to ensure that you won't "
dongsheng@627 16090 "lose any changes that you have made, but not yet incorporated into a patch. "
dongsheng@627 16091 "The example below illustrates this; the <command role=\"hg-ext-mq\">qnew</"
dongsheng@627 16092 "command> command will not create a new patch if there are outstanding "
dongsheng@627 16093 "changes, caused in this case by the <command role=\"hg-cmd\">hg add</command> "
dongsheng@627 16094 "of <filename>file3</filename>."
dongsheng@627 16095 msgstr ""
dongsheng@627 16096
dongsheng@627 16097 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16098 #: ../en/ch12-mq.xml:467
dongsheng@627 16099 msgid ""
dongsheng@627 16100 "Commands that check the working directory all take an <quote>I know what I'm "
dongsheng@627 16101 "doing</quote> option, which is always named <option>-f</option>. The exact "
dongsheng@627 16102 "meaning of <option>-f</option> depends on the command. For example, <command "
dongsheng@1034 16103 "role=\"hg-cmd\">hg qnew <option role=\"hg-ext-mq-cmd-qnew-opt\">-f</option></"
dongsheng@1034 16104 "command> will incorporate any outstanding changes into the new patch it "
dongsheng@1034 16105 "creates, but <command role=\"hg-cmd\">hg qpop <option role=\"hg-ext-mq-cmd-"
dongsheng@1034 16106 "qpop-opt\">-f</option></command> will revert modifications to any files "
dongsheng@627 16107 "affected by the patch that it is popping. Be sure to read the documentation "
dongsheng@627 16108 "for a command's <option>-f</option> option before you use it!"
dongsheng@627 16109 msgstr ""
dongsheng@627 16110
dongsheng@627 16111 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 16112 #: ../en/ch12-mq.xml:482
dongsheng@627 16113 msgid "Working on several patches at once"
dongsheng@636 16114 msgstr "同时处理多个补丁"
dongsheng@627 16115
dongsheng@627 16116 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16117 #: ../en/ch12-mq.xml:484
dongsheng@627 16118 msgid ""
dongsheng@627 16119 "The <command role=\"hg-ext-mq\">qrefresh</command> command always refreshes "
dongsheng@627 16120 "the <emphasis>topmost</emphasis> applied patch. This means that you can "
dongsheng@627 16121 "suspend work on one patch (by refreshing it), pop or push to make a different "
dongsheng@627 16122 "patch the top, and work on <emphasis>that</emphasis> patch for a while."
dongsheng@627 16123 msgstr ""
dongsheng@627 16124
dongsheng@627 16125 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16126 #: ../en/ch12-mq.xml:491
dongsheng@627 16127 msgid ""
dongsheng@627 16128 "Here's an example that illustrates how you can use this ability. Let's say "
dongsheng@627 16129 "you're developing a new feature as two patches. The first is a change to the "
songdongsheng@668 16130 "core of your software, and the second&emdash;layered on top of the "
songdongsheng@668 16131 "first&emdash;changes the user interface to use the code you just added to the "
songdongsheng@668 16132 "core. If you notice a bug in the core while you're working on the UI patch, "
songdongsheng@668 16133 "it's easy to fix the core. Simply <command role=\"hg-ext-mq\">qrefresh</"
songdongsheng@668 16134 "command> the UI patch to save your in-progress changes, and <command role="
songdongsheng@668 16135 "\"hg-ext-mq\">qpop</command> down to the core patch. Fix the core bug, "
songdongsheng@668 16136 "<command role=\"hg-ext-mq\">qrefresh</command> the core patch, and <command "
songdongsheng@668 16137 "role=\"hg-ext-mq\">qpush</command> back to the UI patch to continue where you "
songdongsheng@668 16138 "left off."
dongsheng@627 16139 msgstr ""
dongsheng@627 16140
dongsheng@627 16141 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 16142 #: ../en/ch12-mq.xml:508
dongsheng@627 16143 msgid "More about patches"
dongsheng@636 16144 msgstr "关于补丁的更多信息"
dongsheng@627 16145
dongsheng@627 16146 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16147 #: ../en/ch12-mq.xml:510
dongsheng@627 16148 msgid ""
dongsheng@627 16149 "MQ uses the GNU <command>patch</command> command to apply patches, so it's "
dongsheng@627 16150 "helpful to know a few more detailed aspects of how <command>patch</command> "
dongsheng@627 16151 "works, and about patches themselves."
dongsheng@627 16152 msgstr ""
dongsheng@627 16153
dongsheng@627 16154 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 16155 #: ../en/ch12-mq.xml:516
dongsheng@627 16156 msgid "The strip count"
dongsheng@636 16157 msgstr "修剪计数"
dongsheng@627 16158
dongsheng@627 16159 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16160 #: ../en/ch12-mq.xml:518
dongsheng@627 16161 msgid ""
dongsheng@627 16162 "If you look at the file headers in a patch, you will notice that the "
dongsheng@627 16163 "pathnames usually have an extra component on the front that isn't present in "
dongsheng@627 16164 "the actual path name. This is a holdover from the way that people used to "
dongsheng@627 16165 "generate patches (people still do this, but it's somewhat rare with modern "
dongsheng@627 16166 "revision control tools)."
dongsheng@627 16167 msgstr ""
dongsheng@627 16168
dongsheng@627 16169 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16170 #: ../en/ch12-mq.xml:525
dongsheng@627 16171 msgid ""
dongsheng@627 16172 "Alice would unpack a tarball, edit her files, then decide that she wanted to "
dongsheng@627 16173 "create a patch. So she'd rename her working directory, unpack the tarball "
dongsheng@627 16174 "again (hence the need for the rename), and use the <option role=\"cmd-opt-diff"
dongsheng@627 16175 "\">-r</option> and <option role=\"cmd-opt-diff\">-N</option> options to "
dongsheng@627 16176 "<command>diff</command> to recursively generate a patch between the "
dongsheng@627 16177 "unmodified directory and the modified one. The result would be that the name "
dongsheng@627 16178 "of the unmodified directory would be at the front of the left-hand path in "
dongsheng@627 16179 "every file header, and the name of the modified directory would be at the "
dongsheng@627 16180 "front of the right-hand path."
dongsheng@627 16181 msgstr ""
dongsheng@627 16182
dongsheng@627 16183 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16184 #: ../en/ch12-mq.xml:538
dongsheng@627 16185 msgid ""
dongsheng@627 16186 "Since someone receiving a patch from the Alices of the net would be unlikely "
dongsheng@627 16187 "to have unmodified and modified directories with exactly the same names, the "
dongsheng@627 16188 "<command>patch</command> command has a <option role=\"cmd-opt-patch\">-p</"
dongsheng@627 16189 "option> option that indicates the number of leading path name components to "
dongsheng@627 16190 "strip when trying to apply a patch. This number is called the "
dongsheng@627 16191 "<emphasis>strip count</emphasis>."
dongsheng@627 16192 msgstr ""
dongsheng@627 16193
dongsheng@627 16194 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16195 #: ../en/ch12-mq.xml:546
dongsheng@627 16196 msgid ""
dongsheng@627 16197 "An option of <quote><literal>-p1</literal></quote> means <quote>use a strip "
dongsheng@627 16198 "count of one</quote>. If <command>patch</command> sees a file name "
dongsheng@627 16199 "<filename>foo/bar/baz</filename> in a file header, it will strip "
dongsheng@627 16200 "<filename>foo</filename> and try to patch a file named <filename>bar/baz</"
dongsheng@627 16201 "filename>. (Strictly speaking, the strip count refers to the number of "
dongsheng@627 16202 "<emphasis>path separators</emphasis> (and the components that go with them ) "
dongsheng@627 16203 "to strip. A strip count of one will turn <filename>foo/bar</filename> into "
dongsheng@627 16204 "<filename>bar</filename>, but <filename>/foo/bar</filename> (notice the extra "
dongsheng@627 16205 "leading slash) into <filename>foo/bar</filename>.)"
dongsheng@627 16206 msgstr ""
dongsheng@627 16207
dongsheng@627 16208 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16209 #: ../en/ch12-mq.xml:559
dongsheng@627 16210 msgid ""
dongsheng@627 16211 "The <quote>standard</quote> strip count for patches is one; almost all "
dongsheng@627 16212 "patches contain one leading path name component that needs to be stripped. "
dongsheng@627 16213 "Mercurial's <command role=\"hg-cmd\">hg diff</command> command generates path "
dongsheng@627 16214 "names in this form, and the <command role=\"hg-cmd\">hg import</command> "
dongsheng@627 16215 "command and MQ expect patches to have a strip count of one."
dongsheng@627 16216 msgstr ""
dongsheng@627 16217
dongsheng@627 16218 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16219 #: ../en/ch12-mq.xml:567
dongsheng@627 16220 msgid ""
dongsheng@627 16221 "If you receive a patch from someone that you want to add to your patch queue, "
dongsheng@627 16222 "and the patch needs a strip count other than one, you cannot just <command "
dongsheng@627 16223 "role=\"hg-ext-mq\">qimport</command> the patch, because <command role=\"hg-"
dongsheng@627 16224 "ext-mq\">qimport</command> does not yet have a <literal>-p</literal> option "
dongsheng@627 16225 "(see <ulink role=\"hg-bug\" url=\"http://www.selenic.com/mercurial/bts/"
dongsheng@627 16226 "issue311\">issue 311</ulink>). Your best bet is to <command role=\"hg-ext-mq"
dongsheng@627 16227 "\">qnew</command> a patch of your own, then use <command>patch -pN</command> "
dongsheng@627 16228 "to apply their patch, followed by <command role=\"hg-cmd\">hg addremove</"
dongsheng@627 16229 "command> to pick up any files added or removed by the patch, followed by "
dongsheng@627 16230 "<command role=\"hg-ext-mq\">hg qrefresh</command>. This complexity may become "
dongsheng@627 16231 "unnecessary; see <ulink role=\"hg-bug\" url=\"http://www.selenic.com/"
dongsheng@627 16232 "mercurial/bts/issue311\">issue 311</ulink> for details."
dongsheng@627 16233 msgstr ""
dongsheng@627 16234
dongsheng@627 16235 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 16236 #: ../en/ch12-mq.xml:587
dongsheng@627 16237 msgid "Strategies for applying a patch"
dongsheng@636 16238 msgstr "应用补丁的策略"
dongsheng@627 16239
dongsheng@627 16240 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16241 #: ../en/ch12-mq.xml:589
dongsheng@627 16242 msgid ""
dongsheng@627 16243 "When <command>patch</command> applies a hunk, it tries a handful of "
dongsheng@627 16244 "successively less accurate strategies to try to make the hunk apply. This "
dongsheng@627 16245 "falling-back technique often makes it possible to take a patch that was "
dongsheng@627 16246 "generated against an old version of a file, and apply it against a newer "
dongsheng@627 16247 "version of that file."
dongsheng@627 16248 msgstr ""
dongsheng@627 16249
dongsheng@627 16250 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16251 #: ../en/ch12-mq.xml:596
dongsheng@627 16252 msgid ""
dongsheng@627 16253 "First, <command>patch</command> tries an exact match, where the line numbers, "
dongsheng@627 16254 "the context, and the text to be modified must apply exactly. If it cannot "
dongsheng@627 16255 "make an exact match, it tries to find an exact match for the context, without "
dongsheng@627 16256 "honouring the line numbering information. If this succeeds, it prints a line "
dongsheng@627 16257 "of output saying that the hunk was applied, but at some <emphasis>offset</"
dongsheng@627 16258 "emphasis> from the original line number."
dongsheng@627 16259 msgstr ""
dongsheng@627 16260
dongsheng@627 16261 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16262 #: ../en/ch12-mq.xml:605
dongsheng@627 16263 msgid ""
dongsheng@627 16264 "If a context-only match fails, <command>patch</command> removes the first and "
dongsheng@627 16265 "last lines of the context, and tries a <emphasis>reduced</emphasis> context-"
dongsheng@627 16266 "only match. If the hunk with reduced context succeeds, it prints a message "
dongsheng@627 16267 "saying that it applied the hunk with a <emphasis>fuzz factor</emphasis> (the "
dongsheng@627 16268 "number after the fuzz factor indicates how many lines of context "
dongsheng@627 16269 "<command>patch</command> had to trim before the patch applied)."
dongsheng@627 16270 msgstr ""
dongsheng@627 16271
dongsheng@627 16272 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16273 #: ../en/ch12-mq.xml:614
dongsheng@627 16274 msgid ""
dongsheng@627 16275 "When neither of these techniques works, <command>patch</command> prints a "
dongsheng@627 16276 "message saying that the hunk in question was rejected. It saves rejected "
dongsheng@627 16277 "hunks (also simply called <quote>rejects</quote>) to a file with the same "
dongsheng@627 16278 "name, and an added <filename role=\"special\">.rej</filename> extension. It "
dongsheng@627 16279 "also saves an unmodified copy of the file with a <filename role=\"special\">."
dongsheng@627 16280 "orig</filename> extension; the copy of the file without any extensions will "
dongsheng@627 16281 "contain any changes made by hunks that <emphasis>did</emphasis> apply "
dongsheng@627 16282 "cleanly. If you have a patch that modifies <filename>foo</filename> with six "
dongsheng@627 16283 "hunks, and one of them fails to apply, you will have: an unmodified "
dongsheng@627 16284 "<filename>foo.orig</filename>, a <filename>foo.rej</filename> containing one "
dongsheng@627 16285 "hunk, and <filename>foo</filename>, containing the changes made by the five "
dongsheng@627 16286 "successful hunks."
dongsheng@627 16287 msgstr ""
dongsheng@627 16288
dongsheng@627 16289 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 16290 #: ../en/ch12-mq.xml:632
dongsheng@627 16291 msgid "Some quirks of patch representation"
dongsheng@636 16292 msgstr "补丁的一些特性"
dongsheng@627 16293
dongsheng@627 16294 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16295 #: ../en/ch12-mq.xml:634
dongsheng@627 16296 msgid ""
dongsheng@627 16297 "There are a few useful things to know about how <command>patch</command> "
dongsheng@627 16298 "works with files."
dongsheng@627 16299 msgstr ""
dongsheng@627 16300
dongsheng@627 16301 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 16302 #: ../en/ch12-mq.xml:637
dongsheng@627 16303 msgid ""
dongsheng@627 16304 "This should already be obvious, but <command>patch</command> cannot handle "
dongsheng@627 16305 "binary files."
dongsheng@627 16306 msgstr ""
dongsheng@627 16307
dongsheng@627 16308 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 16309 #: ../en/ch12-mq.xml:641
dongsheng@627 16310 msgid ""
dongsheng@627 16311 "Neither does it care about the executable bit; it creates new files as "
dongsheng@627 16312 "readable, but not executable."
dongsheng@627 16313 msgstr ""
dongsheng@627 16314
dongsheng@627 16315 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 16316 #: ../en/ch12-mq.xml:645
dongsheng@627 16317 msgid ""
dongsheng@627 16318 "<command>patch</command> treats the removal of a file as a diff between the "
dongsheng@627 16319 "file to be removed and the empty file. So your idea of <quote>I deleted this "
dongsheng@627 16320 "file</quote> looks like <quote>every line of this file was deleted</quote> in "
dongsheng@627 16321 "a patch."
dongsheng@627 16322 msgstr ""
dongsheng@627 16323
dongsheng@627 16324 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 16325 #: ../en/ch12-mq.xml:651
dongsheng@627 16326 msgid ""
dongsheng@627 16327 "It treats the addition of a file as a diff between the empty file and the "
dongsheng@627 16328 "file to be added. So in a patch, your idea of <quote>I added this file</"
dongsheng@627 16329 "quote> looks like <quote>every line of this file was added</quote>."
dongsheng@627 16330 msgstr ""
dongsheng@627 16331
dongsheng@627 16332 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 16333 #: ../en/ch12-mq.xml:657
dongsheng@627 16334 msgid ""
dongsheng@627 16335 "It treats a renamed file as the removal of the old name, and the addition of "
dongsheng@627 16336 "the new name. This means that renamed files have a big footprint in "
dongsheng@627 16337 "patches. (Note also that Mercurial does not currently try to infer when "
dongsheng@627 16338 "files have been renamed or copied in a patch.)"
dongsheng@627 16339 msgstr ""
dongsheng@627 16340
dongsheng@627 16341 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 16342 #: ../en/ch12-mq.xml:663
dongsheng@627 16343 msgid ""
dongsheng@627 16344 "<command>patch</command> cannot represent empty files, so you cannot use a "
dongsheng@627 16345 "patch to represent the notion <quote>I added this empty file to the tree</"
dongsheng@627 16346 "quote>."
dongsheng@627 16347 msgstr ""
dongsheng@627 16348
dongsheng@627 16349 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 16350 #: ../en/ch12-mq.xml:671
dongsheng@627 16351 msgid "Beware the fuzz"
dongsheng@636 16352 msgstr "当心毛刺"
dongsheng@627 16353
dongsheng@627 16354 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16355 #: ../en/ch12-mq.xml:673
dongsheng@627 16356 msgid ""
dongsheng@627 16357 "While applying a hunk at an offset, or with a fuzz factor, will often be "
dongsheng@627 16358 "completely successful, these inexact techniques naturally leave open the "
dongsheng@627 16359 "possibility of corrupting the patched file. The most common cases typically "
dongsheng@627 16360 "involve applying a patch twice, or at an incorrect location in the file. If "
dongsheng@627 16361 "<command>patch</command> or <command role=\"hg-ext-mq\">qpush</command> ever "
dongsheng@627 16362 "mentions an offset or fuzz factor, you should make sure that the modified "
dongsheng@627 16363 "files are correct afterwards."
dongsheng@627 16364 msgstr ""
dongsheng@627 16365
dongsheng@627 16366 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16367 #: ../en/ch12-mq.xml:683
dongsheng@627 16368 msgid ""
dongsheng@627 16369 "It's often a good idea to refresh a patch that has applied with an offset or "
dongsheng@627 16370 "fuzz factor; refreshing the patch generates new context information that will "
dongsheng@627 16371 "make it apply cleanly. I say <quote>often,</quote> not <quote>always,</"
dongsheng@627 16372 "quote> because sometimes refreshing a patch will make it fail to apply "
dongsheng@627 16373 "against a different revision of the underlying files. In some cases, such as "
dongsheng@627 16374 "when you're maintaining a patch that must sit on top of multiple versions of "
dongsheng@627 16375 "a source tree, it's acceptable to have a patch apply with some fuzz, provided "
dongsheng@627 16376 "you've verified the results of the patching process in such cases."
dongsheng@627 16377 msgstr ""
dongsheng@627 16378
dongsheng@627 16379 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 16380 #: ../en/ch12-mq.xml:696
dongsheng@627 16381 msgid "Handling rejection"
dongsheng@636 16382 msgstr "处理拒绝"
dongsheng@627 16383
dongsheng@627 16384 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16385 #: ../en/ch12-mq.xml:698
dongsheng@627 16386 msgid ""
dongsheng@627 16387 "If <command role=\"hg-ext-mq\">qpush</command> fails to apply a patch, it "
dongsheng@627 16388 "will print an error message and exit. If it has left <filename role=\"special"
dongsheng@627 16389 "\">.rej</filename> files behind, it is usually best to fix up the rejected "
dongsheng@627 16390 "hunks before you push more patches or do any further work."
dongsheng@627 16391 msgstr ""
dongsheng@627 16392
dongsheng@627 16393 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16394 #: ../en/ch12-mq.xml:704
dongsheng@627 16395 msgid ""
dongsheng@627 16396 "If your patch <emphasis>used to</emphasis> apply cleanly, and no longer does "
dongsheng@627 16397 "because you've changed the underlying code that your patches are based on, "
songdongsheng@658 16398 "Mercurial Queues can help; see <xref linkend=\"sec:mq:merge\"/> for details."
songdongsheng@658 16399 msgstr ""
songdongsheng@658 16400
songdongsheng@658 16401 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16402 #: ../en/ch12-mq.xml:709
dongsheng@627 16403 msgid ""
dongsheng@627 16404 "Unfortunately, there aren't any great techniques for dealing with rejected "
dongsheng@627 16405 "hunks. Most often, you'll need to view the <filename role=\"special\">.rej</"
dongsheng@627 16406 "filename> file and edit the target file, applying the rejected hunks by hand."
dongsheng@627 16407 msgstr ""
dongsheng@627 16408
dongsheng@627 16409 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16410 #: ../en/ch12-mq.xml:714
dongsheng@714 16411 msgid ""
dongsheng@714 16412 "A Linux kernel hacker, Chris Mason (the author of Mercurial Queues), wrote a "
dongsheng@714 16413 "tool called <command>mpatch</command> (<ulink url=\"http://oss.oracle.com/"
dongsheng@714 16414 "~mason/mpatch/\">http://oss.oracle.com/~mason/mpatch/</ulink>), which takes a "
dongsheng@714 16415 "simple approach to automating the application of hunks rejected by "
dongsheng@714 16416 "<command>patch</command>. The <command>mpatch</command> command can help "
dongsheng@714 16417 "with four common reasons that a hunk may be rejected:"
dongsheng@627 16418 msgstr ""
dongsheng@627 16419
dongsheng@627 16420 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 16421 #: ../en/ch12-mq.xml:724
dongsheng@627 16422 msgid "The context in the middle of a hunk has changed."
dongsheng@627 16423 msgstr ""
dongsheng@627 16424
dongsheng@627 16425 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 16426 #: ../en/ch12-mq.xml:727
dongsheng@627 16427 msgid "A hunk is missing some context at the beginning or end."
dongsheng@627 16428 msgstr ""
dongsheng@627 16429
dongsheng@627 16430 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 16431 #: ../en/ch12-mq.xml:730
dongsheng@627 16432 msgid ""
songdongsheng@668 16433 "A large hunk might apply better&emdash;either entirely or in part&emdash;if "
songdongsheng@668 16434 "it was broken up into smaller hunks."
dongsheng@627 16435 msgstr ""
dongsheng@627 16436
dongsheng@627 16437 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 16438 #: ../en/ch12-mq.xml:734
dongsheng@627 16439 msgid ""
dongsheng@627 16440 "A hunk removes lines with slightly different content than those currently "
dongsheng@627 16441 "present in the file."
dongsheng@627 16442 msgstr ""
dongsheng@627 16443
dongsheng@627 16444 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16445 #: ../en/ch12-mq.xml:738
dongsheng@714 16446 msgid ""
dongsheng@714 16447 "If you use <command>mpatch</command>, you should be doubly careful to check "
dongsheng@714 16448 "your results when you're done. In fact, <command>mpatch</command> enforces "
dongsheng@714 16449 "this method of double-checking the tool's output, by automatically dropping "
dongsheng@714 16450 "you into a merge program when it has done its job, so that you can verify its "
dongsheng@714 16451 "work and finish off any remaining merges."
dongsheng@627 16452 msgstr ""
dongsheng@627 16453
dongsheng@627 16454 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 16455 #: ../en/ch12-mq.xml:749
dongsheng@714 16456 msgid "More on patch management"
dongsheng@715 16457 msgstr "补丁管理进阶"
dongsheng@714 16458
dongsheng@714 16459 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16460 #: ../en/ch12-mq.xml:751
dongsheng@714 16461 msgid ""
dongsheng@714 16462 "As you grow familiar with MQ, you will find yourself wanting to perform other "
dongsheng@714 16463 "kinds of patch management operations."
dongsheng@714 16464 msgstr ""
dongsheng@714 16465
dongsheng@714 16466 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 16467 #: ../en/ch12-mq.xml:755
dongsheng@714 16468 msgid "Deleting unwanted patches"
dongsheng@715 16469 msgstr "删除不需要的补丁"
dongsheng@714 16470
dongsheng@714 16471 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16472 #: ../en/ch12-mq.xml:757
dongsheng@714 16473 msgid ""
dongsheng@714 16474 "If you want to get rid of a patch, use the <command role=\"hg-ext-mq\">hg "
dongsheng@714 16475 "qdelete</command> command to delete the patch file and remove its entry from "
dongsheng@714 16476 "the patch series. If you try to delete a patch that is still applied, "
dongsheng@714 16477 "<command role=\"hg-ext-mq\">hg qdelete</command> will refuse."
dongsheng@714 16478 msgstr ""
dongsheng@714 16479
dongsheng@714 16480 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 16481 #: ../en/ch12-mq.xml:767
dongsheng@714 16482 msgid "Converting to and from permanent revisions"
dongsheng@716 16483 msgstr "与持久版本的相互转换"
dongsheng@714 16484
dongsheng@714 16485 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16486 #: ../en/ch12-mq.xml:769
dongsheng@714 16487 msgid ""
dongsheng@714 16488 "Once you're done working on a patch and want to turn it into a permanent "
dongsheng@714 16489 "changeset, use the <command role=\"hg-ext-mq\">hg qfinish</command> command. "
dongsheng@714 16490 "Pass a revision to the command to identify the patch that you want to turn "
dongsheng@714 16491 "into a regular changeset; this patch must already be applied."
dongsheng@714 16492 msgstr ""
dongsheng@714 16493
dongsheng@714 16494 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16495 #: ../en/ch12-mq.xml:777
dongsheng@714 16496 msgid ""
dongsheng@714 16497 "The <command role=\"hg-ext-mq\">hg qfinish</command> command accepts an "
dongsheng@714 16498 "<option>--all</option> or <option>-a</option> option, which turns all applied "
dongsheng@714 16499 "patches into regular changesets."
dongsheng@714 16500 msgstr ""
dongsheng@714 16501
dongsheng@714 16502 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16503 #: ../en/ch12-mq.xml:782
dongsheng@714 16504 msgid ""
dongsheng@714 16505 "It is also possible to turn an existing changeset into a patch, by passing "
dongsheng@714 16506 "the <option>-r</option> option to <command role=\"hg-ext-mq\">hg qimport</"
dongsheng@714 16507 "command>."
dongsheng@714 16508 msgstr ""
dongsheng@714 16509
dongsheng@714 16510 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16511 #: ../en/ch12-mq.xml:788
dongsheng@714 16512 msgid ""
dongsheng@714 16513 "Note that it only makes sense to convert a changeset into a patch if you have "
dongsheng@714 16514 "not propagated that changeset into any other repositories. The imported "
dongsheng@714 16515 "changeset's ID will change every time you refresh the patch, which will make "
dongsheng@714 16516 "Mercurial treat it as unrelated to the original changeset if you have pushed "
dongsheng@714 16517 "it somewhere else."
dongsheng@714 16518 msgstr ""
dongsheng@714 16519
dongsheng@714 16520 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 16521 #: ../en/ch12-mq.xml:798
dongsheng@627 16522 msgid "Getting the best performance out of MQ"
dongsheng@636 16523 msgstr "MQ 的性能"
dongsheng@627 16524
dongsheng@627 16525 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16526 #: ../en/ch12-mq.xml:800
dongsheng@714 16527 msgid ""
dongsheng@714 16528 "MQ is very efficient at handling a large number of patches. I ran some "
dongsheng@627 16529 "performance experiments in mid-2006 for a talk that I gave at the 2006 "
dongsheng@714 16530 "EuroPython conference (on modern hardware, you should expect better "
dongsheng@714 16531 "performance than you'll see below). I used as my data set the Linux 2.6.17-"
dongsheng@714 16532 "mm1 patch series, which consists of 1,738 patches. I applied these on top of "
dongsheng@714 16533 "a Linux kernel repository containing all 27,472 revisions between Linux "
dongsheng@714 16534 "2.6.12-rc2 and Linux 2.6.17."
dongsheng@714 16535 msgstr ""
dongsheng@714 16536
dongsheng@714 16537 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16538 #: ../en/ch12-mq.xml:809
dongsheng@627 16539 msgid ""
dongsheng@627 16540 "On my old, slow laptop, I was able to <command role=\"hg-cmd\">hg qpush "
dongsheng@1034 16541 "<option role=\"hg-ext-mq-cmd-qpush-opt\">-a</option></command> all 1,738 "
dongsheng@627 16542 "patches in 3.5 minutes, and <command role=\"hg-cmd\">hg qpop <option role="
dongsheng@1034 16543 "\"hg-ext-mq-cmd-qpop-opt\">-a</option></command> them all in 30 seconds. (On "
dongsheng@1034 16544 "a newer laptop, the time to push all patches dropped to two minutes.) I "
dongsheng@627 16545 "could <command role=\"hg-ext-mq\">qrefresh</command> one of the biggest "
dongsheng@627 16546 "patches (which made 22,779 lines of changes to 287 files) in 6.6 seconds."
dongsheng@627 16547 msgstr ""
dongsheng@627 16548
dongsheng@627 16549 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16550 #: ../en/ch12-mq.xml:820
dongsheng@627 16551 msgid ""
dongsheng@627 16552 "Clearly, MQ is well suited to working in large trees, but there are a few "
dongsheng@627 16553 "tricks you can use to get the best performance of it."
dongsheng@627 16554 msgstr ""
dongsheng@627 16555
dongsheng@627 16556 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16557 #: ../en/ch12-mq.xml:824
dongsheng@627 16558 msgid ""
dongsheng@627 16559 "First of all, try to <quote>batch</quote> operations together. Every time "
dongsheng@627 16560 "you run <command role=\"hg-ext-mq\">qpush</command> or <command role=\"hg-ext-"
dongsheng@627 16561 "mq\">qpop</command>, these commands scan the working directory once to make "
dongsheng@627 16562 "sure you haven't made some changes and then forgotten to run <command role="
dongsheng@627 16563 "\"hg-ext-mq\">qrefresh</command>. On a small tree, the time that this scan "
dongsheng@627 16564 "takes is unnoticeable. However, on a medium-sized tree (containing tens of "
dongsheng@627 16565 "thousands of files), it can take a second or more."
dongsheng@627 16566 msgstr ""
dongsheng@627 16567
dongsheng@627 16568 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16569 #: ../en/ch12-mq.xml:835
dongsheng@627 16570 msgid ""
dongsheng@627 16571 "The <command role=\"hg-ext-mq\">qpush</command> and <command role=\"hg-ext-mq"
dongsheng@627 16572 "\">qpop</command> commands allow you to push and pop multiple patches at a "
dongsheng@627 16573 "time. You can identify the <quote>destination patch</quote> that you want to "
dongsheng@627 16574 "end up at. When you <command role=\"hg-ext-mq\">qpush</command> with a "
dongsheng@627 16575 "destination specified, it will push patches until that patch is at the top of "
dongsheng@627 16576 "the applied stack. When you <command role=\"hg-ext-mq\">qpop</command> to a "
dongsheng@627 16577 "destination, MQ will pop patches until the destination patch is at the top."
dongsheng@627 16578 msgstr ""
dongsheng@627 16579
dongsheng@627 16580 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16581 #: ../en/ch12-mq.xml:845
dongsheng@627 16582 msgid ""
dongsheng@627 16583 "You can identify a destination patch using either the name of the patch, or "
dongsheng@627 16584 "by number. If you use numeric addressing, patches are counted from zero; "
dongsheng@627 16585 "this means that the first patch is zero, the second is one, and so on."
dongsheng@627 16586 msgstr ""
dongsheng@627 16587
dongsheng@627 16588 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 16589 #: ../en/ch12-mq.xml:852
dongsheng@627 16590 msgid "Updating your patches when the underlying code changes"
dongsheng@636 16591 msgstr "当基础代码改变时,更新补丁的方法"
dongsheng@627 16592
dongsheng@627 16593 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16594 #: ../en/ch12-mq.xml:855
dongsheng@627 16595 msgid ""
dongsheng@627 16596 "It's common to have a stack of patches on top of an underlying repository "
dongsheng@627 16597 "that you don't modify directly. If you're working on changes to third-party "
dongsheng@627 16598 "code, or on a feature that is taking longer to develop than the rate of "
dongsheng@627 16599 "change of the code beneath, you will often need to sync up with the "
dongsheng@627 16600 "underlying code, and fix up any hunks in your patches that no longer apply. "
dongsheng@627 16601 "This is called <emphasis>rebasing</emphasis> your patch series."
dongsheng@627 16602 msgstr ""
dongsheng@627 16603
dongsheng@627 16604 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16605 #: ../en/ch12-mq.xml:864
dongsheng@627 16606 msgid ""
dongsheng@627 16607 "The simplest way to do this is to <command role=\"hg-cmd\">hg qpop <option "
dongsheng@627 16608 "role=\"hg-ext-mq-cmd-qpop-opt\">hg -a</option></command> your patches, then "
dongsheng@627 16609 "<command role=\"hg-cmd\">hg pull</command> changes into the underlying "
dongsheng@627 16610 "repository, and finally <command role=\"hg-cmd\">hg qpush <option role=\"hg-"
dongsheng@1034 16611 "ext-mq-cmd-qpop-opt\">-a</option></command> your patches again. MQ will stop "
dongsheng@1034 16612 "pushing any time it runs across a patch that fails to apply during conflicts, "
dongsheng@1034 16613 "allowing you to fix your conflicts, <command role=\"hg-ext-mq\">qrefresh</"
dongsheng@1034 16614 "command> the affected patch, and continue pushing until you have fixed your "
dongsheng@1034 16615 "entire stack."
dongsheng@627 16616 msgstr ""
dongsheng@627 16617
dongsheng@627 16618 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16619 #: ../en/ch12-mq.xml:876
dongsheng@627 16620 msgid ""
dongsheng@627 16621 "This approach is easy to use and works well if you don't expect changes to "
dongsheng@627 16622 "the underlying code to affect how well your patches apply. If your patch "
dongsheng@627 16623 "stack touches code that is modified frequently or invasively in the "
dongsheng@627 16624 "underlying repository, however, fixing up rejected hunks by hand quickly "
dongsheng@627 16625 "becomes tiresome."
dongsheng@627 16626 msgstr ""
dongsheng@627 16627
dongsheng@627 16628 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16629 #: ../en/ch12-mq.xml:883
dongsheng@627 16630 msgid ""
dongsheng@627 16631 "It's possible to partially automate the rebasing process. If your patches "
dongsheng@627 16632 "apply cleanly against some revision of the underlying repo, MQ can use this "
dongsheng@627 16633 "information to help you to resolve conflicts between your patches and a "
dongsheng@627 16634 "different revision."
dongsheng@627 16635 msgstr ""
dongsheng@627 16636
dongsheng@627 16637 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16638 #: ../en/ch12-mq.xml:889
songdongsheng@658 16639 msgid "The process is a little involved."
songdongsheng@658 16640 msgstr ""
songdongsheng@658 16641
songdongsheng@658 16642 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
dongsheng@714 16643 #: ../en/ch12-mq.xml:891
dongsheng@627 16644 msgid ""
dongsheng@627 16645 "To begin, <command role=\"hg-cmd\">hg qpush -a</command> all of your patches "
dongsheng@627 16646 "on top of the revision where you know that they apply cleanly."
dongsheng@627 16647 msgstr ""
dongsheng@627 16648
dongsheng@627 16649 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
dongsheng@714 16650 #: ../en/ch12-mq.xml:895
dongsheng@627 16651 msgid ""
dongsheng@627 16652 "Save a backup copy of your patch directory using <command role=\"hg-cmd\">hg "
dongsheng@627 16653 "qsave <option role=\"hg-ext-mq-cmd-qsave-opt\">hg -e</option> <option role="
dongsheng@627 16654 "\"hg-ext-mq-cmd-qsave-opt\">hg -c</option></command>. This prints the name "
dongsheng@627 16655 "of the directory that it has saved the patches in. It will save the patches "
dongsheng@627 16656 "to a directory called <filename role=\"special\" class=\"directory\">.hg/"
dongsheng@627 16657 "patches.N</filename>, where <literal>N</literal> is a small integer. It also "
dongsheng@627 16658 "commits a <quote>save changeset</quote> on top of your applied patches; this "
dongsheng@627 16659 "is for internal book-keeping, and records the states of the <filename role="
dongsheng@627 16660 "\"special\">series</filename> and <filename role=\"special\">status</"
dongsheng@627 16661 "filename> files."
dongsheng@627 16662 msgstr ""
dongsheng@627 16663
dongsheng@627 16664 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
dongsheng@714 16665 #: ../en/ch12-mq.xml:909
dongsheng@627 16666 msgid ""
dongsheng@627 16667 "Use <command role=\"hg-cmd\">hg pull</command> to bring new changes into the "
dongsheng@627 16668 "underlying repository. (Don't run <command role=\"hg-cmd\">hg pull -u</"
dongsheng@627 16669 "command>; see below for why.)"
dongsheng@627 16670 msgstr ""
dongsheng@627 16671
dongsheng@627 16672 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
dongsheng@714 16673 #: ../en/ch12-mq.xml:914
dongsheng@627 16674 msgid ""
dongsheng@627 16675 "Update to the new tip revision, using <command role=\"hg-cmd\">hg update "
dongsheng@627 16676 "<option role=\"hg-opt-update\">-C</option></command> to override the patches "
dongsheng@627 16677 "you have pushed."
dongsheng@627 16678 msgstr ""
dongsheng@627 16679
dongsheng@627 16680 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
dongsheng@714 16681 #: ../en/ch12-mq.xml:919
dongsheng@650 16682 msgid ""
dongsheng@650 16683 "Merge all patches using <command>hg qpush -m -a</command>. The <option role="
dongsheng@650 16684 "\"hg-ext-mq-cmd-qpush-opt\">-m</option> option to <command role=\"hg-ext-mq"
dongsheng@650 16685 "\">qpush</command> tells MQ to perform a three-way merge if the patch fails "
dongsheng@650 16686 "to apply."
dongsheng@650 16687 msgstr ""
dongsheng@650 16688
dongsheng@650 16689 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16690 #: ../en/ch12-mq.xml:927
dongsheng@627 16691 msgid ""
dongsheng@627 16692 "During the <command role=\"hg-cmd\">hg qpush <option role=\"hg-ext-mq-cmd-"
dongsheng@627 16693 "qpush-opt\">hg -m</option></command>, each patch in the <filename role="
dongsheng@627 16694 "\"special\">series</filename> file is applied normally. If a patch applies "
dongsheng@627 16695 "with fuzz or rejects, MQ looks at the queue you <command role=\"hg-ext-mq"
dongsheng@627 16696 "\">qsave</command>d, and performs a three-way merge with the corresponding "
dongsheng@627 16697 "changeset. This merge uses Mercurial's normal merge machinery, so it may pop "
dongsheng@627 16698 "up a GUI merge tool to help you to resolve problems."
dongsheng@627 16699 msgstr ""
dongsheng@627 16700
dongsheng@627 16701 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16702 #: ../en/ch12-mq.xml:937
dongsheng@627 16703 msgid ""
dongsheng@627 16704 "When you finish resolving the effects of a patch, MQ refreshes your patch "
dongsheng@627 16705 "based on the result of the merge."
dongsheng@627 16706 msgstr ""
dongsheng@627 16707
dongsheng@627 16708 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16709 #: ../en/ch12-mq.xml:940
dongsheng@627 16710 msgid ""
dongsheng@627 16711 "At the end of this process, your repository will have one extra head from the "
dongsheng@627 16712 "old patch queue, and a copy of the old patch queue will be in <filename role="
dongsheng@627 16713 "\"special\" class=\"directory\">.hg/patches.N</filename>. You can remove the "
dongsheng@627 16714 "extra head using <command role=\"hg-cmd\">hg qpop -a -n patches.N</command> "
dongsheng@627 16715 "or <command role=\"hg-cmd\">hg strip</command>. You can delete <filename "
dongsheng@627 16716 "role=\"special\" class=\"directory\">.hg/patches.N</filename> once you are "
dongsheng@627 16717 "sure that you no longer need it as a backup."
dongsheng@627 16718 msgstr ""
dongsheng@627 16719
dongsheng@627 16720 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 16721 #: ../en/ch12-mq.xml:952
dongsheng@627 16722 msgid "Identifying patches"
dongsheng@636 16723 msgstr "标识补丁"
dongsheng@627 16724
dongsheng@627 16725 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16726 #: ../en/ch12-mq.xml:954
dongsheng@627 16727 msgid ""
dongsheng@627 16728 "MQ commands that work with patches let you refer to a patch either by using "
dongsheng@627 16729 "its name or by a number. By name is obvious enough; pass the name "
dongsheng@627 16730 "<filename>foo.patch</filename> to <command role=\"hg-ext-mq\">qpush</"
dongsheng@627 16731 "command>, for example, and it will push patches until <filename>foo.patch</"
dongsheng@627 16732 "filename> is applied."
dongsheng@627 16733 msgstr ""
dongsheng@627 16734
dongsheng@627 16735 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16736 #: ../en/ch12-mq.xml:961
dongsheng@627 16737 msgid ""
dongsheng@627 16738 "As a shortcut, you can refer to a patch using both a name and a numeric "
dongsheng@627 16739 "offset; <literal>foo.patch-2</literal> means <quote>two patches before "
dongsheng@627 16740 "<literal>foo.patch</literal></quote>, while <literal>bar.patch+4</literal> "
dongsheng@627 16741 "means <quote>four patches after <literal>bar.patch</literal></quote>."
dongsheng@627 16742 msgstr ""
dongsheng@627 16743
dongsheng@627 16744 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16745 #: ../en/ch12-mq.xml:967
dongsheng@627 16746 msgid ""
dongsheng@627 16747 "Referring to a patch by index isn't much different. The first patch printed "
dongsheng@627 16748 "in the output of <command role=\"hg-ext-mq\">qseries</command> is patch zero "
dongsheng@627 16749 "(yes, it's one of those start-at-zero counting systems); the second is patch "
dongsheng@627 16750 "one; and so on."
dongsheng@627 16751 msgstr ""
dongsheng@627 16752
dongsheng@627 16753 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16754 #: ../en/ch12-mq.xml:973
dongsheng@627 16755 msgid ""
dongsheng@627 16756 "MQ also makes it easy to work with patches when you are using normal "
dongsheng@627 16757 "Mercurial commands. Every command that accepts a changeset ID will also "
dongsheng@627 16758 "accept the name of an applied patch. MQ augments the tags normally in the "
dongsheng@627 16759 "repository with an eponymous one for each applied patch. In addition, the "
dongsheng@650 16760 "special tags <literal role=\"tag\">qbase</literal> and <literal role=\"tag"
dongsheng@650 16761 "\">qtip</literal> identify the <quote>bottom-most</quote> and topmost applied "
dongsheng@650 16762 "patches, respectively."
dongsheng@650 16763 msgstr ""
dongsheng@650 16764
dongsheng@650 16765 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16766 #: ../en/ch12-mq.xml:983
dongsheng@627 16767 msgid ""
dongsheng@627 16768 "These additions to Mercurial's normal tagging capabilities make dealing with "
dongsheng@627 16769 "patches even more of a breeze."
dongsheng@627 16770 msgstr ""
dongsheng@627 16771
dongsheng@627 16772 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 16773 #: ../en/ch12-mq.xml:986
dongsheng@627 16774 msgid "Want to patchbomb a mailing list with your latest series of changes?"
dongsheng@627 16775 msgstr ""
dongsheng@627 16776
dongsheng@627 16777 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 16778 #: ../en/ch12-mq.xml:989
songdongsheng@658 16779 msgid ""
songdongsheng@658 16780 "(Don't know what <quote>patchbombing</quote> is? See <xref linkend=\"sec:"
songdongsheng@658 16781 "hgext:patchbomb\"/>.)"
dongsheng@627 16782 msgstr ""
dongsheng@627 16783
dongsheng@627 16784 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 16785 #: ../en/ch12-mq.xml:992
dongsheng@627 16786 msgid ""
dongsheng@627 16787 "Need to see all of the patches since <literal>foo.patch</literal> that have "
dongsheng@627 16788 "touched files in a subdirectory of your tree?"
dongsheng@627 16789 msgstr ""
dongsheng@627 16790
dongsheng@650 16791 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16792 #: ../en/ch12-mq.xml:999
dongsheng@627 16793 msgid ""
dongsheng@627 16794 "Because MQ makes the names of patches available to the rest of Mercurial "
dongsheng@627 16795 "through its normal internal tag machinery, you don't need to type in the "
dongsheng@627 16796 "entire name of a patch when you want to identify it by name."
dongsheng@627 16797 msgstr ""
dongsheng@627 16798
dongsheng@627 16799 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16800 #: ../en/ch12-mq.xml:1004
dongsheng@627 16801 msgid ""
dongsheng@627 16802 "Another nice consequence of representing patch names as tags is that when you "
dongsheng@627 16803 "run the <command role=\"hg-cmd\">hg log</command> command, it will display a "
dongsheng@627 16804 "patch's name as a tag, simply as part of its normal output. This makes it "
dongsheng@627 16805 "easy to visually distinguish applied patches from underlying <quote>normal</"
dongsheng@627 16806 "quote> revisions. The following example shows a few normal Mercurial "
dongsheng@627 16807 "commands in use with applied patches."
dongsheng@627 16808 msgstr ""
dongsheng@627 16809
dongsheng@627 16810 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 16811 #: ../en/ch12-mq.xml:1017
dongsheng@627 16812 msgid "Useful things to know about"
dongsheng@636 16813 msgstr "其它需要了解的东西"
dongsheng@627 16814
dongsheng@627 16815 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16816 #: ../en/ch12-mq.xml:1019
dongsheng@627 16817 msgid ""
dongsheng@627 16818 "There are a number of aspects of MQ usage that don't fit tidily into sections "
dongsheng@627 16819 "of their own, but that are good to know. Here they are, in one place."
dongsheng@627 16820 msgstr ""
dongsheng@627 16821
dongsheng@627 16822 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 16823 #: ../en/ch12-mq.xml:1024
dongsheng@627 16824 msgid ""
dongsheng@627 16825 "Normally, when you <command role=\"hg-ext-mq\">qpop</command> a patch and "
dongsheng@627 16826 "<command role=\"hg-ext-mq\">qpush</command> it again, the changeset that "
dongsheng@627 16827 "represents the patch after the pop/push will have a <emphasis>different "
dongsheng@627 16828 "identity</emphasis> than the changeset that represented the hash beforehand. "
songdongsheng@658 16829 "See <xref linkend=\"sec:mqref:cmd:qpush\"/> for information as to why this is."
dongsheng@627 16830 msgstr ""
dongsheng@627 16831
dongsheng@627 16832 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 16833 #: ../en/ch12-mq.xml:1033
dongsheng@627 16834 msgid ""
dongsheng@627 16835 "It's not a good idea to <command role=\"hg-cmd\">hg merge</command> changes "
dongsheng@627 16836 "from another branch with a patch changeset, at least if you want to maintain "
dongsheng@627 16837 "the <quote>patchiness</quote> of that changeset and changesets below it on "
dongsheng@627 16838 "the patch stack. If you try to do this, it will appear to succeed, but MQ "
dongsheng@627 16839 "will become confused."
dongsheng@627 16840 msgstr ""
dongsheng@627 16841
dongsheng@627 16842 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 16843 #: ../en/ch12-mq.xml:1044
dongsheng@627 16844 msgid "Managing patches in a repository"
dongsheng@636 16845 msgstr "在版本库管理补丁"
dongsheng@627 16846
dongsheng@627 16847 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16848 #: ../en/ch12-mq.xml:1046
dongsheng@627 16849 msgid ""
dongsheng@627 16850 "Because MQ's <filename role=\"special\" class=\"directory\">.hg/patches</"
dongsheng@627 16851 "filename> directory resides outside a Mercurial repository's working "
dongsheng@627 16852 "directory, the <quote>underlying</quote> Mercurial repository knows nothing "
dongsheng@627 16853 "about the management or presence of patches."
dongsheng@627 16854 msgstr ""
dongsheng@627 16855
dongsheng@627 16856 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16857 #: ../en/ch12-mq.xml:1052
dongsheng@627 16858 msgid ""
dongsheng@627 16859 "This presents the interesting possibility of managing the contents of the "
dongsheng@627 16860 "patch directory as a Mercurial repository in its own right. This can be a "
dongsheng@627 16861 "useful way to work. For example, you can work on a patch for a while, "
dongsheng@627 16862 "<command role=\"hg-ext-mq\">qrefresh</command> it, then <command role=\"hg-cmd"
dongsheng@627 16863 "\">hg commit</command> the current state of the patch. This lets you "
dongsheng@627 16864 "<quote>roll back</quote> to that version of the patch later on."
dongsheng@627 16865 msgstr ""
dongsheng@627 16866
dongsheng@627 16867 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16868 #: ../en/ch12-mq.xml:1061
dongsheng@627 16869 msgid ""
dongsheng@627 16870 "You can then share different versions of the same patch stack among multiple "
dongsheng@627 16871 "underlying repositories. I use this when I am developing a Linux kernel "
dongsheng@627 16872 "feature. I have a pristine copy of my kernel sources for each of several CPU "
dongsheng@627 16873 "architectures, and a cloned repository under each that contains the patches I "
dongsheng@627 16874 "am working on. When I want to test a change on a different architecture, I "
dongsheng@627 16875 "push my current patches to the patch repository associated with that kernel "
dongsheng@627 16876 "tree, pop and push all of my patches, and build and test that kernel."
dongsheng@627 16877 msgstr ""
dongsheng@627 16878
dongsheng@627 16879 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16880 #: ../en/ch12-mq.xml:1071
dongsheng@627 16881 msgid ""
dongsheng@627 16882 "Managing patches in a repository makes it possible for multiple developers to "
dongsheng@627 16883 "work on the same patch series without colliding with each other, all on top "
dongsheng@627 16884 "of an underlying source base that they may or may not control."
dongsheng@627 16885 msgstr ""
dongsheng@627 16886
dongsheng@627 16887 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 16888 #: ../en/ch12-mq.xml:1077
dongsheng@627 16889 msgid "MQ support for patch repositories"
dongsheng@636 16890 msgstr "MQ 支持补丁版本库"
dongsheng@627 16891
dongsheng@627 16892 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16893 #: ../en/ch12-mq.xml:1079
dongsheng@627 16894 msgid ""
dongsheng@627 16895 "MQ helps you to work with the <filename role=\"special\" class=\"directory\">."
dongsheng@627 16896 "hg/patches</filename> directory as a repository; when you prepare a "
dongsheng@627 16897 "repository for working with patches using <command role=\"hg-ext-mq\">qinit</"
dongsheng@627 16898 "command>, you can pass the <option role=\"hg-ext-mq-cmd-qinit-opt\">hg -c</"
dongsheng@627 16899 "option> option to create the <filename role=\"special\" class=\"directory\">."
dongsheng@627 16900 "hg/patches</filename> directory as a Mercurial repository."
dongsheng@627 16901 msgstr ""
dongsheng@627 16902
dongsheng@627 16903 #. type: Content of: <book><chapter><sect1><sect2><note><para>
dongsheng@714 16904 #: ../en/ch12-mq.xml:1089
dongsheng@627 16905 msgid ""
dongsheng@627 16906 "If you forget to use the <option role=\"hg-ext-mq-cmd-qinit-opt\">hg -c</"
dongsheng@627 16907 "option> option, you can simply go into the <filename role=\"special\" class="
dongsheng@627 16908 "\"directory\">.hg/patches</filename> directory at any time and run <command "
dongsheng@627 16909 "role=\"hg-cmd\">hg init</command>. Don't forget to add an entry for the "
dongsheng@627 16910 "<filename role=\"special\">status</filename> file to the <filename role="
dongsheng@627 16911 "\"special\">.hgignore</filename> file, though"
dongsheng@627 16912 msgstr ""
dongsheng@627 16913
dongsheng@627 16914 #. type: Content of: <book><chapter><sect1><sect2><note><para>
dongsheng@714 16915 #: ../en/ch12-mq.xml:1098
dongsheng@627 16916 msgid ""
dongsheng@627 16917 "(<command role=\"hg-cmd\">hg qinit <option role=\"hg-ext-mq-cmd-qinit-opt"
dongsheng@627 16918 "\">hg -c</option></command> does this for you automatically); you "
dongsheng@627 16919 "<emphasis>really</emphasis> don't want to manage the <filename role=\"special"
dongsheng@627 16920 "\">status</filename> file."
dongsheng@627 16921 msgstr ""
dongsheng@627 16922
dongsheng@627 16923 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16924 #: ../en/ch12-mq.xml:1105
dongsheng@627 16925 msgid ""
dongsheng@627 16926 "As a convenience, if MQ notices that the <filename class=\"directory\">.hg/"
dongsheng@627 16927 "patches</filename> directory is a repository, it will automatically <command "
dongsheng@627 16928 "role=\"hg-cmd\">hg add</command> every patch that you create and import."
dongsheng@627 16929 msgstr ""
dongsheng@627 16930
dongsheng@627 16931 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16932 #: ../en/ch12-mq.xml:1110
dongsheng@627 16933 msgid ""
dongsheng@627 16934 "MQ provides a shortcut command, <command role=\"hg-ext-mq\">qcommit</"
dongsheng@627 16935 "command>, that runs <command role=\"hg-cmd\">hg commit</command> in the "
dongsheng@627 16936 "<filename role=\"special\" class=\"directory\">.hg/patches</filename> "
dongsheng@627 16937 "directory. This saves some bothersome typing."
dongsheng@627 16938 msgstr ""
dongsheng@627 16939
dongsheng@627 16940 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16941 #: ../en/ch12-mq.xml:1116
dongsheng@627 16942 msgid ""
dongsheng@627 16943 "Finally, as a convenience to manage the patch directory, you can define the "
dongsheng@627 16944 "alias <command>mq</command> on Unix systems. For example, on Linux systems "
dongsheng@627 16945 "using the <command>bash</command> shell, you can include the following "
dongsheng@627 16946 "snippet in your <filename role=\"home\">~/.bashrc</filename>."
dongsheng@627 16947 msgstr ""
dongsheng@627 16948
dongsheng@627 16949 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16950 #: ../en/ch12-mq.xml:1125
dongsheng@627 16951 msgid ""
dongsheng@627 16952 "You can then issue commands of the form <command>mq pull</command> from the "
dongsheng@627 16953 "main repository."
dongsheng@627 16954 msgstr ""
dongsheng@627 16955
dongsheng@627 16956 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 16957 #: ../en/ch12-mq.xml:1130
dongsheng@627 16958 msgid "A few things to watch out for"
dongsheng@636 16959 msgstr "需要注意的事情"
dongsheng@627 16960
dongsheng@627 16961 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16962 #: ../en/ch12-mq.xml:1132
dongsheng@627 16963 msgid ""
dongsheng@627 16964 "MQ's support for working with a repository full of patches is limited in a "
dongsheng@627 16965 "few small respects."
dongsheng@627 16966 msgstr ""
dongsheng@627 16967
dongsheng@627 16968 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 16969 #: ../en/ch12-mq.xml:1135
dongsheng@627 16970 msgid ""
dongsheng@627 16971 "MQ cannot automatically detect changes that you make to the patch directory. "
dongsheng@627 16972 "If you <command role=\"hg-cmd\">hg pull</command>, manually edit, or <command "
dongsheng@627 16973 "role=\"hg-cmd\">hg update</command> changes to patches or the <filename role="
dongsheng@627 16974 "\"special\">series</filename> file, you will have to <command role=\"hg-cmd"
dongsheng@1034 16975 "\">hg qpop <option role=\"hg-ext-mq-cmd-qpop-opt\">-a</option></command> and "
dongsheng@1034 16976 "then <command role=\"hg-cmd\">hg qpush <option role=\"hg-ext-mq-cmd-qpush-opt"
dongsheng@1034 16977 "\">-a</option></command> in the underlying repository to see those changes "
dongsheng@1034 16978 "show up there. If you forget to do this, you can confuse MQ's idea of which "
dongsheng@1034 16979 "patches are applied."
dongsheng@627 16980 msgstr ""
dongsheng@627 16981
dongsheng@627 16982 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 16983 #: ../en/ch12-mq.xml:1151
dongsheng@627 16984 msgid "Third party tools for working with patches"
dongsheng@636 16985 msgstr "操作补丁的第三方工具"
dongsheng@627 16986
dongsheng@627 16987 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16988 #: ../en/ch12-mq.xml:1153
dongsheng@627 16989 msgid ""
dongsheng@627 16990 "Once you've been working with patches for a while, you'll find yourself "
dongsheng@627 16991 "hungry for tools that will help you to understand and manipulate the patches "
dongsheng@627 16992 "you're dealing with."
dongsheng@627 16993 msgstr ""
dongsheng@627 16994
dongsheng@627 16995 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 16996 #: ../en/ch12-mq.xml:1157
dongsheng@627 16997 msgid ""
dongsheng@627 16998 "The <command>diffstat</command> command <citation>web:diffstat</citation> "
dongsheng@627 16999 "generates a histogram of the modifications made to each file in a patch. It "
songdongsheng@668 17000 "provides a good way to <quote>get a sense of</quote> a patch&emdash;which "
songdongsheng@668 17001 "files it affects, and how much change it introduces to each file and as a "
songdongsheng@668 17002 "whole. (I find that it's a good idea to use <command>diffstat</command>'s "
songdongsheng@668 17003 "<option role=\"cmd-opt-diffstat\">-p</option> option as a matter of course, "
songdongsheng@668 17004 "as otherwise it will try to do clever things with prefixes of file names that "
songdongsheng@668 17005 "inevitably confuse at least me.)"
dongsheng@627 17006 msgstr ""
dongsheng@627 17007
dongsheng@627 17008 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17009 #: ../en/ch12-mq.xml:1171
dongsheng@627 17010 msgid ""
dongsheng@627 17011 "The <literal role=\"package\">patchutils</literal> package <citation>web:"
dongsheng@627 17012 "patchutils</citation> is invaluable. It provides a set of small utilities "
dongsheng@627 17013 "that follow the <quote>Unix philosophy;</quote> each does one useful thing "
dongsheng@627 17014 "with a patch. The <literal role=\"package\">patchutils</literal> command I "
dongsheng@627 17015 "use most is <command>filterdiff</command>, which extracts subsets from a "
dongsheng@627 17016 "patch file. For example, given a patch that modifies hundreds of files "
dongsheng@627 17017 "across dozens of directories, a single invocation of <command>filterdiff</"
dongsheng@627 17018 "command> can generate a smaller patch that only touches files whose names "
songdongsheng@658 17019 "match a particular glob pattern. See <xref linkend=\"mq-collab:tips:interdiff"
songdongsheng@658 17020 "\"/> for another example."
dongsheng@627 17021 msgstr ""
dongsheng@627 17022
dongsheng@627 17023 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 17024 #: ../en/ch12-mq.xml:1187
dongsheng@627 17025 msgid "Good ways to work with patches"
dongsheng@636 17026 msgstr "操作补丁的好习惯"
dongsheng@627 17027
dongsheng@627 17028 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17029 #: ../en/ch12-mq.xml:1189
dongsheng@627 17030 msgid ""
dongsheng@627 17031 "Whether you are working on a patch series to submit to a free software or "
dongsheng@627 17032 "open source project, or a series that you intend to treat as a sequence of "
dongsheng@627 17033 "regular changesets when you're done, you can use some simple techniques to "
songdongsheng@710 17034 "keep your work well organized."
dongsheng@627 17035 msgstr ""
dongsheng@627 17036
dongsheng@627 17037 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17038 #: ../en/ch12-mq.xml:1195
dongsheng@627 17039 msgid ""
dongsheng@627 17040 "Give your patches descriptive names. A good name for a patch might be "
dongsheng@627 17041 "<filename>rework-device-alloc.patch</filename>, because it will immediately "
dongsheng@627 17042 "give you a hint what the purpose of the patch is. Long names shouldn't be a "
dongsheng@627 17043 "problem; you won't be typing the names often, but you <emphasis>will</"
dongsheng@627 17044 "emphasis> be running commands like <command role=\"hg-ext-mq\">qapplied</"
dongsheng@627 17045 "command> and <command role=\"hg-ext-mq\">qtop</command> over and over. Good "
dongsheng@627 17046 "naming becomes especially important when you have a number of patches to work "
dongsheng@627 17047 "with, or if you are juggling a number of different tasks and your patches "
dongsheng@627 17048 "only get a fraction of your attention."
dongsheng@627 17049 msgstr ""
dongsheng@627 17050
dongsheng@627 17051 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17052 #: ../en/ch12-mq.xml:1207
dongsheng@627 17053 msgid ""
dongsheng@627 17054 "Be aware of what patch you're working on. Use the <command role=\"hg-ext-mq"
songdongsheng@668 17055 "\">qtop</command> command and skim over the text of your patches "
songdongsheng@668 17056 "frequently&emdash;for example, using <command role=\"hg-cmd\">hg tip <option "
songdongsheng@668 17057 "role=\"hg-opt-tip\">-p</option></command>)&emdash;to be sure of where you "
songdongsheng@668 17058 "stand. I have several times worked on and <command role=\"hg-ext-mq"
songdongsheng@668 17059 "\">qrefresh</command>ed a patch other than the one I intended, and it's often "
songdongsheng@668 17060 "tricky to migrate changes into the right patch after making them in the wrong "
songdongsheng@668 17061 "one."
dongsheng@627 17062 msgstr ""
dongsheng@627 17063
dongsheng@627 17064 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17065 #: ../en/ch12-mq.xml:1217
dongsheng@627 17066 msgid ""
dongsheng@627 17067 "For this reason, it is very much worth investing a little time to learn how "
songdongsheng@658 17068 "to use some of the third-party tools I described in <xref linkend=\"sec:mq:"
songdongsheng@658 17069 "tools\"/>, particularly <command>diffstat</command> and <command>filterdiff</"
songdongsheng@658 17070 "command>. The former will give you a quick idea of what changes your patch "
songdongsheng@658 17071 "is making, while the latter makes it easy to splice hunks selectively out of "
songdongsheng@658 17072 "one patch and into another."
dongsheng@627 17073 msgstr ""
dongsheng@627 17074
dongsheng@627 17075 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 17076 #: ../en/ch12-mq.xml:1228
dongsheng@627 17077 msgid "MQ cookbook"
dongsheng@636 17078 msgstr "MQ 手册"
dongsheng@627 17079
dongsheng@627 17080 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 17081 #: ../en/ch12-mq.xml:1231
dongsheng@627 17082 msgid "Manage <quote>trivial</quote> patches"
dongsheng@636 17083 msgstr "管理<quote>琐碎的</quote>补丁"
dongsheng@627 17084
dongsheng@627 17085 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17086 #: ../en/ch12-mq.xml:1233
dongsheng@627 17087 msgid ""
dongsheng@627 17088 "Because the overhead of dropping files into a new Mercurial repository is so "
dongsheng@627 17089 "low, it makes a lot of sense to manage patches this way even if you simply "
dongsheng@627 17090 "want to make a few changes to a source tarball that you downloaded."
dongsheng@627 17091 msgstr ""
dongsheng@627 17092
dongsheng@627 17093 #
dongsheng@627 17094 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17095 #: ../en/ch12-mq.xml:1238
dongsheng@627 17096 msgid ""
dongsheng@627 17097 "Begin by downloading and unpacking the source tarball, and turning it into a "
dongsheng@627 17098 "Mercurial repository."
dongsheng@627 17099 msgstr ""
dongsheng@627 17100
dongsheng@627 17101 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17102 #: ../en/ch12-mq.xml:1243
dongsheng@627 17103 msgid "Continue by creating a patch stack and making your changes."
dongsheng@627 17104 msgstr ""
dongsheng@627 17105
dongsheng@627 17106 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17107 #: ../en/ch12-mq.xml:1248
dongsheng@627 17108 msgid ""
dongsheng@627 17109 "Let's say a few weeks or months pass, and your package author releases a new "
dongsheng@627 17110 "version. First, bring their changes into the repository."
dongsheng@627 17111 msgstr ""
dongsheng@627 17112
dongsheng@627 17113 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17114 #: ../en/ch12-mq.xml:1254
dongsheng@627 17115 msgid ""
dongsheng@627 17116 "The pipeline starting with <command role=\"hg-cmd\">hg locate</command> above "
dongsheng@627 17117 "deletes all files in the working directory, so that <command role=\"hg-cmd"
dongsheng@627 17118 "\">hg commit</command>'s <option role=\"hg-opt-commit\">--addremove</option> "
dongsheng@627 17119 "option can actually tell which files have really been removed in the newer "
dongsheng@627 17120 "version of the source."
dongsheng@627 17121 msgstr ""
dongsheng@627 17122
dongsheng@627 17123 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17124 #: ../en/ch12-mq.xml:1262
dongsheng@627 17125 msgid "Finally, you can apply your patches on top of the new tree."
dongsheng@627 17126 msgstr ""
dongsheng@627 17127
dongsheng@627 17128 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 17129 #: ../en/ch12-mq.xml:1269
dongsheng@627 17130 msgid "Combining entire patches"
dongsheng@636 17131 msgstr "组合全部的补丁"
dongsheng@627 17132
dongsheng@627 17133 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17134 #: ../en/ch12-mq.xml:1271
dongsheng@627 17135 msgid ""
dongsheng@627 17136 "MQ provides a command, <command role=\"hg-ext-mq\">qfold</command> that lets "
dongsheng@627 17137 "you combine entire patches. This <quote>folds</quote> the patches you name, "
dongsheng@627 17138 "in the order you name them, into the topmost applied patch, and concatenates "
dongsheng@627 17139 "their descriptions onto the end of its description. The patches that you "
dongsheng@627 17140 "fold must be unapplied before you fold them."
dongsheng@627 17141 msgstr ""
dongsheng@627 17142
dongsheng@627 17143 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17144 #: ../en/ch12-mq.xml:1279
dongsheng@627 17145 msgid ""
dongsheng@627 17146 "The order in which you fold patches matters. If your topmost applied patch "
dongsheng@627 17147 "is <literal>foo</literal>, and you <command role=\"hg-ext-mq\">qfold</"
dongsheng@627 17148 "command> <literal>bar</literal> and <literal>quux</literal> into it, you will "
dongsheng@627 17149 "end up with a patch that has the same effect as if you applied first "
dongsheng@627 17150 "<literal>foo</literal>, then <literal>bar</literal>, followed by "
dongsheng@627 17151 "<literal>quux</literal>."
dongsheng@627 17152 msgstr ""
dongsheng@627 17153
dongsheng@627 17154 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 17155 #: ../en/ch12-mq.xml:1290
dongsheng@627 17156 msgid "Merging part of one patch into another"
dongsheng@636 17157 msgstr "合并补丁的部分内容到其它补丁"
dongsheng@627 17158
dongsheng@627 17159 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17160 #: ../en/ch12-mq.xml:1292
dongsheng@627 17161 msgid ""
dongsheng@627 17162 "Merging <emphasis>part</emphasis> of one patch into another is more difficult "
dongsheng@627 17163 "than combining entire patches."
dongsheng@627 17164 msgstr ""
dongsheng@627 17165
dongsheng@627 17166 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17167 #: ../en/ch12-mq.xml:1296
dongsheng@627 17168 msgid ""
dongsheng@627 17169 "If you want to move changes to entire files, you can use <command>filterdiff</"
dongsheng@627 17170 "command>'s <option role=\"cmd-opt-filterdiff\">-i</option> and <option role="
dongsheng@627 17171 "\"cmd-opt-filterdiff\">-x</option> options to choose the modifications to "
dongsheng@627 17172 "snip out of one patch, concatenating its output onto the end of the patch you "
dongsheng@627 17173 "want to merge into. You usually won't need to modify the patch you've merged "
dongsheng@627 17174 "the changes from. Instead, MQ will report some rejected hunks when you "
dongsheng@627 17175 "<command role=\"hg-ext-mq\">qpush</command> it (from the hunks you moved into "
dongsheng@627 17176 "the other patch), and you can simply <command role=\"hg-ext-mq\">qrefresh</"
dongsheng@627 17177 "command> the patch to drop the duplicate hunks."
dongsheng@627 17178 msgstr ""
dongsheng@627 17179
dongsheng@627 17180 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17181 #: ../en/ch12-mq.xml:1309
dongsheng@627 17182 msgid ""
dongsheng@627 17183 "If you have a patch that has multiple hunks modifying a file, and you only "
dongsheng@627 17184 "want to move a few of those hunks, the job becomes more messy, but you can "
dongsheng@627 17185 "still partly automate it. Use <command>lsdiff -nvv</command> to print some "
dongsheng@627 17186 "metadata about the patch."
dongsheng@627 17187 msgstr ""
dongsheng@627 17188
dongsheng@627 17189 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17190 #: ../en/ch12-mq.xml:1317
dongsheng@627 17191 msgid "This command prints three different kinds of number:"
dongsheng@627 17192 msgstr ""
dongsheng@627 17193
dongsheng@627 17194 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 17195 #: ../en/ch12-mq.xml:1320
dongsheng@627 17196 msgid ""
dongsheng@627 17197 "(in the first column) a <emphasis>file number</emphasis> to identify each "
dongsheng@627 17198 "file modified in the patch;"
dongsheng@627 17199 msgstr ""
dongsheng@627 17200
dongsheng@627 17201 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 17202 #: ../en/ch12-mq.xml:1324
dongsheng@627 17203 msgid ""
dongsheng@627 17204 "(on the next line, indented) the line number within a modified file where a "
dongsheng@627 17205 "hunk starts; and"
dongsheng@627 17206 msgstr ""
dongsheng@627 17207
dongsheng@627 17208 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 17209 #: ../en/ch12-mq.xml:1327
dongsheng@627 17210 msgid ""
dongsheng@627 17211 "(on the same line) a <emphasis>hunk number</emphasis> to identify that hunk."
dongsheng@627 17212 msgstr ""
dongsheng@627 17213
dongsheng@627 17214 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17215 #: ../en/ch12-mq.xml:1331
dongsheng@627 17216 msgid ""
dongsheng@627 17217 "You'll have to use some visual inspection, and reading of the patch, to "
dongsheng@627 17218 "identify the file and hunk numbers you'll want, but you can then pass them to "
dongsheng@627 17219 "to <command>filterdiff</command>'s <option role=\"cmd-opt-filterdiff\">--"
dongsheng@627 17220 "files</option> and <option role=\"cmd-opt-filterdiff\">--hunks</option> "
dongsheng@627 17221 "options, to select exactly the file and hunk you want to extract."
dongsheng@627 17222 msgstr ""
dongsheng@627 17223
dongsheng@627 17224 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17225 #: ../en/ch12-mq.xml:1339
dongsheng@627 17226 msgid ""
dongsheng@627 17227 "Once you have this hunk, you can concatenate it onto the end of your "
songdongsheng@658 17228 "destination patch and continue with the remainder of <xref linkend=\"sec:mq:"
songdongsheng@658 17229 "combine\"/>."
dongsheng@627 17230 msgstr ""
dongsheng@627 17231
dongsheng@627 17232 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 17233 #: ../en/ch12-mq.xml:1346
dongsheng@627 17234 msgid "Differences between quilt and MQ"
dongsheng@636 17235 msgstr "MQ 与 quilt 的区别"
dongsheng@627 17236
dongsheng@627 17237 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17238 #: ../en/ch12-mq.xml:1348
dongsheng@627 17239 msgid ""
dongsheng@627 17240 "If you are already familiar with quilt, MQ provides a similar command set. "
dongsheng@627 17241 "There are a few differences in the way that it works."
dongsheng@627 17242 msgstr ""
dongsheng@627 17243
dongsheng@627 17244 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17245 #: ../en/ch12-mq.xml:1352
dongsheng@627 17246 msgid ""
dongsheng@627 17247 "You will already have noticed that most quilt commands have MQ counterparts "
dongsheng@627 17248 "that simply begin with a <quote><literal>q</literal></quote>. The exceptions "
dongsheng@627 17249 "are quilt's <literal>add</literal> and <literal>remove</literal> commands, "
dongsheng@627 17250 "the counterparts for which are the normal Mercurial <command role=\"hg-cmd"
dongsheng@627 17251 "\">hg add</command> and <command role=\"hg-cmd\">hg remove</command> "
dongsheng@627 17252 "commands. There is no MQ equivalent of the quilt <literal>edit</literal> "
dongsheng@627 17253 "command."
dongsheng@627 17254 msgstr ""
dongsheng@627 17255
dongsheng@627 17256 #. type: Content of: <book><chapter><title>
dongsheng@714 17257 #: ../en/ch13-mq-collab.xml:5
dongsheng@627 17258 msgid "Advanced uses of Mercurial Queues"
dongsheng@627 17259 msgstr "MQ 的高级用法"
dongsheng@627 17260
dongsheng@627 17261 #. type: Content of: <book><chapter><para>
dongsheng@714 17262 #: ../en/ch13-mq-collab.xml:7
dongsheng@627 17263 msgid ""
dongsheng@627 17264 "While it's easy to pick up straightforward uses of Mercurial Queues, use of a "
dongsheng@627 17265 "little discipline and some of MQ's less frequently used capabilities makes it "
dongsheng@627 17266 "possible to work in complicated development environments."
dongsheng@627 17267 msgstr ""
dongsheng@627 17268
dongsheng@627 17269 #. type: Content of: <book><chapter><para>
dongsheng@714 17270 #: ../en/ch13-mq-collab.xml:12
dongsheng@627 17271 msgid ""
dongsheng@627 17272 "In this chapter, I will use as an example a technique I have used to manage "
dongsheng@627 17273 "the development of an Infiniband device driver for the Linux kernel. The "
dongsheng@627 17274 "driver in question is large (at least as drivers go), with 25,000 lines of "
dongsheng@627 17275 "code spread across 35 source files. It is maintained by a small team of "
dongsheng@627 17276 "developers."
dongsheng@627 17277 msgstr ""
dongsheng@627 17278
dongsheng@627 17279 #. type: Content of: <book><chapter><para>
dongsheng@714 17280 #: ../en/ch13-mq-collab.xml:18
dongsheng@627 17281 msgid ""
dongsheng@627 17282 "While much of the material in this chapter is specific to Linux, the same "
dongsheng@627 17283 "principles apply to any code base for which you're not the primary owner, and "
dongsheng@627 17284 "upon which you need to do a lot of development."
dongsheng@627 17285 msgstr ""
dongsheng@627 17286
dongsheng@627 17287 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 17288 #: ../en/ch13-mq-collab.xml:24
dongsheng@627 17289 msgid "The problem of many targets"
dongsheng@636 17290 msgstr "多个目标的问题"
dongsheng@627 17291
dongsheng@627 17292 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17293 #: ../en/ch13-mq-collab.xml:26
dongsheng@627 17294 msgid ""
dongsheng@627 17295 "The Linux kernel changes rapidly, and has never been internally stable; "
dongsheng@627 17296 "developers frequently make drastic changes between releases. This means that "
dongsheng@627 17297 "a version of the driver that works well with a particular released version of "
dongsheng@627 17298 "the kernel will not even <emphasis>compile</emphasis> correctly against, "
dongsheng@627 17299 "typically, any other version."
dongsheng@627 17300 msgstr ""
dongsheng@627 17301
dongsheng@627 17302 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17303 #: ../en/ch13-mq-collab.xml:33
dongsheng@627 17304 msgid ""
dongsheng@627 17305 "To maintain a driver, we have to keep a number of distinct versions of Linux "
dongsheng@627 17306 "in mind."
dongsheng@627 17307 msgstr ""
dongsheng@627 17308
dongsheng@627 17309 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 17310 #: ../en/ch13-mq-collab.xml:36
dongsheng@627 17311 msgid ""
dongsheng@627 17312 "One target is the main Linux kernel development tree. Maintenance of the code "
dongsheng@627 17313 "is in this case partly shared by other developers in the kernel community, "
dongsheng@627 17314 "who make <quote>drive-by</quote> modifications to the driver as they develop "
dongsheng@627 17315 "and refine kernel subsystems."
dongsheng@627 17316 msgstr ""
dongsheng@627 17317
dongsheng@627 17318 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 17319 #: ../en/ch13-mq-collab.xml:42
dongsheng@627 17320 msgid ""
dongsheng@627 17321 "We also maintain a number of <quote>backports</quote> to older versions of "
dongsheng@627 17322 "the Linux kernel, to support the needs of customers who are running older "
dongsheng@627 17323 "Linux distributions that do not incorporate our drivers. (To "
dongsheng@627 17324 "<emphasis>backport</emphasis> a piece of code is to modify it to work in an "
dongsheng@627 17325 "older version of its target environment than the version it was developed "
dongsheng@627 17326 "for.)"
dongsheng@627 17327 msgstr ""
dongsheng@627 17328
dongsheng@627 17329 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 17330 #: ../en/ch13-mq-collab.xml:50
dongsheng@627 17331 msgid ""
dongsheng@627 17332 "Finally, we make software releases on a schedule that is necessarily not "
dongsheng@627 17333 "aligned with those used by Linux distributors and kernel developers, so that "
dongsheng@627 17334 "we can deliver new features to customers without forcing them to upgrade "
dongsheng@627 17335 "their entire kernels or distributions."
dongsheng@627 17336 msgstr ""
dongsheng@627 17337
dongsheng@627 17338 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 17339 #: ../en/ch13-mq-collab.xml:58
dongsheng@627 17340 msgid "Tempting approaches that don't work well"
dongsheng@636 17341 msgstr "工作不好的诱人方法"
dongsheng@627 17342
dongsheng@627 17343 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17344 #: ../en/ch13-mq-collab.xml:60
dongsheng@627 17345 msgid ""
dongsheng@627 17346 "There are two <quote>standard</quote> ways to maintain a piece of software "
dongsheng@627 17347 "that has to target many different environments."
dongsheng@627 17348 msgstr ""
dongsheng@627 17349
dongsheng@627 17350 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17351 #: ../en/ch13-mq-collab.xml:64
dongsheng@627 17352 msgid ""
dongsheng@627 17353 "The first is to maintain a number of branches, each intended for a single "
dongsheng@627 17354 "target. The trouble with this approach is that you must maintain iron "
dongsheng@627 17355 "discipline in the flow of changes between repositories. A new feature or bug "
dongsheng@627 17356 "fix must start life in a <quote>pristine</quote> repository, then percolate "
dongsheng@627 17357 "out to every backport repository. Backport changes are more limited in the "
dongsheng@627 17358 "branches they should propagate to; a backport change that is applied to a "
dongsheng@627 17359 "branch where it doesn't belong will probably stop the driver from compiling."
dongsheng@627 17360 msgstr ""
dongsheng@627 17361
dongsheng@627 17362 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17363 #: ../en/ch13-mq-collab.xml:74
dongsheng@627 17364 msgid ""
dongsheng@627 17365 "The second is to maintain a single source tree filled with conditional "
dongsheng@627 17366 "statements that turn chunks of code on or off depending on the intended "
dongsheng@627 17367 "target. Because these <quote>ifdefs</quote> are not allowed in the Linux "
dongsheng@627 17368 "kernel tree, a manual or automatic process must be followed to strip them out "
dongsheng@627 17369 "and yield a clean tree. A code base maintained in this fashion rapidly "
dongsheng@627 17370 "becomes a rat's nest of conditional blocks that are difficult to understand "
dongsheng@627 17371 "and maintain."
dongsheng@627 17372 msgstr ""
dongsheng@627 17373
dongsheng@627 17374 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17375 #: ../en/ch13-mq-collab.xml:83
dongsheng@627 17376 msgid ""
dongsheng@627 17377 "Neither of these approaches is well suited to a situation where you don't "
dongsheng@627 17378 "<quote>own</quote> the canonical copy of a source tree. In the case of a "
dongsheng@627 17379 "Linux driver that is distributed with the standard kernel, Linus's tree "
dongsheng@627 17380 "contains the copy of the code that will be treated by the world as "
dongsheng@627 17381 "canonical. The upstream version of <quote>my</quote> driver can be modified "
dongsheng@627 17382 "by people I don't know, without me even finding out about it until after the "
dongsheng@627 17383 "changes show up in Linus's tree."
dongsheng@627 17384 msgstr ""
dongsheng@627 17385
dongsheng@627 17386 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17387 #: ../en/ch13-mq-collab.xml:93
dongsheng@627 17388 msgid ""
dongsheng@627 17389 "These approaches have the added weakness of making it difficult to generate "
dongsheng@627 17390 "well-formed patches to submit upstream."
dongsheng@627 17391 msgstr ""
dongsheng@627 17392
dongsheng@627 17393 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17394 #: ../en/ch13-mq-collab.xml:97
dongsheng@627 17395 msgid ""
dongsheng@627 17396 "In principle, Mercurial Queues seems like a good candidate to manage a "
dongsheng@627 17397 "development scenario such as the above. While this is indeed the case, MQ "
dongsheng@627 17398 "contains a few added features that make the job more pleasant."
dongsheng@627 17399 msgstr ""
dongsheng@627 17400
dongsheng@627 17401 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 17402 #: ../en/ch13-mq-collab.xml:105
dongsheng@627 17403 msgid "Conditionally applying patches with guards"
dongsheng@636 17404 msgstr "有条件的应用补丁"
dongsheng@627 17405
dongsheng@627 17406 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17407 #: ../en/ch13-mq-collab.xml:107
dongsheng@627 17408 msgid ""
dongsheng@627 17409 "Perhaps the best way to maintain sanity with so many targets is to be able to "
dongsheng@627 17410 "choose specific patches to apply for a given situation. MQ provides a "
dongsheng@627 17411 "feature called <quote>guards</quote> (which originates with quilt's "
dongsheng@627 17412 "<literal>guards</literal> command) that does just this. To start off, let's "
dongsheng@627 17413 "create a simple repository for experimenting in."
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:116
dongsheng@627 17418 msgid ""
dongsheng@627 17419 "This gives us a tiny repository that contains two patches that don't have any "
dongsheng@627 17420 "dependencies on each other, because they touch different files."
dongsheng@627 17421 msgstr ""
dongsheng@627 17422
dongsheng@627 17423 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17424 #: ../en/ch13-mq-collab.xml:120
dongsheng@627 17425 msgid ""
dongsheng@627 17426 "The idea behind conditional application is that you can <quote>tag</quote> a "
dongsheng@627 17427 "patch with a <emphasis>guard</emphasis>, which is simply a text string of "
dongsheng@627 17428 "your choosing, then tell MQ to select specific guards to use when applying "
dongsheng@627 17429 "patches. MQ will then either apply, or skip over, a guarded patch, depending "
dongsheng@627 17430 "on the guards that you have selected."
dongsheng@627 17431 msgstr ""
dongsheng@627 17432
dongsheng@627 17433 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17434 #: ../en/ch13-mq-collab.xml:127
dongsheng@627 17435 msgid ""
dongsheng@627 17436 "A patch can have an arbitrary number of guards; each one is "
dongsheng@627 17437 "<emphasis>positive</emphasis> (<quote>apply this patch if this guard is "
dongsheng@627 17438 "selected</quote>) or <emphasis>negative</emphasis> (<quote>skip this patch if "
dongsheng@627 17439 "this guard is selected</quote>). A patch with no guards is always applied."
dongsheng@627 17440 msgstr ""
dongsheng@627 17441
dongsheng@627 17442 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 17443 #: ../en/ch13-mq-collab.xml:135
dongsheng@627 17444 msgid "Controlling the guards on a patch"
dongsheng@636 17445 msgstr "控制补丁的应用条件"
dongsheng@627 17446
dongsheng@627 17447 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17448 #: ../en/ch13-mq-collab.xml:137
dongsheng@627 17449 msgid ""
dongsheng@627 17450 "The <command role=\"hg-ext-mq\">qguard</command> command lets you determine "
dongsheng@627 17451 "which guards should apply to a patch, or display the guards that are already "
dongsheng@627 17452 "in effect. Without any arguments, it displays the guards on the current "
dongsheng@627 17453 "topmost patch."
dongsheng@627 17454 msgstr ""
dongsheng@627 17455
dongsheng@627 17456 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17457 #: ../en/ch13-mq-collab.xml:144
dongsheng@627 17458 msgid ""
dongsheng@627 17459 "To set a positive guard on a patch, prefix the name of the guard with a "
dongsheng@627 17460 "<quote><literal>+</literal></quote>."
dongsheng@627 17461 msgstr ""
dongsheng@627 17462
dongsheng@627 17463 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17464 #: ../en/ch13-mq-collab.xml:149
dongsheng@627 17465 msgid ""
dongsheng@627 17466 "To set a negative guard on a patch, prefix the name of the guard with a "
dongsheng@627 17467 "<quote><literal>-</literal></quote>."
dongsheng@627 17468 msgstr ""
dongsheng@627 17469
dongsheng@714 17470 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17471 #: ../en/ch13-mq-collab.xml:155
dongsheng@714 17472 msgid ""
dongsheng@714 17473 "Notice that we prefixed the arguments to the <command>hg qguard</command> "
dongsheng@714 17474 "command with a <literal>--</literal> here, so that Mercurial would not "
dongsheng@714 17475 "interpret the text <literal>-quux</literal> as an option."
dongsheng@714 17476 msgstr ""
dongsheng@714 17477
dongsheng@714 17478 #. type: Content of: <book><chapter><sect1><note><title>
dongsheng@714 17479 #: ../en/ch13-mq-collab.xml:161
dongsheng@714 17480 msgid "Setting vs. modifying"
dongsheng@714 17481 msgstr ""
dongsheng@714 17482
dongsheng@627 17483 #. type: Content of: <book><chapter><sect1><note><para>
dongsheng@714 17484 #: ../en/ch13-mq-collab.xml:163
dongsheng@627 17485 msgid ""
dongsheng@627 17486 "The <command role=\"hg-ext-mq\">qguard</command> command <emphasis>sets</"
dongsheng@627 17487 "emphasis> the guards on a patch; it doesn't <emphasis>modify</emphasis> "
dongsheng@627 17488 "them. What this means is that if you run <command role=\"hg-cmd\">hg qguard "
dongsheng@627 17489 "+a +b</command> on a patch, then <command role=\"hg-cmd\">hg qguard +c</"
dongsheng@627 17490 "command> on the same patch, the <emphasis>only</emphasis> guard that will be "
dongsheng@627 17491 "set on it afterwards is <literal>+c</literal>."
dongsheng@627 17492 msgstr ""
dongsheng@627 17493
dongsheng@627 17494 #
dongsheng@627 17495 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17496 #: ../en/ch13-mq-collab.xml:172
dongsheng@627 17497 msgid ""
dongsheng@627 17498 "Mercurial stores guards in the <filename role=\"special\">series</filename> "
dongsheng@627 17499 "file; the form in which they are stored is easy both to understand and to "
dongsheng@627 17500 "edit by hand. (In other words, you don't have to use the <command role=\"hg-"
dongsheng@627 17501 "ext-mq\">qguard</command> command if you don't want to; it's okay to simply "
dongsheng@627 17502 "edit the <filename role=\"special\">series</filename> file.)"
dongsheng@627 17503 msgstr ""
dongsheng@627 17504
dongsheng@627 17505 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 17506 #: ../en/ch13-mq-collab.xml:184
dongsheng@627 17507 msgid "Selecting the guards to use"
dongsheng@636 17508 msgstr "选择使用的条件"
dongsheng@627 17509
dongsheng@627 17510 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17511 #: ../en/ch13-mq-collab.xml:186
dongsheng@627 17512 msgid ""
dongsheng@627 17513 "The <command role=\"hg-ext-mq\">qselect</command> command determines which "
dongsheng@627 17514 "guards are active at a given time. The effect of this is to determine which "
dongsheng@627 17515 "patches MQ will apply the next time you run <command role=\"hg-ext-mq"
dongsheng@627 17516 "\">qpush</command>. It has no other effect; in particular, it doesn't do "
dongsheng@627 17517 "anything to patches that are already applied."
dongsheng@627 17518 msgstr ""
dongsheng@627 17519
dongsheng@627 17520 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17521 #: ../en/ch13-mq-collab.xml:193
dongsheng@627 17522 msgid ""
dongsheng@627 17523 "With no arguments, the <command role=\"hg-ext-mq\">qselect</command> command "
dongsheng@627 17524 "lists the guards currently in effect, one per line of output. Each argument "
dongsheng@627 17525 "is treated as the name of a guard to apply."
dongsheng@627 17526 msgstr ""
dongsheng@627 17527
dongsheng@627 17528 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17529 #: ../en/ch13-mq-collab.xml:200
dongsheng@627 17530 msgid ""
dongsheng@627 17531 "In case you're interested, the currently selected guards are stored in the "
dongsheng@627 17532 "<filename role=\"special\">guards</filename> file."
dongsheng@627 17533 msgstr ""
dongsheng@627 17534
dongsheng@627 17535 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17536 #: ../en/ch13-mq-collab.xml:205
dongsheng@627 17537 msgid ""
dongsheng@627 17538 "We can see the effect the selected guards have when we run <command role=\"hg-"
dongsheng@627 17539 "ext-mq\">qpush</command>."
dongsheng@627 17540 msgstr ""
dongsheng@627 17541
dongsheng@627 17542 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17543 #: ../en/ch13-mq-collab.xml:210
dongsheng@627 17544 msgid ""
dongsheng@627 17545 "A guard cannot start with a <quote><literal>+</literal></quote> or "
dongsheng@627 17546 "<quote><literal>-</literal></quote> character. The name of a guard must not "
dongsheng@627 17547 "contain white space, but most other characters are acceptable. If you try to "
dongsheng@627 17548 "use a guard with an invalid name, MQ will complain:"
dongsheng@627 17549 msgstr ""
dongsheng@627 17550
dongsheng@627 17551 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17552 #: ../en/ch13-mq-collab.xml:219
dongsheng@627 17553 msgid "Changing the selected guards changes the patches that are applied."
dongsheng@627 17554 msgstr ""
dongsheng@627 17555
dongsheng@627 17556 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17557 #: ../en/ch13-mq-collab.xml:224
dongsheng@627 17558 msgid ""
dongsheng@627 17559 "You can see in the example below that negative guards take precedence over "
dongsheng@627 17560 "positive guards."
dongsheng@627 17561 msgstr ""
dongsheng@627 17562
dongsheng@627 17563 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 17564 #: ../en/ch13-mq-collab.xml:231
dongsheng@627 17565 msgid "MQ's rules for applying patches"
dongsheng@636 17566 msgstr "MQ 应用补丁的规则"
dongsheng@627 17567
dongsheng@627 17568 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17569 #: ../en/ch13-mq-collab.xml:233
dongsheng@627 17570 msgid ""
dongsheng@627 17571 "The rules that MQ uses when deciding whether to apply a patch are as follows."
dongsheng@627 17572 msgstr ""
dongsheng@627 17573
dongsheng@627 17574 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 17575 #: ../en/ch13-mq-collab.xml:236
dongsheng@627 17576 msgid "A patch that has no guards is always applied."
dongsheng@627 17577 msgstr ""
dongsheng@627 17578
dongsheng@627 17579 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 17580 #: ../en/ch13-mq-collab.xml:239
dongsheng@627 17581 msgid ""
dongsheng@627 17582 "If the patch has any negative guard that matches any currently selected "
dongsheng@627 17583 "guard, the patch is skipped."
dongsheng@627 17584 msgstr ""
dongsheng@627 17585
dongsheng@627 17586 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 17587 #: ../en/ch13-mq-collab.xml:242
dongsheng@627 17588 msgid ""
dongsheng@627 17589 "If the patch has any positive guard that matches any currently selected "
dongsheng@627 17590 "guard, the patch is applied."
dongsheng@627 17591 msgstr ""
dongsheng@627 17592
dongsheng@627 17593 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 17594 #: ../en/ch13-mq-collab.xml:245
dongsheng@627 17595 msgid ""
dongsheng@627 17596 "If the patch has positive or negative guards, but none matches any currently "
dongsheng@627 17597 "selected guard, the patch is skipped."
dongsheng@627 17598 msgstr ""
dongsheng@627 17599
dongsheng@627 17600 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 17601 #: ../en/ch13-mq-collab.xml:252
dongsheng@627 17602 msgid "Trimming the work environment"
dongsheng@636 17603 msgstr "修剪工作环境"
dongsheng@627 17604
dongsheng@627 17605 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17606 #: ../en/ch13-mq-collab.xml:254
dongsheng@627 17607 msgid ""
dongsheng@627 17608 "In working on the device driver I mentioned earlier, I don't apply the "
dongsheng@627 17609 "patches to a normal Linux kernel tree. Instead, I use a repository that "
dongsheng@627 17610 "contains only a snapshot of the source files and headers that are relevant to "
dongsheng@627 17611 "Infiniband development. This repository is 1% the size of a kernel "
dongsheng@627 17612 "repository, so it's easier to work with."
dongsheng@627 17613 msgstr ""
dongsheng@627 17614
dongsheng@627 17615 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17616 #: ../en/ch13-mq-collab.xml:261
dongsheng@627 17617 msgid ""
dongsheng@627 17618 "I then choose a <quote>base</quote> version on top of which the patches are "
dongsheng@627 17619 "applied. This is a snapshot of the Linux kernel tree as of a revision of my "
dongsheng@627 17620 "choosing. When I take the snapshot, I record the changeset ID from the "
dongsheng@627 17621 "kernel repository in the commit message. Since the snapshot preserves the "
dongsheng@627 17622 "<quote>shape</quote> and content of the relevant parts of the kernel tree, I "
dongsheng@627 17623 "can apply my patches on top of either my tiny repository or a normal kernel "
dongsheng@627 17624 "tree."
dongsheng@627 17625 msgstr ""
dongsheng@627 17626
dongsheng@627 17627 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17628 #: ../en/ch13-mq-collab.xml:270
dongsheng@627 17629 msgid ""
dongsheng@627 17630 "Normally, the base tree atop which the patches apply should be a snapshot of "
dongsheng@627 17631 "a very recent upstream tree. This best facilitates the development of "
dongsheng@627 17632 "patches that can easily be submitted upstream with few or no modifications."
dongsheng@627 17633 msgstr ""
dongsheng@627 17634
dongsheng@627 17635 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 17636 #: ../en/ch13-mq-collab.xml:277
dongsheng@627 17637 msgid "Dividing up the <filename role=\"special\">series</filename> file"
dongsheng@636 17638 msgstr "分类补丁<filename role=\"special\">系列</filename>"
dongsheng@627 17639
dongsheng@627 17640 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17641 #: ../en/ch13-mq-collab.xml:280
dongsheng@627 17642 msgid ""
dongsheng@627 17643 "I categorise the patches in the <filename role=\"special\">series</filename> "
dongsheng@627 17644 "file into a number of logical groups. Each section of like patches begins "
dongsheng@627 17645 "with a block of comments that describes the purpose of the patches that "
dongsheng@627 17646 "follow."
dongsheng@627 17647 msgstr ""
dongsheng@627 17648
dongsheng@627 17649 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17650 #: ../en/ch13-mq-collab.xml:286
dongsheng@627 17651 msgid ""
dongsheng@627 17652 "The sequence of patch groups that I maintain follows. The ordering of these "
dongsheng@627 17653 "groups is important; I'll describe why after I introduce the groups."
dongsheng@627 17654 msgstr ""
dongsheng@627 17655
dongsheng@627 17656 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 17657 #: ../en/ch13-mq-collab.xml:290
dongsheng@627 17658 msgid ""
dongsheng@627 17659 "The <quote>accepted</quote> group. Patches that the development team has "
dongsheng@627 17660 "submitted to the maintainer of the Infiniband subsystem, and which he has "
dongsheng@627 17661 "accepted, but which are not present in the snapshot that the tiny repository "
dongsheng@627 17662 "is based on. These are <quote>read only</quote> patches, present only to "
dongsheng@627 17663 "transform the tree into a similar state as it is in the upstream maintainer's "
dongsheng@627 17664 "repository."
dongsheng@627 17665 msgstr ""
dongsheng@627 17666
dongsheng@627 17667 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 17668 #: ../en/ch13-mq-collab.xml:298
dongsheng@627 17669 msgid ""
dongsheng@627 17670 "The <quote>rework</quote> group. Patches that I have submitted, but that the "
dongsheng@627 17671 "upstream maintainer has requested modifications to before he will accept them."
dongsheng@627 17672 msgstr ""
dongsheng@627 17673
dongsheng@627 17674 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 17675 #: ../en/ch13-mq-collab.xml:303
dongsheng@627 17676 msgid ""
dongsheng@627 17677 "The <quote>pending</quote> group. Patches that I have not yet submitted to "
dongsheng@627 17678 "the upstream maintainer, but which we have finished working on. These will be "
dongsheng@627 17679 "<quote>read only</quote> for a while. If the upstream maintainer accepts "
dongsheng@627 17680 "them upon submission, I'll move them to the end of the <quote>accepted</"
dongsheng@627 17681 "quote> group. If he requests that I modify any, I'll move them to the "
dongsheng@627 17682 "beginning of the <quote>rework</quote> group."
dongsheng@627 17683 msgstr ""
dongsheng@627 17684
dongsheng@627 17685 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 17686 #: ../en/ch13-mq-collab.xml:312
dongsheng@627 17687 msgid ""
dongsheng@627 17688 "The <quote>in progress</quote> group. Patches that are actively being "
dongsheng@627 17689 "developed, and should not be submitted anywhere yet."
dongsheng@627 17690 msgstr ""
dongsheng@627 17691
dongsheng@627 17692 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 17693 #: ../en/ch13-mq-collab.xml:316
dongsheng@627 17694 msgid ""
dongsheng@627 17695 "The <quote>backport</quote> group. Patches that adapt the source tree to "
dongsheng@627 17696 "older versions of the kernel tree."
dongsheng@627 17697 msgstr ""
dongsheng@627 17698
dongsheng@627 17699 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 17700 #: ../en/ch13-mq-collab.xml:320
dongsheng@627 17701 msgid ""
dongsheng@627 17702 "The <quote>do not ship</quote> group. Patches that for some reason should "
dongsheng@627 17703 "never be submitted upstream. For example, one such patch might change "
dongsheng@627 17704 "embedded driver identification strings to make it easier to distinguish, in "
dongsheng@627 17705 "the field, between an out-of-tree version of the driver and a version shipped "
dongsheng@627 17706 "by a distribution vendor."
dongsheng@627 17707 msgstr ""
dongsheng@627 17708
dongsheng@627 17709 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17710 #: ../en/ch13-mq-collab.xml:328
dongsheng@627 17711 msgid ""
dongsheng@627 17712 "Now to return to the reasons for ordering groups of patches in this way. We "
dongsheng@627 17713 "would like the lowest patches in the stack to be as stable as possible, so "
dongsheng@627 17714 "that we will not need to rework higher patches due to changes in context. "
dongsheng@627 17715 "Putting patches that will never be changed first in the <filename role="
dongsheng@627 17716 "\"special\">series</filename> file serves this purpose."
dongsheng@627 17717 msgstr ""
dongsheng@627 17718
dongsheng@627 17719 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17720 #: ../en/ch13-mq-collab.xml:336
dongsheng@627 17721 msgid ""
dongsheng@627 17722 "We would also like the patches that we know we'll need to modify to be "
dongsheng@627 17723 "applied on top of a source tree that resembles the upstream tree as closely "
dongsheng@627 17724 "as possible. This is why we keep accepted patches around for a while."
dongsheng@627 17725 msgstr ""
dongsheng@627 17726
dongsheng@627 17727 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17728 #: ../en/ch13-mq-collab.xml:341
dongsheng@627 17729 msgid ""
dongsheng@627 17730 "The <quote>backport</quote> and <quote>do not ship</quote> patches float at "
dongsheng@627 17731 "the end of the <filename role=\"special\">series</filename> file. The "
dongsheng@627 17732 "backport patches must be applied on top of all other patches, and the "
dongsheng@627 17733 "<quote>do not ship</quote> patches might as well stay out of harm's way."
dongsheng@627 17734 msgstr ""
dongsheng@627 17735
dongsheng@627 17736 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 17737 #: ../en/ch13-mq-collab.xml:350
dongsheng@627 17738 msgid "Maintaining the patch series"
dongsheng@636 17739 msgstr "维护补丁系列"
dongsheng@627 17740
dongsheng@627 17741 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17742 #: ../en/ch13-mq-collab.xml:352
dongsheng@627 17743 msgid ""
dongsheng@627 17744 "In my work, I use a number of guards to control which patches are to be "
dongsheng@627 17745 "applied."
dongsheng@627 17746 msgstr ""
dongsheng@627 17747
dongsheng@627 17748 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 17749 #: ../en/ch13-mq-collab.xml:356
dongsheng@627 17750 msgid ""
dongsheng@627 17751 "<quote>Accepted</quote> patches are guarded with <literal>accepted</"
dongsheng@627 17752 "literal>. I enable this guard most of the time. When I'm applying the "
dongsheng@627 17753 "patches on top of a tree where the patches are already present, I can turn "
dongsheng@627 17754 "this patch off, and the patches that follow it will apply cleanly."
dongsheng@627 17755 msgstr ""
dongsheng@627 17756
dongsheng@627 17757 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 17758 #: ../en/ch13-mq-collab.xml:363
dongsheng@627 17759 msgid ""
dongsheng@627 17760 "Patches that are <quote>finished</quote>, but not yet submitted, have no "
dongsheng@627 17761 "guards. If I'm applying the patch stack to a copy of the upstream tree, I "
dongsheng@627 17762 "don't need to enable any guards in order to get a reasonably safe source tree."
dongsheng@627 17763 msgstr ""
dongsheng@627 17764
dongsheng@627 17765 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 17766 #: ../en/ch13-mq-collab.xml:369
dongsheng@627 17767 msgid ""
dongsheng@627 17768 "Those patches that need reworking before being resubmitted are guarded with "
dongsheng@627 17769 "<literal>rework</literal>."
dongsheng@627 17770 msgstr ""
dongsheng@627 17771
dongsheng@627 17772 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 17773 #: ../en/ch13-mq-collab.xml:373
dongsheng@627 17774 msgid ""
dongsheng@627 17775 "For those patches that are still under development, I use <literal>devel</"
dongsheng@627 17776 "literal>."
dongsheng@627 17777 msgstr ""
dongsheng@627 17778
dongsheng@627 17779 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 17780 #: ../en/ch13-mq-collab.xml:376
dongsheng@627 17781 msgid ""
dongsheng@627 17782 "A backport patch may have several guards, one for each version of the kernel "
dongsheng@627 17783 "to which it applies. For example, a patch that backports a piece of code to "
dongsheng@627 17784 "2.6.9 will have a <literal>2.6.9</literal> guard."
dongsheng@627 17785 msgstr ""
dongsheng@627 17786
dongsheng@627 17787 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 17788 #: ../en/ch13-mq-collab.xml:381
dongsheng@627 17789 msgid ""
dongsheng@627 17790 "This variety of guards gives me considerable flexibility in determining what "
dongsheng@627 17791 "kind of source tree I want to end up with. For most situations, the "
dongsheng@627 17792 "selection of appropriate guards is automated during the build process, but I "
dongsheng@627 17793 "can manually tune the guards to use for less common circumstances."
dongsheng@627 17794 msgstr ""
dongsheng@627 17795
dongsheng@627 17796 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 17797 #: ../en/ch13-mq-collab.xml:388
dongsheng@627 17798 msgid "The art of writing backport patches"
dongsheng@636 17799 msgstr "编写向后移植补丁的艺术"
dongsheng@627 17800
dongsheng@627 17801 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17802 #: ../en/ch13-mq-collab.xml:390
dongsheng@627 17803 msgid ""
dongsheng@627 17804 "Using MQ, writing a backport patch is a simple process. All such a patch has "
dongsheng@627 17805 "to do is modify a piece of code that uses a kernel feature not present in the "
dongsheng@627 17806 "older version of the kernel, so that the driver continues to work correctly "
dongsheng@627 17807 "under that older version."
dongsheng@627 17808 msgstr ""
dongsheng@627 17809
dongsheng@627 17810 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17811 #: ../en/ch13-mq-collab.xml:396
dongsheng@627 17812 msgid ""
dongsheng@627 17813 "A useful goal when writing a good backport patch is to make your code look as "
dongsheng@627 17814 "if it was written for the older version of the kernel you're targeting. The "
dongsheng@627 17815 "less obtrusive the patch, the easier it will be to understand and maintain. "
dongsheng@627 17816 "If you're writing a collection of backport patches to avoid the <quote>rat's "
dongsheng@627 17817 "nest</quote> effect of lots of <literal>#ifdef</literal>s (hunks of source "
dongsheng@627 17818 "code that are only used conditionally) in your code, don't introduce version-"
dongsheng@627 17819 "dependent <literal>#ifdef</literal>s into the patches. Instead, write "
dongsheng@627 17820 "several patches, each of which makes unconditional changes, and control their "
dongsheng@627 17821 "application using guards."
dongsheng@627 17822 msgstr ""
dongsheng@627 17823
dongsheng@627 17824 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17825 #: ../en/ch13-mq-collab.xml:409
dongsheng@627 17826 msgid ""
dongsheng@627 17827 "There are two reasons to divide backport patches into a distinct group, away "
dongsheng@627 17828 "from the <quote>regular</quote> patches whose effects they modify. The first "
dongsheng@627 17829 "is that intermingling the two makes it more difficult to use a tool like the "
dongsheng@627 17830 "<literal role=\"hg-ext\">patchbomb</literal> extension to automate the "
dongsheng@627 17831 "process of submitting the patches to an upstream maintainer. The second is "
dongsheng@627 17832 "that a backport patch could perturb the context in which a subsequent regular "
dongsheng@627 17833 "patch is applied, making it impossible to apply the regular patch cleanly "
dongsheng@627 17834 "<emphasis>without</emphasis> the earlier backport patch already being applied."
dongsheng@627 17835 msgstr ""
dongsheng@627 17836
dongsheng@627 17837 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 17838 #: ../en/ch13-mq-collab.xml:424
dongsheng@627 17839 msgid "Useful tips for developing with MQ"
dongsheng@636 17840 msgstr "使用 MQ 开发的技巧"
dongsheng@627 17841
dongsheng@627 17842 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 17843 #: ../en/ch13-mq-collab.xml:427
dongsheng@627 17844 msgid "Organising patches in directories"
dongsheng@636 17845 msgstr "将补丁放到几个目录中"
dongsheng@627 17846
dongsheng@627 17847 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17848 #: ../en/ch13-mq-collab.xml:429
dongsheng@627 17849 msgid ""
dongsheng@627 17850 "If you're working on a substantial project with MQ, it's not difficult to "
dongsheng@627 17851 "accumulate a large number of patches. For example, I have one patch "
dongsheng@627 17852 "repository that contains over 250 patches."
dongsheng@627 17853 msgstr ""
dongsheng@627 17854
dongsheng@627 17855 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17856 #: ../en/ch13-mq-collab.xml:434
dongsheng@627 17857 msgid ""
dongsheng@627 17858 "If you can group these patches into separate logical categories, you can if "
dongsheng@627 17859 "you like store them in different directories; MQ has no problems with patch "
dongsheng@627 17860 "names that contain path separators."
dongsheng@627 17861 msgstr ""
dongsheng@627 17862
dongsheng@627 17863 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 17864 #: ../en/ch13-mq-collab.xml:441
dongsheng@627 17865 msgid "Viewing the history of a patch"
dongsheng@636 17866 msgstr "察看补丁的历史"
dongsheng@627 17867
dongsheng@627 17868 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17869 #: ../en/ch13-mq-collab.xml:443
dongsheng@627 17870 msgid ""
dongsheng@627 17871 "If you're developing a set of patches over a long time, it's a good idea to "
songdongsheng@658 17872 "maintain them in a repository, as discussed in <xref linkend=\"sec:mq:repo\"/"
songdongsheng@658 17873 ">. If you do so, you'll quickly discover that using the <command role=\"hg-"
songdongsheng@658 17874 "cmd\">hg diff</command> command to look at the history of changes to a patch "
songdongsheng@658 17875 "is unworkable. This is in part because you're looking at the second "
dongsheng@627 17876 "derivative of the real code (a diff of a diff), but also because MQ adds "
dongsheng@627 17877 "noise to the process by modifying time stamps and directory names when it "
dongsheng@627 17878 "updates a patch."
dongsheng@627 17879 msgstr ""
dongsheng@627 17880
dongsheng@627 17881 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17882 #: ../en/ch13-mq-collab.xml:455
dongsheng@627 17883 msgid ""
dongsheng@627 17884 "However, you can use the <literal role=\"hg-ext\">extdiff</literal> "
dongsheng@627 17885 "extension, which is bundled with Mercurial, to turn a diff of two versions of "
dongsheng@627 17886 "a patch into something readable. To do this, you will need a third-party "
dongsheng@627 17887 "package called <literal role=\"package\">patchutils</literal> <citation>web:"
dongsheng@627 17888 "patchutils</citation>. This provides a command named <command>interdiff</"
dongsheng@627 17889 "command>, which shows the differences between two diffs as a diff. Used on "
dongsheng@627 17890 "two versions of the same diff, it generates a diff that represents the diff "
dongsheng@627 17891 "from the first to the second version."
dongsheng@627 17892 msgstr ""
dongsheng@627 17893
dongsheng@627 17894 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17895 #: ../en/ch13-mq-collab.xml:466
dongsheng@627 17896 msgid ""
dongsheng@627 17897 "You can enable the <literal role=\"hg-ext\">extdiff</literal> extension in "
dongsheng@627 17898 "the usual way, by adding a line to the <literal role=\"rc-extensions"
dongsheng@650 17899 "\">extensions</literal> section of your <filename role=\"special\">~/.hgrc</"
dongsheng@627 17900 "filename>."
dongsheng@627 17901 msgstr ""
dongsheng@627 17902
dongsheng@627 17903 #
dongsheng@1034 17904 #. &example.hg-interdiff;
dongsheng@714 17905 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17906 #: ../en/ch13-mq-collab.xml:473
dongsheng@627 17907 msgid ""
dongsheng@627 17908 "The <command>interdiff</command> command expects to be passed the names of "
dongsheng@627 17909 "two files, but the <literal role=\"hg-ext\">extdiff</literal> extension "
dongsheng@627 17910 "passes the program it runs a pair of directories, each of which can contain "
dongsheng@627 17911 "an arbitrary number of files. We thus need a small program that will run "
dongsheng@627 17912 "<command>interdiff</command> on each pair of files in these two directories. "
dongsheng@627 17913 "This program is available as <filename role=\"special\">hg-interdiff</"
dongsheng@627 17914 "filename> in the <filename class=\"directory\">examples</filename> directory "
dongsheng@627 17915 "of the source code repository that accompanies this book."
dongsheng@627 17916 msgstr ""
dongsheng@627 17917
dongsheng@627 17918 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17919 #: ../en/ch13-mq-collab.xml:485
dongsheng@627 17920 msgid ""
dongsheng@627 17921 "With the <filename role=\"special\">hg-interdiff</filename> program in your "
dongsheng@627 17922 "shell's search path, you can run it as follows, from inside an MQ patch "
dongsheng@627 17923 "directory:"
dongsheng@627 17924 msgstr ""
dongsheng@627 17925
dongsheng@627 17926 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17927 #: ../en/ch13-mq-collab.xml:489
dongsheng@627 17928 msgid ""
dongsheng@627 17929 "Since you'll probably want to use this long-winded command a lot, you can get "
dongsheng@627 17930 "<literal role=\"hg-ext\">hgext</literal> to make it available as a normal "
dongsheng@650 17931 "Mercurial command, again by editing your <filename role=\"special\">~/.hgrc</"
dongsheng@627 17932 "filename>."
dongsheng@627 17933 msgstr ""
dongsheng@627 17934
dongsheng@627 17935 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17936 #: ../en/ch13-mq-collab.xml:496
dongsheng@627 17937 msgid ""
dongsheng@627 17938 "This directs <literal role=\"hg-ext\">hgext</literal> to make an "
dongsheng@627 17939 "<literal>interdiff</literal> command available, so you can now shorten the "
dongsheng@627 17940 "previous invocation of <command role=\"hg-ext-extdiff\">extdiff</command> to "
dongsheng@627 17941 "something a little more wieldy."
dongsheng@627 17942 msgstr ""
dongsheng@627 17943
dongsheng@627 17944 #. type: Content of: <book><chapter><sect1><sect2><note><para>
dongsheng@714 17945 #: ../en/ch13-mq-collab.xml:504
dongsheng@627 17946 msgid ""
dongsheng@627 17947 "The <command>interdiff</command> command works well only if the underlying "
dongsheng@627 17948 "files against which versions of a patch are generated remain the same. If "
dongsheng@627 17949 "you create a patch, modify the underlying files, and then regenerate the "
dongsheng@627 17950 "patch, <command>interdiff</command> may not produce useful output."
dongsheng@627 17951 msgstr ""
dongsheng@627 17952
dongsheng@627 17953 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 17954 #: ../en/ch13-mq-collab.xml:512
dongsheng@627 17955 msgid ""
dongsheng@627 17956 "The <literal role=\"hg-ext\">extdiff</literal> extension is useful for more "
dongsheng@627 17957 "than merely improving the presentation of MQ patches. To read more about it, "
songdongsheng@658 17958 "go to <xref linkend=\"sec:hgext:extdiff\"/>."
dongsheng@627 17959 msgstr ""
dongsheng@627 17960
dongsheng@627 17961 #. type: Content of: <book><chapter><title>
dongsheng@714 17962 #: ../en/ch14-hgext.xml:5
dongsheng@627 17963 msgid "Adding functionality with extensions"
dongsheng@627 17964 msgstr "使用扩展增加功能"
dongsheng@627 17965
dongsheng@627 17966 #. type: Content of: <book><chapter><para>
dongsheng@714 17967 #: ../en/ch14-hgext.xml:7
dongsheng@627 17968 msgid ""
dongsheng@627 17969 "While the core of Mercurial is quite complete from a functionality "
dongsheng@627 17970 "standpoint, it's deliberately shorn of fancy features. This approach of "
dongsheng@627 17971 "preserving simplicity keeps the software easy to deal with for both "
dongsheng@627 17972 "maintainers and users."
dongsheng@627 17973 msgstr ""
dongsheng@627 17974
dongsheng@627 17975 #. type: Content of: <book><chapter><para>
dongsheng@714 17976 #: ../en/ch14-hgext.xml:12
dongsheng@627 17977 msgid ""
dongsheng@627 17978 "However, Mercurial doesn't box you in with an inflexible command set: you can "
dongsheng@627 17979 "add features to it as <emphasis>extensions</emphasis> (sometimes known as "
dongsheng@627 17980 "<emphasis>plugins</emphasis>). We've already discussed a few of these "
dongsheng@627 17981 "extensions in earlier chapters."
dongsheng@627 17982 msgstr ""
dongsheng@627 17983
dongsheng@627 17984 #. type: Content of: <book><chapter><itemizedlist><listitem><para>
dongsheng@714 17985 #: ../en/ch14-hgext.xml:18
dongsheng@627 17986 msgid ""
songdongsheng@658 17987 "<xref linkend=\"sec:tour-merge:fetch\"/> covers the <literal role=\"hg-ext"
songdongsheng@658 17988 "\">fetch</literal> extension; this combines pulling new changes and merging "
songdongsheng@658 17989 "them with local changes into a single command, <command role=\"hg-ext-fetch"
songdongsheng@658 17990 "\">fetch</command>."
dongsheng@627 17991 msgstr ""
dongsheng@627 17992
dongsheng@627 17993 #. type: Content of: <book><chapter><itemizedlist><listitem><para>
dongsheng@714 17994 #: ../en/ch14-hgext.xml:24
dongsheng@627 17995 msgid ""
songdongsheng@658 17996 "In <xref linkend=\"chap:hook\"/>, we covered several extensions that are "
songdongsheng@658 17997 "useful for hook-related functionality: <literal role=\"hg-ext\">acl</literal> "
songdongsheng@658 17998 "adds access control lists; <literal role=\"hg-ext\">bugzilla</literal> adds "
songdongsheng@658 17999 "integration with the Bugzilla bug tracking system; and <literal role=\"hg-ext"
songdongsheng@658 18000 "\">notify</literal> sends notification emails on new changes."
dongsheng@627 18001 msgstr ""
dongsheng@627 18002
dongsheng@627 18003 #. type: Content of: <book><chapter><itemizedlist><listitem><para>
dongsheng@714 18004 #: ../en/ch14-hgext.xml:33
dongsheng@627 18005 msgid ""
dongsheng@627 18006 "The Mercurial Queues patch management extension is so invaluable that it "
songdongsheng@658 18007 "merits two chapters and an appendix all to itself. <xref linkend=\"chap:mq\"/"
songdongsheng@658 18008 "> covers the basics; <xref linkend=\"chap:mq-collab\"/> discusses advanced "
songdongsheng@658 18009 "topics; and <xref linkend=\"chap:mqref\"/> goes into detail on each command."
dongsheng@627 18010 msgstr ""
dongsheng@627 18011
dongsheng@627 18012 #. type: Content of: <book><chapter><para>
dongsheng@714 18013 #: ../en/ch14-hgext.xml:43
dongsheng@627 18014 msgid ""
dongsheng@627 18015 "In this chapter, we'll cover some of the other extensions that are available "
dongsheng@627 18016 "for Mercurial, and briefly touch on some of the machinery you'll need to know "
dongsheng@627 18017 "about if you want to write an extension of your own."
dongsheng@627 18018 msgstr ""
dongsheng@627 18019
dongsheng@627 18020 #. type: Content of: <book><chapter><itemizedlist><listitem><para>
dongsheng@714 18021 #: ../en/ch14-hgext.xml:48
dongsheng@627 18022 msgid ""
songdongsheng@658 18023 "In <xref linkend=\"sec:hgext:inotify\"/>, we'll discuss the possibility of "
songdongsheng@658 18024 "<emphasis>huge</emphasis> performance improvements using the <literal role="
songdongsheng@658 18025 "\"hg-ext\">inotify</literal> extension."
dongsheng@627 18026 msgstr ""
dongsheng@627 18027
dongsheng@627 18028 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 18029 #: ../en/ch14-hgext.xml:55
dongsheng@627 18030 msgid ""
dongsheng@627 18031 "Improve performance with the <literal role=\"hg-ext\">inotify</literal> "
dongsheng@627 18032 "extension"
dongsheng@636 18033 msgstr "使用扩展 <literal role=\"hg-ext\">inotify</literal> 以提高性能"
dongsheng@627 18034
dongsheng@627 18035 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18036 #: ../en/ch14-hgext.xml:58
dongsheng@627 18037 msgid ""
dongsheng@627 18038 "Are you interested in having some of the most common Mercurial operations run "
dongsheng@627 18039 "as much as a hundred times faster? Read on!"
dongsheng@627 18040 msgstr ""
dongsheng@627 18041
dongsheng@627 18042 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18043 #: ../en/ch14-hgext.xml:62
dongsheng@627 18044 msgid ""
dongsheng@627 18045 "Mercurial has great performance under normal circumstances. For example, "
dongsheng@627 18046 "when you run the <command role=\"hg-cmd\">hg status</command> command, "
dongsheng@627 18047 "Mercurial has to scan almost every directory and file in your repository so "
dongsheng@627 18048 "that it can display file status. Many other Mercurial commands need to do "
dongsheng@627 18049 "the same work behind the scenes; for example, the <command role=\"hg-cmd\">hg "
dongsheng@627 18050 "diff</command> command uses the status machinery to avoid doing an expensive "
dongsheng@627 18051 "comparison operation on files that obviously haven't changed."
dongsheng@627 18052 msgstr ""
dongsheng@627 18053
dongsheng@627 18054 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18055 #: ../en/ch14-hgext.xml:72
dongsheng@627 18056 msgid ""
dongsheng@627 18057 "Because obtaining file status is crucial to good performance, the authors of "
dongsheng@627 18058 "Mercurial have optimised this code to within an inch of its life. However, "
dongsheng@627 18059 "there's no avoiding the fact that when you run <command role=\"hg-cmd\">hg "
dongsheng@627 18060 "status</command>, Mercurial is going to have to perform at least one "
dongsheng@627 18061 "expensive system call for each managed file to determine whether it's changed "
dongsheng@627 18062 "since the last time Mercurial checked. For a sufficiently large repository, "
dongsheng@627 18063 "this can take a long time."
dongsheng@627 18064 msgstr ""
dongsheng@627 18065
dongsheng@627 18066 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18067 #: ../en/ch14-hgext.xml:82
dongsheng@627 18068 msgid ""
dongsheng@627 18069 "To put a number on the magnitude of this effect, I created a repository "
dongsheng@627 18070 "containing 150,000 managed files. I timed <command role=\"hg-cmd\">hg "
dongsheng@627 18071 "status</command> as taking ten seconds to run, even when <emphasis>none</"
dongsheng@627 18072 "emphasis> of those files had been modified."
dongsheng@627 18073 msgstr ""
dongsheng@627 18074
dongsheng@627 18075 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18076 #: ../en/ch14-hgext.xml:88
dongsheng@627 18077 msgid ""
dongsheng@627 18078 "Many modern operating systems contain a file notification facility. If a "
dongsheng@627 18079 "program signs up to an appropriate service, the operating system will notify "
dongsheng@627 18080 "it every time a file of interest is created, modified, or deleted. On Linux "
dongsheng@627 18081 "systems, the kernel component that does this is called <literal>inotify</"
dongsheng@627 18082 "literal>."
dongsheng@627 18083 msgstr ""
dongsheng@627 18084
dongsheng@627 18085 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18086 #: ../en/ch14-hgext.xml:95
dongsheng@627 18087 msgid ""
dongsheng@627 18088 "Mercurial's <literal role=\"hg-ext\">inotify</literal> extension talks to the "
dongsheng@627 18089 "kernel's <literal>inotify</literal> component to optimise <command role=\"hg-"
dongsheng@627 18090 "cmd\">hg status</command> commands. The extension has two components. A "
dongsheng@627 18091 "daemon sits in the background and receives notifications from the "
dongsheng@627 18092 "<literal>inotify</literal> subsystem. It also listens for connections from a "
songdongsheng@710 18093 "regular Mercurial command. The extension modifies Mercurial's behavior so "
dongsheng@627 18094 "that instead of scanning the filesystem, it queries the daemon. Since the "
dongsheng@627 18095 "daemon has perfect information about the state of the repository, it can "
dongsheng@627 18096 "respond with a result instantaneously, avoiding the need to scan every "
dongsheng@627 18097 "directory and file in the repository."
dongsheng@627 18098 msgstr ""
dongsheng@627 18099
dongsheng@627 18100 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18101 #: ../en/ch14-hgext.xml:108
dongsheng@627 18102 msgid ""
dongsheng@627 18103 "Recall the ten seconds that I measured plain Mercurial as taking to run "
dongsheng@627 18104 "<command role=\"hg-cmd\">hg status</command> on a 150,000 file repository. "
dongsheng@627 18105 "With the <literal role=\"hg-ext\">inotify</literal> extension enabled, the "
dongsheng@627 18106 "time dropped to 0.1 seconds, a factor of <emphasis>one hundred</emphasis> "
dongsheng@627 18107 "faster."
dongsheng@627 18108 msgstr ""
dongsheng@627 18109
dongsheng@627 18110 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18111 #: ../en/ch14-hgext.xml:115
dongsheng@627 18112 msgid "Before we continue, please pay attention to some caveats."
dongsheng@627 18113 msgstr ""
dongsheng@627 18114
dongsheng@627 18115 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 18116 #: ../en/ch14-hgext.xml:118
dongsheng@627 18117 msgid ""
dongsheng@627 18118 "The <literal role=\"hg-ext\">inotify</literal> extension is Linux-specific. "
dongsheng@627 18119 "Because it interfaces directly to the Linux kernel's <literal>inotify</"
dongsheng@627 18120 "literal> subsystem, it does not work on other operating systems."
dongsheng@627 18121 msgstr ""
dongsheng@627 18122
dongsheng@627 18123 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 18124 #: ../en/ch14-hgext.xml:123
dongsheng@627 18125 msgid ""
dongsheng@627 18126 "It should work on any Linux distribution that was released after early 2005. "
dongsheng@627 18127 "Older distributions are likely to have a kernel that lacks <literal>inotify</"
dongsheng@627 18128 "literal>, or a version of <literal>glibc</literal> that does not have the "
dongsheng@627 18129 "necessary interfacing support."
dongsheng@627 18130 msgstr ""
dongsheng@627 18131
dongsheng@627 18132 #. type: Content of: <book><chapter><sect1><itemizedlist><listitem><para>
dongsheng@714 18133 #: ../en/ch14-hgext.xml:130
dongsheng@627 18134 msgid ""
dongsheng@627 18135 "Not all filesystems are suitable for use with the <literal role=\"hg-ext"
dongsheng@627 18136 "\">inotify</literal> extension. Network filesystems such as NFS are a non-"
dongsheng@627 18137 "starter, for example, particularly if you're running Mercurial on several "
dongsheng@627 18138 "systems, all mounting the same network filesystem. The kernel's "
dongsheng@627 18139 "<literal>inotify</literal> system has no way of knowing about changes made on "
dongsheng@627 18140 "another system. Most local filesystems (e.g. ext3, XFS, ReiserFS) should "
dongsheng@627 18141 "work fine."
dongsheng@627 18142 msgstr ""
dongsheng@627 18143
dongsheng@627 18144 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18145 #: ../en/ch14-hgext.xml:141
dongsheng@627 18146 msgid ""
dongsheng@627 18147 "The <literal role=\"hg-ext\">inotify</literal> extension is not yet shipped "
dongsheng@627 18148 "with Mercurial as of May 2007, so it's a little more involved to set up than "
dongsheng@627 18149 "other extensions. But the performance improvement is worth it!"
dongsheng@627 18150 msgstr ""
dongsheng@627 18151
dongsheng@627 18152 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18153 #: ../en/ch14-hgext.xml:146
dongsheng@627 18154 msgid ""
dongsheng@627 18155 "The extension currently comes in two parts: a set of patches to the Mercurial "
dongsheng@627 18156 "source code, and a library of Python bindings to the <literal>inotify</"
dongsheng@627 18157 "literal> subsystem."
dongsheng@627 18158 msgstr ""
dongsheng@627 18159
dongsheng@627 18160 #. type: Content of: <book><chapter><sect1><note><para>
dongsheng@714 18161 #: ../en/ch14-hgext.xml:150
dongsheng@627 18162 msgid ""
dongsheng@627 18163 "There are <emphasis>two</emphasis> Python <literal>inotify</literal> binding "
dongsheng@627 18164 "libraries. One of them is called <literal>pyinotify</literal>, and is "
dongsheng@627 18165 "packaged by some Linux distributions as <literal>python-inotify</literal>. "
dongsheng@627 18166 "This is <emphasis>not</emphasis> the one you'll need, as it is too buggy and "
dongsheng@627 18167 "inefficient to be practical."
dongsheng@627 18168 msgstr ""
dongsheng@627 18169
dongsheng@627 18170 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18171 #: ../en/ch14-hgext.xml:157
dongsheng@627 18172 msgid ""
dongsheng@627 18173 "To get going, it's best to already have a functioning copy of Mercurial "
dongsheng@627 18174 "installed."
dongsheng@627 18175 msgstr ""
dongsheng@627 18176
dongsheng@627 18177 #. type: Content of: <book><chapter><sect1><note><para>
dongsheng@714 18178 #: ../en/ch14-hgext.xml:160
dongsheng@627 18179 msgid ""
dongsheng@627 18180 "If you follow the instructions below, you'll be <emphasis>replacing</"
dongsheng@627 18181 "emphasis> and overwriting any existing installation of Mercurial that you "
dongsheng@627 18182 "might already have, using the latest <quote>bleeding edge</quote> Mercurial "
dongsheng@627 18183 "code. Don't say you weren't warned!"
dongsheng@627 18184 msgstr ""
dongsheng@627 18185
dongsheng@627 18186 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
dongsheng@714 18187 #: ../en/ch14-hgext.xml:167
dongsheng@627 18188 msgid ""
dongsheng@627 18189 "Clone the Python <literal>inotify</literal> binding repository. Build and "
dongsheng@627 18190 "install it."
dongsheng@627 18191 msgstr ""
dongsheng@627 18192
dongsheng@627 18193 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
dongsheng@714 18194 #: ../en/ch14-hgext.xml:174
dongsheng@627 18195 msgid ""
dongsheng@627 18196 "Clone the <filename class=\"directory\">crew</filename> Mercurial "
dongsheng@627 18197 "repository. Clone the <literal role=\"hg-ext\">inotify</literal> patch "
dongsheng@627 18198 "repository so that Mercurial Queues will be able to apply patches to your "
dongsheng@627 18199 "cope of the <filename class=\"directory\">crew</filename> repository."
dongsheng@627 18200 msgstr ""
dongsheng@627 18201
dongsheng@627 18202 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
dongsheng@714 18203 #: ../en/ch14-hgext.xml:184
dongsheng@627 18204 msgid ""
dongsheng@627 18205 "Make sure that you have the Mercurial Queues extension, <literal role=\"hg-ext"
songdongsheng@658 18206 "\">mq</literal>, enabled. If you've never used MQ, read <xref linkend=\"sec:"
songdongsheng@658 18207 "mq:start\"/> to get started quickly."
dongsheng@627 18208 msgstr ""
dongsheng@627 18209
dongsheng@627 18210 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
dongsheng@714 18211 #: ../en/ch14-hgext.xml:190
dongsheng@627 18212 msgid ""
dongsheng@627 18213 "Go into the <filename class=\"directory\">inotify</filename> repo, and apply "
dongsheng@627 18214 "all of the <literal role=\"hg-ext\">inotify</literal> patches using the "
dongsheng@627 18215 "<option role=\"hg-ext-mq-cmd-qpush-opt\">hg -a</option> option to the "
dongsheng@627 18216 "<command role=\"hg-ext-mq\">qpush</command> command."
dongsheng@627 18217 msgstr ""
dongsheng@627 18218
dongsheng@627 18219 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
dongsheng@714 18220 #: ../en/ch14-hgext.xml:199
dongsheng@627 18221 msgid ""
dongsheng@627 18222 "If you get an error message from <command role=\"hg-ext-mq\">qpush</command>, "
dongsheng@627 18223 "you should not continue. Instead, ask for help."
dongsheng@627 18224 msgstr ""
dongsheng@627 18225
dongsheng@627 18226 #. type: Content of: <book><chapter><sect1><orderedlist><listitem><para>
dongsheng@714 18227 #: ../en/ch14-hgext.xml:203
dongsheng@627 18228 msgid "Build and install the patched version of Mercurial."
dongsheng@627 18229 msgstr ""
dongsheng@627 18230
dongsheng@627 18231 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18232 #: ../en/ch14-hgext.xml:209
dongsheng@627 18233 msgid ""
dongsheng@627 18234 "Once you've build a suitably patched version of Mercurial, all you need to do "
dongsheng@627 18235 "to enable the <literal role=\"hg-ext\">inotify</literal> extension is add an "
dongsheng@650 18236 "entry to your <filename role=\"special\">~/.hgrc</filename>."
dongsheng@650 18237 msgstr ""
dongsheng@650 18238
dongsheng@650 18239 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18240 #: ../en/ch14-hgext.xml:214
dongsheng@627 18241 msgid ""
dongsheng@627 18242 "When the <literal role=\"hg-ext\">inotify</literal> extension is enabled, "
dongsheng@627 18243 "Mercurial will automatically and transparently start the status daemon the "
dongsheng@627 18244 "first time you run a command that needs status in a repository. It runs one "
dongsheng@627 18245 "status daemon per repository."
dongsheng@627 18246 msgstr ""
dongsheng@627 18247
dongsheng@627 18248 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18249 #: ../en/ch14-hgext.xml:220
dongsheng@627 18250 msgid ""
dongsheng@627 18251 "The status daemon is started silently, and runs in the background. If you "
dongsheng@627 18252 "look at a list of running processes after you've enabled the <literal role="
dongsheng@627 18253 "\"hg-ext\">inotify</literal> extension and run a few commands in different "
dongsheng@627 18254 "repositories, you'll thus see a few <literal>hg</literal> processes sitting "
dongsheng@627 18255 "around, waiting for updates from the kernel and queries from Mercurial."
dongsheng@627 18256 msgstr ""
dongsheng@627 18257
dongsheng@627 18258 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18259 #: ../en/ch14-hgext.xml:228
dongsheng@627 18260 msgid ""
dongsheng@627 18261 "The first time you run a Mercurial command in a repository when you have the "
dongsheng@627 18262 "<literal role=\"hg-ext\">inotify</literal> extension enabled, it will run "
dongsheng@627 18263 "with about the same performance as a normal Mercurial command. This is "
dongsheng@627 18264 "because the status daemon needs to perform a normal status scan so that it "
dongsheng@627 18265 "has a baseline against which to apply later updates from the kernel. "
dongsheng@627 18266 "However, <emphasis>every</emphasis> subsequent command that does any kind of "
dongsheng@627 18267 "status check should be noticeably faster on repositories of even fairly "
dongsheng@627 18268 "modest size. Better yet, the bigger your repository is, the greater a "
dongsheng@627 18269 "performance advantage you'll see. The <literal role=\"hg-ext\">inotify</"
dongsheng@627 18270 "literal> daemon makes status operations almost instantaneous on repositories "
dongsheng@627 18271 "of all sizes!"
dongsheng@627 18272 msgstr ""
dongsheng@627 18273
dongsheng@627 18274 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18275 #: ../en/ch14-hgext.xml:242
dongsheng@627 18276 msgid ""
dongsheng@627 18277 "If you like, you can manually start a status daemon using the <command role="
dongsheng@627 18278 "\"hg-ext-inotify\">inserve</command> command. This gives you slightly finer "
dongsheng@627 18279 "control over how the daemon ought to run. This command will of course only "
dongsheng@627 18280 "be available when the <literal role=\"hg-ext\">inotify</literal> extension is "
dongsheng@627 18281 "enabled."
dongsheng@627 18282 msgstr ""
dongsheng@627 18283
dongsheng@627 18284 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18285 #: ../en/ch14-hgext.xml:249
dongsheng@627 18286 msgid ""
dongsheng@627 18287 "When you're using the <literal role=\"hg-ext\">inotify</literal> extension, "
dongsheng@627 18288 "you should notice <emphasis>no difference at all</emphasis> in Mercurial's "
songdongsheng@710 18289 "behavior, with the sole exception of status-related commands running a whole "
dongsheng@627 18290 "lot faster than they used to. You should specifically expect that commands "
dongsheng@627 18291 "will not print different output; neither should they give different results. "
dongsheng@627 18292 "If either of these situations occurs, please report a bug."
dongsheng@627 18293 msgstr ""
dongsheng@627 18294
dongsheng@627 18295 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 18296 #: ../en/ch14-hgext.xml:260
dongsheng@627 18297 msgid ""
dongsheng@627 18298 "Flexible diff support with the <literal role=\"hg-ext\">extdiff</literal> "
dongsheng@627 18299 "extension"
dongsheng@636 18300 msgstr "使用扩展 <literal role=\"hg-ext\">extdiff</literal> 以扩展差异支持"
dongsheng@627 18301
dongsheng@627 18302 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18303 #: ../en/ch14-hgext.xml:263
dongsheng@627 18304 msgid ""
dongsheng@627 18305 "Mercurial's built-in <command role=\"hg-cmd\">hg diff</command> command "
dongsheng@627 18306 "outputs plaintext unified diffs."
dongsheng@627 18307 msgstr ""
dongsheng@627 18308 "Mercurial 内置命令 <command role=\"hg-cmd\">hg diff</command> 的输出与统一差异"
dongsheng@627 18309 "不同。"
dongsheng@627 18310
dongsheng@627 18311 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18312 #: ../en/ch14-hgext.xml:268
dongsheng@627 18313 msgid ""
dongsheng@627 18314 "If you would like to use an external tool to display modifications, you'll "
dongsheng@627 18315 "want to use the <literal role=\"hg-ext\">extdiff</literal> extension. This "
dongsheng@627 18316 "will let you use, for example, a graphical diff tool."
dongsheng@627 18317 msgstr ""
dongsheng@627 18318
dongsheng@627 18319 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18320 #: ../en/ch14-hgext.xml:273
dongsheng@627 18321 msgid ""
dongsheng@627 18322 "The <literal role=\"hg-ext\">extdiff</literal> extension is bundled with "
dongsheng@627 18323 "Mercurial, so it's easy to set up. In the <literal role=\"rc-extensions"
dongsheng@650 18324 "\">extensions</literal> section of your <filename role=\"special\">~/.hgrc</"
dongsheng@627 18325 "filename>, simply add a one-line entry to enable the extension."
dongsheng@627 18326 msgstr ""
dongsheng@627 18327
dongsheng@627 18328 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18329 #: ../en/ch14-hgext.xml:280
dongsheng@627 18330 msgid ""
dongsheng@627 18331 "This introduces a command named <command role=\"hg-ext-extdiff\">extdiff</"
dongsheng@627 18332 "command>, which by default uses your system's <command>diff</command> command "
dongsheng@627 18333 "to generate a unified diff in the same form as the built-in <command role="
dongsheng@627 18334 "\"hg-cmd\">hg diff</command> command."
dongsheng@627 18335 msgstr ""
dongsheng@627 18336
dongsheng@627 18337 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18338 #: ../en/ch14-hgext.xml:288
dongsheng@627 18339 msgid ""
dongsheng@627 18340 "The result won't be exactly the same as with the built-in <command role=\"hg-"
dongsheng@627 18341 "cmd\">hg diff</command> variations, because the output of <command>diff</"
dongsheng@627 18342 "command> varies from one system to another, even when passed the same options."
dongsheng@627 18343 msgstr ""
dongsheng@627 18344
dongsheng@627 18345 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18346 #: ../en/ch14-hgext.xml:293
dongsheng@627 18347 msgid ""
dongsheng@627 18348 "As the <quote><literal>making snapshot</literal></quote> lines of output "
dongsheng@627 18349 "above imply, the <command role=\"hg-ext-extdiff\">extdiff</command> command "
dongsheng@627 18350 "works by creating two snapshots of your source tree. The first snapshot is "
dongsheng@627 18351 "of the source revision; the second, of the target revision or working "
dongsheng@627 18352 "directory. The <command role=\"hg-ext-extdiff\">extdiff</command> command "
dongsheng@627 18353 "generates these snapshots in a temporary directory, passes the name of each "
dongsheng@627 18354 "directory to an external diff viewer, then deletes the temporary directory. "
dongsheng@627 18355 "For efficiency, it only snapshots the directories and files that have changed "
dongsheng@627 18356 "between the two revisions."
dongsheng@627 18357 msgstr ""
dongsheng@627 18358
dongsheng@627 18359 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18360 #: ../en/ch14-hgext.xml:306
dongsheng@627 18361 msgid ""
dongsheng@627 18362 "Snapshot directory names have the same base name as your repository. If your "
dongsheng@627 18363 "repository path is <filename class=\"directory\">/quux/bar/foo</filename>, "
dongsheng@627 18364 "then <filename class=\"directory\">foo</filename> will be the name of each "
dongsheng@627 18365 "snapshot directory. Each snapshot directory name has its changeset ID "
dongsheng@627 18366 "appended, if appropriate. If a snapshot is of revision "
dongsheng@627 18367 "<literal>a631aca1083f</literal>, the directory will be named <filename class="
dongsheng@627 18368 "\"directory\">foo.a631aca1083f</filename>. A snapshot of the working "
dongsheng@627 18369 "directory won't have a changeset ID appended, so it would just be <filename "
dongsheng@627 18370 "class=\"directory\">foo</filename> in this example. To see what this looks "
dongsheng@627 18371 "like in practice, look again at the <command role=\"hg-ext-extdiff\">extdiff</"
dongsheng@627 18372 "command> example above. Notice that the diff has the snapshot directory "
dongsheng@627 18373 "names embedded in its header."
dongsheng@627 18374 msgstr ""
dongsheng@627 18375
dongsheng@627 18376 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18377 #: ../en/ch14-hgext.xml:322
dongsheng@627 18378 msgid ""
dongsheng@627 18379 "The <command role=\"hg-ext-extdiff\">extdiff</command> command accepts two "
dongsheng@627 18380 "important options. The <option role=\"hg-ext-extdiff-cmd-extdiff-opt\">hg -p</"
dongsheng@627 18381 "option> option lets you choose a program to view differences with, instead of "
dongsheng@627 18382 "<command>diff</command>. With the <option role=\"hg-ext-extdiff-cmd-extdiff-"
dongsheng@627 18383 "opt\">hg -o</option> option, you can change the options that <command role="
dongsheng@627 18384 "\"hg-ext-extdiff\">extdiff</command> passes to the program (by default, these "
dongsheng@627 18385 "options are <quote><literal>-Npru</literal></quote>, which only make sense if "
dongsheng@627 18386 "you're running <command>diff</command>). In other respects, the <command "
dongsheng@627 18387 "role=\"hg-ext-extdiff\">extdiff</command> command acts similarly to the built-"
dongsheng@627 18388 "in <command role=\"hg-cmd\">hg diff</command> command: you use the same "
dongsheng@627 18389 "option names, syntax, and arguments to specify the revisions you want, the "
dongsheng@627 18390 "files you want, and so on."
dongsheng@627 18391 msgstr ""
dongsheng@627 18392
dongsheng@627 18393 #
dongsheng@627 18394 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18395 #: ../en/ch14-hgext.xml:339
dongsheng@627 18396 msgid ""
dongsheng@627 18397 "As an example, here's how to run the normal system <command>diff</command> "
dongsheng@627 18398 "command, getting it to generate context diffs (using the <option role=\"cmd-"
dongsheng@627 18399 "opt-diff\">-c</option> option) instead of unified diffs, and five lines of "
dongsheng@627 18400 "context instead of the default three (passing <literal>5</literal> as the "
dongsheng@627 18401 "argument to the <option role=\"cmd-opt-diff\">-C</option> option)."
dongsheng@627 18402 msgstr ""
dongsheng@627 18403
dongsheng@627 18404 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18405 #: ../en/ch14-hgext.xml:348
dongsheng@627 18406 msgid ""
dongsheng@627 18407 "Launching a visual diff tool is just as easy. Here's how to launch the "
dongsheng@627 18408 "<command>kdiff3</command> viewer."
dongsheng@627 18409 msgstr ""
dongsheng@627 18410
dongsheng@627 18411 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18412 #: ../en/ch14-hgext.xml:352
dongsheng@627 18413 msgid ""
dongsheng@627 18414 "If your diff viewing command can't deal with directories, you can easily work "
dongsheng@627 18415 "around this with a little scripting. For an example of such scripting in "
dongsheng@627 18416 "action with the <literal role=\"hg-ext\">mq</literal> extension and the "
songdongsheng@658 18417 "<command>interdiff</command> command, see <xref linkend=\"mq-collab:tips:"
songdongsheng@658 18418 "interdiff\"/>."
dongsheng@627 18419 msgstr ""
dongsheng@627 18420
dongsheng@627 18421 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 18422 #: ../en/ch14-hgext.xml:360
dongsheng@627 18423 msgid "Defining command aliases"
dongsheng@636 18424 msgstr "定义命令的别名"
dongsheng@627 18425
dongsheng@627 18426 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 18427 #: ../en/ch14-hgext.xml:362
dongsheng@627 18428 msgid ""
dongsheng@627 18429 "It can be cumbersome to remember the options to both the <command role=\"hg-"
dongsheng@627 18430 "ext-extdiff\">extdiff</command> command and the diff viewer you want to use, "
dongsheng@627 18431 "so the <literal role=\"hg-ext\">extdiff</literal> extension lets you define "
dongsheng@627 18432 "<emphasis>new</emphasis> commands that will invoke your diff viewer with "
dongsheng@627 18433 "exactly the right options."
dongsheng@627 18434 msgstr ""
dongsheng@627 18435
dongsheng@627 18436 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 18437 #: ../en/ch14-hgext.xml:369
dongsheng@650 18438 msgid ""
dongsheng@650 18439 "All you need to do is edit your <filename role=\"special\">~/.hgrc</"
dongsheng@627 18440 "filename>, and add a section named <literal role=\"rc-extdiff\">extdiff</"
dongsheng@627 18441 "literal>. Inside this section, you can define multiple commands. Here's how "
dongsheng@627 18442 "to add a <literal>kdiff3</literal> command. Once you've defined this, you "
dongsheng@627 18443 "can type <quote><literal>hg kdiff3</literal></quote> and the <literal role="
dongsheng@627 18444 "\"hg-ext\">extdiff</literal> extension will run <command>kdiff3</command> for "
dongsheng@627 18445 "you."
dongsheng@627 18446 msgstr ""
dongsheng@627 18447
dongsheng@627 18448 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 18449 #: ../en/ch14-hgext.xml:379
dongsheng@627 18450 msgid ""
dongsheng@627 18451 "If you leave the right hand side of the definition empty, as above, the "
dongsheng@627 18452 "<literal role=\"hg-ext\">extdiff</literal> extension uses the name of the "
dongsheng@627 18453 "command you defined as the name of the external program to run. But these "
dongsheng@627 18454 "names don't have to be the same. Here, we define a command named "
dongsheng@627 18455 "<quote><literal>hg wibble</literal></quote>, which runs <command>kdiff3</"
dongsheng@627 18456 "command>."
dongsheng@627 18457 msgstr ""
dongsheng@627 18458
dongsheng@627 18459 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 18460 #: ../en/ch14-hgext.xml:389
dongsheng@627 18461 msgid ""
dongsheng@627 18462 "You can also specify the default options that you want to invoke your diff "
dongsheng@627 18463 "viewing program with. The prefix to use is <quote><literal>opts.</literal></"
dongsheng@627 18464 "quote>, followed by the name of the command to which the options apply. This "
dongsheng@627 18465 "example defines a <quote><literal>hg vimdiff</literal></quote> command that "
dongsheng@627 18466 "runs the <command>vim</command> editor's <literal>DirDiff</literal> extension."
dongsheng@627 18467 msgstr ""
dongsheng@627 18468
dongsheng@627 18469 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 18470 #: ../en/ch14-hgext.xml:403
dongsheng@627 18471 msgid ""
dongsheng@627 18472 "Cherrypicking changes with the <literal role=\"hg-ext\">transplant</literal> "
dongsheng@627 18473 "extension"
dongsheng@636 18474 msgstr "使用扩展 <literal role=\"hg-ext\">transplant</literal> 以挑选修改"
dongsheng@627 18475
dongsheng@627 18476 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18477 #: ../en/ch14-hgext.xml:406
dongsheng@627 18478 msgid "Need to have a long chat with Brendan about this."
dongsheng@627 18479 msgstr ""
dongsheng@627 18480
dongsheng@627 18481 #. type: Content of: <book><chapter><sect1><title>
dongsheng@714 18482 #: ../en/ch14-hgext.xml:410
dongsheng@627 18483 msgid ""
dongsheng@627 18484 "Send changes via email with the <literal role=\"hg-ext\">patchbomb</literal> "
dongsheng@627 18485 "extension"
dongsheng@627 18486 msgstr ""
dongsheng@636 18487 "使用扩展 <literal role=\"hg-ext\">patchbomb</literal> 通过 email 发送修改"
dongsheng@627 18488
dongsheng@627 18489 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18490 #: ../en/ch14-hgext.xml:413
dongsheng@627 18491 msgid ""
dongsheng@627 18492 "Many projects have a culture of <quote>change review</quote>, in which people "
dongsheng@627 18493 "send their modifications to a mailing list for others to read and comment on "
dongsheng@627 18494 "before they commit the final version to a shared repository. Some projects "
dongsheng@627 18495 "have people who act as gatekeepers; they apply changes from other people to a "
dongsheng@627 18496 "repository to which those others don't have access."
dongsheng@627 18497 msgstr ""
dongsheng@627 18498
dongsheng@627 18499 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18500 #: ../en/ch14-hgext.xml:421
dongsheng@627 18501 msgid ""
dongsheng@627 18502 "Mercurial makes it easy to send changes over email for review or application, "
dongsheng@627 18503 "via its <literal role=\"hg-ext\">patchbomb</literal> extension. The "
dongsheng@627 18504 "extension is so named because changes are formatted as patches, and it's "
dongsheng@627 18505 "usual to send one changeset per email message. Sending a long series of "
dongsheng@627 18506 "changes by email is thus much like <quote>bombing</quote> the recipient's "
dongsheng@627 18507 "inbox, hence <quote>patchbomb</quote>."
dongsheng@627 18508 msgstr ""
dongsheng@627 18509
dongsheng@627 18510 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18511 #: ../en/ch14-hgext.xml:429
dongsheng@627 18512 msgid ""
dongsheng@627 18513 "As usual, the basic configuration of the <literal role=\"hg-ext\">patchbomb</"
dongsheng@627 18514 "literal> extension takes just one or two lines in your <filename role="
dongsheng@627 18515 "\"special\"> /.hgrc</filename>."
dongsheng@627 18516 msgstr ""
dongsheng@627 18517
dongsheng@627 18518 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18519 #: ../en/ch14-hgext.xml:435
dongsheng@627 18520 msgid ""
dongsheng@627 18521 "Once you've enabled the extension, you will have a new command available, "
dongsheng@627 18522 "named <command role=\"hg-ext-patchbomb\">email</command>."
dongsheng@627 18523 msgstr ""
dongsheng@627 18524
dongsheng@627 18525 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18526 #: ../en/ch14-hgext.xml:439
dongsheng@627 18527 msgid ""
dongsheng@627 18528 "The safest and best way to invoke the <command role=\"hg-ext-patchbomb"
dongsheng@627 18529 "\">email</command> command is to <emphasis>always</emphasis> run it first "
dongsheng@627 18530 "with the <option role=\"hg-ext-patchbomb-cmd-email-opt\">hg -n</option> "
dongsheng@627 18531 "option. This will show you what the command <emphasis>would</emphasis> send, "
dongsheng@627 18532 "without actually sending anything. Once you've had a quick glance over the "
dongsheng@627 18533 "changes and verified that you are sending the right ones, you can rerun the "
dongsheng@627 18534 "same command, with the <option role=\"hg-ext-patchbomb-cmd-email-opt\">hg -n</"
dongsheng@627 18535 "option> option removed."
dongsheng@627 18536 msgstr ""
dongsheng@627 18537
dongsheng@627 18538 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18539 #: ../en/ch14-hgext.xml:450
dongsheng@627 18540 msgid ""
dongsheng@627 18541 "The <command role=\"hg-ext-patchbomb\">email</command> command accepts the "
dongsheng@627 18542 "same kind of revision syntax as every other Mercurial command. For example, "
dongsheng@627 18543 "this command will send every revision between 7 and <literal>tip</literal>, "
dongsheng@627 18544 "inclusive."
dongsheng@627 18545 msgstr ""
dongsheng@627 18546
dongsheng@627 18547 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18548 #: ../en/ch14-hgext.xml:455
dongsheng@627 18549 msgid ""
dongsheng@627 18550 "You can also specify a <emphasis>repository</emphasis> to compare with. If "
dongsheng@627 18551 "you provide a repository but no revisions, the <command role=\"hg-ext-"
dongsheng@627 18552 "patchbomb\">email</command> command will send all revisions in the local "
dongsheng@627 18553 "repository that are not present in the remote repository. If you "
dongsheng@627 18554 "additionally specify revisions or a branch name (the latter using the <option "
dongsheng@627 18555 "role=\"hg-ext-patchbomb-cmd-email-opt\">hg -b</option> option), this will "
dongsheng@627 18556 "constrain the revisions sent."
dongsheng@627 18557 msgstr ""
dongsheng@627 18558
dongsheng@627 18559 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18560 #: ../en/ch14-hgext.xml:464
dongsheng@627 18561 msgid ""
dongsheng@627 18562 "It's perfectly safe to run the <command role=\"hg-ext-patchbomb\">email</"
dongsheng@627 18563 "command> command without the names of the people you want to send to: if you "
dongsheng@627 18564 "do this, it will just prompt you for those values interactively. (If you're "
dongsheng@627 18565 "using a Linux or Unix-like system, you should have enhanced "
dongsheng@627 18566 "<literal>readline</literal>-style editing capabilities when entering those "
dongsheng@627 18567 "headers, too, which is useful.)"
dongsheng@627 18568 msgstr ""
dongsheng@627 18569
dongsheng@627 18570 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18571 #: ../en/ch14-hgext.xml:472
dongsheng@627 18572 msgid ""
dongsheng@627 18573 "When you are sending just one revision, the <command role=\"hg-ext-patchbomb"
dongsheng@627 18574 "\">email</command> command will by default use the first line of the "
dongsheng@627 18575 "changeset description as the subject of the single email message it sends."
dongsheng@627 18576 msgstr ""
dongsheng@627 18577
dongsheng@627 18578 #. type: Content of: <book><chapter><sect1><para>
dongsheng@714 18579 #: ../en/ch14-hgext.xml:477
dongsheng@627 18580 msgid ""
dongsheng@627 18581 "If you send multiple revisions, the <command role=\"hg-ext-patchbomb\">email</"
dongsheng@627 18582 "command> command will usually send one message per changeset. It will "
dongsheng@627 18583 "preface the series with an introductory message, in which you should describe "
dongsheng@627 18584 "the purpose of the series of changes you're sending."
dongsheng@627 18585 msgstr ""
dongsheng@627 18586
dongsheng@627 18587 #. type: Content of: <book><chapter><sect1><sect2><title>
dongsheng@714 18588 #: ../en/ch14-hgext.xml:484
songdongsheng@710 18589 msgid "Changing the behavior of patchbombs"
dongsheng@636 18590 msgstr "修改 patchbomb 的行为"
dongsheng@627 18591
dongsheng@627 18592 #. type: Content of: <book><chapter><sect1><sect2><para>
dongsheng@714 18593 #: ../en/ch14-hgext.xml:486
dongsheng@627 18594 msgid ""
dongsheng@627 18595 "Not every project has exactly the same conventions for sending changes in "
dongsheng@627 18596 "email; the <literal role=\"hg-ext\">patchbomb</literal> extension tries to "
dongsheng@627 18597 "accommodate a number of variations through command line options."
dongsheng@627 18598 msgstr ""
dongsheng@627 18599
dongsheng@627 18600 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 18601 #: ../en/ch14-hgext.xml:492
dongsheng@627 18602 msgid ""
dongsheng@627 18603 "You can write a subject for the introductory message on the command line "
dongsheng@627 18604 "using the <option role=\"hg-ext-patchbomb-cmd-email-opt\">hg -s</option> "
dongsheng@627 18605 "option. This takes one argument, the text of the subject to use."
dongsheng@627 18606 msgstr ""
dongsheng@627 18607
dongsheng@627 18608 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 18609 #: ../en/ch14-hgext.xml:498
dongsheng@627 18610 msgid ""
dongsheng@627 18611 "To change the email address from which the messages originate, use the "
dongsheng@627 18612 "<option role=\"hg-ext-patchbomb-cmd-email-opt\">hg -f</option> option. This "
dongsheng@627 18613 "takes one argument, the email address to use."
dongsheng@627 18614 msgstr ""
dongsheng@627 18615
dongsheng@627 18616 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 18617 #: ../en/ch14-hgext.xml:504
dongsheng@627 18618 msgid ""
songdongsheng@710 18619 "The default behavior is to send unified diffs (see <xref linkend=\"sec:mq:"
songdongsheng@658 18620 "patch\"/> for a description of the format), one per message. You can send a "
songdongsheng@658 18621 "binary bundle instead with the <option role=\"hg-ext-patchbomb-cmd-email-opt"
songdongsheng@658 18622 "\">hg -b</option> option."
dongsheng@627 18623 msgstr ""
dongsheng@627 18624
dongsheng@627 18625 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 18626 #: ../en/ch14-hgext.xml:512
dongsheng@627 18627 msgid ""
dongsheng@627 18628 "Unified diffs are normally prefaced with a metadata header. You can omit "
dongsheng@627 18629 "this, and send unadorned diffs, with the <option role=\"hg-ext-patchbomb-cmd-"
dongsheng@627 18630 "email-opt\">hg --plain</option> option."
dongsheng@627 18631 msgstr ""
dongsheng@627 18632
dongsheng@627 18633 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 18634 #: ../en/ch14-hgext.xml:518
dongsheng@627 18635 msgid ""
dongsheng@627 18636 "Diffs are normally sent <quote>inline</quote>, in the same body part as the "
dongsheng@627 18637 "description of a patch. This makes it easiest for the largest number of "
dongsheng@627 18638 "readers to quote and respond to parts of a diff, as some mail clients will "
dongsheng@627 18639 "only quote the first MIME body part in a message. If you'd prefer to send the "
dongsheng@627 18640 "description and the diff in separate body parts, use the <option role=\"hg-"
dongsheng@627 18641 "ext-patchbomb-cmd-email-opt\">hg -a</option> option."
dongsheng@627 18642 msgstr ""
dongsheng@627 18643
dongsheng@627 18644 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 18645 #: ../en/ch14-hgext.xml:528
dongsheng@627 18646 msgid ""
dongsheng@627 18647 "Instead of sending mail messages, you can write them to an <literal>mbox</"
dongsheng@627 18648 "literal>-format mail folder using the <option role=\"hg-ext-patchbomb-cmd-"
dongsheng@627 18649 "email-opt\">hg -m</option> option. That option takes one argument, the name "
dongsheng@627 18650 "of the file to write to."
dongsheng@627 18651 msgstr ""
dongsheng@627 18652
dongsheng@627 18653 #. type: Content of: <book><chapter><sect1><sect2><itemizedlist><listitem><para>
dongsheng@714 18654 #: ../en/ch14-hgext.xml:535
dongsheng@627 18655 msgid ""
dongsheng@627 18656 "If you would like to add a <command>diffstat</command>-format summary to each "
dongsheng@627 18657 "patch, and one to the introductory message, use the <option role=\"hg-ext-"
dongsheng@627 18658 "patchbomb-cmd-email-opt\">hg -d</option> option. The <command>diffstat</"
dongsheng@627 18659 "command> command displays a table containing the name of each file patched, "
dongsheng@627 18660 "the number of lines affected, and a histogram showing how much each file is "
dongsheng@627 18661 "modified. This gives readers a qualitative glance at how complex a patch is."
dongsheng@627 18662 msgstr ""