diff options
Diffstat (limited to 'project.py')
| -rw-r--r-- | project.py | 48 |
1 files changed, 14 insertions, 34 deletions
| @@ -657,41 +657,21 @@ class Project(object): | |||
| 657 | """Returns true if the manifest groups specified at init should cause | 657 | """Returns true if the manifest groups specified at init should cause |
| 658 | this project to be synced. | 658 | this project to be synced. |
| 659 | Prefixing a manifest group with "-" inverts the meaning of a group. | 659 | Prefixing a manifest group with "-" inverts the meaning of a group. |
| 660 | All projects are implicitly labelled with "default" unless they are | 660 | All projects are implicitly labelled with "default". |
| 661 | explicitly labelled "-default". | ||
| 662 | If any non-inverted manifest groups are specified, the default label | ||
| 663 | is ignored. | ||
| 664 | Specifying only inverted groups implies "default". | ||
| 665 | """ | ||
| 666 | project_groups = self.groups | ||
| 667 | if not manifest_groups: | ||
| 668 | return not project_groups or not "-default" in project_groups | ||
| 669 | |||
| 670 | if not project_groups: | ||
| 671 | project_groups = ["default"] | ||
| 672 | elif not ("default" in project_groups or "-default" in project_groups): | ||
| 673 | project_groups.append("default") | ||
| 674 | |||
| 675 | plus_groups = [x for x in manifest_groups if not x.startswith("-")] | ||
| 676 | minus_groups = [x[1:] for x in manifest_groups if x.startswith("-")] | ||
| 677 | |||
| 678 | if not plus_groups: | ||
| 679 | plus_groups.append("default") | ||
| 680 | |||
| 681 | for group in minus_groups: | ||
| 682 | if group in project_groups: | ||
| 683 | # project was excluded by -group | ||
| 684 | return False | ||
| 685 | 661 | ||
| 686 | for group in plus_groups: | 662 | labels are resolved in order. In the example case of |
| 687 | if group in project_groups: | 663 | project_groups: "default,group1,group2" |
| 688 | # project was included by group | 664 | manifest_groups: "-group1,group2" |
| 689 | return True | 665 | the project will be matched. |
| 690 | 666 | """ | |
| 691 | # groups were specified that did not include this project | 667 | matched = False |
| 692 | if plus_groups: | 668 | for group in manifest_groups: |
| 693 | return False | 669 | if group.startswith('-') and group[1:] in self.groups: |
| 694 | return True | 670 | matched = False |
| 671 | elif group in self.groups: | ||
| 672 | matched = True | ||
| 673 | |||
| 674 | return matched | ||
| 695 | 675 | ||
| 696 | ## Status Display ## | 676 | ## Status Display ## |
| 697 | 677 | ||
