You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by sv...@apache.org on 2018/11/03 04:00:16 UTC

svn commit: r1845638 - in /subversion/branches/1.11.x: ./ STATUS subversion/libsvn_subr/sysinfo.c

Author: svn-role
Date: Sat Nov  3 04:00:15 2018
New Revision: 1845638

URL: http://svn.apache.org/viewvc?rev=1845638&view=rev
Log:
Merge r1842334 from trunk:

 * r1842334
   Update how we display the OS name on Mac in 'svn --version --verbose'.
   Justification:
     If we go to the trouble of displaying commercial OS names, we may as well
     do it right on macOS. Not critical for 1.11.0 but would be nice to have;
     the change has very minor impact.
   Votes:
     +1: brane, stsp, rhuijben

Modified:
    subversion/branches/1.11.x/   (props changed)
    subversion/branches/1.11.x/STATUS
    subversion/branches/1.11.x/subversion/libsvn_subr/sysinfo.c

Propchange: subversion/branches/1.11.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Nov  3 04:00:15 2018
@@ -100,4 +100,4 @@
 /subversion/branches/verify-at-commit:1462039-1462408
 /subversion/branches/verify-keep-going:1439280-1546110
 /subversion/branches/wc-collate-path:1402685-1480384
-/subversion/trunk:1840990-1840991,1840995,1840997,1841059,1841079,1841091,1841098,1841136,1841180,1841272,1841481,1841524-1841525,1841567,1841600-1841602,1841606,1841719,1841725,1841731,1841736,1841742-1841743,1841753-1841754,1841822,1841850,1841867,1842090,1842222-1842223,1842814,1842827,1842829,1842877
+/subversion/trunk:1840990-1840991,1840995,1840997,1841059,1841079,1841091,1841098,1841136,1841180,1841272,1841481,1841524-1841525,1841567,1841600-1841602,1841606,1841719,1841725,1841731,1841736,1841742-1841743,1841753-1841754,1841822,1841850,1841867,1842090,1842222-1842223,1842334,1842814,1842827,1842829,1842877

Modified: subversion/branches/1.11.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.11.x/STATUS?rev=1845638&r1=1845637&r2=1845638&view=diff
==============================================================================
--- subversion/branches/1.11.x/STATUS (original)
+++ subversion/branches/1.11.x/STATUS Sat Nov  3 04:00:15 2018
@@ -43,15 +43,6 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * r1842334
-   Update how we display the OS name on Mac in 'svn --version --verbose'.
-   Justification:
-     If we go to the trouble of displaying commercial OS names, we may as well
-     do it right on macOS. Not critical for 1.11.0 but would be nice to have;
-     the change has very minor impact.
-   Votes:
-     +1: brane, stsp, rhuijben
-
  * r1843888
    Fix issue #4768, repos-to-WC copy with --parents doesn't create directories.
    Justification:

Modified: subversion/branches/1.11.x/subversion/libsvn_subr/sysinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.11.x/subversion/libsvn_subr/sysinfo.c?rev=1845638&r1=1845637&r2=1845638&view=diff
==============================================================================
--- subversion/branches/1.11.x/subversion/libsvn_subr/sysinfo.c (original)
+++ subversion/branches/1.11.x/subversion/libsvn_subr/sysinfo.c Sat Nov  3 04:00:15 2018
@@ -1122,42 +1122,70 @@ value_from_dict(CFDictionaryRef plist, C
   return value;
 }
 
-/* Return the commercial name of the OS, given the version number in
+/* Return the minor version the operating system, given the number in
    a format that matches the regular expression /^10\.\d+(\..*)?$/ */
-static const char *
-release_name_from_version(const char *osver)
+static int
+macos_minor_version(const char *osver)
 {
   char *end = NULL;
   unsigned long num = strtoul(osver, &end, 10);
 
   if (!end || *end != '.' || num != 10)
-    return NULL;
+    return -1;
 
   osver = end + 1;
   end = NULL;
   num = strtoul(osver, &end, 10);
   if (!end || (*end && *end != '.'))
-    return NULL;
+    return -1;
+
+  return (int)num;
+}
+
+/* Return the product name of the operating system. */
+static const char *
+product_name_from_minor_version(int minor, const char* product_name)
+{
+  /* We can only do this if we know the official product name. */
+  if (0 != strcmp(product_name, "Mac OS X"))
+    return product_name;
+
+  if (minor <= 7)
+    return product_name;
+
+  if (minor <= 11)
+    return "OS X";
 
-  /* See http://en.wikipedia.org/wiki/History_of_OS_X#Release_timeline */
-  switch(num)
+  return "macOS";
+}
+
+/* Return the commercial name of the operating system. */
+static const char *
+release_name_from_minor_version(int minor, const char* product_name)
+{
+  /* We can only do this if we know the official product name. */
+  if (0 == strcmp(product_name, "Mac OS X"))
     {
-    case  0: return "Cheetah";
-    case  1: return "Puma";
-    case  2: return "Jaguar";
-    case  3: return "Panther";
-    case  4: return "Tiger";
-    case  5: return "Leopard";
-    case  6: return "Snow Leopard";
-    case  7: return "Lion";
-    case  8: return "Mountain Lion";
-    case  9: return "Mavericks";
-    case 10: return "Yosemite";
-    case 11: return "El Capitan";
-    case 12: return "Sierra";
-    case 13: return "High Sierra";
+      /* See https://en.wikipedia.org/wiki/MacOS_version_history#Releases */
+      switch(minor)
+        {
+        case  0: return "Cheetah";
+        case  1: return "Puma";
+        case  2: return "Jaguar";
+        case  3: return "Panther";
+        case  4: return "Tiger";
+        case  5: return "Leopard";
+        case  6: return "Snow Leopard";
+        case  7: return "Lion";
+        case  8: return "Mountain Lion";
+        case  9: return "Mavericks";
+        case 10: return "Yosemite";
+        case 11: return "El Capitan";
+        case 12: return "Sierra";
+        case 13: return "High Sierra";
+        case 14: return "Mojave";
+        }
     }
-
   return NULL;
 }
 
@@ -1180,20 +1208,23 @@ macos_release_name(apr_pool_t *pool)
                                           CFSTR("ProductBuildVersion"),
                                           pool);
       const char *release;
+      int minor_version;
 
       if (!osver)
         osver = value_from_dict(plist, CFSTR("ProductVersion"), pool);
-      release = release_name_from_version(osver);
+      minor_version = macos_minor_version(osver);
+      release = release_name_from_minor_version(minor_version, osname);
+      osname = product_name_from_minor_version(minor_version, osname);
 
       CFRelease(plist);
       return apr_psprintf(pool, "%s%s%s%s%s%s%s%s",
                           (osname ? osname : ""),
-                          (osver ? (osname ? " " : "") : ""),
-                          (osver ? osver : ""),
-                          (release ? (osname||osver ? " " : "") : ""),
+                          (release ? (osname ? " " : "") : ""),
                           (release ? release : ""),
+                          (osver ? (osname||release ? " " : "") : ""),
+                          (osver ? osver : ""),
                           (build
-                           ? (osname||osver||release ? ", " : "")
+                           ? (osname||release||osver ? ", " : "")
                            : ""),
                           (build
                            ? (server ? "server build " : "build ")