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