aboutsummaryrefslogtreecommitdiff
path: root/src/util/git-push-everything.pl
blob: faebdf7ee2827aa2854472921d9eb82f4138218e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#! /usr/bin/perl -w

# Push everything to the master repository

# 2010-01-29 Erik Schnetter <schnetter@cct.lsu.edu>

use strict;



$#ARGV == 2 or die;
my ($git_cmd, $git_repo, $git_master_repo) = @ARGV;

# Central Cactus repository
my $git_central_repo = $ENV{'CACTUS_CENTRAL_GIT_REPO'};

# Path where the git-*.pl commands are installed
my $bindir = $ENV{'SCRATCH_BUILD'} . '/formaline-bin';

my $silent = $ENV{'SILENT'};
$silent = 'yes' if ! defined $silent;
$silent = $silent !~ /^no$/i;
my $silencer = $silent ? '> /dev/null 2>&1' : '';



# Ensure that the repositories exist
die unless -e "$git_repo/.git";
$ENV{'GIT_DIR'} = "$git_repo/.git";
die unless -e "$git_master_repo/.git";



print "Formaline: Pushing source tree to master git repository...\n";

print "Executing: $git_cmd push -v -f --all $git_master_repo\n" unless $silent;
system "$git_cmd push -v -f --all $git_master_repo $silencer";
if ($?) {
    die "Could not push branches";
}

print "Executing: $git_cmd push -v -f --tags $git_master_repo\n" unless $silent;
system "$git_cmd push -v -f --tags $git_master_repo $silencer";
if ($?) {
    die "Could not push tags";
}

print "Executing: $bindir/git-gc-repo.pl '$git_cmd' $git_master_repo\n"
    unless $silent;
system "$bindir/git-gc-repo.pl '$git_cmd' $git_master_repo $silencer";
if ($?) {
    die "Could not collect garbage";
}



if (defined $git_central_repo) {
    $ENV{'GIT_DIR'} = "$git_master_repo/.git";
    
    print "Formaline: Pushing to central repository $git_central_repo...\n";
    
    print "Executing: $git_cmd push -v -f --all $git_central_repo\n"
        unless $silent;
    system "$git_cmd push -v -f --all $git_central_repo $silencer";
    if ($?) {
        die "Could not push branches";
    }
    
    print "$git_cmd push -v -f --tags $git_central_repo\n" unless $silent;
    system "$git_cmd push -v -f --tags $git_central_repo $silencer";
    if ($?) {
        die "Could not push tags";
    }
}