Changeset 13
- Timestamp:
- May 30, 2015, 1:02:36 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Backends/Bazaar/UBazaar.pas
r10 r13 20 20 21 21 TBazaar = class(TWorkingCopy) 22 private 22 23 protected 23 24 procedure Execute(Parameters: array of string); … … 30 31 procedure Merge; override; 31 32 procedure Add(FileName: string); override; 33 procedure Remove(FileName: string); override; 32 34 end; 33 35 36 { TRepositoryBazaar } 37 38 TRepositoryBazaar = class(TRepository) 39 protected 40 procedure Execute(Parameters: array of string); 41 public 42 procedure Init; override; 43 end; 44 45 34 46 implementation 47 48 { TRepositoryBazaar } 49 50 procedure TRepositoryBazaar.Execute(Parameters: array of string); 51 begin 52 ExecuteProcess('/usr/bin/bzr', Parameters); 53 end; 54 55 procedure TRepositoryBazaar.Init; 56 begin 57 Execute(['init', Path]); 58 end; 35 59 36 60 { TBazaar } … … 76 100 end; 77 101 102 procedure TBazaar.Remove(FileName: string); 103 begin 104 Execute(['remove', FileName]); 105 end; 106 78 107 { TBackendBazaar } 79 108 … … 81 110 begin 82 111 Name := 'Bazaar'; 112 HomePage := 'http://bazaar.canonical.com/'; 83 113 WorkingCopyClass := TBazaar; 84 114 end; -
trunk/Backends/CVS/UCVS.pas
r10 r13 31 31 procedure Merge; override; 32 32 procedure Add(FileName: string); override; 33 procedure Remove(FileName: string); override; 33 34 end; 34 35 36 { TRepositoryCVS } 37 38 TRepositoryCVS = class(TRepository) 39 protected 40 procedure Execute(Parameters: array of string); 41 public 42 procedure Init; override; 43 end; 44 45 35 46 implementation 47 48 { TRepositoryCVS } 49 50 procedure TRepositoryCVS.Execute(Parameters: array of string); 51 begin 52 ExecuteProcess('/usr/bin/cvs', Parameters); 53 end; 54 55 procedure TRepositoryCVS.Init; 56 begin 57 Execute(['-d ' + GetCurrentDir + DirectorySeparator + Path, 'init']); 58 end; 36 59 37 60 { TBackendCVS } … … 40 63 begin 41 64 Name := 'CVS'; 65 HomePage := 'http://www.nongnu.org/cvs/'; 42 66 WorkingCopyClass := TCVS; 67 RepositoryClass := TRepositoryCVS; 43 68 end; 44 69 … … 52 77 procedure TCVS.Execute(Parameters: array of string); 53 78 begin 79 EnvVars.Values['CVSROOT'] := GetCurrentDir + DirectorySeparator + Path; 54 80 ExecuteProcess('/usr/bin/cvs', Parameters); 55 81 end; … … 93 119 end; 94 120 121 procedure TCVS.Remove(FileName: string); 122 begin 123 DeleteFile(FileName); 124 Execute(['rm', FileName]); 125 end; 126 95 127 end. 96 128 -
trunk/Backends/Subversion/USubversion.pas
r11 r13 31 31 procedure Merge; override; 32 32 procedure Add(FileName: string); override; 33 procedure Remove(FileName: string); override; 33 34 procedure GetLog(FileName: string; Log: TLogList); override; 34 35 end; 35 36 37 { TRepositorySubversion } 38 39 TRepositorySubversion = class(TRepository) 40 protected 41 procedure Execute(Parameters: array of string); 42 public 43 procedure Init; override; 44 end; 45 36 46 implementation 47 48 { TRepositorySubversion } 49 50 procedure TRepositorySubversion.Execute(Parameters: array of string); 51 begin 52 ExecuteProcess('/usr/bin/svnadmin', Parameters); 53 end; 54 55 procedure TRepositorySubversion.Init; 56 begin 57 Execute(['create', Path]); 58 end; 37 59 38 60 { TBackendSubversion } … … 41 63 begin 42 64 Name := 'Subversion'; 65 HomePage := 'https://subversion.apache.org/'; 43 66 WorkingCopyClass := TSubversion; 67 RepositoryClass := TRepositorySubversion; 44 68 end; 45 69 … … 92 116 end; 93 117 118 procedure TSubversion.Remove(FileName: string); 119 begin 120 Execute(['remove', FileName]); 121 end; 122 94 123 procedure TSubversion.GetLog(FileName: string; Log: TLogList); 95 124 var -
trunk/Forms/UFormBrowse.lfm
r11 r13 1 1 object FormBrowse: TFormBrowse 2 Left = 5542 Left = 952 3 3 Height = 526 4 Top = 2 694 Top = 287 5 5 Width = 722 6 6 Caption = 'Browse' -
trunk/Forms/UFormConsole.pas
r8 r13 31 31 Parameters: TStringList; 32 32 WorkingDir: string; 33 Environment : string;33 EnvironmentVariables: TStringList; 34 34 Aborted: Boolean; 35 35 Log: TStringList; … … 50 50 Parameters := TStringList.Create; 51 51 Log := TStringList.Create; 52 EnvironmentVariables := TStringList.Create; 52 53 end; 53 54 54 55 procedure TFormConsole.FormDestroy(Sender: TObject); 55 56 begin 57 EnvironmentVariables.Free; 56 58 Log.Free; 57 59 Parameters.Free; … … 101 103 if WorkingDir <> '' then 102 104 Process.CurrentDirectory := WorkingDir; 103 //WorkingDir := ''; 104 if Environment <> '' then 105 Process.Environment.Text := Environment; 106 Environment := ''; 105 Process.Environment.Assign(EnvironmentVariables); 106 Process.Parameters.Assign(Parameters); 107 107 Process.Executable := Executable; 108 Process.Parameters.Assign(Parameters);109 //for I := 0 to Process.Parameters.Count - 1 do110 // 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;119 108 CommandLine := Executable + ' ' + StringReplace(Parameters.Text, LineEnding, ' ', [rfReplaceAll]); 120 109 if CommandLine[Length(CommandLine)] = LineEnding then -
trunk/Forms/UFormMain.lfm
r8 r13 1 1 object FormMain: TFormMain 2 Left = 3403 Height = 4974 Top = 1525 Width = 6672 Left = 416 3 Height = 568 4 Top = 329 5 Width = 939 6 6 Caption = 'VCSCommander' 7 ClientHeight = 4688 ClientWidth = 6677 ClientHeight = 539 8 ClientWidth = 939 9 9 Menu = MainMenu1 10 10 OnActivate = FormActivate … … 17 17 Height = 26 18 18 Top = 0 19 Width = 66719 Width = 939 20 20 Caption = 'ToolBarMain' 21 Images = Core.ImageList1 21 22 ParentShowHint = False 22 23 ShowHint = True 23 24 TabOrder = 0 25 object ToolButton1: TToolButton 26 Left = 1 27 Top = 2 28 Action = Core.AProjectCheckout 29 end 30 object ToolButton2: TToolButton 31 Left = 24 32 Top = 2 33 Action = Core.AProjectOpen 34 end 35 object ToolButton3: TToolButton 36 Left = 47 37 Top = 2 38 Action = Core.AProjectClose 39 end 24 40 end 25 41 object StatusBar1: TStatusBar 26 42 Left = 0 27 43 Height = 29 28 Top = 43929 Width = 66744 Top = 510 45 Width = 939 30 46 Panels = <> 31 47 end 32 48 object MainMenu1: TMainMenu 49 Images = Core.ImageList1 33 50 left = 232 34 51 top = 88 35 52 object MenuItemFile: TMenuItem 36 Caption = ' File'53 Caption = 'Working copy' 37 54 object MenuItem17: TMenuItem 38 55 Action = Core.AProjectCheckout … … 52 69 object MenuItemQuit: TMenuItem 53 70 Action = Core.AQuit 71 end 72 end 73 object MenuItem19: TMenuItem 74 Caption = 'Project group' 75 object MenuItem20: TMenuItem 76 Action = Core.AProjectGroupNew 77 end 78 object MenuItem21: TMenuItem 79 Action = Core.AProjectGroupOpen 80 end 81 object MenuItemRecentProjectGroup: TMenuItem 82 Caption = 'Open recent' 83 end 84 object MenuItem23: TMenuItem 85 Action = Core.AProjectGroupSave 86 end 87 object MenuItem25: TMenuItem 88 Action = Core.AProjectGroupSaveAs 89 end 90 object MenuItem24: TMenuItem 91 Action = Core.AProjectGroupClose 54 92 end 55 93 end … … 75 113 end 76 114 end 115 object MenuItem15: TMenuItem 116 Caption = 'Tools' 117 object MenuItem18: TMenuItem 118 Action = Core.AViewTest 119 end 120 end 77 121 object MenuItem1: TMenuItem 78 122 Caption = 'General' -
trunk/Forms/UFormMain.pas
r9 r13 1 1 unit UFormMain; 2 2 3 {$mode objfpc}{$H+}3 {$mode delphi}{$H+} 4 4 5 5 interface … … 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls, 9 Menus, ActnList ;9 Menus, ActnList, ExtCtrls; 10 10 11 11 type … … 21 21 MenuItem13: TMenuItem; 22 22 MenuItem14: TMenuItem; 23 MenuItem15: TMenuItem; 23 24 MenuItem16: TMenuItem; 24 25 MenuItem17: TMenuItem; 26 MenuItem18: TMenuItem; 27 MenuItem19: TMenuItem; 28 MenuItem20: TMenuItem; 29 MenuItem21: TMenuItem; 30 MenuItemRecentProjectGroup: TMenuItem; 31 MenuItem23: TMenuItem; 32 MenuItem24: TMenuItem; 33 MenuItem25: TMenuItem; 25 34 MenuItemOpenRecent: TMenuItem; 26 35 MenuItem2: TMenuItem; … … 36 45 StatusBar1: TStatusBar; 37 46 ToolBarMain: TToolBar; 47 ToolButton1: TToolButton; 48 ToolButton2: TToolButton; 49 ToolButton3: TToolButton; 38 50 procedure FormActivate(Sender: TObject); 39 51 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); … … 42 54 Initialized: Boolean; 43 55 public 56 procedure ProjectGroupOpenRecentExecute(Sender: TObject); 44 57 procedure OpenRecentExecute(Sender: TObject); 45 58 procedure UpdateInterface; … … 55 68 56 69 uses 57 UCore, UFormBrowse ;70 UCore, UFormBrowse, UFormProjectGroup; 58 71 59 72 { TFormMain } … … 66 79 procedure TFormMain.OpenRecentExecute(Sender: TObject); 67 80 begin 68 Core.ProjectOpen(Core.LastOpenedList1.Items[TMenuItem(Sender).MenuIndex]); 81 Core.ProjectOpen(Core.LastOpenedListProject.Items[TMenuItem(Sender).MenuIndex]); 82 end; 83 84 procedure TFormMain.ProjectGroupOpenRecentExecute(Sender: TObject); 85 begin 86 Core.ProjectGroupOpen(Core.LastOpenedListProjectGroup.Items[TMenuItem(Sender).MenuIndex]); 69 87 end; 70 88 … … 96 114 97 115 procedure TFormMain.DockInit; 116 var 117 NewSplitter: TSplitter; 98 118 begin 119 FormProjectGroup.ManualDock(Self, nil, alLeft); 120 FormProjectGroup.Align := alLeft; 121 FormProjectGroup.Show; 122 NewSplitter := TSplitter.Create(nil); 123 NewSplitter.ManualDock(Self, nil, alLeft); 124 NewSplitter.Align := alLeft; 125 NewSplitter.Left := FormProjectGroup.Width; 126 NewSplitter.Show; 99 127 FormBrowse.ManualDock(Self, nil, alClient); 100 128 FormBrowse.Align := alClient; -
trunk/Forms/UFormSettings.lfm
r7 r13 7 7 ClientHeight = 497 8 8 ClientWidth = 686 9 OnCreate = FormCreate 9 10 LCLVersion = '1.5' 10 11 object ButtonCancel: TButton … … 26 27 TabOrder = 1 27 28 end 29 object Label1: TLabel 30 Left = 16 31 Height = 25 32 Top = 16 33 Width = 107 34 Caption = 'User name:' 35 ParentColor = False 36 end 37 object Label2: TLabel 38 Left = 16 39 Height = 25 40 Top = 64 41 Width = 57 42 Caption = 'Email:' 43 ParentColor = False 44 end 45 object EditUserName: TEdit 46 Left = 152 47 Height = 35 48 Top = 8 49 Width = 264 50 TabOrder = 2 51 end 52 object EditEmail: TEdit 53 Left = 152 54 Height = 35 55 Top = 56 56 Width = 264 57 TabOrder = 3 58 end 28 59 end -
trunk/Forms/UFormSettings.pas
r7 r13 6 6 7 7 uses 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls; 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 XMLConf; 9 10 10 11 type … … 15 16 ButtonCancel: TButton; 16 17 ButtonOk: TButton; 18 EditUserName: TEdit; 19 EditEmail: TEdit; 20 Label1: TLabel; 21 Label2: TLabel; 22 procedure FormCreate(Sender: TObject); 17 23 private 18 24 { private declarations } 19 25 public 20 { public declarations } 26 procedure Load(XMLConfig: TXMLConfig); 27 procedure Save(XMLConfig: TXMLConfig); 21 28 end; 22 29 … … 28 35 {$R *.lfm} 29 36 37 uses 38 UCore; 39 40 { TFormSettings } 41 42 procedure TFormSettings.FormCreate(Sender: TObject); 43 begin 44 45 end; 46 47 procedure TFormSettings.Load(XMLConfig: TXMLConfig); 48 begin 49 EditUserName.Text := Core.UserName; 50 EditEmail.Text := Core.Email; 51 end; 52 53 procedure TFormSettings.Save(XMLConfig: TXMLConfig); 54 begin 55 Core.UserName := EditUserName.Text; 56 Core.Email := EditEmail.Text; 57 end; 58 30 59 end. 31 60 -
trunk/UCore.lfm
r11 r13 8 8 Width = 693 9 9 object ActionList1: TActionList 10 left = 260 11 top = 172 10 Images = ImageList1 11 left = 288 12 top = 176 12 13 object AQuit: TAction 13 14 Caption = 'Quit' … … 18 19 Caption = 'Settings' 19 20 OnExecute = ASettingsExecute 21 ShortCut = 121 20 22 end 21 23 object AAbout: TAction … … 24 26 object AHelp: TAction 25 27 Caption = 'Help' 28 ShortCut = 112 26 29 end 27 30 object AViewFavorites: TAction … … 29 32 end 30 33 object AProjectOpen: TAction 34 Category = 'Project' 31 35 Caption = 'Open...' 32 36 OnExecute = AProjectOpenExecute … … 34 38 end 35 39 object AProjectClose: TAction 40 Category = 'Project' 36 41 Caption = 'Close' 37 42 OnExecute = AProjectCloseExecute … … 53 58 end 54 59 object AProjectCheckout: TAction 60 Category = 'Project' 55 61 Caption = 'Checkout...' 56 62 OnExecute = AProjectCheckoutExecute 57 63 end 64 object AViewTest: TAction 65 Caption = 'Test' 66 OnExecute = AViewTestExecute 67 ShortCut = 16468 68 end 69 object AProjectGroupNew: TAction 70 Category = 'ProjectGroup' 71 Caption = 'New' 72 OnExecute = AProjectGroupNewExecute 73 end 74 object AProjectGroupOpen: TAction 75 Category = 'ProjectGroup' 76 Caption = 'Open...' 77 OnExecute = AProjectGroupOpenExecute 78 end 79 object AProjectGroupClose: TAction 80 Category = 'ProjectGroup' 81 Caption = 'Close' 82 OnExecute = AProjectGroupCloseExecute 83 end 84 object AProjectGroupSave: TAction 85 Category = 'ProjectGroup' 86 Caption = 'Save' 87 OnExecute = AProjectGroupSaveExecute 88 end 89 object AProjectGroupSaveAs: TAction 90 Category = 'ProjectGroup' 91 Caption = 'Save as...' 92 OnExecute = AProjectGroupSaveAsExecute 93 end 58 94 end 59 95 object ImageList1: TImageList 60 left = 260 61 top = 228 96 Height = 32 97 Width = 32 98 left = 288 99 top = 240 62 100 end 63 101 object OpenDialog1: TOpenDialog 64 left = 260 102 Filter = 'Project groups (.vcgrp))|*.vcgrp|All files (.*)|*.*' 103 left = 288 65 104 top = 96 66 105 end … … 72 111 top = 96 73 112 end 74 object LastOpenedList 1: TLastOpenedList113 object LastOpenedListProject: TLastOpenedList 75 114 MaxCount = 10 76 OnChange = LastOpenedList 1Change115 OnChange = LastOpenedListProjectChange 77 116 left = 96 78 117 top = 168 … … 88 127 top = 302 89 128 end 129 object LastOpenedListProjectGroup: TLastOpenedList 130 MaxCount = 10 131 OnChange = LastOpenedListProjectGroupChange 132 left = 464 133 top = 224 134 end 135 object SaveDialog1: TSaveDialog 136 DefaultExt = '.vcgrp' 137 Filter = 'Project groups (.vcgrp))|*.vcgrp|All files (.*)|*.*' 138 left = 288 139 top = 24 140 end 90 141 end -
trunk/UCore.pas
r10 r13 19 19 ACommandCommit: TAction; 20 20 ACommandStatus: TAction; 21 AProjectGroupSaveAs: TAction; 22 AProjectGroupSave: TAction; 23 AProjectGroupClose: TAction; 24 AProjectGroupOpen: TAction; 25 AProjectGroupNew: TAction; 26 AViewTest: TAction; 21 27 AProjectCheckout: TAction; 22 28 AProjectClose: TAction; … … 28 34 AViewFavorites: TAction; 29 35 ImageList1: TImageList; 30 LastOpenedList 1: TLastOpenedList;36 LastOpenedListProject: TLastOpenedList; 31 37 LastOpenedListNewDir: TLastOpenedList; 38 LastOpenedListProjectGroup: TLastOpenedList; 32 39 LastOpenedListRepoURL: TLastOpenedList; 33 40 OpenDialog1: TOpenDialog; 41 SaveDialog1: TSaveDialog; 34 42 XMLConfig1: TXMLConfig; 35 43 procedure ACommandCheckoutExecute(Sender: TObject); … … 39 47 procedure AProjectCheckoutExecute(Sender: TObject); 40 48 procedure AProjectCloseExecute(Sender: TObject); 49 procedure AProjectGroupCloseExecute(Sender: TObject); 50 procedure AProjectGroupNewExecute(Sender: TObject); 51 procedure AProjectGroupOpenExecute(Sender: TObject); 52 procedure AProjectGroupSaveAsExecute(Sender: TObject); 53 procedure AProjectGroupSaveExecute(Sender: TObject); 41 54 procedure AProjectOpenExecute(Sender: TObject); 42 55 procedure AQuitExecute(Sender: TObject); 43 56 procedure ASettingsExecute(Sender: TObject); 57 procedure AViewTestExecute(Sender: TObject); 44 58 procedure DataModuleCreate(Sender: TObject); 45 59 procedure DataModuleDestroy(Sender: TObject); 46 procedure LastOpenedList1Change(Sender: TObject); 60 procedure LastOpenedListProjectChange(Sender: TObject); 61 procedure LastOpenedListProjectGroupChange(Sender: TObject); 47 62 private 48 63 procedure UpdateInterface; … … 53 68 Backends: TObjectList; // TList<TBackend> 54 69 Project: TProject; 70 ProjectGroup: TProjectGroup; 71 UserName: string; 72 Email: string; 55 73 procedure LoadConfig; 56 74 procedure SaveConfig; … … 58 76 procedure Done; 59 77 procedure ProjectOpen(Directory: string); 78 procedure ProjectGroupOpen(FileName: string); 60 79 end; 61 80 … … 69 88 uses 70 89 UFormMain, UFormBrowse, UFormSettings, UFormCommit, UFormCheckout, 71 USubversion, UBazaar, UCVS ;90 USubversion, UBazaar, UCVS, UGit, UFormTest, UFormProjectGroup; 72 91 73 92 { TCore } … … 80 99 procedure TCore.ASettingsExecute(Sender: TObject); 81 100 begin 82 FormSettings.ShowModal; 101 FormSettings.Load(XMLConfig1); 102 if FormSettings.ShowModal = mrOk then begin 103 FormSettings.Save(XMLConfig1); 104 end; 105 end; 106 107 procedure TCore.AViewTestExecute(Sender: TObject); 108 begin 109 FormTest.Show; 83 110 end; 84 111 … … 95 122 end; 96 123 97 procedure TCore.LastOpenedList1Change(Sender: TObject); 98 begin 99 LastOpenedList1.LoadToMenuItem(FormMain.MenuItemOpenRecent, FormMain.OpenRecentExecute); 124 procedure TCore.LastOpenedListProjectChange(Sender: TObject); 125 begin 126 LastOpenedListProject.LoadToMenuItem(FormMain.MenuItemOpenRecent, FormMain.OpenRecentExecute); 127 end; 128 129 procedure TCore.LastOpenedListProjectGroupChange(Sender: TObject); 130 begin 131 LastOpenedListProjectGroup.LoadToMenuItem(FormMain.MenuItemRecentProjectGroup, FormMain.ProjectGroupOpenRecentExecute); 100 132 end; 101 133 … … 103 135 begin 104 136 AProjectClose.Enabled := Assigned(Project); 137 AProjectGroupClose.Enabled := Assigned(ProjectGroup); 138 AProjectGroupSave.Enabled := Assigned(ProjectGroup); 139 AProjectGroupSaveAs.Enabled := Assigned(ProjectGroup); 105 140 FormMain.UpdateInterface; 106 141 end; … … 111 146 RegisterBackend(TBackendBazaar.Create); 112 147 RegisterBackend(TBackendCVS.Create); 148 RegisterBackend(TBackendGit.Create); 113 149 end; 114 150 … … 130 166 procedure TCore.LoadConfig; 131 167 begin 132 LastOpenedList 1.LoadFromXMLConfig(XMLConfig1, 'LastOpenedProjects');168 LastOpenedListProject.LoadFromXMLConfig(XMLConfig1, 'LastOpenedProjects'); 133 169 LastOpenedListRepoURL.LoadFromXMLConfig(XMLConfig1, 'LastOpenedRepoURL'); 134 170 LastOpenedListNewDir.LoadFromXMLConfig(XMLConfig1, 'LastOpenedNewDir'); 171 LastOpenedListProjectGroup.LoadFromXMLConfig(XMLConfig1, 'LastOpenedListProjectGroup'); 172 UserName := XMLConfig1.GetValue('UserName', ''); 173 Email := XMLConfig1.GetValue('Email', ''); 135 174 end; 136 175 137 176 procedure TCore.SaveConfig; 138 177 begin 139 LastOpenedList 1.SaveToXMLConfig(XMLConfig1, 'LastOpenedProjects');178 LastOpenedListProject.SaveToXMLConfig(XMLConfig1, 'LastOpenedProjects'); 140 179 LastOpenedListRepoURL.SaveToXMLConfig(XMLConfig1, 'LastOpenedRepoURL'); 141 180 LastOpenedListNewDir.SaveToXMLConfig(XMLConfig1, 'LastOpenedNewDir'); 181 LastOpenedListProjectGroup.SaveToXMLConfig(XMLConfig1, 'LastOpenedListProjectGroup'); 182 XMLConfig1.SetValue('UserName', UserName); 183 XMLConfig1.SetValue('Email', Email); 142 184 end; 143 185 … … 146 188 RegisterBackends; 147 189 LoadConfig; 148 if (LastOpenedList 1.Items.Count > 0) and DirectoryExistsUTF8(LastOpenedList1.Items[0]) then149 ProjectOpen(LastOpenedList 1.Items[0]);190 if (LastOpenedListProject.Items.Count > 0) and DirectoryExistsUTF8(LastOpenedListProject.Items[0]) then 191 ProjectOpen(LastOpenedListProject.Items[0]); 150 192 end; 151 193 … … 160 202 Project := TProject.Create; 161 203 Project.Backend := DetectBackend(Directory); 204 Project.WorkingCopy.UserName := Core.UserName; 205 Project.WorkingCopy.Email := Core.Email; 162 206 if Assigned(Project.Backend) then begin 163 207 Project.Directory := Directory; … … 165 209 FormBrowse.Directory := Project.Directory; 166 210 FormBrowse.ReloadList; 167 LastOpenedList 1.AddItem(Project.Directory);211 LastOpenedListProject.AddItem(Project.Directory); 168 212 end else ShowMessage('Directory not recognized as working copy of any of supported VCS systems'); 213 end; 214 215 procedure TCore.ProjectGroupOpen(FileName: string); 216 begin 217 AProjectGroupClose.Execute; 218 ProjectGroup := TProjectGroup.Create; 219 ProjectGroup.FileName := FileName; 220 UpdateInterface; 221 FormProjectGroup.ReloadTree; 222 LastOpenedListProjectGroup.AddItem(FileName); 169 223 end; 170 224 … … 187 241 FormBrowse.ReloadList; 188 242 UpdateInterface; 243 end; 244 245 procedure TCore.AProjectGroupCloseExecute(Sender: TObject); 246 begin 247 FreeAndNil(ProjectGroup); 248 UpdateInterface; 249 FormProjectGroup.ReloadTree; 250 end; 251 252 procedure TCore.AProjectGroupNewExecute(Sender: TObject); 253 begin 254 AProjectClose.Execute; 255 ProjectGroup := TProjectGroup.Create; 256 ProjectGroup.FileName := 'New project group.vcgrp'; 257 UpdateInterface; 258 FormProjectGroup.ReloadTree; 259 end; 260 261 procedure TCore.AProjectGroupOpenExecute(Sender: TObject); 262 begin 263 if LastOpenedListProjectGroup.Items.Count > 0 then 264 OpenDialog1.FileName := LastOpenedListProjectGroup.Items[0]; 265 if OpenDialog1.Execute then begin 266 AProjectClose.Execute; 267 ProjectGroupOpen(OpenDialog1.FileName); 268 end; 269 end; 270 271 procedure TCore.AProjectGroupSaveAsExecute(Sender: TObject); 272 begin 273 SaveDialog1.FileName := ProjectGroup.FileName; 274 if SaveDialog1.Execute then begin 275 ProjectGroup.SaveToFile(SaveDialog1.FileName); 276 UpdateInterface; 277 end; 278 end; 279 280 procedure TCore.AProjectGroupSaveExecute(Sender: TObject); 281 begin 282 if FileExistsUTF8(ProjectGroup.FileName) then ProjectGroup.SaveToFile(ProjectGroup.FileName) 283 else AProjectGroupSaveAs.Execute; 189 284 end; 190 285 -
trunk/Units/UBackend.pas
r10 r13 10 10 type 11 11 TWorkingCopyClass = class of TWorkingCopy; 12 TRepositoryClass = class of TRepository; 12 13 13 14 { TBackend } … … 15 16 TBackend = class 16 17 Name: string; 18 HomePage: string; 17 19 WorkingCopyClass: TWorkingCopyClass; 20 RepositoryClass: TRepositoryClass; 21 function IsRepository(Directory: string): Boolean; virtual; 18 22 function IsWorkingCopy(Directory: string): Boolean; virtual; 19 23 end; … … 22 26 23 27 { TBackend } 28 29 function TBackend.IsRepository(Directory: string): Boolean; 30 begin 31 Result := False; 32 end; 24 33 25 34 function TBackend.IsWorkingCopy(Directory: string): Boolean; -
trunk/Units/UProject.pas
r9 r13 6 6 7 7 uses 8 Classes, SysUtils, UVCS, UBackend; 8 Classes, SysUtils, UVCS, UBackend, Contnrs, DOM, XMLRead, XMLWrite, UXMLUtils, 9 FileUtil; 9 10 10 11 type … … 22 23 public 23 24 WorkingCopy: TWorkingCopy; 25 Repository: TRepository; 24 26 procedure Open(Directory: string); 25 27 constructor Create; 26 28 destructor Destroy; override; 29 procedure LoadXMLNOde(Node: TDOMNode); 30 procedure SaveXMLNOde(Node: TDOMNode); 27 31 property Backend: TBackend read FBackend write SetBackend; 28 32 property Directory: string read GetDirectory write SetDirectory; … … 30 34 end; 31 35 36 { TProjects } 37 38 TProjects = class(TObjectList) 39 procedure LoadXMLNode(Node: TDOMNode); 40 procedure SaveXMLNode(Node: TDOMNode); 41 end; 42 43 { TProjectGroup } 44 45 TProjectGroup = class 46 FileName: string; 47 Projects: TProjects; 48 constructor Create; 49 destructor Destroy; override; 50 procedure LoadFromFile(FileName: string); 51 procedure SaveToFile(FileName: string); 52 end; 53 32 54 33 55 implementation 34 56 35 uses 36 USubversion; 57 resourcestring 58 SWrongFileFormat = 'Wrong file format'; 59 60 { TProjects } 61 62 procedure TProjects.LoadXMLNode(Node: TDOMNode); 63 var 64 NewProject: TProject; 65 Node2: TDOMNode; 66 begin 67 Node2 := Node.FirstChild; 68 while Assigned(Node2) and (Node2.NodeName = 'Project') do begin 69 NewProject := TProject.Create; 70 NewProject.LoadXMLNode(Node2); 71 Add(NewProject); 72 Node2 := Node2.NextSibling; 73 end; 74 end; 75 76 procedure TProjects.SaveXMLNode(Node: TDOMNode); 77 var 78 I: Integer; 79 NewNode: TDOMNode; 80 begin 81 for I := 0 to Count - 1 do begin; 82 NewNode := Node.OwnerDocument.CreateElement('Project'); 83 Node.AppendChild(NewNode); 84 TProject(Items[I]).SaveXMLNode(NewNode); 85 end; 86 end; 87 88 89 { TProjectGroup } 90 91 constructor TProjectGroup.Create; 92 begin 93 Projects := TProjects.Create; 94 end; 95 96 destructor TProjectGroup.Destroy; 97 begin 98 Projects.Free; 99 inherited Destroy; 100 end; 101 102 procedure TProjectGroup.LoadFromFile(FileName: string); 103 var 104 Doc: TXMLDocument; 105 RootNode: TDOMNode; 106 Node: TDOMNode; 107 Node2: TDOMNode; 108 begin 109 Self.FileName := FileName; 110 ReadXMLFile(Doc, UTF8Decode(FileName)); 111 with Doc do try 112 if Doc.DocumentElement.NodeName <> 'ProjectGroup' then 113 raise Exception.Create(SWrongFileFormat); 114 RootNode := Doc.DocumentElement; 115 with RootNode do begin 116 Node := FindNode('Projects'); 117 if Assigned(Node) then Projects.LoadXMLNode(Node); 118 end; 119 finally 120 Doc.Free; 121 end; 122 end; 123 124 procedure TProjectGroup.SaveToFile(FileName: string); 125 var 126 NewNode: TDOMNode; 127 Doc: TXMLDocument; 128 RootNode: TDOMNode; 129 begin 130 if FileName = '' then Exit; 131 Self.FileName := FileName; 132 Doc := TXMLDocument.Create; 133 with Doc do try 134 RootNode := CreateElement('ProjectGroup'); 135 AppendChild(RootNode); 136 with RootNode do begin 137 NewNode := OwnerDocument.CreateElement('Projects'); 138 AppendChild(NewNode); 139 Projects.SaveXMLNode(NewNode); 140 end; 141 ForceDirectoriesUTF8(ExtractFileDir(FileName)); 142 WriteXMLFile(Doc, UTF8Decode(FileName)); 143 finally 144 Doc.Free; 145 end; 146 end; 37 147 38 148 { TProject } … … 44 154 FreeAndNil(WorkingCopy); 45 155 WorkingCopy := AValue.WorkingCopyClass.Create; 156 FreeAndNil(Repository); 157 Repository := AValue.RepositoryClass.Create; 46 158 end; 47 159 … … 64 176 begin 65 177 WorkingCopy.RepositoryURL := AValue; 178 Repository.Path := AValue; 66 179 end; 67 180 … … 74 187 begin 75 188 WorkingCopy := TWorkingCopy.Create; 189 Repository := TRepository.Create; 76 190 end; 77 191 … … 79 193 begin 80 194 WorkingCopy.Free; 195 Repository.Free; 81 196 inherited Destroy; 82 197 end; 83 198 199 procedure TProject.LoadXMLNOde(Node: TDOMNode); 200 begin 201 RepositoryURL := ReadString(Node, 'RepositoryURL', ''); 202 Directory := ReadString(Node, 'Directory', ''); 203 end; 204 205 procedure TProject.SaveXMLNOde(Node: TDOMNode); 206 begin 207 WriteString(Node, 'RepositoryURL', RepositoryURL); 208 WriteString(Node, 'Directory', Directory); 209 end; 210 84 211 end. 85 212 -
trunk/Units/UVCS.pas
r11 r13 36 36 procedure SetRepositoryURL(AValue: string); 37 37 protected 38 EnvVars: TStringList; 38 39 procedure ExecuteProcess(Command: string; Parameters: array of string); virtual; 39 40 function GetNext(var Text: string; Separator: string): string; 40 41 public 42 UserName: string; 43 Password: string; 44 Email: string; 41 45 ExecutionOutput: TStringList; 42 46 procedure Checkout; virtual; … … 48 52 procedure Refresh; virtual; 49 53 procedure Add(FileName: string); virtual; 54 procedure Remove(FileName: string); virtual; 50 55 procedure GetLog(FileName: string; Log: TLogList); virtual; 51 56 constructor Create; … … 55 60 end; 56 61 62 { TRepository } 63 57 64 TRepository = class 65 protected 66 procedure ExecuteProcess(Command: string; Parameters: array of string); virtual; 67 public 68 ExecutionOutput: TStringList; 58 69 Path: string; 59 end; 60 61 70 procedure Init; virtual; 71 constructor Create; 72 destructor Destroy; override; 73 end; 74 75 76 function URLFromDirectory(DirName: string; Relative: Boolean): string; 62 77 63 78 implementation … … 66 81 UFormConsole; 67 82 68 { TLogItem } 69 70 constructor TLogItem.Create; 71 begin 72 Messages := TStringList.Create; 73 ChangedFiles := TStringList.Create; 74 end; 75 76 destructor TLogItem.Destroy; 77 begin 78 Messages.Free; 79 ChangedFiles.Free; 80 inherited Destroy; 81 end; 82 83 { TWorkingCopy } 84 85 procedure TWorkingCopy.SetPath(AValue: string); 86 begin 87 if FPath = AValue then Exit; 88 FPath := AValue; 89 Refresh; 90 end; 91 92 procedure TWorkingCopy.SetRepositoryURL(AValue: string); 93 begin 94 if FRepositoryURL=AValue then Exit; 95 FRepositoryURL:=AValue; 96 end; 97 98 procedure TWorkingCopy.ExecuteProcess(Command: string; Parameters: array of string); 83 function URLFromDirectory(DirName: string; Relative: Boolean): string; 84 begin 85 Result := DirName; 86 if Relative then Result := GetCurrentDirUTF8 + DirectorySeparator + Result; 87 Result := 'file:///' + StringReplace(Result, DirectorySeparator, '/', [rfReplaceAll]); 88 end; 89 90 { TRepository } 91 92 procedure TRepository.ExecuteProcess(Command: string; 93 Parameters: array of string); 99 94 begin 100 95 FormConsole.Executable := Command; … … 107 102 end; 108 103 104 procedure TRepository.Init; 105 begin 106 107 end; 108 109 constructor TRepository.Create; 110 begin 111 ExecutionOutput := TStringList.Create; 112 Path := ''; 113 end; 114 115 destructor TRepository.Destroy; 116 begin 117 FreeAndNil(ExecutionOutput); 118 inherited Destroy; 119 end; 120 121 { TLogItem } 122 123 constructor TLogItem.Create; 124 begin 125 Messages := TStringList.Create; 126 ChangedFiles := TStringList.Create; 127 end; 128 129 destructor TLogItem.Destroy; 130 begin 131 Messages.Free; 132 ChangedFiles.Free; 133 inherited Destroy; 134 end; 135 136 { TWorkingCopy } 137 138 procedure TWorkingCopy.SetPath(AValue: string); 139 begin 140 if FPath = AValue then Exit; 141 FPath := AValue; 142 Refresh; 143 end; 144 145 procedure TWorkingCopy.SetRepositoryURL(AValue: string); 146 begin 147 if FRepositoryURL=AValue then Exit; 148 FRepositoryURL:=AValue; 149 end; 150 151 procedure TWorkingCopy.ExecuteProcess(Command: string; Parameters: array of string); 152 begin 153 FormConsole.Executable := Command; 154 FormConsole.EnvironmentVariables.Assign(EnvVars); 155 FormConsole.Parameters.Clear; 156 FormConsole.Parameters.AddStrings(Parameters); 157 if DirectoryExistsUTF8(Path) then FormConsole.WorkingDir := Path 158 else FormConsole.WorkingDir := ''; 159 FormConsole.ShowModal; 160 ExecutionOutput.Assign(FormConsole.Log); 161 end; 162 109 163 function TWorkingCopy.GetNext(var Text: string; Separator: string): string; 110 164 begin … … 158 212 end; 159 213 214 procedure TWorkingCopy.Remove(FileName: string); 215 begin 216 217 end; 218 160 219 procedure TWorkingCopy.GetLog(FileName: string; Log: TLogList); 161 220 begin … … 166 225 begin 167 226 ExecutionOutput := TStringList.Create; 227 EnvVars := TStringList.Create; 168 228 FPath := ''; 169 229 FRepositoryURL := ''; … … 172 232 destructor TWorkingCopy.Destroy; 173 233 begin 234 FreeAndNil(EnvVars); 174 235 FreeAndNil(ExecutionOutput); 175 236 inherited Destroy; -
trunk/VCSCommander.lpi
r11 r13 27 27 <SearchPaths> 28 28 <IncludeFiles Value="$(ProjOutDir)"/> 29 <OtherUnitFiles Value="Backends/CVS "/>29 <OtherUnitFiles Value="Backends/CVS;Backends/Git"/> 30 30 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 31 31 </SearchPaths> … … 84 84 </Item4> 85 85 </RequiredPackages> 86 <Units Count="1 6">86 <Units Count="19"> 87 87 <Unit0> 88 88 <Filename Value="VCSCommander.lpr"/> … … 176 176 <ResourceBaseClass Value="Form"/> 177 177 </Unit15> 178 <Unit16> 179 <Filename Value="Backends/Git/UGit.pas"/> 180 <IsPartOfProject Value="True"/> 181 </Unit16> 182 <Unit17> 183 <Filename Value="Forms/UFormTest.pas"/> 184 <IsPartOfProject Value="True"/> 185 <ComponentName Value="FormTest"/> 186 <ResourceBaseClass Value="Form"/> 187 </Unit17> 188 <Unit18> 189 <Filename Value="Forms/UFormProjectGroup.pas"/> 190 <IsPartOfProject Value="True"/> 191 <ComponentName Value="FormProjectGroup"/> 192 <ResourceBaseClass Value="Form"/> 193 </Unit18> 178 194 </Units> 179 195 </ProjectOptions> … … 185 201 <SearchPaths> 186 202 <IncludeFiles Value="$(ProjOutDir)"/> 187 <OtherUnitFiles Value="Forms;Units;Backends/Bazaar;Backends/Subversion;Backends/CVS "/>203 <OtherUnitFiles Value="Forms;Units;Backends/Bazaar;Backends/Subversion;Backends/CVS;Backends/Git"/> 188 204 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 189 205 </SearchPaths> … … 204 220 <StackChecks Value="True"/> 205 221 </Checks> 206 <VerifyObjMethodCallValidity Value="True"/>207 222 </CodeGeneration> 208 223 <Linking> -
trunk/VCSCommander.lpr
r11 r13 10 10 Forms, UFormMain, UCore, Common, TemplateGenerics, UFormBrowse, UVCS, 11 11 UFormFavorites, UFormSettings, UFormConsole, USubversion, UProject, SysUtils, 12 UFormCommit, UFormCheckout, UBazaar, UBackend, UFormLog 12 UFormCommit, UFormCheckout, UBazaar, UBackend, UFormLog, UFormTest, 13 UFormProjectGroup 13 14 { you can add units after this }; 14 15 … … 39 40 Application.CreateForm(TFormCheckout, FormCheckout); 40 41 Application.CreateForm(TFormLog, FormLog); 42 Application.CreateForm(TFormTest, FormTest); 43 Application.CreateForm(TFormProjectGroup, FormProjectGroup); 41 44 Application.Run; 42 45 end.
Note:
See TracChangeset
for help on using the changeset viewer.