added fork feature
|
1 |
<% |
add fork test
|
2 |
# API |
added fork feature
|
3 |
my $api = gitprep_api; |
4 |
|
|
add fork test
|
5 |
# Paramters |
6 |
my $user = param('user'); |
|
7 |
my $project = param('project'); |
|
8 |
my $current_user = session('user'); |
|
added fork feature
|
9 |
|
add fork test
|
10 |
# Can fork? |
11 |
unless ($api->logined) { |
|
12 |
$self->redirect_to('/'); |
|
13 |
return; |
|
14 |
} |
|
15 |
|
|
16 |
# Repository is already exists |
|
revert encoding support
|
17 |
if (app->manager->exists_project($current_user, $project)) { |
add fork test
|
18 |
$self->redirect_to("/$current_user/$project"); |
19 |
return; |
|
20 |
} |
|
21 |
# Fork |
|
22 |
else { |
|
revert encoding support
|
23 |
eval { app->manager->fork_project($current_user, $user, $project) }; |
improve error message
|
24 |
if (my $e = $@) { |
do success xt tests
|
25 |
$self->reply->exception('Internal Error'); |
improve error message
|
26 |
app->log->error(url_for . ": $e"); |
added fork feature
|
27 |
} |
28 |
else { |
|
add fork test
|
29 |
flash(message => "Repository is forked from /$user/$project."); |
30 |
$self->redirect_to("/$current_user/$project"); |
|
added fork feature
|
31 |
} |
fixed bug that fork return e...
|
32 |
return; |
added fork feature
|
33 |
} |
34 |
%> |