- Timestamp:
- Mar 2, 2022, 11:00:51 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:ignore
set to
lib
svnzero
svnzero.dbg
SVNZero.lps
heaptrclog.trc
-
Property svn:ignore
set to
-
trunk/Install/deb/build.sh
r2 r4 4 4 #ARCH=x86_64-linux 5 5 6 BUILD_ROOT=/tmp/build-root/ 20486 BUILD_ROOT=/tmp/build-root/SVNZero 7 7 mkdir -p $BUILD_ROOT 8 8 cp -r -f ../.. $BUILD_ROOT -
trunk/SVNZero.lpi
r3 r4 14 14 <ResourceType Value="res"/> 15 15 </General> 16 <i18n> 17 <EnableI18N Value="True"/> 18 <OutDir Value="Languages"/> 19 </i18n> 16 20 <BuildModes> 17 21 <Item Name="Debug" Default="True"/> -
trunk/USubversion.pas
r3 r4 10 10 11 11 type 12 TSubversionInfo = record 13 Checksum: string; 14 Revision: string; 15 URL: string; 16 Path: string; 17 end; 12 18 13 19 { TExecute } … … 21 27 procedure Execute(Parameters: array of string); virtual; 22 28 procedure ExecuteOutput(Parameters: array of string); 29 function GetInfo(Text: string): TSubversionInfo; 23 30 end; 24 31 … … 97 104 end; 98 105 106 function TExecute.GetInfo(Text: string): TSubversionInfo; 107 var 108 Index: Integer; 109 Lines: TStringList; 110 I: Integer; 111 Line: string; 112 Name: string; 113 Value: string; 114 begin 115 Lines := TStringList.Create; 116 try 117 Lines.Text := Text; 118 for I := 0 to Lines.Count - 1 do begin 119 Line := Trim(Lines[I]); 120 Index := Pos(':', Line); 121 if Index > 0 then begin 122 Name := Trim(Copy(Line, 1, Index - 1)); 123 Value := Trim(Copy(Line, Index + 1, MaxInt)); 124 if Name = 'Checksum' then Result.Checksum := Value 125 else if Name = 'Revision' then Result.Revision := Value 126 else if Name = 'Path' then Result.Path := Value 127 else if Name = 'URL' then Result.URL := Value; 128 end; 129 end; 130 finally 131 Lines.Free; 132 end; 133 end; 134 99 135 { TSubversionAdmin } 100 136 -
trunk/USvnZero.pas
r3 r4 21 21 procedure ZeroPristine; 22 22 procedure RestorePristine; 23 function GetFileChecksum(Text: string): string;24 function GetFileRevision(Text: string): string;25 function GetFileURL(Text: string): string;26 23 function GetWorkingCopyRootPathFromText(Text: string): string; 27 24 function GetSvnDir(FileName: string): string; … … 81 78 procedure TSvnZero.RestorePristine; 82 79 begin 83 84 end;85 86 function TSvnZero.GetFileChecksum(Text: string): string;87 var88 Index: Integer;89 const90 StartText = 'Checksum: ';91 begin92 Index := Pos(StartText, Text);93 if Index > 0 then begin94 Result := Copy(Text, Index + Length(StartText), MaxInt);95 Index := Pos(LineEnding, Result);96 if Index > 0 then begin97 Delete(Result, Index, MaxInt);98 end;99 end;100 end;101 102 function TSvnZero.GetFileRevision(Text: string): string;103 var104 Index: Integer;105 const106 StartText = 'Revision: ';107 begin108 Index := Pos(StartText, Text);109 if Index > 0 then begin110 Result := Copy(Text, Index + Length(StartText), MaxInt);111 Index := Pos(LineEnding, Result);112 if Index > 0 then begin113 Delete(Result, Index, MaxInt);114 end;115 end;116 end;117 118 function TSvnZero.GetFileURL(Text: string): string;119 var120 Index: Integer;121 const122 StartText = 'URL: ';123 begin124 Index := Pos(StartText, Text);125 if Index > 0 then begin126 Result := Copy(Text, Index + Length(StartText), MaxInt);127 Index := Pos(LineEnding, Result);128 if Index > 0 then begin129 Delete(Result, Index, MaxInt);130 end;131 end;132 80 end; 133 81 … … 226 174 var 227 175 FileName: string; 228 FileChecksum: string;229 176 I: Integer; 230 177 ExportedFileName: string; 231 178 PristineFileName: string; 232 FileURL: string; 233 Revision: string; 179 Info: TSubversionInfo; 234 180 begin 235 181 Result := False; … … 243 189 244 190 Subversion.Execute(['info', FileName]); 245 FileChecksum := GetFileChecksum(Subversion.StandardOutput); 246 Revision := GetFileRevision(Subversion.StandardOutput); 247 FileURL := GetFileURL(Subversion.StandardOutput); 191 Info := GetInfo(Subversion.StandardOutput); 248 192 ExportedFileName := GetSvnDir(FileName) + DirectorySeparator + 'tmp' + 249 193 DirectorySeparator + 'ExportedFile.bin'; 250 PristineFileName := GetPristineDir(FileName) + DirectorySeparator + Copy( FileChecksum, 1, 2) +251 DirectorySeparator + FileChecksum + '.svn-base';252 Subversion.Execute(['export', '-r', Revision, '--force', FileURL, ExportedFileName]);194 PristineFileName := GetPristineDir(FileName) + DirectorySeparator + Copy(Info.Checksum, 1, 2) + 195 DirectorySeparator + Info.Checksum + '.svn-base'; 196 Subversion.Execute(['export', '-r', Info.Revision, '--force', Info.URL, ExportedFileName]); 253 197 MakeFileWriteable(PristineFileName); 254 198 CopyFile(ExportedFileName, PristineFileName);
Note:
See TracChangeset
for help on using the changeset viewer.