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

Matt Harbison mharbison72 at gmail.com
Wed Sep 26 23:12:55 EDT 2018


# HG changeset patch
# User Matt Harbison <matt_harbison at 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.

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:


More information about the Mercurial-devel mailing list