mercurial/repair.py
changeset 47437 7a430116f639
parent 46907 ffd3e823a7e5
child 47875 0fb328bb2459
equal deleted inserted replaced
47436:6ecd0980d7f9 47437:7a430116f639
    26     pathutil,
    26     pathutil,
    27     phases,
    27     phases,
    28     pycompat,
    28     pycompat,
    29     requirements,
    29     requirements,
    30     scmutil,
    30     scmutil,
       
    31     util,
    31 )
    32 )
    32 from .utils import (
    33 from .utils import (
    33     hashutil,
    34     hashutil,
    34     stringutil,
    35     stringutil,
    35     urlutil,
    36     urlutil,
   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)