Created
December 13, 2015 11:44
-
-
Save vgaltes/1ac9acba125c7e783994 to your computer and use it in GitHub Desktop.
Whole function code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let extractCommitInfo (commit:string) = | |
let isCommitInfoLine (line: string) = | |
line.StartsWith("[") | |
let extractCommitedFilesInfo c = | |
let commitFileLine = CommitLineCsv.Parse(c).Rows |> Seq.head | |
{LinesAdded = commitFileLine.LinesAdded; LinesDeleted = commitFileLine.LinesDeleted; FileName = commitFileLine.FileName} | |
let commitLines = commit.Split([|lineBreak|], StringSplitOptions.RemoveEmptyEntries) | |
let commitInfoLine = commitLines |> Array.takeWhile(isCommitInfoLine) |> Array.last | |
let fileLines = commitLines |> Array.skipWhile(isCommitInfoLine) | |
let infoRow = CommitInfoCsv.Parse(commitInfoLine).Rows |> Seq.head | |
let commitInfo = {Hash = infoRow.Hash; Author = infoRow.Author; TimeStamp = infoRow.Date; Message = infoRow.Message} | |
let fileRows = fileLines |> Array.map extractCommitedFilesInfo | |
{CommitInfo = commitInfo; Files = fileRows} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment