# HG changeset patch # User Nicolas Dumazet # Date 1281599603 -32400 # Node ID 00cde9bddbe426d0fef20e001e590c2c3b15b01f # Parent ba9957bcfb7c0ed80af68d58436e040f47887c3a repair: do not compress partial bundle if we do not keep it on disk A partial bundle is created to temporarily save revisions > rev but not descending from the node to strip, to be able to restore the changesets after stripping the changelog. Since this bundle is not kept after the strip operation, and is not user-visible, it is not necessary and should be faster to avoid compression. diff -r ba9957bcfb7c -r 00cde9bddbe4 mercurial/repair.py --- a/mercurial/repair.py Thu Aug 12 16:45:47 2010 +0900 +++ b/mercurial/repair.py Thu Aug 12 16:53:23 2010 +0900 @@ -11,14 +11,18 @@ from i18n import _ import os -def _bundle(repo, bases, heads, node, suffix, extranodes=None): +def _bundle(repo, bases, heads, node, suffix, extranodes=None, compress=True): """create a bundle with the specified revisions as a backup""" cg = repo.changegroupsubset(bases, heads, 'strip', extranodes) backupdir = repo.join("strip-backup") if not os.path.isdir(backupdir): os.mkdir(backupdir) name = os.path.join(backupdir, "%s-%s.hg" % (short(node), suffix)) - return changegroup.writebundle(cg, name, "HG10BZ") + if compress: + bundletype = "HG10BZ" + else: + bundletype = "HG10UN" + return changegroup.writebundle(cg, name, bundletype) def _collectfiles(repo, striprev): """find out the filelogs affected by the strip""" @@ -69,6 +73,8 @@ # TODO delete the undo files, and handle undo of merge sets striprev = cl.rev(node) + keeppartialbundle = backup == 'strip' + # Some revisions with rev > striprev may not be descendants of striprev. # We have to find these revisions and put them in a bundle, so that # we can restore them after the truncations. @@ -110,8 +116,9 @@ backupfile = _bundle(repo, [node], cl.heads(), node, 'backup') repo.ui.status(_("saved backup bundle to %s\n") % backupfile) if saveheads or extranodes: + # do not compress partial bundle if we remove it from disk later chgrpfile = _bundle(repo, savebases, saveheads, node, 'temp', - extranodes) + extranodes=extranodes, compress=keeppartialbundle) mfst = repo.manifest @@ -146,7 +153,7 @@ if not repo.ui.verbose: repo.ui.popbuffer() f.close() - if backup != "strip": + if not keeppartialbundle: os.unlink(chgrpfile) except: if backupfile: