Changeset 6473c3b in lab.git for Dev/github
- Timestamp:
- Aug 18, 2013 10:28:10 PM (11 years ago)
- Branches:
- master
- Children:
- fc647d5
- Parents:
- 682d2d9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/github/GitHubBackup.pm
r682d2d9 r6473c3b 162 162 } 163 163 164 sub clone_git { 165 my $self = shift; 166 167 my $dir = $self->directory . '.git'; 164 sub sync { 165 my $self = shift; 166 my $url = shift; 167 my $dir = shift; 168 168 169 if (-d "$dir") { 169 170 local $CWD = $dir; … … 175 176 print "clone ", $dir, "\n"; 176 177 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 183 sub 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 178 191 return $self; 179 192 } … … 207 220 208 221 my $remotes = Git::Repository->run(branch => '--remotes'); 222 my @fetch; 209 223 foreach my $fork (@{$self->{forks}}) { 210 224 if ($remotes =~ /$fork->{full_name}/) { … … 214 228 print "add ", $fork->{full_name}, "\n"; 215 229 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 } 220 237 221 238 return $self; … … 224 241 sub clone_wiki { 225 242 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; 226 250 } 227 251
Note: See TracChangeset
for help on using the changeset viewer.