[Unison-hackers] [unison-svn] r334 - trunk/src

vouillon@seas.upenn.edu vouillon at seas.upenn.edu
Fri May 15 13:31:49 EDT 2009


Author: vouillon
Date: 2009-05-15 13:31:47 -0400 (Fri, 15 May 2009)
New Revision: 334

Modified:
   trunk/src/.depend
   trunk/src/RECENTNEWS
   trunk/src/case.ml
   trunk/src/case.mli
   trunk/src/mkProjectInfo.ml
   trunk/src/remote.ml
Log:
* Cleaned-up the Unicode selection logic

Modified: trunk/src/.depend
===================================================================
--- trunk/src/.depend	2009-05-15 14:34:43 UTC (rev 333)
+++ trunk/src/.depend	2009-05-15 17:31:47 UTC (rev 334)
@@ -149,10 +149,10 @@
     globals.cmx fileinfo.cmx common.cmx recon.cmi 
 remote.cmo: uutil.cmi ubase/util.cmi ubase/trace.cmi terminal.cmi system.cmi \
     ubase/safelist.cmi ubase/prefs.cmi os.cmi lwt/lwt_unix.cmi lwt/lwt.cmi \
-    fspath.cmi common.cmi clroot.cmi remote.cmi 
+    fspath.cmi fs.cmi common.cmi clroot.cmi case.cmi remote.cmi 
 remote.cmx: uutil.cmx ubase/util.cmx ubase/trace.cmx terminal.cmx system.cmx \
     ubase/safelist.cmx ubase/prefs.cmx os.cmx lwt/lwt_unix.cmx lwt/lwt.cmx \
-    fspath.cmx common.cmx clroot.cmx remote.cmi 
+    fspath.cmx fs.cmx common.cmx clroot.cmx case.cmx remote.cmi 
 sortri.cmo: ubase/util.cmi ubase/safelist.cmi ubase/prefs.cmi pred.cmi \
     path.cmi common.cmi sortri.cmi 
 sortri.cmx: ubase/util.cmx ubase/safelist.cmx ubase/prefs.cmx pred.cmx \

Modified: trunk/src/RECENTNEWS
===================================================================
--- trunk/src/RECENTNEWS	2009-05-15 14:34:43 UTC (rev 333)
+++ trunk/src/RECENTNEWS	2009-05-15 17:31:47 UTC (rev 334)
@@ -1,5 +1,9 @@
 CHANGES FROM VERSION 2.34.0
 
+* Cleaned-up the Unicode selection logic
+-------------------------------
+CHANGES FROM VERSION 2.34.0
+
 * Bumped minor version: incompatible protocol changes
 * The use of the Windows Unicode API is now controlled via the
   "unicode" directive

Modified: trunk/src/case.ml
===================================================================
--- trunk/src/case.ml	2009-05-15 14:34:43 UTC (rev 333)
+++ trunk/src/case.ml	2009-05-15 17:31:47 UTC (rev 334)
@@ -40,26 +40,25 @@
   Prefs.createBool "someHostIsInsensitive" false
     "*Pseudo-preference for internal use only" ""
 
-let unicodePref =
+let unicode =
   Prefs.createString "unicode" "default"
     "!assume Unicode encoding in case insensitive mode"
     "When set to {\\tt true}, this flag causes Unison to perform \
      case insensitive file comparisons assuming Unicode encoding"
 
 let unicodeEncoding =
-  Prefs.createBool "unicodeEncoding" false
+  Prefs.createBool "unicodeEnc" false
     "*Pseudo-preference for internal use only" ""
 
 (* Whether we default to Unicode encoding on OSX and Windows *)
-(* !!! the minor version should be increased whenever *)
-(* !!! this default is changed *)
 let defaultToUnicode = false
 
-let useUnicode pref b =
+let useUnicode b =
+  let pref = Prefs.read unicode in
    pref = "yes" || pref = "true" ||
   (defaultToUnicode && pref = "default" && b)
 
-let useUnicodeAPI pref = useUnicode pref (Util.osType = `Win32)
+let useUnicodeAPI () = useUnicode true
 
 (* During startup the client determines the case sensitivity of each root.   *)
 (* If any root is case insensitive, all roots must know it; we ensure this   *)
@@ -70,7 +69,7 @@
     (Prefs.read caseInsensitiveMode = "yes" ||
      Prefs.read caseInsensitiveMode = "true" ||
      (Prefs.read caseInsensitiveMode = "default" && b));
-  Prefs.set unicodeEncoding (useUnicode (Prefs.read unicodePref) b)
+  Prefs.set unicodeEncoding (useUnicode b)
 
 (****)
 

Modified: trunk/src/case.mli
===================================================================
--- trunk/src/case.mli	2009-05-15 14:34:43 UTC (rev 333)
+++ trunk/src/case.mli	2009-05-15 17:31:47 UTC (rev 334)
@@ -1,9 +1,8 @@
 (* Unison file synchronizer: src/case.mli *)
 (* Copyright 1999-2009, Benjamin C. Pierce (see COPYING for details) *)
 
-val unicodePref : string Prefs.t
 val unicodeEncoding : bool Prefs.t
-val useUnicodeAPI : string -> bool
+val useUnicodeAPI : unit -> bool
 
 type mode
 

Modified: trunk/src/mkProjectInfo.ml
===================================================================
--- trunk/src/mkProjectInfo.ml	2009-05-15 14:34:43 UTC (rev 333)
+++ trunk/src/mkProjectInfo.ml	2009-05-15 17:31:47 UTC (rev 334)
@@ -149,3 +149,4 @@
 
 
 
+

Modified: trunk/src/remote.ml
===================================================================
--- trunk/src/remote.ml	2009-05-15 14:34:43 UTC (rev 333)
+++ trunk/src/remote.ml	2009-05-15 17:31:47 UTC (rev 334)
@@ -918,7 +918,7 @@
 let canonizeLocally s unicode =
   (* We need to select the proper API in order to compute correctly the
      canonical fspath *)
-  Fs.setUnicodeEncoding (Case.useUnicodeAPI unicode);
+  Fs.setUnicodeEncoding unicode;
   Fspath.canonize s
 
 let canonizeOnServer =
@@ -929,7 +929,7 @@
 let canonize clroot = (* connection for clroot must have been set up already *)
   match clroot with
     Clroot.ConnectLocal s ->
-      (Common.Local, canonizeLocally s (Prefs.read Case.unicodePref))
+      (Common.Local, canonizeLocally s (Case.useUnicodeAPI ()))
   | _ ->
       match
         try
@@ -950,7 +950,7 @@
     None
 
 let canonizeRoot rootName clroot termInteract =
-  let unicode = Prefs.read Case.unicodePref in
+  let unicode = Case.useUnicodeAPI () in
   let finish ioServer s =
     (* We need to always compute the fspath as it depends on
        unicode settings *)
@@ -1001,7 +1001,7 @@
          end >>= fun ioServer ->
          (* We need to always compute the fspath as it depends on
             unicode settings *)
-         let unicode = Prefs.read Case.unicodePref in
+         let unicode = Case.useUnicodeAPI () in
          canonizeOnServer ioServer (s, unicode) >>= fun (host, fspath) ->
          connectedHosts :=
            listReplace (clroot, (host, fspath, ioServer)) !connectedHosts;
@@ -1012,7 +1012,7 @@
   | Clroot.ConnectByShell(shell,host,userOpt,portOpt,s) ->
       match hostFspath clroot with
          Some x ->
-           let unicode = Prefs.read Case.unicodePref in
+           let unicode = Case.useUnicodeAPI () in
            (* We recompute the fspath as it may have changed due to
               unicode settings *)
            Lwt_unix.run
@@ -1103,7 +1103,7 @@
       Unix.close i1; Unix.close o2;
       Lwt_unix.run
         (initConnection i2 o1 >>= fun ioServer ->
-         let unicode = Prefs.read Case.unicodePref in
+         let unicode = Case.useUnicodeAPI () in
          canonizeOnServer ioServer (s, unicode) >>= fun (host, fspath) ->
          connectedHosts :=
            listReplace (clroot, (host, fspath, ioServer)) !connectedHosts;



More information about the Unison-hackers mailing list