public void Setup() { injectionHelper = new InjectionHelper(); injectionHelper.Bind <UniGitPaths>().FromInstance(new UniGitPaths(@"D:\Test_Repo", @"D:\Test_Repo")); injectionHelper.Bind <GitSettingsJson>().FromInstance(new GitSettingsJson { Threading = 0 }); injectionHelper.Bind <GitCallbacks>(); injectionHelper.Bind <IGitPrefs>().To <GitPrefs>(); injectionHelper.Bind <GitAsyncManager>(); injectionHelper.Bind <GitManager>(); injectionHelper.Bind <GitReflectionHelper>(); injectionHelper.Bind <GitOverlay>(); injectionHelper.Bind <GitSettingsManager>(); injectionHelper.Bind <IGitResourceManager>().To <GitResourceManagerMock>(); injectionHelper.Bind <ILogger>().FromInstance(Debug.unityLogger); injectionHelper.Bind <UniGitData>(); injectionHelper.Bind <GitInitializer>(); gitManager = injectionHelper.GetInstance <GitManager>(); injectionHelper.GetInstance <GitInitializer>().InitializeRepository(); gitCallbacks = injectionHelper.GetInstance <GitCallbacks>(); signature = new Signature("Test", "*****@*****.**", DateTime.Now); data = injectionHelper.GetInstance <UniGitData>(); EditorApplication.update += gitCallbacks.IssueEditorUpdate; gitCallbacks.IssueEditorUpdate(); injectionHelper.CreateNonLazy(); }
private void Construct(GitManager gitManager, GitReflectionHelper reflectionHelper, UniGitData data, ILogger logger, GitSettingsJson gitSettings, GitCallbacks gitCallbacks, GitInitializer initializer, GitSettingsManager settingsManager, UniGitPaths paths, IGitResourceManager resourceManager) { this.resourceManager = resourceManager; this.paths = paths; this.settingsManager = settingsManager; this.logger = logger; this.gitSettings = gitSettings; this.initializer = initializer; if (gitManager == null) { logger.Log(LogType.Error, "Git manager cannot be null."); return; } if (this.gitCallbacks != null) { Unsubscribe(this.gitCallbacks); } this.data = data; this.gitManager = gitManager; this.gitManager.AddWatcher(this); this.reflectionHelper = reflectionHelper; Subscribe(gitCallbacks); }
public GitRemotesSettingsTab(GitManager gitManager, GitSettingsWindow settingsWindow, UniGitData data, GitSettingsJson gitSettings, GitCallbacks gitCallbacks, GitInitializer initializer) : base(new GUIContent("Remotes", "Remote Repositories"), gitManager, settingsWindow, data, gitSettings, gitCallbacks, initializer) { }
public GitSubModulesPopup(UniGitData data, GitOverlay gitOverlay, GitManager gitManager) { this.data = data; this.gitOverlay = gitOverlay; this.gitManager = gitManager; moduleStyle = new GUIStyle("ProjectBrowserHeaderBgTop") { wordWrap = true, fixedHeight = 0, alignment = TextAnchor.MiddleLeft }; }
public GitExternalsSettingsTab(GitManager gitManager, GitSettingsWindow settingsWindow, GitExternalManager externalManager, UniGitData data, GitSettingsJson gitSettings, GitCallbacks gitCallbacks, GitInitializer initializer) : base(new GUIContent("Externals", "External Programs Helpers"), gitManager, settingsWindow, data, gitSettings, gitCallbacks, initializer) { this.externalManager = externalManager; }
public GitDiffWindowToolbarRenderer(GitManager gitManager, GitDiffElementContextFactory contextFactory, UniGitData data, InjectionHelper injectionHelper, GitSettingsJson gitSettings, GitOverlay gitOverlay, IGitPrefs prefs) { this.gitManager = gitManager; this.contextFactory = contextFactory; this.data = data; this.injectionHelper = injectionHelper; this.gitSettings = gitSettings; this.gitOverlay = gitOverlay; this.prefs = prefs; searchField = new SearchField(); }
public GitSecuritySettingsTab(GitManager gitManager, GitSettingsWindow settingsWindow, GitCredentialsManager credentialsManager, UniGitData data, GitSettingsJson gitSettings, GitCallbacks gitCallbacks, GitInitializer initializer, GitOverlay gitOverlay) : base(new GUIContent("Security"), gitManager, settingsWindow, data, gitSettings, gitCallbacks, initializer) { this.credentialsManager = credentialsManager; this.gitOverlay = gitOverlay; }
public GitLFSSettingsTab(GitManager gitManager, GitSettingsWindow settingsWindow, GitLfsManager lfsManager, InjectionHelper injectionHelper, UniGitData data, GitSettingsJson gitSettings, GitCallbacks gitCallbacks, GitInitializer initializer) : base(new GUIContent("LFS", "Git Large File Storage (beta)"), gitManager, settingsWindow, data, gitSettings, gitCallbacks, initializer) { this.injectionHelper = injectionHelper; this.lfsManager = lfsManager; }
public GitBranchesSettingsTab(GitManager gitManager, GitSettingsWindow settingsWindow, GitExternalManager externalManager, InjectionHelper injectionHelper, UniGitData data, ILogger logger, GitSettingsJson gitSettings, GitCallbacks gitCallbacks, GitInitializer initializer) : base(new GUIContent("Branches"), gitManager, settingsWindow, data, gitSettings, gitCallbacks, initializer) { this.injectionHelper = injectionHelper; this.externalManager = externalManager; this.logger = logger; }
public GitGeneralSettingsTab(GitManager gitManager, GitSettingsWindow settingsWindow, GitLfsManager lfsManager, UniGitData data, GitSettingsJson gitSettings, GitCallbacks gitCallbacks, GitInitializer initializer, GitSettingsManager settingsManager, UniGitPaths paths) : base(new GUIContent("General"), gitManager, settingsWindow, data, gitSettings, gitCallbacks, initializer) { this.paths = paths; this.lfsManager = lfsManager; this.settingsManager = settingsManager; }
public GitLog(UniGitPaths paths, UniGitData data, GitSettingsJson gitSettings, GitCallbacks gitCallbacks) { this.paths = paths; this.data = data; this.gitSettings = gitSettings; this.gitCallbacks = gitCallbacks; logTypeRegex = new Regex(@"\[.*?\]", RegexOptions.Compiled); lineAndNumberRegex = new Regex(@"\(at((.*?):(.*?))\)", RegexOptions.Compiled); if (data.LogInitialized) { data.LogInitialized = true; data.LogEntries.Clear(); LoadLines(); } }
internal GitSettingsTab(GUIContent name, GitManager gitManager, GitSettingsWindow settingsWindow, UniGitData data, GitSettingsJson gitSettings, GitCallbacks gitCallbacks, GitInitializer initializer) { this.name = name; this.gitManager = gitManager; this.settingsWindow = settingsWindow; this.data = data; this.gitSettings = gitSettings; this.gitCallbacks = gitCallbacks; this.initializer = initializer; gitCallbacks.EditorUpdate += OnEditorUpdateInternal; gitCallbacks.UpdateRepository += OnGitManagerUpdateInternal; }
public GitManager( GitCallbacks callbacks, GitSettingsJson settings, IGitPrefs prefs, GitAsyncManager asyncManager, UniGitData gitData, ILogger logger, GitInitializer initializer, UniGitPaths paths) { this.paths = paths; this.gitData = gitData; this.callbacks = callbacks; this.prefs = prefs; this.asyncManager = asyncManager; this.logger = logger; this.initializer = initializer; gitSettings = settings; Initialize(); }
public GitProjectOverlay(GitManager gitManager, GitCallbacks gitCallbacks, GitSettingsJson gitSettings, GitAsyncManager asyncManager, GitReflectionHelper reflectionHelper, GitOverlay gitOverlay, IGitPrefs prefs, UniGitData data, ILogger logger, InjectionHelper injectionHelper, [UniGitInjectOptional] bool cullNonAssetPaths = true) { if (iconStyle == null) { iconStyle = new GUIStyle { imagePosition = ImagePosition.ImageOnly, alignment = TextAnchor.LowerLeft, padding = new RectOffset(2, 2, 2, 2) }; lineStyle = new GUIStyle(EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector).FindStyle("IN Title")) { padding = new RectOffset(), margin = new RectOffset(), contentOffset = Vector2.zero, fixedHeight = 0, fixedWidth = 0, border = { left = 0, right = 0 } }; } this.logger = logger; this.data = data; this.gitManager = gitManager; this.gitSettings = gitSettings; this.asyncManager = asyncManager; this.gitCallbacks = gitCallbacks; this.reflectionHelper = reflectionHelper; this.gitOverlay = gitOverlay; this.prefs = prefs; this.cullNonAssetPaths = cullNonAssetPaths; this.injectionHelper = injectionHelper; gitManager.AddWatcher(this); gitCallbacks.EditorUpdate += OnEditorUpdate; gitCallbacks.ProjectWindowItemOnGUI += CustomIcons; gitCallbacks.UpdateRepository += OnUpdateRepository; //project browsers only get created before delay call but not before constructor gitCallbacks.DelayCall += () => { projectWindows = new List <EditorWindow>(Resources.FindObjectsOfTypeAll(reflectionHelper.ProjectWindowType).Cast <EditorWindow>()); }; //shortcut to getting instance id without loading asset var method = typeof(AssetDatabase).GetMethod("GetMainAssetOrInProgressProxyInstanceID", BindingFlags.NonPublic | BindingFlags.Static); if (method != null) { GetMainAssetOrInProgressProxyInstanceID = (Func <string, int>)Delegate.CreateDelegate(typeof(Func <string, int>), method); } }
static UniGitLoader() { HandlePaths(); GitProfilerProxy.BeginSample("UniGit Initialization"); try { GitWindows.OnWindowAddedEvent += OnWindowAdded; EditorApplication.update += OnEditorUpdate; injectionHelper = new InjectionHelper(); GitWindows.Init(); uniGitData = CreateUniGitData(); //data must be created manually to not call unity methods from constructors string projectPath = UniGitPathHelper.FixUnityPath( Application.dataPath.Replace(UniGitPathHelper.UnityDeirectorySeparatorChar + "Assets", "")); string repoPath = projectPath; if (EditorPrefs.HasKey(RepoPathKey)) { repoPath = UniGitPathHelper.FixUnityPath(UniGitPathHelper.Combine(repoPath, EditorPrefs.GetString(RepoPathKey))); } injectionHelper.Bind <UniGitPaths>().FromInstance(new UniGitPaths(repoPath, projectPath)); injectionHelper.Bind <GitInitializer>().NonLazy(); injectionHelper.Bind <UniGitData>().FromMethod(c => uniGitData); //must have a getter so that it can be injected injectionHelper.Bind <GitCallbacks>().FromMethod(GetGitCallbacks); injectionHelper.Bind <IGitPrefs>().To <UnityEditorGitPrefs>(); injectionHelper.Bind <GitManager>().NonLazy(); injectionHelper.Bind <GitSettingsJson>(); injectionHelper.Bind <GitSettingsManager>(); injectionHelper.Bind <GitAsyncManager>(); injectionHelper.Bind <GitFileWatcher>().NonLazy(); injectionHelper.Bind <GitReflectionHelper>(); injectionHelper.Bind <IGitResourceManager>().To <GitResourceManager>(); injectionHelper.Bind <GitOverlay>(); injectionHelper.Bind <GitAutoFetcher>().NonLazy(); injectionHelper.Bind <GitLog>(); injectionHelper.Bind <ILogger>().FromMethod(c => new Logger(c.injectionHelper.GetInstance <GitLog>())); injectionHelper.Bind <GitAnimation>(); injectionHelper.Bind <ICredentialsAdapter>().To <WincredCredentialsAdapter>(); injectionHelper.Bind <GitCredentialsManager>().NonLazy(); injectionHelper.Bind <IExternalAdapter>().To <GitExtensionsAdapter>(); injectionHelper.Bind <IExternalAdapter>().To <TortoiseGitAdapter>(); injectionHelper.Bind <GitExternalManager>(); injectionHelper.Bind <GitLfsManager>().NonLazy(); //must be non lazy as it add itself as a filter injectionHelper.Bind <GitPushHookBase>().To <GitLfsPrePushHook>(); injectionHelper.Bind <GitHookManager>().NonLazy(); injectionHelper.Bind <GitLfsHelper>(); injectionHelper.Bind <FileLinesReader>(); injectionHelper.Bind <GitProjectOverlay>().NonLazy(); injectionHelper.Bind <GitConflictsHandler>(); //diff window injectionHelper.Bind <GitDiffWindowToolbarRenderer>().AsTransient(); injectionHelper.Bind <GitDiffElementContextFactory>().AsTransient(); injectionHelper.Bind <GitDiffWindowCommitRenderer>().AsTransient(); injectionHelper.Bind <GitDiffWindowDiffElementRenderer>().AsTransient(); Rebuild(injectionHelper); } finally { GitProfilerProxy.EndSample(); } }