From 3b1dfd7245b8b64a18bc0757cf5de76fb9ed01ef Mon Sep 17 00:00:00 2001 From: vsnijders Date: Fri, 27 Apr 2007 20:31:57 +0000 Subject: [PATCH] fpsvnsync: fixed adding new directories (or files) with properties git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@154 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- applications/fpsvnsync/fpsvnsync.lpr | 27 ++++++++++++++------ components/svn/svnclasses.pas | 35 +++++++++++++++++++++----- components/svn/test/testsvnclasses.pas | 10 +++++--- components/svn/test/testsvncommand.pas | 2 +- 4 files changed, 56 insertions(+), 18 deletions(-) diff --git a/applications/fpsvnsync/fpsvnsync.lpr b/applications/fpsvnsync/fpsvnsync.lpr index 6407f0234..969291a2d 100644 --- a/applications/fpsvnsync/fpsvnsync.lpr +++ b/applications/fpsvnsync/fpsvnsync.lpr @@ -186,6 +186,9 @@ var var SourcePropInfo: TSvnPropInfo; DestPropInfo: TSvnPropInfo; + BaseFileName: string; + DestFileName: string; + DestFileProp: TSvnFileProp; i: Integer; function CreatePropInfo(const BaseDir: string): TSvnPropInfo; @@ -238,9 +241,13 @@ var end; for i := 0 to SourcePropInfo.FileCount-1 do begin - if Copy(SourcePropInfo[i].FileName, length(FSourceWC)+1, 4000) <> Copy(DestPropInfo[i].FileName, Length(FDestWC)+1, 4000) then begin + BaseFileName := Copy(SourcePropInfo[i].FileName, length(FSourceWC)+1, 4000); + DestFileName := FDestWC + BaseFileName; + DestFileProp := DestPropInfo.GetFileItem(DestFileName); + + if BaseFileName <> Copy(DestFileProp.FileName, Length(FDestWC)+1, 4000) then begin writeln('FileName mismatch: ', - SourcePropInfo[i].FileName, '<>', DestPropInfo[i].FileName); + SourcePropInfo[i].FileName, '<>', DestFileProp.FileName); halt(3); end; CopyFileProp(SourcePropInfo[i], DestPropInfo[i]); @@ -274,14 +281,18 @@ var end; begin - SourceHead := GetRevision('-rHEAD '+FSourceWC); - writeln(FSourceWC, ' HEAD at revision ', SourceHead); + try + SourceHead := GetRevision('-rHEAD '+FSourceWC); + writeln(FSourceWC, ' HEAD at revision ', SourceHead); - Revision := GetRevision('-rHEAD '+FDestWC); - writeln(FDestWC, ' HEAD at revision ', Revision); + Revision := GetRevision('-rHEAD '+FDestWC); + writeln(FDestWC, ' HEAD at revision ', Revision); - DestRoot := GetRepositoryRoot(FDestWC); - writeln('------'); + DestRoot := GetRepositoryRoot(FDestWC); + writeln('------'); + except + halt(9); + end; XmlOutput := TMemoryStream.Create; SvnLog := TSvnLog.Create; diff --git a/components/svn/svnclasses.pas b/components/svn/svnclasses.pas index 67d00bcab..b0366196c 100644 --- a/components/svn/svnclasses.pas +++ b/components/svn/svnclasses.pas @@ -189,6 +189,7 @@ type FProperties: TStrings; public constructor Create; + constructor Create(const AFileName: string); destructor Destroy; override; property FileName: string read FFileName; property Properties: TStrings read FProperties; @@ -198,15 +199,17 @@ type TSvnPropInfo = class private - FFiles: TFPObjectList; + FFiles: TFPHashObjectList; function GetFile(index: integer): TSvnFileProp; function GetFileCount: integer; + function ContainsFile(const AFileName: string) : boolean; public constructor Create; destructor Destroy; override; procedure LoadFromStream(s: TStream); procedure LoadFromFile(FileName: string); procedure LoadForFiles(FileNames: TStrings); + function GetFileItem(const s: string): TSvnFileProp; property FileItem[index: integer]: TSvnFileProp read GetFile; default; property FileCount: integer read GetFileCount; end; @@ -561,6 +564,12 @@ begin FProperties := TStringList.Create; end; +constructor TSvnFileProp.Create(const AFileName: string); +begin + Create; + FFileName := AFileName; +end; + destructor TSvnFileProp.Destroy; begin FProperties.Free; @@ -579,9 +588,14 @@ begin Result := FFiles.Count; end; +function TSvnPropInfo.ContainsFile(const AFileName: string): boolean; +begin + Result := true; +end; + constructor TSvnPropInfo.Create; begin - FFiles := TFPObjectList.Create(true); + FFiles := TFPHashObjectList.Create(true); end; destructor TSvnPropInfo.Destroy; @@ -609,11 +623,10 @@ begin while (i0) + AssertTrue('No XmlOutput', XmlOutput.Size>0) finally XmlOutput.Free; end;