Changeset 23 for trunk/Units


Ignore:
Timestamp:
Apr 4, 2025, 9:22:05 AM (2 weeks ago)
Author:
chronos
Message:
  • Modified: All unit renamed to names without U prefix.
  • Modified: Removed global form variables.
  • Modified: Code cleanup.
Location:
trunk/Units
Files:
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/Units/Backend.pas

    r22 r23  
    1 unit UBackend;
     1unit Backend;
    22
    33interface
    44
    55uses
    6   Classes, SysUtils, UVCS;
     6  Classes, SysUtils, VCS;
    77
    88type
  • trunk/Units/Project.pas

    r22 r23  
    1 unit UProject;
     1unit Project;
    22
    33interface
    44
    55uses
    6   Classes, SysUtils, UVCS, UBackend, Contnrs, DOM, XMLRead, XMLWrite, XML,
    7   LazFileUtils;
     6  Classes, SysUtils, VCS, Backend, Generics.Collections, DOM, XMLRead, XMLWrite,
     7  XML, LazFileUtils;
    88
    99type
     
    3434  { TProjects }
    3535
    36   TProjects = class(TObjectList)
     36  TProjects = class(TObjectList<TProject>)
    3737    procedure LoadXMLNode(Node: TDOMNode);
    3838    procedure SaveXMLNode(Node: TDOMNode);
     
    8484end;
    8585
    86 
    8786{ TProjectGroup }
    8887
     
    9493destructor TProjectGroup.Destroy;
    9594begin
    96   Projects.Free;
    97   inherited Destroy;
     95  FreeAndNil(Projects);
     96  inherited;
    9897end;
    9998
     
    190189destructor TProject.Destroy;
    191190begin
    192   WorkingCopy.Free;
    193   Repository.Free;
    194   inherited Destroy;
     191  FreeAndNil(WorkingCopy);
     192  FreeAndNil(Repository);
     193  inherited;
    195194end;
    196195
  • trunk/Units/VCS.pas

    r22 r23  
    1 unit UVCS;
     1unit VCS;
    22
    33interface
    44
    55uses
    6   Classes, SysUtils, LazFileUtils, Contnrs;
     6  Classes, SysUtils, LazFileUtils, Generics.Collections;
    77
    88type
     
    2121  end;
    2222
    23   TLogList = class(TObjectList)
    24 
     23  TLogList = class(TObjectList<TLogItem>)
    2524  end;
    2625
     
    4039  { TFileStatusList }
    4140
    42   TFileStatusList = class(TObjectList)
     41  TFileStatusList = class(TObjectList<TFileStatus>)
    4342    function SearchByName(Name: string): TFileStatus;
    4443  end;
     
    102101
    103102uses
    104   UFormConsole;
     103  FormConsole;
    105104
    106105function URLFromDirectory(DirName: string; Relative: Boolean): string;
     
    138137procedure TRepository.ExecuteProcess(Command: string;
    139138  Parameters: array of string);
    140 begin
    141   FormConsole.Executable := Command;
    142   FormConsole.Parameters.Clear;
    143   FormConsole.Parameters.AddStrings(Parameters);
    144   if DirectoryExistsUTF8(Path) then FormConsole.WorkingDir := Path
    145     else FormConsole.WorkingDir := '';
    146   FormConsole.ShowModal;
    147   ExecutionOutput.Assign(FormConsole.Log);
     139var
     140  FormConsole: TFormConsole;
     141begin
     142  FormConsole := TFormConsole.Create(nil);
     143  try
     144    FormConsole.Executable := Command;
     145    FormConsole.Parameters.Clear;
     146    FormConsole.Parameters.AddStrings(Parameters);
     147    if DirectoryExistsUTF8(Path) then FormConsole.WorkingDir := Path
     148      else FormConsole.WorkingDir := '';
     149    FormConsole.ShowModal;
     150    ExecutionOutput.Assign(FormConsole.Log);
     151  finally
     152    FormConsole.Free;
     153  end;
    148154end;
    149155
     
    162168begin
    163169  FreeAndNil(ExecutionOutput);
    164   inherited Destroy;
     170  inherited;
    165171end;
    166172
     
    175181destructor TLogItem.Destroy;
    176182begin
    177   Messages.Free;
    178   ChangedFiles.Free;
    179   inherited Destroy;
     183  FreeAndNil(Messages);
     184  FreeAndNil(ChangedFiles);
     185  inherited;
    180186end;
    181187
     
    191197procedure TWorkingCopy.SetRepositoryURL(AValue: string);
    192198begin
    193   if FRepositoryURL=AValue then Exit;
    194   FRepositoryURL:=AValue;
     199  if FRepositoryURL = AValue then Exit;
     200  FRepositoryURL := AValue;
    195201end;
    196202
    197203procedure TWorkingCopy.ExecuteProcess(Command: string; Parameters: array of string);
    198 begin
    199   FormConsole.Executable := Command;
    200   FormConsole.EnvironmentVariables.Assign(EnvVars);
    201   FormConsole.Parameters.Clear;
    202   FormConsole.Parameters.AddStrings(Parameters);
    203   if DirectoryExistsUTF8(Path) then FormConsole.WorkingDir := Path
    204     else FormConsole.WorkingDir := '';
    205   if SilentExecution then FormConsole.Perform
    206     else FormConsole.ShowModal;
    207   ExecutionOutput.Assign(FormConsole.Log);
     204var
     205  FormConsole: TFormConsole;
     206begin
     207  FormConsole := TFormConsole.Create(nil);
     208  try
     209    FormConsole.Executable := Command;
     210    FormConsole.EnvironmentVariables.Assign(EnvVars);
     211    FormConsole.Parameters.Clear;
     212    FormConsole.Parameters.AddStrings(Parameters);
     213    if DirectoryExistsUTF8(Path) then FormConsole.WorkingDir := Path
     214      else FormConsole.WorkingDir := '';
     215    if SilentExecution then FormConsole.Perform
     216      else FormConsole.ShowModal;
     217    ExecutionOutput.Assign(FormConsole.Log);
     218  finally
     219    FormConsole.Free;
     220  end;
    208221end;
    209222
     
    286299  FreeAndNil(EnvVars);
    287300  FreeAndNil(ExecutionOutput);
    288   inherited Destroy;
     301  inherited;
    289302end;
    290303
Note: See TracChangeset for help on using the changeset viewer.