Mercurial > hg
comparison tests/test-push-race.t @ 34767:6338e23c887d
configitems: register the test config in 'test-push-race.t'
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Wed, 11 Oct 2017 23:33:59 +0200 |
parents | eb586ed5d8ce |
children | a0100f34e20b |
comparison
equal
deleted
inserted
replaced
34766:d957d4475a64 | 34767:6338e23c887d |
---|---|
20 > import time | 20 > import time |
21 > | 21 > |
22 > from mercurial import ( | 22 > from mercurial import ( |
23 > exchange, | 23 > exchange, |
24 > extensions, | 24 > extensions, |
25 > registrar, | |
26 > ) | |
27 > | |
28 > configtable = {} | |
29 > configitem = registrar.configitem(configtable) | |
30 > | |
31 > configitem('delaypush', 'ready-path', | |
32 > default=None, | |
33 > ) | |
34 > configitem('delaypush', 'release-path', | |
35 > default=None, | |
25 > ) | 36 > ) |
26 > | 37 > |
27 > def delaypush(orig, pushop): | 38 > def delaypush(orig, pushop): |
28 > # notify we are done preparing | 39 > # notify we are done preparing |
29 > ui = pushop.repo.ui | 40 > ui = pushop.repo.ui |
30 > readypath = ui.config('delaypush', 'ready-path', None) | 41 > readypath = ui.config('delaypush', 'ready-path') |
31 > if readypath is not None: | 42 > if readypath is not None: |
32 > with open(readypath, 'w') as r: | 43 > with open(readypath, 'w') as r: |
33 > r.write('foo') | 44 > r.write('foo') |
34 > ui.status('wrote ready: %s\n' % readypath) | 45 > ui.status('wrote ready: %s\n' % readypath) |
35 > # now wait for the other process to be done | 46 > # now wait for the other process to be done |
36 > watchpath = ui.config('delaypush', 'release-path', None) | 47 > watchpath = ui.config('delaypush', 'release-path') |
37 > if watchpath is not None: | 48 > if watchpath is not None: |
38 > ui.status('waiting on: %s\n' % watchpath) | 49 > ui.status('waiting on: %s\n' % watchpath) |
39 > limit = 100 | 50 > limit = 100 |
40 > while 0 < limit and not os.path.exists(watchpath): | 51 > while 0 < limit and not os.path.exists(watchpath): |
41 > limit -= 1 | 52 > limit -= 1 |