diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py --- a/mercurial/templatefilters.py +++ b/mercurial/templatefilters.py @@ -349,6 +349,11 @@ def shortdate(text): """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 --- a/tests/test-locate.t +++ b/tests/test-locate.t @@ -151,4 +151,13 @@ Issue294: hg remove --after dir fails wh $ 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 ../..