From e65d1451599480377496693ccd772c2831a5f10d Mon Sep 17 00:00:00 2001 From: vsnijders Date: Fri, 11 Jan 2008 23:13:23 +0000 Subject: [PATCH] fpsvnsync: fixed setting svn:eolstyle on files that are not text/plain, needed for lazarus r13688. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@323 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- applications/fpsvnsync/fpsvnsync.lpi | 4 ++-- applications/fpsvnsync/fpsvnsync.lpr | 32 +++++++++++++++++++--------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/applications/fpsvnsync/fpsvnsync.lpi b/applications/fpsvnsync/fpsvnsync.lpi index 48e38b236..ac25155b1 100644 --- a/applications/fpsvnsync/fpsvnsync.lpi +++ b/applications/fpsvnsync/fpsvnsync.lpi @@ -26,10 +26,10 @@ - + - + diff --git a/applications/fpsvnsync/fpsvnsync.lpr b/applications/fpsvnsync/fpsvnsync.lpr index ea4b1a16f..e25f45b4a 100644 --- a/applications/fpsvnsync/fpsvnsync.lpr +++ b/applications/fpsvnsync/fpsvnsync.lpr @@ -204,7 +204,8 @@ var procedure CopyFileProp(SourceProp, DestProp: TSvnFileProp); var - j: integer; + j, pass: integer; + IsSvnEolProp: boolean; Command: string; begin if SourceProp.Properties.Text=DestProp.Properties.Text then exit; @@ -221,13 +222,21 @@ var writeln('svn ', Command); writeln('svn result: ', ExecuteSvnCommand(Command)); end; - for j:=0 to SourceProp.Properties.Count-1 do begin - Command := format('propset %s "%s" "%s"', - [SourceProp.Properties.Names[j], - SourceProp.Properties.ValueFromIndex[j], - DestProp.FileName]); - writeln('svn ', Command); - writeln('svn result: ', ExecuteSvnCommand(Command)); + // first pass set svn:eolstyle, later it might not be possible + // because of the mime style is non-text. + for pass := 1 to 2 do begin + for j:=0 to SourceProp.Properties.Count-1 do begin + IsSvnEolProp := SourceProp.Properties.Names[j]='svn:eol-style'; + if ((pass=1) and (IsSvnEolProp=true)) or + ((pass=2) and (IsSvnEolProp=false)) then begin + Command := format('propset %s "%s" "%s"', + [SourceProp.Properties.Names[j], + SourceProp.Properties.ValueFromIndex[j], + DestProp.FileName]); + writeln('svn ', Command); + writeln('svn result: ', ExecuteSvnCommand(Command)); + end; + end; end; end; @@ -309,8 +318,11 @@ begin DestRoot := GetRepositoryRoot(FDestWC); writeln('------'); - except - halt(9); + except on E: Exception do + begin + writeln(E.Message); + halt(9); + end; end; XmlOutput := TMemoryStream.Create;