diff mercurial/scmutil.py @ 41491:e6ec0737b706

status: extract helper for producing relative or absolute path for UI I put the helper in scmutil so it can be used by most modules. I would have put it in utils.pathutil, but I think that's supposed to be unaware of repos. Differential Revision: https://phab.mercurial-scm.org/D5745
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 29 Jan 2019 15:37:14 -0800
parents f83b230b7fb3
children 02186c6871ac
line wrap: on
line diff
--- a/mercurial/scmutil.py	Thu Jan 31 18:17:02 2019 +0530
+++ b/mercurial/scmutil.py	Tue Jan 29 15:37:14 2019 -0800
@@ -725,6 +725,14 @@
         return []
     return parents
 
+def getuipathfn(repo, relative):
+    if relative:
+        cwd = repo.getcwd()
+        pathto = repo.pathto
+        return lambda f: pathto(f, cwd)
+    else:
+        return lambda f: f
+
 def expandpats(pats):
     '''Expand bare globs when running on windows.
     On posix we assume it already has already been done by sh.'''