[fpc-pascal] Is there some example of an FPC program for use in svn hook calls (email)?

Bo Berglund bo.berglund at gmail.com
Thu Dec 14 20:27:28 CET 2017


On Thu, 14 Dec 2017 19:54:49 +0100, Bo Berglund
<bo.berglund at gmail.com> wrote:

>   if AProcess.RunCommand(Command, Parameters.Strings, sTmp) then
>   begin
>     SvnData.Text := sTmp);
>     Result := true;
>   end;
>

It works when this is changed to:
var
  Params: array of string;
  ...
begin
....
    SetLength(Params, Parameters.Count);
    for i := 0 to Parameters.Count-1 do
      Params[i] := Parameters[i];
    if RunCommand(Command, Params, sTmp) then
    begin
      SvnData.Text := sTmp;
      Result := true;
      writeln(SvnData.Text); <= Just for testing
    end;

But first I had to fix the real bug:

*** WHAT A STUPID MISTAKE! BANGING MY HEAD! ***
In the caller:

    Parms.Add('info');
    Parms.Add('-r');
    Parms.Add('REV');
    Parms.Add('REPOS_PATH');
    if GetSvnData(svncmd, Parms, DataBuf) then

The last two Parms.Add's are stupidly wrong. The quotes are leftovers
from when I had literals there as a first test. REV and REPOS_PATH are
*variables*! Removing the quotes is what it took to make it work....

But a good thing came out of this anyway because I was steered towards
the use of RunCommand(), which works just fine and simplifies the code
enormously!
Thanks for that!

-- 
Bo Berglund
Developer in Sweden




More information about the fpc-pascal mailing list