line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Minilla::Release::Commit; |
2
|
1
|
|
|
1
|
|
933
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
24
|
|
4
|
1
|
|
|
1
|
|
26
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
29
|
use Minilla::Util qw(find_file cmd); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
57
|
|
7
|
1
|
|
|
1
|
|
7
|
use Minilla::Logger; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
351
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub run { |
10
|
0
|
|
|
0
|
0
|
|
my ($self, $project, $opts) = @_; |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
|
|
|
my @modified_files = split /\0/, `git ls-files --deleted --modified -z`; |
13
|
0
|
0
|
|
|
|
|
return if @modified_files == 0; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
$project->clear_metadata(); |
16
|
0
|
|
|
|
|
|
my $ver = $project->metadata->version; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $msg = "Checking in changes prior to tagging of version $ver.\n\nChangelog diff is:\n\n"; |
19
|
0
|
|
|
|
|
|
$msg .= `git diff Changes`; |
20
|
|
|
|
|
|
|
|
21
|
0
|
0
|
|
|
|
|
if ($opts->{dry_run}) { |
22
|
0
|
|
|
|
|
|
infof("DRY-RUN. Would have committed message of:\n----------------\n$msg\n-----------\n"); |
23
|
0
|
|
|
|
|
|
return; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
cmd('git', 'commit', '-a', '-m', $msg, '--cleanup=verbatim'); |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
$self->_push_to_origin(); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub _push_to_origin { |
32
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# git v1.7.10 is required? |
35
|
0
|
0
|
|
|
|
|
my $branch = `git symbolic-ref --short HEAD` |
36
|
|
|
|
|
|
|
or return; |
37
|
0
|
|
|
|
|
|
$branch =~ s/\n//g; |
38
|
0
|
|
|
|
|
|
infof("Pushing to origin\n"); |
39
|
0
|
|
|
|
|
|
cmd('git', 'push', 'origin', $branch); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|