diff --git a/mercurial/repair.py b/mercurial/repair.py --- a/mercurial/repair.py +++ b/mercurial/repair.py @@ -147,10 +147,10 @@ def strip(ui, repo, nodelist, backup=Tru vfs.join(backupfile)) repo.ui.log("backupbundle", "saved backup bundle to %s\n", vfs.join(backupfile)) - chgrpfile = None + tmpbundlefile = None if saveheads: - # do not compress partial bundle if we remove it from disk later - chgrpfile = _bundle(repo, savebases, saveheads, node, 'temp', + # do not compress temporary bundle if we remove it from disk later + tmpbundlefile = _bundle(repo, savebases, saveheads, node, 'temp', compress=False) mfst = repo.manifest @@ -185,21 +185,22 @@ def strip(ui, repo, nodelist, backup=Tru if troffset == 0: repo.store.markremoved(file) - if chgrpfile: + if tmpbundlefile: ui.note(_("adding branch\n")) - f = vfs.open(chgrpfile, "rb") - gen = exchange.readbundle(ui, f, chgrpfile, vfs) + f = vfs.open(tmpbundlefile, "rb") + gen = exchange.readbundle(ui, f, tmpbundlefile, vfs) if not repo.ui.verbose: # silence internal shuffling chatter repo.ui.pushbuffer() if isinstance(gen, bundle2.unbundle20): with repo.transaction('strip') as tr: tr.hookargs = {'source': 'strip', - 'url': 'bundle:' + vfs.join(chgrpfile)} + 'url': 'bundle:' + vfs.join(tmpbundlefile)} bundle2.applybundle(repo, gen, tr, source='strip', - url='bundle:' + vfs.join(chgrpfile)) + url='bundle:' + vfs.join(tmpbundlefile)) else: - gen.apply(repo, 'strip', 'bundle:' + vfs.join(chgrpfile), True) + gen.apply(repo, 'strip', 'bundle:' + vfs.join(tmpbundlefile), + True) if not repo.ui.verbose: repo.ui.popbuffer() f.close() @@ -228,18 +229,18 @@ def strip(ui, repo, nodelist, backup=Tru except: # re-raises if backupfile: - ui.warn(_("strip failed, full bundle stored in '%s'\n") + ui.warn(_("strip failed, backup bundle stored in '%s'\n") % vfs.join(backupfile)) - if chgrpfile: + if tmpbundlefile: ui.warn(_("strip failed, unrecovered changes stored in '%s'\n") - % vfs.join(chgrpfile)) + % vfs.join(tmpbundlefile)) ui.warn(_("(fix the problem, then recover the changesets with " - "\"hg unbundle '%s'\")\n") % vfs.join(chgrpfile)) + "\"hg unbundle '%s'\")\n") % vfs.join(tmpbundlefile)) raise else: - if chgrpfile: - # Remove partial backup only if there were no exceptions - vfs.unlink(chgrpfile) + if tmpbundlefile: + # Remove temporary bundle only if there were no exceptions + vfs.unlink(tmpbundlefile) repo.destroyed() diff --git a/tests/test-hook.t b/tests/test-hook.t --- a/tests/test-hook.t +++ b/tests/test-hook.t @@ -802,7 +802,7 @@ pretxnclose hook failure should abort th saved backup bundle to * (glob) transaction abort! rollback completed - strip failed, full bundle stored in * (glob) + strip failed, backup bundle stored in * (glob) abort: pretxnclose.error hook exited with status 1 [255] $ hg recover diff --git a/tests/test-repair-strip.t b/tests/test-repair-strip.t --- a/tests/test-repair-strip.t +++ b/tests/test-repair-strip.t @@ -51,7 +51,7 @@ transaction abort! failed to truncate data/b.i rollback failed - please run hg recover - strip failed, full bundle + strip failed, backup bundle abort: Permission denied .hg/store/data/b.i % after update 0, strip 2 abandoned transaction found - run hg recover @@ -104,7 +104,7 @@ transaction abort! failed to truncate 00manifest.i rollback failed - please run hg recover - strip failed, full bundle + strip failed, backup bundle abort: Permission denied .hg/store/00manifest.i % after update 0, strip 2 abandoned transaction found - run hg recover diff --git a/tests/test-strip.t b/tests/test-strip.t --- a/tests/test-strip.t +++ b/tests/test-strip.t @@ -374,7 +374,7 @@ Failed hook while applying "saveheads" b saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) transaction abort! rollback completed - strip failed, full bundle stored in '$TESTTMP/test/.hg/strip-backup/*-backup.hg' (glob) + strip failed, backup bundle stored in '$TESTTMP/test/.hg/strip-backup/*-backup.hg' (glob) strip failed, unrecovered changes stored in '$TESTTMP/test/.hg/strip-backup/*-temp.hg' (glob) (fix the problem, then recover the changesets with "hg unbundle '$TESTTMP/test/.hg/strip-backup/*-temp.hg'") (glob) abort: pretxnchangegroup.bad hook exited with status 1 @@ -931,7 +931,7 @@ Error during post-close callback of the > EOF $ hg strip tip --config extensions.crash=$TESTTMP/crashstrip.py saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg (glob) - strip failed, full bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg' (glob) + strip failed, backup bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg' (glob) abort: boom [255]