[PATCH] strip: use the 'writenewbundle' function to get bundle on disk
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Thu May 25 19:11:17 UTC 2017
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1494000942 -7200
# Fri May 05 18:15:42 2017 +0200
# Node ID fe4d931431ab849db7814d162817ee9db7d4c84f
# Parent 548478efc46c6147e9c2781cf70477b3461b440d
# EXP-Topic bundle2.tagsfnodecache
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
# hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r fe4d931431ab
strip: use the 'writenewbundle' function to get bundle on disk
This will ensure the backup bundle use the best available logic (eg: includes
relevant caches so that we loose less of them on strip.)
diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -16,6 +16,7 @@ from .node import short
from . import (
bundle2,
changegroup,
+ discovery,
error,
exchange,
obsolete,
@@ -24,10 +25,7 @@ from . import (
def _bundle(repo, bases, heads, node, suffix, compress=True):
"""create a bundle with the specified revisions as a backup"""
- cgversion = changegroup.safeversion(repo)
- cg = changegroup.changegroupsubset(repo, bases, heads, 'strip',
- version=cgversion)
backupdir = "strip-backup"
vfs = repo.vfs
if not vfs.isdir(backupdir):
@@ -39,6 +37,7 @@ def _bundle(repo, bases, heads, node, su
totalhash = hashlib.sha1(''.join(allhashes)).hexdigest()
name = "%s/%s-%s-%s.hg" % (backupdir, short(node), totalhash[:8], suffix)
+ cgversion = changegroup.safeversion(repo)
comp = None
if cgversion != '01':
bundletype = "HG20"
@@ -48,8 +47,11 @@ def _bundle(repo, bases, heads, node, su
bundletype = "HG10BZ"
else:
bundletype = "HG10UN"
- return bundle2.writebundle(repo.ui, cg, name, bundletype, vfs,
- compression=comp)
+
+ outgoing = discovery.outgoing(repo, missingroots=bases, missingheads=heads)
+ contentopts = {'cg.version': cgversion}
+ return bundle2.writenewbundle(repo.ui, repo, 'strip', name, bundletype,
+ outgoing, contentopts, vfs, compression=comp)
def _collectfiles(repo, striprev):
"""find out the filelogs affected by the strip"""
More information about the Mercurial-devel
mailing list