void Awake()
 {
     if (treeElements.Count == 0)
     {
         treeElements = CommitTreeParser.GenerateCommitTree();
     }
 }
Exemple #2
0
        /// <summary>
        /// Ignores the file or folder by removing from the tracked files list and adding it to the gitignore.
        /// </summary>
        /// <param name="path">The file or folder path.</param>
        void IgnoreFile(string path)
        {
            string gitIgnore = "";

            using (StreamReader readtext = new StreamReader(".gitignore"))
            {
                gitIgnore = readtext.ReadToEnd();
            }
            var regex = string.Format("^{0}$", path);
            var match = Regex.Match(gitIgnore, regex, RegexOptions.IgnoreCase);

            if (!match.Success) // Check if the path is not yet in the gitignore
            {
                using (StreamWriter writetext = new StreamWriter(".gitignore", append: true))
                {
                    writetext.WriteLine(path);
                }
            }

            RepositoryManager.Remove(path);

            treeModel.SetData(CommitTreeParser.GenerateCommitTree());
            Reload();
        }
 /// <summary>
 /// Reload the tree
 /// </summary>
 public void Reload()
 {
     treeElements = CommitTreeParser.GenerateCommitTree();
 }
Exemple #4
0
 /// <summary>
 /// Revert a file or folder.
 /// </summary>
 /// <param name="path">The path to the file or folder.</param>
 void RevertFile(string path)
 {
     RepositoryManager.Checkout(path);
     treeModel.SetData(CommitTreeParser.GenerateCommitTree());
     Reload();
 }