D7778: mq: avoid using `__file__` to compare modules

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Wed Jan 8 14:50:42 EST 2020


Closed by commit rHG5bbd770d1324: mq: avoid using `__file__` to compare modules (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7778?vs=19026&id=19093

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7778/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7778

AFFECTED FILES
  hgext/mq.py

CHANGE DETAILS

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -68,6 +68,7 @@
 import os
 import re
 import shutil
+import sys
 from mercurial.i18n import _
 from mercurial.node import (
     bin,
@@ -4277,8 +4278,9 @@
 
     dotable(commands.table)
 
+    thismodule = sys.modules["hgext.mq"]
     for extname, extmodule in extensions.extensions():
-        if extmodule.__file__ != __file__:
+        if extmodule != thismodule:
             dotable(getattr(extmodule, 'cmdtable', {}))
 
 



To: mharbison72, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list