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

login
register
mail settings
Submitter phabricator
Date Dec. 30, 2019, 6:36 p.m.
Message ID <differential-rev-PHID-DREV-jzxfasa7bwi36vngxe5f-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44137/
State Superseded
Headers show

Comments

phabricator - Dec. 30, 2019, 6:36 p.m.
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This fixes ~70 tests when using an oxidized executable, bringing the current
  failure count down to 92 (with 110 skips) when templates/ is copied next to the
  executable.

REPOSITORY
  rHG Mercurial

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,
@@ -4278,8 +4279,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', {}))