Changeset 55d0513 in lab.git for Dev/github/GitHubBackup.pm
- Timestamp:
- Aug 19, 2013 10:21:00 AM (11 years ago)
- Branches:
- master
- Children:
- 49aca65
- Parents:
- fc647d5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/github/GitHubBackup.pm
rfc647d5 r55d0513 24 24 sub get { 25 25 my $url = shift; 26 my %parameters = @_; 27 28 my $parameters = ''; 29 while (my($key, $value) = each %parameters) { 30 $parameters .= "&$key=$value"; 31 } 26 32 27 33 my $page = 1; 28 34 my $data; 29 35 while(1) { 30 my $result = json_api("$url?per_page=100&page=$page ");36 my $result = json_api("$url?per_page=100&page=$page$parameters"); 31 37 if (ref($result) eq 'ARRAY' && scalar @$result > 0) { 32 38 push @$data, @$result; … … 198 204 } 199 205 200 sub get_forks {206 sub forks { 201 207 my $self = shift; 202 208 return $self->{forks} if ($self->{forks}); … … 204 210 $self->{forks} = utils::get("/repos/" . $self->{full_name} . "/forks"); 205 211 206 return $self ;212 return $self->{forks}; 207 213 } 208 214 209 215 sub set_forks { 210 216 my $self = shift; 211 212 $self->get_forks;213 217 214 218 my $dir = $self->directory . '.git'; … … 217 221 my $remotes = Git::Repository->run(branch => '--remotes'); 218 222 my @fetch; 219 foreach my $fork (@{$self-> {forks}}) {223 foreach my $fork (@{$self->forks}) { 220 224 if ($remotes =~ /$fork->{full_name}/) { 221 225 print "skip ", $fork->{full_name}, "\n"; … … 246 250 } 247 251 252 sub issues { 253 my $self = shift; 254 return $self->{issues} if ($self->{issues}); 255 256 my $open = utils::get("/repos/" . $self->{full_name} . "/issues"); 257 my $closed = utils::get("/repos/" . $self->{full_name} . "/issues", state => 'closed'); 258 259 if ($open) { push @{$self->{issues}}, @$open } 260 if ($closed) { push @{$self->{issues}}, @$closed } 261 262 return $self->{issues}; 263 } 264 248 265 sub save_issues { 249 266 my $self = shift; 267 268 $self->issues; 250 269 } 251 270
Note: See TracChangeset
for help on using the changeset viewer.