You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/11/04 21:48:30 UTC

svn commit: r1031230 [21/21] - in /subversion/branches/py-tests-as-modules: ./ build/ build/ac-macros/ build/win32/ contrib/client-side/ notes/ notes/http-and-webdav/ notes/wc-ng/ subversion/bindings/ctypes-python/csvn/ subversion/bindings/javahl/nativ...

Modified: subversion/branches/py-tests-as-modules/tools/dev/wc-format.py
URL: http://svn.apache.org/viewvc/subversion/branches/py-tests-as-modules/tools/dev/wc-format.py?rev=1031230&r1=1031229&r2=1031230&view=diff
==============================================================================
--- subversion/branches/py-tests-as-modules/tools/dev/wc-format.py (original)
+++ subversion/branches/py-tests-as-modules/tools/dev/wc-format.py Thu Nov  4 20:48:21 2010
@@ -4,31 +4,44 @@ import os
 import sqlite3
 import sys
 
-# helper
-def usage():
-  sys.stderr.write("USAGE: %s [PATH]\n" + \
-                   "\n" + \
-                   "Prints to stdout the format of the working copy at PATH.\n")
-
-# parse argv
-wc = (sys.argv[1:] + ['.'])[0]
-
-# main()
-entries = os.path.join(wc, '.svn', 'entries')
-wc_db = os.path.join(wc, '.svn', 'wc.db')
-
-if os.path.exists(entries):
-  formatno = int(open(entries).readline())
-elif os.path.exists(wc_db):
-  formatno = sqlite3.connect(wc_db).execute('pragma user_version;').fetchone()[0]
-else:
-  usage()
-  sys.exit(1)
-
-# 1.0.x -> 1.3.x: format 4
-# 1.4.x: format 8
-# 1.5.x: format 9
-# 1.6.x: format 10
-# 1.7.x: format XXX
-print("%s: %d" % (wc, formatno))
+MIN_SINGLE_DB_FORMAT = 19
 
+def get_format(wc_path):
+  entries = os.path.join(wc_path, '.svn', 'entries')
+  wc_db = os.path.join(wc_path, '.svn', 'wc.db')
+
+  formatno = 'not under version control'
+
+  if os.path.exists(entries):
+    formatno = int(open(entries).readline())
+  elif os.path.exists(wc_db):
+    conn = sqlite3.connect(wc_db)
+    curs = conn.cursor()
+    curs.execute('pragma user_version;')
+    formatno = curs.fetchone()[0]
+  elif os.path.exists(wc_path):
+    parent_path = os.path.dirname(os.path.abspath(wc_path))
+    if wc_path != parent_path:
+      formatno = get_format(parent_path)
+      if formatno >= MIN_SINGLE_DB_FORMAT:
+      	return formatno
+
+  return formatno
+
+def print_format(wc_path):
+  # see subversion/libsvn_wc/wc.h for format values and information
+  #   1.0.x -> 1.3.x: format 4
+  #   1.4.x: format 8
+  #   1.5.x: format 9
+  #   1.6.x: format 10
+  #   1.7.x: format XXX
+  formatno = get_format(wc_path)
+  print '%s: %s' % (wc_path, formatno)
+
+
+if __name__ == '__main__':
+  paths = sys.argv[1:]
+  if not paths:
+    paths = ['.']
+  for wc_path in paths:
+    print_format(wc_path)

Modified: subversion/branches/py-tests-as-modules/tools/diff/diff.c
URL: http://svn.apache.org/viewvc/subversion/branches/py-tests-as-modules/tools/diff/diff.c?rev=1031230&r1=1031229&r2=1031230&view=diff
==============================================================================
--- subversion/branches/py-tests-as-modules/tools/diff/diff.c (original)
+++ subversion/branches/py-tests-as-modules/tools/diff/diff.c Thu Nov  4 20:48:21 2010
@@ -1,4 +1,4 @@
-/* diff-test.c -- test driver for text diffs
+/* diff.c -- test driver for text diffs
  *
  * ====================================================================
  *    Licensed to the Apache Software Foundation (ASF) under one
@@ -28,68 +28,121 @@
 #include "svn_pools.h"
 #include "svn_diff.h"
 #include "svn_io.h"
-
+#include "svn_utf.h"
 
 static svn_error_t *
 do_diff(svn_stream_t *ostream,
-        const char *original, const char *modified,
+        const char *original,
+        const char *modified,
         svn_boolean_t *has_changes,
+        svn_diff_file_options_t *options,
+        svn_boolean_t show_c_function,
         apr_pool_t *pool)
 {
   svn_diff_t *diff;
 
-  SVN_ERR(svn_diff_file_diff(&diff, original, modified, pool));
-
+  SVN_ERR(svn_diff_file_diff_2(&diff, original, modified, options, pool));
   *has_changes = svn_diff_contains_diffs(diff);
+  return svn_diff_file_output_unified3(ostream, diff, original, modified,
+                                       NULL, NULL, SVN_APR_LOCALE_CHARSET,
+                                       NULL, show_c_function, pool);
+}
 
-  SVN_ERR(svn_diff_file_output_unified(ostream, diff,
-                                       original, modified,
-                                       NULL, NULL, pool));
-
-  return NULL;
+static void
+print_usage(svn_stream_t *ostream, const char *progname,
+            apr_pool_t *pool)
+{
+  svn_error_clear(svn_stream_printf(ostream, pool,
+     "Usage: %s [OPTIONS] <file1> <file2>\n"
+     "\n"
+     "Display the differences between <file1> and <file2> in unified diff\n"
+     "format.  OPTIONS are diff extensions as described by 'svn help diff'.\n"
+     "Use '--' alone to indicate that no more options follow.\n",
+     progname));
 }
 
-int main(int argc, char *argv[])
+int main(int argc, const char *argv[])
 {
   apr_pool_t *pool;
   svn_stream_t *ostream;
-  int rc;
   svn_error_t *svn_err;
+  svn_boolean_t has_changes;
+  svn_diff_file_options_t *diff_options;
+  apr_array_header_t *options_array;
+  int i;
+  const char *from = NULL;
+  const char *to = NULL;
+  svn_boolean_t show_c_function = FALSE;
+  svn_boolean_t no_more_options = FALSE;
 
   apr_initialize();
+  atexit(apr_terminate);
 
   pool = svn_pool_create(NULL);
 
   svn_err = svn_stream_for_stdout(&ostream, pool);
   if (svn_err)
     {
-      svn_handle_error2(svn_err, stdout, FALSE, "diff-test: ");
-      rc = 2;
+      svn_handle_error2(svn_err, stdout, FALSE, "diff: ");
+      return 2;
     }
-  else if (argc == 3)
+  
+  options_array = apr_array_make(pool, 0, sizeof(const char *));
+  
+  for (i = 1 ; i < argc ; i++)
     {
-      svn_boolean_t has_changes;
-
-      svn_err = do_diff(ostream, argv[1], argv[2], &has_changes, pool);
-      if (svn_err == NULL)
+      if (!no_more_options && (argv[i][0] == '-'))
         {
-          rc = has_changes ? 1 : 0;
+          /* Special case: '--' means "no more options follow" */
+          if (argv[i][1] == '-' && !argv[i][2])
+            {
+              no_more_options = TRUE;
+              continue;
+            }
+          /* Special case: we need to detect '-p' and handle it specially */
+          if (argv[i][1] == 'p' && !argv[i][2])
+            {
+              show_c_function = TRUE;
+              continue;
+            }
+          APR_ARRAY_PUSH(options_array, const char *) = argv[i];
         }
       else
         {
-          svn_handle_error2(svn_err, stdout, FALSE, "diff-test: ");
-          rc = 2;
+          if (from == NULL)
+            from = argv[i];
+          else if (to == NULL)
+            to = argv[i];
+          else
+            {
+              print_usage(ostream, argv[0], pool);
+              return 2;
+            }
         }
     }
-  else
+
+  if (!from || !to)
     {
-      svn_error_clear(svn_stream_printf(ostream, pool,
-                                        "Usage: %s <file1> <file2>\n",
-                                        argv[0]));
-      rc = 2;
+      print_usage(ostream, argv[0], pool);
+      return 2;
     }
 
-  apr_terminate();
+  diff_options = svn_diff_file_options_create(pool);
+
+  svn_err = svn_diff_file_options_parse(diff_options, options_array, pool);
+  if (svn_err)
+    {
+      svn_handle_error2(svn_err, stdout, FALSE, "diff: ");
+      return 2;
+    }
+
+  svn_err = do_diff(ostream, from, to, &has_changes,
+                    diff_options, show_c_function, pool);
+  if (svn_err)
+    {
+      svn_handle_error2(svn_err, stdout, FALSE, "diff: ");
+      return 2;
+    }
 
-  return rc;
+  return has_changes ? 1 : 0;
 }

Modified: subversion/branches/py-tests-as-modules/tools/diff/diff3.c
URL: http://svn.apache.org/viewvc/subversion/branches/py-tests-as-modules/tools/diff/diff3.c?rev=1031230&r1=1031229&r2=1031230&view=diff
==============================================================================
--- subversion/branches/py-tests-as-modules/tools/diff/diff3.c (original)
+++ subversion/branches/py-tests-as-modules/tools/diff/diff3.c Thu Nov  4 20:48:21 2010
@@ -1,4 +1,4 @@
-/* diff3-test.c -- test driver for 3-way text merges
+/* diff3.c -- test driver for 3-way text merges
  *
  * ====================================================================
  *    Licensed to the Apache Software Foundation (ASF) under one
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
   svn_err = svn_stream_for_stdout(&ostream, pool);
   if (svn_err)
     {
-      svn_handle_error2(svn_err, stdout, FALSE, "diff3-test: ");
+      svn_handle_error2(svn_err, stdout, FALSE, "diff3: ");
       rc = 2;
     }
   else if (argc == 4)
@@ -81,7 +81,7 @@ int main(int argc, char *argv[])
         }
       else
         {
-          svn_handle_error2(svn_err, stdout, FALSE, "diff3-test: ");
+          svn_handle_error2(svn_err, stdout, FALSE, "diff3: ");
           rc = 2;
         }
     }

Modified: subversion/branches/py-tests-as-modules/tools/diff/diff4.c
URL: http://svn.apache.org/viewvc/subversion/branches/py-tests-as-modules/tools/diff/diff4.c?rev=1031230&r1=1031229&r2=1031230&view=diff
==============================================================================
--- subversion/branches/py-tests-as-modules/tools/diff/diff4.c (original)
+++ subversion/branches/py-tests-as-modules/tools/diff/diff4.c Thu Nov  4 20:48:21 2010
@@ -1,4 +1,4 @@
-/* diff4-test.c -- test driver for 3-way text merges
+/* diff4.c -- test driver for 4-way text merges
  *
  * ====================================================================
  *    Licensed to the Apache Software Foundation (ASF) under one
@@ -67,7 +67,7 @@ int main(int argc, char *argv[])
   svn_err = svn_stream_for_stdout(&ostream, pool);
   if (svn_err)
     {
-      svn_handle_error2(svn_err, stdout, FALSE, "diff4-test: ");
+      svn_handle_error2(svn_err, stdout, FALSE, "diff4: ");
       rc = 2;
     }
   else if (argc == 5)
@@ -77,7 +77,7 @@ int main(int argc, char *argv[])
                          pool);
       if (svn_err != NULL)
         {
-          svn_handle_error2(svn_err, stdout, FALSE, "diff4-test: ");
+          svn_handle_error2(svn_err, stdout, FALSE, "diff4: ");
           rc = 2;
         }
     }

Modified: subversion/branches/py-tests-as-modules/tools/hook-scripts/svnperms.conf.example
URL: http://svn.apache.org/viewvc/subversion/branches/py-tests-as-modules/tools/hook-scripts/svnperms.conf.example?rev=1031230&r1=1031229&r2=1031230&view=diff
==============================================================================
--- subversion/branches/py-tests-as-modules/tools/hook-scripts/svnperms.conf.example (original)
+++ subversion/branches/py-tests-as-modules/tools/hook-scripts/svnperms.conf.example Thu Nov  4 20:48:21 2010
@@ -9,6 +9,8 @@
 #
 [groups]
 group1 = user1 user2 user3
+group2 = user4 user5
+supergroup = @group1 @group2 user6
 
 #
 # Example repository control, showing allowed syntax.
@@ -20,13 +22,13 @@ group1 = user1 user2 user3
 # - line breaks are accepted
 #
 [example1 groups]
-group2 = user9 user10
+group3 = user9 user10
 
 [example1]
 trunk/.* = *(add,remove,update) @group1,user4,user5(update)
            user6,user7()
 trunk/.* = user8(add,update)
-tags/[^/]+/ = @group2(add)
+tags/[^/]+/ = @group3(add)
 branches/[^/]+/.* = *(add,remove,update)
 
 #

Modified: subversion/branches/py-tests-as-modules/tools/hook-scripts/svnperms.py
URL: http://svn.apache.org/viewvc/subversion/branches/py-tests-as-modules/tools/hook-scripts/svnperms.py?rev=1031230&r1=1031229&r2=1031230&view=diff
==============================================================================
--- subversion/branches/py-tests-as-modules/tools/hook-scripts/svnperms.py (original)
+++ subversion/branches/py-tests-as-modules/tools/hook-scripts/svnperms.py Thu Nov  4 20:48:21 2010
@@ -128,7 +128,17 @@ class Permission:
 
     def parse_groups(self, groupsiter):
         for option, value in groupsiter:
-            self._group[option] = value.split()
+            groupusers = []
+            for token in value.split():
+                # expand nested groups in place; no forward decls
+                if token[0] == "@":
+                    try:
+                        groupusers.extend(self._group[token[1:]])
+                    except KeyError:
+                        raise Error, "group '%s' not found" % token[1:]
+                else:
+                    groupusers.append(token)
+            self._group[option] = groupusers
 
     def parse_perms(self, permsiter):
         for option, value in permsiter:

Modified: subversion/branches/py-tests-as-modules/tools/server-side/svn-rep-sharing-stats.c
URL: http://svn.apache.org/viewvc/subversion/branches/py-tests-as-modules/tools/server-side/svn-rep-sharing-stats.c?rev=1031230&r1=1031229&r2=1031230&view=diff
==============================================================================
--- subversion/branches/py-tests-as-modules/tools/server-side/svn-rep-sharing-stats.c (original)
+++ subversion/branches/py-tests-as-modules/tools/server-side/svn-rep-sharing-stats.c Thu Nov  4 20:48:21 2010
@@ -329,12 +329,10 @@ pretty_print(const char *name,
   for (hi = apr_hash_first(scratch_pool, reps_ref_counts);
        hi; hi = apr_hash_next(hi))
     {
-      const struct key_t *key;
       struct value_t *value;
 
       SVN_ERR(cancel_func(NULL));
 
-      key = svn__apr_hash_index_key(hi);
       value = svn__apr_hash_index_val(hi);
       SVN_ERR(svn_cmdline_printf(scratch_pool, "%s %" APR_UINT64_T_FMT " %s\n",
                                  name, value->refcount,

Modified: subversion/branches/py-tests-as-modules/win-tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/py-tests-as-modules/win-tests.py?rev=1031230&r1=1031229&r2=1031230&view=diff
==============================================================================
--- subversion/branches/py-tests-as-modules/win-tests.py (original)
+++ subversion/branches/py-tests-as-modules/win-tests.py Thu Nov  4 20:48:21 2010
@@ -226,7 +226,6 @@ if run_httpd:
     base_url = 'http://localhost:' + str(httpd_port)
 
 if base_url:
-  all_tests = client_tests
   repo_loc = 'remote repository ' + base_url + '.'
   if base_url[:4] == 'http':
     log = 'dav-tests.log'