[PATCH 2 of 6] blackbox: remove hexfn

timeless timeless at mozdev.org
Tue Mar 1 06:51:44 EST 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1456829147 0
#      Tue Mar 01 10:45:47 2016 +0000
# Node ID e19277557090548ed21a72c7984e24e5c25e4669
# Parent  95ce1eb4af13e2eb8354a57737cef9778ca5a61d
blackbox: remove hexfn

It was introduced as copy+paste code, but was never necessary.

diff --git a/hgext/blackbox.py b/hgext/blackbox.py
--- a/hgext/blackbox.py
+++ b/hgext/blackbox.py
@@ -71,12 +71,6 @@
     del filehandles[path]
     fp.close()
 
-def hexfn(node):
-    if node is None:
-        return None
-    else:
-        return hex(node)
-
 def wrapui(ui):
     class blackboxui(ui.__class__):
         def __init__(self, src=None):
@@ -173,16 +167,13 @@
                 changed = ''
                 if ui._bbrepo:
                     ctx = ui._bbrepo[None]
-                    if ctx.rev() is not None:
-                        rev = hexfn(ctx.node())
-                    else:
-                        parents = ctx.parents()
-                        rev = ('+'.join([hexfn(p.node()) for p in parents]))
-                        if (ui.configbool('blackbox', 'dirty', False) and (
-                            any(ui._bbrepo.status()) or
-                            any(ctx.sub(s).dirty() for s in ctx.substate)
-                        )):
-                            changed = '+'
+                    parents = ctx.parents()
+                    rev = ('+'.join([hex(p.node()) for p in parents]))
+                    if (ui.configbool('blackbox', 'dirty', False) and (
+                        any(ui._bbrepo.status()) or
+                        any(ctx.sub(s).dirty() for s in ctx.substate)
+                    )):
+                        changed = '+'
                 try:
                     ui._bbwrite('%s %s @%s%s (%s)> %s',
                         date, user, rev, changed, pid, formattedmsg)


More information about the Mercurial-devel mailing list