Put some more stuff in YAML.
[invirt/scripts/git-migration.git] / rules.mako
1 <%
2     import yaml
3     svn = yaml.load(open('svn.yml'))
4     packages = svn['packages']
5     trunks = svn['trunks']
6     scripts = svn['scripts']
7     quashes = svn['quashes']
8
9     repos = ['packages/%s' % package for package in packages]
10     repos += ['scripts/%s' % script for script in scripts]
11     repos += ['doc/xvm', 'scripts/osx-update']
12
13     for package in packages:
14         if 'merge' in packages[package]:
15             repos.remove('packages/%s' % package)
16
17     def get_repo(package):
18         if 'merge' in packages[package]:
19             return get_repo(packages[package]['merge'])
20         return 'packages/%s.git' % package
21
22     def get_branch(package):
23         if 'branch' in packages[package]:
24             return packages[package]['branch']
25         if 'merge' in packages[package]:
26             return get_branch(packages[package]['merge'])
27         return 'master'
28
29     def get_tag_prefix(package):
30         if 'merge' in packages[package]:
31             return '%s/' % package
32         return ''
33 %>
34
35 % for repo in repos:
36 create repository ${repo}.git
37 end repository
38
39 % endfor
40
41 % for quash in quashes:
42 match ${quash['path']}
43   min revision ${quash['rev']}
44   max revision ${quash['rev']}
45 end match
46 % endfor
47
48 % for package in packages:
49
50 %   if package == 'sipb-xen-database':
51 match /trunk/packages/${package}/${package}-0/
52   repository ${get_repo(package)}
53   branch ${get_branch(package)}
54   max revision 8
55 end match
56 %   endif
57
58 %   if 'undouble' in packages[package]:
59 match /trunk/packages/${package}/${package}/
60   repository ${get_repo(package)}
61   branch ${get_branch(package)}
62   max revision ${packages[package]['undouble'][0] - 1}
63 end match
64
65 match /package_tags/${package}/([^/~]+)/${package}/
66   repository ${get_repo(package)}
67   branch tags/${get_tag_prefix(package)}\1
68 %     if package == 'sipb-xen-dev':
69   max revision 318
70 %     else:
71   max revision ${packages[package]['undouble'][0] - 1}
72 %     endif
73 end match
74
75 match /trunk/packages/tmp/${package}/
76   min revision ${packages[package]['undouble'][0]}
77   max revision ${packages[package]['undouble'][0]}
78 end match
79
80 match /trunk/packages/${package}/
81   min revision ${packages[package]['undouble'][1]}
82   max revision ${packages[package]['undouble'][1]}
83 end match
84 %   endif
85
86 match /trunk/packages/${package}/
87   repository ${get_repo(package)}
88   branch ${get_branch(package)}
89 %   if 'undouble' in packages[package]:
90   min revision ${packages[package]['undouble'][1] + 1}
91 %   endif
92 %   if 'punt' in packages[package]:
93   max revision ${packages[package]['punt'] - 1}
94 %   endif
95 end match
96
97 match /package_tags/${package}/([^/~]+)/
98   repository ${get_repo(package)}
99   branch tags/${get_tag_prefix(package)}\1
100 %   if 'undouble' in packages[package]:
101   min revision ${packages[package]['undouble'][1]}
102 %   endif
103 end match
104
105 match /package_tags/${package}/([^/~]+)~([^/~]+)/
106   repository ${get_repo(package)}
107   branch tags/${get_tag_prefix(package)}\1_\2
108 %   if 'undouble' in packages[package]:
109   min revision ${packages[package]['undouble'][1]}
110 %   endif
111 end match
112
113 % endfor
114
115 match /trunk/packages/(xen-common|xen-3.1)/
116 end match
117
118 match /package_tags/(xen-common|xen-3.1)/
119 end match
120
121 % for trunk in trunks:
122 %   if 'inclusive' in trunks[trunk]:
123 match /trunk/${trunk}(/|$)
124 %   else:
125 match /trunk/${trunk}/
126 %   endif
127   repository ${get_repo(trunks[trunk]['merge'])}
128 %   if 'branch' in trunks[trunk]:
129   branch ${trunks[trunk]['branch']}
130 %   else:
131   branch ${get_branch(trunks[trunk]['merge'])}
132 %   endif
133 %   if 'inclusive' in trunks[trunk]:
134   max revision ${trunks[trunk]['punt']}
135 %   else:
136   max revision ${trunks[trunk]['punt'] - 1}
137 %   endif
138 end match
139 % endfor
140
141 match /trunk/vnc/tightvnc-1.3.9_javasrc.zip
142 end match
143
144 % for script in scripts:
145 match /trunk/scripts/${script}/
146   repository scripts/${script}.git
147   branch master
148 end match
149 % endfor
150
151 match /trunk/scripts/
152   repository scripts/osx-update.git
153   branch master
154   min revision 1785
155   max revision 1785
156 end match
157
158 match /trunk/scripts/
159   repository scripts/prod-migration.git
160   branch master
161   max revision 1863
162 end match
163
164 % for rev in [803, 804, 925, 926, 928, 1537, 1566]:
165 match /trunk/
166   repository doc/xvm.git
167   branch master
168   min revision ${rev}
169   max revision ${rev}
170 end match
171 % endfor
172
173 match /trunk/vmctl/
174 end match
175
176 match /trunk/COPYING$
177 end match
178
179 match /branches/wsgi/
180 end match