Changeset 9
- Timestamp:
- May 18, 2015, 11:49:39 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormCheckout.lfm
r8 r9 1 1 object FormCheckout: TFormCheckout 2 2 Left = 833 3 Height = 3773 Height = 417 4 4 Top = 345 5 Width = 8 265 Width = 834 6 6 Caption = 'Checkout' 7 ClientHeight = 377 8 ClientWidth = 826 7 ClientHeight = 417 8 ClientWidth = 834 9 OnShow = FormShow 9 10 LCLVersion = '1.5' 10 11 object GroupBox1: TGroupBox 11 12 Left = 8 12 Height = 18413 Height = 232 13 14 Top = 8 14 Width = 81 015 Width = 818 15 16 Align = alTop 16 17 BorderSpacing.Around = 8 17 18 Caption = 'Repository' 18 ClientHeight = 15719 ClientWidth = 8 0619 ClientHeight = 205 20 ClientWidth = 814 20 21 TabOrder = 0 21 22 object Label1: TLabel 22 23 Left = 8 23 24 Height = 25 24 Top = 1625 Top = 64 25 26 Width = 166 26 27 Caption = 'URL of repository:' … … 30 31 Left = 8 31 32 Height = 35 32 Top = 4833 Width = 7 8733 Top = 96 34 Width = 795 34 35 Anchors = [akTop, akLeft, akRight] 35 36 TabOrder = 0 … … 38 39 Left = 8 39 40 Height = 25 40 Top = 8841 Top = 136 41 42 Width = 181 42 43 Caption = 'Checkout directory:' … … 46 47 Left = 8 47 48 Height = 35 48 Top = 1 2049 Width = 73 149 Top = 168 50 Width = 739 50 51 Anchors = [akTop, akLeft, akRight] 51 52 TabOrder = 1 52 53 end 53 54 object Button1: TButton 54 Left = 7 5555 Left = 763 55 56 Height = 25 56 Top = 1 2857 Top = 176 57 58 Width = 40 58 59 Anchors = [akTop, akRight] … … 61 62 TabOrder = 2 62 63 end 64 object ComboBox1: TComboBox 65 Left = 152 66 Height = 35 67 Top = 16 68 Width = 352 69 ItemHeight = 0 70 Style = csDropDownList 71 TabOrder = 3 72 end 73 object Label3: TLabel 74 Left = 8 75 Height = 25 76 Top = 21 77 Width = 49 78 Caption = 'Type:' 79 ParentColor = False 80 end 63 81 end 64 82 object GroupBox2: TGroupBox 65 83 Left = 8 66 84 Height = 105 67 Top = 2 0068 Width = 81 085 Top = 248 86 Width = 818 69 87 Align = alTop 70 88 BorderSpacing.Around = 8 … … 72 90 TabOrder = 1 73 91 end 74 object ButtonCancel: TButton 75 Left = 728 76 Height = 25 77 Top = 328 78 Width = 75 79 Anchors = [akTop, akRight] 80 Caption = 'Cancel' 81 ModalResult = 2 92 object Panel1: TPanel 93 Left = 0 94 Height = 50 95 Top = 367 96 Width = 834 97 Align = alBottom 98 BevelOuter = bvNone 99 ClientHeight = 50 100 ClientWidth = 834 82 101 TabOrder = 2 83 end 84 object ButtonOk: TButton 85 Left = 616 86 Height = 25 87 Top = 328 88 Width = 75 89 Anchors = [akTop, akRight] 90 Caption = 'Ok' 91 ModalResult = 1 92 TabOrder = 3 102 object ButtonOk: TButton 103 Left = 624 104 Height = 25 105 Top = 16 106 Width = 75 107 Anchors = [akTop, akRight] 108 Caption = 'Ok' 109 ModalResult = 1 110 TabOrder = 0 111 end 112 object ButtonCancel: TButton 113 Left = 736 114 Height = 25 115 Top = 16 116 Width = 75 117 Anchors = [akTop, akRight] 118 Caption = 'Cancel' 119 ModalResult = 2 120 TabOrder = 1 121 end 93 122 end 94 123 end -
trunk/Forms/UFormCheckout.pas
r8 r9 6 6 7 7 uses 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls; 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 Menus, ExtCtrls; 9 10 10 11 type … … 16 17 ButtonCancel: TButton; 17 18 ButtonOk: TButton; 19 ComboBox1: TComboBox; 18 20 EditURL: TEdit; 19 21 EditDir: TEdit; … … 22 24 Label1: TLabel; 23 25 Label2: TLabel; 26 Label3: TLabel; 27 Panel1: TPanel; 24 28 procedure Button1Click(Sender: TObject); 29 procedure FormShow(Sender: TObject); 25 30 private 26 31 { private declarations } … … 36 41 {$R *.lfm} 37 42 43 uses 44 UCore, UBackend; 45 38 46 { TFormCheckout } 39 47 … … 46 54 end; 47 55 56 procedure TFormCheckout.FormShow(Sender: TObject); 57 var 58 I: Integer; 59 begin 60 ComboBox1.Clear; 61 for I := 0 to Core.Backends.Count - 1 do 62 ComboBox1.AddItem(TBackend(Core.Backends[I]).Name, Core.Backends[I]); 63 if ComboBox1.Items.Count > 0 then 64 ComboBox1.ItemIndex := 0; 65 end; 66 48 67 end. 49 68 -
trunk/Forms/UFormMain.pas
r8 r9 85 85 const 86 86 AppName = 'VCSCommander'; 87 var 88 NewCaption: string; 87 89 begin 90 NewCaption := ''; 88 91 if Assigned(Core.Project) then 89 Caption := Core.Project.Directory + ' - ' + AppName 90 else Caption := AppName; 92 NewCaption := Core.Project.Directory + ' (' + Core.Project.Backend.Name + ') - '; 93 NewCaption := NewCaption + AppName; 94 Caption := NewCaption; 91 95 end; 92 96 -
trunk/UCore.pas
r8 r9 7 7 uses 8 8 Classes, SysUtils, XMLConf, FileUtil, ActnList, Controls, UVCS, UProject, 9 ULastOpenedList, Forms, Dialogs ;9 ULastOpenedList, Forms, Dialogs, Contnrs, UBackend; 10 10 11 11 type … … 47 47 private 48 48 procedure UpdateInterface; 49 procedure RegisterBackends; 50 procedure RegisterBackend(Backend: TBackend); 51 function DetectBackend(Directory: string): TBackend; 49 52 public 53 Backends: TObjectList; // TList<TBackend> 50 54 Project: TProject; 51 55 procedure LoadConfig; … … 64 68 65 69 uses 66 UFormMain, UFormBrowse, UFormSettings, UFormCommit, UFormCheckout; 70 UFormMain, UFormBrowse, UFormSettings, UFormCommit, UFormCheckout, 71 USubversion, UBazaar; 67 72 68 73 { TCore } … … 80 85 procedure TCore.DataModuleCreate(Sender: TObject); 81 86 begin 87 Backends := TObjectList.Create; 82 88 UpdateInterface; 83 89 end; … … 85 91 procedure TCore.DataModuleDestroy(Sender: TObject); 86 92 begin 87 Project.Free; 93 FreeAndNil(Project); 94 FreeAndNil(Backends); 88 95 end; 89 96 … … 97 104 AProjectClose.Enabled := Assigned(Project); 98 105 FormMain.UpdateInterface; 106 end; 107 108 procedure TCore.RegisterBackends; 109 begin 110 RegisterBackend(TBackendSubversion.Create); 111 RegisterBackend(TBackendBazaar.Create); 112 end; 113 114 procedure TCore.RegisterBackend(Backend: TBackend); 115 begin 116 Backends.Add(Backend); 117 end; 118 119 function TCore.DetectBackend(Directory: string): TBackend; 120 var 121 I: Integer; 122 begin 123 I := 0; 124 while (I < Backends.Count) and (not TBackend(Backends[I]).IsWorkingCopy(Directory)) do Inc(I); 125 if I < Backends.Count then Result := TBackend(Backends[I]) 126 else Result := nil; 99 127 end; 100 128 … … 115 143 procedure TCore.Init; 116 144 begin 145 RegisterBackends; 117 146 LoadConfig; 118 147 if (LastOpenedList1.Items.Count > 0) and DirectoryExistsUTF8(LastOpenedList1.Items[0]) then … … 129 158 AProjectClose.Execute; 130 159 Project := TProject.Create; 131 Project.VCSType := vtSubversion; 132 Project.Directory := Directory; 133 UpdateInterface; 134 FormBrowse.Directory := Project.Directory; 135 FormBrowse.ReloadList; 136 LastOpenedList1.AddItem(Project.Directory); 160 Project.Backend := DetectBackend(Directory); 161 if Assigned(Project.Backend) then begin 162 Project.Directory := Directory; 163 UpdateInterface; 164 FormBrowse.Directory := Project.Directory; 165 FormBrowse.ReloadList; 166 LastOpenedList1.AddItem(Project.Directory); 167 end else ShowMessage('Directory not recognized as working copy of any of supported VCS systems'); 137 168 end; 138 169 … … 175 206 TempProject := TProject.Create; 176 207 try 177 TempProject. VCSType := vtSubversion;208 TempProject.Backend := TBackend(FormCheckout.ComboBox1.Items.Objects[FormCheckout.ComboBox1.ItemIndex]); 178 209 TempProject.Directory := FormCheckout.EditDir.Text; 179 210 TempProject.RepositoryURL := FormCheckout.EditURL.Text; -
trunk/Units/UProject.pas
r8 r9 6 6 7 7 uses 8 Classes, SysUtils, UVCS ;8 Classes, SysUtils, UVCS, UBackend; 9 9 10 10 type 11 12 TVCSType = (vtNone, vtSubversion, vtCVS, vtMercurial, vtBazaar, vzGit);13 11 14 12 { TProject } … … 16 14 TProject = class 17 15 private 18 F VCSType: TVCSType;16 FBackend: TBackend; 19 17 function GetDirectory: string; 20 18 function GetRepositoryURL: string; 21 19 procedure SetDirectory(AValue: string); 22 20 procedure SetRepositoryURL(AValue: string); 23 procedure Set VCSType(AValue: TVCSType);21 procedure SetBackend(AValue: TBackend); 24 22 public 25 23 WorkingCopy: TWorkingCopy; … … 27 25 constructor Create; 28 26 destructor Destroy; override; 29 property VCSType: TVCSType read FVCSType write SetVCSType;27 property Backend: TBackend read FBackend write SetBackend; 30 28 property Directory: string read GetDirectory write SetDirectory; 31 29 property RepositoryURL: string read GetRepositoryURL write SetRepositoryURL; … … 40 38 { TProject } 41 39 42 procedure TProject.Set VCSType(AValue: TVCSType);40 procedure TProject.SetBackend(AValue: TBackend); 43 41 begin 44 if F VCSType= AValue then Exit;45 F VCSType:= AValue;42 if FBackend = AValue then Exit; 43 FBackend := AValue; 46 44 FreeAndNil(WorkingCopy); 47 case AValue of 48 vtSubversion: WorkingCopy := TSubversion.Create; 49 else WorkingCopy := TWorkingCopy.Create; 50 end; 45 WorkingCopy := AValue.WorkingCopyClass.Create; 51 46 end; 52 47 -
trunk/Units/UVCS.pas
r8 r9 19 19 procedure SetRepositoryURL(AValue: string); 20 20 protected 21 procedure ExecuteProcess(Command: string; Parameters: TStrings); virtual;21 procedure ExecuteProcess(Command: string; Parameters: array of string); virtual; 22 22 public 23 23 procedure Checkout; virtual; … … 25 25 procedure CleanUp; virtual; 26 26 procedure Commit(Message: TStrings); virtual; 27 procedure Move ; virtual;27 procedure Move(Source, Dest: string); virtual; 28 28 procedure Merge; virtual; 29 29 procedure Refresh; virtual; … … 35 35 Path: string; 36 36 end; 37 37 38 38 39 … … 57 58 end; 58 59 59 procedure TWorkingCopy.ExecuteProcess(Command: string; Parameters: TStrings);60 procedure TWorkingCopy.ExecuteProcess(Command: string; Parameters: array of string); 60 61 begin 61 62 FormConsole.Executable := Command; 62 FormConsole.Parameters.Assign(Parameters); 63 FormConsole.Parameters.Clear; 64 FormConsole.Parameters.AddStrings(Parameters); 63 65 if DirectoryExistsUTF8(Path) then FormConsole.WorkingDir := Path 64 66 else FormConsole.WorkingDir := ''; … … 86 88 end; 87 89 88 procedure TWorkingCopy.Move ;90 procedure TWorkingCopy.Move(Source, Dest: string); 89 91 begin 90 92 -
trunk/VCSCommander.lpi
r8 r9 83 83 </Item4> 84 84 </RequiredPackages> 85 <Units Count="1 2">85 <Units Count="14"> 86 86 <Unit0> 87 87 <Filename Value="VCSCommander.lpr"/> … … 128 128 </Unit6> 129 129 <Unit7> 130 <Filename Value=" Units/USubversion.pas"/>130 <Filename Value="Backends/Subversion/USubversion.pas"/> 131 131 <IsPartOfProject Value="True"/> 132 132 </Unit7> … … 156 156 <ResourceBaseClass Value="Form"/> 157 157 </Unit11> 158 <Unit12> 159 <Filename Value="Backends/Bazaar/UBazaar.pas"/> 160 <IsPartOfProject Value="True"/> 161 </Unit12> 162 <Unit13> 163 <Filename Value="Units/UBackend.pas"/> 164 <IsPartOfProject Value="True"/> 165 </Unit13> 158 166 </Units> 159 167 </ProjectOptions> … … 165 173 <SearchPaths> 166 174 <IncludeFiles Value="$(ProjOutDir)"/> 167 <OtherUnitFiles Value="Forms;Units "/>175 <OtherUnitFiles Value="Forms;Units;Backends/Bazaar;Backends/Subversion"/> 168 176 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 169 177 </SearchPaths> -
trunk/VCSCommander.lpr
r8 r9 10 10 Forms, UFormMain, UCore, Common, TemplateGenerics, UFormBrowse, UVCS, 11 11 UFormFavorites, UFormSettings, UFormConsole, USubversion, UProject, SysUtils, 12 UFormCommit, UFormCheckout 12 UFormCommit, UFormCheckout, UBazaar, UBackend 13 13 { you can add units after this }; 14 14
Note:
See TracChangeset
for help on using the changeset viewer.