[svnbook] r5560 committed - branches/1.8/zh/book/ch05-repository-admin.xml

wuzhouhui at users.sourceforge.net wuzhouhui at users.sourceforge.net
Sat Dec 30 19:51:16 CST 2017


Revision: 5560
          http://sourceforge.net/p/svnbook/source/5560
Author:   wuzhouhui
Date:     2017-12-31 01:51:16 +0000 (Sun, 31 Dec 2017)
Log Message:
-----------
1.8/zh: translation of chapter 5 in progress

Modified Paths:
--------------
    branches/1.8/zh/book/ch05-repository-admin.xml

Modified: branches/1.8/zh/book/ch05-repository-admin.xml
===================================================================
--- branches/1.8/zh/book/ch05-repository-admin.xml	2017-12-29 14:30:36 UTC (rev 5559)
+++ branches/1.8/zh/book/ch05-repository-admin.xml	2017-12-31 01:51:16 UTC (rev 5560)
@@ -952,9 +952,13 @@
         of the person who triggered the event.</para>
       -->
             
+      <!--
       <para>The <filename>hooks</filename> subdirectory is, by
         default, filled with templates for various repository
         hooks:</para>
+      -->
+      <para>默认情况下, 子目录 <filename>hooks</filename> 包含了多种不同的
+        钩子的模板:</para>
 
       <informalexample>
         <screen>
@@ -966,6 +970,7 @@
 </screen>
       </informalexample>
             
+      <!--
       <para>There is one template for each hook that the Subversion
         repository supports; by examining the contents of those
         template scripts, you can see what triggers each script
@@ -978,7 +983,17 @@
         which can be executed as the name (such as
         <command>start-commit</command> or
         <command>post-commit</command>) of the hook.</para>
+      -->
+      <para>Subversion 仓库支持的每个钩子都有一个模板, 通过查看这些模板脚本的
+        内容, 用户可以看到每个脚本所执行的操作, 以及传递给脚本的参数. 模
+        板展示了用户可能会用钩子完成哪些操作, 借助 Subversion 工具的配合,
+        钩子可以完成一些常见的操作. 为了安装一个能实际工作的钩子, 用户只
+        需要把所需的可执行程序或脚本放到仓库的子目录 <filename>hooks</filename>
+        里, Subversion 就可以根据钩子脚本的文件名 (例如
+        <filename>start-commit</filename> 或 <filename>post-commit</filename>)
+        决定在什么时候执行它.</para>
 
+      <!--
       <para>On Unix platforms, this means supplying a script or
         program (which could be a shell script, a Python program, a
         compiled C binary, or any number of other things) named
@@ -995,6 +1010,19 @@
         recognized by Windows for executable programs, such as
         <filename>.exe</filename> for programs and
         <filename>.bat</filename> for batch files.</para>
+      -->
+      <para>如果存放仓库的主机是 Unix 操作系统, 这就意味着用户必须提供一个脚
+        本或程序 (可以是 shell 脚本, Python 程序, 已编译的二进制程序, 或其他
+        形式的可执行文件), 文件的名字必须严格按照钩子的规定进行命名. 当然,
+        子目录 <filename>hooks</filename> 里的模板不仅仅是为了向用户展示钩子的
+        典型内容—在 Unix 系统中, 安装钩子最简单的方法是复制一个适当的
+        模板文件, 复制出的新文件要删掉扩展名 <filename>.tmpl</filename>, 然后
+        对脚本的内容进行必要的修改, 并确保脚本具有可执行权限. 然而, Windows
+        操作系统是根据文件的扩展名判断文件是否是可执行的, 因此管理员所提供的
+        钩子, 其文件名 (不包括扩展名部分) 是钩子的名字, 而扩展名是 Windows
+        规定的可作为可执行程序的几种扩展名之一, 例如二进制可执行文件用
+        <filename>.exe</filename>, 批处理文件用 <filename>.bat</filename>.
+      </para>
 
       <para>Subversion executes hooks as the same user who owns the
         process that is accessing the Subversion repository.  In most




More information about the svnbook-dev mailing list