changeset 1550:e47dda53a5c2

check-code: make obsolete.py comply with check-code
author Laurent Charignon <lcharignon@fb.com>
date Fri, 04 Dec 2015 15:31:34 -0800
parents 81a221db8a72
children 40e496bc7b54
files hgext/obsolete.py
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/obsolete.py	Fri Dec 04 15:21:16 2015 -0800
+++ b/hgext/obsolete.py	Fri Dec 04 15:31:34 2015 -0800
@@ -5,9 +5,12 @@
 # GNU General Public License version 2 or any later version.
 """Deprecated extension that formely introduces "Changeset Obsolescence".
 
-This concept is now partially in Mercurial core (starting with mercurial 2.3). The remaining logic have been grouped with the evolve extension.
+This concept is now partially in Mercurial core (starting with mercurial 2.3).
+The remaining logic have been grouped with the evolve extension.
 
-Some code cemains in this extensions to detect and convert prehistoric format of obsolete marker than early user may have create. Keep it enabled if you were such user.
+Some code cemains in this extensions to detect and convert prehistoric format
+of obsolete marker than early user may have create. Keep it enabled if you
+were such user.
 """
 
 from mercurial import util
@@ -15,13 +18,14 @@
 try:
     from mercurial import obsolete
 except ImportError:
-    raise util.Abort('Obsolete extension requires Mercurial 2.3 (or later)')
+    raise error.Abort('Obsolete extension requires Mercurial 2.3 (or later)')
 
 import sys
 import json
 
 from mercurial import cmdutil
 from mercurial import error
+from mercurial.i18n import _
 from mercurial.node import bin, nullid
 
 
@@ -50,8 +54,8 @@
         if not data:
             data = repo.svfs.tryread('obsoletemarkers')
         if data:
-            raise util.Abort('old format of obsolete marker detected!\n'
-                             'run `hg debugconvertobsolete` once.')
+            raise error.Abort('old format of obsolete marker detected!\n'
+                              'run `hg debugconvertobsolete` once.')
 
 def _obsdeserialise(flike):
     """read a file like object serialised with _obsserialise
@@ -65,7 +69,7 @@
         subnode = bin(subhex)
         if subnode == nullid:
             subnode = None
-        rels.setdefault( subnode, set()).add(bin(objhex))
+        rels.setdefault(subnode, set()).add(bin(objhex))
     return rels
 
 cmdtable = {}
@@ -153,7 +157,7 @@
         del repo._importoldobsolete
         l.release()
     if not some:
-            ui.warn('nothing to do\n')
+        ui.warn(_('nothing to do\n'))
     ui.status('%i obsolete marker converted\n' % cnt)
     if err:
         ui.write_err('%i conversion failed. check you graph!\n' % err)