diff options
| author | Conley Owens <cco3@android.com> | 2012-10-03 16:49:12 -0700 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2012-10-03 16:49:12 -0700 |
| commit | 3ff9decfd4e2f1fed71658d0f78a17895f80ff5f (patch) | |
| tree | 5ecf68da509291eaf368772f3f5c3571060651a8 /manifest_xml.py | |
| parent | 9779565abf06d2f1e48548197be350a06c1eab9b (diff) | |
| parent | 14a6674e32b3000dbe8b7c96b0d1bb4fb0021720 (diff) | |
| download | git-repo-3ff9decfd4e2f1fed71658d0f78a17895f80ff5f.tar.gz | |
Merge "manifest: record the original revision when in -r mode."
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 8be83cf9..a6364a77 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
| @@ -124,7 +124,7 @@ class XmlManifest(object): | |||
| 124 | if r.reviewUrl is not None: | 124 | if r.reviewUrl is not None: |
| 125 | e.setAttribute('review', r.reviewUrl) | 125 | e.setAttribute('review', r.reviewUrl) |
| 126 | 126 | ||
| 127 | def Save(self, fd, peg_rev=False): | 127 | def Save(self, fd, peg_rev=False, peg_rev_upstream=True): |
| 128 | """Write the current manifest out to the given file descriptor. | 128 | """Write the current manifest out to the given file descriptor. |
| 129 | """ | 129 | """ |
| 130 | mp = self.manifestProject | 130 | mp = self.manifestProject |
| @@ -198,11 +198,15 @@ class XmlManifest(object): | |||
| 198 | e.setAttribute('remote', p.remote.name) | 198 | e.setAttribute('remote', p.remote.name) |
| 199 | if peg_rev: | 199 | if peg_rev: |
| 200 | if self.IsMirror: | 200 | if self.IsMirror: |
| 201 | e.setAttribute('revision', | 201 | value = p.bare_git.rev_parse(p.revisionExpr + '^0') |
| 202 | p.bare_git.rev_parse(p.revisionExpr + '^0')) | ||
| 203 | else: | 202 | else: |
| 204 | e.setAttribute('revision', | 203 | value = p.work_git.rev_parse(HEAD + '^0') |
| 205 | p.work_git.rev_parse(HEAD + '^0')) | 204 | e.setAttribute('revision', value) |
| 205 | if peg_rev_upstream and value != p.revisionExpr: | ||
| 206 | # Only save the origin if the origin is not a sha1, and the default | ||
| 207 | # isn't our value, and the if the default doesn't already have that | ||
| 208 | # covered. | ||
| 209 | e.setAttribute('upstream', p.revisionExpr) | ||
| 206 | elif not d.revisionExpr or p.revisionExpr != d.revisionExpr: | 210 | elif not d.revisionExpr or p.revisionExpr != d.revisionExpr: |
| 207 | e.setAttribute('revision', p.revisionExpr) | 211 | e.setAttribute('revision', p.revisionExpr) |
| 208 | 212 | ||
| @@ -574,6 +578,8 @@ class XmlManifest(object): | |||
| 574 | else: | 578 | else: |
| 575 | sync_c = sync_c.lower() in ("yes", "true", "1") | 579 | sync_c = sync_c.lower() in ("yes", "true", "1") |
| 576 | 580 | ||
| 581 | upstream = node.getAttribute('upstream') | ||
| 582 | |||
| 577 | groups = '' | 583 | groups = '' |
| 578 | if node.hasAttribute('groups'): | 584 | if node.hasAttribute('groups'): |
| 579 | groups = node.getAttribute('groups') | 585 | groups = node.getAttribute('groups') |
| @@ -600,7 +606,8 @@ class XmlManifest(object): | |||
| 600 | revisionId = None, | 606 | revisionId = None, |
| 601 | rebase = rebase, | 607 | rebase = rebase, |
| 602 | groups = groups, | 608 | groups = groups, |
| 603 | sync_c = sync_c) | 609 | sync_c = sync_c, |
| 610 | upstream = upstream) | ||
| 604 | 611 | ||
| 605 | for n in node.childNodes: | 612 | for n in node.childNodes: |
| 606 | if n.nodeName == 'copyfile': | 613 | if n.nodeName == 'copyfile': |
