comparison tests/test-bookmarks-corner-case.t @ 42512:84aff7e20c55

merge with stable
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 21 Jun 2019 23:35:04 -0700
parents 5b217451a2c2 044045dce23a
children 904e0da2e195
comparison
equal deleted inserted replaced
42504:a68350a7fc55 42512:84aff7e20c55
117 117
118 $ cat > bookrace.py << EOF 118 $ cat > bookrace.py << EOF
119 > import atexit 119 > import atexit
120 > import os 120 > import os
121 > import time 121 > import time
122 > from mercurial import bookmarks, error, extensions 122 > import atexit
123 > def wrapinit(orig, self, repo): 123 > from mercurial import error, extensions, bookmarks
124 >
125 > def wait(repo):
124 > if not os.path.exists('push-A-started'): 126 > if not os.path.exists('push-A-started'):
127 > assert repo._currentlock(repo._lockref) is None
128 > assert repo._currentlock(repo._wlockref) is None
125 > repo.ui.status(b'setting raced push up\n') 129 > repo.ui.status(b'setting raced push up\n')
126 > with open('push-A-started', 'w'): 130 > with open('push-A-started', 'w'):
127 > pass 131 > pass
128 > clock = 300 132 > clock = 300
129 > while not os.path.exists('push-B-done'): 133 > while not os.path.exists('push-B-done'):
130 > clock -= 1 134 > clock -= 1
131 > if clock <= 0: 135 > if clock <= 0:
132 > raise error.Abort("race scenario timed out") 136 > raise error.Abort("race scenario timed out")
133 > time.sleep(0.1) 137 > time.sleep(0.1)
134 > return orig(self, repo)
135 > 138 >
139 > def reposetup(ui, repo):
140 > class racedrepo(repo.__class__):
141 > @property
142 > def _bookmarks(self):
143 > wait(self)
144 > return super(racedrepo, self)._bookmarks
136 > repo.__class__ = racedrepo 145 > repo.__class__ = racedrepo
137 > def uisetup(ui): 146 >
138 > extensions.wrapfunction(bookmarks.bmstore, '__init__', wrapinit)
139 > def e(): 147 > def e():
140 > with open('push-A-done', 'w'): 148 > with open('push-A-done', 'w'):
141 > pass 149 > pass
142 > atexit.register(e) 150 > atexit.register(e)
143 > EOF 151 > EOF
191 Check raced push output. 199 Check raced push output.
192 200
193 $ cat push-output.txt 201 $ cat push-output.txt
194 pushing to ssh://user@dummy/bookrace-server 202 pushing to ssh://user@dummy/bookrace-server
195 searching for changes 203 searching for changes
204 remote has heads on branch 'default' that are not known locally: f26c3b5167d1
196 remote: setting raced push up 205 remote: setting raced push up
197 remote: adding changesets 206 remote: adding changesets
198 remote: adding manifests 207 remote: adding manifests
199 remote: adding file changes 208 remote: adding file changes
200 remote: added 1 changesets with 1 changes to 1 files 209 remote: added 1 changesets with 1 changes to 1 files