diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py
index a8478b808f17b76b0531d2bb5374ffc46f978c2a_bWVyY3VyaWFsL3RlbXBsYXRlZmlsdGVycy5weQ==..dad8a5071b0a9616f8fea713e8a0dcd222415610_bWVyY3VyaWFsL3RlbXBsYXRlZmlsdGVycy5weQ== 100644
--- a/mercurial/templatefilters.py
+++ b/mercurial/templatefilters.py
@@ -349,6 +349,11 @@
     """Date. Returns a date like "2006-09-18"."""
     return util.shortdate(text)
 
+@templatefilter('slashpath')
+def slashpath(path):
+    """Any text. Replaces the native path separator with slash."""
+    return util.pconvert(path)
+
 @templatefilter('splitlines')
 def splitlines(text):
     """Any text. Split text into a list of lines."""
diff --git a/tests/test-locate.t b/tests/test-locate.t
index a8478b808f17b76b0531d2bb5374ffc46f978c2a_dGVzdHMvdGVzdC1sb2NhdGUudA==..dad8a5071b0a9616f8fea713e8a0dcd222415610_dGVzdHMvdGVzdC1sb2NhdGUudA== 100644
--- a/tests/test-locate.t
+++ b/tests/test-locate.t
@@ -151,4 +151,13 @@
   $ hg files .
   [1]
 
+Convert native path separator to slash (issue5572)
+
+  $ hg files -T '{path|slashpath}\n'
+  ../b
+  ../dir.h/foo
+  ../t.h
+  ../t/e.h
+  ../t/x
+
   $ cd ../..