##// END OF EJS Templates
repair: make "strip()" treat bundle files via vfs...
FUJIWARA Katsunori -
r20979:ad5b6137 default
parent child Browse files
Show More
@@ -9,7 +9,6 b''
9 9 from mercurial import changegroup
10 10 from mercurial.node import short
11 11 from mercurial.i18n import _
12 import os
13 12 import errno
14 13
15 14 def _bundle(repo, bases, heads, node, suffix, compress=True):
@@ -24,7 +23,7 b' def _bundle(repo, bases, heads, node, su'
24 23 bundletype = "HG10BZ"
25 24 else:
26 25 bundletype = "HG10UN"
27 return vfs.join(changegroup.writebundle(cg, name, bundletype, vfs))
26 return changegroup.writebundle(cg, name, bundletype, vfs)
28 27
29 28 def _collectfiles(repo, striprev):
30 29 """find out the filelogs affected by the strip"""
@@ -109,10 +108,13 b' def strip(ui, repo, nodelist, backup="al'
109 108
110 109 # create a changegroup for all the branches we need to keep
111 110 backupfile = None
111 vfs = repo.vfs
112 112 if backup == "all":
113 113 backupfile = _bundle(repo, stripbases, cl.heads(), node, topic)
114 repo.ui.status(_("saved backup bundle to %s\n") % backupfile)
115 repo.ui.log("backupbundle", "saved backup bundle to %s\n", backupfile)
114 repo.ui.status(_("saved backup bundle to %s\n") %
115 vfs.join(backupfile))
116 repo.ui.log("backupbundle", "saved backup bundle to %s\n",
117 vfs.join(backupfile))
116 118 if saveheads or savebases:
117 119 # do not compress partial bundle if we remove it from disk later
118 120 chgrpfile = _bundle(repo, savebases, saveheads, node, 'temp',
@@ -144,18 +146,18 b' def strip(ui, repo, nodelist, backup="al'
144 146
145 147 if saveheads or savebases:
146 148 ui.note(_("adding branch\n"))
147 f = open(chgrpfile, "rb")
148 gen = changegroup.readbundle(f, chgrpfile)
149 f = vfs.open(chgrpfile, "rb")
150 gen = changegroup.readbundle(f, chgrpfile, vfs)
149 151 if not repo.ui.verbose:
150 152 # silence internal shuffling chatter
151 153 repo.ui.pushbuffer()
152 154 changegroup.addchangegroup(repo, gen, 'strip',
153 'bundle:' + chgrpfile, True)
155 'bundle:' + vfs.join(chgrpfile), True)
154 156 if not repo.ui.verbose:
155 157 repo.ui.popbuffer()
156 158 f.close()
157 159 if not keeppartialbundle:
158 os.unlink(chgrpfile)
160 vfs.unlink(chgrpfile)
159 161
160 162 # remove undo files
161 163 for undovfs, undofile in repo.undofiles():
@@ -172,10 +174,10 b' def strip(ui, repo, nodelist, backup="al'
172 174 except: # re-raises
173 175 if backupfile:
174 176 ui.warn(_("strip failed, full bundle stored in '%s'\n")
175 % backupfile)
177 % vfs.join(backupfile))
176 178 elif saveheads:
177 179 ui.warn(_("strip failed, partial bundle stored in '%s'\n")
178 % chgrpfile)
180 % vfs.join(chgrpfile))
179 181 raise
180 182
181 183 repo.destroyed()
General Comments 0
You need to be logged in to leave comments. Login now