237 |
238 |
238 if tmpbundlefile: |
239 if tmpbundlefile: |
239 ui.note(_(b"adding branch\n")) |
240 ui.note(_(b"adding branch\n")) |
240 f = vfs.open(tmpbundlefile, b"rb") |
241 f = vfs.open(tmpbundlefile, b"rb") |
241 gen = exchange.readbundle(ui, f, tmpbundlefile, vfs) |
242 gen = exchange.readbundle(ui, f, tmpbundlefile, vfs) |
242 if not repo.ui.verbose: |
243 # silence internal shuffling chatter |
243 # silence internal shuffling chatter |
244 maybe_silent = ( |
244 repo.ui.pushbuffer() |
245 repo.ui.silent() |
245 tmpbundleurl = b'bundle:' + vfs.join(tmpbundlefile) |
246 if not repo.ui.verbose |
246 txnname = b'strip' |
247 else util.nullcontextmanager() |
247 if not isinstance(gen, bundle2.unbundle20): |
248 ) |
248 txnname = b"strip\n%s" % urlutil.hidepassword(tmpbundleurl) |
249 with maybe_silent: |
249 with repo.transaction(txnname) as tr: |
250 tmpbundleurl = b'bundle:' + vfs.join(tmpbundlefile) |
250 bundle2.applybundle( |
251 txnname = b'strip' |
251 repo, gen, tr, source=b'strip', url=tmpbundleurl |
252 if not isinstance(gen, bundle2.unbundle20): |
252 ) |
253 txnname = b"strip\n%s" % urlutil.hidepassword( |
253 if not repo.ui.verbose: |
254 tmpbundleurl |
254 repo.ui.popbuffer() |
255 ) |
|
256 with repo.transaction(txnname) as tr: |
|
257 bundle2.applybundle( |
|
258 repo, gen, tr, source=b'strip', url=tmpbundleurl |
|
259 ) |
255 f.close() |
260 f.close() |
256 |
261 |
257 with repo.transaction(b'repair') as tr: |
262 with repo.transaction(b'repair') as tr: |
258 bmchanges = [(m, repo[newbmtarget].node()) for m in updatebm] |
263 bmchanges = [(m, repo[newbmtarget].node()) for m in updatebm] |
259 repo._bookmarks.applychanges(repo, tr, bmchanges) |
264 repo._bookmarks.applychanges(repo, tr, bmchanges) |