D5935: windows: use util.localpath for repo-relative paths in getuipathfn()

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Feb 11 12:51:16 EST 2019


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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, https://phab.mercurial-scm.org/rHGa997163e7fae2fe933f8d0c6d1013205befd1ee4 (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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5935

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -756,8 +756,10 @@
         cwd = repo.getcwd()
         pathto = repo.pathto
         return lambda f: pathto(f, cwd)
+    elif repo.ui.configbool('ui', 'slash'):
+        return lambda f: f
     else:
-        return lambda f: f
+        return util.localpath
 
 def subdiruipathfn(subpath, uipathfn):
     '''Create a new uipathfn that treats the file as relative to subpath.'''



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list