summaryrefslogtreecommitdiffstats
path: root/subcmds/sync.py
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r--subcmds/sync.py27
1 files changed, 23 insertions, 4 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py
index a8022d9d..27dd877d 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -423,7 +423,7 @@ uncommitted changes are present' % project.relpath
423 # in the .netrc file. 423 # in the .netrc file.
424 print >>sys.stderr, 'No credentials found for %s in .netrc' % \ 424 print >>sys.stderr, 'No credentials found for %s in .netrc' % \
425 parse_result.hostname 425 parse_result.hostname
426 except netrc.NetrcParseError, e: 426 except netrc.NetrcParseError as e:
427 print >>sys.stderr, 'Error parsing .netrc file: %s' % e 427 print >>sys.stderr, 'Error parsing .netrc file: %s' % e
428 428
429 if (username and password): 429 if (username and password):
@@ -470,11 +470,11 @@ uncommitted changes are present' % project.relpath
470 else: 470 else:
471 print >>sys.stderr, 'error: %s' % manifest_str 471 print >>sys.stderr, 'error: %s' % manifest_str
472 sys.exit(1) 472 sys.exit(1)
473 except (socket.error, IOError, xmlrpclib.Fault), e: 473 except (socket.error, IOError, xmlrpclib.Fault) as e:
474 print >>sys.stderr, 'error: cannot connect to manifest server %s:\n%s' % ( 474 print >>sys.stderr, 'error: cannot connect to manifest server %s:\n%s' % (
475 self.manifest.manifest_server, e) 475 self.manifest.manifest_server, e)
476 sys.exit(1) 476 sys.exit(1)
477 except xmlrpclib.ProtocolError, e: 477 except xmlrpclib.ProtocolError as e:
478 print >>sys.stderr, 'error: cannot connect to manifest server %s:\n%d %s' % ( 478 print >>sys.stderr, 'error: cannot connect to manifest server %s:\n%d %s' % (
479 self.manifest.manifest_server, e.errcode, e.errmsg) 479 self.manifest.manifest_server, e.errcode, e.errmsg)
480 sys.exit(1) 480 sys.exit(1)
@@ -512,12 +512,31 @@ uncommitted changes are present' % project.relpath
512 to_fetch.sort(key=self._fetch_times.Get, reverse=True) 512 to_fetch.sort(key=self._fetch_times.Get, reverse=True)
513 self._fetch_times.Clear() 513 self._fetch_times.Clear()
514 514
515 self._Fetch(to_fetch, opt) 515 fetched = self._Fetch(to_fetch, opt)
516 _PostRepoFetch(rp, opt.no_repo_verify) 516 _PostRepoFetch(rp, opt.no_repo_verify)
517 if opt.network_only: 517 if opt.network_only:
518 # bail out now; the rest touches the working tree 518 # bail out now; the rest touches the working tree
519 return 519 return
520 520
521 # Iteratively fetch missing and/or nested unregistered submodules
522 previously_missing_set = set()
523 while True:
524 self.manifest._Unload()
525 all_projects = self.GetProjects(args, missing_ok=True)
526 missing = []
527 for project in all_projects:
528 if project.gitdir not in fetched:
529 missing.append(project)
530 if not missing:
531 break
532 # Stop us from non-stopped fetching actually-missing repos: If set of
533 # missing repos has not been changed from last fetch, we break.
534 missing_set = set(p.name for p in missing)
535 if previously_missing_set == missing_set:
536 break
537 previously_missing_set = missing_set
538 fetched.update(self._Fetch(missing, opt))
539
521 if self.manifest.IsMirror: 540 if self.manifest.IsMirror:
522 # bail out now, we have no working tree 541 # bail out now, we have no working tree
523 return 542 return