Revert "GITC: Always update the gitc manifest from the repo manifest"
This reverts commit 250303b437
.
Change-Id: I1fd8af20f802553151aacb953c913f3305ca6057
This commit is contained in:
parent
250303b437
commit
0375523331
5 changed files with 34 additions and 100 deletions
|
@ -68,13 +68,15 @@ use for this GITC client.
|
|||
os.mkdir(self.client_dir)
|
||||
super(GitcInit, self).Execute(opt, args)
|
||||
|
||||
manifest_file = self.manifest.manifestFile
|
||||
for name, remote in self.manifest.remotes.iteritems():
|
||||
remote.fetchUrl = remote.resolvedFetchUrl
|
||||
|
||||
if opt.manifest_file:
|
||||
if not os.path.exists(opt.manifest_file):
|
||||
print('fatal: Specified manifest file %s does not exist.' %
|
||||
opt.manifest_file)
|
||||
sys.exit(1)
|
||||
manifest_file = opt.manifest_file
|
||||
gitc_utils.generate_gitc_manifest(self.repodir, opt.gitc_client, None, manifest_file)
|
||||
self.manifest.Override(opt.manifest_file)
|
||||
gitc_utils.generate_gitc_manifest(self.client_dir, self.manifest)
|
||||
print('Please run `cd %s` to view your GITC client.' %
|
||||
os.path.join(gitc_utils.GITC_FS_ROOT_DIR, opt.gitc_client))
|
||||
|
|
|
@ -57,6 +57,7 @@ revision specified in the manifest.
|
|||
print("error: at least one project must be specified", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
proj_name_to_gitc_proj_dict = {}
|
||||
if self.gitc_manifest:
|
||||
all_projects = self.GetProjects(projects, manifest=self.gitc_manifest,
|
||||
missing_ok=True)
|
||||
|
@ -66,6 +67,7 @@ revision specified in the manifest.
|
|||
else:
|
||||
project.already_synced = False
|
||||
project.old_revision = project.revisionExpr
|
||||
proj_name_to_gitc_proj_dict[project.name] = project
|
||||
project.revisionExpr = None
|
||||
# Save the GITC manifest.
|
||||
gitc_utils.save_manifest(self.gitc_manifest)
|
||||
|
@ -75,10 +77,9 @@ revision specified in the manifest.
|
|||
pm = Progress('Starting %s' % nb, len(all_projects))
|
||||
for project in all_projects:
|
||||
pm.update()
|
||||
|
||||
if self.gitc_manifest:
|
||||
gitc_project = self.gitc_manifest.paths[project.relpath]
|
||||
# Sync projects that have not been opened.
|
||||
gitc_project = proj_name_to_gitc_proj_dict[project.name]
|
||||
# Sync projects that have already been opened.
|
||||
if not gitc_project.already_synced:
|
||||
proj_localdir = os.path.join(self.gitc_manifest.gitc_client_dir,
|
||||
project.relpath)
|
||||
|
@ -88,7 +89,7 @@ revision specified in the manifest.
|
|||
project.Sync_NetworkHalf()
|
||||
sync_buf = SyncBuffer(self.manifest.manifestProject.config)
|
||||
project.Sync_LocalHalf(sync_buf)
|
||||
project.revisionId = gitc_project.old_revision
|
||||
project.revisionExpr = gitc_project.old_revision
|
||||
|
||||
# If the current revision is a specific SHA1 then we can't push back
|
||||
# to it; so substitute with dest_branch if defined, or with manifest
|
||||
|
@ -99,7 +100,6 @@ revision specified in the manifest.
|
|||
branch_merge = project.dest_branch
|
||||
else:
|
||||
branch_merge = self.manifest.default.revisionExpr
|
||||
|
||||
if not project.StartBranch(nb, branch_merge=branch_merge):
|
||||
err.append(project)
|
||||
pm.end()
|
||||
|
|
|
@ -670,36 +670,32 @@ later is required to fix a server side protocol bug.
|
|||
if opt.jobs is None:
|
||||
self.jobs = self.manifest.default.sync_j
|
||||
|
||||
# TODO (sbasi) - Add support for manifest changes, aka projects
|
||||
# have been added or deleted from the manifest.
|
||||
if self.gitc_manifest:
|
||||
gitc_manifest_projects = self.GetProjects(args,
|
||||
manifest=self.gitc_manifest,
|
||||
missing_ok=True)
|
||||
gitc_projects = []
|
||||
opened_projects = []
|
||||
for project in gitc_manifest_projects:
|
||||
if project.relpath in self.gitc_manifest.paths and \
|
||||
self.gitc_manifest.paths[project.relpath].old_revision:
|
||||
opened_projects.append(project.relpath)
|
||||
if not project.old_revision:
|
||||
gitc_projects.append(project)
|
||||
else:
|
||||
gitc_projects.append(project.relpath)
|
||||
opened_projects.append(project)
|
||||
|
||||
if not args:
|
||||
gitc_projects = None
|
||||
|
||||
if gitc_projects != [] and not opt.local_only:
|
||||
if gitc_projects and not opt.local_only:
|
||||
print('Updating GITC client: %s' % self.gitc_manifest.gitc_client_name)
|
||||
gitc_utils.generate_gitc_manifest(self.repodir,
|
||||
self.gitc_manifest.gitc_client_name,
|
||||
gitc_utils.generate_gitc_manifest(self.gitc_manifest.gitc_client_dir,
|
||||
self.gitc_manifest,
|
||||
self.manifest.manifestFile,
|
||||
gitc_projects)
|
||||
print('GITC client successfully synced.')
|
||||
|
||||
# The opened projects need to be synced as normal, therefore we
|
||||
# generate a new args list to represent the opened projects.
|
||||
# TODO: make this more reliable -- if there's a project name/path overlap,
|
||||
# this may choose the wrong project.
|
||||
args = [os.path.relpath(self.manifest.paths[p].worktree, os.getcwd())
|
||||
for p in opened_projects]
|
||||
args = []
|
||||
for proj in opened_projects:
|
||||
args.append(os.path.relpath(proj.worktree, os.getcwd()))
|
||||
if not args:
|
||||
return
|
||||
all_projects = self.GetProjects(args,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue