source: trunk/scripts/git-migration/rules.mako @ 1939

Last change on this file since 1939 was 1937, checked in by andersk, 16 years ago

Quash the rest of the empty revisions.

File size: 6.8 KB
Line 
1<%
2    packages = [line.strip() for line in open('package-list')]
3    packages.append('packages/xvm-console-devconfig')
4    repos = packages
5    packages = [package[len('packages/'):] for package in packages]
6
7    scripts = ['git-migration', 'invirt.mit.edu', 'munin', 'prod-migration']
8    repos += ['scripts/%s' % script for script in scripts]
9
10    repos += ['doc/xvm', 'scripts/osx-update']
11
12    doubled_packages = {
13        'sipb-xen-guest-installer': (310, 310),
14        'sipb-xen-base': (314, 315),
15        'sipb-xen-database': (311, 313),
16        'sipb-xen-dev': (314, 315),
17        'sipb-xen-dom0': (314, 315),
18        'sipb-xen-remctl-auto': (314, 315),
19    }
20
21    punt = {
22        'xvm-console-devconfig': 700,
23        'sipb-xen-guest-installer': 742,
24        'sipb-xen-remote-server': 1176,
25        'sipb-xen-dns': 1184,
26        'sipb-xen-console-server': 1187,
27        'sipb-xen-console': 1201,
28        'sipb-xen-base': 1350,
29        'sipb-xen-chrony-config': 1351,
30        'sipb-xen-database': 1352,
31        'sipb-xen-dev': 1353,
32        'sipb-xen-dom0': 1354,
33        'sipb-xen-host-master': 1355,
34        'sipb-xen-iptables': 1356,
35        'sipb-xen-python-pydhcplib': 1357,
36        'sipb-xen-remctl-auto': 1358,
37        'sipb-xen-vnc-client': 1359,
38        'sipb-xen-www': 1360,
39        'sipb-xen-vnc-server': 1387,
40        'sipb-xen-dhcp': 1436,
41        'sipb-xen-autoinstaller': 1569,
42        'sipb-xen-clvm-config': 1569,
43        'invirt-console-host': 1815,
44        'invirt-console-server': 1813,
45        'invirt-remote-host': 1822,
46        'invirt-remote-server': 1822,
47    }
48
49    quashes = [
50        ('/package_tags/sipb-xen-dev/sipb-xen-dev/', 11),
51        ('/package_tags/sipb-xen-dev/13/', 316),
52        ('/package_tags/sipb-xen-console/2/', 347),
53        ('/package_tags/sipb-xen-console/2/sipb-xen-console/', 348),
54        ('/package_tags/sipb-xen-console/2/', 349),
55        ('/package_tags/sipb-xen-console/7.1/sipb-xen-console/', 401),
56        ('/package_tags/sipb-xen-guest-installer/1.0/sipb-xen-guest-installer/', 452),
57        ('/package_tags/sipb-xen-dev/14/sipb-xen-dev/', 462),
58        ('/package_tags/sipb-xen-dev/14/', 463),
59        ('/trunk/packages/sipb-xen-autoinstaller/', 742),
60        ('/trunk/packages/invirt-console-server/', 1201),
61        ('/trunk/packages/xvm-prodconfig/', 1455),
62        ('/trunk/packages/invirt-xen-config/', 1757),
63        ('/trunk/packages/invirt-console/', 1819),
64        ('/trunk/scripts/prod-migration/', 1864),
65        ('/trunk/packages/invirt-dhcp/', 1904),
66    ]
67
68    merges = []
69    for line in open('merges'):
70        line = line.strip()
71        if line == '' or line[0] == '#':
72            continue
73
74        merges.append(line.split())
75
76    merge_map = {}
77    merge_count = {}
78    merge_n = {}
79    for merge in merges:
80        repos.remove('packages/%s' % merge[0])
81        merge_map[merge[0]] = merge[1]
82        if int(merge[2]) == 0:
83            merge_count[merge[1]] = merge_count.get(merge[1], 0) + 1
84        else:
85            merge_n[merge[0]] = int(merge[2])
86
87    def get_repo(package):
88        if package in merge_map:
89            return get_repo(merge_map[package])
90        return 'packages/%s.git' % package
91
92    def get_branch(package):
93        if package in merge_map:
94            if package in merge_n or merge_count[merge_map[package]] > 1:
95                return package
96            return get_branch(merge_map[package])
97        return 'master'
98
99    def get_tag_prefix(package):
100        if package in merge_map:
101            return '%s/' % package
102        return ''
103%>
104
105% for repo in repos:
106create repository ${repo}.git
107end repository
108
109% endfor
110
111% for quash in quashes:
112match ${quash[0]}
113  min revision ${quash[1]}
114  max revision ${quash[1]}
115end match
116% endfor
117
118% for package in packages:
119
120% if package == 'sipb-xen-database':
121match /trunk/packages/${package}/${package}-0/
122  repository ${get_repo(package)}
123  branch ${get_branch(package)}
124  max revision 8
125end match
126% endif
127
128% if package in doubled_packages:
129match /trunk/packages/${package}/${package}/
130  repository ${get_repo(package)}
131  branch ${get_branch(package)}
132  max revision ${doubled_packages[package][0] - 1}
133end match
134
135match /package_tags/${package}/([^/~]+)/${package}/
136  repository ${get_repo(package)}
137  branch tags/${get_tag_prefix(package)}\1
138% if package == 'sipb-xen-dev':
139  max revision 318
140% else:
141  max revision ${doubled_packages[package][0] - 1}
142% endif
143end match
144
145match /trunk/packages/tmp/${package}/
146  min revision ${doubled_packages[package][0]}
147  max revision ${doubled_packages[package][0]}
148end match
149
150match /trunk/packages/${package}/
151  min revision ${doubled_packages[package][1]}
152  max revision ${doubled_packages[package][1]}
153end match
154% endif
155
156match /trunk/packages/${package}/
157  repository ${get_repo(package)}
158  branch ${get_branch(package)}
159% if package in doubled_packages:
160  min revision ${doubled_packages[package][1] + 1}
161% endif
162% if package in punt:
163  max revision ${punt[package] - 1}
164% endif
165end match
166
167match /package_tags/${package}/([^/~]+)/
168  repository ${get_repo(package)}
169  branch tags/${get_tag_prefix(package)}\1
170% if package in doubled_packages:
171  min revision ${doubled_packages[package][1]}
172% endif
173end match
174
175match /package_tags/${package}/([^/~]+)~([^/~]+)/
176  repository ${get_repo(package)}
177  branch tags/${get_tag_prefix(package)}\1_\2
178% if package in doubled_packages:
179  min revision ${doubled_packages[package][1]}
180% endif
181end match
182
183% endfor
184
185match /trunk/packages/(xen-common|xen-3.1)/
186end match
187
188match /package_tags/(xen-common|xen-3.1)/
189end match
190
191match /trunk/dhcp/
192  repository ${get_repo('sipb-xen-dhcp')}
193  branch ${get_branch('sipb-xen-dhcp')}
194  max revision 281
195end match
196
197match /trunk/web(/|$)
198  repository ${get_repo('sipb-xen-www')}
199  branch ${get_branch('sipb-xen-www')}
200  max revision 303
201end match
202
203match /trunk/vnc/tightvnc-1.3.9_javasrc.zip
204end match
205
206match /trunk/vnc/vnc_javasrc/
207  repository ${get_repo('sipb-xen-vnc-client')}
208  branch ${get_branch('sipb-xen-vnc-client')}
209  max revision 304
210end match
211
212match /trunk/vnc/vnc_server(/|$)
213  repository ${get_repo('sipb-xen-vnc-server')}
214  branch ${get_branch('sipb-xen-vnc-server')}
215  max revision 286
216end match
217
218match /trunk/dns/
219  repository ${get_repo('sipb-xen-dns')}
220  branch dns
221  max revision 268
222end match
223
224% for script in scripts:
225match /trunk/scripts/${script}/
226  repository scripts/${script}.git
227  branch master
228end match
229% endfor
230
231match /trunk/scripts/
232  repository scripts/osx-update.git
233  branch master
234  min revision 1785
235  max revision 1785
236end match
237
238match /trunk/scripts/
239  repository scripts/prod-migration.git
240  branch master
241  max revision 1863
242end match
243
244% for rev in [803, 804, 925, 926, 928, 1537, 1566]:
245match /trunk/
246  repository doc/xvm.git
247  branch master
248  min revision ${rev}
249  max revision ${rev}
250end match
251% endfor
252
253match /trunk/vmctl/
254end match
255
256match /trunk/COPYING$
257end match
258
259match /branches/wsgi/
260end match
Note: See TracBrowser for help on using the repository browser.