... | ... |
@@ -23,6 +23,7 @@ has 'git'; |
23 | 23 |
has 'manager'; |
24 | 24 |
has 'vc'; |
25 | 25 |
|
26 |
+ |
|
26 | 27 |
use constant BUFFER_SIZE => 8192; |
27 | 28 |
|
28 | 29 |
sub startup { |
... | ... |
@@ -122,6 +122,18 @@ sub branches_count { |
122 | 122 |
return $branches_count; |
123 | 123 |
} |
124 | 124 |
|
125 |
+sub cmd_clone { |
|
126 |
+ my ($self, $user, $project) = @_; |
|
127 |
+ |
|
128 |
+ # Repository |
|
129 |
+ my $home = $self->rep_home; |
|
130 |
+ my $rep = "$home/$user/$project.git"; |
|
131 |
+ |
|
132 |
+ # Working directory |
|
133 |
+ my $working_dir = $self->app->home->rel_file("/data/work/$user/$project"); |
|
134 |
+ |
|
135 |
+ return ($self->bin, 'clone', $rep, $working_dir) |
|
136 |
+} |
|
125 | 137 |
sub cmd { |
126 | 138 |
my ($self, $user, $project, @cmd) = @_; |
127 | 139 |
|
... | ... |
@@ -18,7 +18,7 @@ has 'authorized_keys_file'; |
18 | 18 |
sub working_home { |
19 | 19 |
my ($self, $user, $project) = @_; |
20 | 20 |
|
21 |
- my $working_home = app->home->rel_file("data/work/$user/$project"); |
|
21 |
+ my $working_home = $self->app->home->rel_file("data/work/$user/$project"); |
|
22 | 22 |
|
23 | 23 |
return $working_home; |
24 | 24 |
} |
... | ... |
@@ -61,6 +61,10 @@ |
61 | 61 |
my $can_merge; |
62 | 62 |
if ($can_open_pull_request) { |
63 | 63 |
|
64 |
+ # Clone repository to working directory if it don't exist |
|
65 |
+ # my @git_clone_cmd = $self->app->git->cmd_clone($user, $project); |
|
66 |
+ # Gitprep::Util::run_command(@git_clone_cmd) |
|
67 |
+ # or die "Can't git clone: @git_clone_cmd"; |
|
64 | 68 |
} |
65 | 69 |
|
66 | 70 |
layout 'common', title => "Comparing $from_rev...$rev \x{30fb} $user/$project"; |
... | ... |
@@ -369,7 +369,6 @@ note 'Compare page'; |
369 | 369 |
# Page access (branch name long) |
370 | 370 |
$t->get_ok("/$user/$project/compare/refs/heads/b1...refs/heads/master"); |
371 | 371 |
$t->content_like(qr#renamed dir/a\.txt to dir/b\.txt and added text#); |
372 |
- |
|
373 | 372 |
} |
374 | 373 |
|
375 | 374 |
note 'API References'; |