BuildMaster 0.9.1 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. data/bin/svnfix.rb +3 -0
  2. data/lib/buildmaster/ci/server.rb +55 -0
  3. data/lib/buildmaster/common.rb +3 -0
  4. data/lib/buildmaster/common/properties.rb +28 -0
  5. data/lib/buildmaster/{tree_to_object.rb → common/tree_to_object.rb} +0 -0
  6. data/lib/buildmaster/cotta.rb +1 -1
  7. data/lib/buildmaster/cotta/command_error.rb +6 -1
  8. data/lib/buildmaster/cotta/command_interface.rb +44 -0
  9. data/lib/buildmaster/cotta/command_runner.rb +39 -0
  10. data/lib/buildmaster/cotta/cotta.rb +40 -3
  11. data/lib/buildmaster/cotta/cotta_dir.rb +28 -7
  12. data/lib/buildmaster/cotta/cotta_file.rb +14 -2
  13. data/lib/buildmaster/cotta/cotta_pathname.rb +9 -0
  14. data/lib/buildmaster/cotta/in_memory_system.rb +20 -9
  15. data/lib/buildmaster/cotta/physical_system.rb +4 -8
  16. data/lib/buildmaster/project.rb +10 -0
  17. data/lib/buildmaster/{ant_driver.rb → project/ant_driver.rb} +0 -0
  18. data/lib/buildmaster/project/build.rb +3 -0
  19. data/lib/buildmaster/{build_number_file.rb → project/build_number_file.rb} +4 -0
  20. data/lib/buildmaster/project/ci.rb +3 -0
  21. data/lib/buildmaster/{cvs_driver.rb → project/cvs_driver.rb} +0 -0
  22. data/lib/buildmaster/project/ftp_driver.rb +64 -0
  23. data/lib/buildmaster/{java_manifest.rb → project/java_manifest.rb} +0 -0
  24. data/lib/buildmaster/project/pscp_driver.rb +17 -0
  25. data/lib/buildmaster/project/release.rb +67 -0
  26. data/lib/buildmaster/project/ruby_forge_project.rb +26 -0
  27. data/lib/buildmaster/{run_ant.rb → project/run_ant.rb} +0 -0
  28. data/lib/buildmaster/project/server_manager.rb +64 -0
  29. data/lib/buildmaster/project/svn_admin_driver.rb +20 -0
  30. data/lib/buildmaster/project/svn_driver.rb +94 -0
  31. data/lib/buildmaster/project/svn_helper.rb +113 -0
  32. data/lib/buildmaster/project/svn_status_info.rb +54 -0
  33. data/lib/buildmaster/{try.rb → project/try.rb} +0 -0
  34. data/lib/buildmaster/project/version_number_file.rb +45 -0
  35. data/lib/buildmaster/{windows → project/windows}/iis_driver.rb +4 -4
  36. data/lib/buildmaster/{windows → project/windows}/sql_server_driver.rb +0 -0
  37. data/lib/buildmaster/site.rb +5 -0
  38. data/lib/buildmaster/site/about_handler.rb +43 -0
  39. data/lib/buildmaster/site/content_engine_repository.rb +83 -0
  40. data/lib/buildmaster/site/element_processor_by_name.rb +18 -0
  41. data/lib/buildmaster/site/file_processor.rb +59 -0
  42. data/lib/buildmaster/site/site.rb +29 -6
  43. data/lib/buildmaster/site/site_server.rb +56 -0
  44. data/lib/buildmaster/{site_spec.rb → site/site_spec.rb} +63 -38
  45. data/lib/buildmaster/{site_tester.rb → site/site_tester.rb} +0 -0
  46. data/lib/buildmaster/site/source_content.rb +12 -0
  47. data/lib/buildmaster/{source_file_handler.rb → site/source_file_handler.rb} +13 -27
  48. data/lib/buildmaster/site/template_builder.rb +4 -0
  49. data/lib/buildmaster/site/template_error.rb +18 -0
  50. data/lib/buildmaster/{template_runner.rb → site/template_runner.rb} +6 -16
  51. data/lib/buildmaster/{templatelets.rb → site/templatelets.rb} +3 -1
  52. data/lib/buildmaster/site/templatelets/attribute.rb +21 -0
  53. data/lib/buildmaster/site/templatelets/code.rb +82 -0
  54. data/lib/buildmaster/{templatelets → site/templatelets}/each.rb +7 -5
  55. data/lib/buildmaster/{templatelets → site/templatelets}/href.rb +1 -1
  56. data/lib/buildmaster/{templatelets → site/templatelets}/include.rb +0 -0
  57. data/lib/buildmaster/{templatelets → site/templatelets}/link.rb +2 -3
  58. data/lib/buildmaster/{templatelets → site/templatelets}/text.rb +1 -1
  59. data/lib/buildmaster/{templatelets → site/templatelets}/when.rb +4 -7
  60. data/lib/buildmaster/site/templates/buildmaster/content/border_bottom.gif +0 -0
  61. data/lib/buildmaster/site/templates/buildmaster/content/buildmaster.css +370 -0
  62. data/lib/buildmaster/site/templates/buildmaster/content/logo.gif +0 -0
  63. data/lib/buildmaster/site/templates/buildmaster/content/news-rss2.xml +4 -0
  64. data/lib/buildmaster/site/templates/buildmaster/content/print.css +65 -0
  65. data/lib/buildmaster/site/templates/buildmaster/content/ruby.css +14 -0
  66. data/lib/buildmaster/site/templates/buildmaster/template.html +121 -0
  67. data/lib/buildmaster/site/templates/cotta/content/border_bottom.gif +0 -0
  68. data/lib/buildmaster/site/templates/cotta/content/cotta.css +363 -0
  69. data/lib/buildmaster/site/templates/cotta/content/cotta.gif +0 -0
  70. data/lib/buildmaster/site/templates/cotta/content/news-rss2.xml +2 -0
  71. data/lib/buildmaster/site/templates/cotta/template.html +106 -0
  72. data/lib/buildmaster/site/xtemplate.rb +26 -0
  73. data/lib/buildmaster/version +1 -0
  74. data/test/buildmaster/common/tc_properties.rb +24 -0
  75. data/test/buildmaster/{tc_tree_to_object.rb → common/tc_tree_to_object.rb} +18 -18
  76. data/test/buildmaster/cotta/cotta_specifications.rb +88 -64
  77. data/test/buildmaster/cotta/physical_system_stub.rb +3 -3
  78. data/test/buildmaster/cotta/system_file_specifications.rb +38 -47
  79. data/test/buildmaster/cotta/tc_command_interface.rb +46 -0
  80. data/test/buildmaster/cotta/tc_command_runner.rb +28 -0
  81. data/test/buildmaster/cotta/tc_cotta.rb +35 -9
  82. data/test/buildmaster/cotta/tc_cotta_dir_in_memory.rb +10 -5
  83. data/test/buildmaster/cotta/tc_cotta_file_in_memory.rb +3 -3
  84. data/test/buildmaster/cotta/tc_in_memory_system.rb +7 -2
  85. data/test/buildmaster/cotta/tc_pathname.rb +22 -0
  86. data/test/buildmaster/cotta/tc_physical_system.rb +12 -2
  87. data/test/buildmaster/{build.xml → project/build.xml} +0 -0
  88. data/test/buildmaster/{manifest.mf → project/manifest.mf} +0 -0
  89. data/test/buildmaster/{tc_ant_driver.rb → project/tc_ant_driver.rb} +3 -3
  90. data/test/buildmaster/{tc_build_number_file.rb → project/tc_build_number_file.rb} +7 -7
  91. data/test/buildmaster/{tc_cvs_driver.rb → project/tc_cvs_driver.rb} +14 -14
  92. data/test/buildmaster/{tc_java_manifest.rb → project/tc_java_manifest.rb} +7 -7
  93. data/test/buildmaster/project/tc_release.rb +61 -0
  94. data/test/buildmaster/project/tc_server_manager.rb +70 -0
  95. data/test/buildmaster/project/tc_svn_driver.rb +104 -0
  96. data/test/buildmaster/project/tc_svn_status_info.rb +37 -0
  97. data/test/buildmaster/project/tc_version_number_file.rb +46 -0
  98. data/test/buildmaster/{windows → project/windows}/tc_iis_driver.rb +5 -4
  99. data/test/buildmaster/{windows → project/windows}/tc_sql_server_driver.rb +4 -4
  100. data/test/buildmaster/site/content/tc_content_engine_repository.rb +63 -0
  101. data/test/buildmaster/site/tc_element_processor_by_name.rb +29 -0
  102. data/test/buildmaster/site/tc_file_processor.rb +141 -0
  103. data/test/buildmaster/site/tc_site.rb +42 -11
  104. data/test/buildmaster/site/tc_site_server.rb +43 -0
  105. data/test/buildmaster/{tc_site_spec.rb → site/tc_site_spec.rb} +9 -9
  106. data/test/buildmaster/{tc_source_file_handler.rb → site/tc_source_file_handler.rb} +10 -9
  107. data/test/buildmaster/site/tc_template_builder.rb +23 -23
  108. data/test/buildmaster/site/tc_template_error.rb +15 -0
  109. data/test/buildmaster/{tc_template_runner.rb → site/tc_template_runner.rb} +22 -17
  110. data/test/buildmaster/site/tc_templatelets.rb +37 -0
  111. data/test/buildmaster/{tc_xtemplate.rb → site/tc_xtemplate.rb} +14 -15
  112. data/test/buildmaster/{template.xhtml → site/template.xhtml} +0 -0
  113. data/test/buildmaster/{templatelets → site/templatelets}/common_templatelet_test.rb +11 -7
  114. data/test/buildmaster/{templatelets → site/templatelets}/tc_attribute.rb +14 -10
  115. data/test/buildmaster/site/templatelets/tc_code.rb +132 -0
  116. data/test/buildmaster/{templatelets → site/templatelets}/tc_each.rb +25 -12
  117. data/test/buildmaster/{templatelets → site/templatelets}/tc_href.rb +6 -8
  118. data/test/buildmaster/{templatelets → site/templatelets}/tc_include.rb +3 -12
  119. data/test/buildmaster/{templatelets → site/templatelets}/tc_link.rb +11 -18
  120. data/test/buildmaster/{templatelets → site/templatelets}/tc_text.rb +2 -9
  121. data/test/buildmaster/{templatelets → site/templatelets}/tc_when.rb +8 -15
  122. data/test/manual/bms.rb +10 -0
  123. data/test/tmp/svn_test/repository/README.txt +5 -0
  124. data/test/tmp/svn_test/repository/conf/authz +21 -0
  125. data/test/tmp/svn_test/repository/conf/passwd +8 -0
  126. data/test/tmp/svn_test/repository/conf/svnserve.conf +30 -0
  127. data/test/tmp/svn_test/repository/db/current +1 -0
  128. data/test/tmp/svn_test/repository/db/format +1 -0
  129. data/test/tmp/svn_test/repository/db/fs-type +1 -0
  130. data/test/tmp/svn_test/repository/db/revprops/0 +5 -0
  131. data/test/tmp/svn_test/repository/db/revprops/1 +13 -0
  132. data/test/tmp/svn_test/repository/db/revprops/2 +13 -0
  133. data/test/tmp/svn_test/repository/db/revprops/3 +13 -0
  134. data/test/tmp/svn_test/repository/db/revprops/4 +13 -0
  135. data/test/tmp/svn_test/repository/db/revs/0 +11 -0
  136. data/test/tmp/svn_test/repository/db/revs/1 +25 -0
  137. data/test/tmp/svn_test/repository/db/revs/2 +29 -0
  138. data/test/tmp/svn_test/repository/db/revs/3 +33 -0
  139. data/test/tmp/svn_test/repository/db/revs/4 +0 -0
  140. data/test/tmp/svn_test/repository/db/uuid +1 -0
  141. data/test/tmp/svn_test/repository/db/write-lock +0 -0
  142. data/test/tmp/svn_test/repository/format +1 -0
  143. data/test/tmp/svn_test/repository/hooks/post-commit.tmpl +51 -0
  144. data/test/tmp/svn_test/repository/hooks/post-lock.tmpl +44 -0
  145. data/test/tmp/svn_test/repository/hooks/post-revprop-change.tmpl +56 -0
  146. data/test/tmp/svn_test/repository/hooks/post-unlock.tmpl +42 -0
  147. data/test/tmp/svn_test/repository/hooks/pre-commit.tmpl +70 -0
  148. data/test/tmp/svn_test/repository/hooks/pre-lock.tmpl +64 -0
  149. data/test/tmp/svn_test/repository/hooks/pre-revprop-change.tmpl +66 -0
  150. data/test/tmp/svn_test/repository/hooks/pre-unlock.tmpl +60 -0
  151. data/test/tmp/svn_test/repository/hooks/start-commit.tmpl +54 -0
  152. data/test/tmp/svn_test/repository/locks/db-logs.lock +3 -0
  153. data/test/tmp/svn_test/repository/locks/db.lock +3 -0
  154. data/test/tmp/svn_test/second/test.txt +1 -0
  155. data/test/tmp/svn_test/workdir/test.txt +1 -0
  156. data/test/ts_buildmaster.rb +0 -1
  157. metadata +168 -69
  158. data/lib/buildmaster.rb +0 -10
  159. data/lib/buildmaster/build_file.rb +0 -11
  160. data/lib/buildmaster/buildnumber +0 -1
  161. data/lib/buildmaster/file_processor.rb +0 -138
  162. data/lib/buildmaster/site_server.rb +0 -33
  163. data/lib/buildmaster/source_content.rb +0 -11
  164. data/lib/buildmaster/svn_driver.rb +0 -78
  165. data/lib/buildmaster/template_error.rb +0 -8
  166. data/lib/buildmaster/templatelets/attribute.rb +0 -16
  167. data/lib/buildmaster/xtemplate.rb +0 -27
  168. data/lib/mock.rb +0 -3
  169. data/lib/mock/mock_base.rb +0 -24
  170. data/test/buildmaster/tc_file_processor.rb +0 -125
  171. data/test/buildmaster/tc_svn_driver.rb +0 -81
  172. data/test/tmp/output/index.html +0 -8
  173. data/test/tmp/output/markdown.html +0 -8
  174. data/test/tmp/output/textile.html +0 -8
@@ -0,0 +1,11 @@
1
+ PLAIN
2
+ END
3
+ ENDREP
4
+ id: 0.0.r0/17
5
+ type: dir
6
+ count: 0
7
+ text: 0 0 4 4 2d2977d1c96f487abe4a1e202dd03b4e
8
+ cpath: /
9
+
10
+
11
+ 17 107
@@ -0,0 +1,25 @@
1
+ id: 1.0.r1/0
2
+ type: dir
3
+ count: 0
4
+ cpath: /trunk
5
+ copyroot: 0 /
6
+
7
+ PLAIN
8
+ K 5
9
+ trunk
10
+ V 12
11
+ dir 1.0.r1/0
12
+ END
13
+ ENDREP
14
+ id: 0.0.r1/106
15
+ type: dir
16
+ pred: 0.0.r0/17
17
+ count: 1
18
+ text: 1 61 32 32 1a75181b9171c46aaf0541e72379cc46
19
+ cpath: /
20
+ copyroot: 0 /
21
+
22
+ _0.0.t0-1 add false false /trunk
23
+
24
+
25
+ 106 230
@@ -0,0 +1,29 @@
1
+ id: 2.0.r2/0
2
+ type: dir
3
+ count: 0
4
+ cpath: /tags
5
+ copyroot: 0 /
6
+
7
+ PLAIN
8
+ K 4
9
+ tags
10
+ V 12
11
+ dir 2.0.r2/0
12
+ K 5
13
+ trunk
14
+ V 12
15
+ dir 1.0.r1/0
16
+ END
17
+ ENDREP
18
+ id: 0.0.r2/132
19
+ type: dir
20
+ pred: 0.0.r1/106
21
+ count: 2
22
+ text: 2 60 59 59 cc5d4350f2e3e4a400de2b90563fb967
23
+ cpath: /
24
+ copyroot: 0 /
25
+
26
+ _0.0.t1-1 add false false /tags
27
+
28
+
29
+ 132 257
@@ -0,0 +1,33 @@
1
+ id: 3.0.r3/0
2
+ type: dir
3
+ count: 0
4
+ cpath: /branches
5
+ copyroot: 0 /
6
+
7
+ PLAIN
8
+ K 8
9
+ branches
10
+ V 12
11
+ dir 3.0.r3/0
12
+ K 4
13
+ tags
14
+ V 12
15
+ dir 2.0.r2/0
16
+ K 5
17
+ trunk
18
+ V 12
19
+ dir 1.0.r1/0
20
+ END
21
+ ENDREP
22
+ id: 0.0.r3/167
23
+ type: dir
24
+ pred: 0.0.r2/132
25
+ count: 3
26
+ text: 3 64 90 90 4093995f6e23dee1057db0ceccb42b0e
27
+ cpath: /
28
+ copyroot: 0 /
29
+
30
+ _0.0.t2-1 add false false /branches
31
+
32
+
33
+ 167 292
@@ -0,0 +1 @@
1
+ 2cb220c7-ec14-4944-92bb-109beafd8dbe
@@ -0,0 +1,51 @@
1
+ #!/bin/sh
2
+
3
+ # POST-COMMIT HOOK
4
+ #
5
+ # The post-commit hook is invoked after a commit. Subversion runs
6
+ # this hook by invoking a program (script, executable, binary, etc.)
7
+ # named 'post-commit' (for which this file is a template) with the
8
+ # following ordered arguments:
9
+ #
10
+ # [1] REPOS-PATH (the path to this repository)
11
+ # [2] REV (the number of the revision just committed)
12
+ #
13
+ # The default working directory for the invocation is undefined, so
14
+ # the program should set one explicitly if it cares.
15
+ #
16
+ # Because the commit has already completed and cannot be undone,
17
+ # the exit code of the hook program is ignored. The hook program
18
+ # can use the 'svnlook' utility to help it examine the
19
+ # newly-committed tree.
20
+ #
21
+ # On a Unix system, the normal procedure is to have 'post-commit'
22
+ # invoke other programs to do the real work, though it may do the
23
+ # work itself too.
24
+ #
25
+ # Note that 'post-commit' must be executable by the user(s) who will
26
+ # invoke it (typically the user httpd runs as), and that user must
27
+ # have filesystem-level permission to access the repository.
28
+ #
29
+ # On a Windows system, you should name the hook program
30
+ # 'post-commit.bat' or 'post-commit.exe',
31
+ # but the basic idea is the same.
32
+ #
33
+ # The hook program typically does not inherit the environment of
34
+ # its parent process. For example, a common problem is for the
35
+ # PATH environment variable to not be set to its usual value, so
36
+ # that subprograms fail to launch unless invoked via absolute path.
37
+ # If you're having unexpected problems with a hook program, the
38
+ # culprit may be unusual (or missing) environment variables.
39
+ #
40
+ # Here is an example hook script, for a Unix /bin/sh interpreter.
41
+ # For more examples and pre-written hooks, see those in
42
+ # the Subversion repository at
43
+ # http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and
44
+ # http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/
45
+
46
+
47
+ REPOS="$1"
48
+ REV="$2"
49
+
50
+ commit-email.pl "$REPOS" "$REV" commit-watchers@example.org
51
+ log-commit.py --repository "$REPOS" --revision "$REV"
@@ -0,0 +1,44 @@
1
+ #!/bin/sh
2
+
3
+ # POST-LOCK HOOK
4
+ #
5
+ # The post-lock hook is run after a path is locked. Subversion runs
6
+ # this hook by invoking a program (script, executable, binary, etc.)
7
+ # named 'post-lock' (for which this file is a template) with the
8
+ # following ordered arguments:
9
+ #
10
+ # [1] REPOS-PATH (the path to this repository)
11
+ # [2] USER (the user who created the lock)
12
+ #
13
+ # The paths that were just locked are passed to the hook via STDIN (as
14
+ # of Subversion 1.2, only one path is passed per invocation, but the
15
+ # plan is to pass all locked paths at once, so the hook program
16
+ # should be written accordingly).
17
+ #
18
+ # The default working directory for the invocation is undefined, so
19
+ # the program should set one explicitly if it cares.
20
+ #
21
+ # Because the lock has already been created and cannot be undone,
22
+ # the exit code of the hook program is ignored. The hook program
23
+ # can use the 'svnlook' utility to help it examine the
24
+ # newly-created lock.
25
+ #
26
+ # On a Unix system, the normal procedure is to have 'post-lock'
27
+ # invoke other programs to do the real work, though it may do the
28
+ # work itself too.
29
+ #
30
+ # Note that 'post-lock' must be executable by the user(s) who will
31
+ # invoke it (typically the user httpd runs as), and that user must
32
+ # have filesystem-level permission to access the repository.
33
+ #
34
+ # On a Windows system, you should name the hook program
35
+ # 'post-lock.bat' or 'post-lock.exe',
36
+ # but the basic idea is the same.
37
+ #
38
+ # Here is an example hook script, for a Unix /bin/sh interpreter:
39
+
40
+ REPOS="$1"
41
+ USER="$2"
42
+
43
+ # Send email to interested parties, let them know a lock was created:
44
+ mailer.py lock "$REPOS" "$USER" /path/to/mailer.conf
@@ -0,0 +1,56 @@
1
+ #!/bin/sh
2
+
3
+ # POST-REVPROP-CHANGE HOOK
4
+ #
5
+ # The post-revprop-change hook is invoked after a revision property
6
+ # has been added, modified or deleted. Subversion runs this hook by
7
+ # invoking a program (script, executable, binary, etc.) named
8
+ # 'post-revprop-change' (for which this file is a template), with the
9
+ # following ordered arguments:
10
+ #
11
+ # [1] REPOS-PATH (the path to this repository)
12
+ # [2] REV (the revision that was tweaked)
13
+ # [3] USER (the username of the person tweaking the property)
14
+ # [4] PROPNAME (the property that was changed)
15
+ # [5] ACTION (the property was 'A'dded, 'M'odified, or 'D'eleted)
16
+ #
17
+ # [STDIN] PROPVAL ** the old property value is passed via STDIN.
18
+ #
19
+ # Because the propchange has already completed and cannot be undone,
20
+ # the exit code of the hook program is ignored. The hook program
21
+ # can use the 'svnlook' utility to help it examine the
22
+ # new property value.
23
+ #
24
+ # On a Unix system, the normal procedure is to have 'post-revprop-change'
25
+ # invoke other programs to do the real work, though it may do the
26
+ # work itself too.
27
+ #
28
+ # Note that 'post-revprop-change' must be executable by the user(s) who will
29
+ # invoke it (typically the user httpd runs as), and that user must
30
+ # have filesystem-level permission to access the repository.
31
+ #
32
+ # On a Windows system, you should name the hook program
33
+ # 'post-revprop-change.bat' or 'post-revprop-change.exe',
34
+ # but the basic idea is the same.
35
+ #
36
+ # The hook program typically does not inherit the environment of
37
+ # its parent process. For example, a common problem is for the
38
+ # PATH environment variable to not be set to its usual value, so
39
+ # that subprograms fail to launch unless invoked via absolute path.
40
+ # If you're having unexpected problems with a hook program, the
41
+ # culprit may be unusual (or missing) environment variables.
42
+ #
43
+ # Here is an example hook script, for a Unix /bin/sh interpreter.
44
+ # For more examples and pre-written hooks, see those in
45
+ # the Subversion repository at
46
+ # http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and
47
+ # http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/
48
+
49
+
50
+ REPOS="$1"
51
+ REV="$2"
52
+ USER="$3"
53
+ PROPNAME="$4"
54
+ ACTION="$5"
55
+
56
+ propchange-email.pl "$REPOS" "$REV" "$USER" "$PROPNAME" watchers@example.org
@@ -0,0 +1,42 @@
1
+ #!/bin/sh
2
+
3
+ # POST-UNLOCK HOOK
4
+ #
5
+ # The post-unlock hook runs after a path is unlocked. Subversion runs
6
+ # this hook by invoking a program (script, executable, binary, etc.)
7
+ # named 'post-unlock' (for which this file is a template) with the
8
+ # following ordered arguments:
9
+ #
10
+ # [1] REPOS-PATH (the path to this repository)
11
+ # [2] USER (the user who destroyed the lock)
12
+ #
13
+ # The paths that were just unlocked are passed to the hook via STDIN
14
+ # (as of Subversion 1.2, only one path is passed per invocation, but
15
+ # the plan is to pass all unlocked paths at once, so the hook program
16
+ # should be written accordingly).
17
+ #
18
+ # The default working directory for the invocation is undefined, so
19
+ # the program should set one explicitly if it cares.
20
+ #
21
+ # Because the lock has already been destroyed and cannot be undone,
22
+ # the exit code of the hook program is ignored.
23
+ #
24
+ # On a Unix system, the normal procedure is to have 'post-unlock'
25
+ # invoke other programs to do the real work, though it may do the
26
+ # work itself too.
27
+ #
28
+ # Note that 'post-unlock' must be executable by the user(s) who will
29
+ # invoke it (typically the user httpd runs as), and that user must
30
+ # have filesystem-level permission to access the repository.
31
+ #
32
+ # On a Windows system, you should name the hook program
33
+ # 'post-unlock.bat' or 'post-unlock.exe',
34
+ # but the basic idea is the same.
35
+ #
36
+ # Here is an example hook script, for a Unix /bin/sh interpreter:
37
+
38
+ REPOS="$1"
39
+ USER="$2"
40
+
41
+ # Send email to interested parties, let them know a lock was removed:
42
+ mailer.py unlock "$REPOS" "$USER" /path/to/mailer.conf
@@ -0,0 +1,70 @@
1
+ #!/bin/sh
2
+
3
+ # PRE-COMMIT HOOK
4
+ #
5
+ # The pre-commit hook is invoked before a Subversion txn is
6
+ # committed. Subversion runs this hook by invoking a program
7
+ # (script, executable, binary, etc.) named 'pre-commit' (for which
8
+ # this file is a template), with the following ordered arguments:
9
+ #
10
+ # [1] REPOS-PATH (the path to this repository)
11
+ # [2] TXN-NAME (the name of the txn about to be committed)
12
+ #
13
+ # The default working directory for the invocation is undefined, so
14
+ # the program should set one explicitly if it cares.
15
+ #
16
+ # If the hook program exits with success, the txn is committed; but
17
+ # if it exits with failure (non-zero), the txn is aborted, no commit
18
+ # takes place, and STDERR is returned to the client. The hook
19
+ # program can use the 'svnlook' utility to help it examine the txn.
20
+ #
21
+ # On a Unix system, the normal procedure is to have 'pre-commit'
22
+ # invoke other programs to do the real work, though it may do the
23
+ # work itself too.
24
+ #
25
+ # *** NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT ***
26
+ # *** FOR REVISION PROPERTIES (like svn:log or svn:author). ***
27
+ #
28
+ # This is why we recommend using the read-only 'svnlook' utility.
29
+ # In the future, Subversion may enforce the rule that pre-commit
30
+ # hooks should not modify the versioned data in txns, or else come
31
+ # up with a mechanism to make it safe to do so (by informing the
32
+ # committing client of the changes). However, right now neither
33
+ # mechanism is implemented, so hook writers just have to be careful.
34
+ #
35
+ # Note that 'pre-commit' must be executable by the user(s) who will
36
+ # invoke it (typically the user httpd runs as), and that user must
37
+ # have filesystem-level permission to access the repository.
38
+ #
39
+ # On a Windows system, you should name the hook program
40
+ # 'pre-commit.bat' or 'pre-commit.exe',
41
+ # but the basic idea is the same.
42
+ #
43
+ # The hook program typically does not inherit the environment of
44
+ # its parent process. For example, a common problem is for the
45
+ # PATH environment variable to not be set to its usual value, so
46
+ # that subprograms fail to launch unless invoked via absolute path.
47
+ # If you're having unexpected problems with a hook program, the
48
+ # culprit may be unusual (or missing) environment variables.
49
+ #
50
+ # Here is an example hook script, for a Unix /bin/sh interpreter.
51
+ # For more examples and pre-written hooks, see those in
52
+ # the Subversion repository at
53
+ # http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and
54
+ # http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/
55
+
56
+
57
+ REPOS="$1"
58
+ TXN="$2"
59
+
60
+ # Make sure that the log message contains some text.
61
+ SVNLOOK=/usr/local/bin/svnlook
62
+ $SVNLOOK log -t "$TXN" "$REPOS" | \
63
+ grep "[a-zA-Z0-9]" > /dev/null || exit 1
64
+
65
+ # Check that the author of this commit has the rights to perform
66
+ # the commit on the files and directories being modified.
67
+ commit-access-control.pl "$REPOS" "$TXN" commit-access-control.cfg || exit 1
68
+
69
+ # All checks passed, so allow the commit.
70
+ exit 0
@@ -0,0 +1,64 @@
1
+ #!/bin/sh
2
+
3
+ # PRE-LOCK HOOK
4
+ #
5
+ # The pre-lock hook is invoked before an exclusive lock is
6
+ # created. Subversion runs this hook by invoking a program
7
+ # (script, executable, binary, etc.) named 'pre-lock' (for which
8
+ # this file is a template), with the following ordered arguments:
9
+ #
10
+ # [1] REPOS-PATH (the path to this repository)
11
+ # [2] PATH (the path in the repository about to be locked)
12
+ # [3] USER (the user creating the lock)
13
+ #
14
+ # The default working directory for the invocation is undefined, so
15
+ # the program should set one explicitly if it cares.
16
+ #
17
+ # If the hook program exits with success, the lock is created; but
18
+ # if it exits with failure (non-zero), the lock action is aborted
19
+ # and STDERR is returned to the client.
20
+
21
+ # On a Unix system, the normal procedure is to have 'pre-lock'
22
+ # invoke other programs to do the real work, though it may do the
23
+ # work itself too.
24
+ #
25
+ # Note that 'pre-lock' must be executable by the user(s) who will
26
+ # invoke it (typically the user httpd runs as), and that user must
27
+ # have filesystem-level permission to access the repository.
28
+ #
29
+ # On a Windows system, you should name the hook program
30
+ # 'pre-lock.bat' or 'pre-lock.exe',
31
+ # but the basic idea is the same.
32
+ #
33
+ # Here is an example hook script, for a Unix /bin/sh interpreter:
34
+
35
+ REPOS="$1"
36
+ PATH="$2"
37
+ USER="$3"
38
+
39
+ # If a lock exists and is owned by a different person, don't allow it
40
+ # to be stolen (e.g., with 'svn lock --force ...').
41
+
42
+ # (Maybe this script could send email to the lock owner?)
43
+ SVNLOOK=/usr/local/bin/svnlook
44
+ GREP=/bin/grep
45
+ SED=/bin/sed
46
+
47
+ LOCK_OWNER=`$SVNLOOK lock "$REPOS" "$PATH" | \
48
+ $GREP '^Owner: ' | $SED 's/Owner: //'`
49
+
50
+ # If we get no result from svnlook, there's no lock, allow the lock to
51
+ # happen:
52
+ if [ "$LOCK_OWNER" = "" ]; then
53
+ exit 0
54
+ fi
55
+
56
+ # If the person locking matches the lock's owner, allow the lock to
57
+ # happen:
58
+ if [ "$LOCK_OWNER" = "$USER" ]; then
59
+ exit 0
60
+ fi
61
+
62
+ # Otherwise, we've got an owner mismatch, so return failure:
63
+ echo "Error: $PATH already locked by ${LOCK_OWNER}." 1>&2
64
+ exit 1