- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>parse_change (P4Trigger)</title>
- <link rel=StyleSheet href="../.././rdoc-style.css" type="text/css" media="screen" />
- </head>
- <body bgcolor="white">
- <pre><span class="cmt"># File P4Triggers.rb, line 154</span>
- <span class="kw">def</span> parse_change( change_no )
- <span class="kw">begin</span>
- <span class="kw">if</span> ( ! change_no )
- raise( <span class="str">"No changelist number supplied to trigger script.\n"</span> +
- <span class="str">"Please check your trigger configuration."</span>
- )
- <span class="kw">end</span>
- get_change( change_no )
- <span class="kw">return</span> ( validate() ? 0 : 1 )
- <span class="kw">rescue</span>
- <span class="cmt"># Report errors to stderr, so they go into the Perforce server's</span>
- <span class="cmt"># logfile and report a simpler message to stdout</span>
- $stderr.puts( <span class="str">"\nError during trigger execution:\n\n"</span> )
- <span class="kw">if</span> ( $!.kind_of?( P4Exception ) )
- p4.errors.each { |e| $stderr.puts( e ) }
- <span class="kw">else</span>
- $stderr.puts( $!.to_s )
- <span class="kw">end</span>
- $stderr.puts( <span class="str">"\nStack Trace:\n"</span> )
- $stderr.puts( $!.backtrace )
- $stdout.puts( error_message() )
-
- <span class="cmt"># Now we return false to the caller so they can return with </span>
- <span class="cmt"># the correct exit status</span>
- <span class="kw">return</span> 1
- <span class="kw">end</span>
- <span class="kw">end</span></pre>
- </body>
- </html>
# |
Change |
User |
Description |
Committed |
|
#1
|
3637 |
Tony Smith |
Add RDoc documentation to the sample triggers. |
21 years ago
|
|