fixed tags page paging bug a...
|
1 |
package Gitprep::Manager; |
2 |
use Mojo::Base -base; |
|
3 | ||
4 |
use Carp 'croak'; |
|
fixed bug that setting page ...
|
5 |
use Encode 'encode'; |
fix description file not cop...
|
6 |
use File::Copy qw/move copy/; |
fixed tags page paging bug a...
|
7 |
use File::Path qw/mkpath rmtree/; |
8 |
use File::Temp (); |
|
add key delete feature and u...
|
9 |
use Fcntl ':flock'; |
10 |
use Carp 'croak'; |
|
11 |
use File::Copy qw/copy move/; |
|
fix bug that in CGI reposito...
|
12 |
use File::Spec; |
13 |
use Gitprep::Util; |
|
fixed tags page paging bug a...
|
14 | |
15 |
has 'app'; |
|
add key delete feature and u...
|
16 |
has 'authorized_keys_file'; |
fixed tags page paging bug a...
|
17 | |
cleanup prepare merge
|
18 |
has '_tmp_branch' => '__gitprep_tmp_branch__'; |
19 | ||
20 |
sub prepare_merge { |
|
fix tests
|
21 |
my ($self, $work_rep_info, $base_rep_info, $base_branch, $target_rep_info, $target_branch) = @_; |
add lock system
|
22 |
|
cleanup prepare merge
|
23 |
# Fetch base repository |
fix tests
|
24 |
my $base_user_id = $base_rep_info->{user}; |
fix pull_request table bug
|
25 |
my @git_fetch_base_cmd = $self->app->git->cmd($work_rep_info, 'fetch', 'origin'); |
cleanup prepare merge
|
26 |
Gitprep::Util::run_command(@git_fetch_base_cmd) |
27 |
or Carp::croak "Can't execute git fetch: @git_fetch_base_cmd"; |
|
add lock system
|
28 |
|
cleanup prepare merge
|
29 |
# Fetch target repository |
fix tests
|
30 |
my @git_fetch_target_cmd = $self->app->git->cmd($work_rep_info, 'fetch', $target_rep_info->{git_dir}); |
cleanup prepare merge
|
31 |
Gitprep::Util::run_command(@git_fetch_target_cmd) |
32 |
or Carp::croak "Can't execute git fetch: @git_fetch_target_cmd"; |
|
cleanup merge and push logic
|
33 | |
34 |
# Ensure no diff |
|
35 |
my @git_reset_hard_cmd = $self->app->git->cmd( |
|
36 |
$work_rep_info, |
|
37 |
'reset', |
|
38 |
'--hard' |
|
39 |
); |
|
40 |
Gitprep::Util::run_command(@git_reset_hard_cmd) |
|
41 |
or Carp::croak "Can't execute git reset --hard: @git_reset_hard_cmd"; |
|
42 | ||
43 |
# Checkout first branch |
|
44 |
my $tmp_branch = $self->_tmp_branch; |
|
45 |
my $branch_names = $self->app->git->branch_names($work_rep_info); |
|
46 |
my $first_branch; |
|
47 |
for my $branch_name (@$branch_names) { |
|
48 |
if ($branch_name ne $tmp_branch) { |
|
49 |
$first_branch = $branch_name; |
|
50 |
last; |
|
51 |
} |
|
52 |
} |
|
53 |
my @git_checkout_first_branch = $self->app->git->cmd( |
|
54 |
$work_rep_info, |
|
55 |
'checkout', |
|
56 |
$first_branch |
|
57 |
); |
|
58 |
Gitprep::Util::run_command(@git_checkout_first_branch) |
|
59 |
or Carp::croak "Can't execute git checkout: @git_checkout_first_branch"; |
|
60 |
|
|
61 |
# Delete temparary branch if it eixsts |
|
62 |
if (grep { $_ eq $tmp_branch } @$branch_names) { |
|
63 |
my @git_branch_remove_cmd = $self->app->git->cmd( |
|
64 |
$work_rep_info, |
|
65 |
'branch', |
|
66 |
'-D', |
|
67 |
$tmp_branch |
|
68 |
); |
|
69 |
Gitprep::Util::run_command(@git_branch_remove_cmd) |
|
70 |
or Carp::croak "Can't execute git branch: @git_branch_remove_cmd"; |
|
71 |
} |
|
72 | ||
73 |
# Create temparary branch |
|
74 |
my @git_branch_cmd = $self->app->git->cmd( |
|
75 |
$work_rep_info, |
|
76 |
'branch', |
|
77 |
$tmp_branch |
|
78 |
); |
|
79 |
Gitprep::Util::run_command(@git_branch_cmd) |
|
80 |
or Carp::croak "Can't execute git branch: @git_branch_cmd"; |
|
cleanup prepare merge
|
81 |
|
82 |
# Checkout tmp branch and git reset --hard from my remote branch |
|
83 |
my @git_checkout_tmp_branch = $self->app->git->cmd( |
|
84 |
$work_rep_info, |
|
85 |
'checkout', |
|
cleanup merge and push logic
|
86 |
$tmp_branch |
cleanup prepare merge
|
87 |
); |
88 |
Gitprep::Util::run_command(@git_checkout_tmp_branch) |
|
89 |
or Carp::croak "Can't execute git checkout: @git_checkout_tmp_branch"; |
|
90 |
|
|
fix merge pull request bug
|
91 |
# git reset --hard |
fix tests
|
92 |
my $base_object_id = $self->app->git->ref_to_object_id($base_rep_info, $base_branch); |
fix merge pull request bug
|
93 |
my @git_reset_hard_base_cmd = $self->app->git->cmd( |
cleanup prepare merge
|
94 |
$work_rep_info, |
95 |
'reset', |
|
96 |
'--hard', |
|
fix tests
|
97 |
$base_object_id |
cleanup prepare merge
|
98 |
); |
fix merge pull request bug
|
99 |
Gitprep::Util::run_command(@git_reset_hard_base_cmd) |
100 |
or Carp::croak "Can't execute git reset --hard: @git_reset_hard_base_cmd"; |
|
add lock system
|
101 |
} |
102 | ||
cleanup merge and push logic
|
103 |
sub merge { |
add --no-ff option to merge ...
|
104 |
my ($self, $work_rep_info, $target_rep_info, $target_branch, $pull_request_number) = @_; |
cleanup merge and push logic
|
105 |
|
fix tests
|
106 |
my $object_id = $self->app->git->ref_to_object_id($target_rep_info, $target_branch); |
fix pull_request table bug
|
107 |
|
add --no-ff option to merge ...
|
108 |
my $message; |
fix tests
|
109 |
my $target_user_id = $target_rep_info->{user}; |
add --no-ff option to merge ...
|
110 |
if (defined $pull_request_number) { |
111 |
$message = "Merge pull request #$pull_request_number from $target_user_id/$target_branch"; |
|
112 |
} |
|
113 |
else { |
|
114 |
$message = "Merge from $target_user_id/$target_branch"; |
|
115 |
} |
|
116 |
|
|
117 |
# Merge |
|
cleanup merge and push logic
|
118 |
my @git_merge_cmd = $self->app->git->cmd( |
119 |
$work_rep_info, |
|
120 |
'merge', |
|
add --no-ff option to merge ...
|
121 |
'--no-ff', |
122 |
"--message=$message", |
|
fix pull_request table bug
|
123 |
$object_id |
cleanup merge and push logic
|
124 |
); |
add --no-ff option to merge ...
|
125 |
# |
cleanup merge and push logic
|
126 |
|
127 |
my $success = Gitprep::Util::run_command(@git_merge_cmd); |
|
128 |
|
|
129 |
return $success; |
|
130 |
} |
|
131 | ||
132 |
sub push { |
|
fix merge pull request bug
|
133 |
my ($self, $work_rep_info, $base_branch) = @_; |
cleanup merge and push logic
|
134 |
|
135 |
# Push |
|
fix merge pull request bug
|
136 |
my $tmp_branch = $self->_tmp_branch; |
137 |
my @git_push_cmd = $self->app->git->cmd( |
|
138 |
$work_rep_info, |
|
139 |
'push', |
|
140 |
'origin', |
|
141 |
"$tmp_branch:$base_branch" |
|
142 |
); |
|
cleanup merge and push logic
|
143 |
Gitprep::Util::run_command(@git_push_cmd) |
144 |
or Carp::croak "Can't execute git push: @git_push_cmd"; |
|
145 |
} |
|
146 | ||
cleanup prepare merge
|
147 |
sub lock_rep { |
148 |
my ($self, $rep_info) = @_; |
|
149 |
|
|
150 |
my $git_dir = $rep_info->{git_dir}; |
|
151 |
my $lock_file = "$git_dir/config"; |
|
152 |
|
|
153 |
open my $lock_fh, '<', $lock_file |
|
154 |
or croak "Can't open lock file $lock_file: $!"; |
|
155 |
|
|
156 |
flock $lock_fh, LOCK_EX |
|
157 |
or croak "Can't lock $lock_file"; |
|
158 |
|
|
159 |
return $lock_fh; |
|
160 |
} |
|
161 | ||
cleanup
|
162 |
sub create_work_rep { |
improve create working repos...
|
163 |
my ($self, $user, $project) = @_; |
164 |
|
|
cleanup create working direc...
|
165 |
# Remote repository |
166 |
my $rep_info = $self->app->rep_info($user, $project); |
|
167 |
my $rep_git_dir = $rep_info->{git_dir}; |
|
168 |
|
|
169 |
# Working repository |
|
170 |
my $work_rep_info = $self->app->work_rep_info($user, $project); |
|
171 |
my $work_tree = $work_rep_info->{work_tree}; |
|
172 |
|
|
improve create working repos...
|
173 |
# Create working repository if it don't exist |
cleanup create working direc...
|
174 |
unless (-e $work_tree) { |
175 | ||
improve create working repos...
|
176 |
# git clone |
cleanup create working direc...
|
177 |
my @git_clone_cmd = ($self->app->git->bin, 'clone', $rep_git_dir, $work_tree); |
improve create working repos...
|
178 |
Gitprep::Util::run_command(@git_clone_cmd) |
179 |
or croak "Can't git clone: @git_clone_cmd"; |
|
cleanup compare logic
|
180 |
|
improve create working repos...
|
181 |
# Set user name |
cleanup create working direc...
|
182 |
my @git_config_user_name = $self->app->git->cmd( |
183 |
$work_rep_info, |
|
improve create working repos...
|
184 |
'config', |
185 |
'user.name', |
|
186 |
$user |
|
187 |
); |
|
188 |
Gitprep::Util::run_command(@git_config_user_name) |
|
189 |
or croak "Can't execute git config: @git_config_user_name"; |
|
190 |
|
|
fix mail bug
|
191 |
# Set user email |
192 |
my $user_email = $self->app->dbi->model('user')->select('email', where => {id => $user})->value; |
|
193 |
my @git_config_user_email = $self->app->git->cmd( |
|
cleanup create working direc...
|
194 |
$work_rep_info, |
improve create working repos...
|
195 |
'config', |
196 |
'user.email', |
|
fix mail bug
|
197 |
"$user_email" |
improve create working repos...
|
198 |
); |
fix mail bug
|
199 |
Gitprep::Util::run_command(@git_config_user_email) |
200 |
or croak "Can't execute git config: @git_config_user_email"; |
|
improve create working repos...
|
201 |
} |
202 |
} |
|
203 | ||
added admin tests
|
204 |
sub admin_user { |
cleanup
|
205 |
my $self = shift; |
206 |
|
|
207 |
# Admin user |
|
208 |
my $admin_user = $self->app->dbi->model('user') |
|
added admin tests
|
209 |
->select(where => {admin => 1})->one; |
cleanup
|
210 |
|
211 |
return $admin_user; |
|
212 |
} |
|
213 | ||
fixed tags page paging bug a...
|
214 |
sub default_branch { |
fix project page
|
215 |
my ($self, $user_id, $project_id, $default_branch) = @_; |
216 |
|
|
217 |
my $user_row_id = $self->api->get_user_row_id($user_id); |
|
fixed tags page paging bug a...
|
218 |
|
added default branch change ...
|
219 |
# Set default branch |
220 |
my $dbi = $self->app->dbi; |
|
221 |
if (defined $default_branch) { |
|
222 |
$dbi->model('project')->update( |
|
223 |
{default_branch => $default_branch}, |
|
fix project page
|
224 |
where => {user => $user_row_id, id => $project_id} |
added default branch change ...
|
225 |
); |
226 |
} |
|
227 |
else { |
|
228 |
# Get default branch |
|
229 |
my $default_branch = $dbi->model('project') |
|
fix project page
|
230 |
->select('default_branch', where => {user => $user_row_id, id => $project_id}) |
added default branch change ...
|
231 |
->value; |
232 |
|
|
233 |
return $default_branch; |
|
234 |
} |
|
fixed tags page paging bug a...
|
235 |
} |
236 | ||
show deleted repository in u...
|
237 |
sub fork_project { |
cleanup
|
238 |
my ($self, $forked_user_id, $user_id, $project_id) = @_; |
fix fork
|
239 |
|
cleanup
|
240 |
my $user_row_id = $self->api->get_user_row_id($user_id); |
show deleted repository in u...
|
241 |
|
242 |
# Fork project |
|
243 |
my $dbi = $self->app->dbi; |
|
244 |
my $error; |
|
245 |
eval { |
|
246 |
$dbi->connector->txn(sub { |
|
247 |
|
|
248 |
# Original project id |
|
fix fork
|
249 |
my $project = $dbi->model('project')->select( |
cleanup
|
250 |
{__MY__ => ['row_id', 'private']}, |
cleanup join table
|
251 |
where => {'__user.id' => $user_id, 'project.id' => $project_id} |
version up and add descripti...
|
252 |
)->one; |
253 |
|
|
show deleted repository in u...
|
254 |
# Create project |
255 |
eval { |
|
256 |
$self->_create_project( |
|
cleanup
|
257 |
$forked_user_id, |
fix fork
|
258 |
$project_id, |
show deleted repository in u...
|
259 |
{ |
fix fork
|
260 |
original_project => $project->{row_id}, |
261 |
private => $project->{private} |
|
show deleted repository in u...
|
262 |
} |
263 |
); |
|
264 |
}; |
|
265 |
croak $error = $@ if $@; |
|
266 |
|
|
267 |
# Create repository |
|
268 |
eval { |
|
cleanup
|
269 |
$self->_fork_rep($user_id, $project_id, $forked_user_id, $project_id); |
show deleted repository in u...
|
270 |
}; |
271 |
croak $error = $@ if $@; |
|
272 |
}); |
|
273 |
}; |
|
274 |
croak $error if $@; |
|
275 |
} |
|
276 | ||
cleanup
|
277 |
sub is_admin { |
fix project page
|
278 |
my ($self, $user_id) = @_; |
cleanup
|
279 |
|
280 |
# Check admin |
|
281 |
my $is_admin = $self->app->dbi->model('user') |
|
fix project page
|
282 |
->select('admin', where => {id => $user_id})->value; |
cleanup
|
283 |
|
284 |
return $is_admin; |
|
285 |
} |
|
286 | ||
add private checkbox
|
287 |
sub is_private_project { |
fix project page
|
288 |
my ($self, $user_id, $project_id) = @_; |
289 |
|
|
290 |
my $user_row_id = $self->api->get_user_row_id($user_id); |
|
add private checkbox
|
291 |
|
292 |
# Is private |
|
fix setting page
|
293 |
my $private = $self->app->dbi->model('project')->select( |
294 |
'private', where => {user => $user_row_id, id => $project_id} |
|
295 |
)->value; |
|
add private checkbox
|
296 |
|
297 |
return $private; |
|
298 |
} |
|
299 | ||
fix project page
|
300 |
sub api { shift->app->gitprep_api } |
301 | ||
302 | ||
fix network page
|
303 |
sub member_projects { |
fix project page
|
304 |
my ($self, $user_id, $project_id) = @_; |
305 |
|
|
fixed tags page paging bug a...
|
306 |
# DBI |
307 |
my $dbi = $self->app->dbi; |
|
308 |
|
|
cleanup
|
309 |
# project id |
310 |
my $project_row_id = $dbi->model('project')->select( |
|
311 |
'project.row_id', |
|
cleanup join table
|
312 |
where => {'__user.id' => $user_id, 'project.id' => $project_id} |
cleanup
|
313 |
)->value; |
fixed tags page paging bug a...
|
314 |
|
315 |
# Members |
|
cleanup
|
316 |
my $member_projects = $dbi->model('project')->select( |
fix project page
|
317 |
[ |
fix network page
|
318 |
{__MY__ => ['id']}, |
cleanup join table
|
319 |
{__user => ['id']} |
fix project page
|
320 |
], |
fix network page
|
321 |
where => { |
322 |
original_project => $project_row_id, |
|
323 |
}, |
|
cleanup join table
|
324 |
append => 'order by __user.id, project.id' |
fixed tags page paging bug a...
|
325 |
)->all; |
326 | ||
cleanup
|
327 |
return $member_projects; |
fixed tags page paging bug a...
|
328 |
} |
329 | ||
330 |
sub create_project { |
|
fix fork
|
331 |
my ($self, $user_id, $project_id, $opts) = @_; |
fixed tags page paging bug a...
|
332 |
|
add private checkbox to new ...
|
333 |
my $params = {}; |
334 |
if ($opts->{private}) { |
|
335 |
$params->{private} = 1; |
|
336 |
} |
|
337 |
|
|
fixed tags page paging bug a...
|
338 |
# Create project |
fixed bug that setting page ...
|
339 |
my $dbi = $self->app->dbi; |
fixed tags page paging bug a...
|
340 |
my $error; |
341 |
eval { |
|
342 |
$dbi->connector->txn(sub { |
|
fix fork
|
343 |
eval { $self->_create_project($user_id, $project_id, $params) }; |
fixed tags page paging bug a...
|
344 |
croak $error = $@ if $@; |
fix fork
|
345 |
eval {$self->_create_rep($user_id, $project_id, $opts) }; |
fixed tags page paging bug a...
|
346 |
croak $error = $@ if $@; |
347 |
}); |
|
348 |
}; |
|
349 |
croak $error if $@; |
|
350 |
} |
|
351 | ||
352 |
sub create_user { |
|
353 |
my ($self, $user, $data) = @_; |
|
354 | ||
355 |
# Create user |
|
fixed bug that setting page ...
|
356 |
my $dbi = $self->app->dbi; |
fixed tags page paging bug a...
|
357 |
my $error; |
358 |
eval { |
|
359 |
$dbi->connector->txn(sub { |
|
360 |
eval { $self->_create_db_user($user, $data) }; |
|
361 |
croak $error = $@ if $@; |
|
362 |
eval {$self->_create_user_dir($user) }; |
|
363 |
croak $error = $@ if $@; |
|
364 |
}); |
|
365 |
}; |
|
366 |
croak $error if $@; |
|
367 |
} |
|
368 | ||
369 |
sub delete_project { |
|
370 |
my ($self, $user, $project) = @_; |
|
371 |
|
|
372 |
# Delete project |
|
fixed bug that setting page ...
|
373 |
my $dbi = $self->app->dbi; |
fixed tags page paging bug a...
|
374 |
my $error; |
375 |
eval { |
|
376 |
$dbi->connector->txn(sub { |
|
377 |
eval { $self->_delete_project($user, $project) }; |
|
378 |
croak $error = $@ if $@; |
|
379 |
eval {$self->_delete_rep($user, $project) }; |
|
380 |
croak $error = $@ if $@; |
|
381 |
}); |
|
382 |
}; |
|
383 |
croak $error if $@; |
|
384 |
} |
|
385 | ||
386 |
sub delete_user { |
|
387 |
my ($self, $user) = @_; |
|
388 |
|
|
389 |
# Delete user |
|
fixed bug that setting page ...
|
390 |
my $dbi = $self->app->dbi; |
fixed tags page paging bug a...
|
391 |
my $error; |
added delete user test
|
392 |
my $count; |
fixed tags page paging bug a...
|
393 |
eval { |
394 |
$dbi->connector->txn(sub { |
|
added delete user test
|
395 |
eval { $count = $self->_delete_db_user($user) }; |
fixed tags page paging bug a...
|
396 |
croak $error = $@ if $@; |
397 |
eval {$self->_delete_user_dir($user) }; |
|
398 |
croak $error = $@ if $@; |
|
399 |
}); |
|
400 |
}; |
|
401 |
croak $error if $@; |
|
added delete user test
|
402 |
|
403 |
return $count; |
|
fixed tags page paging bug a...
|
404 |
} |
405 | ||
406 |
sub original_project { |
|
fix project page
|
407 |
my ($self, $user_id, $project_id) = @_; |
408 |
|
|
409 |
my $user_row_id = $self->api->get_user_row_id($user_id); |
|
fixed tags page paging bug a...
|
410 |
|
cleanup delete original_proj...
|
411 |
# Original project id |
412 |
my $dbi = $self->app->dbi; |
|
fix project page
|
413 |
my $original_project_row_id = $dbi->model('project')->select( |
414 |
'original_project', |
|
415 |
where => {user => $user_row_id, id => $project_id} |
|
416 |
)->value; |
|
cleanup delete original_proj...
|
417 |
|
fix project page
|
418 |
croak "Original project don't eixsts." unless defined $original_project_row_id; |
cleanup delete original_proj...
|
419 |
|
fixed bug that setting page ...
|
420 |
# Original project |
cleanup delete original_proj...
|
421 |
my $original_project = $dbi->model('project')->select( |
fix project page
|
422 |
[ |
423 |
{__MY__ => '*'}, |
|
cleanup join table
|
424 |
{__user => ['id']} |
fix project page
|
425 |
], |
cleanup delete original_proj...
|
426 |
where => { |
fix project page
|
427 |
'project.row_id' => $original_project_row_id |
cleanup delete original_proj...
|
428 |
} |
fix project page
|
429 |
)->one; |
cleanup delete original_proj...
|
430 |
|
fix project page
|
431 |
return unless defined $original_project; |
fixed tags page paging bug a...
|
432 |
|
433 |
return $original_project; |
|
434 |
} |
|
435 | ||
get target branch logic
|
436 |
sub child_project { |
437 |
my ($self, $user_id, $project_id, $child_user_id) = @_; |
|
438 |
|
|
439 |
my $project_row_id = $self->app->dbi->model('project')->select( |
|
cleanup join table
|
440 |
'project.row_id', where => {'__user.id' => $user_id, 'project.id' => $project_id} |
get target branch logic
|
441 |
)->value; |
442 |
|
|
443 |
my $child_project = $self->app->dbi->model('project')->select( |
|
444 |
[ |
|
445 |
{__MY__ => '*'}, |
|
improve compare page popup
|
446 |
{__user => ['id']} |
get target branch logic
|
447 |
], |
448 |
where => { |
|
449 |
'project.original_project' => $project_row_id, |
|
cleanup join table
|
450 |
'__user.id' => $child_user_id |
get target branch logic
|
451 |
} |
452 |
)->one; |
|
453 |
|
|
454 |
return $child_project; |
|
455 |
} |
|
456 | ||
show deleted repository in u...
|
457 |
sub projects { |
fix user page
|
458 |
my ($self, $user_id) = @_; |
459 |
|
|
460 |
my $user_row_id = $self->app->dbi->model('user')->select('row_id', where => {id => $user_id})->value; |
|
461 |
|
|
show deleted repository in u...
|
462 |
# Projects |
463 |
my $projects = $self->app->dbi->model('project')->select( |
|
fix user page
|
464 |
where => {user => $user_row_id}, |
465 |
append => 'order by id' |
|
show deleted repository in u...
|
466 |
)->all; |
467 |
|
|
468 |
return $projects; |
|
469 |
} |
|
470 | ||
cleanup
|
471 |
sub users { |
472 |
my $self = shift; |
|
fixed bug that setting page ...
|
473 |
|
474 |
# Users |
|
cleanup
|
475 |
my $users = $self->app->dbi->model('user')->select( |
476 |
where => [':admin{<>}',{admin => 1}], |
|
477 |
append => 'order by id' |
|
478 |
)->all; |
|
479 |
|
|
480 |
return $users; |
|
481 |
} |
|
482 | ||
fixed tags page paging bug a...
|
483 |
sub rename_project { |
show deleted repository in u...
|
484 |
my ($self, $user, $project, $to_project) = @_; |
fixed tags page paging bug a...
|
485 |
|
show deleted repository in u...
|
486 |
# Rename project |
revert encoding support
|
487 |
my $git = $self->app->git; |
fixed tags page paging bug a...
|
488 |
my $dbi = $self->app->dbi; |
simplify rename project
|
489 |
my $error; |
490 |
eval { |
|
fixed tags page paging bug a...
|
491 |
$dbi->connector->txn(sub { |
simplify rename project
|
492 |
eval { $self->_rename_project($user, $project, $to_project) }; |
493 |
croak $error = $@ if $@; |
|
494 |
eval { $self->_rename_rep($user, $project, $to_project) }; |
|
495 |
croak $error = $@ if $@; |
|
fixed tags page paging bug a...
|
496 |
}); |
simplify rename project
|
497 |
}; |
498 |
croak $error if $error; |
|
fixed tags page paging bug a...
|
499 |
} |
500 | ||
add key delete feature and u...
|
501 |
sub update_authorized_keys_file { |
502 |
my $self = shift; |
|
503 | ||
504 |
my $authorized_keys_file = $self->authorized_keys_file; |
|
505 |
if (defined $authorized_keys_file) { |
|
506 |
|
|
507 |
# Lock file |
|
fix update_authorized_keys_f...
|
508 |
my $lock_file = $self->app->home->rel_file('lock/authorized_keys'); |
add key delete feature and u...
|
509 |
open my $lock_fh, $lock_file |
510 |
or croak "Can't open lock file $lock_file"; |
|
511 |
flock $lock_fh, LOCK_EX |
|
512 |
or croak "Can't lock $lock_file"; |
|
513 |
|
|
514 |
# Create authorized_keys_file |
|
515 |
unless (-f $authorized_keys_file) { |
|
516 |
open my $fh, '>', $authorized_keys_file |
|
fix gitprep-shell
|
517 |
or croak "Can't create authorized_keys file: $authorized_keys_file"; |
518 |
chmod 0600, $authorized_keys_file |
|
519 |
or croak "Can't chmod authorized_keys file: $authorized_keys_file"; |
|
add key delete feature and u...
|
520 |
} |
521 |
|
|
522 |
# Parse file |
|
forbidden public key which i...
|
523 |
my $result = $self->parse_authorized_keys_file($authorized_keys_file); |
fix update_authorized_keys_f...
|
524 |
my $before_part = $result->{before_part}; |
525 |
my $gitprep_part = $result->{gitprep_part}; |
|
526 |
my $after_part = $result->{after_part}; |
|
527 |
my $start_symbol = $result->{start_symbol}; |
|
528 |
my $end_symbol = $result->{end_symbol}; |
|
add key delete feature and u...
|
529 |
|
530 |
# Backup at first time |
|
531 |
if ($gitprep_part eq '') { |
|
532 |
# Backup original file |
|
533 |
my $to = "$authorized_keys_file.gitprep.original"; |
|
534 |
unless (-f $to) { |
|
535 |
copy $authorized_keys_file, $to |
|
536 |
or croak "Can't copy $authorized_keys_file to $to"; |
|
537 |
} |
|
538 |
} |
|
fix update_authorized_keys_f...
|
539 | |
add key delete feature and u...
|
540 |
# Create public keys |
fix ssh public key bug
|
541 |
my $ssh_public_keys = $self->app->dbi->model('ssh_public_key')->select( |
542 |
[ |
|
543 |
{__MY__ => '*'}, |
|
544 |
{__user => ['id']} |
|
545 |
] |
|
546 |
)->all; |
|
add key delete feature and u...
|
547 |
my $ssh_public_keys_str = ''; |
548 |
for my $key (@$ssh_public_keys) { |
|
fix permission bug
|
549 |
my $ssh_public_key_str = 'command="' . $self->app->home->rel_file('script/gitprep-shell') |
fix ssh public key bug
|
550 |
. " $key->{'__user.id'}\",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty $key->{key}"; |
551 |
$ssh_public_keys_str .= "$ssh_public_key_str $key->{'__user.id'}\n\n"; |
|
add key delete feature and u...
|
552 |
} |
553 |
|
|
554 |
# Output tmp file |
|
fix gitprep-shell
|
555 |
my $output = "$before_part$start_symbol\n\n$ssh_public_keys_str$end_symbol$after_part"; |
add key delete feature and u...
|
556 |
my $output_file = "$authorized_keys_file.gitprep.tmp"; |
557 |
open my $out_fh, '>', $output_file |
|
558 |
or croak "Can't create authorized_keys tmp file $output_file"; |
|
559 |
print $out_fh $output; |
|
560 |
close $out_fh |
|
561 |
or croak "Can't close authorized_keys tmp file $output_file"; |
|
fix update_authorized_keys_f...
|
562 | |
add key delete feature and u...
|
563 |
# Replace |
fix permission bug
|
564 |
chmod 0600, $output_file |
565 |
or croak "Can't chmod authorized_keys tmp file: $output_file"; |
|
add key delete feature and u...
|
566 |
move $output_file, $authorized_keys_file |
567 |
or croak "Can't replace $authorized_keys_file by $output_file"; |
|
568 |
} |
|
569 |
else { |
|
570 |
croak qq/authorized_keys file "$authorized_keys_file" is not found./; |
|
571 |
} |
|
572 |
} |
|
573 | ||
forbidden public key which i...
|
574 |
sub parse_authorized_keys_file { |
fix update_authorized_keys_f...
|
575 |
my ($self, $file) = @_; |
add key delete feature and u...
|
576 |
|
577 |
my $start_symbol = "# gitprep start"; |
|
578 |
my $end_symbol = "# gitprep end"; |
|
579 |
|
|
580 |
# Parse |
|
581 |
open my $fh, '<', $file |
|
fix update_authorized_keys_f...
|
582 |
or croak "Can't open authorized_key file $file"; |
add key delete feature and u...
|
583 |
my $start_symbol_count = 0; |
584 |
my $end_symbol_count = 0; |
|
585 |
my $before_part = ''; |
|
586 |
my $gitprep_part = ''; |
|
587 |
my $after_part = ''; |
|
588 |
my $error_prefix = "authorized_keys file $file format error:"; |
|
589 |
while (my $line = <$fh>) { |
|
590 |
if ($line =~ /^$start_symbol/) { |
|
591 |
if ($start_symbol_count > 0) { |
|
592 |
croak qq/$error_prefix "$start_symbol" is found more than one/; |
|
593 |
} |
|
594 |
else { |
|
595 |
if ($end_symbol_count > 0) { |
|
596 |
croak qq/$error_prefix "$end_symbol" is found before "$start_symbol"/; |
|
597 |
} |
|
598 |
else { |
|
599 |
$start_symbol_count++; |
|
600 |
} |
|
601 |
} |
|
602 |
} |
|
603 |
elsif ($line =~ /^$end_symbol/) { |
|
fix ssh key authentication b...
|
604 |
if ($end_symbol_count > 0) { |
add key delete feature and u...
|
605 |
croak qq/$error_prefix "$end_symbol" is found more than one/; |
606 |
} |
|
607 |
else { |
|
fix gitprep-shell
|
608 |
$end_symbol_count++; |
add key delete feature and u...
|
609 |
} |
610 |
} |
|
611 |
elsif ($start_symbol_count == 0 && $end_symbol_count == 0) { |
|
612 |
$before_part .= $line; |
|
613 |
} |
|
614 |
elsif ($start_symbol_count == 1 && $end_symbol_count == 0) { |
|
615 |
$gitprep_part .= $line; |
|
616 |
} |
|
617 |
elsif ($start_symbol_count == 1 && $end_symbol_count == 1) { |
|
618 |
$after_part .= $line; |
|
619 |
} |
|
620 |
} |
|
fix update_authorized_keys_f...
|
621 |
|
622 |
my $result = { |
|
623 |
start_symbol => $start_symbol, |
|
624 |
end_symbol => $end_symbol, |
|
625 |
before_part => $before_part, |
|
626 |
gitprep_part => $gitprep_part, |
|
627 |
after_part => $after_part |
|
628 |
}; |
|
629 |
|
|
630 |
return $result; |
|
add key delete feature and u...
|
631 |
} |
632 | ||
fixed tags page paging bug a...
|
633 |
sub _create_project { |
fix fork
|
634 |
my ($self, $user_id, $project_id, $params) = @_; |
635 |
|
|
636 |
my $user_row_id = $self->api->get_user_row_id($user_id); |
|
fixed tags page paging bug a...
|
637 |
$params ||= {}; |
fix fork
|
638 |
$params->{user} = $user_row_id; |
639 |
$params->{id} = $project_id; |
|
fixed tags page paging bug a...
|
640 |
|
641 |
# Create project |
|
cleanup
|
642 |
my $dbi = $self->app->dbi; |
fixed tags page paging bug a...
|
643 |
$dbi->connector->txn(sub { |
fix fork
|
644 |
$dbi->model('project')->insert($params); |
fixed tags page paging bug a...
|
645 |
}); |
646 |
} |
|
647 | ||
648 |
sub _create_rep { |
|
649 |
my ($self, $user, $project, $opts) = @_; |
|
650 |
|
|
651 |
# Create repository directory |
|
revert encoding support
|
652 |
my $git = $self->app->git; |
remove rep_path
|
653 |
|
654 |
my $rep_info = $self->app->rep_info($user, $project); |
|
655 |
my $rep_git_dir = $rep_info->{git_dir}; |
|
656 |
|
|
657 |
mkdir $rep_git_dir |
|
658 |
or croak "Can't create directory $rep_git_dir: $!"; |
|
fix bug that in CGI reposito...
|
659 |
|
fixed tags page paging bug a...
|
660 |
eval { |
661 |
# Git init |
|
662 |
{ |
|
remove cmd_dir
|
663 |
my @git_init_cmd = $git->cmd($rep_info, 'init', '--bare'); |
fix bug that in CGI reposito...
|
664 |
Gitprep::Util::run_command(@git_init_cmd) |
fix git 2.0 create repositor...
|
665 |
or croak "Can't execute git init --bare:@git_init_cmd"; |
fixed tags page paging bug a...
|
666 |
} |
667 |
|
|
668 |
# Add git-daemon-export-ok |
|
669 |
{ |
|
remove rep_path
|
670 |
my $file = "$rep_git_dir/git-daemon-export-ok"; |
fixed tags page paging bug a...
|
671 |
open my $fh, '>', $file |
672 |
or croak "Can't create git-daemon-export-ok: $!" |
|
673 |
} |
|
674 |
|
|
675 |
# HTTP support |
|
remove cmd_dir
|
676 |
my @git_update_server_info_cmd = $git->cmd( |
677 |
$rep_info, |
|
fixed tags page paging bug a...
|
678 |
'--bare', |
679 |
'update-server-info' |
|
680 |
); |
|
fix bug that in CGI reposito...
|
681 |
Gitprep::Util::run_command(@git_update_server_info_cmd) |
fix git 2.0 create repositor...
|
682 |
or croak "Can't execute git --bare update-server-info"; |
remove rep_path
|
683 |
move("$rep_git_dir/hooks/post-update.sample", "$rep_git_dir/hooks/post-update") |
fixed tags page paging bug a...
|
684 |
or croak "Can't move post-update"; |
685 |
|
|
686 |
# Description |
|
version up and add descripti...
|
687 |
my $description = $opts->{description}; |
688 |
$description = '' unless defined $description; |
|
fixed tags page paging bug a...
|
689 |
{ |
remove rep_path
|
690 |
my $file = "$rep_git_dir/description"; |
fixed tags page paging bug a...
|
691 |
open my $fh, '>', $file |
692 |
or croak "Can't open $file: $!"; |
|
693 |
print $fh encode('UTF-8', $description) |
|
694 |
or croak "Can't write $file: $!"; |
|
695 |
close $fh; |
|
696 |
} |
|
697 |
|
|
698 |
# Add README and commit |
|
699 |
if ($opts->{readme}) { |
|
700 |
# Create working directory |
|
use own tmp directory to cre...
|
701 |
my $home_tmp_dir = $self->app->home->rel_file('tmp'); |
702 |
|
|
remove cmd_work_dir
|
703 |
# Temp directory |
use own tmp directory to cre...
|
704 |
my $temp_dir = File::Temp->newdir(DIR => $home_tmp_dir); |
remove cmd_work_dir
|
705 |
|
706 |
# Working repository |
|
707 |
my $work_rep_work_tree = "$temp_dir/work"; |
|
708 |
my $work_rep_git_dir = "$work_rep_work_tree/.git"; |
|
709 |
my $work_rep_info = { |
|
710 |
work_tree => $work_rep_work_tree, |
|
711 |
git_dir => $work_rep_git_dir |
|
712 |
}; |
|
713 |
|
|
714 |
mkdir $work_rep_work_tree |
|
715 |
or croak "Can't create directory $work_rep_work_tree: $!"; |
|
use own tmp directory to cre...
|
716 |
|
fixed tags page paging bug a...
|
717 |
# Git init |
remove cmd_work_dir
|
718 |
my @git_init_cmd = $git->cmd($work_rep_info, 'init', '-q'); |
fix bug that in CGI reposito...
|
719 |
Gitprep::Util::run_command(@git_init_cmd) |
fix git 2.0 create repositor...
|
720 |
or croak "Can't execute git init: @git_init_cmd"; |
fixed tags page paging bug a...
|
721 |
|
722 |
# Add README |
|
remove cmd_work_dir
|
723 |
my $file = "$work_rep_work_tree/README.md"; |
default readme file is chang...
|
724 |
open my $readme_fh, '>', $file |
fixed tags page paging bug a...
|
725 |
or croak "Can't create $file: $!"; |
version up and add descripti...
|
726 |
print $readme_fh "# $project\n"; |
727 |
print $readme_fh "\n" . encode('UTF-8', $description) . "\n"; |
|
default readme file is chang...
|
728 |
close $readme_fh; |
729 |
|
|
remove cmd_work_dir
|
730 |
my @git_add_cmd = $git->cmd( |
731 |
$work_rep_info, |
|
fixed tags page paging bug a...
|
732 |
'add', |
default readme file is chang...
|
733 |
'README.md' |
fixed tags page paging bug a...
|
734 |
); |
improve create working repos...
|
735 |
|
fix bug that in CGI reposito...
|
736 |
Gitprep::Util::run_command(@git_add_cmd) |
fix git 2.0 create repositor...
|
737 |
or croak "Can't execute git add: @git_add_cmd"; |
fixed tags page paging bug a...
|
738 |
|
fix bug that repository with...
|
739 |
# Set user name |
remove cmd_work_dir
|
740 |
my @git_config_user_name = $git->cmd( |
741 |
$work_rep_info, |
|
fix bug that repository with...
|
742 |
'config', |
743 |
'user.name', |
|
744 |
$user |
|
745 |
); |
|
746 |
Gitprep::Util::run_command(@git_config_user_name) |
|
747 |
or croak "Can't execute git config: @git_config_user_name"; |
|
748 |
|
|
fix mail bug
|
749 |
# Set user email |
750 |
my $user_email = $self->app->dbi->model('user')->select('email', where => {id => $user})->value; |
|
751 |
my @git_config_user_email = $git->cmd( |
|
remove cmd_work_dir
|
752 |
$work_rep_info, |
fix bug that repository with...
|
753 |
'config', |
754 |
'user.email', |
|
fix mail bug
|
755 |
"$user_email" |
fix bug that repository with...
|
756 |
); |
fix mail bug
|
757 |
Gitprep::Util::run_command(@git_config_user_email) |
758 |
or croak "Can't execute git config: @git_config_user_email"; |
|
fix bug that repository with...
|
759 |
|
fixed tags page paging bug a...
|
760 |
# Commit |
remove cmd_work_dir
|
761 |
my @git_commit_cmd = $git->cmd( |
762 |
$work_rep_info, |
|
fixed tags page paging bug a...
|
763 |
'commit', |
764 |
'-q', |
|
765 |
'-m', |
|
766 |
'first commit' |
|
767 |
); |
|
fix bug that in CGI reposito...
|
768 |
Gitprep::Util::run_command(@git_commit_cmd) |
fix git 2.0 create repositor...
|
769 |
or croak "Can't execute git commit: @git_commit_cmd"; |
fixed tags page paging bug a...
|
770 |
|
771 |
# Push |
|
772 |
{ |
|
remove cmd_work_dir
|
773 |
my @git_push_cmd = $git->cmd( |
774 |
$work_rep_info, |
|
fixed tags page paging bug a...
|
775 |
'push', |
776 |
'-q', |
|
remove rep_path
|
777 |
$rep_git_dir, |
fixed tags page paging bug a...
|
778 |
'master' |
779 |
); |
|
780 |
# (This is bad, but --quiet option can't supress in old git) |
|
fix bug that in CGI reposito...
|
781 |
Gitprep::Util::run_command(@git_push_cmd) |
fix git 2.0 create repositor...
|
782 |
or croak "Can't execute git push: @git_push_cmd"; |
fixed tags page paging bug a...
|
783 |
} |
784 |
} |
|
785 |
}; |
|
improve faq of pushing lerge...
|
786 |
if (my $e = $@) { |
remove rep_path
|
787 |
rmtree $rep_git_dir; |
improve faq of pushing lerge...
|
788 |
croak $e; |
fixed tags page paging bug a...
|
789 |
} |
790 |
} |
|
791 | ||
show deleted repository in u...
|
792 |
sub _create_db_user { |
fix project page
|
793 |
my ($self, $user_id, $data) = @_; |
794 |
|
|
795 |
$data->{id} = $user_id; |
|
show deleted repository in u...
|
796 |
|
797 |
# Create database user |
|
fix project page
|
798 |
$self->app->dbi->model('user')->insert($data); |
show deleted repository in u...
|
799 |
} |
800 | ||
801 |
sub _create_user_dir { |
|
802 |
my ($self, $user) = @_; |
|
803 |
|
|
804 |
# Create user directory |
|
cleanup ->rep_home
|
805 |
my $rep_home = $self->app->rep_home; |
show deleted repository in u...
|
806 |
my $user_dir = "$rep_home/$user"; |
807 |
mkpath $user_dir; |
|
808 |
} |
|
809 | ||
810 |
sub _delete_db_user { |
|
fix project page
|
811 |
my ($self, $user_id) = @_; |
show deleted repository in u...
|
812 |
|
813 |
# Delete database user |
|
fix project page
|
814 |
my $count = $self->app->dbi->model('user')->delete(where => {id => $user_id}); |
added delete user test
|
815 |
|
816 |
return $count; |
|
show deleted repository in u...
|
817 |
} |
818 | ||
819 |
sub _delete_user_dir { |
|
820 |
my ($self, $user) = @_; |
|
821 |
|
|
822 |
# Delete user directory |
|
cleanup ->rep_home
|
823 |
my $rep_home = $self->app->rep_home; |
show deleted repository in u...
|
824 |
my $user_dir = "$rep_home/$user"; |
825 |
rmtree $user_dir; |
|
826 |
} |
|
827 | ||
fixed tags page paging bug a...
|
828 |
sub _delete_project { |
fix project page
|
829 |
my ($self, $user_id, $project_id) = @_; |
830 |
|
|
831 |
my $user_row_id = $self->api->get_user_row_id($user_id); |
|
fixed tags page paging bug a...
|
832 |
|
cleanup
|
833 |
# Delete project |
fixed tags page paging bug a...
|
834 |
my $dbi = $self->app->dbi; |
fix project page
|
835 |
$dbi->model('project')->delete(where => {user => $user_row_id, id => $project_id}); |
fixed tags page paging bug a...
|
836 |
} |
837 | ||
838 |
sub _delete_rep { |
|
839 |
my ($self, $user, $project) = @_; |
|
840 | ||
cleanup
|
841 |
# Delete repository |
cleanup ->rep_home
|
842 |
my $rep_home = $self->app->rep_home; |
add missing 'o'
|
843 |
croak "Can't remove repository. repository home is empty" |
fixed tags page paging bug a...
|
844 |
if !defined $rep_home || $rep_home eq ''; |
845 |
my $rep = "$rep_home/$user/$project.git"; |
|
846 |
rmtree $rep; |
|
847 |
croak "Can't remove repository. repository is rest" |
|
848 |
if -e $rep; |
|
849 |
} |
|
850 | ||
fixed bug that setting page ...
|
851 |
sub exists_project { |
fix project page
|
852 |
my ($self, $user_id, $project_id) = @_; |
853 |
|
|
854 |
my $user_row_id = $self->api->get_user_row_id($user_id); |
|
cleanup
|
855 |
|
856 |
# Exists project |
|
fixed tags page paging bug a...
|
857 |
my $dbi = $self->app->dbi; |
fix project page
|
858 |
my $row = $dbi->model('project')->select(where => {user => $user_row_id, id => $project_id})->one; |
fixed tags page paging bug a...
|
859 |
|
860 |
return $row ? 1 : 0; |
|
861 |
} |
|
862 | ||
add rename project and suppr...
|
863 |
sub exists_user { |
fix project page
|
864 |
my ($self, $user_id) = @_; |
add rename project and suppr...
|
865 |
|
866 |
# Exists project |
|
fix project page
|
867 |
my $row = $self->app->dbi->model('user')->select(where => {id => $user_id})->one; |
add rename project and suppr...
|
868 |
|
869 |
return $row ? 1 : 0; |
|
870 |
} |
|
871 | ||
fixed tags page paging bug a...
|
872 |
sub _exists_rep { |
873 |
my ($self, $user, $project) = @_; |
|
874 |
|
|
cleanup
|
875 |
# Exists repository |
remove rep_path
|
876 |
my $rep_info = $self->app->rep_info($user, $project); |
877 |
my $rep_git_dir = $rep_info->{git_dir}; |
|
fixed tags page paging bug a...
|
878 |
|
remove rep_path
|
879 |
return -e $rep_git_dir; |
fixed tags page paging bug a...
|
880 |
} |
881 | ||
show deleted repository in u...
|
882 |
sub _fork_rep { |
fix fork
|
883 |
my ($self, $user_id, $project_id, $to_user_id, $to_project_id) = @_; |
show deleted repository in u...
|
884 |
|
cleanup
|
885 |
# Fork repository |
revert encoding support
|
886 |
my $git = $self->app->git; |
remove rep_path
|
887 |
|
fix fork
|
888 |
my $rep_info = $self->app->rep_info($user_id, $project_id); |
remove rep_path
|
889 |
my $rep_git_dir = $rep_info->{git_dir}; |
890 |
|
|
fix fork
|
891 |
my $to_rep_info = $self->app->rep_info($to_user_id, $to_project_id); |
remove rep_path
|
892 |
my $to_rep_git_dir = $to_rep_info->{git_dir}; |
893 | ||
show deleted repository in u...
|
894 |
my @cmd = ( |
895 |
$git->bin, |
|
896 |
'clone', |
|
897 |
'-q', |
|
898 |
'--bare', |
|
remove rep_path
|
899 |
$rep_git_dir, |
900 |
$to_rep_git_dir |
|
show deleted repository in u...
|
901 |
); |
fix bug that in CGI reposito...
|
902 |
Gitprep::Util::run_command(@cmd) |
fix description file not cop...
|
903 |
or croak "Can't fork repository(_fork_rep): @cmd"; |
904 |
|
|
905 |
# Copy description |
|
remove rep_path
|
906 |
copy "$rep_git_dir/description", "$to_rep_git_dir/description" |
fix description file not cop...
|
907 |
or croak "Can't copy description file(_fork_rep)"; |
show deleted repository in u...
|
908 |
} |
909 | ||
fixed tags page paging bug a...
|
910 |
sub _rename_project { |
fix project page
|
911 |
my ($self, $user_id, $project_id, $renamed_project_id) = @_; |
912 |
|
|
913 |
my $user_row_id = $self->api->get_user_row_id($user_id); |
|
fixed tags page paging bug a...
|
914 |
|
cleanup
|
915 |
# Check arguments |
add rename project and suppr...
|
916 |
croak "Invalid parameters(_rename_project)" |
fix project page
|
917 |
unless defined $user_id && defined $project_id && defined $renamed_project_id; |
fixed tags page paging bug a...
|
918 |
|
919 |
# Rename project |
|
cleanup
|
920 |
my $dbi = $self->app->dbi; |
fixed tags page paging bug a...
|
921 |
$dbi->model('project')->update( |
fix project page
|
922 |
{id => $renamed_project_id}, |
923 |
where => {user => $user_row_id, id => $project_id} |
|
fixed tags page paging bug a...
|
924 |
); |
925 |
} |
|
926 | ||
927 |
sub _rename_rep { |
|
928 |
my ($self, $user, $project, $renamed_project) = @_; |
|
929 |
|
|
cleanup
|
930 |
# Check arguments |
fixed tags page paging bug a...
|
931 |
croak "Invalid user name or project" |
932 |
unless defined $user && defined $project && defined $renamed_project; |
|
cleanup
|
933 | |
934 |
# Rename repository |
|
remove rep_path
|
935 |
my $rep_info = $self->app->rep_info($user, $project); |
936 |
my $rep_git_dir = $rep_info->{git_dir}; |
|
937 |
|
|
938 |
my $renamed_rep_info = $self->app->rep_info($user, $renamed_project); |
|
939 |
my $renamed_rep_git_dir = $renamed_rep_info->{git_dir}; |
|
940 | ||
941 |
move($rep_git_dir, $renamed_rep_git_dir) |
|
942 |
or croak "Can't move $rep_git_dir to $renamed_rep_git_dir: $!"; |
|
fixed tags page paging bug a...
|
943 |
} |
944 | ||
945 |
1; |