source: trunk/Backends/Bazaar/UBazaar.pas

Last change on this file was 13, checked in by chronos, 9 years ago
  • Added: New test form where general functionality of selected backend can be tested.
  • Added: Basic git backend implementation.
  • Added: Project group form and ability to open/save group of projects as configuration to XML file.
File size: 2.2 KB
Line 
1unit UBazaar;
2
3{$mode delphi}
4
5interface
6
7uses
8 Classes, SysUtils, UBackend, UVCS;
9
10type
11
12 { TBackendBazaar }
13
14 TBackendBazaar = class(TBackend)
15 constructor Create;
16 function IsWorkingCopy(Directory: string): Boolean; override;
17 end;
18
19 { TBazaar }
20
21 TBazaar = class(TWorkingCopy)
22 private
23 protected
24 procedure Execute(Parameters: array of string);
25 public
26 procedure Checkout; override;
27 procedure Update; override;
28 procedure CleanUp; override;
29 procedure Commit(Message: TStrings); override;
30 procedure Move(Source, Dest: string); override;
31 procedure Merge; override;
32 procedure Add(FileName: string); override;
33 procedure Remove(FileName: string); override;
34 end;
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
46implementation
47
48{ TRepositoryBazaar }
49
50procedure TRepositoryBazaar.Execute(Parameters: array of string);
51begin
52 ExecuteProcess('/usr/bin/bzr', Parameters);
53end;
54
55procedure TRepositoryBazaar.Init;
56begin
57 Execute(['init', Path]);
58end;
59
60{ TBazaar }
61
62procedure TBazaar.Execute(Parameters: array of string);
63begin
64 ExecuteProcess('/usr/bin/bzr', Parameters);
65end;
66
67procedure TBazaar.Checkout;
68begin
69 Execute(['checkout', RepositoryURL, Path]);
70end;
71
72procedure TBazaar.Update;
73begin
74 Execute(['update']);
75end;
76
77procedure TBazaar.CleanUp;
78begin
79 inherited CleanUp;
80end;
81
82procedure TBazaar.Commit(Message: TStrings);
83begin
84 Execute(['commit', '-m "' + Message.Text + '"']);
85end;
86
87procedure TBazaar.Move(Source, Dest: string);
88begin
89 Execute(['move', Source, Dest]);
90end;
91
92procedure TBazaar.Merge;
93begin
94 Execute(['merge']);
95end;
96
97procedure TBazaar.Add(FileName: string);
98begin
99 Execute(['add', FileName]);
100end;
101
102procedure TBazaar.Remove(FileName: string);
103begin
104 Execute(['remove', FileName]);
105end;
106
107{ TBackendBazaar }
108
109constructor TBackendBazaar.Create;
110begin
111 Name := 'Bazaar';
112 HomePage := 'http://bazaar.canonical.com/';
113 WorkingCopyClass := TBazaar;
114end;
115
116function TBackendBazaar.IsWorkingCopy(Directory: string): Boolean;
117begin
118 Result := DirectoryExists(Directory + DirectorySeparator + '.bzr');
119end;
120
121end.
122
Note: See TracBrowser for help on using the repository browser.