205 def inhibitposttransaction(transaction): |
205 def inhibitposttransaction(transaction): |
206 # At the end of the transaction we catch all the new visible and |
206 # At the end of the transaction we catch all the new visible and |
207 # obsolete commit to inhibit them |
207 # obsolete commit to inhibit them |
208 visibleobsolete = repo.revs('obsolete() - hidden()') |
208 visibleobsolete = repo.revs('obsolete() - hidden()') |
209 ignoreset = set(getattr(repo, '_rebaseset', [])) |
209 ignoreset = set(getattr(repo, '_rebaseset', [])) |
|
210 ignoreset |= set(getattr(repo, '_obsoletenotrebased', [])) |
210 visibleobsolete = list(r for r in visibleobsolete if r not in ignoreset) |
211 visibleobsolete = list(r for r in visibleobsolete if r not in ignoreset) |
211 if visibleobsolete: |
212 if visibleobsolete: |
212 _inhibitmarkers(repo, [repo[r].node() for r in visibleobsolete]) |
213 _inhibitmarkers(repo, [repo[r].node() for r in visibleobsolete]) |
213 transaction = orig(repo, desc, *args, **kwargs) |
214 transaction = orig(repo, desc, *args, **kwargs) |
214 if desc != 'strip' and _inhibitenabled(repo): |
215 if desc != 'strip' and _inhibitenabled(repo): |
215 transaction.addpostclose('inhibitposttransaction', |
216 transaction.addpostclose('inhibitposttransaction', |
216 inhibitposttransaction) |
217 inhibitposttransaction) |
217 return transaction |
218 return transaction |
|
219 |
|
220 |
|
221 # We wrap these two functions to address the following scenario: |
|
222 # - Assuming that we have markers between commits in the rebase set and |
|
223 # destination and that these markers are inhibited |
|
224 # - At the end of the rebase the nodes are still visible because rebase operate |
|
225 # without inhibition and skip these nodes |
|
226 # We keep track in repo._obsoletenotrebased of the obsolete commits skipped by |
|
227 # the rebase and lift the inhibition in the end of the rebase. |
|
228 |
|
229 def _computeobsoletenotrebased(orig, repo, *args, **kwargs): |
|
230 r = orig(repo, *args, **kwargs) |
|
231 repo._obsoletenotrebased = r.keys() |
|
232 return r |
|
233 |
|
234 def _clearrebased(orig, ui, repo, *args, **kwargs): |
|
235 r = orig(ui, repo, *args, **kwargs) |
|
236 tonode = repo.changelog.node |
|
237 if util.safehasattr(repo, '_obsoletenotrebased'): |
|
238 _deinhibitmarkers(repo, [tonode(k) for k in repo._obsoletenotrebased]) |
|
239 return r |
|
240 |
218 |
241 |
219 def extsetup(ui): |
242 def extsetup(ui): |
220 # lets wrap the computation of the obsolete set |
243 # lets wrap the computation of the obsolete set |
221 # We apply inhibition there |
244 # We apply inhibition there |
222 obsfunc = obsolete.cachefuncs['obsolete'] |
245 obsfunc = obsolete.cachefuncs['obsolete'] |
260 if rebase: |
283 if rebase: |
261 if util.safehasattr(rebase, '_filterobsoleterevs'): |
284 if util.safehasattr(rebase, '_filterobsoleterevs'): |
262 extensions.wrapfunction(rebase, |
285 extensions.wrapfunction(rebase, |
263 '_filterobsoleterevs', |
286 '_filterobsoleterevs', |
264 _filterobsoleterevswrap) |
287 _filterobsoleterevswrap) |
|
288 extensions.wrapfunction(rebase, 'clearrebased', _clearrebased) |
|
289 if util.safehasattr(rebase, '_computeobsoletenotrebased'): |
|
290 extensions.wrapfunction(rebase, |
|
291 '_computeobsoletenotrebased', |
|
292 _computeobsoletenotrebased) |
|
293 |
265 except KeyError: |
294 except KeyError: |
266 pass |
295 pass |
267 # There are two ways to save bookmark changes during a transation, we |
296 # There are two ways to save bookmark changes during a transation, we |
268 # wrap both to add inhibition markers. |
297 # wrap both to add inhibition markers. |
269 extensions.wrapfunction(bookmarks.bmstore, 'recordchange', _bookmarkchanged) |
298 extensions.wrapfunction(bookmarks.bmstore, 'recordchange', _bookmarkchanged) |