You've already forked lazarus-ccr
added TSvnPropInfo.LoadForFiles
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@114 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -153,6 +153,7 @@ type
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
function GetFileList: TStrings;
|
||||
property Author: string read FAuthor write FAuthor;
|
||||
property CommonPath: string read GetCommonPath;
|
||||
property Date: string read FDate write FDate;
|
||||
@ -203,6 +204,7 @@ type
|
||||
destructor Destroy; override;
|
||||
procedure LoadFromStream(s: TStream);
|
||||
procedure LoadFromFile(FileName: string);
|
||||
procedure LoadForFiles(FileNames: TStrings);
|
||||
property FileItem[index: integer]: TSvnFileProp read GetFile; default;
|
||||
property FileCount: integer read GetFileCount;
|
||||
end;
|
||||
@ -458,6 +460,15 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TLogEntry.GetFileList: TStrings;
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
Result := TStringList.Create;
|
||||
for i:= 0 to PathCount -1 do
|
||||
Result.Add(Path[i].Path);
|
||||
end;
|
||||
|
||||
function TLogEntry.GetLogPathCount: integer;
|
||||
begin
|
||||
Result := FLogPaths.Count;
|
||||
@ -630,5 +641,24 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSvnPropInfo.LoadForFiles(FileNames: TStrings);
|
||||
var
|
||||
Output: TMemoryStream;
|
||||
Files: string;
|
||||
i: integer;
|
||||
begin
|
||||
Output := TMemoryStream.Create;
|
||||
try
|
||||
Files := '';
|
||||
for i := 0 to FileNames.Count-1 do
|
||||
Files := Files + ' ' + FileNames[i];
|
||||
ExecuteSvnCommand('proplist -v' + Files, Output);
|
||||
Output.Position := 0;
|
||||
LoadFromStream(Output);
|
||||
finally
|
||||
Output.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -26,7 +26,9 @@ type
|
||||
procedure TestLoadComplexLogPaths;
|
||||
procedure TestLoadLogTwice;
|
||||
procedure TestLogCommonPath;
|
||||
procedure TestLogFiles;
|
||||
procedure TestPropList;
|
||||
procedure TestPropListLoadForFiles;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -212,6 +214,29 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTestSvnClasses.TestLogFiles;
|
||||
var
|
||||
SvnLog: TSvnLog;
|
||||
Files: TStrings;
|
||||
i: Integer;
|
||||
begin
|
||||
SvnLog := TSvnLog.Create;
|
||||
Files := nil;
|
||||
try
|
||||
SvnLog.LoadFromFile(GetLogFileName);
|
||||
AssertEquals('Wrong number of log entries', 6, SvnLog.LogEntryCount);
|
||||
for i := 0 to SvnLog.LogEntryCount - 1 do begin
|
||||
Files := SvnLog.LogEntry[i].GetFileList;
|
||||
AssertEquals('Wrong number of files',
|
||||
SvnLog.LogEntry[i].PathCount, Files.Count);
|
||||
FreeAndNil(Files);
|
||||
end;
|
||||
finally
|
||||
SvnLog.Free;
|
||||
Files.Free
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTestSvnClasses.TestPropList;
|
||||
var
|
||||
SvnPropInfo: TSvnPropInfo;
|
||||
@ -239,6 +264,26 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TTestSvnClasses.TestPropListLoadForFiles;
|
||||
var
|
||||
SvnPropInfo: TSvnPropInfo;
|
||||
FileNames: TStrings;
|
||||
begin
|
||||
FileNames:= TStringList.Create;
|
||||
FileNames.Add('testsvnclasses.pas');
|
||||
FileNames.Add('fpcunitsvnpkg.lpi');
|
||||
SvnPropInfo := TSvnPropInfo.Create;
|
||||
try
|
||||
SvnPropInfo.LoadForFiles(FileNames);
|
||||
AssertEquals('Wrong number of files', 2, SvnPropInfo.FileCount);
|
||||
AssertEquals('Wrong file name', FileNames[0], SvnPropInfo[0].FileName);
|
||||
AssertEquals('Wrong file name', FileNames[1], SvnPropInfo[1].FileName);
|
||||
finally
|
||||
FileNames.Free;
|
||||
SvnPropInfo.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
RegisterTest(TTestSvnClasses);
|
||||
|
Reference in New Issue
Block a user