ISourceControlProvider.cs 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. using System;
  2. using System.Collections.Generic;
  3. using JetBrains.Annotations;
  4. using Unity.Cloud.Collaborate.Models.Enums;
  5. using Unity.Cloud.Collaborate.Models.Structures;
  6. namespace Unity.Cloud.Collaborate.Models.Api
  7. {
  8. internal interface ISourceControlProvider
  9. {
  10. /// <summary>
  11. /// Event called whenever the change list is updated.
  12. /// </summary>
  13. event Action UpdatedChangeList;
  14. /// <summary>
  15. /// Event called whenever the selected change list is updated.
  16. /// </summary>
  17. event Action<IReadOnlyList<string>> UpdatedSelectedChangeList;
  18. /// <summary>
  19. /// Event called whenever the list of historical revisions is updated.
  20. /// </summary>
  21. event Action UpdatedHistoryEntries;
  22. /// <summary>
  23. /// Event called whenever a long operation (with progress) has completed / started.
  24. /// </summary>
  25. event Action<bool> UpdatedOperationStatus;
  26. /// <summary>
  27. /// Event called whenever a long operation progress has changed.
  28. /// </summary>
  29. event Action<IProgressInfo> UpdatedOperationProgress;
  30. /// <summary>
  31. /// Event called whenever an error has occurred.
  32. /// </summary>
  33. event Action<IErrorInfo> ErrorOccurred;
  34. /// <summary>
  35. /// Event called whenever an error has cleared.
  36. /// </summary>
  37. event Action ErrorCleared;
  38. /// <summary>
  39. /// Event called whenever the conflict state changes.
  40. /// </summary>
  41. event Action<bool> UpdatedConflictState;
  42. /// <summary>
  43. /// Event called whenever the availability of remote revisions changes.
  44. /// </summary>
  45. event Action<bool> UpdatedRemoteRevisionsAvailability;
  46. /// <summary>
  47. /// Event that is triggered when the project status changes.
  48. /// </summary>
  49. event Action<ProjectStatus> UpdatedProjectStatus;
  50. /// <summary>
  51. /// Get whether there are available revisions to fetch.
  52. /// </summary>
  53. /// <returns>True if there are revisions available</returns>
  54. bool GetRemoteRevisionAvailability();
  55. /// <summary>
  56. /// Get whether there is a conflict or not.
  57. /// </summary>
  58. /// <returns>True if there is a conflict.</returns>
  59. bool GetConflictedState();
  60. /// <summary>
  61. /// Get the current progress state.
  62. /// </summary>
  63. /// <returns>The current progress state. Null if no operation ongoing.</returns>
  64. [CanBeNull]
  65. IProgressInfo GetProgressState();
  66. /// <summary>
  67. /// Get the current error state.
  68. /// </summary>
  69. /// <returns>The current error state. Null if no errors presently.</returns>
  70. [CanBeNull]
  71. IErrorInfo GetErrorState();
  72. /// <summary>
  73. /// Returns the current project status.
  74. /// </summary>
  75. /// <returns>Current project status.</returns>
  76. ProjectStatus GetProjectStatus();
  77. /// <summary>
  78. /// Request the current change list.
  79. /// </summary>
  80. /// <param name="callback">Callback for the result.</param>
  81. void RequestChangeList([NotNull] Action<IReadOnlyList<IChangeEntry>> callback);
  82. /// <summary>
  83. /// Publish files to Collaborate.
  84. /// </summary>
  85. /// <param name="message">Message to commit with.</param>
  86. /// <param name="changes">Changes to publish. Pass null to publish all.</param>
  87. void RequestPublish([NotNull] string message, [CanBeNull] IReadOnlyList<IChangeEntry> changes = null);
  88. /// <summary>
  89. /// Request a single historical revision.
  90. /// </summary>
  91. /// <param name="revisionId">Id of the revision to request.</param>
  92. /// <param name="callback">Callback for the result.</param>
  93. void RequestHistoryEntry([NotNull] string revisionId, [NotNull] Action<IHistoryEntry> callback);
  94. /// <summary>
  95. /// Request a page of historical revisions.
  96. /// </summary>
  97. /// <param name="offset">Where to start the page from.</param>
  98. /// <param name="pageSize">Number of entries in the page.</param>
  99. /// <param name="callback">Callback for the result.</param>
  100. void RequestHistoryPage(int offset, int pageSize, [NotNull] Action<IReadOnlyList<IHistoryEntry>> callback);
  101. /// <summary>
  102. /// Request the total number of historical revisions.
  103. /// </summary>
  104. /// <param name="callback">Callback for the result.</param>
  105. void RequestHistoryCount([NotNull] Action<int?> callback);
  106. /// <summary>
  107. /// Revert the specified file to the state of the current revision.
  108. /// of the source control system, or delete it if it's a new file.
  109. /// </summary>
  110. /// <param name="entry">Entry to discard.</param>
  111. void RequestDiscard([NotNull] IChangeEntry entry);
  112. /// <summary>
  113. /// Revert the specified files to the state of the current revision.
  114. /// of the source control system.
  115. /// </summary>
  116. /// <param name="paths">List of entries to discard.</param>
  117. void RequestBulkDiscard([NotNull] IReadOnlyList<IChangeEntry> entries);
  118. /// <summary>
  119. /// Diff the changes for the file at the given path.
  120. /// </summary>
  121. /// <param name="path">Path of the file to diff.</param>
  122. void RequestDiffChanges([NotNull] string path);
  123. /// <summary>
  124. /// Returns true if the provider supports revert.
  125. /// </summary>
  126. bool SupportsRevert { get; }
  127. /// <summary>
  128. /// Request revert the specified files to the given revision.
  129. /// </summary>
  130. /// <param name="revisionId">Revision to revert the files back to.</param>
  131. /// <param name="files">Files to revert back.</param>
  132. void RequestRevert([NotNull] string revisionId, [NotNull] IReadOnlyList<string> files);
  133. /// <summary>
  134. /// Request to update the state of the project to a new provided revision.
  135. /// </summary>
  136. /// <param name="revisionId">New revision id of the project to go to.</param>
  137. void RequestUpdateTo([NotNull] string revisionId);
  138. /// <summary>
  139. /// Request to take the state of the project back to the given (and current) revision.
  140. /// </summary>
  141. /// <param name="revisionId">Current revision id of the project to go back to.</param>
  142. void RequestRestoreTo([NotNull] string revisionId);
  143. /// <summary>
  144. /// Request to take the state of the project back to the given revision, but do not change the current revision or history.
  145. /// </summary>
  146. /// <param name="revisionId">Revision id to go back to.</param>
  147. void RequestGoBackTo([NotNull] string revisionId);
  148. /// <summary>
  149. /// Clears the error state.
  150. /// </summary>
  151. void ClearError();
  152. /// <summary>
  153. /// Show the difference between both version of a conlicted file.
  154. /// </summary>
  155. /// <param name="path">Path of the file to show.</param>
  156. void RequestShowConflictedDifferences([NotNull] string path);
  157. /// <summary>
  158. /// Request to choose merge for the provided conflict.
  159. /// </summary>
  160. /// <param name="path">Path of the file to choose merge for.</param>
  161. void RequestChooseMerge([NotNull] string path);
  162. /// <summary>
  163. /// Request to choose mine for the provided conflict.
  164. /// </summary>
  165. /// <param name="paths">Paths of the files to choose mine for.</param>
  166. void RequestChooseMine([NotNull] string[] paths);
  167. /// <summary>
  168. /// Request to choose remote for the provided conflict.
  169. /// </summary>
  170. /// <param name="paths">Paths of the files to choose remote for.</param>
  171. void RequestChooseRemote([NotNull] string[] paths);
  172. /// <summary>
  173. /// Request sync to latest revision.
  174. /// </summary>
  175. void RequestSync();
  176. /// <summary>
  177. /// Request cancel current job.
  178. /// </summary>
  179. void RequestCancelJob();
  180. /// <summary>
  181. /// Request to turn on the service.
  182. /// </summary>
  183. /// <returns></returns>
  184. void RequestTurnOnService();
  185. /// <summary>
  186. /// Show the service page.
  187. /// </summary>
  188. void ShowServicePage();
  189. /// <summary>
  190. /// Show login page.
  191. /// </summary>
  192. void ShowLoginPage();
  193. /// <summary>
  194. /// Show no seat page.
  195. /// </summary>
  196. void ShowNoSeatPage();
  197. }
  198. }