From 1249b16f7076a083b090be4f679d46f9fe60839a Mon Sep 17 00:00:00 2001 From: vsnijders Date: Tue, 23 Dec 2008 14:48:32 +0000 Subject: [PATCH] fpsvnsync: another fix for using revision in svn copy command git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@643 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- applications/fpsvnsync/fpsvnsync.lpr | 42 ++++++++++++++++------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/applications/fpsvnsync/fpsvnsync.lpr b/applications/fpsvnsync/fpsvnsync.lpr index 2e1ff2c8a..0a5c8a647 100644 --- a/applications/fpsvnsync/fpsvnsync.lpr +++ b/applications/fpsvnsync/fpsvnsync.lpr @@ -32,7 +32,7 @@ uses Classes, SysUtils, CustApp, FileUtil, SvnClasses, SvnCommand; - + type { TSvnMirrorApp } @@ -78,7 +78,7 @@ var SvnLog: TSvnLog; SubPath: string; DestRoot: string; - + procedure GetLog; var Command: string; @@ -90,7 +90,7 @@ var SubPath := SvnLog.LogEntry[0].CommonPath; writeln('Finding common path from log messages: ', SubPath); end; - + procedure UpdateWC(const WorkingDir, SubPath: string; Revision: integer); var Command: string; @@ -130,7 +130,7 @@ var end; Diff.Free; end; - + procedure DeleteFiles; var LogEntry: TLogEntry; @@ -163,9 +163,15 @@ var if LogPath.Action in [caModify, caAdd] then begin SourceFile := FSourceWC + LogPath.Path; if LogPath.CopyFromPath<>'' then begin - Command := format('copy "%1:s%2:s@%0:d" "%3:s"', - [LogPath.CopyFromRevision, - DestRoot, LogPath.CopyFromPath, DestFile]); + if ExtractFileName(LogPath.CopyFromPath)=ExtractFileName(DestFile) then + // to prevent that svn complains that the target is not a directory + Command := format('copy "%1:s%2:s@%0:d" "%3:s"', + [LogPath.CopyFromRevision, DestRoot, LogPath.CopyFromPath, + ExtractFileDir(DestFile)]) + else + Command := format('copy "%1:s%2:s@%0:d" "%3:s"', + [LogPath.CopyFromRevision, DestRoot, + LogPath.CopyFromPath, DestFile]); writeln('svn '+ Command); ExecuteSvnCommand(Command); end; @@ -182,7 +188,7 @@ var end; end; end; - + procedure ApplyPropChanges; var Files: TStrings; @@ -201,7 +207,7 @@ var Result.LoadForFiles(Files); Files.Free; end; - + procedure CopyFileProp(SourceProp, DestProp: TSvnFileProp); var j, pass: integer; @@ -209,7 +215,7 @@ var Command: string; begin if SourceProp.Properties.Text=DestProp.Properties.Text then exit; - + writeln('Properties changed for ', DestProp.FileName); writeln('Source properties'); writeln(SourceProp.Properties.Text); @@ -229,7 +235,7 @@ var // if there is no value, don't set the property if (SourceProp.Properties.ValueFromIndex[j]='') then continue; - + IsSvnEolProp := SourceProp.Properties.Names[j]='svn:eol-style'; if ((pass=1) and (IsSvnEolProp=true)) or ((pass=2) and (IsSvnEolProp=false)) then begin @@ -243,7 +249,7 @@ var end; end; end; - + begin SourcePropInfo := CreatePropInfo(FSourceWC); DestPropInfo := CreatePropInfo(FDestWC); @@ -268,7 +274,7 @@ var for i := 0 to Files.Count-1 do begin SourceFileName := FSourceWC + Files[i]; DestFileName := FDestWC + Files[i]; - SourceFileProp := SourcePropInfo.GetFileItem(SourceFileName); + SourceFileProp := SourcePropInfo.GetFileItem(SourceFileName); DestFileProp := DestPropInfo.GetFileItem(DestFileName); if SourceFileProp=nil then begin @@ -283,12 +289,12 @@ var CopyFileProp(SourceFileProp, DestFileProp); end; - + Files.Free; SourcePropInfo.Free; DestPropInfo.Free; end; - + procedure CommitChanges; var Command: string; @@ -311,7 +317,7 @@ var writeln('svn commit result: ', ExecuteSvnCommand(Command)); DeleteFile(MessageFile); end; - + begin try SourceHead := GetRevision('-rHEAD '+FSourceWC); @@ -333,9 +339,9 @@ begin SvnLog := TSvnLog.Create; while (Revision