296 def __call__(self, tr): |
296 def __call__(self, tr): |
297 roots = safestriproots(self.ui, self.repo, self.nodelist) |
297 roots = safestriproots(self.ui, self.repo, self.nodelist) |
298 if roots: |
298 if roots: |
299 strip(self.ui, self.repo, roots, self.backup, self.topic) |
299 strip(self.ui, self.repo, roots, self.backup, self.topic) |
300 |
300 |
301 def delayedstrip(ui, repo, nodelist, topic=None): |
301 def delayedstrip(ui, repo, nodelist, topic=None, backup=True): |
302 """like strip, but works inside transaction and won't strip irreverent revs |
302 """like strip, but works inside transaction and won't strip irreverent revs |
303 |
303 |
304 nodelist must explicitly contain all descendants. Otherwise a warning will |
304 nodelist must explicitly contain all descendants. Otherwise a warning will |
305 be printed that some nodes are not stripped. |
305 be printed that some nodes are not stripped. |
306 |
306 |
307 Always do a backup. The last non-None "topic" will be used as the backup |
307 Will do a backup if `backup` is True. The last non-None "topic" will be |
308 topic name. The default backup topic name is "backup". |
308 used as the backup topic name. The default backup topic name is "backup". |
309 """ |
309 """ |
310 tr = repo.currenttransaction() |
310 tr = repo.currenttransaction() |
311 if not tr: |
311 if not tr: |
312 nodes = safestriproots(ui, repo, nodelist) |
312 nodes = safestriproots(ui, repo, nodelist) |
313 return strip(ui, repo, nodes, True, topic) |
313 return strip(ui, repo, nodes, backup=backup, topic=topic) |
314 # transaction postclose callbacks are called in alphabet order. |
314 # transaction postclose callbacks are called in alphabet order. |
315 # use '\xff' as prefix so we are likely to be called last. |
315 # use '\xff' as prefix so we are likely to be called last. |
316 callback = tr.getpostclose('\xffstrip') |
316 callback = tr.getpostclose('\xffstrip') |
317 if callback is None: |
317 if callback is None: |
318 callback = stripcallback(ui, repo, True, topic) |
318 callback = stripcallback(ui, repo, backup=backup, topic=topic) |
319 tr.addpostclose('\xffstrip', callback) |
319 tr.addpostclose('\xffstrip', callback) |
320 if topic: |
320 if topic: |
321 callback.topic = topic |
321 callback.topic = topic |
322 callback.addnodes(nodelist) |
322 callback.addnodes(nodelist) |
323 |
323 |