<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Class: P4Change</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel=StyleSheet href=".././rdoc-style.css" type="text/css" media="screen" /> <script type="text/javascript" language="JavaScript"> <!-- function popCode(url) { window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") } //--> </script> </head> <body bgcolor="white"> <table summary="Information on class" width="100%" border="0" cellspacing="0"> <tr class="title-row"> <td class="big-title-font"> <sup><font color="aqua">Class</font></sup> P4Change </td> <td align="right"> <table summary="layout" cellspacing="0" cellpadding="2"> <tr valign="top"> <td class="small-title-font">In:</td> <td class="small-title-font"> <a href="../files/P4Triggers_rb.html" class="aqua"> P4Triggers.rb </a> <br /> </td> </tr> <tr> <td class="small-title-font">Parent:</td> <td class="small-title-font"> Object </td> </tr> </table> </td> </tr> </table> <!-- banner header --> <div class="description"><p> A class for holding info about a change. This is intended to be populated be the output of "p4 describe" rather than "p4 change -o". The difference is mostly in the case of the hash keys, but that’s significant enough. </p> </div> <table summary="Methods" cellpadding="5" width="100%"> <tr><td class="tablesubtitle">Methods</td></tr> </table> <div class="name-list"> <a href="#M000004">each_file</a> <a href="#M000005">each_job</a> <a href="#M000003">new</a> </div> <table summary="Attributes" cellpadding="5" width="100%"> <tr><td class="tablesubtitle">Attributes</td></tr> </table> <table summary="Attribute details" cellspacing="5"> <tr valign="top"> <td class="attr-name">change</td> <td align="center" class="attr-rw"> [R] </td> <td></td> </tr> <tr valign="top"> <td class="attr-name">client</td> <td align="center" class="attr-rw"> [R] </td> <td></td> </tr> <tr valign="top"> <td class="attr-name">desc</td> <td align="center" class="attr-rw"> [R] </td> <td></td> </tr> <tr valign="top"> <td class="attr-name">files</td> <td align="center" class="attr-rw"> [R] </td> <td></td> </tr> <tr valign="top"> <td class="attr-name">jobs</td> <td align="center" class="attr-rw"> [R] </td> <td></td> </tr> <tr valign="top"> <td class="attr-name">status</td> <td align="center" class="attr-rw"> [R] </td> <td></td> </tr> <tr valign="top"> <td class="attr-name">time</td> <td align="center" class="attr-rw"> [R] </td> <td></td> </tr> <tr valign="top"> <td class="attr-name">user</td> <td align="center" class="attr-rw"> [R] </td> <td></td> </tr> </table> <table summary="Method list" cellpadding="5" width="100%"> <tr><td class="tablesubtitle">Public Class methods</td></tr> </table> <table summary="method" width="100%" cellspacing="0" cellpadding="5" border="0"> <tr><td class="methodtitle"> <a name="M000003"></a> <b>new</b>( hash ) </td></tr> </table> <div class="description"> <p> Constructor. Pass the hash returned by P4#run_describe( "-s" ) in tagged mode. </p> </div> <pre class="source"> <span class="cmt"># File P4Triggers.rb, line 47</span> <span class="kw">def</span> initialize( hash ) @change = hash[ <span class="str">"change"</span> ] @user = hash[ <span class="str">"user"</span> ] @client = hash[ <span class="str">"client"</span> ] @desc = hash[ <span class="str">"desc"</span> ] @time = Time.at( hash[ <span class="str">"time"</span> ].to_i ) @status = hash[ <span class="str">"status"</span> ] @files = Array.new @jobs = Hash.new <span class="kw">if</span> ( hash.has_key?( <span class="str">"depotFile"</span> ) ) hash[ <span class="str">"depotFile"</span> ].each_index <span class="kw">do</span> |i| name = hash[ <span class="str">"depotFile"</span> ][ i ] type = hash[ <span class="str">"type"</span> ][ i ] rev = hash[ <span class="str">"rev"</span> ][ i ] act = hash[ <span class="str">"action"</span> ][ i ] df = P4DepotFile.new( name ) dr = df.new_revision dr.type = type dr.revno = rev.to_i dr.action = act @files.push( df ) <span class="kw">end</span> <span class="kw">end</span> <span class="kw">if</span> ( hash.has_key?( <span class="str">"job"</span> ) ) hash[ <span class="str">"job"</span> ].each_index <span class="kw">do</span> |i| job = hash[ <span class="str">"job"</span> ][ i ] status = hash[ <span class="str">"jobstat"</span> ][ i ] @jobs[ job ] = status <span class="kw">end</span> <span class="kw">end</span> <span class="kw">end</span> </pre> <table summary="Method list" cellpadding="5" width="100%"> <tr><td class="tablesubtitle">Public Instance methods</td></tr> </table> <table summary="method" width="100%" cellspacing="0" cellpadding="5" border="0"> <tr><td class="methodtitle"> <a name="M000004"></a> <b>each_file</b>( &block ) {| f | ...} </td></tr> </table> <div class="description"> <p> Shorthand iterator for looking at the files in the change </p> </div> <pre class="source"> <span class="cmt"># File P4Triggers.rb, line 90</span> <span class="kw">def</span> each_file( &block ) @files.each { |f| <span class="kw">yield</span>( f ) } <span class="kw">end</span> </pre> <table summary="method" width="100%" cellspacing="0" cellpadding="5" border="0"> <tr><td class="methodtitle"> <a name="M000005"></a> <b>each_job</b>( &block ) {| j | ...} </td></tr> </table> <div class="description"> <p> Shorthand iterator for looking at the jobs fixed by the change </p> </div> <pre class="source"> <span class="cmt"># File P4Triggers.rb, line 95</span> <span class="kw">def</span> each_job( &block ) @jobs.each { |j| <span class="kw">yield</span>( j ) } <span class="kw">end</span> </pre> </body> </html>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#3 | 4654 | Tony Smith |
Add an example spec trigger to show how you might restrict the default view for all new clients to a pre-defined set of mappings. |
||
#2 | 4640 | Tony Smith |
Add a sample post-commit trigger that can be used to keep a master and slave branch in sync. |
||
#1 | 3637 | Tony Smith | Add RDoc documentation to the sample triggers. |