Patchwork [2,of,6] blackbox: remove hexfn

login
register
mail settings
Submitter timeless@mozdev.org
Date March 1, 2016, 11:51 a.m.
Message ID <e19277557090548ed21a.1456833104@waste.org>
Download mbox | patch
Permalink /patch/13497/
State Accepted
Headers show

Comments

timeless@mozdev.org - March 1, 2016, 11:51 a.m.
# HG changeset patch
# User timeless <timeless@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.

Patch

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)