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