-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloneGit.py
More file actions
54 lines (51 loc) · 1.36 KB
/
cloneGit.py
File metadata and controls
54 lines (51 loc) · 1.36 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
import sys, envoy, re, time
#Please set these as appropriate for your VM
DiskCapacity = 25000000*1000
netid='xxxxx'
n2s = {}
f = open ('RepoSize.csv')
for l in f:
ar = l .rstrip () .split(';')
vcs = ar [1]
s = int (ar [0])
n2s [ar [5]] = s
start = time .time()
now = start
nmax = DiskCapacity
nused = 0
f = open ('divided')
toCopy = []
for l in f:
ar = l .rstrip () .split(';')
t = int (ar [0])
n = ar[2]
p = re. sub('/', '_', n)
s = n2s [ n ]
vcs = ar [1]
if (t == 1):
cmdl = 'git clone --mirror https://bitbucket.org/' + n + ' ' + p
if vcs == 'hg':
continue
if (nused + s > DiskCapacity):
now0 = time .time()
print str (nused) + ' cloned in ' + str (now0 - now)
now = time .time()
rsync = " ".join (toCopy)
r = envoy .run ('rsync -ae "ssh -p2200" ' + rsync + ' ' + netid + '@da2.eecs.utk.edu:git')
r1 = envoy .run ('find ' + rsync + ' -delete')
now = time .time()
print str (nused) + ' synced in ' + str (now - now0)
print r .std_out
print r .std_err
print r1 .std_out
print r1 .std_err
nused = 0
toCopy = []
r = envoy .run (cmdl)
ttt = time .time()
print str (r.status_code) + ';' + str (nused) + ';' + str (ttt) + ';' + cmdl
sys.stdout.flush()
if (r.status_code == 0):
toCopy .append (p)
nused += s
f .close()