diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
index a7701001c829838e01f5317ea494c54c981a50a4_bWVyY3VyaWFsL3N1YnJlcG8ucHk=..df63d4843581c790c2be51910f164b0eee2f2b94_bWVyY3VyaWFsL3N1YnJlcG8ucHk= 100644
--- a/mercurial/subrepo.py
+++ b/mercurial/subrepo.py
@@ -500,6 +500,10 @@
         """return file flags"""
         return ''
 
+    def getfileset(self, expr):
+        """Resolve the fileset expression for this repo"""
+        return set()
+
     def printfiles(self, ui, m, fm, fmt):
         """handle the files command for this subrepo"""
         return 1
@@ -917,6 +921,26 @@
             ctx = self._repo[rev]
         return cmdutil.files(ui, ctx, m, fm, fmt, True)
 
+    @annotatesubrepoerror
+    def getfileset(self, expr):
+        if self._ctx.rev() is None:
+            ctx = self._repo[None]
+        else:
+            rev = self._state[1]
+            ctx = self._repo[rev]
+
+        files = ctx.getfileset(expr)
+
+        for subpath in ctx.substate:
+            sub = ctx.sub(subpath)
+
+            try:
+                files.extend(subpath + '/' + f for f in sub.getfileset(expr))
+            except error.LookupError:
+                self.ui.status(_("skipping missing subrepository: %s\n")
+                               % self.wvfs.reljoin(reporelpath(self), subpath))
+        return files
+
     def walk(self, match):
         ctx = self._repo[None]
         return ctx.walk(match)