Patchwork registrar: minor cleanup to the merge function

login
register
mail settings
Submitter Matt Harbison
Date Jan. 3, 2019, 4:04 a.m.
Message ID <f8f61cf246f5acd8c61b.1546488274@Envy>
Download mbox | patch
Permalink /patch/37431/
State Accepted
Headers show

Comments

Matt Harbison - Jan. 3, 2019, 4:04 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1546483780 18000
#      Wed Jan 02 21:49:40 2019 -0500
# Node ID f8f61cf246f5acd8c61b24455b5a83d1bf43a4d7
# Parent  e0d00ec2d614f3119d941c4b74dbd724a7836a71
registrar: minor cleanup to the merge function

Pointed out by Yuya.
Yuya Nishihara - Jan. 3, 2019, 8:33 a.m.
On Wed, 02 Jan 2019 23:04:34 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1546483780 18000
> #      Wed Jan 02 21:49:40 2019 -0500
> # Node ID f8f61cf246f5acd8c61b24455b5a83d1bf43a4d7
> # Parent  e0d00ec2d614f3119d941c4b74dbd724a7836a71
> registrar: minor cleanup to the merge function

Queued, thanks.

Patch

diff --git a/mercurial/registrar.py b/mercurial/registrar.py
--- a/mercurial/registrar.py
+++ b/mercurial/registrar.py
@@ -80,11 +80,11 @@  class _funcregistrarbase(object):
         current one, or a ProgrammmingError is raised.  Additionally, the types
         of the two registrars must match.
         """
-        if type(self) != type(registrarbase):
+        if not isinstance(registrarbase, type(self)):
             msg = "cannot merge different types of registrar"
             raise error.ProgrammingError(msg)
 
-        dups = set(registrarbase._table.keys()).intersection(self._table.keys())
+        dups = set(registrarbase._table).intersection(self._table)
 
         if dups:
             msg = 'duplicate registration for names: "%s"' % '", "'.join(dups)