diff options
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r-- | subcmds/sync.py | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index 2e9bbe70..a99d7e74 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -75,6 +75,7 @@ from error import RepoChangedException, GitError, ManifestParseError | |||
75 | from project import SyncBuffer | 75 | from project import SyncBuffer |
76 | from progress import Progress | 76 | from progress import Progress |
77 | from wrapper import Wrapper | 77 | from wrapper import Wrapper |
78 | from manifest_xml import GitcManifest | ||
78 | 79 | ||
79 | _ONE_DAY_S = 24 * 60 * 60 | 80 | _ONE_DAY_S = 24 * 60 * 60 |
80 | 81 | ||
@@ -670,32 +671,39 @@ later is required to fix a server side protocol bug. | |||
670 | if opt.jobs is None: | 671 | if opt.jobs is None: |
671 | self.jobs = self.manifest.default.sync_j | 672 | self.jobs = self.manifest.default.sync_j |
672 | 673 | ||
673 | # TODO (sbasi) - Add support for manifest changes, aka projects | ||
674 | # have been added or deleted from the manifest. | ||
675 | if self.gitc_manifest: | 674 | if self.gitc_manifest: |
676 | gitc_manifest_projects = self.GetProjects(args, | 675 | gitc_manifest_projects = self.GetProjects(args, |
677 | manifest=self.gitc_manifest, | ||
678 | missing_ok=True) | 676 | missing_ok=True) |
679 | gitc_projects = [] | 677 | gitc_projects = [] |
680 | opened_projects = [] | 678 | opened_projects = [] |
681 | for project in gitc_manifest_projects: | 679 | for project in gitc_manifest_projects: |
682 | if not project.old_revision: | 680 | if project.relpath in self.gitc_manifest.paths and \ |
683 | gitc_projects.append(project) | 681 | self.gitc_manifest.paths[project.relpath].old_revision: |
682 | opened_projects.append(project.relpath) | ||
684 | else: | 683 | else: |
685 | opened_projects.append(project) | 684 | gitc_projects.append(project.relpath) |
686 | 685 | ||
687 | if gitc_projects and not opt.local_only: | 686 | if not args: |
687 | gitc_projects = None | ||
688 | |||
689 | if gitc_projects != [] and not opt.local_only: | ||
688 | print('Updating GITC client: %s' % self.gitc_manifest.gitc_client_name) | 690 | print('Updating GITC client: %s' % self.gitc_manifest.gitc_client_name) |
689 | gitc_utils.generate_gitc_manifest(self.gitc_manifest.gitc_client_dir, | 691 | manifest = GitcManifest(self.repodir, self.gitc_manifest.gitc_client_name) |
690 | self.gitc_manifest, | 692 | if manifest_name: |
693 | manifest.Override(manifest_name) | ||
694 | else: | ||
695 | manifest.Override(self.manifest.manifestFile) | ||
696 | gitc_utils.generate_gitc_manifest(self.gitc_manifest, | ||
697 | manifest, | ||
691 | gitc_projects) | 698 | gitc_projects) |
692 | print('GITC client successfully synced.') | 699 | print('GITC client successfully synced.') |
693 | 700 | ||
694 | # The opened projects need to be synced as normal, therefore we | 701 | # The opened projects need to be synced as normal, therefore we |
695 | # generate a new args list to represent the opened projects. | 702 | # generate a new args list to represent the opened projects. |
696 | args = [] | 703 | # TODO: make this more reliable -- if there's a project name/path overlap, |
697 | for proj in opened_projects: | 704 | # this may choose the wrong project. |
698 | args.append(os.path.relpath(proj.worktree, cwd)) | 705 | args = [os.path.relpath(self.manifest.paths[p].worktree, os.getcwd()) |
706 | for p in opened_projects] | ||
699 | if not args: | 707 | if not args: |
700 | return | 708 | return |
701 | all_projects = self.GetProjects(args, | 709 | all_projects = self.GetProjects(args, |