diff --git a/mercurial/config.py b/mercurial/config.py
--- a/mercurial/config.py
+++ b/mercurial/config.py
@@ -168,7 +168,7 @@ class config(object):
                     inc = os.path.normpath(os.path.join(base, expanded))
 
                     try:
-                        include(inc, remap=remap, sections=sections)
+                        include(expanded, inc, remap=remap, sections=sections)
                         break
                     except IOError as inst:
                         if inst.errno != errno.ENOENT:
@@ -216,8 +216,12 @@ class config(object):
             b'config files must be opened in binary mode, got fp=%r mode=%r'
             % (fp, fp.mode,)
         )
+
+        def include(rel, abs, remap, sections):
+            self.read(abs, remap=remap, sections=sections)
+
         self.parse(
-            path, fp.read(), sections=sections, remap=remap, include=self.read
+            path, fp.read(), sections=sections, remap=remap, include=include
         )
 
 
diff --git a/mercurial/subrepoutil.py b/mercurial/subrepoutil.py
--- a/mercurial/subrepoutil.py
+++ b/mercurial/subrepoutil.py
@@ -36,7 +36,7 @@ def state(ctx, ui):
     p = config.config()
     repo = ctx.repo()
 
-    def read(f, sections=None, remap=None):
+    def read(rel, f, sections=None, remap=None):
         if f in ctx:
             try:
                 data = ctx[f].data()
@@ -56,7 +56,7 @@ def state(ctx, ui):
             )
 
     if b'.hgsub' in ctx:
-        read(b'.hgsub')
+        read(b'.hgsub', b'.hgsub')
 
     for path, src in ui.configitems(b'subpaths'):
         p.set(b'subpaths', path, src, ui.configsource(b'subpaths', path))