using System; using System.Text; using p4dn; using System.IO; namespace P4API { /// <summary> /// Actions to take when resolving a file. /// </summary> /// <remarks> /// <list> /// <li>CMS_QUIT user wants to quit</li> /// <li>CMS_SKIP skip the integration record</li> /// <li>CMS_MERGED accepted merged theirs and yours</li> /// <li>CMS_EDIT accepted edited merge</li> /// <li>CMS_THEIRS accepted theirs</li> /// <li>CMS_YOUR accepted yours</li> /// </list> /// </remarks> public enum MergeAction { /// <summary> /// Quit the resolve workflow. /// </summary> Quit, // CMS_QUIT user wants to quit /// <summary> /// Skip this file in the resolve workflow. /// </summary> Skip, // CMS_SKIP skip the integration record /// <summary> /// Accept the merged file from Perforce. This file must not be edited. /// </summary> AcceptMerged, // CMS_MERGED accepted merged theirs and yours /// <summary> /// Accept the result file with your edits. The result file should be edited before returning this merge action. /// </summary> AcceptEdit, // CMS_EDIT accepted edited merge /// <summary> /// Accept 'their' file ('your' changes will be lost). /// </summary> AcceptTheirs, // CMS_THEIRS accepted theirs /// <summary> /// Accept 'your' file ('thier' changes will be lost). /// </summary> AcceptYours // CMS_YOUR accepted yours } /// <summary> /// Contains information about the files being merged. /// </summary> public class MergeData { private P4MergeData _mergeData; internal MergeData(P4MergeData mergeData) { _mergeData = mergeData; } /// <summary> /// Base file for the 3-way merge. /// </summary> public FileInfo BaseFile { get { return _mergeData.GetBasePath(); } } /// <summary> /// Your file for the 3-way merge. /// </summary> public FileInfo YourFile { get { return _mergeData.GetYourPath(); } } /// <summary> /// Perforce's recommended merge action. /// </summary> public MergeAction MergeHint { get { switch (_mergeData.GetMergeHint()) { case P4MergeStatus.CMS_QUIT: return MergeAction.Quit; case P4MergeStatus.CMS_SKIP: return MergeAction.Skip; case P4MergeStatus.CMS_EDIT: return MergeAction.AcceptEdit; case P4MergeStatus.CMS_MERGED: return MergeAction.AcceptMerged; case P4MergeStatus.CMS_YOURS: return MergeAction.AcceptYours; case P4MergeStatus.CMS_THEIRS: return MergeAction.AcceptTheirs; } return MergeAction.Quit; } } /// <summary> /// Thier file for the 3-way merge. /// </summary> public FileInfo TheirFile { get { return _mergeData.GetTheirPath(); } } /// <summary> /// File where merged result should be written. /// </summary> public FileInfo ResultFile { get { return _mergeData.GetResultPath(); } } /// <summary> /// Perforce name of the base file. Format is '//depot/path/file.ext#rev'. /// </summary> public string BaseName { get { return _mergeData.GetBaseName(); } } /// <summary> /// Perforce name of your file. Format is '//client/path/file.ext'. /// </summary> public string YourName { get { return _mergeData.GetYourName(); } } /// <summary> /// Perforce name of thier file. Format is '//depot/path/file.ext#rev'. /// </summary> public string TheirName { get { return _mergeData.GetTheirName(); } } /// <summary> /// Runs the external merge tool configured by P4MERGE. /// </summary> /// <returns>True if the merge tool exits with code 0, false otherwise.</returns> public bool RunMergeTool() { return _mergeData.RunMergeTool(); } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 7291 | Andrew McDonald | initial submittal | ||
//guest/shawn_hladky/P4.Net/main/src/P4API/MergeData.cs | |||||
#3 | 6505 | Shawn Hladky |
P4.Net: Multiple Changes 1. Update samples to VS2008 and new bin paths 2. Update MSBuild sync tasks to have IgnoredWarnings parameter 3. Added public class for P4RecordsetCallback. This allows consumers to easily migrate code that uses Recordsets to also take advantage of callback hooks. 4. Reworked method signiture of RunCallback. Removed tagged parameter and added RunCallbackUnparsed method. Made Callback parameter first so command and arguments are next to one-another. Note: this is a BREAKING CHANGE if you are using callbacks. 5. Reworked so switching between tagged and untagged runs will not disconnect/reconnect. 6. Add initial work for a file diffing object. |
||
#2 | 6457 | Shawn Hladky |
P4.Net: Added form_save overload to allow arbitrary arguments (primarily for -u flag on submitted changelists) Added unit tests for Resolve workflow. Still need work on this and test partially fails. Updated some internal data structures to use generics Added documentation comments |
||
#1 | 6353 | Shawn Hladky |
P4.Net: Implemented diff functionality Implemented Merge functionality Converted print commands to the callback interface |