diff --git a/doc/hgrc.5.txt b/doc/hgrc.5.txt --- a/doc/hgrc.5.txt +++ b/doc/hgrc.5.txt @@ -439,6 +439,11 @@ ui:: 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;; diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -27,6 +27,7 @@ class dirstate(object): 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 @@ class dirstate(object): 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.