Esempio n. 1
0
    public void GetChanges()
    {
        Process p      = GitManager.GitCommand("--no-pager log HEAD..FETCH_HEAD --format=\"%an%n%at\" --numstat " + path);
        string  output = p.StandardOutput.ReadToEnd(),
                error  = p.StandardError.ReadToEnd();

        if (error.Length > 0)
        {
            UnityEngine.Debug.Log(error);
        }

        string[]         lines    = output.Split(new char[] { System.Environment.NewLine[0], System.Environment.NewLine[1] });
        List <GitChange> changesL = new List <GitChange>();

        for (int i = 0; i < lines.Length - 4; i += 4)
        {
            GitChange change = new GitChange();
            change.author = lines[i];
            change.date   = lines[i + 1];
            string[] a = lines[i + 3].Split('	');
            change.additions = System.Convert.ToInt32(a[0]);
            change.deletions = System.Convert.ToInt32(a[1]);
            change.path      = a[2];
            changesL.Add(change);
        }
        changes = changesL.ToArray();
        p.WaitForExit();
        p.Close();
    }