summaryrefslogtreecommitdiffstats
path: root/subcmds/sync.py
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2015-09-08 13:27:20 -0700
committerDan Willemsen <dwillemsen@google.com>2015-09-09 12:35:56 -0700
commit250303b437855c2b50d052a05a08ed517423af8b (patch)
treeae9df65083e7e0e53d3438adb752cad2dbe27cb5 /subcmds/sync.py
parentba72d8301e33344b3b11e286619c99568c37db1a (diff)
downloadgit-repo-250303b437855c2b50d052a05a08ed517423af8b.tar.gz
GITC: Always update the gitc manifest from the repo manifest
This way any changes made to the main manifest are reflected in the gitc manifest. It's also necessary to use both manifests to sync since the information required to update the gitc manifest is actually in the repo manifest. This also fixes a few issues that came up when testing. notdefault groups weren't being saved to the gitc manifest in a method that matched 'sync'. The merge branch wasn't always being set to the correct value either. Change-Id: I5dbc850dd73a9fbd10ab2470ae4c40e46ff894de
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r--subcmds/sync.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 7b44dbd8..79cfaaa5 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -670,32 +670,36 @@ later is required to fix a server side protocol bug.
670 if opt.jobs is None: 670 if opt.jobs is None:
671 self.jobs = self.manifest.default.sync_j 671 self.jobs = self.manifest.default.sync_j
672 672
673 # TODO (sbasi) - Add support for manifest changes, aka projects
674 # have been added or deleted from the manifest.
675 if self.gitc_manifest: 673 if self.gitc_manifest:
676 gitc_manifest_projects = self.GetProjects(args, 674 gitc_manifest_projects = self.GetProjects(args,
677 manifest=self.gitc_manifest,
678 missing_ok=True) 675 missing_ok=True)
679 gitc_projects = [] 676 gitc_projects = []
680 opened_projects = [] 677 opened_projects = []
681 for project in gitc_manifest_projects: 678 for project in gitc_manifest_projects:
682 if not project.old_revision: 679 if project.relpath in self.gitc_manifest.paths and \
683 gitc_projects.append(project) 680 self.gitc_manifest.paths[project.relpath].old_revision:
681 opened_projects.append(project.relpath)
684 else: 682 else:
685 opened_projects.append(project) 683 gitc_projects.append(project.relpath)
686 684
687 if gitc_projects and not opt.local_only: 685 if not args:
686 gitc_projects = None
687
688 if gitc_projects != [] and not opt.local_only:
688 print('Updating GITC client: %s' % self.gitc_manifest.gitc_client_name) 689 print('Updating GITC client: %s' % self.gitc_manifest.gitc_client_name)
689 gitc_utils.generate_gitc_manifest(self.gitc_manifest.gitc_client_dir, 690 gitc_utils.generate_gitc_manifest(self.repodir,
691 self.gitc_manifest.gitc_client_name,
690 self.gitc_manifest, 692 self.gitc_manifest,
693 self.manifest.manifestFile,
691 gitc_projects) 694 gitc_projects)
692 print('GITC client successfully synced.') 695 print('GITC client successfully synced.')
693 696
694 # The opened projects need to be synced as normal, therefore we 697 # The opened projects need to be synced as normal, therefore we
695 # generate a new args list to represent the opened projects. 698 # generate a new args list to represent the opened projects.
696 args = [] 699 # TODO: make this more reliable -- if there's a project name/path overlap,
697 for proj in opened_projects: 700 # this may choose the wrong project.
698 args.append(os.path.relpath(proj.worktree, os.getcwd())) 701 args = [os.path.relpath(self.manifest.paths[p].worktree, os.getcwd())
702 for p in opened_projects]
699 if not args: 703 if not args:
700 return 704 return
701 all_projects = self.GetProjects(args, 705 all_projects = self.GetProjects(args,