-
Notifications
You must be signed in to change notification settings - Fork 1
/
git_check.py
83 lines (68 loc) · 2.18 KB
/
git_check.py
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
#######################################
# git_graft.py
#######################################
import glob
import shutil
from os.path import join as pjoin
from general_utils import *
from svn_utils import *
from git_utils import *
def gen_tag_tarball(rel):
with cchdir(git_repo_dir()):
sexe("git checkout v%s" % rel)
sexe("tar -czvf visit.test.%s.tar.gz src/" % rel)
def git_check_gen_tag_tarballs():
# for each release, create squashed commit to master
rcs = svn_ls_rc_branches()
for rc in rcs:
if not rc.startswith("1."):
print "[checking releases off of rc %s]" % rc
for release in svn_release_tags_for_rc(rc):
print "[gen tarball for release %s]" % release
gen_tag_tarball(release)
def find_pairs():
res = {}
rts =glob.glob(pjoin("release_tarballs","*"))
for r in rts:
r_val = os.path.split(r)[1]
r_val = r_val[len("visit"):]
r_val = r_val[:r_val.find(".tar.gz")]
print r, r_val
t = pjoin("new_tarballs","visit.test.%s.tar.gz" % r_val)
if os.path.isfile(t):
res[r] = t
return res
def stage_pair(a,b):
af = os.path.abspath(a)
bf = os.path.abspath(b)
r_val = os.path.split(af)[1]
r_val = r_val[len("visit"):]
r_val = r_val[:r_val.find(".tar.gz")]
print r_val
with cchdir("_extract"):
odir = "stage_%s_old" % r_val
os.mkdir(odir)
with cchdir(odir):
sexe("tar -xzvf %s" % af)
ndir = "stage_%s_new" % r_val
os.mkdir(ndir)
print odir, ndir
with cchdir(ndir):
sexe("tar -xzvf %s" % bf)
sexe("diff -bur stage_%s_new/src/ stage_%s_old/visit%s/src/ > mout_diff_%s.txt" % (r_val,r_val,r_val,r_val), fatal_on_error=False)
def cycle_rc_checkouts():
branches = git_ls_branches()
for b in branches:
with cchdir(git_repo_dir()):
sexe('git checkout %s' % b)
def git_check():
#git_check_gen_tag_tarballs()
#
#p = find_pairs()
#for k,v in p.items():
# if k.count("2.13.3") > 0:
# stage_pair(k,v)
# sys.exit(0)
cycle_rc_checkouts()
if __name__ == "__main__":
git_check()