mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-24 06:01:34 +02:00
Improve revision.inc regeneration program
git-svn-id: trunk@23994 -
This commit is contained in:
parent
64bc09ae58
commit
402e2bbe0e
@ -17,10 +17,11 @@ begin
|
||||
end;
|
||||
|
||||
var
|
||||
filename, line, date, lastdate, revision : string;
|
||||
filename, fileurl, line, date, lastdate,
|
||||
revision, oldrevstring, olddate : string;
|
||||
f : text;
|
||||
p : longint;
|
||||
rev,lastrev : longint;
|
||||
p, io : longint;
|
||||
rev, lastrev, oldrev : longint;
|
||||
|
||||
begin
|
||||
if paramcount<>1 then
|
||||
@ -29,9 +30,10 @@ begin
|
||||
{$i-}
|
||||
assign(f,filename);
|
||||
reset(f);
|
||||
if ioresult<>0 then
|
||||
io:=ioresult;
|
||||
if io<>0 then
|
||||
begin
|
||||
Writeln('Unable to open ',filename,' for reading');
|
||||
Writeln('Unable to open ',filename,' for reading, io=',io);
|
||||
halt(2);
|
||||
end;
|
||||
lastrev:=0;
|
||||
@ -39,6 +41,12 @@ begin
|
||||
while not eof(f) do
|
||||
begin
|
||||
readln(f,line);
|
||||
p:=pos('URL: ',line);
|
||||
if p>0 then
|
||||
begin
|
||||
fileurl:=copy(line,p+length('URL: '),length(line));
|
||||
writeln('fileurl=',fileurl);
|
||||
end;
|
||||
p:=pos('Last Changed Date: ',line);
|
||||
if p>0 then
|
||||
begin
|
||||
@ -62,9 +70,46 @@ begin
|
||||
end;
|
||||
close(f);
|
||||
assign(f,'revision.inc');
|
||||
rewrite(f);
|
||||
io:=ioresult;
|
||||
reset(f);
|
||||
io:=ioresult;
|
||||
if io<>0 then
|
||||
begin
|
||||
Writeln('revision.inc reset failed, io=',io);
|
||||
end
|
||||
else
|
||||
begin
|
||||
readln(f,oldrevstring);
|
||||
close(f);
|
||||
writeln('oldrevstring ',oldrevstring);
|
||||
if oldrevstring[1]='''' then
|
||||
oldrevstring:=copy(oldrevstring,2,length(oldrevstring));
|
||||
p:=length(oldrevstring);
|
||||
if oldrevstring[p]='''' then
|
||||
oldrevstring:=copy(oldrevstring,1,p-1);
|
||||
p:=pos(' rev ',oldrevstring);
|
||||
if p>0 then
|
||||
begin
|
||||
val(copy(oldrevstring,p+5,length(oldrevstring)),oldrev);
|
||||
olddate:=copy(oldrevstring,1,p-1);
|
||||
Writeln('Old values ',olddate,' ',oldrev);
|
||||
if (olddate >= lastdate) and (oldrev >= lastrev) then
|
||||
begin
|
||||
Writeln('New values ',lastdate,' ',lastrev);
|
||||
Writeln('Keeing old values');
|
||||
lastrev:=oldrev;
|
||||
lastdate:=olddate;
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
Writeln('revision.inc set to ''',lastdate,' rev ',lastrev,'''');
|
||||
if ioresult <> 0 then
|
||||
|
||||
assign(f,'revision.inc');
|
||||
rewrite(f);
|
||||
io:=ioresult;
|
||||
if io <> 0 then
|
||||
begin
|
||||
Writeln('Error opening revision.inc for writing');
|
||||
halt(3);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user