# HG changeset patch # User Laurent Charignon # Date 1449271879 28800 # Node ID 40e496bc7b54a28f0af7fe5f136f60c905d0d7e9 # Parent e47dda53a5c2dc4935987d4a4aa37fefada68eef check-code: make inhibit.py comply with check-code diff -r e47dda53a5c2 -r 40e496bc7b54 hgext/inhibit.py --- 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):