summaryrefslogtreecommitdiffstats
path: root/subcmds/sync.py
diff options
context:
space:
mode:
authorSimran Basi <sbasi@google.com>2015-08-20 12:19:28 -0700
committerDan Willemsen <dwillemsen@google.com>2015-08-28 10:53:05 -0700
commitb9a1b73425773dc97843f92aeee9c57c9a08c0f7 (patch)
tree592a3655e92af8c7265ba07e29ba35aa1a1a36a8 /subcmds/sync.py
parentdc2545cad60d7e8bae894f5d60eaeb3cff7485ae (diff)
downloadgit-repo-b9a1b73425773dc97843f92aeee9c57c9a08c0f7.tar.gz
GITC: Add repo start support.
Add repo start support for GITC checkouts. If the user is in the GITC FS view, they can now run repo start to check out the sources and create a new working branch. When "repo start" is called on a GITC project, the revision tag is set to an empty string and saved in a new tag: old-revision. This tells the GITC filesystem to display the local copy of the sources when being viewed. The local copy is created by pulling the project sources and the new branch is created based off the original project revision. Updated main.py to setup each command's gitc_manifest when appropriate. Updated repo sync's logic to sync opened projects and updating the GITC manifest file for the rest. Change-Id: I7e4809d1c4fc43c69b26f2f1bebe45aab0cae628
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r--subcmds/sync.py44
1 files changed, 29 insertions, 15 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py
index ad0ecdf4..934aaa80 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -549,15 +549,6 @@ later is required to fix a server side protocol bug.
549 cwd.split(gitc_utils.GITC_MANIFEST_DIR)[1])) 549 cwd.split(gitc_utils.GITC_MANIFEST_DIR)[1]))
550 sys.exit(1) 550 sys.exit(1)
551 551
552 self._gitc_sync = False
553 if cwd.startswith(gitc_utils.GITC_FS_ROOT_DIR):
554 self._gitc_sync = True
555 self._client_name = cwd.split(gitc_utils.GITC_FS_ROOT_DIR)[1].split(
556 '/')[0]
557 self._client_dir = os.path.join(gitc_utils.GITC_MANIFEST_DIR,
558 self._client_name)
559 print('Updating GITC client: %s' % self._client_name)
560
561 if opt.manifest_name: 552 if opt.manifest_name:
562 self.manifest.Override(opt.manifest_name) 553 self.manifest.Override(opt.manifest_name)
563 554
@@ -677,12 +668,6 @@ later is required to fix a server side protocol bug.
677 if opt.repo_upgraded: 668 if opt.repo_upgraded:
678 _PostRepoUpgrade(self.manifest, quiet=opt.quiet) 669 _PostRepoUpgrade(self.manifest, quiet=opt.quiet)
679 670
680 if self._gitc_sync:
681 gitc_utils.generate_gitc_manifest(self._client_dir, self.manifest)
682 print('GITC client successfully synced.')
683 return
684
685
686 if not opt.local_only: 671 if not opt.local_only:
687 mp.Sync_NetworkHalf(quiet=opt.quiet, 672 mp.Sync_NetworkHalf(quiet=opt.quiet,
688 current_branch_only=opt.current_branch_only, 673 current_branch_only=opt.current_branch_only,
@@ -697,6 +682,35 @@ later is required to fix a server side protocol bug.
697 self._ReloadManifest(manifest_name) 682 self._ReloadManifest(manifest_name)
698 if opt.jobs is None: 683 if opt.jobs is None:
699 self.jobs = self.manifest.default.sync_j 684 self.jobs = self.manifest.default.sync_j
685
686 # TODO (sbasi) - Add support for manifest changes, aka projects
687 # have been added or deleted from the manifest.
688 if self.gitc_manifest:
689 gitc_manifest_projects = self.GetProjects(args,
690 manifest=self.gitc_manifest,
691 missing_ok=True)
692 gitc_projects = []
693 opened_projects = []
694 for project in gitc_manifest_projects:
695 if not project.old_revision:
696 gitc_projects.append(project)
697 else:
698 opened_projects.append(project)
699
700 if gitc_projects and not opt.local_only:
701 print('Updating GITC client: %s' % self.gitc_manifest.gitc_client_name)
702 gitc_utils.generate_gitc_manifest(self.gitc_manifest.gitc_client_dir,
703 self.gitc_manifest,
704 gitc_projects)
705 print('GITC client successfully synced.')
706
707 # The opened projects need to be synced as normal, therefore we
708 # generate a new args list to represent the opened projects.
709 args = []
710 for proj in opened_projects:
711 args.append(os.path.relpath(proj.worktree, cwd))
712 if not args:
713 return
700 all_projects = self.GetProjects(args, 714 all_projects = self.GetProjects(args,
701 missing_ok=True, 715 missing_ok=True,
702 submodules_ok=opt.fetch_submodules) 716 submodules_ok=opt.fetch_submodules)