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

login
register
mail settings
Submitter phabricator
Date Jan. 8, 2020, 7:50 p.m.
Message ID <45dbeea9e211356ecdc1fcd2abc5b950@localhost.localdomain>
Download mbox | patch
Permalink /patch/44200/
State Not Applicable
Headers show

Comments

phabricator - Jan. 8, 2020, 7:50 p.m.
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




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

Patch

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', {}))