Beispiel #1
0
        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 GitDiffWindowCommitRenderer(GitSettingsJson gitSettings, GitManager gitManager, GitOverlay gitOverlay, GitInitializer initializer)
 {
     this.gitSettings = gitSettings;
     this.gitManager  = gitManager;
     this.gitOverlay  = gitOverlay;
     this.initializer = initializer;
 }
Beispiel #3
0
        private static void SaveCommitMessageToFile(GitInitializer initializer, GitSettingsJson gitSettings, string message)
        {
            try
            {
                string settingsFolder = initializer.GitSettingsFolderPath;
                if (!Directory.Exists(settingsFolder))
                {
                    Directory.CreateDirectory(settingsFolder);
                }

                var commitMessageFilePath      = initializer.GetCommitMessageFilePath(gitSettings.ActiveSubModule);
                var commitMessageFileDirectory = Path.GetDirectoryName(commitMessageFilePath);

                if (!Directory.Exists(commitMessageFileDirectory))
                {
                    Directory.CreateDirectory(commitMessageFileDirectory);
                }

                File.WriteAllText(commitMessageFileDirectory, message);
            }
            catch (UnauthorizedAccessException e)
            {
                Debug.LogWarning("Commit message file is forced to read only.");
            }
            catch (Exception e)
            {
#if UNITY_EDITOR
                Debug.LogError("Could not save commit message to file. Saving to Prefs");
                Debug.LogException(e);
#endif
            }
        }
Beispiel #4
0
 internal static void SetCommitMessage(GitInitializer initializer, GitManager gitManager, GitSettingsJson gitSettings, string commitMessage)
 {
     if (gitSettings.ReadFromFile)
     {
         SaveCommitMessageToFile(initializer, gitSettings, commitMessage);
     }
     gitManager.Prefs.SetString(CommitMessageKey, commitMessage);
 }
        public GitSettingsManager(UniGitPaths paths, GitSettingsJson settings, GitCallbacks gitCallbacks, ILogger logger, GitInitializer initializer)
        {
            this.paths        = paths;
            this.settings     = settings;
            this.gitCallbacks = gitCallbacks;
            this.logger       = logger;
            this.initializer  = initializer;

            gitCallbacks.EditorUpdate += OnEditorUpdate;
        }
Beispiel #6
0
 internal static void Init(GitManager gitManager,
                           GitExternalManager externalManager,
                           GitCallbacks gitCallbacks,
                           ILogger logger,
                           GitProjectOverlay gitProjectOverlay,
                           GitReflectionHelper reflectionHelper,
                           GitInitializer initializer)
 {
     GitProjectContextMenus.gitManager        = gitManager;
     GitProjectContextMenus.externalManager   = externalManager;
     GitProjectContextMenus.gitCallbacks      = gitCallbacks;
     GitProjectContextMenus.logger            = logger;
     GitProjectContextMenus.reflectionHelper  = reflectionHelper;
     GitProjectContextMenus.gitProjectOverlay = gitProjectOverlay;
     GitProjectContextMenus.initializer       = initializer;
 }
Beispiel #7
0
 public GitAutoFetcher(GitManager gitManager,
                       GitCredentialsManager credentialsManager,
                       GitCallbacks gitCallbacks,
                       GitSettingsJson gitSettings,
                       ILogger logger,
                       GitInitializer initializer)
 {
     this.gitManager            = gitManager;
     this.credentialsManager    = credentialsManager;
     this.gitCallbacks          = gitCallbacks;
     this.logger                = logger;
     this.gitSettings           = gitSettings;
     this.initializer           = initializer;
     gitCallbacks.EditorUpdate += OnEditorUpdate;
     needsFetch = !EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isCompiling && !EditorApplication.isUpdating;
 }
Beispiel #8
0
        private void Construct(GitManager gitManager,
                               GitCredentialsManager credentialsManager,
                               GitExternalManager externalManager,
                               ILogger logger,
                               GitSettingsJson gitSettings,
                               GitInitializer initializer)
        {
            this.logger             = logger;
            this.gitManager         = gitManager;
            this.credentialsManager = credentialsManager;
            this.externalManager    = externalManager;
            this.gitSettings        = gitSettings;
            this.initializer        = initializer;

            remotes = gitManager.Repository.Network != null && gitManager.Repository.Network.Remotes != null?gitManager.Repository.Network.Remotes.ToArray() : new Remote[0];

            remoteNames         = remotes.Select(r => new GUIContent(r.Name)).ToArray();
            branchNames         = gitManager.Repository.Branches.Select(b => b.CanonicalName).ToArray();
            branchFriendlyNames = gitManager.Repository.Branches.Select(b => b.FriendlyName).ToArray();
        }
Beispiel #9
0
        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();
        }
Beispiel #10
0
 internal static void Init(GitInitializer initializer)
 {
     GitUnityMenu.initializer = initializer;
 }
 public GitConflictsHandler(GitManager gitManager, GitExternalManager externalManager, GitInitializer initializer)
 {
     this.gitManager      = gitManager;
     this.externalManager = externalManager;
     this.initializer     = initializer;
 }