| 1 | #line 1 | ||||||||||||||||||||||
| 2 | package Module::Install::Repository; | ||||||||||||||||||||||
| 3 | 1 | ▶ | |||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 5 | 1 | use 5.008_001; | |||||||||||||||||||||
| 6 | our $VERSION = '0.02'; | ||||||||||||||||||||||
| 7 | 1 | ▶ | |||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||
| 8 | use base qw(Module::Install::Base); | ||||||||||||||||||||||
| 9 | 0 | ▶ | |||||||||||||||||||||
|
Subroutine
auto_set_repository: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||
| 10 | 0 | sub auto_set_repository { | |||||||||||||||||||||
| 11 | my $self = shift; | ||||||||||||||||||||||
| 12 | 0 | ▶ | |||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 13 | return unless $Module::Install::AUTHOR; | ||||||||||||||||||||||
| 14 | 0 | ||||||||||||||||||||||
| 15 | 0 | ▶ | my $repo = _find_repo(); | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 16 | 0 | if ($repo) { | |||||||||||||||||||||
| 17 | $self->repository($repo); | ||||||||||||||||||||||
| 18 | 0 | } else { | |||||||||||||||||||||
| 19 | warn "Cannot determine repository URL\n"; | ||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||
| 22 | 0 | ▶ | |||||||||||||||||||||
|
Subroutine
_find_repo: not called CC=16 SCAR=56.1
| |||||||||||||||||||||||
| 23 | 0 | ▶ | sub _find_repo { | ||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||
| 24 | if (-e ".git") { | ||||||||||||||||||||||
| 25 | 0 | ▶ | # TODO support remote besides 'origin'? | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 26 | if (`git remote show origin` =~ /URL: (.*)$/m) { | ||||||||||||||||||||||
| 27 | 0 | # XXX Make it public clone URL, but this only works with github | |||||||||||||||||||||
| 28 | 0 | my $git_url = $1; | |||||||||||||||||||||
| 29 | 0 | $git_url =~ s![\w\-]+\@([^:]+):!git://$1/!; | |||||||||||||||||||||
| 30 | return $git_url; | ||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||
| 32 | 0 | ▶ | } elsif (-e ".svn") { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 33 | 0 | if (`svn info` =~ /URL: (.*)$/m) { | |||||||||||||||||||||
| 34 | return $1; | ||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||
| 36 | } elsif (-e "_darcs") { | ||||||||||||||||||||||
| 37 | 0 | ▶ | # defaultrepo is better, but that is more likely to be ssh, not http | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 38 | 0 | ▶ | if (my $query_repo = `darcs query repo`) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 39 | 0 | if ($query_repo =~ m!Default Remote: (http://.+)!) { | |||||||||||||||||||||
| 40 | return $1; | ||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||
| 43 | 0 | ▶ | |||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 44 | 0 | ▶ | open my $handle, '<', '_darcs/prefs/repos' or return; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 45 | 0 | while (<$handle>) { | |||||||||||||||||||||
| 46 | 0 | ▶ | chomp; | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 47 | return $_ if m!^http://!; | ||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||
| 49 | } elsif (-e "$ENV{HOME}/.svk") { | ||||||||||||||||||||||
| 50 | 0 | ▶ | # Is there an explicit way to check if it's an svk checkout? | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 51 | my $svk_info = `svk info` or return; | ||||||||||||||||||||||
| 52 | 0 | ▶ | SVK_INFO: { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 53 | 0 | if ($svk_info =~ /Mirrored From: (.*), Rev\./) { | |||||||||||||||||||||
| 54 | return $1; | ||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||
| 56 | 0 | ▶ | |||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 57 | 0 | ▶ | if ($svk_info =~ m!Merged From: (/mirror/.*), Rev\.!) { | ||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||
| 58 | 0 | $svk_info = `svk info /$1` or return; | |||||||||||||||||||||
| 59 | redo SVK_INFO; | ||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||
| 62 | 0 | ||||||||||||||||||||||
| 63 | return; | ||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||
| 66 | 1 | ||||||||||||||||||||||
| 67 | 1; | ||||||||||||||||||||||
| 68 | __END__ | ||||||||||||||||||||||