- Timestamp:
- Aug 21, 2013 12:56:22 PM (11 years ago)
- Branches:
- master
- Children:
- 13e2400
- Parents:
- 9353238
- Location:
- Dev/github
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/github/GitHubBackup.pm
r9353238 rf7f894d 194 194 } 195 195 196 sub message { 197 my $self = shift; 198 my $message = shift; 199 200 print $self->full_name, " $message\n"; 201 202 return $self; 203 } 204 196 205 sub sync { 197 206 my $self = shift; … … 201 210 if (-d "$dir") { 202 211 local $CWD = $dir; 203 print "fetch $dir\n";212 $self->message("++> $dir"); 204 213 Git::Repository->run(fetch => '--all'); 205 214 return $self; 206 215 } 207 216 208 print "clone $dir\n";217 $self->message("==> $dir"); 209 218 mkpath $dir; 210 219 Git::Repository->run(clone => '--mirror' => $url => $dir); … … 243 252 foreach my $fork (@{$self->forks}) { 244 253 if ($remotes =~ /$fork->{full_name}/) { 245 print "skip ", $fork->{full_name}, "\n";254 $self->message("--- ". $fork->{full_name}); 246 255 next; 247 256 } 248 print "add ", $fork->{full_name}, "\n";257 $self->message("+++ ". $fork->{full_name}); 249 258 Git::Repository->run(remote => add => $fork->{full_name} => $fork->{clone_url}); 250 259 push @fetch, $fork->{full_name}; … … 252 261 253 262 foreach my $fork (@fetch) { 254 print "fetch $fork\n";263 $self->message("--> $fork"); 255 264 Git::Repository->run(fetch => $fork); 256 265 } … … 270 279 ); 271 280 if ($res->code != 200) { 272 print "$dir does not exist\n";281 $self->message("wiki does not exist"); 273 282 return $self; 274 283 } … … 303 312 foreach my $issue (@{$self->issues}) { 304 313 my $number = $issue->{number}; 305 print "save issue/$number\n";314 $self->message("+++ issue/$number"); 306 315 307 316 open my $fh, ">$number.json";
Note: See TracChangeset
for help on using the changeset viewer.