소스 검색

Fixing project renaming bug.

This bug happens when a project gets added to the manifest, and
then is renamed. Users who happened to have run "repo sync" after
the project was added but before the rename happened will try to
read the data from the old project, as the manifest was only updated
after all projects were updated successfully.
Nico Sallembien 16 년 전
부모
커밋
9bb1816bdc
1개의 변경된 파일9개의 추가작업 그리고 9개의 파일을 삭제
  1. 9 9
      subcmds/sync.py

+ 9 - 9
subcmds/sync.py

@@ -111,7 +111,6 @@ later is required to fix a server side protocol bug.
     pm = Progress('Fetching projects', len(projects))
     for project in projects:
       pm.update()
-
       if project.Sync_NetworkHalf():
         fetched.add(project.gitdir)
       else:
@@ -192,6 +191,15 @@ uncommitted changes are present' % project.relpath
     if opt.repo_upgraded:
       _PostRepoUpgrade(self.manifest)
 
+    if not opt.local_only:
+      mp.Sync_NetworkHalf()
+
+    if mp.HasChanges:
+      syncbuf = SyncBuffer(mp.config)
+      mp.Sync_LocalHalf(syncbuf)
+      if not syncbuf.Finish():
+        sys.exit(1)
+      self.manifest._Unload()
     all = self.GetProjects(args, missing_ok=True)
 
     if not opt.local_only:
@@ -199,7 +207,6 @@ uncommitted changes are present' % project.relpath
       now = time.time()
       if (24 * 60 * 60) <= (now - rp.LastFetch):
         to_fetch.append(rp)
-      to_fetch.append(mp)
       to_fetch.extend(all)
 
       fetched = self._Fetch(to_fetch)
@@ -208,12 +215,6 @@ uncommitted changes are present' % project.relpath
         # bail out now; the rest touches the working tree
         return
 
-      if mp.HasChanges:
-        syncbuf = SyncBuffer(mp.config)
-        mp.Sync_LocalHalf(syncbuf)
-        if not syncbuf.Finish():
-          sys.exit(1)
-
         self.manifest._Unload()
         all = self.GetProjects(args, missing_ok=True)
         missing = []
@@ -241,7 +242,6 @@ uncommitted changes are present' % project.relpath
     if not syncbuf.Finish():
       sys.exit(1)
 
-
 def _PostRepoUpgrade(manifest):
   for project in manifest.projects.values():
     if project.Exists: