diff options
author | Shawn O. Pearce <sop@google.com> | 2010-10-29 12:05:43 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2010-10-29 12:08:57 -0700 |
commit | 16614f86b3cc8d61ccae7197624fa93fc752767b (patch) | |
tree | 218818ddc0e9521a85aa804477e59fff6f28364e /subcmds/sync.py | |
parent | 88443387b1b0508f43b57e104821c6b375806fea (diff) | |
download | git-repo-16614f86b3cc8d61ccae7197624fa93fc752767b.tar.gz |
sync --quiet: be more quiet
Change-Id: I5e8363c7b32e4546d1236cfc5a32e01c3e5ea8e6
Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'subcmds/sync.py')
-rw-r--r-- | subcmds/sync.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index 6cac2e52..1f4b137f 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -110,6 +110,9 @@ later is required to fix a server side protocol bug. | |||
110 | p.add_option('-d','--detach', | 110 | p.add_option('-d','--detach', |
111 | dest='detach_head', action='store_true', | 111 | dest='detach_head', action='store_true', |
112 | help='detach projects back to manifest revision') | 112 | help='detach projects back to manifest revision') |
113 | p.add_option('-q','--quiet', | ||
114 | dest='quiet', action='store_true', | ||
115 | help='be more quiet') | ||
113 | p.add_option('-j','--jobs', | 116 | p.add_option('-j','--jobs', |
114 | dest='jobs', action='store', type='int', | 117 | dest='jobs', action='store', type='int', |
115 | help="number of projects to fetch simultaneously") | 118 | help="number of projects to fetch simultaneously") |
@@ -126,8 +129,8 @@ later is required to fix a server side protocol bug. | |||
126 | dest='repo_upgraded', action='store_true', | 129 | dest='repo_upgraded', action='store_true', |
127 | help=SUPPRESS_HELP) | 130 | help=SUPPRESS_HELP) |
128 | 131 | ||
129 | def _FetchHelper(self, project, lock, fetched, pm, sem): | 132 | def _FetchHelper(self, opt, project, lock, fetched, pm, sem): |
130 | if not project.Sync_NetworkHalf(): | 133 | if not project.Sync_NetworkHalf(quiet=opt.quiet): |
131 | print >>sys.stderr, 'error: Cannot fetch %s' % project.name | 134 | print >>sys.stderr, 'error: Cannot fetch %s' % project.name |
132 | sem.release() | 135 | sem.release() |
133 | sys.exit(1) | 136 | sys.exit(1) |
@@ -138,14 +141,14 @@ later is required to fix a server side protocol bug. | |||
138 | lock.release() | 141 | lock.release() |
139 | sem.release() | 142 | sem.release() |
140 | 143 | ||
141 | def _Fetch(self, projects): | 144 | def _Fetch(self, projects, opt): |
142 | fetched = set() | 145 | fetched = set() |
143 | pm = Progress('Fetching projects', len(projects)) | 146 | pm = Progress('Fetching projects', len(projects)) |
144 | 147 | ||
145 | if self.jobs == 1: | 148 | if self.jobs == 1: |
146 | for project in projects: | 149 | for project in projects: |
147 | pm.update() | 150 | pm.update() |
148 | if project.Sync_NetworkHalf(): | 151 | if project.Sync_NetworkHalf(quiet=opt.quiet): |
149 | fetched.add(project.gitdir) | 152 | fetched.add(project.gitdir) |
150 | else: | 153 | else: |
151 | print >>sys.stderr, 'error: Cannot fetch %s' % project.name | 154 | print >>sys.stderr, 'error: Cannot fetch %s' % project.name |
@@ -157,7 +160,12 @@ later is required to fix a server side protocol bug. | |||
157 | for project in projects: | 160 | for project in projects: |
158 | sem.acquire() | 161 | sem.acquire() |
159 | t = _threading.Thread(target = self._FetchHelper, | 162 | t = _threading.Thread(target = self._FetchHelper, |
160 | args = (project, lock, fetched, pm, sem)) | 163 | args = (opt, |
164 | project, | ||
165 | lock, | ||
166 | fetched, | ||
167 | pm, | ||
168 | sem)) | ||
161 | threads.add(t) | 169 | threads.add(t) |
162 | t.start() | 170 | t.start() |
163 | 171 | ||
@@ -291,7 +299,7 @@ uncommitted changes are present' % project.relpath | |||
291 | _PostRepoUpgrade(self.manifest) | 299 | _PostRepoUpgrade(self.manifest) |
292 | 300 | ||
293 | if not opt.local_only: | 301 | if not opt.local_only: |
294 | mp.Sync_NetworkHalf() | 302 | mp.Sync_NetworkHalf(quiet=opt.quiet) |
295 | 303 | ||
296 | if mp.HasChanges: | 304 | if mp.HasChanges: |
297 | syncbuf = SyncBuffer(mp.config) | 305 | syncbuf = SyncBuffer(mp.config) |
@@ -308,7 +316,7 @@ uncommitted changes are present' % project.relpath | |||
308 | to_fetch.append(rp) | 316 | to_fetch.append(rp) |
309 | to_fetch.extend(all) | 317 | to_fetch.extend(all) |
310 | 318 | ||
311 | fetched = self._Fetch(to_fetch) | 319 | fetched = self._Fetch(to_fetch, opt) |
312 | _PostRepoFetch(rp, opt.no_repo_verify) | 320 | _PostRepoFetch(rp, opt.no_repo_verify) |
313 | if opt.network_only: | 321 | if opt.network_only: |
314 | # bail out now; the rest touches the working tree | 322 | # bail out now; the rest touches the working tree |
@@ -320,7 +328,7 @@ uncommitted changes are present' % project.relpath | |||
320 | for project in all: | 328 | for project in all: |
321 | if project.gitdir not in fetched: | 329 | if project.gitdir not in fetched: |
322 | missing.append(project) | 330 | missing.append(project) |
323 | self._Fetch(missing) | 331 | self._Fetch(missing, opt) |
324 | 332 | ||
325 | if self.manifest.IsMirror: | 333 | if self.manifest.IsMirror: |
326 | # bail out now, we have no working tree | 334 | # bail out now, we have no working tree |