diff options
author | Shawn O. Pearce <sop@google.com> | 2009-05-29 18:38:17 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2009-05-29 18:45:20 -0700 |
commit | 3c8dea1f8d7c4257d080f9f34159cdb2fffb81e6 (patch) | |
tree | 2a5e48ce93bc913076034f88f8878e4bfffef4dc /manifest_xml.py | |
parent | 8ad8a0e61d919e76f521f3124c91bd46fbaa84e2 (diff) | |
download | git-repo-3c8dea1f8d7c4257d080f9f34159cdb2fffb81e6.tar.gz |
Change project.revision to revisionExpr and revisionId
The revisionExpr field now holds an expression from the manifest,
such as "refs/heads/master", while revisionId holds the current
commit-ish SHA-1 of the revisionExpr. Currently that is only
filled in if the manifest points directly to a SHA-1.
Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'manifest_xml.py')
-rw-r--r-- | manifest_xml.py | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/manifest_xml.py b/manifest_xml.py index 5c5617ac..51e653ed 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -27,7 +27,7 @@ LOCAL_MANIFEST_NAME = 'local_manifest.xml' | |||
27 | class _Default(object): | 27 | class _Default(object): |
28 | """Project defaults within the manifest.""" | 28 | """Project defaults within the manifest.""" |
29 | 29 | ||
30 | revision = None | 30 | revisionExpr = None |
31 | remote = None | 31 | remote = None |
32 | 32 | ||
33 | class _XmlRemote(object): | 33 | class _XmlRemote(object): |
@@ -116,9 +116,9 @@ class XmlManifest(object): | |||
116 | if d.remote: | 116 | if d.remote: |
117 | have_default = True | 117 | have_default = True |
118 | e.setAttribute('remote', d.remote.name) | 118 | e.setAttribute('remote', d.remote.name) |
119 | if d.revision: | 119 | if d.revisionExpr: |
120 | have_default = True | 120 | have_default = True |
121 | e.setAttribute('revision', d.revision) | 121 | e.setAttribute('revision', d.revisionExpr) |
122 | if have_default: | 122 | if have_default: |
123 | root.appendChild(e) | 123 | root.appendChild(e) |
124 | root.appendChild(doc.createTextNode('')) | 124 | root.appendChild(doc.createTextNode('')) |
@@ -138,12 +138,12 @@ class XmlManifest(object): | |||
138 | if peg_rev: | 138 | if peg_rev: |
139 | if self.IsMirror: | 139 | if self.IsMirror: |
140 | e.setAttribute('revision', | 140 | e.setAttribute('revision', |
141 | p.bare_git.rev_parse(p.revision + '^0')) | 141 | p.bare_git.rev_parse(p.revisionExpr + '^0')) |
142 | else: | 142 | else: |
143 | e.setAttribute('revision', | 143 | e.setAttribute('revision', |
144 | p.work_git.rev_parse(HEAD + '^0')) | 144 | p.work_git.rev_parse(HEAD + '^0')) |
145 | elif not d.revision or p.revision != d.revision: | 145 | elif not d.revisionExpr or p.revisionExpr != d.revisionExpr: |
146 | e.setAttribute('revision', p.revision) | 146 | e.setAttribute('revision', p.revisionExpr) |
147 | 147 | ||
148 | for c in p.copyfiles: | 148 | for c in p.copyfiles: |
149 | ce = doc.createElement('copyfile') | 149 | ce = doc.createElement('copyfile') |
@@ -286,7 +286,8 @@ class XmlManifest(object): | |||
286 | gitdir = gitdir, | 286 | gitdir = gitdir, |
287 | worktree = None, | 287 | worktree = None, |
288 | relpath = None, | 288 | relpath = None, |
289 | revision = m.revision) | 289 | revisionExpr = m.revisionExpr, |
290 | revisionId = None) | ||
290 | self._projects[project.name] = project | 291 | self._projects[project.name] = project |
291 | 292 | ||
292 | def _ParseRemote(self, node): | 293 | def _ParseRemote(self, node): |
@@ -306,9 +307,9 @@ class XmlManifest(object): | |||
306 | """ | 307 | """ |
307 | d = _Default() | 308 | d = _Default() |
308 | d.remote = self._get_remote(node) | 309 | d.remote = self._get_remote(node) |
309 | d.revision = node.getAttribute('revision') | 310 | d.revisionExpr = node.getAttribute('revision') |
310 | if d.revision == '': | 311 | if d.revisionExpr == '': |
311 | d.revision = None | 312 | d.revisionExpr = None |
312 | return d | 313 | return d |
313 | 314 | ||
314 | def _ParseProject(self, node): | 315 | def _ParseProject(self, node): |
@@ -325,10 +326,10 @@ class XmlManifest(object): | |||
325 | "no remote for project %s within %s" % \ | 326 | "no remote for project %s within %s" % \ |
326 | (name, self.manifestFile) | 327 | (name, self.manifestFile) |
327 | 328 | ||
328 | revision = node.getAttribute('revision') | 329 | revisionExpr = node.getAttribute('revision') |
329 | if not revision: | 330 | if not revisionExpr: |
330 | revision = self._default.revision | 331 | revisionExpr = self._default.revisionExpr |
331 | if not revision: | 332 | if not revisionExpr: |
332 | raise ManifestParseError, \ | 333 | raise ManifestParseError, \ |
333 | "no revision for project %s within %s" % \ | 334 | "no revision for project %s within %s" % \ |
334 | (name, self.manifestFile) | 335 | (name, self.manifestFile) |
@@ -355,7 +356,8 @@ class XmlManifest(object): | |||
355 | gitdir = gitdir, | 356 | gitdir = gitdir, |
356 | worktree = worktree, | 357 | worktree = worktree, |
357 | relpath = path, | 358 | relpath = path, |
358 | revision = revision) | 359 | revisionExpr = revisionExpr, |
360 | revisionId = None) | ||
359 | 361 | ||
360 | for n in node.childNodes: | 362 | for n in node.childNodes: |
361 | if n.nodeName == 'copyfile': | 363 | if n.nodeName == 'copyfile': |