private static void ReMoveAssetOnVC(string from, string to) { VersionControlStatus status = VCCommands.Instance.GetAssetStatus(from); string topUnversionedFolder; if (VCUtility.ManagedByRepository(status) && !InUnversionedParentFolder(from, out topUnversionedFolder)) { if (DisplayConfirmationDialog("Move", from, status)) { if (InUnversionedParentFolder(to, out topUnversionedFolder)) { string msg = "Versioned files are moved into an unversioned folder. Add following unversioned folder first?\n\n" + topUnversionedFolder; int result = EditorUtility.DisplayDialogComplex("Add Folder?", msg, "Yes", "No", "Cancel"); if (result == 0) { //MoveAssetBack(from, to); VCCommands.Instance.Add(new[] { topUnversionedFolder }); VCCommands.Instance.Status(new[] { topUnversionedFolder }, StatusLevel.Local); } if (result == 1) { //VCCommands.Instance.Delete(new[] { from }, OperationMode.Force); return; } if (result == 2) { MoveAssetBack(from, to); return; } } //else //{ // MoveAssetBack(from, to); //} //VCCommands.Instance.Move(from, to); AssetDatabase.Refresh(); GameObjectToAssetPathCache.ClearObjectToAssetPathCache(); } else { MoveAssetBack(from, to); } } }
static AnalyticsEvents() { VCCommands.Instance.OperationCompleted += (operation, beforeStatus, afterStatus, success) => { GoogleAnalytics.LogUserEvent("Operation", string.Format("{0}_{1}", operation.ToString(), (success ? "success" : "failed"))); }; int dayOfYear = DateTime.Now.DayOfYear; int dayOfYearForLastSubmit = EditorPrefs.GetInt("UVCGA/DayOfLastSubmit", -1); if (dayOfYear != dayOfYearForLastSubmit) { EditorPrefs.SetInt("UVCGA/DayOfLastSubmit", dayOfYear); GoogleAnalytics.LogUserEvent("Project", PlayerSettings.productName.GetHashCode().ToString()); GoogleAnalytics.LogUserEvent("Version", VCUtility.GetCurrentVersion()); GoogleAnalytics.LogUserEvent("OS", Environment.OSVersion.Platform.ToString()); } }
public static void HandleConflicts() { var conflicts = VCCommands.Instance.GetFilteredAssets(s => s.fileStatus == VCFileStatus.Conflicted || s.MetaStatus().fileStatus == VCFileStatus.Conflicted).Select(status => status.assetPath).ToArray(); if (conflicts.Any()) { foreach (var conflictIt in conflicts) { if (ignoredConflicts.Contains(conflictIt)) { continue; } bool mergable = VCUtility.IsMergableAsset(conflictIt); const string explanation = "\nTheirs :\nUse the file from the server and discard local changes to the file\n\nMine :\nUse my version of the file and discard the changes someone else made on the server"; const string mergeExplanation = "\nMerge External :\nIgnore the conflict in UVC and handle the conflict in an external program"; const string ignoreExplanation = "\nIgnore :\nIgnore the conflict for now although the file will not be readable by Unity"; string message = string.Format("There is a conflict in the file:\n '{0}'\n\nUse 'Theirs' or 'Mine'?\n {1}\n{2}\n", conflictIt.Compose(), explanation, mergable ? mergeExplanation : ignoreExplanation); int result = EditorUtility.DisplayDialogComplex("Conflict", message, "Theirs", "Mine", mergable ? "Merge External" : "Ignore"); if (result == 0 || result == 1) { VCCommands.Instance.Resolve(new[] { conflictIt.Compose() }, result == 0 ? ConflictResolution.Theirs : ConflictResolution.Mine); } else { ignoredConflicts.Add(conflictIt); /*if (mergable) * { * string mine, theirs, basePath; * if(VCCommands.Instance.GetConflict(conflictIt.Compose(), out basePath, out mine, out theirs)) * { * EditorUtility.InvokeDiffTool("Mine : " + mine, mine, "Theirs : " + theirs, theirs, "Base: " + basePath, basePath); * } * }*/ } } OnNextUpdate.Do(AssetDatabase.Refresh); } }
private static AssetMoveResult OnWillMoveAsset(string from, string to) { if (!UseTeamLicence) { return(AssetMoveResult.DidNotMove); } VersionControlStatus status = VCCommands.Instance.GetAssetStatus(from); if (VCUtility.ManagedByRepository(status)) { if (DisplayConfirmationDialog("Move", from, status)) { string topUnversionedFolder; if (InUnversionedParentFolder(to, out topUnversionedFolder)) { int result = EditorUtility.DisplayDialogComplex("Add Folder?", "Versioned files are moved into an unversioned folder. Add following unversioned folder first?\n\n" + topUnversionedFolder, "Yes", "No", "Cancel"); if (result == 0) { VCCommands.Instance.Add(new[] { topUnversionedFolder }); VCCommands.Instance.Status(new[] { topUnversionedFolder }, StatusLevel.Local); } if (result == 2) { return(AssetMoveResult.FailedMove); } } if (VCCommands.Instance.Move(from, to)) { D.Log("Version Control Move: " + from + " => " + to); return(AssetMoveResult.DidMove); } return(AssetMoveResult.DidNotMove); } return(AssetMoveResult.FailedMove); } return(AssetMoveResult.DidNotMove); }
internal static void RefreshEditableObject(GameObject gameObject) { bool editable = ShouleBeEditable(gameObject); bool parentEditable = gameObject.transform.parent ? ShouleBeEditable(gameObject.transform.parent.gameObject) : VCUtility.HaveAssetControl(SceneManagerUtilities.GetCurrentScenePath()); bool prefabHeadEditable = PrefabHelper.IsPrefabRoot(gameObject) && parentEditable; if (prefabHeadEditable) { SetEditable(gameObject, true); } else { SetEditable(gameObject, editable); } foreach (var componentIt in gameObject.GetComponents <Component>()) { if (prefabHeadEditable && componentIt == gameObject.transform) { SetEditable(gameObject.transform, true); } else { RefreshEditableComponent(gameObject, componentIt); } } }
internal static void RefreshEditableMaterial(Material material) { SetEditable(material, VCUtility.HaveAssetControl(material) || !LockMaterial(material.GetAssetPath())); }
private static void SetMaterialLock(Material material, bool gameObjectLocked) { var assetPath = material.GetAssetPath(); var assetStatus = VCCommands.Instance.GetAssetStatus(assetPath); bool materialStoredInScene = VCUtility.MaterialStoredInScene(material); bool shouldLock = (materialStoredInScene ? gameObjectLocked : (VCUtility.ManagedByRepository(assetStatus) && !VCUtility.HaveAssetControl(assetStatus))) && LockMaterial(assetPath); SetEditable(material, !shouldLock); }
private static void ReportError(VCException e) { if (VCSettings.BugReport) { string title = Environment.UserName + "@" + Environment.MachineName + " : (" + VCUtility.GetCurrentVersion() + "):\n" + e.ErrorMessage; string description = "\n" + e.ErrorDetails; var conflicts = VCCommands.Instance.GetFilteredAssets( svnStatus => svnStatus.treeConflictStatus != VCTreeConflictStatus.Normal || svnStatus.fileStatus == VCFileStatus.Conflicted || svnStatus.fileStatus == VCFileStatus.Obstructed); if (conflicts != null && conflicts.Any()) { description += "\n\nSVN Conflicts:\n" + conflicts.Select(status => status.assetPath.Compose()).Aggregate((a, b) => a + "\n" + b); } FogbugzUtilities.SubmitAutoBug(title, description); } }
public static void VCDeleteProjectContext() { VCUtility.VCDeleteWithConfirmation(GetAssetPathsOfSelected()); }