You've already forked lazarus-ccr
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
This commit is contained in:
@ -32,7 +32,7 @@ uses
|
|||||||
Classes, SysUtils, CustApp,
|
Classes, SysUtils, CustApp,
|
||||||
FileUtil,
|
FileUtil,
|
||||||
SvnClasses, SvnCommand;
|
SvnClasses, SvnCommand;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TSvnMirrorApp }
|
{ TSvnMirrorApp }
|
||||||
@ -78,7 +78,7 @@ var
|
|||||||
SvnLog: TSvnLog;
|
SvnLog: TSvnLog;
|
||||||
SubPath: string;
|
SubPath: string;
|
||||||
DestRoot: string;
|
DestRoot: string;
|
||||||
|
|
||||||
procedure GetLog;
|
procedure GetLog;
|
||||||
var
|
var
|
||||||
Command: string;
|
Command: string;
|
||||||
@ -90,7 +90,7 @@ var
|
|||||||
SubPath := SvnLog.LogEntry[0].CommonPath;
|
SubPath := SvnLog.LogEntry[0].CommonPath;
|
||||||
writeln('Finding common path from log messages: ', SubPath);
|
writeln('Finding common path from log messages: ', SubPath);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure UpdateWC(const WorkingDir, SubPath: string; Revision: integer);
|
procedure UpdateWC(const WorkingDir, SubPath: string; Revision: integer);
|
||||||
var
|
var
|
||||||
Command: string;
|
Command: string;
|
||||||
@ -130,7 +130,7 @@ var
|
|||||||
end;
|
end;
|
||||||
Diff.Free;
|
Diff.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DeleteFiles;
|
procedure DeleteFiles;
|
||||||
var
|
var
|
||||||
LogEntry: TLogEntry;
|
LogEntry: TLogEntry;
|
||||||
@ -163,9 +163,15 @@ var
|
|||||||
if LogPath.Action in [caModify, caAdd] then begin
|
if LogPath.Action in [caModify, caAdd] then begin
|
||||||
SourceFile := FSourceWC + LogPath.Path;
|
SourceFile := FSourceWC + LogPath.Path;
|
||||||
if LogPath.CopyFromPath<>'' then begin
|
if LogPath.CopyFromPath<>'' then begin
|
||||||
Command := format('copy "%1:s%2:s@%0:d" "%3:s"',
|
if ExtractFileName(LogPath.CopyFromPath)=ExtractFileName(DestFile) then
|
||||||
[LogPath.CopyFromRevision,
|
// to prevent that svn complains that the target is not a directory
|
||||||
DestRoot, LogPath.CopyFromPath, DestFile]);
|
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);
|
writeln('svn '+ Command);
|
||||||
ExecuteSvnCommand(Command);
|
ExecuteSvnCommand(Command);
|
||||||
end;
|
end;
|
||||||
@ -182,7 +188,7 @@ var
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ApplyPropChanges;
|
procedure ApplyPropChanges;
|
||||||
var
|
var
|
||||||
Files: TStrings;
|
Files: TStrings;
|
||||||
@ -201,7 +207,7 @@ var
|
|||||||
Result.LoadForFiles(Files);
|
Result.LoadForFiles(Files);
|
||||||
Files.Free;
|
Files.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure CopyFileProp(SourceProp, DestProp: TSvnFileProp);
|
procedure CopyFileProp(SourceProp, DestProp: TSvnFileProp);
|
||||||
var
|
var
|
||||||
j, pass: integer;
|
j, pass: integer;
|
||||||
@ -209,7 +215,7 @@ var
|
|||||||
Command: string;
|
Command: string;
|
||||||
begin
|
begin
|
||||||
if SourceProp.Properties.Text=DestProp.Properties.Text then exit;
|
if SourceProp.Properties.Text=DestProp.Properties.Text then exit;
|
||||||
|
|
||||||
writeln('Properties changed for ', DestProp.FileName);
|
writeln('Properties changed for ', DestProp.FileName);
|
||||||
writeln('Source properties');
|
writeln('Source properties');
|
||||||
writeln(SourceProp.Properties.Text);
|
writeln(SourceProp.Properties.Text);
|
||||||
@ -229,7 +235,7 @@ var
|
|||||||
// if there is no value, don't set the property
|
// if there is no value, don't set the property
|
||||||
if (SourceProp.Properties.ValueFromIndex[j]='')
|
if (SourceProp.Properties.ValueFromIndex[j]='')
|
||||||
then continue;
|
then continue;
|
||||||
|
|
||||||
IsSvnEolProp := SourceProp.Properties.Names[j]='svn:eol-style';
|
IsSvnEolProp := SourceProp.Properties.Names[j]='svn:eol-style';
|
||||||
if ((pass=1) and (IsSvnEolProp=true)) or
|
if ((pass=1) and (IsSvnEolProp=true)) or
|
||||||
((pass=2) and (IsSvnEolProp=false)) then begin
|
((pass=2) and (IsSvnEolProp=false)) then begin
|
||||||
@ -243,7 +249,7 @@ var
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
SourcePropInfo := CreatePropInfo(FSourceWC);
|
SourcePropInfo := CreatePropInfo(FSourceWC);
|
||||||
DestPropInfo := CreatePropInfo(FDestWC);
|
DestPropInfo := CreatePropInfo(FDestWC);
|
||||||
@ -268,7 +274,7 @@ var
|
|||||||
for i := 0 to Files.Count-1 do begin
|
for i := 0 to Files.Count-1 do begin
|
||||||
SourceFileName := FSourceWC + Files[i];
|
SourceFileName := FSourceWC + Files[i];
|
||||||
DestFileName := FDestWC + Files[i];
|
DestFileName := FDestWC + Files[i];
|
||||||
SourceFileProp := SourcePropInfo.GetFileItem(SourceFileName);
|
SourceFileProp := SourcePropInfo.GetFileItem(SourceFileName);
|
||||||
DestFileProp := DestPropInfo.GetFileItem(DestFileName);
|
DestFileProp := DestPropInfo.GetFileItem(DestFileName);
|
||||||
|
|
||||||
if SourceFileProp=nil then begin
|
if SourceFileProp=nil then begin
|
||||||
@ -283,12 +289,12 @@ var
|
|||||||
|
|
||||||
CopyFileProp(SourceFileProp, DestFileProp);
|
CopyFileProp(SourceFileProp, DestFileProp);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Files.Free;
|
Files.Free;
|
||||||
SourcePropInfo.Free;
|
SourcePropInfo.Free;
|
||||||
DestPropInfo.Free;
|
DestPropInfo.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure CommitChanges;
|
procedure CommitChanges;
|
||||||
var
|
var
|
||||||
Command: string;
|
Command: string;
|
||||||
@ -311,7 +317,7 @@ var
|
|||||||
writeln('svn commit result: ', ExecuteSvnCommand(Command));
|
writeln('svn commit result: ', ExecuteSvnCommand(Command));
|
||||||
DeleteFile(MessageFile);
|
DeleteFile(MessageFile);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
try
|
try
|
||||||
SourceHead := GetRevision('-rHEAD '+FSourceWC);
|
SourceHead := GetRevision('-rHEAD '+FSourceWC);
|
||||||
@ -333,9 +339,9 @@ begin
|
|||||||
SvnLog := TSvnLog.Create;
|
SvnLog := TSvnLog.Create;
|
||||||
while (Revision<SourceHead) do begin
|
while (Revision<SourceHead) do begin
|
||||||
inc(Revision);
|
inc(Revision);
|
||||||
|
|
||||||
GetLog;
|
GetLog;
|
||||||
|
|
||||||
UpdateWC(FDestWC, SvnLog.LogEntry[0].CommonPath, Revision-1);
|
UpdateWC(FDestWC, SvnLog.LogEntry[0].CommonPath, Revision-1);
|
||||||
UpdateWC(FSourceWC, SvnLog.LogEntry[0].CommonPath, Revision);
|
UpdateWC(FSourceWC, SvnLog.LogEntry[0].CommonPath, Revision);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user