@@ -176,6 +176,16 @@ def _createmarkers(orig, repo, relations
finally:
lockmod.release(tr, lock)
+def _computeobsoletenotrebasedwrap(orig, repo, rebasesetrevs, dest):
+ repo._notinhibited = rebasesetrevs
+ try:
+ repo.invalidatevolatilesets()
+ r = orig(repo, rebasesetrevs, dest)
+ finally:
+ del repo._notinhibited
+ repo.invalidatevolatilesets()
+ return r
+
def transactioncallback(orig, repo, desc, *args, **kwargs):
""" Wrap localrepo.transaction to inhibit new obsolete changes """
def inhibitposttransaction(transaction):
@@ -202,8 +212,10 @@ def extsetup(ui):
obs = obsfunc(repo)
if _inhibitenabled(repo):
getrev = repo.changelog.nodemap.get
+ blacklist = getattr(repo, '_notinhibited', set())
for n in repo._obsinhibit:
- obs.discard(getrev(n))
+ if getrev(n) not in blacklist:
+ obs.discard(getrev(n))
return obs
try:
extensions.find('directaccess')
@@ -232,6 +244,14 @@ def extsetup(ui):
# wrap both to add inhibition markers.
extensions.wrapfunction(bookmarks.bmstore, 'recordchange', _bookmarkchanged)
extensions.wrapfunction(bookmarks.bmstore, 'write', _bookmarkchanged)
+ try:
+ rebase = extensions.find('rebase')
+ if rebase:
+ extensions.wrapfunction(rebase,
+ '_computeobsoletenotrebased',
+ _computeobsoletenotrebasedwrap)
+ except KeyError:
+ pass
# Add bookmark -D option
entry = extensions.wrapcommand(commands.table, 'bookmark', _bookmark)
entry[1].append(('D','prune',None,
@@ -700,6 +700,17 @@ Empty commit
nothing changed
[1]
+Check that the behavior of rebase with obsolescence markers is maintained
+despite inhibit
+
+ $ hg up a438c045eb37
+ 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ hg rebase -r 15:: -d 21 --config experimental.rebaseskipobsolete=True
+ note: not rebasing 15:2d66e189f5b5 "add cM", already in destination as 21:721c3c279519 "add cM"
+ rebasing 16:a438c045eb37 "add cN"
+ $ hg up 21
+ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+
Directaccess should load after some extensions precised in the conf
With no extension specified:
@@ -714,7 +725,7 @@ With no extension specified:
> EOF
$ hg id
['rebase', 'strip', 'evolve', 'directaccess', 'inhibit', 'testextension']
- 721c3c279519 tip
+ 721c3c279519
With test_extension specified:
$ cat >> $HGRCPATH << EOF
@@ -723,7 +734,7 @@ With test_extension specified:
> EOF
$ hg id
['rebase', 'strip', 'evolve', 'inhibit', 'testextension', 'directaccess']
- 721c3c279519 tip
+ 721c3c279519
Inhibit should not work without directaccess
$ cat >> $HGRCPATH <<EOF
@@ -746,6 +757,7 @@ We copy the inhibhit repo to inhibit2 an
$ pwd=$(pwd)
$ cd inhibit
$ mkcommit pk
+ created new head
$ hg id
003a4735afde tip
$ echo "OO" > pk
@@ -767,7 +779,7 @@ Visible commits can still be pushed
adding changesets
adding manifests
adding file changes
- added 1 changesets with 1 changes to 1 files
+ added 1 changesets with 1 changes to 1 files (+1 heads)
2 new obsolescence markers
Pulling from a inhibit repo to a non-inhibit repo should work