subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r1658955 [1/3] - in /subversion/branches/move-tracking-2: ./ subversion/ subversion/include/ subversion/libsvn_delta/ subversion/libsvn_fs_fs/ subversion/libsvn_fs_x/ subversion/libsvn_repos/ subversion/libsvn_subr/ subversion/libsvn_wc/ su...
Date Wed, 11 Feb 2015 13:33:08 GMT
Author: julianfoad
Date: Wed Feb 11 13:33:07 2015
New Revision: 1658955

URL: http://svn.apache.org/r1658955
Log:
On the 'move-tracking-2' branch: catch up with trunk@1658954.

Added:
    subversion/branches/move-tracking-2/subversion/tests/libsvn_wc/wc-test-queries.sql
      - copied, changed from r1658954, subversion/trunk/subversion/tests/libsvn_wc/wc-test-queries.sql
Modified:
    subversion/branches/move-tracking-2/   (props changed)
    subversion/branches/move-tracking-2/Makefile.in
    subversion/branches/move-tracking-2/build.conf   (contents, props changed)
    subversion/branches/move-tracking-2/subversion/   (props changed)
    subversion/branches/move-tracking-2/subversion/include/svn_x509.h
    subversion/branches/move-tracking-2/subversion/libsvn_delta/compat.c
    subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/lock.c
    subversion/branches/move-tracking-2/subversion/libsvn_fs_x/   (props changed)
    subversion/branches/move-tracking-2/subversion/libsvn_fs_x/lock.c
    subversion/branches/move-tracking-2/subversion/libsvn_repos/repos.c
    subversion/branches/move-tracking-2/subversion/libsvn_subr/x509.h
    subversion/branches/move-tracking-2/subversion/libsvn_subr/x509info.c
    subversion/branches/move-tracking-2/subversion/libsvn_subr/x509parse.c
    subversion/branches/move-tracking-2/subversion/libsvn_wc/conflicts.c
    subversion/branches/move-tracking-2/subversion/libsvn_wc/status.c
    subversion/branches/move-tracking-2/subversion/libsvn_wc/token-map.h
    subversion/branches/move-tracking-2/subversion/libsvn_wc/update_editor.c
    subversion/branches/move-tracking-2/subversion/libsvn_wc/wc-queries.sql
    subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db.c
    subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db.h
    subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db_private.h
    subversion/branches/move-tracking-2/subversion/libsvn_wc/wc_db_update_move.c
    subversion/branches/move-tracking-2/subversion/mod_dav_svn/deadprops.c
    subversion/branches/move-tracking-2/subversion/tests/cmdline/move_tests.py
    subversion/branches/move-tracking-2/subversion/tests/libsvn_fs/locks-test.c
    subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/x509-test.c
    subversion/branches/move-tracking-2/subversion/tests/libsvn_wc/   (props changed)
    subversion/branches/move-tracking-2/subversion/tests/libsvn_wc/db-test.c
    subversion/branches/move-tracking-2/subversion/tests/libsvn_wc/op-depth-test.c

Propchange: subversion/branches/move-tracking-2/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 11 13:33:07 2015
@@ -86,4 +86,4 @@
 /subversion/branches/verify-at-commit:1462039-1462408
 /subversion/branches/verify-keep-going:1439280-1546110
 /subversion/branches/wc-collate-path:1402685-1480384
-/subversion/trunk:1606692-1658451
+/subversion/trunk:1606692-1658954

Modified: subversion/branches/move-tracking-2/Makefile.in
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/Makefile.in?rev=1658955&r1=1658954&r2=1658955&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/Makefile.in (original)
+++ subversion/branches/move-tracking-2/Makefile.in Wed Feb 11 13:33:07 2015
@@ -837,7 +837,7 @@ $(SWIG_PL_DIR)/native/Makefile.PL: $(SWI
 	./config.status subversion/bindings/swig/perl/native/Makefile.PL
 
 $(SWIG_PL_DIR)/native/Makefile: $(SWIG_PL_DIR)/native/Makefile.PL
-	cd $(SWIG_PL_DIR)/native; $(PERL) Makefile.PL
+	cd $(SWIG_PL_DIR)/native; $(PERL) Makefile.PL PREFIX=$(prefix)
 
 # There is a "readlink -f" command on some systems for the same purpose,
 # but it's not as portable (e.g. Mac OS X doesn't have it).  These should

Modified: subversion/branches/move-tracking-2/build.conf
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/build.conf?rev=1658955&r1=1658954&r2=1658955&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/build.conf (original)
+++ subversion/branches/move-tracking-2/build.conf Wed Feb 11 13:33:07 2015
@@ -56,6 +56,7 @@ private-built-includes =
         subversion/libsvn_wc/wc-queries.h
         subversion/libsvn_wc/wc-checks.h
         subversion/libsvn_subr/internal_statements.h
+        subversion/tests/libsvn_wc/wc-test-queries.h
         subversion/bindings/swig/proxy/swig_python_external_runtime.swg
         subversion/bindings/swig/proxy/swig_perl_external_runtime.swg
         subversion/bindings/swig/proxy/swig_ruby_external_runtime.swg
@@ -469,6 +470,12 @@ type = sql-header
 path = subversion/libsvn_subr
 sources = internal_statements.sql
 
+[wc_test_queries]
+description = Queries using working copy tests
+type = sql-header
+path = subversion/tests/libsvn_wc
+sources = wc-test-queries.sql
+
 # ----------------------------------------------------------------------------
 #
 # TARGETS FOR I18N SUPPORT

Propchange: subversion/branches/move-tracking-2/build.conf
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 11 13:33:07 2015
@@ -82,4 +82,4 @@
 /subversion/branches/verify-at-commit/build.conf:1462039-1462408
 /subversion/branches/verify-keep-going/build.conf:1439280-1546110
 /subversion/branches/wc-collate-path/build.conf:1402685-1480384
-/subversion/trunk/build.conf:1606692-1658451
+/subversion/trunk/build.conf:1606692-1658954

Propchange: subversion/branches/move-tracking-2/subversion/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 11 13:33:07 2015
@@ -82,4 +82,4 @@
 /subversion/branches/verify-at-commit/subversion:1462039-1462408
 /subversion/branches/verify-keep-going/subversion:1439280-1546110
 /subversion/branches/wc-collate-path/subversion:1402685-1480384
-/subversion/trunk/subversion:1606692-1658451
+/subversion/trunk/subversion:1606692-1658954

Modified: subversion/branches/move-tracking-2/subversion/include/svn_x509.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/svn_x509.h?rev=1658955&r1=1658954&r2=1658955&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/include/svn_x509.h (original)
+++ subversion/branches/move-tracking-2/subversion/include/svn_x509.h Wed Feb 11 13:33:07 2015
@@ -38,13 +38,13 @@
 extern "C" {
 #endif
 
-#define SVN_X509_OID_COMMON_NAME  "2.5.4.3"
-#define SVN_X509_OID_COUNTRY      "2.5.4.6"
-#define SVN_X509_OID_LOCALITY     "2.5.4.7"
-#define SVN_X509_OID_STATE        "2.5.4.8"
-#define SVN_X509_OID_ORGANIZATION "2.5.4.10"
-#define SVN_X509_OID_ORG_UNIT     "2.5.4.11"
-#define SVN_X509_OID_EMAIL        "1.2.840.113549.1.9.1"
+#define SVN_X509_OID_COMMON_NAME  "\x55\x04\x03"
+#define SVN_X509_OID_COUNTRY      "\x55\x04\x06"
+#define SVN_X509_OID_LOCALITY     "\x55\x04\x07"
+#define SVN_X509_OID_STATE        "\x55\x04\x08"
+#define SVN_X509_OID_ORGANIZATION "\x55\x04\x0A"
+#define SVN_X509_OID_ORG_UNIT     "\x55\x04\x0B"
+#define SVN_X509_OID_EMAIL        "\x2A\x86\x48\x86\xF7\x0D\x01\x09\x01"
 
 /**
  * Representation of parsed certificate info.
@@ -54,6 +54,13 @@ extern "C" {
 typedef struct svn_x509_certinfo_t svn_x509_certinfo_t;
 
 /**
+ * Representation of an atttribute in an X.509 name (e.g. Subject or Issuer)
+ *
+ * @since New in 1.9.
+ */
+typedef struct svn_x509_name_attr_t svn_x509_name_attr_t;
+
+/**
  * Parse x509 @a der certificate data from @a buf with length @a
  * buflen and return certificate information in @a *certinfo,
  * allocated in @a result_pool.
@@ -77,6 +84,32 @@ svn_x509_parse_cert(svn_x509_certinfo_t
                     apr_pool_t *scratch_pool);
 
 /**
+ * Returns a deep copy of the @a attr, allocated in @a result_pool.
+ * May use @a scratch_pool for temporary allocations.
+ * @since New in 1.9.
+ */
+svn_x509_name_attr_t *
+svn_x509_name_attr_dup(const svn_x509_name_attr_t *attr,
+                       apr_pool_t *result_pool,
+                       apr_pool_t *scratch_pool);
+
+/**
+ * Returns the OID of @a attr as encoded in the certificate.  The
+ * length of the OID will be set in @a len.
+ * @since New in 1.9.
+ */
+const unsigned char *
+svn_x509_name_attr_get_oid(const svn_x509_name_attr_t *attr, apr_size_t *len);
+
+/**
+ * Returns the value of @a attr as a UTF-8 C string.
+ * @since New in 1.9.
+ */
+const char *
+svn_x509_name_attr_get_value(const svn_x509_name_attr_t *attr);
+
+
+/**
  * Returns a deep copy of @a certinfo, allocated in @a result_pool.
  * May use @a scratch_pool for temporary allocations.
  * @since New in 1.9.
@@ -95,25 +128,13 @@ svn_x509_certinfo_get_subject(const svn_
                               apr_pool_t *result_pool);
 
 /**
- * Returns a list of the the object IDs of the attributes available
- * for the subject in the @a certinfo.  The oids in the list are C
- * strings with dot separated integers.
+ * Returns a list of the attributes for the subject in the @a certinfo.
+ * Each member of the list is of type svn_x509_name_attr_t.
  *
  * @since New in 1.9.
  */
 const apr_array_header_t *
-svn_x509_certinfo_get_subject_oids(const svn_x509_certinfo_t *certinfo);
-
-/**
- * Returns the value of the attribute with the object ID specified in
- * @a oid of the subject from @a certinfo.  @a oid is a string of dot
- * separated integers.
- *
- * @since New in 1.9.
- */
-const char *
-svn_x509_certinfo_get_subject_attr(const svn_x509_certinfo_t *certinfo,
-                                   const char *oid);
+svn_x509_certinfo_get_subject_attrs(const svn_x509_certinfo_t *certinfo);
 
 /**
  * Returns the cerficiate issuer DN from @a certinfo.
@@ -124,25 +145,13 @@ svn_x509_certinfo_get_issuer(const svn_x
                              apr_pool_t *result_pool);
 
 /**
- * Returns a list of the the object IDs of the attributes available
- * for the issuer in the @a certinfo.  The oids in the list are C
- * strings with dot separated integers.
+ * Returns a list of the attributes for the issuer in the @a certinfo.
+ * Each member of the list is of type svn_x509_name_attr_t.
  *
  * @since New in 1.9.
  */
 const apr_array_header_t *
-svn_x509_certinfo_get_issuer_oids(const svn_x509_certinfo_t *certinfo);
-
-/**
- * Returns the value of the attribute with the object ID specified in
- * @a oid of the issuer from @a certinfo.  @a oid is a string of dot
- * separated integers.
- *
- * @since New in 1.9.
- */
-const char *
-svn_x509_certinfo_get_issuer_attr(const svn_x509_certinfo_t *certinfo,
-                                  const char *oid);
+svn_x509_certinfo_get_issuer_attrs(const svn_x509_certinfo_t *certinfo);
 
 /**
  * Returns the start of the certificate validity period from @a certinfo.
@@ -175,6 +184,17 @@ svn_x509_certinfo_get_digest(const svn_x
 const apr_array_header_t *
 svn_x509_certinfo_get_hostnames(const svn_x509_certinfo_t *certinfo);
 
+/**
+ * Given an @a oid return a null-terminated C string representation.
+ * For example an OID with the bytes "\x2A\x86\x48\x86\xF7\x0D\x01\x09\x01"
+ * would be converted to the string "1.2.840.113549.1.9.1".  Returns
+ * NULL if the @oid can't be represented as a string.
+ *
+ * @since New in 1.9. */
+const char *
+svn_x509_oid_to_string(const unsigned char *oid, apr_size_t oid_len,
+                       apr_pool_t *scratch_pool, apr_pool_t *result_pool);
+
 #ifdef __cplusplus
 }
 #endif

Modified: subversion/branches/move-tracking-2/subversion/libsvn_delta/compat.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_delta/compat.c?rev=1658955&r1=1658954&r2=1658955&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_delta/compat.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_delta/compat.c Wed Feb 11 13:33:07 2015
@@ -1233,12 +1233,12 @@ alter_file_cb(void *baton,
   if (contents)
     {
       /* We may need to re-checksum these contents */
-      if (!(checksum && checksum->kind == svn_checksum_md5))
+      if (checksum && checksum->kind == svn_checksum_md5)
+        md5_checksum = (svn_checksum_t *)checksum;
+      else
         contents = svn_stream_checksummed2(contents, &md5_checksum, NULL,
                                            svn_checksum_md5, TRUE,
                                            scratch_pool);
-      else
-        md5_checksum = (svn_checksum_t *)checksum;
 
       /* Spool the contents to a tempfile, and provide that to the driver. */
       SVN_ERR(svn_stream_open_unique(&tmp_stream, &tmp_filename, NULL,

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/lock.c?rev=1658955&r1=1658954&r2=1658955&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/lock.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/lock.c Wed Feb 11 13:33:07 2015
@@ -539,7 +539,6 @@ static svn_error_t *
 locks_walker(void *baton,
              const char *fs_path,
              const char *digest_path,
-             apr_hash_t *children,
              svn_lock_t *lock,
              svn_boolean_t have_write_lock,
              apr_pool_t *pool)
@@ -569,17 +568,16 @@ locks_walker(void *baton,
 
 /* Callback type for walk_digest_files().
  *
- * CHILDREN and LOCK come from a read_digest_file(digest_path) call.
+ * LOCK come from a read_digest_file(digest_path) call.
  */
 typedef svn_error_t *(*walk_digests_callback_t)(void *baton,
                                                 const char *fs_path,
                                                 const char *digest_path,
-                                                apr_hash_t *children,
                                                 svn_lock_t *lock,
                                                 svn_boolean_t have_write_lock,
                                                 apr_pool_t *pool);
 
-/* A recursive function that calls WALK_DIGESTS_FUNC/WALK_DIGESTS_BATON for
+/* A function that calls WALK_DIGESTS_FUNC/WALK_DIGESTS_BATON for
    all lock digest files in and under PATH in FS.
    HAVE_WRITE_LOCK should be true if the caller (directly or indirectly)
    has the FS write lock. */
@@ -599,11 +597,10 @@ walk_digest_files(const char *fs_path,
   /* First, send up any locks in the current digest file. */
   SVN_ERR(read_digest_file(&children, &lock, fs_path, digest_path, pool));
 
-  SVN_ERR(walk_digests_func(walk_digests_baton, fs_path, digest_path,
-                            children, lock,
+  SVN_ERR(walk_digests_func(walk_digests_baton, fs_path, digest_path, lock,
                             have_write_lock, pool));
 
-  /* Now, recurse on this thing's child entries (if any; bail otherwise). */
+  /* Now, report all the child entries (if any; bail otherwise). */
   if (! apr_hash_count(children))
     return SVN_NO_ERROR;
   subpool = svn_pool_create(pool);
@@ -611,15 +608,19 @@ walk_digest_files(const char *fs_path,
     {
       const char *digest = apr_hash_this_key(hi);
       svn_pool_clear(subpool);
-      SVN_ERR(walk_digest_files
-              (fs_path, digest_path_from_digest(fs_path, digest, subpool),
-               walk_digests_func, walk_digests_baton, have_write_lock, subpool));
+
+      SVN_ERR(read_digest_file
+              (NULL, &lock, fs_path,
+               digest_path_from_digest(fs_path, digest, subpool), subpool));
+
+      SVN_ERR(walk_digests_func(walk_digests_baton, fs_path, digest_path, lock,
+                                have_write_lock, subpool));
     }
   svn_pool_destroy(subpool);
   return SVN_NO_ERROR;
 }
 
-/* A recursive function that calls GET_LOCKS_FUNC/GET_LOCKS_BATON for
+/* A function that calls GET_LOCKS_FUNC/GET_LOCKS_BATON for
    all locks in and under PATH in FS.
    HAVE_WRITE_LOCK should be true if the caller (directly or indirectly)
    has the FS write lock. */

Propchange: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Feb 11 13:33:07 2015
@@ -88,5 +88,5 @@
 /subversion/branches/verify-at-commit/subversion/libsvn_fs_x:1462039-1462408
 /subversion/branches/verify-keep-going/subversion/libsvn_fs_x:1439280-1492639,1546002-1546110
 /subversion/branches/wc-collate-path/subversion/libsvn_fs_x:1402685-1480384
-/subversion/trunk/subversion/libsvn_fs_fs:1415133-1596500,1596567,1597414,1597989,1598273,1599140,1600872,1601633,1603485-1603487,1603499,1603605,1604128,1604188,1604413-1604414,1604416-1604417,1604421,1604442,1604700,1604717,1604720,1604726,1604755,1604794,1604802,1604824,1604836,1604844,1604902-1604903,1604911,1604925,1604933,1604947,1605059-1605060,1605064-1605065,1605068,1605071-1605073,1605075,1605123,1605188-1605189,1605191,1605197,1605444,1605633,1606132,1606142,1606144,1606514,1606526,1606528,1606551,1606554,1606564,1606598-1606599,1606656,1606658,1606662,1606744,1606840,1607085,1607572,1612407,1612810,1613339,1613872,1614611,1615348,1615351-1615352,1615356,1616338-1616339,1616613,1617586,1617688,1618138,1618151,1618153,1618226,1618641,1618653,1618662,1619068,1619358,1619413,1619769,1619774,1620602,1620909,1620912,1620928,1620930,1621275,1621635,1622931,1622937,1622942,1622946,1622959-1622960,1622963,1622987,1623007,1623368,1623373,1623377,1623379,1623381,1623398,1623402,162
 4011,1624265,1624512,1626246,1626871,1626873,1626886,1627497-1627498,1627502,1627947-1627949,1627966,1628083,1628093,1628158-1628159,1628161,1628392-1628393,1628415,1628427,1628676,1628738,1628762,1628764,1629854-1629855,1629857,1629865,1629873,1629875,1629879,1630067,1630070,1631049-1631051,1631075,1631115,1631171,1631180,1631185-1631186,1631196-1631197,1631239-1631240,1631548,1631550,1631563,1631567,1631588,1631598,1632646,1632776,1632849,1632851-1632853,1632856-1632857,1632868,1632908,1632926,1633232,1633617-1633618,1634872,1634875,1634879-1634880,1634920,1636478,1636483,1636629,1636644,1637184,1637186,1637330,1637358,1637363,1637393,1639319,1639322,1639335,1639348,1639352,1639355,1639358,1639414,1639419,1639426,1639430,1639436,1639440,1639549,1640061-1640062,1640197,1640915,1640966,1641013,1643139,1643233,1645567,1646021,1646712,1646716,1647537,1647540-1647541,1647820,1647905,1648230,1648238,1648241-1648243,1648253,1648272,1648532,1648537-1648539,1648542,1648591,1648612,1653608
-/subversion/trunk/subversion/libsvn_fs_x:1414756-1509914,1606692-1658451
+/subversion/trunk/subversion/libsvn_fs_fs:1415133-1596500,1596567,1597414,1597989,1598273,1599140,1600872,1601633,1603485-1603487,1603499,1603605,1604128,1604188,1604413-1604414,1604416-1604417,1604421,1604442,1604700,1604717,1604720,1604726,1604755,1604794,1604802,1604824,1604836,1604844,1604902-1604903,1604911,1604925,1604933,1604947,1605059-1605060,1605064-1605065,1605068,1605071-1605073,1605075,1605123,1605188-1605189,1605191,1605197,1605444,1605633,1606132,1606142,1606144,1606514,1606526,1606528,1606551,1606554,1606564,1606598-1606599,1606656,1606658,1606662,1606744,1606840,1607085,1607572,1612407,1612810,1613339,1613872,1614611,1615348,1615351-1615352,1615356,1616338-1616339,1616613,1617586,1617688,1618138,1618151,1618153,1618226,1618641,1618653,1618662,1619068,1619358,1619413,1619769,1619774,1620602,1620909,1620912,1620928,1620930,1621275,1621635,1622931,1622937,1622942,1622946,1622959-1622960,1622963,1622987,1623007,1623368,1623373,1623377,1623379,1623381,1623398,1623402,162
 4011,1624265,1624512,1626246,1626871,1626873,1626886,1627497-1627498,1627502,1627947-1627949,1627966,1628083,1628093,1628158-1628159,1628161,1628392-1628393,1628415,1628427,1628676,1628738,1628762,1628764,1629854-1629855,1629857,1629865,1629873,1629875,1629879,1630067,1630070,1631049-1631051,1631075,1631115,1631171,1631180,1631185-1631186,1631196-1631197,1631239-1631240,1631548,1631550,1631563,1631567,1631588,1631598,1632646,1632776,1632849,1632851-1632853,1632856-1632857,1632868,1632908,1632926,1633232,1633617-1633618,1634872,1634875,1634879-1634880,1634920,1636478,1636483,1636629,1636644,1637184,1637186,1637330,1637358,1637363,1637393,1639319,1639322,1639335,1639348,1639352,1639355,1639358,1639414,1639419,1639426,1639430,1639436,1639440,1639549,1640061-1640062,1640197,1640915,1640966,1641013,1643139,1643233,1645567,1646021,1646712,1646716,1647537,1647540-1647541,1647820,1647905,1648230,1648238,1648241-1648243,1648253,1648272,1648532,1648537-1648539,1648542,1648591,1648612,1653608,
 1658482
+/subversion/trunk/subversion/libsvn_fs_x:1414756-1509914,1606692-1658954

Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/lock.c?rev=1658955&r1=1658954&r2=1658955&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/lock.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/lock.c Wed Feb 11 13:33:07 2015
@@ -559,7 +559,6 @@ static svn_error_t *
 locks_walker(void *baton,
              const char *fs_path,
              const char *digest_path,
-             apr_hash_t *children,
              svn_lock_t *lock,
              svn_boolean_t have_write_lock,
              apr_pool_t *pool)
@@ -589,17 +588,16 @@ locks_walker(void *baton,
 
 /* Callback type for walk_digest_files().
  *
- * CHILDREN and LOCK come from a read_digest_file(digest_path) call.
+ * LOCK come from a read_digest_file(digest_path) call.
  */
 typedef svn_error_t *(*walk_digests_callback_t)(void *baton,
                                                 const char *fs_path,
                                                 const char *digest_path,
-                                                apr_hash_t *children,
                                                 svn_lock_t *lock,
                                                 svn_boolean_t have_write_lock,
                                                 apr_pool_t *pool);
 
-/* A recursive function that calls WALK_DIGESTS_FUNC/WALK_DIGESTS_BATON for
+/* A function that calls WALK_DIGESTS_FUNC/WALK_DIGESTS_BATON for
    all lock digest files in and under PATH in FS.
    HAVE_WRITE_LOCK should be true if the caller (directly or indirectly)
    has the FS write lock. */
@@ -619,11 +617,10 @@ walk_digest_files(const char *fs_path,
   /* First, send up any locks in the current digest file. */
   SVN_ERR(read_digest_file(&children, &lock, fs_path, digest_path, pool));
 
-  SVN_ERR(walk_digests_func(walk_digests_baton, fs_path, digest_path,
-                            children, lock,
+  SVN_ERR(walk_digests_func(walk_digests_baton, fs_path, digest_path, lock,
                             have_write_lock, pool));
 
-  /* Now, recurse on this thing's child entries (if any; bail otherwise). */
+  /* Now, report all the child entries (if any; bail otherwise). */
   if (! apr_hash_count(children))
     return SVN_NO_ERROR;
   subpool = svn_pool_create(pool);
@@ -631,15 +628,19 @@ walk_digest_files(const char *fs_path,
     {
       const char *digest = apr_hash_this_key(hi);
       svn_pool_clear(subpool);
-      SVN_ERR(walk_digest_files
-              (fs_path, digest_path_from_digest(fs_path, digest, subpool),
-               walk_digests_func, walk_digests_baton, have_write_lock, subpool));
+
+      SVN_ERR(read_digest_file
+              (NULL, &lock, fs_path,
+               digest_path_from_digest(fs_path, digest, subpool), subpool));
+
+      SVN_ERR(walk_digests_func(walk_digests_baton, fs_path, digest_path, lock,
+                                have_write_lock, subpool));
     }
   svn_pool_destroy(subpool);
   return SVN_NO_ERROR;
 }
 
-/* A recursive function that calls GET_LOCKS_FUNC/GET_LOCKS_BATON for
+/* A function that calls GET_LOCKS_FUNC/GET_LOCKS_BATON for
    all locks in and under PATH in FS.
    HAVE_WRITE_LOCK should be true if the caller (directly or indirectly)
    has the FS write lock. */

Modified: subversion/branches/move-tracking-2/subversion/libsvn_repos/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_repos/repos.c?rev=1658955&r1=1658954&r2=1658955&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_repos/repos.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_repos/repos.c Wed Feb 11 13:33:07 2015
@@ -291,10 +291,76 @@ create_locks(svn_repos_t *repos, apr_poo
   "# For similar reasons, you should also add a trailing @ to URLs which"  NL \
   "# are passed to SVN commands accepting URLs with peg revisions."        NL
 
+/* Return template text for a hook script named SCRIPT_NAME. Include
+ * DESCRIPTION and SCRIPT in the template text.
+ */
+static const char *
+hook_template_text(const char *script_name,
+                   const char *description,
+                   const char *script,
+                   apr_pool_t *result_pool)
+{
+  return apr_pstrcat(result_pool,
+"#!/bin/sh"                                                                  NL
+""                                                                           NL,
+                     description,
+"#"                                                                          NL
+"# The default working directory for the invocation is undefined, so"        NL
+"# the program should set one explicitly if it cares."                       NL
+"#"                                                                          NL
+"# On a Unix system, the normal procedure is to have '", script_name, "'"    NL
+"# invoke other programs to do the real work, though it may do the"          NL
+"# work itself too."                                                         NL
+"#"                                                                          NL
+"# Note that '", script_name, "' must be executable by the user(s) who will" NL
+"# invoke it (typically the user httpd runs as), and that user must"         NL
+"# have filesystem-level permission to access the repository."               NL
+"#"                                                                          NL
+"# On a Windows system, you should name the hook program"                    NL
+"# '", script_name, ".bat' or '", script_name, ".exe',"                                                    NL
+"# but the basic idea is the same."                                          NL
+"#"                                                                          NL
+HOOKS_ENVIRONMENT_TEXT
+"#"                                                                          NL
+HOOKS_QUOTE_ARGUMENTS_TEXT
+"#"                                                                          NL
+"# Here is an example hook script, for a Unix /bin/sh interpreter."          NL
+PREWRITTEN_HOOKS_TEXT
+""                                                                           NL
+""                                                                           NL,
+                     script,
+                     SVN_VA_NULL);
+}
+
+/* Write a template file for a hook script named SCRIPT_NAME (appending
+ * '.tmpl' to that name) in REPOS. Include DESCRIPTION and SCRIPT in the
+ * template text.
+ */
+static svn_error_t *
+write_hook_template_file(svn_repos_t *repos, const char *script_name,
+                         const char *description,
+                         const char *script,
+                         apr_pool_t *pool)
+{
+  const char *template_path
+    = svn_dirent_join(repos->hook_path,
+                      apr_psprintf(pool, "%s%s",
+                                   script_name, SVN_REPOS__HOOK_DESC_EXT),
+                      pool);
+  const char *contents
+    = hook_template_text(script_name, description, script, pool);
+
+  SVN_ERR(svn_io_file_create(template_path, contents, pool));
+  SVN_ERR(svn_io_set_file_executable(template_path, TRUE, FALSE, pool));
+  return SVN_NO_ERROR;
+}
+
+/* Write the hook template files in REPOS.
+ */
 static svn_error_t *
 create_hooks(svn_repos_t *repos, apr_pool_t *pool)
 {
-  const char *this_path, *contents;
+  const char *description, *script;
 
   /* Create the hook directory. */
   SVN_ERR_W(create_repos_dir(repos->hook_path, pool),
@@ -303,16 +369,9 @@ create_hooks(svn_repos_t *repos, apr_poo
   /*** Write a default template for each standard hook file. */
 
   /* Start-commit hook. */
-  {
-    this_path = apr_psprintf(pool, "%s%s",
-                             svn_repos_start_commit_hook(repos, pool),
-                             SVN_REPOS__HOOK_DESC_EXT);
-
 #define SCRIPT_NAME SVN_REPOS__HOOK_START_COMMIT
 
-    contents =
-"#!/bin/sh"                                                                  NL
-""                                                                           NL
+  description =
 "# START-COMMIT HOOK"                                                        NL
 "#"                                                                          NL
 "# The start-commit hook is invoked immediately after a Subversion txn is"   NL
@@ -343,33 +402,10 @@ create_hooks(svn_repos_t *repos, apr_poo
 "# make security assumptions based on the capabilities list, nor should"     NL
 "# you assume that clients reliably report every capability they have."      NL
 "#"                                                                          NL
-"# The working directory for this hook program's invocation is undefined,"   NL
-"# so the program should set one explicitly if it cares."                    NL
-"#"                                                                          NL
 "# If the hook program exits with success, the commit continues; but"        NL
 "# if it exits with failure (non-zero), the commit is stopped before"        NL
-"# a Subversion txn is created, and STDERR is returned to the client."       NL
-"#"                                                                          NL
-"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'"        NL
-"# invoke other programs to do the real work, though it may do the"          NL
-"# work itself too."                                                         NL
-"#"                                                                          NL
-"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will"     NL
-"# invoke it (typically the user httpd runs as), and that user must"         NL
-"# have filesystem-level permission to access the repository."               NL
-"#"                                                                          NL
-"# On a Windows system, you should name the hook program"                    NL
-"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe',"                              NL
-"# but the basic idea is the same."                                          NL
-"# "                                                                         NL
-HOOKS_ENVIRONMENT_TEXT
-"# "                                                                         NL
-HOOKS_QUOTE_ARGUMENTS_TEXT
-"# "                                                                         NL
-"# Here is an example hook script, for a Unix /bin/sh interpreter."          NL
-PREWRITTEN_HOOKS_TEXT
-""                                                                           NL
-""                                                                           NL
+"# a Subversion txn is created, and STDERR is returned to the client."       NL;
+  script =
 "REPOS=\"$1\""                                                               NL
 "USER=\"$2\""                                                                NL
 ""                                                                           NL
@@ -379,25 +415,17 @@ PREWRITTEN_HOOKS_TEXT
 "# All checks passed, so allow the commit."                                  NL
 "exit 0"                                                                     NL;
 
-#undef SCRIPT_NAME
+  SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
+                                     description, script, pool),
+            _("Creating start-commit hook"));
 
-    SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
-              _("Creating start-commit hook"));
+#undef SCRIPT_NAME
 
-    SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
-  }  /* end start-commit hook */
 
   /* Pre-commit hook. */
-  {
-    this_path = apr_psprintf(pool, "%s%s",
-                             svn_repos_pre_commit_hook(repos, pool),
-                             SVN_REPOS__HOOK_DESC_EXT);
-
 #define SCRIPT_NAME SVN_REPOS__HOOK_PRE_COMMIT
 
-    contents =
-"#!/bin/sh"                                                                  NL
-""                                                                           NL
+  description =
 "# PRE-COMMIT HOOK"                                                          NL
 "#"                                                                          NL
 "# The pre-commit hook is invoked before a Subversion txn is"                NL
@@ -419,18 +447,11 @@ PREWRITTEN_HOOKS_TEXT
 "#   by the separator character '|', followed by the lock token string,"     NL
 "#   followed by a newline."                                                 NL
 "#"                                                                          NL
-"# The default working directory for the invocation is undefined, so"        NL
-"# the program should set one explicitly if it cares."                       NL
-"#"                                                                          NL
 "# If the hook program exits with success, the txn is committed; but"        NL
 "# if it exits with failure (non-zero), the txn is aborted, no commit"       NL
 "# takes place, and STDERR is returned to the client.   The hook"            NL
 "# program can use the 'svnlook' utility to help it examine the txn."        NL
 "#"                                                                          NL
-"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'"        NL
-"# invoke other programs to do the real work, though it may do the"          NL
-"# work itself too."                                                         NL
-"#"                                                                          NL
 "#   ***  NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT  ***"       NL
 "#   ***  FOR REVISION PROPERTIES (like svn:log or svn:author).   ***"       NL
 "#"                                                                          NL
@@ -439,24 +460,8 @@ PREWRITTEN_HOOKS_TEXT
 "#   hooks should not modify the versioned data in txns, or else come"       NL
 "#   up with a mechanism to make it safe to do so (by informing the"         NL
 "#   committing client of the changes).  However, right now neither"         NL
-"#   mechanism is implemented, so hook writers just have to be careful."     NL
-"#"                                                                          NL
-"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will"     NL
-"# invoke it (typically the user httpd runs as), and that user must"         NL
-"# have filesystem-level permission to access the repository."               NL
-"#"                                                                          NL
-"# On a Windows system, you should name the hook program"                    NL
-"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe',"                              NL
-"# but the basic idea is the same."                                          NL
-"#"                                                                          NL
-HOOKS_ENVIRONMENT_TEXT
-"# "                                                                         NL
-HOOKS_QUOTE_ARGUMENTS_TEXT
-"# "                                                                         NL
-"# Here is an example hook script, for a Unix /bin/sh interpreter."          NL
-PREWRITTEN_HOOKS_TEXT
-""                                                                           NL
-""                                                                           NL
+"#   mechanism is implemented, so hook writers just have to be careful."     NL;
+  script =
 "REPOS=\"$1\""                                                               NL
 "TXN=\"$2\""                                                                 NL
 ""                                                                           NL
@@ -473,26 +478,17 @@ PREWRITTEN_HOOKS_TEXT
 "# All checks passed, so allow the commit."                                  NL
 "exit 0"                                                                     NL;
 
-#undef SCRIPT_NAME
-
-    SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
-              _("Creating pre-commit hook"));
+  SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
+                                     description, script, pool),
+            _("Creating pre-commit hook"));
 
-    SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
-  }  /* end pre-commit hook */
+#undef SCRIPT_NAME
 
 
   /* Pre-revprop-change hook. */
-  {
-    this_path = apr_psprintf(pool, "%s%s",
-                             svn_repos_pre_revprop_change_hook(repos, pool),
-                             SVN_REPOS__HOOK_DESC_EXT);
-
 #define SCRIPT_NAME SVN_REPOS__HOOK_PRE_REVPROP_CHANGE
 
-    contents =
-"#!/bin/sh"                                                                  NL
-""                                                                           NL
+  description =
 "# PRE-REVPROP-CHANGE HOOK"                                                  NL
 "#"                                                                          NL
 "# The pre-revprop-change hook is invoked before a revision property"        NL
@@ -520,28 +516,8 @@ PREWRITTEN_HOOKS_TEXT
 "# will behave as if the hook were present, but failed.  The reason"         NL
 "# for this is that revision properties are UNVERSIONED, meaning that"       NL
 "# a successful propchange is destructive;  the old value is gone"           NL
-"# forever.  We recommend the hook back up the old value somewhere."         NL
-"#"                                                                          NL
-"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'"        NL
-"# invoke other programs to do the real work, though it may do the"          NL
-"# work itself too."                                                         NL
-"#"                                                                          NL
-"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will"     NL
-"# invoke it (typically the user httpd runs as), and that user must"         NL
-"# have filesystem-level permission to access the repository."               NL
-"#"                                                                          NL
-"# On a Windows system, you should name the hook program"                    NL
-"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe',"                              NL
-"# but the basic idea is the same."                                          NL
-"#"                                                                          NL
-HOOKS_ENVIRONMENT_TEXT
-"# "                                                                         NL
-HOOKS_QUOTE_ARGUMENTS_TEXT
-"# "                                                                         NL
-"# Here is an example hook script, for a Unix /bin/sh interpreter."          NL
-PREWRITTEN_HOOKS_TEXT
-""                                                                           NL
-""                                                                           NL
+"# forever.  We recommend the hook back up the old value somewhere."         NL;
+  script =
 "REPOS=\"$1\""                                                               NL
 "REV=\"$2\""                                                                 NL
 "USER=\"$3\""                                                                NL
@@ -553,26 +529,17 @@ PREWRITTEN_HOOKS_TEXT
 "echo \"Changing revision properties other than svn:log is prohibited\" >&2" NL
 "exit 1"                                                                     NL;
 
-#undef SCRIPT_NAME
-
-    SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
-              _("Creating pre-revprop-change hook"));
+  SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
+                                     description, script, pool),
+            _("Creating pre-revprop-change hook"));
 
-    SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
-  }  /* end pre-revprop-change hook */
+#undef SCRIPT_NAME
 
 
   /* Pre-lock hook. */
-  {
-    this_path = apr_psprintf(pool, "%s%s",
-                             svn_repos_pre_lock_hook(repos, pool),
-                             SVN_REPOS__HOOK_DESC_EXT);
-
 #define SCRIPT_NAME SVN_REPOS__HOOK_PRE_LOCK
 
-    contents =
-"#!/bin/sh"                                                                  NL
-""                                                                           NL
+  description =
 "# PRE-LOCK HOOK"                                                            NL
 "#"                                                                          NL
 "# The pre-lock hook is invoked before an exclusive lock is"                 NL
@@ -591,29 +558,10 @@ PREWRITTEN_HOOKS_TEXT
 "# this feature, you must guarantee the tokens generated are unique across"  NL
 "# the repository each time."                                                NL
 "#"                                                                          NL
-"# The default working directory for the invocation is undefined, so"        NL
-"# the program should set one explicitly if it cares."                       NL
-"#"                                                                          NL
 "# If the hook program exits with success, the lock is created; but"         NL
 "# if it exits with failure (non-zero), the lock action is aborted"          NL
-"# and STDERR is returned to the client."                                    NL
-""                                                                           NL
-"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'"        NL
-"# invoke other programs to do the real work, though it may do the"          NL
-"# work itself too."                                                         NL
-"#"                                                                          NL
-"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will"     NL
-"# invoke it (typically the user httpd runs as), and that user must"         NL
-"# have filesystem-level permission to access the repository."               NL
-"#"                                                                          NL
-"# On a Windows system, you should name the hook program"                    NL
-"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe',"                              NL
-"# but the basic idea is the same."                                          NL
-"#"                                                                          NL
-HOOKS_QUOTE_ARGUMENTS_TEXT
-"# "                                                                         NL
-"# Here is an example hook script, for a Unix /bin/sh interpreter:"          NL
-""                                                                           NL
+"# and STDERR is returned to the client."                                    NL;
+  script =
 "REPOS=\"$1\""                                                               NL
 "PATH=\"$2\""                                                                NL
 "USER=\"$3\""                                                                NL
@@ -647,26 +595,17 @@ HOOKS_QUOTE_ARGUMENTS_TEXT
 "echo \"Error: $PATH already locked by ${LOCK_OWNER}.\" 1>&2"                NL
 "exit 1"                                                                     NL;
 
-#undef SCRIPT_NAME
-
-    SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
-              "Creating pre-lock hook");
+  SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
+                                     description, script, pool),
+            _("Creating pre-lock hook"));
 
-    SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
-  }  /* end pre-lock hook */
+#undef SCRIPT_NAME
 
 
   /* Pre-unlock hook. */
-  {
-    this_path = apr_psprintf(pool, "%s%s",
-                             svn_repos_pre_unlock_hook(repos, pool),
-                             SVN_REPOS__HOOK_DESC_EXT);
-
 #define SCRIPT_NAME SVN_REPOS__HOOK_PRE_UNLOCK
 
-    contents =
-"#!/bin/sh"                                                                  NL
-""                                                                           NL
+  description =
 "# PRE-UNLOCK HOOK"                                                          NL
 "#"                                                                          NL
 "# The pre-unlock hook is invoked before an exclusive lock is"               NL
@@ -680,29 +619,10 @@ HOOKS_QUOTE_ARGUMENTS_TEXT
 "#   [4] TOKEN        (the lock token to be destroyed)"                      NL
 "#   [5] BREAK-UNLOCK (1 if the user is breaking the lock, else 0)"          NL
 "#"                                                                          NL
-"# The default working directory for the invocation is undefined, so"        NL
-"# the program should set one explicitly if it cares."                       NL
-"#"                                                                          NL
 "# If the hook program exits with success, the lock is destroyed; but"       NL
 "# if it exits with failure (non-zero), the unlock action is aborted"        NL
-"# and STDERR is returned to the client."                                    NL
-""                                                                           NL
-"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'"        NL
-"# invoke other programs to do the real work, though it may do the"          NL
-"# work itself too."                                                         NL
-"#"                                                                          NL
-"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will"     NL
-"# invoke it (typically the user httpd runs as), and that user must"         NL
-"# have filesystem-level permission to access the repository."               NL
-"#"                                                                          NL
-"# On a Windows system, you should name the hook program"                    NL
-"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe',"                              NL
-"# but the basic idea is the same."                                          NL
-"#"                                                                          NL
-HOOKS_QUOTE_ARGUMENTS_TEXT
-"# "                                                                         NL
-"# Here is an example hook script, for a Unix /bin/sh interpreter:"          NL
-""                                                                           NL
+"# and STDERR is returned to the client."                                    NL;
+  script =
 "REPOS=\"$1\""                                                               NL
 "PATH=\"$2\""                                                                NL
 "USER=\"$3\""                                                                NL
@@ -733,27 +653,17 @@ HOOKS_QUOTE_ARGUMENTS_TEXT
 "echo \"Error: $PATH locked by ${LOCK_OWNER}.\" 1>&2"                        NL
 "exit 1"                                                                     NL;
 
-#undef SCRIPT_NAME
-
-    SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
-              "Creating pre-unlock hook");
-
-    SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
-  }  /* end pre-unlock hook */
+  SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
+                                     description, script, pool),
+            _("Creating pre-unlock hook"));
 
+#undef SCRIPT_NAME
 
 
   /* Post-commit hook. */
-  {
-    this_path = apr_psprintf(pool, "%s%s",
-                             svn_repos_post_commit_hook(repos, pool),
-                             SVN_REPOS__HOOK_DESC_EXT);
-
 #define SCRIPT_NAME SVN_REPOS__HOOK_POST_COMMIT
 
-    contents =
-"#!/bin/sh"                                                                  NL
-""                                                                           NL
+  description =
 "# POST-COMMIT HOOK"                                                         NL
 "#"                                                                          NL
 "# The post-commit hook is invoked after a commit.  Subversion runs"         NL
@@ -765,60 +675,28 @@ HOOKS_QUOTE_ARGUMENTS_TEXT
 "#   [2] REV          (the number of the revision just committed)"           NL
 "#   [3] TXN-NAME     (the name of the transaction that has become REV)"     NL
 "#"                                                                          NL
-"# The default working directory for the invocation is undefined, so"        NL
-"# the program should set one explicitly if it cares."                       NL
-"#"                                                                          NL
 "# Because the commit has already completed and cannot be undone,"           NL
 "# the exit code of the hook program is ignored.  The hook program"          NL
 "# can use the 'svnlook' utility to help it examine the"                     NL
-"# newly-committed tree."                                                    NL
-"#"                                                                          NL
-"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'"        NL
-"# invoke other programs to do the real work, though it may do the"          NL
-"# work itself too."                                                         NL
-"#"                                                                          NL
-"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will"     NL
-"# invoke it (typically the user httpd runs as), and that user must"         NL
-"# have filesystem-level permission to access the repository."               NL
-"#"                                                                          NL
-"# On a Windows system, you should name the hook program"                    NL
-"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe',"                              NL
-"# but the basic idea is the same."                                          NL
-"# "                                                                         NL
-HOOKS_ENVIRONMENT_TEXT
-"# "                                                                         NL
-HOOKS_QUOTE_ARGUMENTS_TEXT
-"# "                                                                         NL
-"# Here is an example hook script, for a Unix /bin/sh interpreter."          NL
-PREWRITTEN_HOOKS_TEXT
-""                                                                           NL
-""                                                                           NL
+"# newly-committed tree."                                                    NL;
+  script =
 "REPOS=\"$1\""                                                               NL
 "REV=\"$2\""                                                                 NL
 "TXN_NAME=\"$3\""                                                            NL
                                                                              NL
 "mailer.py commit \"$REPOS\" \"$REV\" /path/to/mailer.conf"                  NL;
 
-#undef SCRIPT_NAME
-
-    SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
-              _("Creating post-commit hook"));
+  SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
+                                     description, script, pool),
+            _("Creating post-commit hook"));
 
-    SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
-  } /* end post-commit hook */
+#undef SCRIPT_NAME
 
 
   /* Post-lock hook. */
-  {
-    this_path = apr_psprintf(pool, "%s%s",
-                             svn_repos_post_lock_hook(repos, pool),
-                             SVN_REPOS__HOOK_DESC_EXT);
-
 #define SCRIPT_NAME SVN_REPOS__HOOK_POST_LOCK
 
-    contents =
-"#!/bin/sh"                                                                  NL
-""                                                                           NL
+  description =
 "# POST-LOCK HOOK"                                                           NL
 "#"                                                                          NL
 "# The post-lock hook is run after a path is locked.  Subversion runs"       NL
@@ -831,57 +709,29 @@ PREWRITTEN_HOOKS_TEXT
 "#"                                                                          NL
 "# The paths that were just locked are passed to the hook via STDIN."        NL
 "#"                                                                          NL
-"# The default working directory for the invocation is undefined, so"        NL
-"# the program should set one explicitly if it cares."                       NL
-"#"                                                                          NL
 "# Because the locks have already been created and cannot be undone,"        NL
 "# the exit code of the hook program is ignored.  The hook program"          NL
 "# can use the 'svnlook' utility to examine the paths in the repository"     NL
 "# but since the hook is invoked asyncronously the newly-created locks"      NL
-"# may no longer be present."                                                NL
-"#"                                                                          NL
-"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'"        NL
-"# invoke other programs to do the real work, though it may do the"          NL
-"# work itself too."                                                         NL
-"#"                                                                          NL
-"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will"     NL
-"# invoke it (typically the user httpd runs as), and that user must"         NL
-"# have filesystem-level permission to access the repository."               NL
-"#"                                                                          NL
-"# On a Windows system, you should name the hook program"                    NL
-"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe',"                              NL
-"# but the basic idea is the same."                                          NL
-"# "                                                                         NL
-HOOKS_QUOTE_ARGUMENTS_TEXT
-"# "                                                                         NL
-"# Here is an example hook script, for a Unix /bin/sh interpreter:"          NL
-""                                                                           NL
+"# may no longer be present."                                                NL;
+  script =
 "REPOS=\"$1\""                                                               NL
 "USER=\"$2\""                                                                NL
 ""                                                                           NL
 "# Send email to interested parties, let them know a lock was created:"      NL
 "mailer.py lock \"$REPOS\" \"$USER\" /path/to/mailer.conf"                   NL;
 
-#undef SCRIPT_NAME
-
-    SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
-              "Creating post-lock hook");
+  SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
+                                     description, script, pool),
+            _("Creating post-lock hook"));
 
-    SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
-  } /* end post-lock hook */
+#undef SCRIPT_NAME
 
 
   /* Post-unlock hook. */
-  {
-    this_path = apr_psprintf(pool, "%s%s",
-                             svn_repos_post_unlock_hook(repos, pool),
-                             SVN_REPOS__HOOK_DESC_EXT);
-
 #define SCRIPT_NAME SVN_REPOS__HOOK_POST_UNLOCK
 
-    contents =
-"#!/bin/sh"                                                                  NL
-""                                                                           NL
+  description =
 "# POST-UNLOCK HOOK"                                                         NL
 "#"                                                                          NL
 "# The post-unlock hook runs after a path is unlocked.  Subversion runs"     NL
@@ -894,54 +744,26 @@ HOOKS_QUOTE_ARGUMENTS_TEXT
 "#"                                                                          NL
 "# The paths that were just unlocked are passed to the hook via STDIN."      NL
 "#"                                                                          NL
-"# The default working directory for the invocation is undefined, so"        NL
-"# the program should set one explicitly if it cares."                       NL
-"#"                                                                          NL
 "# Because the lock has already been destroyed and cannot be undone,"        NL
-"# the exit code of the hook program is ignored."                            NL
-"#"                                                                          NL
-"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'"        NL
-"# invoke other programs to do the real work, though it may do the"          NL
-"# work itself too."                                                         NL
-"#"                                                                          NL
-"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will"     NL
-"# invoke it (typically the user httpd runs as), and that user must"         NL
-"# have filesystem-level permission to access the repository."               NL
-"#"                                                                          NL
-"# On a Windows system, you should name the hook program"                    NL
-"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe',"                              NL
-"# but the basic idea is the same."                                          NL
-"# "                                                                         NL
-HOOKS_QUOTE_ARGUMENTS_TEXT
-"# "                                                                         NL
-"# Here is an example hook script, for a Unix /bin/sh interpreter:"          NL
-""                                                                           NL
+"# the exit code of the hook program is ignored."                            NL;
+  script =
 "REPOS=\"$1\""                                                               NL
 "USER=\"$2\""                                                                NL
 ""                                                                           NL
 "# Send email to interested parties, let them know a lock was removed:"      NL
 "mailer.py unlock \"$REPOS\" \"$USER\" /path/to/mailer.conf"                 NL;
 
-#undef SCRIPT_NAME
-
-    SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
-              "Creating post-unlock hook");
+  SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
+                                     description, script, pool),
+            _("Creating post-unlock hook"));
 
-    SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
-  } /* end post-unlock hook */
+#undef SCRIPT_NAME
 
 
   /* Post-revprop-change hook. */
-  {
-    this_path = apr_psprintf(pool, "%s%s",
-                             svn_repos_post_revprop_change_hook(repos, pool),
-                             SVN_REPOS__HOOK_DESC_EXT);
-
 #define SCRIPT_NAME SVN_REPOS__HOOK_POST_REVPROP_CHANGE
 
-    contents =
-"#!/bin/sh"                                                                  NL
-""                                                                           NL
+  description =
 "# POST-REVPROP-CHANGE HOOK"                                                 NL
 "#"                                                                          NL
 "# The post-revprop-change hook is invoked after a revision property"        NL
@@ -961,28 +783,8 @@ HOOKS_QUOTE_ARGUMENTS_TEXT
 "# Because the propchange has already completed and cannot be undone,"       NL
 "# the exit code of the hook program is ignored.  The hook program"          NL
 "# can use the 'svnlook' utility to help it examine the"                     NL
-"# new property value."                                                      NL
-"#"                                                                          NL
-"# On a Unix system, the normal procedure is to have '"SCRIPT_NAME"'"        NL
-"# invoke other programs to do the real work, though it may do the"          NL
-"# work itself too."                                                         NL
-"#"                                                                          NL
-"# Note that '"SCRIPT_NAME"' must be executable by the user(s) who will"     NL
-"# invoke it (typically the user httpd runs as), and that user must"         NL
-"# have filesystem-level permission to access the repository."               NL
-"#"                                                                          NL
-"# On a Windows system, you should name the hook program"                    NL
-"# '"SCRIPT_NAME".bat' or '"SCRIPT_NAME".exe',"                              NL
-"# but the basic idea is the same."                                          NL
-"# "                                                                         NL
-HOOKS_ENVIRONMENT_TEXT
-"# "                                                                         NL
-HOOKS_QUOTE_ARGUMENTS_TEXT
-"# "                                                                         NL
-"# Here is an example hook script, for a Unix /bin/sh interpreter."          NL
-PREWRITTEN_HOOKS_TEXT
-""                                                                           NL
-""                                                                           NL
+"# new property value."                                                      NL;
+  script =
 "REPOS=\"$1\""                                                               NL
 "REV=\"$2\""                                                                 NL
 "USER=\"$3\""                                                                NL
@@ -992,13 +794,11 @@ PREWRITTEN_HOOKS_TEXT
 "mailer.py propchange2 \"$REPOS\" \"$REV\" \"$USER\" \"$PROPNAME\" "
 "\"$ACTION\" /path/to/mailer.conf"                                           NL;
 
-#undef SCRIPT_NAME
-
-    SVN_ERR_W(svn_io_file_create(this_path, contents, pool),
-              _("Creating post-revprop-change hook"));
+  SVN_ERR_W(write_hook_template_file(repos, SCRIPT_NAME,
+                                     description, script, pool),
+            _("Creating post-revprop-change hook"));
 
-    SVN_ERR(svn_io_set_file_executable(this_path, TRUE, FALSE, pool));
-  } /* end post-revprop-change hook */
+#undef SCRIPT_NAME
 
   return SVN_NO_ERROR;
 }

Modified: subversion/branches/move-tracking-2/subversion/libsvn_subr/x509.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_subr/x509.h?rev=1658955&r1=1658954&r2=1658955&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_subr/x509.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_subr/x509.h Wed Feb 11 13:33:07 2015
@@ -108,15 +108,19 @@ typedef struct _x509_cert {
 } x509_cert;
 
 
+struct svn_x509_name_attr_t {
+  unsigned char *oid;
+  apr_size_t oid_len;
+  const char *utf8_value;
+};
+
 /*
  * Certificate info, returned from the parser
  */
 struct svn_x509_certinfo_t
 {
-  apr_array_header_t *issuer_oids;
-  apr_hash_t *issuer;
-  apr_array_header_t *subject_oids;
-  apr_hash_t *subject;
+  apr_array_header_t *issuer;
+  apr_array_header_t *subject;
   apr_time_t valid_from;
   apr_time_t valid_to;
   svn_checksum_t *digest;

Modified: subversion/branches/move-tracking-2/subversion/libsvn_subr/x509info.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_subr/x509info.c?rev=1658955&r1=1658954&r2=1658955&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_subr/x509info.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_subr/x509info.c Wed Feb 11 13:33:07 2015
@@ -34,6 +34,33 @@
 
 
 
+svn_x509_name_attr_t *
+svn_x509_name_attr_dup(const svn_x509_name_attr_t *attr,
+                       apr_pool_t *result_pool,
+                       apr_pool_t *scratch_pool)
+{
+  svn_x509_name_attr_t *result = apr_palloc(result_pool, sizeof(*result));
+  result->oid_len = attr->oid_len;
+  result->oid = apr_palloc(result_pool, result->oid_len);
+  memcpy(result->oid, attr->oid, result->oid_len);
+  result->utf8_value = apr_pstrdup(result_pool, attr->utf8_value);
+
+  return result;
+}
+
+const unsigned char *
+svn_x509_name_attr_get_oid(const svn_x509_name_attr_t *attr, apr_size_t *len)
+{
+  *len = attr->oid_len;
+  return attr->oid;
+}
+
+const char *
+svn_x509_name_attr_get_value(const svn_x509_name_attr_t *attr)
+{
+  return attr->utf8_value;
+}
+
 /* Array elements are assumed to be nul-terminated C strings. */
 static apr_array_header_t *
 deep_copy_array(apr_array_header_t *s, apr_pool_t *result_pool)
@@ -56,31 +83,24 @@ deep_copy_array(apr_array_header_t *s, a
   return d;
 }
 
-/* Hash key and value are assumed to be nul-terminated C strings. */
-static apr_hash_t *deep_copy_hash(apr_hash_t *s,
-                                  apr_pool_t *scratch_pool, 
-                                  apr_pool_t *result_pool)
+/* Copy an array with elements that are svn_x509_name_attr_t's */
+static apr_array_header_t *
+deep_copy_name_attrs(apr_array_header_t *s, apr_pool_t *result_pool)
 {
-  apr_hash_t *d;
-  apr_hash_index_t *i;
+  int i;
+  apr_array_header_t *d;
 
   if (!s)
     return NULL;
 
-  d = apr_hash_make(result_pool);
-  i = apr_hash_first(scratch_pool, s);
+  d = apr_array_copy(result_pool, s);
 
-  /* Make a deep copy of the hash keys and values. */
-  while (i)
+  /* Make a deep copy of the svn_x509_name_attr_t's in the array. */
+  for (i = 0; i < s->nelts; ++i)
     {
-      const void *key;
-      void *val;
-      apr_ssize_t klen;
-
-      apr_hash_this(i, &key, &klen, &val);
-      apr_hash_set(d, apr_pstrndup(result_pool, key, klen), klen,
-                   apr_pstrdup(result_pool, val));
-      i = apr_hash_next(i);
+      APR_ARRAY_IDX(d, i, const svn_x509_name_attr_t *) =
+        svn_x509_name_attr_dup(APR_ARRAY_IDX(s, i, svn_x509_name_attr_t *),
+                               result_pool, result_pool);
     }
 
   return d;
@@ -92,10 +112,8 @@ svn_x509_certinfo_dup(const svn_x509_cer
                       apr_pool_t *scratch_pool)
 {
   svn_x509_certinfo_t *result = apr_palloc(result_pool, sizeof(*result));
-  result->subject_oids = deep_copy_array(certinfo->subject_oids, result_pool);
-  result->subject = deep_copy_hash(certinfo->subject, scratch_pool, result_pool);
-  result->issuer_oids = deep_copy_array(certinfo->issuer_oids, result_pool);
-  result->issuer = deep_copy_hash(certinfo->issuer, scratch_pool, result_pool);
+  result->subject = deep_copy_name_attrs(certinfo->subject, result_pool);
+  result->issuer = deep_copy_name_attrs(certinfo->issuer, result_pool);
   result->valid_from = certinfo->valid_from;
   result->valid_to = certinfo->valid_to;
   result->digest = svn_checksum_dup(certinfo->digest, result_pool);
@@ -105,49 +123,134 @@ svn_x509_certinfo_dup(const svn_x509_cer
 }
 
 typedef struct asn1_oid {
-  const char *oid_string;
+  const unsigned char *oid;
+  const ptrdiff_t oid_len;
   const char *short_label;
   const char *long_label;
 } asn1_oid;
 
+#define CONSTANT_PAIR(c) (unsigned char *)(c), sizeof((c)) - 1
+
 static const asn1_oid asn1_oids[] = {
-  { SVN_X509_OID_COMMON_NAME,  "CN", "commonName" },
-  { SVN_X509_OID_COUNTRY,      "C",  "countryName" },
-  { SVN_X509_OID_LOCALITY,     "L",  "localityName" },
-  { SVN_X509_OID_STATE,        "ST", "stateOrProvinceName" },
-  { SVN_X509_OID_ORGANIZATION, "O",  "organizationName" },
-  { SVN_X509_OID_ORG_UNIT,     "OU", "organizationalUnitName"},
-  { SVN_X509_OID_EMAIL,        NULL, "emailAddress" },
+  { CONSTANT_PAIR(SVN_X509_OID_COMMON_NAME),  "CN", "commonName" },
+  { CONSTANT_PAIR(SVN_X509_OID_COUNTRY),      "C",  "countryName" },
+  { CONSTANT_PAIR(SVN_X509_OID_LOCALITY),     "L",  "localityName" },
+  { CONSTANT_PAIR(SVN_X509_OID_STATE),        "ST", "stateOrProvinceName" },
+  { CONSTANT_PAIR(SVN_X509_OID_ORGANIZATION), "O",  "organizationName" },
+  { CONSTANT_PAIR(SVN_X509_OID_ORG_UNIT),     "OU", "organizationalUnitName"},
+  { CONSTANT_PAIR(SVN_X509_OID_EMAIL),        NULL, "emailAddress" },
   { NULL },
 };
 
-static const asn1_oid *oid_string_to_asn1_oid(const char *oid_string)
+/* Given an OID return a null-terminated C string representation.
+ * For example an OID with the bytes "\x2A\x86\x48\x86\xF7\x0D\x01\x09\x01"
+ * would be converted to the string "1.2.840.113549.1.9.1". */
+const char *
+svn_x509_oid_to_string(const unsigned char *oid, apr_size_t oid_len,
+                       apr_pool_t *scratch_pool, apr_pool_t *result_pool)
 {
-  const asn1_oid *oid;
+  svn_stringbuf_t *out = svn_stringbuf_create_empty(result_pool);
+  const unsigned char *p = oid;
+  const unsigned char *end = p + oid_len;
+  const char *temp;
+
+  while (p != end) {
+    if (p == oid)
+      {
+        /* Handle decoding the first two values of the OID.  These values
+         * are encoded by taking the first value and adding 40 to it and
+         * adding the result to the second value, then placing this single
+         * value in the first byte of the output.  This is unambiguous since
+         * the first value is apparently limited to 0, 1 or 2 and the second
+         * is limited to 0 to 39. */
+        temp = apr_psprintf(scratch_pool, "%d.%d", *p / 40, *p % 40);
+        p++;
+      }
+    else if (*p < 128)
+      {
+        /* The remaining values if they're less than 128 are just 
+         * the number one to one encoded */
+        temp = apr_psprintf(scratch_pool, ".%d", *p);
+        p++;
+      }
+    else
+      {
+        /* Values greater than 128 are encoded as a series of 7 bit values
+         * with the left most bit set to indicate this encoding with the
+         * last octet missing the left most bit to finish out the series.. */
+        unsigned int collector = 0;
+        svn_boolean_t dot = FALSE;
+
+        do {
+          if (collector == 0 && *p == 0x80)
+            {
+              /* include leading zeros in the string representation
+                 technically not legal, but this seems nicer than just
+                 returning NULL */
+              if (!dot)
+                {
+                  svn_stringbuf_appendbyte(out, '.');
+                  dot = TRUE;
+                }
+              svn_stringbuf_appendbyte(out, '0');
+            }
+          else if (collector > UINT_MAX >> 7)
+            {
+              /* overflow */
+              return NULL;
+            }
+          collector = collector << 7 | (*(p++) & 0x7f);
+        } while (p != end && *p > 127);
+        if (collector > UINT_MAX >> 7)
+          return NULL; /* overflow */
+        collector = collector << 7 | *(p++);
+        temp = apr_psprintf(scratch_pool, "%s%d", dot ? "" : ".", collector);
+      }
+    svn_stringbuf_appendcstr(out, temp);
+  }
 
-  for (oid = asn1_oids; oid->oid_string; oid++)
+  if (svn_stringbuf_isempty(out))
+    return NULL;
+
+  return out->data;
+}
+
+static const asn1_oid *oid_to_asn1_oid(unsigned char *oid, apr_size_t oid_len)
+{
+  const asn1_oid *entry;
+
+  for (entry = asn1_oids; entry->oid; entry++)
     {
-      if (strcmp(oid_string, oid->oid_string) == 0)
-        return oid;
+      if (oid_len == entry->oid_len &&
+          memcmp(oid, entry->oid, oid_len) == 0)
+        return entry;
     }
 
   return NULL;
 }
 
-static const char *oid_string_to_best_label(const char *oid_string)
+static const char *oid_to_best_label(unsigned char *oid, apr_size_t oid_len,
+                                     apr_pool_t *result_pool)
 {
-  const asn1_oid *oid = oid_string_to_asn1_oid(oid_string);
+  const asn1_oid *entry = oid_to_asn1_oid(oid, oid_len);
 
-  if (oid)
+  if (entry)
     {
-      if (oid->short_label)
-        return oid->short_label;
+      if (entry->short_label)
+        return entry->short_label;
 
-      if (oid->long_label)
-        return oid->long_label;
+      if (entry->long_label)
+        return entry->long_label;
+    }
+  else
+    {
+      const char *oid_string = svn_x509_oid_to_string(oid, oid_len,
+                                                      result_pool, result_pool);
+      if (oid_string)
+        return oid_string;
     }
 
-  return oid_string;
+  return "??";
 }
 
 /*
@@ -156,23 +259,22 @@ static const char *oid_string_to_best_la
  * If CN is not NULL, return any common name in CN
  */
 static const char *
-get_dn(apr_array_header_t *oids,
-       apr_hash_t *hash,
+get_dn(apr_array_header_t *name,
        apr_pool_t *result_pool)
 {
   svn_stringbuf_t *buf = svn_stringbuf_create_empty(result_pool);
   int n;
 
-  for (n = 0; n < oids->nelts; n++)
+  for (n = 0; n < name->nelts; n++)
     {
-      const char *field = APR_ARRAY_IDX(oids, n, const char *);
+      const svn_x509_name_attr_t *attr = APR_ARRAY_IDX(name, n, svn_x509_name_attr_t *);
 
       if (n > 0)
         svn_stringbuf_appendcstr(buf, ", ");
 
-      svn_stringbuf_appendcstr(buf, oid_string_to_best_label(field));
+      svn_stringbuf_appendcstr(buf, oid_to_best_label(attr->oid, attr->oid_len, result_pool));
       svn_stringbuf_appendbyte(buf, '=');
-      svn_stringbuf_appendcstr(buf, svn_hash_gets(hash, field));
+      svn_stringbuf_appendcstr(buf, attr->utf8_value);
     }
 
   return buf->data;
@@ -182,40 +284,26 @@ const char *
 svn_x509_certinfo_get_subject(const svn_x509_certinfo_t *certinfo,
                               apr_pool_t *result_pool)
 {
-  return get_dn(certinfo->subject_oids, certinfo->subject, result_pool);
+  return get_dn(certinfo->subject, result_pool);
 }
 
 const apr_array_header_t *
-svn_x509_certinfo_get_subject_oids(const svn_x509_certinfo_t *certinfo)
+svn_x509_certinfo_get_subject_attrs(const svn_x509_certinfo_t *certinfo)
 {
-  return certinfo->subject_oids;
-}
-
-const char *
-svn_x509_certinfo_get_subject_attr(const svn_x509_certinfo_t *certinfo,
-                                   const char *oid)
-{
-  return svn_hash_gets(certinfo->subject, oid);
+  return certinfo->subject;
 }
 
 const char *
 svn_x509_certinfo_get_issuer(const svn_x509_certinfo_t *certinfo,
                              apr_pool_t *result_pool)
 {
-  return get_dn(certinfo->issuer_oids, certinfo->issuer, result_pool);
+  return get_dn(certinfo->issuer, result_pool);
 }
 
 const apr_array_header_t *
-svn_x509_certinfo_get_issuer_oids(const svn_x509_certinfo_t *certinfo)
-{
-  return certinfo->issuer_oids;
-}
-
-const char *
-svn_x509_certinfo_get_issuer_attr(const svn_x509_certinfo_t *certinfo,
-                                  const char *oid)
+svn_x509_certinfo_get_issuer_attrs(const svn_x509_certinfo_t *certinfo)
 {
-  return svn_hash_gets(certinfo->issuer, oid);
+  return certinfo->issuer;
 }
 
 apr_time_t
@@ -241,3 +329,4 @@ svn_x509_certinfo_get_hostnames(const sv
 {
   return certinfo->hostnames;
 }
+

Modified: subversion/branches/move-tracking-2/subversion/libsvn_subr/x509parse.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_subr/x509parse.c?rev=1658955&r1=1658954&r2=1658955&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_subr/x509parse.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_subr/x509parse.c Wed Feb 11 13:33:07 2015
@@ -903,90 +903,27 @@ x509name_to_utf8_string(const x509_name
   return nul_escape(utf8_string, result_pool);
 }
 
-/* Given an OID return a null-terminated C string representation in *RESULT.
- * For example an OID with the bytes "\x2A\x86\x48\x86\xF7\x0D\x01\x09\x01"
- * would be converted to the string "1.2.840.113549.1.9.1". */
 static svn_error_t *
-asn1_oid_to_string(const char **result, const x509_buf *oid,
-                   apr_pool_t *scratch_pool, apr_pool_t *result_pool)
-{
-  svn_stringbuf_t *out = svn_stringbuf_create_empty(result_pool);
-  const unsigned char *p = oid->p;
-  const unsigned char *end = p + oid->len;
-  const char *temp;
-
-  *result = NULL;
-
-  if (oid->tag != ASN1_OID)
-    return svn_error_create(SVN_ERR_ASN1_UNEXPECTED_TAG, NULL, NULL);
-
-  if (oid->len <= 0)
-    return svn_error_create(SVN_ERR_ASN1_OUT_OF_DATA, NULL, NULL);
-
-  while (p != end) {
-    if (p == oid->p)
-      {
-        /* Handle decoding the first two values of the OID.  These values
-         * are encoded by taking the first value and adding 40 to it and
-         * adding the result to the second value, then placing this single
-         * value in the first byte of the output.  This is unambiguous since
-         * the first value is apparently limited to 0, 1 or 2 and the second
-         * is limited to 0 to 39. */
-        temp = apr_psprintf(scratch_pool, "%d.%d", *p / 40, *p % 40);
-        p++;
-      }
-    else if (*p < 128)
-      {
-        /* The remaining values if they're less than 128 are just 
-         * the number one to one encoded */
-        temp = apr_psprintf(scratch_pool, ".%d", *p);
-        p++;
-      }
-    else
-      {
-        /* Values greater than 128 are encoded as a series of 7 bit values
-         * with the left most bit set to indicate this encoding with the
-         * last octet missing the left most bit to finish out the series.. */
-        int collector = 0;
-
-        do {
-          collector = collector << 7 | (*(p++) & 0x7f);
-        } while (p != end && *p > 127);
-        collector = collector << 7 | *(p++);
-        temp = apr_psprintf(scratch_pool, ".%d", collector);
-      }
-    svn_stringbuf_appendcstr(out, temp);
-  }
-
-  *result = out->data;
-  return SVN_NO_ERROR;
-}
-
-static svn_error_t *
-x509_name_to_certinfo(apr_array_header_t **oids,
-                      apr_hash_t **hash,
+x509_name_to_certinfo(apr_array_header_t **result,
                       const x509_name *dn,
                       apr_pool_t *scratch_pool,
                       apr_pool_t *result_pool)
 {
   const x509_name *name = dn;
 
-  *oids = apr_array_make(result_pool, 6, sizeof(const char *));
-  *hash = apr_hash_make(result_pool);
+  *result = apr_array_make(result_pool, 6, sizeof(svn_x509_name_attr_t *));
 
   while (name != NULL) {
-    const char *oid_string;
-    const char *utf8_value;
+    svn_x509_name_attr_t *attr = apr_palloc(result_pool, sizeof(svn_x509_name_attr_t));
 
-    SVN_ERR(asn1_oid_to_string(&oid_string, &name->oid,
-                               scratch_pool, result_pool));
-    APR_ARRAY_PUSH(*oids, const char *) = oid_string;
-    utf8_value = x509name_to_utf8_string(name, result_pool);
-    if (utf8_value)
-      svn_hash_sets(*hash, oid_string, utf8_value);
-    else
+    attr->oid_len = name->oid.len;
+    attr->oid = apr_palloc(result_pool, attr->oid_len);
+    memcpy(attr->oid, name->oid.p, attr->oid_len);
+    attr->utf8_value = x509name_to_utf8_string(name, result_pool);
+    if (!attr->utf8_value)
       /* this should never happen */
-      svn_hash_sets(*hash, oid_string, "??");
+      attr->utf8_value = apr_pstrdup(result_pool, "??");
+    APR_ARRAY_PUSH(*result, const svn_x509_name_attr_t *) = attr;
 
     name = name->next;
   }
@@ -1028,6 +965,23 @@ is_hostname(const char *str)
   return TRUE;
 }
 
+static const char *
+x509parse_get_cn(apr_array_header_t *subject)
+{
+  int i;
+
+  for (i = 0; i < subject->nelts; ++i)
+    {
+      const svn_x509_name_attr_t *attr = APR_ARRAY_IDX(subject, i, const svn_x509_name_attr_t *);
+      if (equal(attr->oid, attr->oid_len,
+                SVN_X509_OID_COMMON_NAME, sizeof(SVN_X509_OID_COMMON_NAME) - 1))
+        return attr->utf8_value;
+    }
+
+  return NULL;
+}
+
+
 static void
 x509parse_get_hostnames(svn_x509_certinfo_t *ci, x509_cert *crt,
                         apr_pool_t *result_pool, apr_pool_t *scratch_pool)
@@ -1058,8 +1012,7 @@ x509parse_get_hostnames(svn_x509_certinf
       /* no SAN then get the hostname from the CommonName on the cert */
       const char *utf8_value;
 
-      utf8_value = svn_x509_certinfo_get_subject_attr(ci,
-                      SVN_X509_OID_COMMON_NAME);
+      utf8_value = x509parse_get_cn(ci->subject);
 
       if (utf8_value && is_hostname(utf8_value))
         {
@@ -1220,11 +1173,11 @@ svn_x509_parse_cert(svn_x509_certinfo_t
   ci = apr_pcalloc(result_pool, sizeof(*ci));
 
   /* Get the subject name */
-  SVN_ERR(x509_name_to_certinfo(&ci->subject_oids, &ci->subject, &crt->subject,
+  SVN_ERR(x509_name_to_certinfo(&ci->subject, &crt->subject,
                                 scratch_pool, result_pool));
 
   /* Get the issuer name */
-  SVN_ERR(x509_name_to_certinfo(&ci->issuer_oids, &ci->issuer, &crt->issuer,
+  SVN_ERR(x509_name_to_certinfo(&ci->issuer, &crt->issuer,
                                 scratch_pool, result_pool));
 
   /* Copy the validity range */

Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/conflicts.c?rev=1658955&r1=1658954&r2=1658955&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/conflicts.c Wed Feb 11 13:33:07 2015
@@ -1851,6 +1851,7 @@ static svn_error_t *
 resolve_tree_conflict_on_node(svn_boolean_t *did_resolve,
                               svn_wc__db_t *db,
                               const char *local_abspath,
+                              const svn_skel_t *conflict,
                               svn_wc_conflict_choice_t conflict_choice,
                               apr_hash_t *resolve_later,
                               svn_wc_notify_func2_t notify_func,
@@ -2047,7 +2048,7 @@ svn_wc__conflict_invoke_resolver(svn_wc_
          can continue safely. ### Need notify handling */
       if (result->choice != svn_wc_conflict_choose_postpone)
         SVN_ERR(resolve_tree_conflict_on_node(&resolved,
-                                              db, local_abspath,
+                                              db, local_abspath, conflict_skel,
                                               result->choice,
                                               apr_hash_make(scratch_pool),
                                               NULL, NULL, /* ### notify */
@@ -2514,6 +2515,7 @@ static svn_error_t *
 resolve_tree_conflict_on_node(svn_boolean_t *did_resolve,
                               svn_wc__db_t *db,
                               const char *local_abspath,
+                              const svn_skel_t *conflicts,
                               svn_wc_conflict_choice_t conflict_choice,
                               apr_hash_t *resolve_later,
                               svn_wc_notify_func2_t notify_func,
@@ -2524,18 +2526,12 @@ resolve_tree_conflict_on_node(svn_boolea
 {
   svn_wc_conflict_reason_t reason;
   svn_wc_conflict_action_t action;
-  svn_skel_t *conflicts;
   svn_wc_operation_t operation;
   svn_boolean_t tree_conflicted;
   const char *src_op_root_abspath;
 
   *did_resolve = FALSE;
 
-  SVN_ERR(svn_wc__db_read_conflict(&conflicts, db, local_abspath,
-                                   scratch_pool, scratch_pool));
-  if (!conflicts)
-    return SVN_NO_ERROR;
-
   SVN_ERR(svn_wc__conflict_read_info(&operation, NULL, NULL, NULL,
                                      &tree_conflicted, db, local_abspath,
                                      conflicts, scratch_pool, scratch_pool));
@@ -2613,9 +2609,10 @@ resolve_tree_conflict_on_node(svn_boolea
           if (conflict_choice == svn_wc_conflict_choose_mine_conflict)
             {
               err = svn_wc__db_update_moved_away_conflict_victim(
-                        db, local_abspath,
-                        notify_func, notify_baton,
+                        db, local_abspath, src_op_root_abspath,
+                        operation, action, reason,
                         cancel_func, cancel_baton,
+                        notify_func, notify_baton,
                         scratch_pool);
 
               if (err)
@@ -2884,7 +2881,7 @@ conflict_status_walker(void *baton,
               break;
             SVN_ERR(resolve_tree_conflict_on_node(&did_resolve,
                                                   db,
-                                                  local_abspath,
+                                                  local_abspath, conflict,
                                                   my_choice,
                                                   cswb->resolve_later,
                                                   tree_conflict_collector,

Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/status.c?rev=1658955&r1=1658954&r2=1658955&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/status.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/status.c Wed Feb 11 13:33:07 2015
@@ -36,7 +36,6 @@
 #include "svn_string.h"
 #include "svn_error.h"
 #include "svn_dirent_uri.h"
-#include "svn_path.h"
 #include "svn_io.h"
 #include "svn_config.h"
 #include "svn_time.h"
@@ -47,9 +46,6 @@
 
 #include "wc.h"
 #include "props.h"
-#include "entries.h"
-#include "translate.h"
-#include "tree_conflicts.h"
 
 #include "private/svn_sorts_private.h"
 #include "private/svn_wc_private.h"

Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/token-map.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/token-map.h?rev=1658955&r1=1658954&r2=1658955&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/token-map.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/token-map.h Wed Feb 11 13:33:07 2015
@@ -33,6 +33,7 @@
 extern "C" {
 #endif
 
+/* The kind values used on NODES */
 static const svn_token_map_t kind_map[] = {
   { "file", svn_node_file }, /* MAP_FILE */
   { "dir", svn_node_dir }, /* MAP_DIR */
@@ -41,6 +42,16 @@ static const svn_token_map_t kind_map[]
   { NULL }
 };
 
+/* Like kind_map, but also supports 'none' */
+static const svn_token_map_t kind_map_none[] = {
+  { "none", svn_node_none },
+  { "file", svn_node_file },
+  { "dir", svn_node_dir },
+  { "symlink", svn_node_symlink },
+  { "unknown", svn_node_unknown },
+  { NULL }
+};
+
 /* Note: we only decode presence values from the database. These are a
    subset of all the status values. */
 static const svn_token_map_t presence_map[] = {

Modified: subversion/branches/move-tracking-2/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_wc/update_editor.c?rev=1658955&r1=1658954&r2=1658955&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_wc/update_editor.c Wed Feb 11 13:33:07 2015
@@ -2898,10 +2898,9 @@ close_directory(void *dir_baton,
                 (dav_prop_changes->nelts > 0)
                     ? svn_prop_array_to_hash(dav_prop_changes, pool)
                     : NULL,
-                conflict_skel,
                 (! db->shadowed) && new_base_props != NULL,
-                new_actual_props,
-                iprops, all_work_items,
+                new_actual_props, iprops,
+                conflict_skel, all_work_items,
                 scratch_pool));
     }
 



Mime
View raw message