[PATCH] Fix issue 1625: On Windows, the locate command ignores the 'ui.slash' setting

Alejandro Santos alejolp at alejolp.com
Fri Jul 10 17:30:18 UTC 2009


# HG changeset patch
# User Alejandro Santos <alejolp at alejolp.com>
# Date 1247246428 10800
# Node ID 63c55c8908a5760ab229536a8ace8bbc3ea9aad8
# Parent  bbc78cb1bf150d8497a6057d3b1c5d75e4003d11
Fix issue 1625: On Windows, the locate command ignores the 'ui.slash' setting.

diff -r bbc78cb1bf15 -r 63c55c8908a5 mercurial/commands.py
--- a/mercurial/commands.py	Thu Jul 09 19:49:02 2009 -0500
+++ b/mercurial/commands.py	Fri Jul 10 14:20:28 2009 -0300
@@ -1902,6 +1902,13 @@
     end = opts.get('print0') and '\0' or '\n'
     rev = opts.get('rev') or None
 
+    # Fix issue 1625: On Windows, the locate command ignores the 'ui.slash'
+    # setting and the output contains a mix of slashes '/' and backslashes '\'
+    # This function replaces the output depending on the user setting and the
+    # OS.
+    fnfixslash = ui.configbool('ui', 'slash') and util.pconvert \
+        or util.localpath
+
     ret = 1
     m = cmdutil.match(repo, pats, opts, default='relglob')
     m.bad = lambda x,y: False
@@ -1909,9 +1916,9 @@
         if not rev and abs not in repo.dirstate:
             continue
         if opts.get('fullpath'):
-            ui.write(repo.wjoin(abs), end)
+            ui.write(fnfixslash(repo.wjoin(abs)), end)
         else:
-            ui.write(((pats and m.rel(abs)) or abs), end)
+            ui.write(fnfixslash((pats and m.rel(abs)) or abs), end)
         ret = 0
 
     return ret



More information about the Mercurial-devel mailing list