Mercurial > hg
comparison mercurial/repair.py @ 27875:add2ba16430e
with: use context manager for transaction in strip
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Fri, 15 Jan 2016 13:14:49 -0800 |
parents | 60ea60fea5f3 |
children | 7cbb3a01fa38 |
comparison
equal
deleted
inserted
replaced
27874:4ff0e2347ae6 | 27875:add2ba16430e |
---|---|
183 gen = exchange.readbundle(ui, f, chgrpfile, vfs) | 183 gen = exchange.readbundle(ui, f, chgrpfile, vfs) |
184 if not repo.ui.verbose: | 184 if not repo.ui.verbose: |
185 # silence internal shuffling chatter | 185 # silence internal shuffling chatter |
186 repo.ui.pushbuffer() | 186 repo.ui.pushbuffer() |
187 if isinstance(gen, bundle2.unbundle20): | 187 if isinstance(gen, bundle2.unbundle20): |
188 tr = repo.transaction('strip') | 188 with repo.transaction('strip') as tr: |
189 tr.hookargs = {'source': 'strip', | 189 tr.hookargs = {'source': 'strip', |
190 'url': 'bundle:' + vfs.join(chgrpfile)} | 190 'url': 'bundle:' + vfs.join(chgrpfile)} |
191 try: | |
192 bundle2.applybundle(repo, gen, tr, source='strip', | 191 bundle2.applybundle(repo, gen, tr, source='strip', |
193 url='bundle:' + vfs.join(chgrpfile)) | 192 url='bundle:' + vfs.join(chgrpfile)) |
194 tr.close() | |
195 finally: | |
196 tr.release() | |
197 else: | 193 else: |
198 gen.apply(repo, 'strip', 'bundle:' + vfs.join(chgrpfile), True) | 194 gen.apply(repo, 'strip', 'bundle:' + vfs.join(chgrpfile), True) |
199 if not repo.ui.verbose: | 195 if not repo.ui.verbose: |
200 repo.ui.popbuffer() | 196 repo.ui.popbuffer() |
201 f.close() | 197 f.close() |