You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

perforce.html 10 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355
  1. <html>
  2. <head>
  3. <title>Perforce Tasks for ANT</title>
  4. </head>
  5. <body>
  6. <h1>Perforce Tasks User Manual</h1>
  7. <p>by</p>
  8. <ul>
  9. <li>Les Hughes (<a href="mailto:leslie.hughes@rubus.com">leslie.hughes@rubus.com</a>)</li>
  10. </ul>
  11. <p>Version 1.1 - 2001/01/09</p>
  12. <hr>
  13. <h2>Contents</h2>
  14. <ul>
  15. <li><a href="#intro">Introduction</a></li>
  16. <li><a href="#tasks">The Tasks</a></li>
  17. <li><a href="#changes">Change History</a></li>
  18. </ul>
  19. <br>
  20. <h2><a name="intro">Introduction</a></h2>
  21. <p>These tasks provide an interface to the <a href="http://www.perforce.com" target="_top">Perforce</a> SCM.
  22. The <code>org.apache.tools.ant.taskdefs.optional.perforce</code> package consists of a simple framework to support
  23. p4 functionality as well as some Ant tasks encapsulating frequently used (by me :-) p4 commands.
  24. However, the addition of new p4 commands is a pretty simple task (see the source).
  25. Although it is possible to use these commands on the desktop,
  26. they were primarily intended to be used by automated build systems.</p>
  27. <p><b>Note:</b> These tasks require the <a href="http://jakarta.apache.org/oro" target="_top">oro 2.0</a> regular
  28. expression package. Simply download this package and copy the jakarta-oro-2.0.jar file into Ant's lib directory.
  29. You will also need the perforce client executable (p4 or p4.exe but not p4win.exe) in your path.
  30. </p>
  31. <h2><a name="tasks">The Tasks</a></h2>
  32. <table border="0" cellspacing="0" cellpadding="3">
  33. <tr>
  34. <td><a href="#p4sync">P4Sync</a></td>
  35. <td>Synchronise a workspce to a depot</td>
  36. </tr>
  37. <tr>
  38. <td><a href="#p4change">P4Change</a></td>
  39. <td>Request a new changelist from the perforce server</td>
  40. </tr>
  41. <tr>
  42. <td><a href="#p4edit">P4Edit</a></td>
  43. <td>Open files for edit (checkout)</td>
  44. </tr>
  45. <tr>
  46. <td><a href="#p4submit">P4Submit</a></td>
  47. <td>Submit a changelist to the perforce server (checkin)</td>
  48. </tr>
  49. <tr>
  50. <td><a href="#p4have">P4Have</a></td>
  51. <td>List current files in client view, useful for reporting</td>
  52. </tr>
  53. <tr>
  54. <td><a href="#p4label">P4Label</a></td>
  55. <td>Create a label reflecting files in the current workspace</td>
  56. </tr>
  57. </table>
  58. <h3>General P4 Properties</h3>
  59. <p>Each p4 task requires a number of settings, either through build-wide properties, individual attributes
  60. or environment variables. These are
  61. </p>
  62. <table border="1" cellpadding="2" cellspacing="0">
  63. <tr>
  64. <td valign="top"><b>Property</b></td>
  65. <td valign="top"><b>Attribute</b></td>
  66. <td valign="top"><b>Env Var</b></td>
  67. <td valign="top"><b>Description</b></td>
  68. <td align="center" valign="top"><b>Default</b></td>
  69. </tr>
  70. <tr>
  71. <td valign="top">p4.port</td>
  72. <td valign="top">port</td>
  73. <td valign="top">P4PORT</td>
  74. <td valign="top">The p4d server and port to connect to</td>
  75. <td valign="top">perforce:1666</td>
  76. </tr>
  77. <tr>
  78. <td valign="top">p4.client</td>
  79. <td valign="top">client</td>
  80. <td valign="top">P4CLIENT</td>
  81. <td valign="top">The p4 client spec to use</td>
  82. <td valign="top">The logged in username</td>
  83. </tr>
  84. <tr>
  85. <td valign="top">p4.user</td>
  86. <td valign="top">user</td>
  87. <td valign="top">P4USER</td>
  88. <td valign="top">The p4 username</td>
  89. <td valign="top">The logged in username</td>
  90. </tr>
  91. <tr>
  92. <td valign="top" align="center">--</td>
  93. <td valign="top">view</td>
  94. <td valign="top" align="center">--</td>
  95. <td valign="top">The client, branch or label view to operate upon. See the p4 user guide for more info.</td>
  96. <td valign="top">//...</td>
  97. </tr>
  98. </table>
  99. <p>
  100. Your local installation of perforce may require other settings (e.g. P4PASSWD, P4CONFIG). At the moment, these can only be set outside of Ant, as environment variables.
  101. </p>
  102. <h3>Examples</h3>
  103. <p>Setting in the environment:-</p>
  104. <p>
  105. (Unix csh)</p>
  106. <pre>setenv P4PORT myperforcebox:1666</pre>
  107. <p>(Unix sh et al)</p>
  108. <pre>P4USER=myp4userid; export P4USER</pre>
  109. <p>Using build properties:-</p>
  110. <pre>&lt;property name=&quot;p4.client&quot; value=&quot;nightlybuild&quot;/&gt;</pre>
  111. <p>Using task attributes:-</p>
  112. <pre>
  113. &lt;p4Whatever
  114. port=&quot;myserver:1666&quot;
  115. client=&quot;smoketest&quot;
  116. user=&quot;smoketestdude&quot;
  117. .
  118. .
  119. .
  120. /&gt;
  121. </pre>
  122. <p>
  123. For more information regarding the underlying 'p4' commands you are referred to the Perforce Command Reference
  124. available from the <a href="http://www.perforce.com/" target="_top">Perforce website</a>.
  125. </p>
  126. <h3>Taskdefs</h3>
  127. <p>Standard taskdefs (for you to copy'n'paste)</p>
  128. <pre>
  129. &lt;taskdef name=&quot;p4sync&quot; classname=&quot;org.apache.tools.ant.taskdefs.optional.perforce.P4Sync&quot; /&gt;
  130. &lt;taskdef name=&quot;p4change&quot; classname=&quot;org.apache.tools.ant.taskdefs.optional.perforce.P4Change&quot; /&gt;
  131. &lt;taskdef name=&quot;p4edit&quot; classname=&quot;org.apache.tools.ant.taskdefs.optional.perforce.P4Edit&quot; /&gt;
  132. &lt;taskdef name=&quot;p4submit&quot; classname=&quot;org.apache.tools.ant.taskdefs.optional.perforce.P4Submit&quot; /&gt;
  133. &lt;taskdef name=&quot;p4have&quot; classname=&quot;org.apache.tools.ant.taskdefs.optional.perforce.P4Have&quot; /&gt;
  134. &lt;taskdef name=&quot;p4label&quot; classname=&quot;org.apache.tools.ant.taskdefs.optional.perforce.P4Label&quot; /&gt;
  135. </pre>
  136. <hr>
  137. <h2>Task Descriptions</h2>
  138. <h2><a name="p4sync">P4Sync</a></h2>
  139. <h3>Description:</h3>
  140. <p>Synchronize the current workspace with the depot.</p>
  141. <h3>Parameters</h3>
  142. <table border="1" cellpadding="2" cellspacing="0">
  143. <tr>
  144. <td valign="top"><b>Attribute</b></td>
  145. <td valign="top"><b>Description</b></td>
  146. <td align="center" valign="top"><b>Required</b></td>
  147. </tr>
  148. <tr>
  149. <td valign="top">force</td>
  150. <td valign="top">force a refresh of files</td>
  151. <td valign="top" align="center">no</td>
  152. </tr>
  153. <tr>
  154. <td valign="top">label</td>
  155. <td valign="top">sync client to label</td>
  156. <td valign="top" align="center">no</td>
  157. </tr>
  158. </table>
  159. <h3>Examples</h3>
  160. <pre>&lt;p4sync label=&quot;nightlybuild-0.0123&quot; force=&quot;yes&quot; /&gt;
  161. &lt;p4sync view=&quot;//depot/projects/projectfoo/main/src/...&quot; /&gt;
  162. </pre>
  163. <hr>
  164. <h2><a name="p4change">P4Change</a></h2>
  165. <h3>Description:</h3>
  166. <p>Request a new changelist from the perforce server.
  167. This task sets the ${p4.change} property which can then be passed to P4Submit or P4Edit.
  168. </p>
  169. <h3>Parameters</h3>
  170. <table border="1" cellpadding="2" cellspacing="0">
  171. <tr>
  172. <td valign="top"><b>Attribute</b></td>
  173. <td valign="top"><b>Description</b></td>
  174. <td align="center" valign="top"><b>Required</b></td>
  175. </tr>
  176. <tr>
  177. <td valign="top">None</td>
  178. <td valign="top" align="center">--</td>
  179. <td valign="top" align="center">--</td>
  180. </tr>
  181. </table>
  182. <h3>Examples</h3>
  183. <pre>&lt;p4change /&gt;
  184. </pre>
  185. <hr>
  186. <h2><a name="p4edit">P4Edit</a></h2>
  187. <h3>Description:</h3>
  188. <p>Open file(s) for edit. P4Change should be used to obtain a new changelist for P4Edit as,
  189. although P4Edit can open files to the default change, P4Submit cannot yet submit it.
  190. </p>
  191. <h3>Parameters</h3>
  192. <table border="1" cellpadding="2" cellspacing="0">
  193. <tr>
  194. <td valign="top"><b>Attribute</b></td>
  195. <td valign="top"><b>Description</b></td>
  196. <td align="center" valign="top"><b>Required</b></td>
  197. </tr>
  198. <tr>
  199. <td valign="top">view</td>
  200. <td valign="top">The filespec to request to edit</td>
  201. <td valign="top" align="center">Yes</td>
  202. </tr>
  203. <tr>
  204. <td valign="top">change</td>
  205. <td valign="top">An existing changelist number to assign files to.</td>
  206. <td valign="top" align="center">No, but see above.</td>
  207. </tr>
  208. </table>
  209. <h3>Examples</h3>
  210. <pre>
  211. &lt;p4edit
  212. view=&quot;//depot/projects/projectfoo/main/src/Blah.java...&quot;
  213. change=&quot;${p4.change}&quot; /&gt;
  214. </pre>
  215. <hr>
  216. <h2><a name="p4submit">P4Submit</a></h2>
  217. <h3>Description:</h3>
  218. <p>Submit a changelist, usually obtained from P4Change.
  219. </p>
  220. <h3>Parameters</h3>
  221. <table border="1" cellpadding="2" cellspacing="0">
  222. <tr>
  223. <td valign="top"><b>Attribute</b></td>
  224. <td valign="top"><b>Description</b></td>
  225. <td align="center" valign="top"><b>Required</b></td>
  226. </tr>
  227. <tr>
  228. <td valign="top">change</td>
  229. <td valign="top">The changelist number to submit</td>
  230. <td valign="top" align="center">Yes</td>
  231. </tr>
  232. </table>
  233. <h3>Examples</h3>
  234. <pre>&lt;p4submit change=&quot;${p4.change}&quot; /&gt;
  235. </pre>
  236. <hr>
  237. <h2><a name="p4have">P4Have</a></h2>
  238. <h3>Description:</h3>
  239. <p>List handy file info reflecting the current client contents.
  240. </p>
  241. <h3>Parameters</h3>
  242. <table border="1" cellpadding="2" cellspacing="0">
  243. <tr>
  244. <td valign="top"><b>Attribute</b></td>
  245. <td valign="top"><b>Description</b></td>
  246. <td align="center" valign="top"><b>Required</b></td>
  247. </tr>
  248. <tr>
  249. <td valign="top">None</td>
  250. <td valign="top" align="center">--</td>
  251. <td valign="top" align="center">--</td>
  252. </tr>
  253. </table>
  254. <h3>Examples</h3>
  255. <pre>&lt;p4have /&gt;
  256. </pre>
  257. <hr>
  258. <h2><a name="p4label">P4Label</a></h2>
  259. <h3>Description:</h3>
  260. <p>Create a new label and set contents to reflect current client file revisions.
  261. </p>
  262. <h3>Parameters</h3>
  263. <table border="1" cellpadding="2" cellspacing="0">
  264. <tr>
  265. <td valign="top"><b>Attribute</b></td>
  266. <td valign="top"><b>Description</b></td>
  267. <td align="center" valign="top"><b>Required</b></td>
  268. </tr>
  269. <tr>
  270. <td valign="top">name</td>
  271. <td valign="top">The name of the label</td>
  272. <td valign="top" align="center">Yes</td>
  273. </tr>
  274. <tr>
  275. <td valign="top">view</td>
  276. <td valign="top">client view to use for label</td>
  277. <td valign="top" align="center">No</td>
  278. </tr>
  279. <tr>
  280. <td valign="top">desc</td>
  281. <td valign="top">Label Description</td>
  282. <td valign="top" align="center">No</td>
  283. </tr>
  284. </table>
  285. <h3>Examples</h3>
  286. <pre>
  287. &lt;p4label
  288. name=&quot;NightlyBuild:${DSTAMP}:${TSTAMP}&quot;
  289. desc=&quot;Auto Nightly Build&quot;
  290. /&gt;
  291. </pre>
  292. <hr>
  293. <h2><a name="changes">Change History</a></h2>
  294. <table border="1" cellpadding="2" cellspacing="0">
  295. <tr>
  296. <td valign="top">Sept 2000</td>
  297. <td valign="top" align="center">--</td>
  298. <td valign="top">Internal Release within Rubus</td>
  299. </tr>
  300. <tr>
  301. <td valign="top">Nov 2000</td>
  302. <td valign="top">V1.0</td>
  303. <td valign="top">Initial Release donated to ASF :-)</td>
  304. </tr>
  305. <tr>
  306. <td valign="top">Jan 2001</td>
  307. <td valign="top">V1.1</td>
  308. <td valign="top">fixed cross platform (NT/Unix) bug<br>refactored p4 output handling code<br>refactored exec'ing code</td>
  309. </tr>
  310. </table>
  311. </body>
  312. </html>