diff options
author | Shawn O. Pearce <sop@google.com> | 2008-10-30 09:21:43 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2008-10-30 09:21:43 -0700 |
commit | df830f12389984adeeba04659615b9fc230f2db3 (patch) | |
tree | ea5857656f63f9b375dbb9851e8801062570c24d /manifest.py | |
parent | 90be5c0839762d14bdee75d121c3923ed91c8404 (diff) | |
download | git-repo-df830f12389984adeeba04659615b9fc230f2db3.tar.gz |
Remove import_tar, import_zip and the <snapshot> elementsv1.0.7
Now that repo relies only on the git data stream (as it is much
faster to download through) we don't really need to be parsing the
<snapshot> elements within manifest. Its a lot of complex code to
convert the tar (or zip) through to a fast import stream, and we
just aren't calling it anymore.
Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'manifest.py')
-rw-r--r-- | manifest.py | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/manifest.py b/manifest.py index 8c5a8d6d..ffff14a5 100644 --- a/manifest.py +++ b/manifest.py | |||
@@ -18,8 +18,6 @@ import sys | |||
18 | import xml.dom.minidom | 18 | import xml.dom.minidom |
19 | 19 | ||
20 | from git_config import GitConfig, IsId | 20 | from git_config import GitConfig, IsId |
21 | from import_tar import ImportTar | ||
22 | from import_zip import ImportZip | ||
23 | from project import Project, MetaProject, R_TAGS | 21 | from project import Project, MetaProject, R_TAGS |
24 | from remote import Remote | 22 | from remote import Remote |
25 | from error import ManifestParseError | 23 | from error import ManifestParseError |
@@ -245,78 +243,8 @@ class Manifest(object): | |||
245 | elif n.nodeName == 'copyfile': | 243 | elif n.nodeName == 'copyfile': |
246 | self._ParseCopyFile(project, n) | 244 | self._ParseCopyFile(project, n) |
247 | 245 | ||
248 | to_resolve = [] | ||
249 | by_version = {} | ||
250 | |||
251 | for n in node.childNodes: | ||
252 | if n.nodeName == 'import': | ||
253 | self._ParseImport(project, n, to_resolve, by_version) | ||
254 | |||
255 | for pair in to_resolve: | ||
256 | sn, pr = pair | ||
257 | try: | ||
258 | sn.SetParent(by_version[pr].commit) | ||
259 | except KeyError: | ||
260 | raise ManifestParseError, \ | ||
261 | 'snapshot %s not in project %s in %s' % \ | ||
262 | (pr, project.name, self.manifestFile) | ||
263 | |||
264 | return project | 246 | return project |
265 | 247 | ||
266 | def _ParseImport(self, project, import_node, to_resolve, by_version): | ||
267 | first_url = None | ||
268 | for node in import_node.childNodes: | ||
269 | if node.nodeName == 'mirror': | ||
270 | first_url = self._reqatt(node, 'url') | ||
271 | break | ||
272 | if not first_url: | ||
273 | raise ManifestParseError, \ | ||
274 | 'mirror url required for project %s in %s' % \ | ||
275 | (project.name, self.manifestFile) | ||
276 | |||
277 | imp = None | ||
278 | for cls in [ImportTar, ImportZip]: | ||
279 | if cls.CanAccept(first_url): | ||
280 | imp = cls() | ||
281 | break | ||
282 | if not imp: | ||
283 | raise ManifestParseError, \ | ||
284 | 'snapshot %s unsupported for project %s in %s' % \ | ||
285 | (first_url, project.name, self.manifestFile) | ||
286 | |||
287 | imp.SetProject(project) | ||
288 | |||
289 | for node in import_node.childNodes: | ||
290 | if node.nodeName == 'remap': | ||
291 | old = node.getAttribute('strip') | ||
292 | new = node.getAttribute('insert') | ||
293 | imp.RemapPath(old, new) | ||
294 | |||
295 | elif node.nodeName == 'mirror': | ||
296 | imp.AddUrl(self._reqatt(node, 'url')) | ||
297 | |||
298 | for node in import_node.childNodes: | ||
299 | if node.nodeName == 'snapshot': | ||
300 | sn = imp.Clone() | ||
301 | sn.SetVersion(self._reqatt(node, 'version')) | ||
302 | sn.SetCommit(node.getAttribute('check')) | ||
303 | |||
304 | pr = node.getAttribute('prior') | ||
305 | if pr: | ||
306 | if IsId(pr): | ||
307 | sn.SetParent(pr) | ||
308 | else: | ||
309 | to_resolve.append((sn, pr)) | ||
310 | |||
311 | rev = R_TAGS + sn.TagName | ||
312 | |||
313 | if rev in project.snapshots: | ||
314 | raise ManifestParseError, \ | ||
315 | 'duplicate snapshot %s for project %s in %s' % \ | ||
316 | (sn.version, project.name, self.manifestFile) | ||
317 | project.snapshots[rev] = sn | ||
318 | by_version[sn.version] = sn | ||
319 | |||
320 | def _ParseCopyFile(self, project, node): | 248 | def _ParseCopyFile(self, project, node): |
321 | src = self._reqatt(node, 'src') | 249 | src = self._reqatt(node, 'src') |
322 | dest = self._reqatt(node, 'dest') | 250 | dest = self._reqatt(node, 'dest') |