-
Notifications
You must be signed in to change notification settings - Fork 1
/
svn_git_clone_branches.py
63 lines (54 loc) · 2.01 KB
/
svn_git_clone_branches.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
##################################
# file: svn_git_clone_branches.py
##################################
from os.path import join as pjoin
from svn_utils import *
# def git_svn_clone(branch):
# dest = pjoin(root_dir(),"checkouts","svn_%s" % branch)
# rc_start_revs = svn_rc_creation_map()
# print "[checking git svn clone at %s]" % dest
# with cchdir(dest):
# rev_str = None
# if branch != "trunk":
# rev_id = SVNRev(rc_start_revs[branch])
# # start looking one rev before ...
# rev_str = "r%d" % (rev_id.number()-1)
# if not git_svn_check_clone(rev_str):
# if branch == "trunk":
# git_svn_clone_src("%s" % branch)
# else:
# # for an rc we know where the branches start,
# # use this to speed up the clone
#
# git_svn_clone_src("branches/%s" % branch, rev=rev_str)
# else:
# print "[git svn clone at %s is up to date]" % dest
def git_svn_clone(branch):
dest = pjoin(root_dir(),"checkouts","svn_%s" % branch)
rc_start_revs = svn_rc_creation_map()
rev_str = None
if branch != "trunk":
rev_id = SVNRev(rc_start_revs[branch])
# start looking one rev before ...
rev_str = "r%d" % (rev_id.number()-1)
if not git_svn_check_if_clone_exists(dest):
print "[cloning to %s]" % dest
with cchdir(dest):
if branch == "trunk":
git_svn_clone_src("%s" % branch)
else:
# for an rc we know where the branches start,
# use this to speed up the clone
git_svn_clone_src("branches/%s" % branch, rev=rev_str)
else:
print "[updating %s]" % dest
with cchdir(dest):
git_svn_update_clone(rev_str)
def git_svn_clone_all():
branches = svn_ls_rc_branches()
branches.append("trunk")
for b in branches:
git_svn_clone(b)
#git_svn_clone("2.11RC")
if __name__ == "__main__":
git_svn_clone_all()