diff options
author | schnetter <schnetter@83718e91-0e4f-0410-abf4-91180603181f> | 2010-02-06 17:24:06 +0000 |
---|---|---|
committer | schnetter <schnetter@83718e91-0e4f-0410-abf4-91180603181f> | 2010-02-06 17:24:06 +0000 |
commit | 1f053de3b2531ccad7f4e96e18892435705996c2 (patch) | |
tree | e4604175591382e231485e7d7bce8245b497ee56 /src/util/git-init-master-repo.pl | |
parent | d602467129df8ca1bd67edbb6fe96a534f06064f (diff) |
Git stuff:
Replace shell commands in Makefile with explicit perl scripts.
Handle symbolic links to arrangements or thorns explicitly, so that
newer versions of git work fine.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusUtils/Formaline/trunk@181 83718e91-0e4f-0410-abf4-91180603181f
Diffstat (limited to 'src/util/git-init-master-repo.pl')
-rwxr-xr-x | src/util/git-init-master-repo.pl | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/util/git-init-master-repo.pl b/src/util/git-init-master-repo.pl new file mode 100755 index 0000000..ef5d5e5 --- /dev/null +++ b/src/util/git-init-master-repo.pl @@ -0,0 +1,71 @@ +#! /usr/bin/perl -w + +# Initialise the master repository + +# 2010-01-29 Erik Schnetter <schnetter@cct.lsu.edu> + +use strict; + + + +$#ARGV == 1 or die; +my ($git_cmd, $git_master_repo) = @ARGV; + +my $silent = $ENV{'SILENT'}; +$silent = 'yes' if ! defined $silent; +$silent = $silent !~ /^no$/i; +my $silencer = $silent ? '> /dev/null 2>&1' : ''; + + + +# If the repository exists already, do nothing +if (-e "$git_master_repo/.git") { + exit; +} + + + +print "Formaline: Creating git master repository...\n"; + +# Create the directory for the repository +mkdir $git_master_repo; +$ENV{'GIT_DIR'} = $git_master_repo; + +# Create the repository +print "Executing: $git_cmd init-db\n" unless $silent; +system "$git_cmd init-db $silencer"; +if ($?) { + die "Formaline: WARNING: Error while initialising master git repository"; +} + + + +# Add a README +open README, "> $git_master_repo/README" or die; +my $today = `date`; +print README "\ +This directory $git_master_repo + +is not empty -- it contains a git repository with the Cactus source +trees of all previous builds, starting on $today. + +You can use the command \"git branch\" to list all configurations that +are stored in this repository. The history of each branch is the +sequence in which the configurations were built. The most recent +build is stored in the branch head, as usual. In order to check out a +certain branch into a directory <name>, issue the following commands: + cd <somewhere_else> + mkdir <name> + cd <name> + git init + git pull $git_master_repo <branch> + +You can also use the command \"git tag -l\" to list all builds that +are stored in this repository. This keeps the source tree for each +build directly accessible. In order to check out a certain tag into a +directory <name>, issue the following commands: + cd <somewhere_else> + git clone -o <name> $git_master_repo + git checkout <tag>" + or die; +close README or die; |