Patchwork [3,of,4] py3: mask out None type when printing in `debuglocks`

login
register
mail settings
Submitter Matt Harbison
Date Sept. 27, 2018, 3:12 a.m.
Message ID <549bc25529a2d8d1c677.1538017975@Envy>
Download mbox | patch
Permalink /patch/35130/
State Accepted
Headers show

Comments

Matt Harbison - Sept. 27, 2018, 3:12 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1538014885 14400
#      Wed Sep 26 22:21:25 2018 -0400
# Node ID 549bc25529a2d8d1c67736110c90491cc1eafc76
# Parent  e37a4df2bf1523b9f03ddbfe5db0209058e6c8f0
py3: mask out None type when printing in `debuglocks`

Apparently, %b doesn't allow None.

Patch

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1436,10 +1436,10 @@  def debuglocks(ui, repo, **opts):
                 if ":" in locker:
                     host, pid = locker.split(':')
                     if host == socket.gethostname():
-                        locker = 'user %s, process %s' % (user, pid)
+                        locker = 'user %s, process %s' % (user or b'None', pid)
                     else:
                         locker = 'user %s, process %s, host %s' \
-                                 % (user, pid, host)
+                                 % (user or b'None', pid, host)
                 ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age))
                 return 1
             except OSError as e: