changeset 47339:43f6a7bb4e12

fuzz: add hg to sys.path when constructing mpatch corpus Differential Revision: https://phab.mercurial-scm.org/D10777
author Augie Fackler <augie@google.com>
date Thu, 27 May 2021 12:10:59 -0400
parents f27f2afb15da
children 3f00665bbea0
files contrib/fuzz/mpatch_corpus.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/fuzz/mpatch_corpus.py	Wed May 19 16:18:16 2021 +0200
+++ b/contrib/fuzz/mpatch_corpus.py	Thu May 27 12:10:59 2021 -0400
@@ -1,10 +1,15 @@
 from __future__ import absolute_import, print_function
 
 import argparse
+import os
 import struct
 import sys
 import zipfile
 
+# Add ../.. to sys.path as an absolute path so we can import hg modules
+hgloc = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
+sys.path[0:0] = [hgloc]
+
 from mercurial import (
     hg,
     ui as uimod,