Changeset 4 for trunk/USubversion.pas


Ignore:
Timestamp:
Mar 2, 2022, 11:00:51 PM (3 years ago)
Author:
chronos
Message:
  • Modified: Generalized svn info parsing.
  • Added: Language files for translation of text strings.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore set to
      lib
      svnzero
      svnzero.dbg
      SVNZero.lps
      heaptrclog.trc
  • trunk/USubversion.pas

    r3 r4  
    1010
    1111type
     12  TSubversionInfo = record
     13    Checksum: string;
     14    Revision: string;
     15    URL: string;
     16    Path: string;
     17  end;
    1218
    1319  { TExecute }
     
    2127    procedure Execute(Parameters: array of string); virtual;
    2228    procedure ExecuteOutput(Parameters: array of string);
     29    function GetInfo(Text: string): TSubversionInfo;
    2330  end;
    2431
     
    97104end;
    98105
     106function TExecute.GetInfo(Text: string): TSubversionInfo;
     107var
     108  Index: Integer;
     109  Lines: TStringList;
     110  I: Integer;
     111  Line: string;
     112  Name: string;
     113  Value: string;
     114begin
     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;
     133end;
     134
    99135{ TSubversionAdmin }
    100136
Note: See TracChangeset for help on using the changeset viewer.