diff options
Diffstat (limited to 'manifest_xml.py')
-rw-r--r-- | manifest_xml.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/manifest_xml.py b/manifest_xml.py index 8e9efd13..be185477 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -123,7 +123,7 @@ class XmlManifest(object): | |||
123 | if r.reviewUrl is not None: | 123 | if r.reviewUrl is not None: |
124 | e.setAttribute('review', r.reviewUrl) | 124 | e.setAttribute('review', r.reviewUrl) |
125 | 125 | ||
126 | def Save(self, fd, peg_rev=False): | 126 | def Save(self, fd, peg_rev=False, peg_rev_upstream=True): |
127 | """Write the current manifest out to the given file descriptor. | 127 | """Write the current manifest out to the given file descriptor. |
128 | """ | 128 | """ |
129 | mp = self.manifestProject | 129 | mp = self.manifestProject |
@@ -197,11 +197,15 @@ class XmlManifest(object): | |||
197 | e.setAttribute('remote', p.remote.name) | 197 | e.setAttribute('remote', p.remote.name) |
198 | if peg_rev: | 198 | if peg_rev: |
199 | if self.IsMirror: | 199 | if self.IsMirror: |
200 | e.setAttribute('revision', | 200 | value = p.bare_git.rev_parse(p.revisionExpr + '^0') |
201 | p.bare_git.rev_parse(p.revisionExpr + '^0')) | ||
202 | else: | 201 | else: |
203 | e.setAttribute('revision', | 202 | value = p.work_git.rev_parse(HEAD + '^0') |
204 | p.work_git.rev_parse(HEAD + '^0')) | 203 | e.setAttribute('revision', value) |
204 | if peg_rev_upstream and value != p.revisionExpr: | ||
205 | # Only save the origin if the origin is not a sha1, and the default | ||
206 | # isn't our value, and the if the default doesn't already have that | ||
207 | # covered. | ||
208 | e.setAttribute('upstream', p.revisionExpr) | ||
205 | elif not d.revisionExpr or p.revisionExpr != d.revisionExpr: | 209 | elif not d.revisionExpr or p.revisionExpr != d.revisionExpr: |
206 | e.setAttribute('revision', p.revisionExpr) | 210 | e.setAttribute('revision', p.revisionExpr) |
207 | 211 | ||
@@ -573,6 +577,8 @@ class XmlManifest(object): | |||
573 | else: | 577 | else: |
574 | sync_c = sync_c.lower() in ("yes", "true", "1") | 578 | sync_c = sync_c.lower() in ("yes", "true", "1") |
575 | 579 | ||
580 | upstream = node.getAttribute('upstream') | ||
581 | |||
576 | groups = '' | 582 | groups = '' |
577 | if node.hasAttribute('groups'): | 583 | if node.hasAttribute('groups'): |
578 | groups = node.getAttribute('groups') | 584 | groups = node.getAttribute('groups') |
@@ -599,7 +605,8 @@ class XmlManifest(object): | |||
599 | revisionId = None, | 605 | revisionId = None, |
600 | rebase = rebase, | 606 | rebase = rebase, |
601 | groups = groups, | 607 | groups = groups, |
602 | sync_c = sync_c) | 608 | sync_c = sync_c, |
609 | upstream = upstream) | ||
603 | 610 | ||
604 | for n in node.childNodes: | 611 | for n in node.childNodes: |
605 | if n.nodeName == 'copyfile': | 612 | if n.nodeName == 'copyfile': |