svn classes: added TLogEntry.DateTime property + test

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@759 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
vsnijders
2009-04-03 07:58:58 +00:00
parent a271d2f11f
commit 4c15005f84
3 changed files with 16 additions and 9 deletions

View File

@ -34,7 +34,7 @@ unit SvnClasses;
interface
uses
Classes, SysUtils, strutils,
Classes, SysUtils, strutils, dateutils,
contnrs,
DOM, XMLRead,
SvnCommand;
@ -162,6 +162,7 @@ type
FMessage: string;
FRevision: integer;
function GetCommonPath: string;
function GetDateTime: TDateTime;
function GetDisplayDate: string;
function GetLogPath(index: integer): TLogPath;
function GetLogPathCount: integer;
@ -174,6 +175,7 @@ type
property Author: string read FAuthor write FAuthor;
property CommonPath: string read GetCommonPath;
property Date: string read FDate write FDate;
property DateTime: TDateTime read GetDateTime;
property DisplayDate: string read GetDisplayDate;
property Message: string read FMessage write FMessage;
property Path[index: integer] :TLogPath read GetLogPath;
@ -548,6 +550,11 @@ begin
end;
end;
function TLogEntry.GetDateTime: TDateTime;
begin
Result := ScanDateTime('yyyy-mm-dd"T"hh:nn:ss.zzz',FDate);
end;
function TLogEntry.GetDisplayDate: string;
begin
Result := Copy(FDate, 1, 10) + ' ' + Copy(FDate,12,8);
@ -696,7 +703,6 @@ begin
Lines := TStringList.Create;
try
Lines.LoadFromStream(s);
//writeln(Lines.Text);
i := 0;
while (i<Lines.Count) do begin
Line := Lines[i];

View File

@ -2,11 +2,13 @@
<CONFIG>
<ProjectOptions>
<PathDelim Value="\"/>
<Version Value="5"/>
<Version Value="7"/>
<General>
<Flags>
<LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<IconPath Value="./"/>
<TargetFileExt Value=".exe"/>
</General>
<VersionInfo>
@ -56,11 +58,8 @@
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
<Version Value="8"/>
<PathDelim Value="\"/>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
<Linking>
<Debugging>
<GenerateDebugInfo Value="True"/>

View File

@ -5,7 +5,7 @@ unit TestSvnClasses;
interface
uses
Classes, SysUtils, fpcunit, testregistry,
Classes, SysUtils, dateutils, fpcunit, testregistry,
svnclasses;
type
@ -116,6 +116,8 @@ begin
'2007-02-20T10:57:42.928052Z', LogEntry.Date);
AssertEquals('Wrong log display date',
'2007-02-20 10:57:42', LogEntry.DisplayDate);
AssertEquals('Wrong log datetime',
EncodeDateTime(2007,2,20,10,57,42,928), LogEntry.DateTime);
AssertEquals('Wrong log message',
'TAChart: added icon, added to make bigide', LogEntry.Message);
finally