-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinitgit
More file actions
executable file
·112 lines (100 loc) · 2.88 KB
/
Copy pathinitgit
File metadata and controls
executable file
·112 lines (100 loc) · 2.88 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#! /bin/csh -f
#*********************************************************************
# 24 Feb 2017
# Andrew J. Worth
# andy@neuromorphometrics.com
#
# Neuromorphometrics
# 22 Westminster Street
# Somerville, MA 02144-1630 USA
#
# http://neuromorphometrics.com
#
#*********************************************************************
#* *
#* (c) Copyright 2017 Neuromorphometrics All rights reserved *
#* *
#*********************************************************************
# Give two arguments: CUST PROJ
# or else I'll use the current path to figure those out!
#echo "number of arguments "$#argv
if ( $#argv != 2 ) then
set PATH=`pwd`
echo "The current path is $PATH"
set SPLITPATH = `echo $PATH | tr '/' ' '`
#echo $SPLITPATH
set PLEN = ${#SPLITPATH}
#echo $PLEN
@ INDEX = $PLEN - 2
@ C = $PLEN - 1
@ P = $PLEN
#echo $SPLITPATH[$INDEX]
if ( $SPLITPATH[$INDEX] != 'NMM' ) then
echo "ERROR, where the path is '$SPLITPATH[$INDEX]' should be 'NMM'"
echo "I quit."
exit
else
set CUST = "$SPLITPATH[$C]"
set PROJ = "$SPLITPATH[$P]"
endif
else
set CUST = "$1"
set PROJ = "$2"
endif
echo "Customer name is $CUST"
echo " Project name is $PROJ"
if ( -e .git ) then
echo ".git already exists"
else
git init
git add .
git commit -m 'initial setup'
git remote add origin git@neuromorphometrics.org:NMM/$CUST/$PROJ.git
git push --set-upstream origin master
endif
# Add NMM remotes if they are not already there
set LIST = (Labels SegMentor bin)
while ( ${#LIST} > 0 )
set DIR = $LIST[1]
#echo $DIR
if ( -e $DIR ) then
if ( -e $DIR/.git ) then
#echo "$DIR/.git is present"
set ANS = `grep '\[remote' $DIR/.git/config | grep NMM`
echo $DIR
if ( "$ANS" == "" ) then
echo "Adding remote NMM"
cd $DIR
git remote add NMM git@neuromorphometrics.org:NMM/$CUST/$PROJ/$DIR.git
git push --set-upstream NMM master
cd ..
else
echo "$ANS exists"
endif
endif
endif
shift LIST
end
# Add git repos if they are not already there
set LIST = (Archive Atlas Literature MetaData NMM Notes Orig Results)
while ( ${#LIST} > 0 )
set DIR = $LIST[1]
if ( -e $DIR ) then
if ( -e $DIR/.git ) then
echo "$DIR/.git already exists"
else
cd $DIR
git init
git add .
git commit -m 'initial setup'
git remote add origin git@neuromorphometrics.org:NMM/$CUST/$PROJ/$DIR.git
git push --set-upstream origin master
cd ..
endif
else
echo "$DIR does not exist, skipping it"
endif
shift LIST
end
exit
# vi:set autoindent ts=2 sw=2 expandtab : See Vim, :help 'modeline'