-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHgCommit.cs
33 lines (29 loc) · 935 Bytes
/
HgCommit.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
using System;
namespace mercurial_reorder
{
internal class HgCommit : IComparable<HgCommit>
{
public string Branch = "";
public int Revision;
public string ChangesetId = "";
public string ParentChangesetId = "";
public DateTime Date = new DateTime();
public string Message = "";
public HgCommit(string data)
{
string[] pieces = data.Split(new string[] {"||||"}, StringSplitOptions.None);
if(pieces.Length != 6)
throw new InvalidOperationException("Does not have 6 fields: " + data);
Revision = int.Parse(pieces[0]);
Branch = pieces[1];
ChangesetId = pieces[2];
ParentChangesetId = pieces[3];
Date = Epoch.FromUnixTime(Double.Parse(pieces[4]));
Message = pieces[5];
}
public int CompareTo(HgCommit other)
{
return Revision.CompareTo(other.Revision);
}
}
}