diff options
author | Shawn O. Pearce <sop@google.com> | 2009-06-04 16:18:09 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2009-06-04 16:21:01 -0700 |
commit | 3a68bb4c7f50897c0dbca59ca47aef463a9ad8d0 (patch) | |
tree | 7d469d0d1c996106fa5a90747ee644f7bcda881e /subcmds/sync.py | |
parent | cd1d7ff81e0b4ab481f83ff883505dbf2442d5be (diff) | |
download | git-repo-3a68bb4c7f50897c0dbca59ca47aef463a9ad8d0.tar.gz |
sync: Tolerate blank lines in project.listv1.6.8.1
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>
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r-- | subcmds/sync.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index ad05cadd..6bccbb03 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -123,7 +123,8 @@ later is required to fix a server side protocol bug. | |||
123 | def UpdateProjectList(self): | 123 | def UpdateProjectList(self): |
124 | new_project_paths = [] | 124 | new_project_paths = [] |
125 | for project in self.manifest.projects.values(): | 125 | for project in self.manifest.projects.values(): |
126 | new_project_paths.append(project.relpath) | 126 | if project.relpath: |
127 | new_project_paths.append(project.relpath) | ||
127 | file_name = 'project.list' | 128 | file_name = 'project.list' |
128 | file_path = os.path.join(self.manifest.repodir, file_name) | 129 | file_path = os.path.join(self.manifest.repodir, file_name) |
129 | old_project_paths = [] | 130 | old_project_paths = [] |
@@ -135,6 +136,8 @@ later is required to fix a server side protocol bug. | |||
135 | finally: | 136 | finally: |
136 | fd.close() | 137 | fd.close() |
137 | for path in old_project_paths: | 138 | for path in old_project_paths: |
139 | if not path: | ||
140 | continue | ||
138 | if path not in new_project_paths: | 141 | if path not in new_project_paths: |
139 | project = Project( | 142 | project = Project( |
140 | manifest = self.manifest, | 143 | manifest = self.manifest, |
@@ -166,6 +169,7 @@ uncommitted changes are present' % project.relpath | |||
166 | fd = open(file_path, 'w') | 169 | fd = open(file_path, 'w') |
167 | try: | 170 | try: |
168 | fd.write('\n'.join(new_project_paths)) | 171 | fd.write('\n'.join(new_project_paths)) |
172 | fd.write('\n') | ||
169 | finally: | 173 | finally: |
170 | fd.close() | 174 | fd.close() |
171 | return 0 | 175 | return 0 |