summaryrefslogtreecommitdiffstats
path: root/subcmds/sync.py
diff options
context:
space:
mode:
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r--subcmds/sync.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py
index ec5ada21..55ffca3e 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -18,6 +18,7 @@ import os
18import re 18import re
19import subprocess 19import subprocess
20import sys 20import sys
21import time
21 22
22from git_command import GIT 23from git_command import GIT
23from project import HEAD 24from project import HEAD
@@ -72,7 +73,7 @@ revision is temporarily needed.
72 dest='repo_upgraded', action='store_true', 73 dest='repo_upgraded', action='store_true',
73 help=SUPPRESS_HELP) 74 help=SUPPRESS_HELP)
74 75
75 def _Fetch(self, *projects): 76 def _Fetch(self, projects):
76 fetched = set() 77 fetched = set()
77 pm = Progress('Fetching projects', len(projects)) 78 pm = Progress('Fetching projects', len(projects))
78 for project in projects: 79 for project in projects:
@@ -106,7 +107,14 @@ revision is temporarily needed.
106 all = self.GetProjects(args, missing_ok=True) 107 all = self.GetProjects(args, missing_ok=True)
107 108
108 if not opt.local_only: 109 if not opt.local_only:
109 fetched = self._Fetch(rp, mp, *all) 110 to_fetch = []
111 now = time.time()
112 if (24 * 60 * 60) <= (now - rp.LastFetch):
113 to_fetch.append(rp)
114 to_fetch.append(mp)
115 to_fetch.extend(all)
116
117 fetched = self._Fetch(to_fetch)
110 _PostRepoFetch(rp, opt.no_repo_verify) 118 _PostRepoFetch(rp, opt.no_repo_verify)
111 if opt.network_only: 119 if opt.network_only:
112 # bail out now; the rest touches the working tree 120 # bail out now; the rest touches the working tree
@@ -124,7 +132,7 @@ revision is temporarily needed.
124 for project in all: 132 for project in all:
125 if project.gitdir not in fetched: 133 if project.gitdir not in fetched:
126 missing.append(project) 134 missing.append(project)
127 self._Fetch(*missing) 135 self._Fetch(missing)
128 136
129 syncbuf = SyncBuffer(mp.config, 137 syncbuf = SyncBuffer(mp.config,
130 detach_head = opt.detach_head) 138 detach_head = opt.detach_head)