Show More
@@ -186,76 +186,77 b' def strip(ui, repo, nodelist, backup=Tru' | |||
|
186 | 186 | tmpbundlefile = backupbundle(repo, savebases, saveheads, node, 'temp', |
|
187 | 187 | compress=False, obsolescence=False) |
|
188 | 188 | |
|
189 | try: | |
|
190 | with repo.transaction("strip") as tr: | |
|
191 | offset = len(tr.entries) | |
|
189 | with ui.uninterruptable(): | |
|
190 | try: | |
|
191 | with repo.transaction("strip") as tr: | |
|
192 | offset = len(tr.entries) | |
|
192 | 193 | |
|
193 | tr.startgroup() | |
|
194 | cl.strip(striprev, tr) | |
|
195 | stripmanifest(repo, striprev, tr, files) | |
|
196 | ||
|
197 | for fn in files: | |
|
198 | repo.file(fn).strip(striprev, tr) | |
|
199 | tr.endgroup() | |
|
194 | tr.startgroup() | |
|
195 | cl.strip(striprev, tr) | |
|
196 | stripmanifest(repo, striprev, tr, files) | |
|
200 | 197 | |
|
201 | for i in xrange(offset, len(tr.entries)): | |
|
202 | file, troffset, ignore = tr.entries[i] | |
|
203 | with repo.svfs(file, 'a', checkambig=True) as fp: | |
|
204 | fp.truncate(troffset) | |
|
205 | if troffset == 0: | |
|
206 | repo.store.markremoved(file) | |
|
198 | for fn in files: | |
|
199 | repo.file(fn).strip(striprev, tr) | |
|
200 | tr.endgroup() | |
|
207 | 201 | |
|
208 | deleteobsmarkers(repo.obsstore, stripobsidx) | |
|
209 | del repo.obsstore | |
|
210 | repo.invalidatevolatilesets() | |
|
211 | repo._phasecache.filterunknown(repo) | |
|
202 | for i in xrange(offset, len(tr.entries)): | |
|
203 | file, troffset, ignore = tr.entries[i] | |
|
204 | with repo.svfs(file, 'a', checkambig=True) as fp: | |
|
205 | fp.truncate(troffset) | |
|
206 | if troffset == 0: | |
|
207 | repo.store.markremoved(file) | |
|
208 | ||
|
209 | deleteobsmarkers(repo.obsstore, stripobsidx) | |
|
210 | del repo.obsstore | |
|
211 | repo.invalidatevolatilesets() | |
|
212 | repo._phasecache.filterunknown(repo) | |
|
212 | 213 | |
|
213 | if tmpbundlefile: | |
|
214 | ui.note(_("adding branch\n")) | |
|
215 | f = vfs.open(tmpbundlefile, "rb") | |
|
216 | gen = exchange.readbundle(ui, f, tmpbundlefile, vfs) | |
|
217 | if not repo.ui.verbose: | |
|
218 | # silence internal shuffling chatter | |
|
219 | repo.ui.pushbuffer() | |
|
220 | tmpbundleurl = 'bundle:' + vfs.join(tmpbundlefile) | |
|
221 | txnname = 'strip' | |
|
222 | if not isinstance(gen, bundle2.unbundle20): | |
|
223 | txnname = "strip\n%s" % util.hidepassword(tmpbundleurl) | |
|
224 | with repo.transaction(txnname) as tr: | |
|
225 | bundle2.applybundle(repo, gen, tr, source='strip', | |
|
226 | url=tmpbundleurl) | |
|
227 | if not repo.ui.verbose: | |
|
228 | repo.ui.popbuffer() | |
|
229 | f.close() | |
|
214 | if tmpbundlefile: | |
|
215 | ui.note(_("adding branch\n")) | |
|
216 | f = vfs.open(tmpbundlefile, "rb") | |
|
217 | gen = exchange.readbundle(ui, f, tmpbundlefile, vfs) | |
|
218 | if not repo.ui.verbose: | |
|
219 | # silence internal shuffling chatter | |
|
220 | repo.ui.pushbuffer() | |
|
221 | tmpbundleurl = 'bundle:' + vfs.join(tmpbundlefile) | |
|
222 | txnname = 'strip' | |
|
223 | if not isinstance(gen, bundle2.unbundle20): | |
|
224 | txnname = "strip\n%s" % util.hidepassword(tmpbundleurl) | |
|
225 | with repo.transaction(txnname) as tr: | |
|
226 | bundle2.applybundle(repo, gen, tr, source='strip', | |
|
227 | url=tmpbundleurl) | |
|
228 | if not repo.ui.verbose: | |
|
229 | repo.ui.popbuffer() | |
|
230 | f.close() | |
|
230 | 231 | |
|
231 | with repo.transaction('repair') as tr: | |
|
232 | bmchanges = [(m, repo[newbmtarget].node()) for m in updatebm] | |
|
233 | bm.applychanges(repo, tr, bmchanges) | |
|
232 | with repo.transaction('repair') as tr: | |
|
233 | bmchanges = [(m, repo[newbmtarget].node()) for m in updatebm] | |
|
234 | bm.applychanges(repo, tr, bmchanges) | |
|
234 | 235 | |
|
235 | # remove undo files | |
|
236 | for undovfs, undofile in repo.undofiles(): | |
|
237 | try: | |
|
238 | undovfs.unlink(undofile) | |
|
239 | except OSError as e: | |
|
240 | if e.errno != errno.ENOENT: | |
|
241 | ui.warn(_('error removing %s: %s\n') % | |
|
242 | (undovfs.join(undofile), | |
|
243 | stringutil.forcebytestr(e))) | |
|
236 | # remove undo files | |
|
237 | for undovfs, undofile in repo.undofiles(): | |
|
238 | try: | |
|
239 | undovfs.unlink(undofile) | |
|
240 | except OSError as e: | |
|
241 | if e.errno != errno.ENOENT: | |
|
242 | ui.warn(_('error removing %s: %s\n') % | |
|
243 | (undovfs.join(undofile), | |
|
244 | stringutil.forcebytestr(e))) | |
|
244 | 245 | |
|
245 | except: # re-raises | |
|
246 | if backupfile: | |
|
247 | ui.warn(_("strip failed, backup bundle stored in '%s'\n") | |
|
248 | % vfs.join(backupfile)) | |
|
249 | if tmpbundlefile: | |
|
250 | ui.warn(_("strip failed, unrecovered changes stored in '%s'\n") | |
|
251 | % vfs.join(tmpbundlefile)) | |
|
252 | ui.warn(_("(fix the problem, then recover the changesets with " | |
|
253 | "\"hg unbundle '%s'\")\n") % vfs.join(tmpbundlefile)) | |
|
254 | raise | |
|
255 | else: | |
|
256 | if tmpbundlefile: | |
|
257 | # Remove temporary bundle only if there were no exceptions | |
|
258 | vfs.unlink(tmpbundlefile) | |
|
246 | except: # re-raises | |
|
247 | if backupfile: | |
|
248 | ui.warn(_("strip failed, backup bundle stored in '%s'\n") | |
|
249 | % vfs.join(backupfile)) | |
|
250 | if tmpbundlefile: | |
|
251 | ui.warn(_("strip failed, unrecovered changes stored in '%s'\n") | |
|
252 | % vfs.join(tmpbundlefile)) | |
|
253 | ui.warn(_("(fix the problem, then recover the changesets with " | |
|
254 | "\"hg unbundle '%s'\")\n") % vfs.join(tmpbundlefile)) | |
|
255 | raise | |
|
256 | else: | |
|
257 | if tmpbundlefile: | |
|
258 | # Remove temporary bundle only if there were no exceptions | |
|
259 | vfs.unlink(tmpbundlefile) | |
|
259 | 260 | |
|
260 | 261 | repo.destroyed() |
|
261 | 262 | # return the backup file path (or None if 'backup' was False) so |
General Comments 0
You need to be logged in to leave comments.
Login now