public static void DiffWithBase(string assetPath) { if (!string.IsNullOrEmpty(assetPath)) { string baseAssetPath = VCCommands.Instance.GetBasePath(assetPath); if (!string.IsNullOrEmpty(baseAssetPath)) { if (EditorSettings.serializationMode == SerializationMode.ForceBinary && requiresTextConversionPostfix.Any(new ComposedString(assetPath).EndsWith)) { if (!Directory.Exists(tempDirectory)) { Directory.CreateDirectory(tempDirectory); } string convertedBaseFile = tempDirectory + Path.GetFileName(assetPath) + ".svn-base"; string convertedWorkingCopyFile = tempDirectory + Path.GetFileName(assetPath) + ".svn-wc"; var baseConvertCommand = new CommandLineExecution.CommandLine(GetBinaryConverterPath(), baseAssetPath + " " + convertedBaseFile, ".").Execute(); var workingCopyConvertCommand = new CommandLineExecution.CommandLine(GetBinaryConverterPath(), assetPath + " " + convertedWorkingCopyFile, ".").Execute(); EditorUtility.InvokeDiffTool("Working Base : " + convertedWorkingCopyFile, convertedBaseFile, "Working Copy : " + convertedWorkingCopyFile, convertedWorkingCopyFile, convertedWorkingCopyFile, convertedBaseFile); } else { EditorUtility.InvokeDiffTool("Working Base : " + assetPath, baseAssetPath, "Working Copy : " + assetPath, assetPath, assetPath, baseAssetPath); } } } }
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 void DiffWithBase(string assetPath) { if (!string.IsNullOrEmpty(assetPath)) { string baseAssetPath = VCCommands.Instance.GetBasePath(assetPath); var workingDirectory = GetWorkingDirectory(); if (!string.IsNullOrEmpty(baseAssetPath)) { if (EditorSettings.serializationMode == SerializationMode.ForceBinary && requiresTextConversionPostfix.Any(new ComposedString(assetPath).EndsWith)) { if (!Directory.Exists(tempDirectory)) { Directory.CreateDirectory(tempDirectory); } string convertedBaseFile = tempDirectory + Path.GetFileName(assetPath) + ".base"; string convertedWorkingCopyFile = tempDirectory + Path.GetFileName(assetPath) + ".wc"; var baseConvertCommand = new CommandLineExecution.CommandLine(GetBinaryConverterPath(), baseAssetPath + " " + convertedBaseFile, ".").Execute(); if (baseConvertCommand.Failed) { DebugLog.LogError("Command line Error: " + baseConvertCommand.ErrorStr + baseConvertCommand.OutputStr); return; } var workingCopyConvertCommand = new CommandLineExecution.CommandLine(GetBinaryConverterPath(), assetPath + " " + convertedWorkingCopyFile, ".").Execute(); if (workingCopyConvertCommand.Failed) { DebugLog.LogError("Command line Error: " + workingCopyConvertCommand.ErrorStr + workingCopyConvertCommand.OutputStr); return; } var(toolpath, args) = GetDiffCommandLine(Path.GetFullPath(convertedBaseFile), Path.GetFullPath(convertedWorkingCopyFile)); var diffCommand = new CommandLineExecution.CommandLine(toolpath, args, workingDirectory); Task.Run(() => diffCommand.Execute()); } else { var(toolpath, args) = GetDiffCommandLine(baseAssetPath, Path.GetFullPath(assetPath)); var baseConvertCommand = new CommandLineExecution.CommandLine(toolpath, args, workingDirectory); Task.Run(() => baseConvertCommand.Execute()); } } } }
public static void DiffWithBase(string assetPath) { if (!string.IsNullOrEmpty(assetPath)) { string baseAssetPath = VCCommands.Instance.GetBasePath(assetPath); if (!string.IsNullOrEmpty(baseAssetPath)) { if (EditorSettings.serializationMode == SerializationMode.ForceBinary) { if (!Directory.Exists(tempDirectory)) Directory.CreateDirectory(tempDirectory); string convertedBaseFile = tempDirectory + Path.GetFileName(assetPath) + ".svn-base"; string convertedWorkingCopyFile = tempDirectory + Path.GetFileName(assetPath) + ".svn-wc"; var baseConvertCommand = new CommandLineExecution.CommandLine(GetBinaryConverterPath(), baseAssetPath + " " + convertedBaseFile, ".").Execute(); var workingCopyConvertCommand = new CommandLineExecution.CommandLine(GetBinaryConverterPath(), assetPath + " " + convertedWorkingCopyFile, ".").Execute(); EditorUtility.InvokeDiffTool("Working Base : " + convertedWorkingCopyFile, convertedBaseFile, "Working Copy : " + convertedWorkingCopyFile, convertedWorkingCopyFile, convertedWorkingCopyFile, convertedBaseFile); } else { EditorUtility.InvokeDiffTool("Working Base : " + assetPath, baseAssetPath, "Working Copy : " + assetPath, assetPath, assetPath, baseAssetPath); } } } }