mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-01-02 16:14:25 +00:00
sync: Tolerate blank lines in project.list
If a line is blank in project.list, its not a relevant project path, so skip over it. Existing project.list files may have blank lines if sync was run with no projects at all, and the file was created empty. Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
parent
cd1d7ff81e
commit
3a68bb4c7f
@ -123,7 +123,8 @@ later is required to fix a server side protocol bug.
|
|||||||
def UpdateProjectList(self):
|
def UpdateProjectList(self):
|
||||||
new_project_paths = []
|
new_project_paths = []
|
||||||
for project in self.manifest.projects.values():
|
for project in self.manifest.projects.values():
|
||||||
new_project_paths.append(project.relpath)
|
if project.relpath:
|
||||||
|
new_project_paths.append(project.relpath)
|
||||||
file_name = 'project.list'
|
file_name = 'project.list'
|
||||||
file_path = os.path.join(self.manifest.repodir, file_name)
|
file_path = os.path.join(self.manifest.repodir, file_name)
|
||||||
old_project_paths = []
|
old_project_paths = []
|
||||||
@ -135,6 +136,8 @@ later is required to fix a server side protocol bug.
|
|||||||
finally:
|
finally:
|
||||||
fd.close()
|
fd.close()
|
||||||
for path in old_project_paths:
|
for path in old_project_paths:
|
||||||
|
if not path:
|
||||||
|
continue
|
||||||
if path not in new_project_paths:
|
if path not in new_project_paths:
|
||||||
project = Project(
|
project = Project(
|
||||||
manifest = self.manifest,
|
manifest = self.manifest,
|
||||||
@ -166,6 +169,7 @@ uncommitted changes are present' % project.relpath
|
|||||||
fd = open(file_path, 'w')
|
fd = open(file_path, 'w')
|
||||||
try:
|
try:
|
||||||
fd.write('\n'.join(new_project_paths))
|
fd.write('\n'.join(new_project_paths))
|
||||||
|
fd.write('\n')
|
||||||
finally:
|
finally:
|
||||||
fd.close()
|
fd.close()
|
||||||
return 0
|
return 0
|
||||||
|
Loading…
Reference in New Issue
Block a user