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

View File

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

View File

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