public static bool VCDialog(string command, IEnumerable <string> assetPaths) { if (!assetPaths.Any()) { return(false); } return(UserDialog.DisplayDialog(command + " following assest in Version Control?", "\n" + assetPaths.Aggregate((a, b) => a + "\n" + b), "Yes", "No")); }
private static void HandleMixedRevision(VCMixedRevisionException e) { var answer = UserDialog.DisplayDialog("Mixed Revision", "Cannot merge into mixed-revision working copy, try updating first", "Update", "Cancel"); if (answer) { VCCommands.Instance.UpdateTask(); } }
private static void HandleNewerVersion(VCNewerVersionException e) { var answer = UserDialog.DisplayDialog("Newer Version", "There is a newer version of the file on the server so you need to 'Update' first and then try again", "Update", "Cancel"); if (answer) { VCCommands.Instance.UpdateTask(); } }
public static bool GetLock(string assetpath, OperationMode operationMode = OperationMode.Normal) { var status = VCCommands.Instance.GetAssetStatus(assetpath); if (operationMode == OperationMode.Normal || UserDialog.DisplayDialog("Force " + Terminology.getlock, "Are you sure you will steal the file from: [" + status.owner + "]", "Yes", "Cancel")) { return(VCCommands.Instance.GetLock(new[] { assetpath }, operationMode)); } return(false); }
private static void VCForceGetLockGameobjectContext(MenuCommand command) { string assetPath = command.context.GetAssetPath(); VersionControlStatus assetStatus = VCCommands.Instance.GetAssetStatus(assetPath); if (assetStatus.lockStatus == VCLockStatus.LockedOther) { if (UserDialog.DisplayDialog("Force " + Terminology.getlock, "Are you sure you will steal the file from: [" + assetStatus.owner + "]", "Yes", "Cancel")) { VCCommands.Instance.GetLock(new[] { assetPath }, OperationMode.Force); } } }
private static bool DisplayConfirmationDialog(string command, string assetPath, VersionControlStatus assetStatus) { bool acceptOperation = true; if (assetStatus.lockStatus == VCLockStatus.LockedOther) { acceptOperation = UserDialog.DisplayDialog(command + " on repository?", assetPath + "\nis " + Terminology.getlock + " by [" + assetStatus.owner + "], are you sure you want to " + command + "?", command, "Cancel"); } if (acceptOperation && assetStatus.fileStatus == VCFileStatus.Modified) { acceptOperation = UserDialog.DisplayDialog(command + " on repository?", assetPath + "\nFile is modified on repository, are you sure you want to " + command + "?", command, "Cancel"); } return(acceptOperation); }
public static void ValidateIgnoreFolders(bool forceValidate) { string workDirectory = Application.dataPath.Remove(Application.dataPath.LastIndexOf("/Assets", StringComparison.InvariantCultureIgnoreCase)); var ignores = VCCommands.Instance.GetIgnore(workDirectory); if (ignores != null) { bool needSetIgnore = !ignores.Contains("Library") || !ignores.Contains("Temp"); if (needSetIgnore || forceValidate) { const string title = "Fix ignores?"; const string message = "Do you want UVC to automatically fix file and folder ignores?"; if (UserDialog.DisplayDialog(title, message, "Fix it", "No")) { VCCommands.Instance.SetIgnore(workDirectory, defaultIgnores); } } } }
public static void ResolveConflict(string assetPath, string basepath, string theirs, string yours) { if (!string.IsNullOrEmpty(assetPath)) { var workingDirectory = GetWorkingDirectory(); var path = Path.GetDirectoryName(assetPath); var file = Path.GetFileName(assetPath); basepath = Path.GetFullPath(basepath); theirs = Path.GetFullPath(theirs); yours = Path.GetFullPath(yours); string merge = Path.GetFullPath(assetPath); DateTime lastWriteTime = File.GetLastWriteTime(assetPath); var(toolpath, args) = GetMergeCommandLine(basepath, theirs, yours, merge); var mergeCommand = new CommandLineExecution.CommandLine(toolpath, args, workingDirectory); Task.Run(() => { while (true) { Thread.Sleep(100); if (File.GetLastWriteTime(assetPath) != lastWriteTime) { return(true); } } }).ContinueWithOnNextUpdate(modified => { VCCommands.Instance.Status(new[] { assetPath }, StatusLevel.Local); if (VCCommands.Instance.GetAssetStatus(assetPath).fileStatus == VCFileStatus.Conflicted) { if (UserDialog.DisplayDialog("Merge Successful?", $"Did the merge complete successfully?\n'{assetPath}'", "Yes", "No")) { VCCommands.Instance.Resolve(new[] { assetPath }, ConflictResolution.Mine); VCCommands.Instance.Status(StatusLevel.Previous, DetailLevel.Normal); } } } ); Task.Run(() => mergeCommand.Execute()); } }
public static bool UserSelectedVersionControlSystem() { if (VCSettings.VersionControlBackend == VCSettings.EVersionControlBackend.None) { bool response = UserDialog.DisplayDialog("Version Control Selection", "Select which Version Control System you are using", "SVN", "None"); if (response) // SVN { VCSettings.VersionControlBackend = VCSettings.EVersionControlBackend.Svn; } /*P4_DISABLED * int response = UserDialog.DisplayDialogComplex("Version Control Selection", "Select which Version Control System you are using", "SVN", "P4 Beta", "None"); * if (response == 0) // SVN * { * VCSettings.VersionControlBackend = VCSettings.EVersionControlBackend.Svn; * } * else if (response == 1) // Perforce * { * VCSettings.VersionControlBackend = VCSettings.EVersionControlBackend.P4_Beta; * }*/ } return(VCSettings.VersionControlBackend != VCSettings.EVersionControlBackend.None); }
public bool CommitDialog(List <string> assets, bool includeDependencies = true, bool showUserConfirmation = false, string commitMessage = "") { int initialAssetCount = assets.Count; if (initialAssetCount == 0) { return(true); } UnityAssetpathsFilters.AddFilesInFolders(ref assets); AssetpathsFilters.AddFolders(ref assets, vcc); AssetpathsFilters.AddMoveMatches(ref assets, vcc); List <string> dependencies = new List <string>(); if (includeDependencies) { dependencies = assets.GetDependencies().ToList(); UnityAssetpathsFilters.AddFilesInFolders(ref dependencies); AssetpathsFilters.AddFolders(ref dependencies, vcc); dependencies.AddRange(assets.AddDeletedInFolders(vcc)); } var allAssets = assets.Concat(dependencies).Distinct().ToList(); var localModified = allAssets.LocalModified(vcc); if (assets.Contains(SceneManagerUtilities.GetCurrentScenePath())) { SceneManagerUtilities.SaveCurrentModifiedScenesIfUserWantsTo(); } var localOnly = allAssets.LocalOnly(vcc); if (localOnly.Any()) { return(UserDialog.DisplayDialog( title: "Commit Warning!", message: "You have chosen your own content above content from the server, which have made the asset 'Local Only'\n" + "To reduce the risk of removing someones work, you will have to verify you wish to 'commit anyway'\n\n" + $"{localOnly.Aggregate((a, b) => a + "\n" + b)}", ok: "Commit Anyway", cancel: "Cancel" )); } if (VCSettings.RequireLockBeforeCommit && localModified.Any()) { string title = $"{Terminology.getlock} '{Terminology.localModified}' files?"; string message = $"You are trying to commit files which are '{Terminology.localModified}'.\nDo you want to '{Terminology.getlock}' these files first?"; if (UserDialog.DisplayDialog(title, message, Terminology.getlock, "Abort")) { GetLock(localModified); } else { return(false); } } if (showUserConfirmation || initialAssetCount < (assets.Count() + dependencies.Count())) { return(OpenCommitDialogWindow(assets, dependencies)); } return(Commit(assets, commitMessage)); }
private static bool PromptUserForBackend(VCSettings.EVersionControlBackend backend) { return(UserDialog.DisplayDialog("Use " + backend + " ?", "The only valid version control found is '" + backend + "'. \nUse " + backend + " as version control?", "Yes", "No")); }