public GitAnalyzer()
        {
            commitList = new List <Commit>();
            repo       = FindGitRepo();
            if (repo == null)
            {
                return;
            }

            foreach (Commit c in repo.Commits)
            {
                commitList.Add(c);
            }

            // Cofigure diff options so patch only includes modified lines
            compareOptions = new CompareOptions();
            compareOptions.ContextLines      = 0; // if 0, only include modified lines in diff (has + or - at start of line). 3 is default
            compareOptions.IncludeUnmodified = true;
            compareOptions.InterhunkLines    = 0; // if Int.MAX then all changes are in ONE hunk
            pathOptions = new ExplicitPathsOptions();

            // Create Regex to match each hunk in the diff patch
            string diffPattern = @"\@\@\s\-(?:\d+)(?:,\d+)??\s\+(?<start>\d+)(?:,\d+)??\s\@\@
                            (?:[^\n]*?\n)(?<changes>.*?)(?=\n^@ | $\Z)
                            ";

            hunkRegex = new Regex(diffPattern, RegexOptions.IgnorePatternWhitespace | RegexOptions.Singleline | RegexOptions.Multiline);
            //TODO figure out way to sep chunks via regex
        }
Example #2
0
        private void OnEnable()
        {
            GitWindows.AddWindow(this);
            compareOptions = new CompareOptions()
            {
                Algorithm    = DiffAlgorithm.Myers,
                ContextLines = 0
            };

            explicitPathsOptions = new ExplicitPathsOptions();

            titleContent = new GUIContent("Diff Inspector", GitGUI.Textures.ZoomTool);
            uberRegex    = new UberRegex(new ColoredRegex[]
            {
                new ColoredRegex("Comments", comments, "green"),
                new ColoredRegex("Strings", strings, "brown"),
                new ColoredRegex("Keywords", keywords, "blue"),
                new ColoredRegex("Types", types, "blue"),
                new ColoredRegex("Methods", methods, "teal"),
                new ColoredRegex("Attributes", attributes, "blue"),
                new ColoredRegex("Defines", defines, "olive"),
                new ColoredRegex("Values", values, "brown"),
                new ColoredRegex("NUmbers", numbers, "brown"),
            });
        }
Example #3
0
 public void Remove(IEnumerable <string> paths, bool removeFromWorkingDirectory, ExplicitPathsOptions explicitPathsOptions)
 {
     throw new NotImplementedException();
 }
Example #4
0
 public void Unstage(IEnumerable <string> paths, ExplicitPathsOptions explicitPathsOptions)
 {
     throw new NotImplementedException();
 }
Example #5
0
 public void Unstage(string path, ExplicitPathsOptions explicitPathsOptions)
 {
     throw new NotImplementedException();
 }
Example #6
0
 public void Reset(Commit commit, IEnumerable <string> paths = null, ExplicitPathsOptions explicitPathsOptions = null)
 {
     throw new NotImplementedException();
 }
Example #7
0
 public void Remove(string path, bool removeFromWorkingDirectory, ExplicitPathsOptions explicitPathsOptions)
 {
     Commands.Remove(this.repository, path, removeFromWorkingDirectory, explicitPathsOptions);
 }
Example #8
0
 public void Remove(IEnumerable <string> paths, bool removeFromWorkingDirectory, ExplicitPathsOptions explicitPathsOptions)
 {
     Commands.Remove(this.repository, paths, removeFromWorkingDirectory, explicitPathsOptions);
 }
Example #9
0
 public void Unstage(IEnumerable <string> paths, ExplicitPathsOptions explicitPathsOptions)
 {
     Commands.Unstage(this.repository, paths, explicitPathsOptions);
 }
Example #10
0
 public void Unstage(string path, ExplicitPathsOptions explicitPathsOptions)
 {
     Commands.Unstage(this.repository, path, explicitPathsOptions);
 }