diff options
author | Hu Xiuyun <clouds08@qq.com> | 2015-11-25 15:52:26 +0800 |
---|---|---|
committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2015-11-26 02:25:43 +0000 |
commit | e9becc079c647f6c9477eed83c0aecb2f591fdf4 (patch) | |
tree | 6fc68e16b2bdba169d97a08e17d92ba4892d68ef | |
parent | 466b8c4ea26f119f2b0532ece764c543e78a873e (diff) | |
download | git-repo-e9becc079c647f6c9477eed83c0aecb2f591fdf4.tar.gz |
Sync: Fix error exit code when both -n and -f are used
When repo sync is used with -f (--force-error) and a project fails to
sync, the sync will continue but then exit with an error status.
However if -n (--network-only) is also used, the exit code is 0, even
when a project failed.
Modify the logic to make sure the sync exits with the correct status.
Bug: Issue 214
Change-Id: I0b5d97a34642c5aa3743750ef14a42c9d5743c1d
-rw-r--r-- | subcmds/sync.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index e865e564..4af411c9 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -320,6 +320,7 @@ later is required to fix a server side protocol bug. | |||
320 | did_lock = True | 320 | did_lock = True |
321 | 321 | ||
322 | if not success: | 322 | if not success: |
323 | err_event.set() | ||
323 | print('error: Cannot fetch %s' % project.name, file=sys.stderr) | 324 | print('error: Cannot fetch %s' % project.name, file=sys.stderr) |
324 | if opt.force_broken: | 325 | if opt.force_broken: |
325 | print('warn: --force-broken, continuing to sync', | 326 | print('warn: --force-broken, continuing to sync', |
@@ -330,7 +331,7 @@ later is required to fix a server side protocol bug. | |||
330 | fetched.add(project.gitdir) | 331 | fetched.add(project.gitdir) |
331 | pm.update() | 332 | pm.update() |
332 | except _FetchError: | 333 | except _FetchError: |
333 | err_event.set() | 334 | pass |
334 | except Exception as e: | 335 | except Exception as e: |
335 | print('error: Cannot fetch %s (%s: %s)' \ | 336 | print('error: Cannot fetch %s (%s: %s)' \ |
336 | % (project.name, type(e).__name__, str(e)), file=sys.stderr) | 337 | % (project.name, type(e).__name__, str(e)), file=sys.stderr) |