Changeset 6473c3b in lab.git for Dev/github


Ignore:
Timestamp:
Aug 18, 2013 10:28:10 PM (11 years ago)
Author:
Ken-ichi Mito <mitty@…>
Branches:
master
Children:
fc647d5
Parents:
682d2d9
Message:

sync wiki pages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/github/GitHubBackup.pm

    r682d2d9 r6473c3b  
    162162} 
    163163 
    164 sub clone_git { 
    165     my $self = shift; 
    166      
    167     my $dir = $self->directory . '.git'; 
     164sub sync { 
     165    my $self = shift; 
     166    my $url = shift; 
     167    my $dir = shift; 
     168     
    168169    if (-d "$dir") { 
    169170        local $CWD = $dir; 
     
    175176    print "clone ", $dir, "\n"; 
    176177    mkpath $dir; 
    177     Git::Repository->run(clone => '--mirror' => $self->{clone_url} => $dir); 
     178    Git::Repository->run(clone => '--mirror' => $url => $dir); 
     179     
     180    return $self; 
     181} 
     182 
     183sub clone_git { 
     184    my $self = shift; 
     185     
     186    my $dir = $self->directory . '.git'; 
     187    my $url = $self->{clone_url}; 
     188     
     189    $self->sync($url => $dir); 
     190     
    178191    return $self; 
    179192} 
     
    207220     
    208221    my $remotes = Git::Repository->run(branch => '--remotes'); 
     222    my @fetch; 
    209223    foreach my $fork (@{$self->{forks}}) { 
    210224        if ($remotes =~ /$fork->{full_name}/) { 
     
    214228        print "add ", $fork->{full_name}, "\n"; 
    215229        Git::Repository->run(remote => add => $fork->{full_name} => $fork->{clone_url}); 
    216     } 
    217      
    218     print "fetch ", $dir, "\n"; 
    219     Git::Repository->run(fetch => '--all'); 
     230        push @fetch, $fork->{full_name}; 
     231    } 
     232     
     233    foreach my $fork (@fetch) { 
     234        print "fetch ", $fork, "\n"; 
     235        Git::Repository->run(fetch => $fork); 
     236    } 
    220237     
    221238    return $self; 
     
    224241sub clone_wiki { 
    225242    my $self = shift; 
     243     
     244    my $dir = $self->directory . '.wiki.git'; 
     245    my $url = 'https://github.com/' . $self->{full_name} . '.wiki.git'; 
     246     
     247    $self->sync($url => $dir); 
     248     
     249    return $self; 
    226250} 
    227251 
Note: See TracChangeset for help on using the changeset viewer.