diff options
author | Andrei Warkentin <andreiw@motorola.com> | 2010-07-02 17:58:31 -0500 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2010-10-29 12:20:01 -0700 |
commit | 5df6de075e5fb674368d38f858419425bc8d8d07 (patch) | |
tree | c138ab50fe9e8b08352c1e70e460f83771d56179 | |
parent | a0de6e8eab97f5dcdb2f51d4e09dd1568623ec58 (diff) | |
download | git-repo-5df6de075e5fb674368d38f858419425bc8d8d07.tar.gz |
sync: Use --force-broken to continue other projectsv1.7
This adds a new flag -f/--force-broken that will allow the rest of
the sync process to continue instead of bailing when a particular
project fails to sync.
Change-Id: I23680f2ee7927410f7ed930b1d469424c9aa246e
Signed-off-by: Andrei Warkentin <andreiw@motorola.com>
Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r-- | subcmds/sync.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index 1f4b137f..ca78467b 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -70,6 +70,9 @@ The -s/--smart-sync option can be used to sync to a known good | |||
70 | build as specified by the manifest-server element in the current | 70 | build as specified by the manifest-server element in the current |
71 | manifest. | 71 | manifest. |
72 | 72 | ||
73 | The -f/--force-broken option can be used to proceed with syncing | ||
74 | other projects if a project sync fails. | ||
75 | |||
73 | SSH Connections | 76 | SSH Connections |
74 | --------------- | 77 | --------------- |
75 | 78 | ||
@@ -101,6 +104,9 @@ later is required to fix a server side protocol bug. | |||
101 | """ | 104 | """ |
102 | 105 | ||
103 | def _Options(self, p, show_smart=True): | 106 | def _Options(self, p, show_smart=True): |
107 | p.add_option('-f', '--force-broken', | ||
108 | dest='force_broken', action='store_true', | ||
109 | help="continue sync even if a project fails to sync") | ||
104 | p.add_option('-l','--local-only', | 110 | p.add_option('-l','--local-only', |
105 | dest='local_only', action='store_true', | 111 | dest='local_only', action='store_true', |
106 | help="only update working tree, don't fetch") | 112 | help="only update working tree, don't fetch") |
@@ -132,8 +138,11 @@ later is required to fix a server side protocol bug. | |||
132 | def _FetchHelper(self, opt, project, lock, fetched, pm, sem): | 138 | def _FetchHelper(self, opt, project, lock, fetched, pm, sem): |
133 | if not project.Sync_NetworkHalf(quiet=opt.quiet): | 139 | if not project.Sync_NetworkHalf(quiet=opt.quiet): |
134 | print >>sys.stderr, 'error: Cannot fetch %s' % project.name | 140 | print >>sys.stderr, 'error: Cannot fetch %s' % project.name |
135 | sem.release() | 141 | if opt.force_broken: |
136 | sys.exit(1) | 142 | print >>sys.stderr, 'warn: --force-broken, continuing to sync' |
143 | else: | ||
144 | sem.release() | ||
145 | sys.exit(1) | ||
137 | 146 | ||
138 | lock.acquire() | 147 | lock.acquire() |
139 | fetched.add(project.gitdir) | 148 | fetched.add(project.gitdir) |
@@ -152,7 +161,10 @@ later is required to fix a server side protocol bug. | |||
152 | fetched.add(project.gitdir) | 161 | fetched.add(project.gitdir) |
153 | else: | 162 | else: |
154 | print >>sys.stderr, 'error: Cannot fetch %s' % project.name | 163 | print >>sys.stderr, 'error: Cannot fetch %s' % project.name |
155 | sys.exit(1) | 164 | if opt.force_broken: |
165 | print >>sys.stderr, 'warn: --force-broken, continuing to sync' | ||
166 | else: | ||
167 | sys.exit(1) | ||
156 | else: | 168 | else: |
157 | threads = set() | 169 | threads = set() |
158 | lock = _threading.Lock() | 170 | lock = _threading.Lock() |