Exemplo n.º 1
0
        private bool AutoFetchChanges()
        {
            if (gitManager.Repository == null || !initializer.IsValidRepo || !gitSettings.AutoFetch)
            {
                return(false);
            }
            Remote remote = gitManager.Repository.Network.Remotes.FirstOrDefault();

            if (remote == null)
            {
                return(false);
            }
            GitProfilerProxy.BeginSample("Git automatic fetching");
            try
            {
                GitCommands.Fetch(gitManager.Repository, remote, new FetchOptions()
                {
                    CredentialsProvider         = credentialsManager.FetchChangesAutoCredentialHandler,
                    OnTransferProgress          = gitManager.FetchTransferProgressHandler,
                    RepositoryOperationStarting = (context) =>
                    {
                        logger.Log(LogType.Log, "Repository Operation Starting");
                        return(true);
                    }
                });
                //Debug.LogFormat("Auto Fetch From remote: {0} - ({1}) successful.", remote.Name, remote.Url);
            }
            catch (Exception e)
            {
                logger.LogFormat(LogType.Error, "Automatic Fetching from remote: {0} with URL: {1} Failed!", remote.Name, remote.Url);
                logger.LogException(e);
            }
            finally
            {
                EditorUtility.ClearProgressBar();
                GitProfilerProxy.EndSample();
            }
            return(false);
        }
Exemplo n.º 2
0
        private void OnWizardCreate()
        {
            try
            {
                GitCommands.Fetch(gitManager.Repository, remotes[selectedRemote], fetchOptions);
#if UNITY_EDITOR
                logger.Log(LogType.Log, "Fetch Complete");
#endif
                var window = UniGitLoader.FindWindow <GitHistoryWindow>();
                if (window != null)
                {
                    window.ShowNotification(new GUIContent("Fetch Complete"));
                }
                gitManager.MarkDirty(true);
            }
            catch (Exception e)
            {
                logger.LogException(e);
            }
            finally
            {
                EditorUtility.ClearProgressBar();
            }
        }