<html> <head> <title>P4/Ruby</title> <link rel="stylesheet" type="text/css" href="docstyle.css"> </head> <body> <p align="right"> <a href="index.html">Contents</a> </p> <div class="classhdr"> <table border=0> <tr> <td> <span class="classtag">Class</span> <span class="classname">P4::MergeData</span> <span class="classparent">< Object</span> </td> <td id="righttext"> <span class="requiretag">require</span> <span class="modulename">"P4"</span> </td> </tr> </table> </div> <h3>Description</h3> Class containing the context for an individual merge during execution of a 'p4 resolve'. <div class="classmethods"> <h3>Class Methods</h3> <div class="index"> <table border="0"> <tr> <td> None </td> </tr> </table> </div> </div> <div class="instancemethods"> <h3>Instance Methods</h3> <div class="index"> <table border="0"> <tr> <td> <a href="#your_name">your_name</a> <a href="#their_name">their_name</a> <a href="#base_name">base_name</a> </td> <td> <a href="#your_path">your_path</a> <a href="#their_path">their_path</a> <a href="#base_path">base_path</a> </td> <td> <a href="#result_path">result_path</a> <a href="#merge_hint">merge_hint</a> <a href="#run_merge">run_merge</a> </td> </tr> </table> </div> </div> <a name="your_name"></a> <div class="method"> <div class="methodheader"> <table> <tr> <td class="meth_name">your_name</td> <td class="proto"> <i>md</i>.your_name() -> <i>aString</i> </td> </tr> </table> </div> Returns the name of 'your' file in the merge. This is typically a path to a file in the workspace. <pre> p4.run_resolve() do |md| yours = md.your_name md.merge_hint end </pre> </div> <a name="their_name"></a> <div class="method"> <div class="methodheader"> <table> <tr> <td class="meth_name">their_name</td> <td class="proto"> <i>md</i>.their_name() -> <i>aString</i> </td> </tr> </table> </div> Returns the name of 'their' file in the merge. This is typically a path to a file in the depot. <pre> p4.run_resolve() do |md| theirs = md.their_name md.merge_hint end </pre> </div> <a name="base_name"></a> <div class="method"> <div class="methodheader"> <table> <tr> <td class="meth_name">base_name</td> <td class="proto"> <i>md</i>.base_name() -> <i>aString</i> </td> </tr> </table> </div> Returns the name of the 'base' file in the merge. This is typically a path to a file in the depot. <pre> p4.run_resolve() do |md| base = md.base_name md.merge_hint end </pre> </div> <a name="your_path"></a> <div class="method"> <div class="methodheader"> <table> <tr> <td class="meth_name">your_path</td> <td class="proto"> <i>md</i>.your_path() -> <i>aString</i> </td> </tr> </table> </div> Returns the path of 'your' file in the merge. This is typically a path to a file in the workspace. <pre> p4.run_resolve() do |md| your_path = md.your_path md.merge_hint end </pre> </div> <a name="their_path"></a> <div class="method"> <div class="methodheader"> <table> <tr> <td class="meth_name">their_path</td> <td class="proto"> <i>md</i>.their_path() -> <i>aString</i> </td> </tr> </table> </div> Returns the path of 'their' file in the merge. This is typically a path to a temporary file on your local machine in which the contents of <a href="#their_name">their_name()</a> have been loaded. <pre> p4.run_resolve() do |md| their_name = md.their_name their_file = File.open( md.their_path ) md.merge_hint end </pre> </div> <a name="base_path"></a> <div class="method"> <div class="methodheader"> <table> <tr> <td class="meth_name">base_path</td> <td class="proto"> <i>md</i>.base_path() -> <i>aString</i> </td> </tr> </table> </div> Returns the path of the base file in the merge. This is typically a path to a temporary file on your local machine in which the contents of <a href="#base_name">base_name()</a> have been loaded. <pre> p4.run_resolve() do |md| base_name = md.base_name base_file = File.open( md.base_path ) md.merge_hint end </pre> </div> <a name="result_path"></a> <div class="method"> <div class="methodheader"> <table> <tr> <td class="meth_name">result_path</td> <td class="proto"> <i>md</i>.result_path() -> <i>aString</i> </td> </tr> </table> </div> Returns the path to the merge result. This is typically a path to a temporary file on your local machine in which the contents of the automatic merge performed by the server have been loaded. <pre> p4.run_resolve() do |md| result_file = File.open( md.result_path ) md.merge_hint end </pre> </div> <a name="merge_hint"></a> <div class="method"> <div class="methodheader"> <table> <tr> <td class="meth_name">merge_hint</td> <td class="proto"> <i>md</i>.merge_hint() -> <i>aString</i> </td> </tr> </table> </div> Returns the hint from the server as to how it thinks you might best resolve this merge. <pre> p4.run_resolve() do |md| md.merge_hint end </pre> </div> <a name="run_merge"></a> <div class="method"> <div class="methodheader"> <table> <tr> <td class="meth_name">run_merge</td> <td class="proto"> <i>md</i>.run_merge() -> <i>aBoolean</i> </td> </tr> </table> </div> If the environment variable P4MERGE is defined, run_merge() invokes the specified program and returns a boolean based on the return value of that program. <pre> p4.run_resolve() do |md| if ( ENV.has_key?( "P4MERGE" ) && md.run_merge() ) "am" else "s" end end </pre> </div> <h3>See Also</h3> <div class="seealso"> <a href="P4.html">P4</a> </div> </body> </html>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 5791 | Tony Smith |
Add experimental support for passing a block to P4#run_resolve. The block is passed a P4::MergeData object encapsulating the context of each merge performed. The block should evaluate to a string indicating the desired result of the merge: 'ay', 'at', 'am', 's', etc. The P4::MergeData object contains information about the files involved in the merge and can invoke an external merge tool. This is still experimental at this stage so the interface may change as it evolves. |