diff options
Diffstat (limited to 'subcmds/sync.py')
| -rw-r--r-- | subcmds/sync.py | 45 | 
1 files changed, 23 insertions, 22 deletions
| diff --git a/subcmds/sync.py b/subcmds/sync.py index eac0556d..4a544706 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
| @@ -164,31 +164,32 @@ later is required to fix a server side protocol bug. | |||
| 164 | # - We always make sure we call sem.release(). | 164 | # - We always make sure we call sem.release(). | 
| 165 | # - We always make sure we unlock the lock if we locked it. | 165 | # - We always make sure we unlock the lock if we locked it. | 
| 166 | try: | 166 | try: | 
| 167 | success = project.Sync_NetworkHalf(quiet=opt.quiet) | 167 | try: | 
| 168 | success = project.Sync_NetworkHalf(quiet=opt.quiet) | ||
| 168 | 169 | ||
| 169 | # Lock around all the rest of the code, since printing, updating a set | 170 | # Lock around all the rest of the code, since printing, updating a set | 
| 170 | # and Progress.update() are not thread safe. | 171 | # and Progress.update() are not thread safe. | 
| 171 | lock.acquire() | 172 | lock.acquire() | 
| 172 | did_lock = True | 173 | did_lock = True | 
| 173 | 174 | ||
| 174 | if not success: | 175 | if not success: | 
| 175 | print >>sys.stderr, 'error: Cannot fetch %s' % project.name | 176 | print >>sys.stderr, 'error: Cannot fetch %s' % project.name | 
| 176 | if opt.force_broken: | 177 | if opt.force_broken: | 
| 177 | print >>sys.stderr, 'warn: --force-broken, continuing to sync' | 178 | print >>sys.stderr, 'warn: --force-broken, continuing to sync' | 
| 178 | else: | 179 | else: | 
| 179 | raise _FetchError() | 180 | raise _FetchError() | 
| 180 | 181 | ||
| 181 | fetched.add(project.gitdir) | 182 | fetched.add(project.gitdir) | 
| 182 | pm.update() | 183 | pm.update() | 
| 183 | except BaseException, e: | 184 | except BaseException, e: | 
| 184 | # Notify the _Fetch() function about all errors. | 185 | # Notify the _Fetch() function about all errors. | 
| 185 | err_event.set() | 186 | err_event.set() | 
| 186 | 187 | ||
| 187 | # If we got our own _FetchError, we don't want a stack trace. | 188 | # If we got our own _FetchError, we don't want a stack trace. | 
| 188 | # However, if we got something else (something in Sync_NetworkHalf?), | 189 | # However, if we got something else (something in Sync_NetworkHalf?), | 
| 189 | # we'd like one (so re-raise after we've set err_event). | 190 | # we'd like one (so re-raise after we've set err_event). | 
| 190 | if not isinstance(e, _FetchError): | 191 | if not isinstance(e, _FetchError): | 
| 191 | raise | 192 | raise | 
| 192 | finally: | 193 | finally: | 
| 193 | if did_lock: | 194 | if did_lock: | 
| 194 | lock.release() | 195 | lock.release() | 
