changeset 4527:b422b558015b

Add ui.slash hgrc setting This will make most commands print paths using "/", regardless of the value of os.sep.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 08 Jun 2007 23:49:12 -0300
parents cbabc9ac7424
children 85a69f4d1e80
files doc/hgrc.5.txt mercurial/dirstate.py
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/doc/hgrc.5.txt	Fri Jun 08 23:49:12 2007 -0300
+++ b/doc/hgrc.5.txt	Fri Jun 08 23:49:12 2007 -0300
@@ -439,6 +439,11 @@
     Reduce the amount of output printed.  True or False.  Default is False.
   remotecmd;;
     remote command to use for clone/push/pull operations. Default is 'hg'.
+  slash;;
+    Display paths using a slash ("/") as the path separator.  This only
+    makes a difference on systems where the default path separator is not
+    the slash character (e.g. Windows uses the backslash character ("\")).
+    Default is False.
   ssh;;
     command to use for SSH connections. Default is 'ssh'.
   strict;;
--- a/mercurial/dirstate.py	Fri Jun 08 23:49:12 2007 -0300
+++ b/mercurial/dirstate.py	Fri Jun 08 23:49:12 2007 -0300
@@ -27,6 +27,7 @@
         self.copymap = {}
         self.ignorefunc = None
         self._branch = None
+        self._slash = None
 
     def wjoin(self, f):
         return os.path.join(self.root, f)
@@ -47,7 +48,12 @@
     def pathto(self, f, cwd=None):
         if cwd is None:
             cwd = self.getcwd()
-        return util.pathto(self.root, cwd, f)
+        path = util.pathto(self.root, cwd, f)
+        if self._slash is None:
+            self._slash = self.ui.configbool('ui', 'slash') and os.sep != '/'
+        if self._slash:
+            path = path.replace(os.sep, '/')
+        return path
 
     def hgignore(self):
         '''return the contents of .hgignore files as a list of patterns.