Mercurial > public > mercurial-scm > hg
comparison mercurial/scmutil.py @ 41684:a8d3a4be066e
windows: use util.localpath for repo-relative paths in getuipathfn()
Now that we have a single place that translates from internal path
representation (slash-separated) to UI representation
(i.e. scmutil.getuipathfn()), let's switch that over to using
util.localpath for absolute paths. I don't expect any test impact on
Windows because we still respect ui.slash, which is set by the test
runner.
As Yuya pointed out, a997163e7fae (status: extract helper for
producing relative or absolute path for UI, 2019-01-29) accidentally
changed to slash-separated paths on Windows because it used used to
use repo.pathto(f, cwd='') (which calls util.localpath()) and after
that patch it just prints the filename without any
transformation. This patch should fix that regression.
Differential Revision: https://phab.mercurial-scm.org/D5935
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 11 Feb 2019 09:12:23 -0800 |
parents | 0531dff73d0b |
children | b81ecf3571d5 |
comparison
equal
deleted
inserted
replaced
41683:5d383d9636d0 | 41684:a8d3a4be066e |
---|---|
754 | 754 |
755 if relative: | 755 if relative: |
756 cwd = repo.getcwd() | 756 cwd = repo.getcwd() |
757 pathto = repo.pathto | 757 pathto = repo.pathto |
758 return lambda f: pathto(f, cwd) | 758 return lambda f: pathto(f, cwd) |
759 elif repo.ui.configbool('ui', 'slash'): | |
760 return lambda f: f | |
759 else: | 761 else: |
760 return lambda f: f | 762 return util.localpath |
761 | 763 |
762 def subdiruipathfn(subpath, uipathfn): | 764 def subdiruipathfn(subpath, uipathfn): |
763 '''Create a new uipathfn that treats the file as relative to subpath.''' | 765 '''Create a new uipathfn that treats the file as relative to subpath.''' |
764 return lambda f: uipathfn(posixpath.join(subpath, f)) | 766 return lambda f: uipathfn(posixpath.join(subpath, f)) |
765 | 767 |