Пример #1
0
 public void Copy(GitSettings settings)
 {
     AutoStage                 = settings.AutoStage;
     AutoFetch                 = settings.AutoFetch;
     ExternalsType             = settings.ExternalsType;
     ExternalProgram           = settings.ExternalProgram;
     CredentialsManager        = settings.CredentialsManager;
     ProjectStatusOverlayDepth = settings.ProjectStatusOverlayDepth;
     ShowEmptyFolders          = settings.ShowEmptyFolders;
     GitStatusMultithreaded    = settings.GitStatusMultithreaded;
     UseGavatar                = settings.UseGavatar;
     MaxCommitTextAreaSize     = settings.MaxCommitTextAreaSize;
     DetectRenames             = settings.DetectRenames;
 }
Пример #2
0
 public void Copy(GitSettings settings)
 {
     AutoStage                 = settings.AutoStage;
     AutoFetch                 = settings.AutoFetch;
     ExternalsType             = (ExternalsTypeEnum)settings.ExternalsType;
     ExternalProgram           = settings.ExternalProgram;
     CredentialsManager        = settings.CredentialsManager;
     ProjectStatusOverlayDepth = settings.ProjectStatusOverlayDepth;
     ShowEmptyFolders          = settings.ShowEmptyFolders;
     Threading                 = (settings.GitStatusMultithreaded ? DefalutThreadingType : 0);
     UseGavatar                = settings.UseGavatar;
     MaxCommitTextAreaSize     = settings.MaxCommitTextAreaSize;
     DetectRenames             = settings.DetectRenames ? RenameTypeEnum.All : RenameTypeEnum.None;
 }
Пример #3
0
        internal static void Initlize()
        {
            repoPathCached = Application.dataPath.Replace("/Assets", "").Replace("/", "\\");

            if (!IsValidRepo)
            {
                return;
            }

            gitCredentials = EditorGUIUtility.Load("UniGit/Git-Credentials.asset") as GitCredentials;
            gitSettings    = EditorGUIUtility.Load("UniGit/Git-Settings.asset") as GitSettings;
            if (gitSettings == null)
            {
                gitSettings = ScriptableObject.CreateInstance <GitSettings>();
                AssetDatabase.CreateAsset(gitSettings, "Assets/Editor Default Resources/UniGit/Git-Settings.asset");
                AssetDatabase.SaveAssets();
            }

            if (IconStyle == null)
            {
                IconStyle = new GUIStyle
                {
                    imagePosition = ImagePosition.ImageOnly,
                    alignment     = TextAnchor.LowerLeft,
                    padding       = new RectOffset(2, 2, 2, 2)
                };
            }

            if (icons == null)
            {
                icons = new Icons()
                {
                    validIcon          = EditorGUIUtility.IconContent("UniGit/success"),
                    validIconSmall     = EditorGUIUtility.IconContent("UniGit/success_small"),
                    modifiedIcon       = EditorGUIUtility.IconContent("UniGit/error"),
                    modifiedIconSmall  = EditorGUIUtility.IconContent("UniGit/error_small"),
                    addedIcon          = EditorGUIUtility.IconContent("UniGit/add"),
                    addedIconSmall     = EditorGUIUtility.IconContent("UniGit/add_small"),
                    untrackedIcon      = EditorGUIUtility.IconContent("UniGit/info"),
                    untrackedIconSmall = EditorGUIUtility.IconContent("UniGit/info_small"),
                    ignoredIcon        = EditorGUIUtility.IconContent("UniGit/minus"),
                    ignoredIconSmall   = EditorGUIUtility.IconContent("UniGit/minus_small"),
                    conflictIcon       = EditorGUIUtility.IconContent("UniGit/warning"),
                    conflictIconSmall  = EditorGUIUtility.IconContent("UniGit/warning_small"),
                    deletedIcon        = EditorGUIUtility.IconContent("UniGit/deleted"),
                    deletedIconSmall   = EditorGUIUtility.IconContent("UniGit/deleted_small"),
                    renamedIcon        = EditorGUIUtility.IconContent("UniGit/renamed"),
                    renamedIconSmall   = EditorGUIUtility.IconContent("UniGit/renamed_small"),
                    loadingIconSmall   = EditorGUIUtility.IconContent("UniGit/loading"),
                    objectIcon         = EditorGUIUtility.IconContent("UniGit/object"),
                    objectIconSmall    = EditorGUIUtility.IconContent("UniGit/object_small"),
                    metaIcon           = EditorGUIUtility.IconContent("UniGit/meta"),
                    metaIconSmall      = EditorGUIUtility.IconContent("UniGit/meta_small")
                };
            }

            EditorApplication.projectWindowItemOnGUI += CustomIcons;

            GitLfsManager.Load();
            GitHookManager.Load();
            GitExternalManager.Load();
            GitCredentialsManager.Load();

            needsFetch                 = !EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isCompiling && !EditorApplication.isUpdating;
            repositoryDirty            = true;
            GitCallbacks.EditorUpdate += OnEditorUpdate;
        }
Пример #4
0
        internal static void Initlize()
        {
            if (!IsValidRepo)
            {
                return;
            }

            gitCredentials = EditorGUIUtility.Load("UniGit/Git-Credentials.asset") as GitCredentials;
            gitSettings    = EditorGUIUtility.LoadRequired("UniGit/Git-Settings.asset") as GitSettings;
            if (gitSettings == null)
            {
                gitSettings = ScriptableObject.CreateInstance <GitSettings>();
                AssetDatabase.CreateAsset(gitSettings, "Assets/Editor Default Resources/UniGit/Git-Settings.asset");
                AssetDatabase.SaveAssets();
            }
            repository = new Repository(RepoPath);
            Update();

            if (IconStyle == null)
            {
                IconStyle = new GUIStyle
                {
                    imagePosition = ImagePosition.ImageOnly,
                    alignment     = TextAnchor.LowerLeft,
                    padding       = new RectOffset(2, 2, 2, 2)
                };
            }

            if (icons == null)
            {
                icons = new Icons()
                {
                    validIcon          = EditorGUIUtility.IconContent("UniGit/success"),
                    validIconSmall     = EditorGUIUtility.IconContent("UniGit/success_small"),
                    modifiedIcon       = EditorGUIUtility.IconContent("UniGit/error"),
                    modifiedIconSmall  = EditorGUIUtility.IconContent("UniGit/error_small"),
                    addedIcon          = EditorGUIUtility.IconContent("UniGit/add"),
                    addedIconSmall     = EditorGUIUtility.IconContent("UniGit/add_small"),
                    untrackedIcon      = EditorGUIUtility.IconContent("UniGit/info"),
                    untrackedIconSmall = EditorGUIUtility.IconContent("UniGit/info_small"),
                    ignoredIcon        = EditorGUIUtility.IconContent("UniGit/minus"),
                    ignoredIconSmall   = EditorGUIUtility.IconContent("UniGit/minus_small"),
                    conflictIcon       = EditorGUIUtility.IconContent("UniGit/warning"),
                    conflictIconSmall  = EditorGUIUtility.IconContent("UniGit/warning_small"),
                    deletedIcon        = EditorGUIUtility.IconContent("UniGit/deleted"),
                    deletedIconSmall   = EditorGUIUtility.IconContent("UniGit/deleted_small"),
                    renamedIcon        = EditorGUIUtility.IconContent("UniGit/renamed"),
                    renamedIconSmall   = EditorGUIUtility.IconContent("UniGit/renamed_small")
                };
            }

            EditorApplication.projectWindowItemOnGUI += CustomIcons;

            GitLfsManager.Load();
            GitHookManager.Load();
            GitExternalManager.Load();
            GitCredentialsManager.Load();

            needsFetch = true;
            EditorApplication.update += OnEditorUpdate;
        }