##// END OF EJS Templates
repair: do not compress partial bundle if we do not keep it on disk...
Nicolas Dumazet -
r11791:00cde9bd default
parent child Browse files
Show More
@@ -11,14 +11,18 b' from node import nullrev, short'
11 11 from i18n import _
12 12 import os
13 13
14 def _bundle(repo, bases, heads, node, suffix, extranodes=None):
14 def _bundle(repo, bases, heads, node, suffix, extranodes=None, compress=True):
15 15 """create a bundle with the specified revisions as a backup"""
16 16 cg = repo.changegroupsubset(bases, heads, 'strip', extranodes)
17 17 backupdir = repo.join("strip-backup")
18 18 if not os.path.isdir(backupdir):
19 19 os.mkdir(backupdir)
20 20 name = os.path.join(backupdir, "%s-%s.hg" % (short(node), suffix))
21 return changegroup.writebundle(cg, name, "HG10BZ")
21 if compress:
22 bundletype = "HG10BZ"
23 else:
24 bundletype = "HG10UN"
25 return changegroup.writebundle(cg, name, bundletype)
22 26
23 27 def _collectfiles(repo, striprev):
24 28 """find out the filelogs affected by the strip"""
@@ -69,6 +73,8 b' def strip(ui, repo, node, backup="all"):'
69 73 # TODO delete the undo files, and handle undo of merge sets
70 74 striprev = cl.rev(node)
71 75
76 keeppartialbundle = backup == 'strip'
77
72 78 # Some revisions with rev > striprev may not be descendants of striprev.
73 79 # We have to find these revisions and put them in a bundle, so that
74 80 # we can restore them after the truncations.
@@ -110,8 +116,9 b' def strip(ui, repo, node, backup="all"):'
110 116 backupfile = _bundle(repo, [node], cl.heads(), node, 'backup')
111 117 repo.ui.status(_("saved backup bundle to %s\n") % backupfile)
112 118 if saveheads or extranodes:
119 # do not compress partial bundle if we remove it from disk later
113 120 chgrpfile = _bundle(repo, savebases, saveheads, node, 'temp',
114 extranodes)
121 extranodes=extranodes, compress=keeppartialbundle)
115 122
116 123 mfst = repo.manifest
117 124
@@ -146,7 +153,7 b' def strip(ui, repo, node, backup="all"):'
146 153 if not repo.ui.verbose:
147 154 repo.ui.popbuffer()
148 155 f.close()
149 if backup != "strip":
156 if not keeppartialbundle:
150 157 os.unlink(chgrpfile)
151 158 except:
152 159 if backupfile:
General Comments 0
You need to be logged in to leave comments. Login now