hgext/inhibit.py
changeset 1332 1ed337c7f061
parent 1321 8fa74845eb1f
child 1334 b8f880d4171d
--- a/hgext/inhibit.py	Mon May 11 14:31:17 2015 -0700
+++ b/hgext/inhibit.py	Thu Apr 30 17:37:11 2015 -0700
@@ -55,12 +55,12 @@
             _inhibitmarkers(repo, [newnode])
             return newnode
 
-    # Wrapping this to inhibit obsolete revs resulting from a transaction
-    extensions.wrapfunction(localrepo.localrepository,
-                            'transaction', transactioncallback)
-
     repo.__class__ = obsinhibitedrepo
     repo._explicitaccess = set()
+    if not ui.configbool('inhibit', 'onlydirectaccess', False):
+        # Wrapping this to inhibit obsolete revs resulting from a transaction
+        extensions.wrapfunction(localrepo.localrepository,
+                                'transaction', transactioncallback)
 
 
 def _update(orig, ui, repo, *args, **kwargs):
@@ -206,25 +206,26 @@
             obs.discard(getrev(n))
         return obs
     obsolete.cachefuncs['obsolete'] = _computeobsoleteset
-    # drop divergence computation since it is incompatible with "light revive"
-    obsolete.cachefuncs['divergent'] = lambda repo: set()
-    # drop bumped computation since it is incompatible with "light revive"
-    obsolete.cachefuncs['bumped'] = lambda repo: set()
     # wrap create marker to make it able to lift the inhibition
     extensions.wrapfunction(obsolete, 'createmarkers', _createmarkers)
     extensions.wrapfunction(repoview, '_getdynamicblockers', _accessvisible)
     extensions.wrapfunction(revset, 'posttreebuilthook', _posttreebuilthook)
-    # wrap update to make sure that no obsolete commit is visible after an
-    # update
-    extensions.wrapcommand(commands.table, 'update', _update)
-    # There are two ways to save bookmark changes during a transation, we
-    # wrap both to add inhibition markers.
-    extensions.wrapfunction(bookmarks.bmstore, 'recordchange', _bookmarkchanged)
-    extensions.wrapfunction(bookmarks.bmstore, 'write', _bookmarkchanged)
-    # Add bookmark -D option
-    entry = extensions.wrapcommand(commands.table, 'bookmark', _bookmark)
-    entry[1].append(('D','prune',None,
-                    _('delete the bookmark and prune the commits underneath')))
+    if not ui.configbool('inhibit', 'onlydirectaccess', False):
+        # drop divergence computation since it is incompatible with "light revive"
+        obsolete.cachefuncs['divergent'] = lambda repo: set()
+        # drop bumped computation since it is incompatible with "light revive"
+        obsolete.cachefuncs['bumped'] = lambda repo: set()
+        # wrap update to make sure that no obsolete commit is visible after an
+        # update
+        extensions.wrapcommand(commands.table, 'update', _update)
+        # There are two ways to save bookmark changes during a transation, we
+        # wrap both to add inhibition markers.
+        extensions.wrapfunction(bookmarks.bmstore, 'recordchange', _bookmarkchanged)
+        extensions.wrapfunction(bookmarks.bmstore, 'write', _bookmarkchanged)
+        # Add bookmark -D option
+        entry = extensions.wrapcommand(commands.table, 'bookmark', _bookmark)
+        entry[1].append(('D','prune',None,
+                        _('delete the bookmark and prune the commits underneath')))