changeset 1551:40e496bc7b54

check-code: make inhibit.py comply with check-code
author Laurent Charignon <lcharignon@fb.com>
date Fri, 04 Dec 2015 15:31:19 -0800
parents e47dda53a5c2
children ebebff25b891
files hgext/inhibit.py
diffstat 1 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- 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):