1 | unit UBazaar;
|
---|
2 |
|
---|
3 | {$mode delphi}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Classes, SysUtils, UBackend, UVCS;
|
---|
9 |
|
---|
10 | type
|
---|
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 |
|
---|
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;
|
---|
59 |
|
---|
60 | { TBazaar }
|
---|
61 |
|
---|
62 | procedure TBazaar.Execute(Parameters: array of string);
|
---|
63 | begin
|
---|
64 | ExecuteProcess('/usr/bin/bzr', Parameters);
|
---|
65 | end;
|
---|
66 |
|
---|
67 | procedure TBazaar.Checkout;
|
---|
68 | begin
|
---|
69 | Execute(['checkout', RepositoryURL, Path]);
|
---|
70 | end;
|
---|
71 |
|
---|
72 | procedure TBazaar.Update;
|
---|
73 | begin
|
---|
74 | Execute(['update']);
|
---|
75 | end;
|
---|
76 |
|
---|
77 | procedure TBazaar.CleanUp;
|
---|
78 | begin
|
---|
79 | inherited CleanUp;
|
---|
80 | end;
|
---|
81 |
|
---|
82 | procedure TBazaar.Commit(Message: TStrings);
|
---|
83 | begin
|
---|
84 | Execute(['commit', '-m "' + Message.Text + '"']);
|
---|
85 | end;
|
---|
86 |
|
---|
87 | procedure TBazaar.Move(Source, Dest: string);
|
---|
88 | begin
|
---|
89 | Execute(['move', Source, Dest]);
|
---|
90 | end;
|
---|
91 |
|
---|
92 | procedure TBazaar.Merge;
|
---|
93 | begin
|
---|
94 | Execute(['merge']);
|
---|
95 | end;
|
---|
96 |
|
---|
97 | procedure TBazaar.Add(FileName: string);
|
---|
98 | begin
|
---|
99 | Execute(['add', FileName]);
|
---|
100 | end;
|
---|
101 |
|
---|
102 | procedure TBazaar.Remove(FileName: string);
|
---|
103 | begin
|
---|
104 | Execute(['remove', FileName]);
|
---|
105 | end;
|
---|
106 |
|
---|
107 | { TBackendBazaar }
|
---|
108 |
|
---|
109 | constructor TBackendBazaar.Create;
|
---|
110 | begin
|
---|
111 | Name := 'Bazaar';
|
---|
112 | HomePage := 'http://bazaar.canonical.com/';
|
---|
113 | WorkingCopyClass := TBazaar;
|
---|
114 | end;
|
---|
115 |
|
---|
116 | function TBackendBazaar.IsWorkingCopy(Directory: string): Boolean;
|
---|
117 | begin
|
---|
118 | Result := DirectoryExists(Directory + DirectorySeparator + '.bzr');
|
---|
119 | end;
|
---|
120 |
|
---|
121 | end.
|
---|
122 |
|
---|