Changeset 8


Ignore:
Timestamp:
May 18, 2015, 12:15:30 AM (9 years ago)
Author:
chronos
Message:
  • Added: Checkout form and ability to checkout new working copy.
Location:
trunk
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormBrowse.lfm

    r7 r8  
    77  ClientHeight = 526
    88  ClientWidth = 722
     9  OnCreate = FormCreate
     10  OnDestroy = FormDestroy
    911  LCLVersion = '1.5'
    1012  object TreeView1: TTreeView
  • trunk/Forms/UFormBrowse.pas

    r7 r8  
    3333    procedure ADeleteExecute(Sender: TObject);
    3434    procedure AOpenExecute(Sender: TObject);
     35    procedure FormCreate(Sender: TObject);
     36    procedure FormDestroy(Sender: TObject);
    3537    procedure ListView1Data(Sender: TObject; Item: TListItem);
    3638    procedure ListView1DblClick(Sender: TObject);
     
    8385end;
    8486
     87procedure TFormBrowse.FormCreate(Sender: TObject);
     88begin
     89  FileList := TStringList.Create;
     90end;
     91
     92procedure TFormBrowse.FormDestroy(Sender: TObject);
     93begin
     94  FileList.Free;
     95end;
     96
    8597procedure TFormBrowse.ReloadList;
    8698var
    8799  FindFile: TFindFile;
     100  FoundFileList: TStrings;
    88101  I: Integer;
    89102begin
    90   FindFile := TFindFile.Create(nil);
    91   FindFile.Path := Directory;
    92   FindFile.FileMask := AllFilesMask;
    93   FindFile.InSubFolders := False;
    94   FileList := FindFile.SearchForFiles;
    95   for I := FileList.Count - 1 downto 0 do
    96     if ExtractFileName(FileList[I]) = '.' then FileList.Delete(I);
    97   FileList.Sort;
    98   ListView1.Items.Count := FileList.Count;
     103  if DirectoryExistsUTF8(Directory) then begin
     104    FindFile := TFindFile.Create(nil);
     105    try
     106      FindFile.Path := Directory;
     107      FindFile.FileMask := AllFilesMask;
     108      FindFile.InSubFolders := False;
     109      FoundFileList := FindFile.SearchForFiles;
     110      FileList.Assign(FoundFileList);
     111      for I := FileList.Count - 1 downto 0 do
     112        if ExtractFileName(FileList[I]) = '.' then FileList.Delete(I);
     113      FileList.Sort;
     114      ListView1.Items.Count := FileList.Count;
     115    finally
     116      FindFile.Free;
     117    end;
     118  end else ListView1.Items.Count := 0;
    99119  ListView1.Refresh;
    100120end;
  • trunk/Forms/UFormConsole.lfm

    r6 r8  
    3939  object EditCommand: TEdit
    4040    Left = 4
    41     Height = 32
     41    Height = 35
    4242    Top = 7
    4343    Width = 884
  • trunk/Forms/UFormConsole.pas

    r6 r8  
    9292  Line: string;
    9393  CommandLine: string;
     94  I: Integer;
    9495begin
    9596  Text := '';
     
    104105      Process.Environment.Text := Environment;
    105106    Environment := '';
    106     //Process.Executable := Executable;
    107     //Process.Parameters.Assign(Parameters);
    108     Process.CommandLine := Executable + ' ' + Parameters.Text;
     107    Process.Executable := Executable;
     108    Process.Parameters.Assign(Parameters);
     109    //for I := 0 to Process.Parameters.Count - 1 do
     110    //  ShowMessage('"' + Process.Parameters[I] + '"');
     111    //Process.CommandLine := Executable + ' checkout http://svn.zdechov.net/svn/xtactics /home/chronos/Smazat/svn3';
     112    //Process.Parameters.Clear;
     113    //Process.Parameters.Add('checkout');
     114    //Process.Parameters.Add('http://svn.zdechov.net/svn/xtactics');
     115    //Process.Parameters.Add('/home/chronos/Smazat/svn3');
     116    //Process.Parameters.Add('checkout');
     117    //Process.Parameters.Add('dasd');;
     118    //Process.CommandLine := Executable + ' ' + Parameters.Text;
    109119    CommandLine := Executable + ' ' + StringReplace(Parameters.Text, LineEnding, ' ', [rfReplaceAll]);
    110120    if CommandLine[Length(CommandLine)] = LineEnding then
  • trunk/Forms/UFormMain.lfm

    r6 r8  
    55  Width = 667
    66  Caption = 'VCSCommander'
    7   ClientHeight = 471
     7  ClientHeight = 468
    88  ClientWidth = 667
    99  Menu = MainMenu1
     
    2525  object StatusBar1: TStatusBar
    2626    Left = 0
    27     Height = 26
    28     Top = 445
     27    Height = 29
     28    Top = 439
    2929    Width = 667
    3030    Panels = <>
     
    3535    object MenuItemFile: TMenuItem
    3636      Caption = 'File'
     37      object MenuItem17: TMenuItem
     38        Action = Core.AProjectCheckout
     39      end
    3740      object MenuItem8: TMenuItem
    3841        Action = Core.AProjectOpen
     
    6871        Action = Core.ACommandCleanup
    6972      end
    70       object MenuItem15: TMenuItem
    71         Action = Core.ACommandCheckout
    72       end
    7373      object MenuItem16: TMenuItem
    7474        Action = Core.ACommandStatus
  • trunk/Forms/UFormMain.pas

    r6 r8  
    2121    MenuItem13: TMenuItem;
    2222    MenuItem14: TMenuItem;
    23     MenuItem15: TMenuItem;
    2423    MenuItem16: TMenuItem;
     24    MenuItem17: TMenuItem;
    2525    MenuItemOpenRecent: TMenuItem;
    2626    MenuItem2: TMenuItem;
  • trunk/UCore.lfm

    r7 r8  
    33  OnDestroy = DataModuleDestroy
    44  OldCreateOrder = False
    5   Height = 346
    6   HorizontalOffset = 482
    7   VerticalOffset = 265
    8   Width = 447
     5  Height = 435
     6  HorizontalOffset = 539
     7  VerticalOffset = 195
     8  Width = 693
    99  object ActionList1: TActionList
    1010    left = 260
     
    4545      OnExecute = ACommandCleanupExecute
    4646    end
    47     object ACommandCheckout: TAction
    48       Caption = 'Checkout'
    49       OnExecute = ACommandCheckoutExecute
    50     end
    5147    object ACommandCommit: TAction
    5248      Caption = 'Commit'
     
    5652      Caption = 'Status'
    5753    end
    58     object Action1: TAction
    59       Caption = 'Action1'
     54    object AProjectCheckout: TAction
     55      Caption = 'Checkout...'
     56      OnExecute = AProjectCheckoutExecute
    6057    end
    6158  end
     
    8178    top = 168
    8279  end
     80  object LastOpenedListRepoURL: TLastOpenedList
     81    MaxCount = 10
     82    left = 96
     83    top = 240
     84  end
     85  object LastOpenedListNewDir: TLastOpenedList
     86    MaxCount = 10
     87    left = 465
     88    top = 302
     89  end
    8390end
  • trunk/UCore.pas

    r7 r8  
    1717    ACommandUpdate: TAction;
    1818    ACommandCleanup: TAction;
    19     ACommandCheckout: TAction;
    2019    ACommandCommit: TAction;
    2120    ACommandStatus: TAction;
    22     Action1: TAction;
     21    AProjectCheckout: TAction;
    2322    AProjectClose: TAction;
    2423    ActionList1: TActionList;
     
    3029    ImageList1: TImageList;
    3130    LastOpenedList1: TLastOpenedList;
     31    LastOpenedListNewDir: TLastOpenedList;
     32    LastOpenedListRepoURL: TLastOpenedList;
    3233    OpenDialog1: TOpenDialog;
    3334    XMLConfig1: TXMLConfig;
     
    3637    procedure ACommandCommitExecute(Sender: TObject);
    3738    procedure ACommandUpdateExecute(Sender: TObject);
     39    procedure AProjectCheckoutExecute(Sender: TObject);
    3840    procedure AProjectCloseExecute(Sender: TObject);
    3941    procedure AProjectOpenExecute(Sender: TObject);
     
    6264
    6365uses
    64   UFormMain, UFormBrowse, UFormSettings, UFormCommit;
     66  UFormMain, UFormBrowse, UFormSettings, UFormCommit, UFormCheckout;
    6567
    6668{ TCore }
     
    100102begin
    101103  LastOpenedList1.LoadFromXMLConfig(XMLConfig1, 'LastOpenedProjects');
     104  LastOpenedListRepoURL.LoadFromXMLConfig(XMLConfig1, 'LastOpenedRepoURL');
     105  LastOpenedListNewDir.LoadFromXMLConfig(XMLConfig1, 'LastOpenedNewDir');
    102106end;
    103107
     
    105109begin
    106110  LastOpenedList1.SaveToXMLConfig(XMLConfig1, 'LastOpenedProjects');
     111  LastOpenedListRepoURL.SaveToXMLConfig(XMLConfig1, 'LastOpenedRepoURL');
     112  LastOpenedListNewDir.SaveToXMLConfig(XMLConfig1, 'LastOpenedNewDir');
    107113end;
    108114
     
    146152begin
    147153  FreeAndNil(Project);
     154  FormBrowse.Directory := '';
     155  FormBrowse.ReloadList;
    148156  UpdateInterface;
    149157end;
     
    154162end;
    155163
     164procedure TCore.AProjectCheckoutExecute(Sender: TObject);
     165var
     166  TempProject: TProject;
     167begin
     168  if LastOpenedListRepoURL.Items.Count > 0 then
     169    FormCheckout.EditURL.Text := LastOpenedListRepoURL.Items[0];
     170  if LastOpenedListNewDir.Items.Count > 0 then
     171    FormCheckout.EditDir.Text := LastOpenedListNewDir.Items[0];
     172  if FormCheckout.ShowModal = mrOk then begin
     173    LastOpenedListRepoURL.AddItem(FormCheckout.EditURL.Text);
     174    LastOpenedListNewDir.AddItem(FormCheckout.EditDir.Text);
     175    TempProject := TProject.Create;
     176    try
     177      TempProject.VCSType := vtSubversion;
     178      TempProject.Directory := FormCheckout.EditDir.Text;
     179      TempProject.RepositoryURL := FormCheckout.EditURL.Text;
     180      TempProject.WorkingCopy.Checkout;
     181    finally
     182      TempProject.Free;
     183    end;
     184    ProjectOpen(FormCheckout.EditDir.Text);
     185  end;
     186end;
     187
    156188procedure TCore.ACommandCleanupExecute(Sender: TObject);
    157189begin
    158   Project.WorkingCopy.CleanUp;
     190  Project.WorkingCopy.Cleanup;
    159191end;
    160192
    161193procedure TCore.ACommandCheckoutExecute(Sender: TObject);
    162194begin
    163   Project.WorkingCopy.Checkout;
     195
    164196end;
    165197
  • trunk/Units/UProject.pas

    r4 r8  
    1818    FVCSType: TVCSType;
    1919    function GetDirectory: string;
     20    function GetRepositoryURL: string;
    2021    procedure SetDirectory(AValue: string);
     22    procedure SetRepositoryURL(AValue: string);
    2123    procedure SetVCSType(AValue: TVCSType);
    2224  public
     
    2729    property VCSType: TVCSType read FVCSType write SetVCSType;
    2830    property Directory: string read GetDirectory write SetDirectory;
     31    property RepositoryURL: string read GetRepositoryURL write SetRepositoryURL;
    2932  end;
    3033
     
    4144  if FVCSType = AValue then Exit;
    4245  FVCSType := AValue;
    43   WorkingCopy.Free;
     46  FreeAndNil(WorkingCopy);
    4447  case AValue of
    4548    vtSubversion: WorkingCopy := TSubversion.Create;
     
    5356end;
    5457
     58function TProject.GetRepositoryURL: string;
     59begin
     60  Result := WorkingCopy.RepositoryURL;
     61end;
     62
    5563procedure TProject.SetDirectory(AValue: string);
    5664begin
    5765  WorkingCopy.Path := AValue;
     66end;
     67
     68procedure TProject.SetRepositoryURL(AValue: string);
     69begin
     70  WorkingCopy.RepositoryURL := AValue;
    5871end;
    5972
  • trunk/Units/USubversion.pas

    r7 r8  
    3535  try
    3636    Params.AddStrings(Parameters);
    37     ExecuteProcess('svn', Params);
     37    ExecuteProcess('/usr/bin/svn', Params);
    3838  finally
    3939    Params.Free;
     
    4343procedure TSubversion.Checkout;
    4444begin
    45   Execute(['checkout']);
     45  Execute(['checkout', RepositoryURL, Path]);
    4646end;
    4747
  • trunk/Units/UVCS.pas

    r7 r8  
    66
    77uses
    8   Classes, SysUtils;
     8  Classes, SysUtils, FileUtil;
    99
    1010type
     
    1515  private
    1616    FPath: string;
     17    FRepositoryURL: string;
    1718    procedure SetPath(AValue: string);
     19    procedure SetRepositoryURL(AValue: string);
    1820  protected
    1921    procedure ExecuteProcess(Command: string; Parameters: TStrings); virtual;
     
    2628    procedure Merge; virtual;
    2729    procedure Refresh; virtual;
     30    property RepositoryURL: string read FRepositoryURL write SetRepositoryURL;
    2831    property Path: string read FPath write SetPath;
    2932  end;
     
    4851end;
    4952
     53procedure TWorkingCopy.SetRepositoryURL(AValue: string);
     54begin
     55  if FRepositoryURL=AValue then Exit;
     56  FRepositoryURL:=AValue;
     57end;
     58
    5059procedure TWorkingCopy.ExecuteProcess(Command: string; Parameters: TStrings);
    5160begin
    5261  FormConsole.Executable := Command;
    5362  FormConsole.Parameters.Assign(Parameters);
    54   FormConsole.WorkingDir := Path;
     63  if DirectoryExistsUTF8(Path) then FormConsole.WorkingDir := Path
     64    else FormConsole.WorkingDir := '';
    5565  FormConsole.ShowModal;
    5666end;
  • trunk/VCSCommander.lpi

    r7 r8  
    8383      </Item4>
    8484    </RequiredPackages>
    85     <Units Count="11">
     85    <Units Count="12">
    8686      <Unit0>
    8787        <Filename Value="VCSCommander.lpr"/>
     
    149149        <ResourceBaseClass Value="Form"/>
    150150      </Unit10>
     151      <Unit11>
     152        <Filename Value="Forms/UFormCheckout.pas"/>
     153        <IsPartOfProject Value="True"/>
     154        <ComponentName Value="FormCheckout"/>
     155        <HasResources Value="True"/>
     156        <ResourceBaseClass Value="Form"/>
     157      </Unit11>
    151158    </Units>
    152159  </ProjectOptions>
     
    165172        <SyntaxMode Value="Delphi"/>
    166173        <CStyleOperator Value="False"/>
     174        <IncludeAssertionCode Value="True"/>
    167175        <AllowLabel Value="False"/>
    168176        <CPPInline Value="False"/>
     
    176184        <StackChecks Value="True"/>
    177185      </Checks>
     186      <VerifyObjMethodCallValidity Value="True"/>
    178187    </CodeGeneration>
    179188    <Linking>
     
    187196      </Options>
    188197    </Linking>
     198    <Other>
     199      <CustomOptions Value="-dDEBUG"/>
     200    </Other>
    189201  </CompilerOptions>
    190202  <Debugging>
  • trunk/VCSCommander.lpr

    r7 r8  
    99  Interfaces, // this includes the LCL widgetset
    1010  Forms, UFormMain, UCore, Common, TemplateGenerics, UFormBrowse, UVCS,
    11   UFormFavorites, UFormSettings, UFormConsole, USubversion, UProject,
    12 UFormCommit
     11  UFormFavorites, UFormSettings, UFormConsole, USubversion, UProject, SysUtils,
     12  UFormCommit, UFormCheckout
    1313  { you can add units after this };
    1414
    1515{$R *.res}
    1616
     17{$IFDEF DEBUG}
     18const
     19  HeapTraceLog = 'heaptrclog.trc';
     20{$ENDIF}
     21
     22
    1723begin
     24  {$IFDEF DEBUG}
     25  // Heap trace
     26  DeleteFile(ExtractFilePath(ParamStr(0)) + HeapTraceLog);
     27  SetHeapTraceOutput(ExtractFilePath(ParamStr(0)) + HeapTraceLog);
     28  {$ENDIF}
     29
    1830  RequireDerivedFormResource := True;
    1931  Application.Initialize;
     
    2537  Application.CreateForm(TFormConsole, FormConsole);
    2638  Application.CreateForm(TFormCommit, FormCommit);
     39  Application.CreateForm(TFormCheckout, FormCheckout);
    2740  Application.Run;
    2841end.
Note: See TracChangeset for help on using the changeset viewer.