Changeset 9353238 in lab.git for Dev/github/GitHubBackup.pm


Ignore:
Timestamp:
Aug 21, 2013 11:36:58 AM (11 years ago)
Author:
Ken-ichi Mito <mitty@…>
Branches:
master
Children:
f7f894d
Parents:
f38b66d
Message:

check wiki existency

  • some repositories have no wiki even if '"has_wiki": true'
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/github/GitHubBackup.pm

    rf38b66d r9353238  
    201201    if (-d "$dir") { 
    202202        local $CWD = $dir; 
    203         print "fetch ", $dir, "\n"; 
     203        print "fetch $dir\n"; 
    204204        Git::Repository->run(fetch => '--all'); 
    205205        return $self; 
    206206    } 
    207207     
    208     print "clone ", $dir, "\n"; 
     208    print "clone $dir\n"; 
    209209    mkpath $dir; 
    210210    Git::Repository->run(clone => '--mirror' => $url => $dir); 
     
    252252     
    253253    foreach my $fork (@fetch) { 
    254         print "fetch ", $fork, "\n"; 
     254        print "fetch $fork\n"; 
    255255        Git::Repository->run(fetch => $fork); 
    256256    } 
     
    264264    my $dir = $self->directory . '.wiki.git'; 
    265265    my $url = 'https://github.com/' . $self->full_name . '.wiki.git'; 
     266     
     267    my $ua = LWP::UserAgent->new(max_redirect => 0); 
     268    my $res = $ua->head( 
     269        'https://github.com/' . $self->full_name . '/wiki' 
     270    ); 
     271    if ($res->code != 200) { 
     272        print "$dir does not exist\n"; 
     273        return $self; 
     274    } 
    266275     
    267276    $self->sync($url => $dir); 
Note: See TracChangeset for help on using the changeset viewer.