1
0
Fork 0
mirror of https://github.com/clockfort/GitHub-Backup.git synced 2025-03-16 00:00:06 +01:00

minor changes to error handling

This commit is contained in:
Chris Lockfort 2010-07-13 14:33:45 -04:00
parent 79102ef5d2
commit 85d276a4e5
2 changed files with 11 additions and 11 deletions

View file

@ -5,7 +5,15 @@ By Chris Lockfort (devnull@csh.rit.edu) (Github username: Clockfort)
GitHub-Backup makes a local backup copy of all of a github user's (or github organization's) repositories.
This is useful in many cases:
Usage
-----
"./github-backup.pl USERNAME BACKUP_DIRECTORY"
Then, put it in a cron job somewhere and forget about it for eternity.
Why This Software Exists
-------------------------
This software is useful in many cases:
- GitHub suddenly explodes.
@ -18,10 +26,6 @@ This is useful in many cases:
- You are paranoid tinfoil-hat wearer who needs to back up everything in triplicate on a variety of outdated tape media.
Usage
-----
"./github-backup.pl USERNAME BACKUP_DIRECTORY"
Questions, Improvements, Etc
-----------------------------

View file

@ -16,10 +16,6 @@ my @giturls = grep s/ :url: http/git/, @urls;
@urls = @giturls;
my @reponames = grep s/.*$username\///, @giturls;
foreach my $name (@reponames){
print "NAME: $name\n";
}
for(my $i = 0; $i < @urls; ++$i){
my $url = $urls[$i];
my $name = $reponames[$i];
@ -27,11 +23,11 @@ for(my $i = 0; $i < @urls; ++$i){
system("mkdir $backupdir") and die "Couldn't make $backupdir.\n";
}
unless(-e "$backupdir/$name"){ #We haven't backed this up before, let's clone it
print "CLONING $url\n";
print "CLONING REPOSITORY: $url\n";
system("cd backups && git clone $url") and die "Encountered an error while git-cloning repository $name\n";
}
else{ #We've backed it up before, just fetch the most recent copy
print "EXISTED, FETCHING $name\n";
print "REPOSITORY EXISTED, FETCHING: $name\n";
system("cd $backupdir/$name && git fetch -q") and die "Encountered an error while git-fetching repository $name\n";
}
}