Changeset View
Changeset View
Standalone View
Standalone View
mercurial/repair.py
Show All 22 Lines | from . import ( | ||||
exchange, | exchange, | ||||
obsolete, | obsolete, | ||||
obsutil, | obsutil, | ||||
pathutil, | pathutil, | ||||
phases, | phases, | ||||
pycompat, | pycompat, | ||||
requirements, | requirements, | ||||
scmutil, | scmutil, | ||||
util, | |||||
) | ) | ||||
from .utils import ( | from .utils import ( | ||||
hashutil, | hashutil, | ||||
stringutil, | stringutil, | ||||
urlutil, | |||||
) | ) | ||||
def backupbundle( | def backupbundle( | ||||
repo, bases, heads, node, suffix, compress=True, obsolescence=True | repo, bases, heads, node, suffix, compress=True, obsolescence=True | ||||
): | ): | ||||
"""create a bundle with the specified revisions as a backup""" | """create a bundle with the specified revisions as a backup""" | ||||
▲ Show 20 Lines • Show All 196 Lines • ▼ Show 20 Line(s) | with ui.uninterruptible(): | ||||
f = vfs.open(tmpbundlefile, b"rb") | f = vfs.open(tmpbundlefile, b"rb") | ||||
gen = exchange.readbundle(ui, f, tmpbundlefile, vfs) | gen = exchange.readbundle(ui, f, tmpbundlefile, vfs) | ||||
if not repo.ui.verbose: | if not repo.ui.verbose: | ||||
# silence internal shuffling chatter | # silence internal shuffling chatter | ||||
repo.ui.pushbuffer() | repo.ui.pushbuffer() | ||||
tmpbundleurl = b'bundle:' + vfs.join(tmpbundlefile) | tmpbundleurl = b'bundle:' + vfs.join(tmpbundlefile) | ||||
txnname = b'strip' | txnname = b'strip' | ||||
if not isinstance(gen, bundle2.unbundle20): | if not isinstance(gen, bundle2.unbundle20): | ||||
txnname = b"strip\n%s" % util.hidepassword(tmpbundleurl) | txnname = b"strip\n%s" % urlutil.hidepassword(tmpbundleurl) | ||||
with repo.transaction(txnname) as tr: | with repo.transaction(txnname) as tr: | ||||
bundle2.applybundle( | bundle2.applybundle( | ||||
repo, gen, tr, source=b'strip', url=tmpbundleurl | repo, gen, tr, source=b'strip', url=tmpbundleurl | ||||
) | ) | ||||
if not repo.ui.verbose: | if not repo.ui.verbose: | ||||
repo.ui.popbuffer() | repo.ui.popbuffer() | ||||
f.close() | f.close() | ||||
▲ Show 20 Lines • Show All 290 Lines • Show Last 20 Lines |