equal
deleted
inserted
replaced
215 """ |
215 """ |
216 clear = False |
216 clear = False |
217 |
217 |
218 loop = 0 |
218 loop = 0 |
219 |
219 |
220 while not clear: |
220 try: |
221 loop += 1 |
221 while not clear: |
222 if loop > 100: |
222 loop += 1 |
223 # XXX basic protection against infinite loop, make it better. |
223 if loop > 100: |
224 raise error.ProgrammingError("Too many auto upgrade loops") |
224 # XXX basic protection against infinite loop, make it better. |
225 clear = True |
225 raise error.ProgrammingError("Too many auto upgrade loops") |
226 for get_action in AUTO_UPGRADE_ACTIONS: |
226 clear = True |
227 action = get_action(repo) |
227 for get_action in AUTO_UPGRADE_ACTIONS: |
228 if action is not None: |
228 action = get_action(repo) |
229 clear = False |
229 if action is not None: |
230 with repo.wlock(wait=False), repo.lock(wait=False): |
230 clear = False |
231 action = get_action(repo) |
231 with repo.wlock(wait=False), repo.lock(wait=False): |
232 if action is not None: |
232 action = get_action(repo) |
233 action() |
233 if action is not None: |
234 repo = maker_func() |
234 action() |
|
235 repo = maker_func() |
|
236 except error.LockError: |
|
237 # if we cannot get the lock, ignore the auto-upgrade attemps and |
|
238 # proceed. We might want to make this behavior configurable in the |
|
239 # future. |
|
240 pass |
|
241 |
235 return repo |
242 return repo |