-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathLogEntry.cs
133 lines (119 loc) · 3.25 KB
/
LogEntry.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
//-----------------------------------------------------------------------
// <copyright file="LogEntry.cs" company="(none)">
// Copyright © 2013 John Gietzen and the WebGit .NET Authors. All rights reserved.
// </copyright>
// <author>John Gietzen</author>
//-----------------------------------------------------------------------
namespace WebGitNet
{
using System;
using System.Collections.Generic;
using System.Linq;
public class LogEntry
{
private readonly string author;
private readonly DateTimeOffset authorDate;
private readonly string authorEmail;
private readonly string body;
private readonly string commitHash;
private readonly string committer;
private readonly DateTimeOffset committerDate;
private readonly string committerEmail;
private readonly IList<string> parents;
private readonly string subject;
private readonly string tree;
public LogEntry(string commitHash, string tree, string parents, string author, string authorEmail, string authorDate, string committer, string committerEmail, string committerDate, string subject, string body)
{
this.commitHash = commitHash;
this.tree = tree;
this.parents = string.IsNullOrEmpty(parents)
? (IList<string>)new string[0]
: parents.Split(' ').ToList().AsReadOnly();
this.author = author;
this.authorEmail = authorEmail;
this.authorDate = DateTimeOffset.Parse(authorDate);
this.committer = committer;
this.committerEmail = committerEmail;
this.committerDate = DateTimeOffset.Parse(committerDate);
this.subject = subject;
this.body = body;
}
public string Author
{
get
{
return this.author;
}
}
public DateTimeOffset AuthorDate
{
get
{
return this.authorDate;
}
}
public string AuthorEmail
{
get
{
return this.authorEmail;
}
}
public string Body
{
get
{
return this.body;
}
}
public string CommitHash
{
get
{
return this.commitHash;
}
}
public string Committer
{
get
{
return this.committer;
}
}
public DateTimeOffset CommitterDate
{
get
{
return this.committerDate;
}
}
public string CommitterEmail
{
get
{
return this.committerEmail;
}
}
public IList<string> Parents
{
get
{
return this.parents;
}
}
public string Subject
{
get
{
return this.subject;
}
}
public string Tree
{
get
{
return this.tree;
}
}
}
}