mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-26 22:11:54 +01: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;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
filename, line, date, lastdate, revision : string;
|
filename, fileurl, line, date, lastdate,
|
||||||
|
revision, oldrevstring, olddate : string;
|
||||||
f : text;
|
f : text;
|
||||||
p : longint;
|
p, io : longint;
|
||||||
rev,lastrev : longint;
|
rev, lastrev, oldrev : longint;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if paramcount<>1 then
|
if paramcount<>1 then
|
||||||
@ -29,9 +30,10 @@ begin
|
|||||||
{$i-}
|
{$i-}
|
||||||
assign(f,filename);
|
assign(f,filename);
|
||||||
reset(f);
|
reset(f);
|
||||||
if ioresult<>0 then
|
io:=ioresult;
|
||||||
|
if io<>0 then
|
||||||
begin
|
begin
|
||||||
Writeln('Unable to open ',filename,' for reading');
|
Writeln('Unable to open ',filename,' for reading, io=',io);
|
||||||
halt(2);
|
halt(2);
|
||||||
end;
|
end;
|
||||||
lastrev:=0;
|
lastrev:=0;
|
||||||
@ -39,6 +41,12 @@ begin
|
|||||||
while not eof(f) do
|
while not eof(f) do
|
||||||
begin
|
begin
|
||||||
readln(f,line);
|
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);
|
p:=pos('Last Changed Date: ',line);
|
||||||
if p>0 then
|
if p>0 then
|
||||||
begin
|
begin
|
||||||
@ -62,9 +70,46 @@ begin
|
|||||||
end;
|
end;
|
||||||
close(f);
|
close(f);
|
||||||
assign(f,'revision.inc');
|
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,'''');
|
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
|
begin
|
||||||
Writeln('Error opening revision.inc for writing');
|
Writeln('Error opening revision.inc for writing');
|
||||||
halt(3);
|
halt(3);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user