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

Last change on this file since 2496 was 2471, checked in by andersk, 15 years ago

Deal with package_branches.

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