hgext/inhibit.py
changeset 1551 40e496bc7b54
parent 1542 333e056b3034
child 1560 59d47a9f633d
--- a/hgext/inhibit.py	Fri Dec 04 15:31:34 2015 -0800
+++ b/hgext/inhibit.py	Fri Dec 04 15:31:19 2015 -0800
@@ -9,15 +9,16 @@
 should probably stick on using evolution in its current state, understand its
 concept and provide feedback
 
-This extension provides the ability to "inhibit" obsolescence markers. obsolete 
-revision can be cheaply brought back to life that way. 
-However as the inhibitor are not fitting in an append only model, this is 
+This extension provides the ability to "inhibit" obsolescence markers. obsolete
+revision can be cheaply brought back to life that way.
+However as the inhibitor are not fitting in an append only model, this is
 incompatible with sharing mutable history.
 """
 from mercurial import localrepo
 from mercurial import obsolete
 from mercurial import extensions
 from mercurial import cmdutil
+from mercurial import error
 from mercurial import scmutil
 from mercurial import commands
 from mercurial import lock as lockmod
@@ -40,7 +41,7 @@
             obsinhibit = set()
             raw = self.svfs.tryread('obsinhibit')
             for i in xrange(0, len(raw), 20):
-                obsinhibit.add(raw[i:i+20])
+                obsinhibit.add(raw[i:i + 20])
             return obsinhibit
 
         def commit(self, *args, **kwargs):
@@ -59,7 +60,7 @@
     """
     wlock = None
     try:
-        # Evolve is running a hook on lock release to display a warning message 
+        # Evolve is running a hook on lock release to display a warning message
         # if the workind dir's parent is obsolete.
         # We take the lock here to make sure that we inhibit the parent before
         # that hook get a chance to run.
@@ -77,10 +78,10 @@
     if not haspruneopt:
         return orig(ui, repo, *bookmarks, **opts)
     elif opts.get('rename'):
-        raise util.Abort('Cannot use both -m and -D')
+        raise error.Abort('Cannot use both -m and -D')
     elif len(bookmarks) == 0:
         hint = _('make sure to put a space between -D and your bookmark name')
-        raise util.Abort(_('Error, please check your command'), hint=hint)
+        raise error.Abort(_('Error, please check your command'), hint=hint)
 
     # Call prune -B
     evolve = extensions.find('evolve')
@@ -184,11 +185,11 @@
 def _computeobsoletenotrebasedwrap(orig, repo, rebasesetrevs, dest):
     repo._notinhibited = rebasesetrevs
     try:
-       repo.invalidatevolatilesets()
-       r = orig(repo, rebasesetrevs, dest)
+        repo.invalidatevolatilesets()
+        r = orig(repo, rebasesetrevs, dest)
     finally:
-       del repo._notinhibited
-       repo.invalidatevolatilesets()
+        del repo._notinhibited
+        repo.invalidatevolatilesets()
     return r
 
 def transactioncallback(orig, repo, desc, *args, **kwargs):
@@ -203,7 +204,8 @@
             _inhibitmarkers(repo, [repo[r].node() for r in visibleobsolete])
     transaction = orig(repo, desc, *args, **kwargs)
     if desc != 'strip' and _inhibitenabled(repo):
-        transaction.addpostclose('inhibitposttransaction', inhibitposttransaction)
+        transaction.addpostclose('inhibitposttransaction',
+                                 inhibitposttransaction)
     return transaction
 
 def extsetup(ui):