diff options
| -rw-r--r-- | docs/manifest-format.txt | 2 | ||||
| -rw-r--r-- | manifest_xml.py | 23 | ||||
| -rw-r--r-- | project.py | 5 |
3 files changed, 28 insertions, 2 deletions
diff --git a/docs/manifest-format.txt b/docs/manifest-format.txt index 764e41eb..53789651 100644 --- a/docs/manifest-format.txt +++ b/docs/manifest-format.txt | |||
| @@ -39,6 +39,7 @@ following DTD: | |||
| 39 | <!ATTLIST default remote IDREF #IMPLIED> | 39 | <!ATTLIST default remote IDREF #IMPLIED> |
| 40 | <!ATTLIST default revision CDATA #IMPLIED> | 40 | <!ATTLIST default revision CDATA #IMPLIED> |
| 41 | <!ATTLIST default sync-j CDATA #IMPLIED> | 41 | <!ATTLIST default sync-j CDATA #IMPLIED> |
| 42 | <!ATTLIST default sync-c CDATA #IMPLIED> | ||
| 42 | 43 | ||
| 43 | <!ELEMENT manifest-server (EMPTY)> | 44 | <!ELEMENT manifest-server (EMPTY)> |
| 44 | <!ATTLIST url CDATA #REQUIRED> | 45 | <!ATTLIST url CDATA #REQUIRED> |
| @@ -49,6 +50,7 @@ following DTD: | |||
| 49 | <!ATTLIST project remote IDREF #IMPLIED> | 50 | <!ATTLIST project remote IDREF #IMPLIED> |
| 50 | <!ATTLIST project revision CDATA #IMPLIED> | 51 | <!ATTLIST project revision CDATA #IMPLIED> |
| 51 | <!ATTLIST project groups CDATA #IMPLIED> | 52 | <!ATTLIST project groups CDATA #IMPLIED> |
| 53 | <!ATTLIST project sync-c CDATA #IMPLIED> | ||
| 52 | 54 | ||
| 53 | <!ELEMENT annotation (EMPTY)> | 55 | <!ELEMENT annotation (EMPTY)> |
| 54 | <!ATTLIST annotation name CDATA #REQUIRED> | 56 | <!ATTLIST annotation name CDATA #REQUIRED> |
diff --git a/manifest_xml.py b/manifest_xml.py index d20eac2a..ca65e33f 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
| @@ -35,6 +35,7 @@ class _Default(object): | |||
| 35 | revisionExpr = None | 35 | revisionExpr = None |
| 36 | remote = None | 36 | remote = None |
| 37 | sync_j = 1 | 37 | sync_j = 1 |
| 38 | sync_c = False | ||
| 38 | 39 | ||
| 39 | class _XmlRemote(object): | 40 | class _XmlRemote(object): |
| 40 | def __init__(self, | 41 | def __init__(self, |
| @@ -159,6 +160,9 @@ class XmlManifest(object): | |||
| 159 | if d.sync_j > 1: | 160 | if d.sync_j > 1: |
| 160 | have_default = True | 161 | have_default = True |
| 161 | e.setAttribute('sync-j', '%d' % d.sync_j) | 162 | e.setAttribute('sync-j', '%d' % d.sync_j) |
| 163 | if d.sync_c: | ||
| 164 | have_default = True | ||
| 165 | e.setAttribute('sync-c', 'true') | ||
| 162 | if have_default: | 166 | if have_default: |
| 163 | root.appendChild(e) | 167 | root.appendChild(e) |
| 164 | root.appendChild(doc.createTextNode('')) | 168 | root.appendChild(doc.createTextNode('')) |
| @@ -212,6 +216,9 @@ class XmlManifest(object): | |||
| 212 | ae.setAttribute('value', a.value) | 216 | ae.setAttribute('value', a.value) |
| 213 | e.appendChild(ae) | 217 | e.appendChild(ae) |
| 214 | 218 | ||
| 219 | if p.sync_c: | ||
| 220 | e.setAttribute('sync-c', 'true') | ||
| 221 | |||
| 215 | if self._repo_hooks_project: | 222 | if self._repo_hooks_project: |
| 216 | root.appendChild(doc.createTextNode('')) | 223 | root.appendChild(doc.createTextNode('')) |
| 217 | e = doc.createElement('repo-hooks') | 224 | e = doc.createElement('repo-hooks') |
| @@ -444,11 +451,18 @@ class XmlManifest(object): | |||
| 444 | d.revisionExpr = node.getAttribute('revision') | 451 | d.revisionExpr = node.getAttribute('revision') |
| 445 | if d.revisionExpr == '': | 452 | if d.revisionExpr == '': |
| 446 | d.revisionExpr = None | 453 | d.revisionExpr = None |
| 454 | |||
| 447 | sync_j = node.getAttribute('sync-j') | 455 | sync_j = node.getAttribute('sync-j') |
| 448 | if sync_j == '' or sync_j is None: | 456 | if sync_j == '' or sync_j is None: |
| 449 | d.sync_j = 1 | 457 | d.sync_j = 1 |
| 450 | else: | 458 | else: |
| 451 | d.sync_j = int(sync_j) | 459 | d.sync_j = int(sync_j) |
| 460 | |||
| 461 | sync_c = node.getAttribute('sync-c') | ||
| 462 | if not sync_c: | ||
| 463 | d.sync_c = False | ||
| 464 | else: | ||
| 465 | d.sync_c = sync_c.lower() in ("yes", "true", "1") | ||
| 452 | return d | 466 | return d |
| 453 | 467 | ||
| 454 | def _ParseNotice(self, node): | 468 | def _ParseNotice(self, node): |
| @@ -526,6 +540,12 @@ class XmlManifest(object): | |||
| 526 | else: | 540 | else: |
| 527 | rebase = rebase.lower() in ("yes", "true", "1") | 541 | rebase = rebase.lower() in ("yes", "true", "1") |
| 528 | 542 | ||
| 543 | sync_c = node.getAttribute('sync-c') | ||
| 544 | if not sync_c: | ||
| 545 | sync_c = False | ||
| 546 | else: | ||
| 547 | sync_c = sync_c.lower() in ("yes", "true", "1") | ||
| 548 | |||
| 529 | groups = '' | 549 | groups = '' |
| 530 | if node.hasAttribute('groups'): | 550 | if node.hasAttribute('groups'): |
| 531 | groups = node.getAttribute('groups') | 551 | groups = node.getAttribute('groups') |
| @@ -550,7 +570,8 @@ class XmlManifest(object): | |||
| 550 | revisionExpr = revisionExpr, | 570 | revisionExpr = revisionExpr, |
| 551 | revisionId = None, | 571 | revisionId = None, |
| 552 | rebase = rebase, | 572 | rebase = rebase, |
| 553 | groups = groups) | 573 | groups = groups, |
| 574 | sync_c = sync_c) | ||
| 554 | 575 | ||
| 555 | for n in node.childNodes: | 576 | for n in node.childNodes: |
| 556 | if n.nodeName == 'copyfile': | 577 | if n.nodeName == 'copyfile': |
| @@ -510,7 +510,8 @@ class Project(object): | |||
| 510 | revisionExpr, | 510 | revisionExpr, |
| 511 | revisionId, | 511 | revisionId, |
| 512 | rebase = True, | 512 | rebase = True, |
| 513 | groups = None): | 513 | groups = None, |
| 514 | sync_c = False): | ||
| 514 | self.manifest = manifest | 515 | self.manifest = manifest |
| 515 | self.name = name | 516 | self.name = name |
| 516 | self.remote = remote | 517 | self.remote = remote |
| @@ -531,6 +532,7 @@ class Project(object): | |||
| 531 | 532 | ||
| 532 | self.rebase = rebase | 533 | self.rebase = rebase |
| 533 | self.groups = groups | 534 | self.groups = groups |
| 535 | self.sync_c = sync_c | ||
| 534 | 536 | ||
| 535 | self.snapshots = {} | 537 | self.snapshots = {} |
| 536 | self.copyfiles = [] | 538 | self.copyfiles = [] |
| @@ -964,6 +966,7 @@ class Project(object): | |||
| 964 | and self._ApplyCloneBundle(initial=is_new, quiet=quiet): | 966 | and self._ApplyCloneBundle(initial=is_new, quiet=quiet): |
| 965 | is_new = False | 967 | is_new = False |
| 966 | 968 | ||
| 969 | current_branch_only = current_branch_only or self.sync_c or self.manifest.default.sync_c | ||
| 967 | if not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir, | 970 | if not self._RemoteFetch(initial=is_new, quiet=quiet, alt_dir=alt_dir, |
| 968 | current_branch_only=current_branch_only): | 971 | current_branch_only=current_branch_only): |
| 969 | return False | 972 | return False |
