comparison mercurial/streamclone.py @ 27850:49cfddbf54ba

with: use context manager in maybeperformlegacystreamclone
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:49 -0800
parents 7417e1c10253
children f55a5ace8e69
comparison
equal deleted inserted replaced
27849:900d36a3e4dd 27850:49cfddbf54ba
135 filecount, bytecount = map(int, l.split(' ', 1)) 135 filecount, bytecount = map(int, l.split(' ', 1))
136 except (ValueError, TypeError): 136 except (ValueError, TypeError):
137 raise error.ResponseError( 137 raise error.ResponseError(
138 _('unexpected response from remote server:'), l) 138 _('unexpected response from remote server:'), l)
139 139
140 lock = repo.lock() 140 with repo.lock():
141 try:
142 consumev1(repo, fp, filecount, bytecount) 141 consumev1(repo, fp, filecount, bytecount)
143 142
144 # new requirements = old non-format requirements + 143 # new requirements = old non-format requirements +
145 # new format-related remote requirements 144 # new format-related remote requirements
146 # requirements from the streamed-in repository 145 # requirements from the streamed-in repository
151 150
152 if rbranchmap: 151 if rbranchmap:
153 branchmap.replacecache(repo, rbranchmap) 152 branchmap.replacecache(repo, rbranchmap)
154 153
155 repo.invalidate() 154 repo.invalidate()
156 finally:
157 lock.release()
158 155
159 def allowservergeneration(ui): 156 def allowservergeneration(ui):
160 """Whether streaming clones are allowed from the server.""" 157 """Whether streaming clones are allowed from the server."""
161 return ui.configbool('server', 'uncompressed', True, untrusted=True) 158 return ui.configbool('server', 'uncompressed', True, untrusted=True)
162 159