You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by vm...@apache.org on 2012/12/23 19:34:20 UTC
svn commit: r1425508 [10/17] - in /subversion/branches/javahl-ra: ./ build/
build/ac-macros/ build/generator/ build/generator/templates/ build/hudson/
notes/ notes/api-errata/1.8/ notes/obliterate/ notes/tree-conflicts/
subversion/ subversion/bindings/...
Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/skel.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/skel.c?rev=1425508&r1=1425507&r2=1425508&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/skel.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/skel.c Sun Dec 23 18:34:14 2012
@@ -23,6 +23,8 @@
#include <string.h>
#include "svn_string.h"
#include "svn_error.h"
+#include "svn_props.h"
+#include "svn_pools.h"
#include "private/svn_skel.h"
#include "private/svn_string_private.h"
@@ -167,6 +169,35 @@ is_valid_proplist_skel(const svn_skel_t
return FALSE;
}
+static svn_boolean_t
+is_valid_iproplist_skel(const svn_skel_t *skel)
+{
+ int len = svn_skel__list_length(skel);
+
+ if ((len >= 0) && (len & 1) == 0)
+ {
+ svn_skel_t *elt;
+
+ for (elt = skel->children; elt; elt = elt->next)
+ {
+ if (!elt->is_atom)
+ return FALSE;
+
+ if (elt->next == NULL)
+ return FALSE;
+
+ elt = elt->next;
+
+ if (! is_valid_proplist_skel(elt))
+ return FALSE;
+ }
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static svn_skel_t *parse(const char *data, apr_size_t len,
apr_pool_t *pool);
@@ -689,6 +720,34 @@ svn_skel__parse_proplist(apr_hash_t **pr
return SVN_NO_ERROR;
}
+svn_error_t *
+svn_skel__parse_iprops(apr_array_header_t **iprops,
+ const svn_skel_t *skel,
+ apr_pool_t *result_pool)
+{
+ svn_skel_t *elt;
+
+ /* Validate the skel. */
+ if (! is_valid_iproplist_skel(skel))
+ return skel_err("iprops");
+
+ /* Create the returned structure */
+ *iprops = apr_array_make(result_pool, 1,
+ sizeof(svn_prop_inherited_item_t *));
+
+ for (elt = skel->children; elt; elt = elt->next->next)
+ {
+ svn_prop_inherited_item_t *new_iprop = apr_palloc(result_pool,
+ sizeof(*new_iprop));
+ svn_string_t *repos_parent = svn_string_ncreate(elt->data, elt->len,
+ result_pool);
+ SVN_ERR(svn_skel__parse_proplist(&(new_iprop->prop_hash), elt->next,
+ result_pool));
+ new_iprop->path_or_url = repos_parent->data;
+ APR_ARRAY_PUSH(*iprops, svn_prop_inherited_item_t *) = new_iprop;
+ }
+ return SVN_NO_ERROR;
+}
svn_error_t *
svn_skel__parse_prop(svn_string_t **propval,
@@ -760,3 +819,65 @@ svn_skel__unparse_proplist(svn_skel_t **
*skel_p = skel;
return SVN_NO_ERROR;
}
+
+svn_error_t *
+svn_skel__unparse_iproplist(svn_skel_t **skel_p,
+ const apr_array_header_t *inherited_props,
+ apr_pool_t *result_pool)
+{
+ svn_skel_t *skel = svn_skel__make_empty_list(result_pool);
+
+ /* Create the skel. */
+ if (inherited_props)
+ {
+ int i;
+ apr_hash_index_t *hi;
+ apr_pool_t *subpool = svn_pool_create(result_pool);
+
+ for (i = 0; i < inherited_props->nelts; i++)
+ {
+ svn_prop_inherited_item_t *iprop =
+ APR_ARRAY_IDX(inherited_props, i, svn_prop_inherited_item_t *);
+
+ svn_skel_t *skel_list = svn_skel__make_empty_list(result_pool);
+ svn_skel_t *skel_atom;
+
+ svn_pool_clear(subpool);
+
+ /* Loop over hash entries */
+ for (hi = apr_hash_first(subpool, iprop->prop_hash);
+ hi;
+ hi = apr_hash_next(hi))
+ {
+ const void *key;
+ void *val;
+ apr_ssize_t klen;
+ svn_string_t *value;
+
+ apr_hash_this(hi, &key, &klen, &val);
+ value = val;
+
+ /* VALUE */
+ svn_skel__prepend(svn_skel__mem_atom(value->data, value->len,
+ result_pool), skel_list);
+
+ /* NAME */
+ svn_skel__prepend(svn_skel__mem_atom(key, klen, result_pool),
+ skel_list);
+ }
+
+ skel_atom = svn_skel__str_atom(
+ apr_pstrdup(result_pool, iprop->path_or_url), result_pool);
+ svn_skel__append(skel, skel_atom);
+ svn_skel__append(skel, skel_list);
+ }
+ svn_pool_destroy(subpool);
+ }
+
+ /* Validate and return the skel. */
+ if (! is_valid_iproplist_skel(skel))
+ return skel_err("iproplist");
+
+ *skel_p = skel;
+ return SVN_NO_ERROR;
+}
Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/sqlite.c?rev=1425508&r1=1425507&r2=1425508&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/sqlite.c Sun Dec 23 18:34:14 2012
@@ -54,6 +54,20 @@
#error SQLite is too old -- version 3.7.12 is the minimum required version
#endif
+const char *
+svn_sqlite__compiled_version(void)
+{
+ static const char sqlite_version[] = SQLITE_VERSION;
+ return sqlite_version;
+}
+
+const char *
+svn_sqlite__runtime_version(void)
+{
+ return sqlite3_libversion();
+}
+
+
INTERNAL_STATEMENTS_SQL_DECLARE_STATEMENTS(internal_statements);
@@ -462,6 +476,27 @@ svn_sqlite__bind_properties(svn_sqlite__
}
svn_error_t *
+svn_sqlite__bind_iprops(svn_sqlite__stmt_t *stmt,
+ int slot,
+ const apr_array_header_t *inherited_props,
+ apr_pool_t *scratch_pool)
+{
+ svn_skel_t *skel;
+ svn_stringbuf_t *properties;
+
+ if (inherited_props == NULL)
+ return svn_error_trace(svn_sqlite__bind_blob(stmt, slot, NULL, 0));
+
+ SVN_ERR(svn_skel__unparse_iproplist(&skel, inherited_props,
+ scratch_pool));
+ properties = svn_skel__unparse(skel, scratch_pool);
+ return svn_error_trace(svn_sqlite__bind_blob(stmt,
+ slot,
+ properties->data,
+ properties->len));
+}
+
+svn_error_t *
svn_sqlite__bind_checksum(svn_sqlite__stmt_t *stmt,
int slot,
const svn_checksum_t *checksum,
@@ -567,6 +602,31 @@ svn_sqlite__column_properties(apr_hash_t
}
svn_error_t *
+svn_sqlite__column_iprops(apr_array_header_t **iprops,
+ svn_sqlite__stmt_t *stmt,
+ int column,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ apr_size_t len;
+ const void *val;
+
+ /* svn_skel__parse_iprops copies everything needed to result_pool */
+ val = svn_sqlite__column_blob(stmt, column, &len, NULL);
+ if (val == NULL)
+ {
+ *iprops = NULL;
+ return SVN_NO_ERROR;
+ }
+
+ SVN_ERR(svn_skel__parse_iprops(iprops,
+ svn_skel__parse(val, len, scratch_pool),
+ result_pool));
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
svn_sqlite__column_checksum(const svn_checksum_t **checksum,
svn_sqlite__stmt_t *stmt, int column,
apr_pool_t *result_pool)
Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/ssl_client_cert_pw_providers.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/ssl_client_cert_pw_providers.c?rev=1425508&r1=1425507&r2=1425508&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/ssl_client_cert_pw_providers.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/ssl_client_cert_pw_providers.c Sun Dec 23 18:34:14 2012
@@ -82,7 +82,7 @@ svn_auth__ssl_client_cert_pw_get(svn_boo
return SVN_NO_ERROR;
}
*done = FALSE;
- return FALSE;
+ return SVN_NO_ERROR;
}
/* This implements the svn_auth__password_set_t interface.
Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/string.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/string.c?rev=1425508&r1=1425507&r2=1425508&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/string.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/string.c Sun Dec 23 18:34:14 2012
@@ -578,6 +578,80 @@ svn_stringbuf_appendcstr(svn_stringbuf_t
svn_stringbuf_appendbytes(targetstr, cstr, strlen(cstr));
}
+void
+svn_stringbuf_insert(svn_stringbuf_t *str,
+ apr_size_t pos,
+ const char *bytes,
+ apr_size_t count)
+{
+ if (bytes + count > str->data && bytes < str->data + str->blocksize)
+ {
+ /* special case: BYTES overlaps with this string -> copy the source */
+ const char *temp = apr_pstrndup(str->pool, bytes, count);
+ svn_stringbuf_insert(str, pos, temp, count);
+ }
+ else
+ {
+ if (pos > str->len)
+ pos = str->len;
+
+ svn_stringbuf_ensure(str, str->len + count);
+ memmove(str->data + pos + count, str->data + pos, str->len - pos + 1);
+ memcpy(str->data + pos, bytes, count);
+
+ str->len += count;
+ }
+}
+
+void
+svn_stringbuf_remove(svn_stringbuf_t *str,
+ apr_size_t pos,
+ apr_size_t count)
+{
+ if (pos > str->len)
+ pos = str->len;
+ if (pos + count > str->len)
+ count = str->len - pos;
+
+ memmove(str->data + pos, str->data + pos + count, str->len - pos - count + 1);
+ str->len -= count;
+}
+
+void
+svn_stringbuf_replace(svn_stringbuf_t *str,
+ apr_size_t pos,
+ apr_size_t old_count,
+ const char *bytes,
+ apr_size_t new_count)
+{
+ if (bytes + new_count > str->data && bytes < str->data + str->blocksize)
+ {
+ /* special case: BYTES overlaps with this string -> copy the source */
+ const char *temp = apr_pstrndup(str->pool, bytes, new_count);
+ svn_stringbuf_replace(str, pos, old_count, temp, new_count);
+ }
+ else
+ {
+ if (pos > str->len)
+ pos = str->len;
+ if (pos + old_count > str->len)
+ old_count = str->len - pos;
+
+ if (old_count < new_count)
+ {
+ apr_size_t delta = new_count - old_count;
+ svn_stringbuf_ensure(str, str->len + delta);
+ }
+
+ if (old_count != new_count)
+ memmove(str->data + pos + new_count, str->data + pos + old_count,
+ str->len - pos - old_count + 1);
+
+ memcpy(str->data + pos, bytes, new_count);
+ str->len += new_count - old_count;
+ }
+}
+
svn_stringbuf_t *
svn_stringbuf_dup(const svn_stringbuf_t *original_string, apr_pool_t *pool)
@@ -989,7 +1063,7 @@ svn__ui64toa(char * dest, apr_uint64_t n
target -= 8;
}
- /* Now, the number fits into 32 bits, but is larger than 1 */
+ /* Now, the number fits into 32 bits, but may still be larger than 99 */
reduced = (apr_uint32_t)(number);
while (reduced >= 100)
{
@@ -1019,3 +1093,44 @@ svn__i64toa(char * dest, apr_int64_t num
*dest = '-';
return svn__ui64toa(dest + 1, (apr_uint64_t)(0-number)) + 1;
}
+
+static void
+ui64toa_sep(apr_uint64_t number, char seperator, char *buffer)
+{
+ apr_size_t length = svn__ui64toa(buffer, number);
+ apr_size_t i;
+
+ for (i = length; i > 3; i -= 3)
+ {
+ memmove(&buffer[i - 2], &buffer[i - 3], length - i + 3);
+ buffer[i-3] = seperator;
+ length++;
+ }
+
+ buffer[length] = 0;
+}
+
+char *
+svn__ui64toa_sep(apr_uint64_t number, char seperator, apr_pool_t *pool)
+{
+ char buffer[2 * SVN_INT64_BUFFER_SIZE];
+ ui64toa_sep(number, seperator, buffer);
+
+ return apr_pstrdup(pool, buffer);
+}
+
+char *
+svn__i64toa_sep(apr_int64_t number, char seperator, apr_pool_t *pool)
+{
+ char buffer[2 * SVN_INT64_BUFFER_SIZE];
+ if (number < 0)
+ {
+ buffer[0] = '-';
+ ui64toa_sep((apr_uint64_t)(-number), seperator, &buffer[1]);
+ }
+ else
+ ui64toa_sep((apr_uint64_t)(number), seperator, buffer);
+
+ return apr_pstrdup(pool, buffer);
+}
+
Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/sysinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/sysinfo.c?rev=1425508&r1=1425507&r2=1425508&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/sysinfo.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/sysinfo.c Sun Dec 23 18:34:14 2012
@@ -36,11 +36,20 @@
#include <apr_lib.h>
#include <apr_pools.h>
#include <apr_file_info.h>
+#include <apr_signal.h>
#include <apr_strings.h>
+#include <apr_thread_proc.h>
+#include <apr_version.h>
+#include <apu_version.h>
#include "svn_ctype.h"
#include "svn_error.h"
+#include "svn_io.h"
+#include "svn_string.h"
#include "svn_utf.h"
+#include "svn_version.h"
+
+#include "private/svn_sqlite.h"
#include "sysinfo.h"
#include "svn_private_config.h"
@@ -53,22 +62,37 @@
#include <CoreFoundation/CoreFoundation.h>
#endif
+#ifdef SVN_HAVE_MACHO_ITERATE
+#include <mach-o/dyld.h>
+#include <mach-o/loader.h>
+#endif
+
#if HAVE_UNAME
-static const char* canonical_host_from_uname(apr_pool_t *pool);
-static const char* release_name_from_uname(apr_pool_t *pool);
+static const char *canonical_host_from_uname(apr_pool_t *pool);
+# ifndef SVN_HAVE_MACOS_PLIST
+static const char *release_name_from_uname(apr_pool_t *pool);
+# endif
#endif
#ifdef WIN32
-static const char * win32_canonical_host(apr_pool_t *pool);
-static const char * win32_release_name(apr_pool_t *pool);
-static const char * win32_shared_libs(apr_pool_t *pool);
+static const char *win32_canonical_host(apr_pool_t *pool);
+static const char *win32_release_name(apr_pool_t *pool);
+static const apr_array_header_t *win32_shared_libs(apr_pool_t *pool);
#endif /* WIN32 */
#ifdef SVN_HAVE_MACOS_PLIST
static const char *macos_release_name(apr_pool_t *pool);
-#endif /* SVN_HAVE_MACOS_PLIST */
+#endif
+
+#ifdef SVN_HAVE_MACHO_ITERATE
+static const apr_array_header_t *macos_shared_libs(apr_pool_t *pool);
+#endif
+#if __linux__
+static const char *linux_release_name(apr_pool_t *pool);
+#endif
+
const char *
svn_sysinfo__canonical_host(apr_pool_t *pool)
{
@@ -87,8 +111,10 @@ svn_sysinfo__release_name(apr_pool_t *po
{
#ifdef WIN32
return win32_release_name(pool);
-#elif SVN_HAVE_MACOS_PLIST
+#elif defined(SVN_HAVE_MACOS_PLIST)
return macos_release_name(pool);
+#elif __linux__
+ return linux_release_name(pool);
#elif HAVE_UNAME
return release_name_from_uname(pool);
#else
@@ -96,12 +122,41 @@ svn_sysinfo__release_name(apr_pool_t *po
#endif
}
+const apr_array_header_t *
+svn_sysinfo__linked_libs(apr_pool_t *pool)
+{
+ svn_version_ext_linked_lib_t *lib;
+ apr_array_header_t *array = apr_array_make(pool, 3, sizeof(*lib));
-const char *
+ lib = &APR_ARRAY_PUSH(array, svn_version_ext_linked_lib_t);
+ lib->name = "APR";
+ lib->compiled_version = APR_VERSION_STRING;
+ lib->runtime_version = apr_pstrdup(pool, apr_version_string());
+
+ lib = &APR_ARRAY_PUSH(array, svn_version_ext_linked_lib_t);
+ lib->name = "APR-Util";
+ lib->compiled_version = APU_VERSION_STRING;
+ lib->runtime_version = apr_pstrdup(pool, apu_version_string());
+
+ lib = &APR_ARRAY_PUSH(array, svn_version_ext_linked_lib_t);
+ lib->name = "SQLite";
+ lib->compiled_version = apr_pstrdup(pool, svn_sqlite__compiled_version());
+#ifdef SVN_SQLITE_INLINE
+ lib->runtime_version = NULL;
+#else
+ lib->runtime_version = apr_pstrdup(pool, svn_sqlite__runtime_version());
+#endif
+
+ return array;
+}
+
+const apr_array_header_t *
svn_sysinfo__loaded_libs(apr_pool_t *pool)
{
#ifdef WIN32
return win32_shared_libs(pool);
+#elif defined(SVN_HAVE_MACHO_ITERATE)
+ return macos_shared_libs(pool);
#else
return NULL;
#endif
@@ -172,6 +227,7 @@ canonical_host_from_uname(apr_pool_t *po
return apr_psprintf(pool, "%s-%s-%s%s", machine, vendor, sysname, sysver);
}
+# ifndef SVN_HAVE_MACOS_PLIST
/* Generate a release name from the uname(3) info, effectively
returning "`uname -s` `uname -r`". */
static const char *
@@ -209,9 +265,277 @@ release_name_from_uname(apr_pool_t *pool
}
return NULL;
}
+# endif /* !SVN_HAVE_MACOS_PLIST */
#endif /* HAVE_UNAME */
+#if __linux__
+/* Split a stringbuf into a key/value pair.
+ Return the key, leaving the striped value in the stringbuf. */
+static const char *
+stringbuf_split_key(svn_stringbuf_t *buffer, char delim)
+{
+ char *key;
+ char *end;
+
+ end = strchr(buffer->data, delim);
+ if (!end)
+ return NULL;
+
+ svn_stringbuf_strip_whitespace(buffer);
+ key = buffer->data;
+ end = strchr(key, delim);
+ *end = '\0';
+ buffer->len = 1 + end - key;
+ buffer->data = end + 1;
+ svn_stringbuf_strip_whitespace(buffer);
+
+ return key;
+}
+
+/* Parse `/usr/bin/lsb_rlease --all` */
+static const char *
+lsb_release(apr_pool_t *pool)
+{
+ static const char *const args[3] =
+ {
+ "/usr/bin/lsb_release",
+ "--all",
+ NULL
+ };
+
+ const char *distributor = NULL;
+ const char *description = NULL;
+ const char *release = NULL;
+ const char *codename = NULL;
+
+ apr_proc_t lsbproc;
+ svn_stream_t *lsbinfo;
+ svn_error_t *err;
+
+ /* Run /usr/bin/lsb_release --all < /dev/null 2>/dev/null */
+ {
+ apr_file_t *stdin_handle;
+ apr_file_t *stdout_handle;
+
+ err = svn_io_file_open(&stdin_handle, SVN_NULL_DEVICE_NAME,
+ APR_READ, APR_OS_DEFAULT, pool);
+ if (!err)
+ err = svn_io_file_open(&stdout_handle, SVN_NULL_DEVICE_NAME,
+ APR_WRITE, APR_OS_DEFAULT, pool);
+ if (!err)
+ err = svn_io_start_cmd3(&lsbproc, NULL, args[0], args, NULL, FALSE,
+ FALSE, stdin_handle,
+ TRUE, NULL,
+ FALSE, stdout_handle,
+ pool);
+ if (err)
+ {
+ svn_error_clear(err);
+ return NULL;
+ }
+ }
+
+ /* Parse the output and try to populate the */
+ lsbinfo = svn_stream_from_aprfile2(lsbproc.out, TRUE, pool);
+ if (lsbinfo)
+ {
+ for (;;)
+ {
+ svn_boolean_t eof = FALSE;
+ svn_stringbuf_t *line;
+ const char *key;
+
+ err = svn_stream_readline(lsbinfo, &line, "\n", &eof, pool);
+ if (err || eof)
+ break;
+
+ key = stringbuf_split_key(line, ':');
+ if (!key)
+ continue;
+
+ if (0 == svn_cstring_casecmp(key, "Distributor ID"))
+ distributor = line->data;
+ else if (0 == svn_cstring_casecmp(key, "Description"))
+ description = line->data;
+ else if (0 == svn_cstring_casecmp(key, "Release"))
+ release = line->data;
+ else if (0 == svn_cstring_casecmp(key, "Codename"))
+ codename = line->data;
+ }
+ svn_stream_close(lsbinfo);
+ if (err)
+ {
+ svn_error_clear(err);
+ apr_proc_kill(&lsbproc, SIGKILL);
+ return NULL;
+ }
+ }
+
+ /* Reap the child process */
+ err = svn_io_wait_for_cmd(&lsbproc, "", NULL, NULL, pool);
+ if (err)
+ {
+ svn_error_clear(err);
+ return NULL;
+ }
+
+ if (description)
+ return apr_psprintf(pool, "%s%s%s%s", description,
+ (codename ? " (" : ""),
+ (codename ? codename : ""),
+ (codename ? ")" : ""));
+ if (distributor)
+ return apr_psprintf(pool, "%s%s%s%s%s%s", distributor,
+ (release ? " " : ""),
+ (release ? release : ""),
+ (codename ? " (" : ""),
+ (codename ? codename : ""),
+ (codename ? ")" : ""));
+
+ return NULL;
+}
+
+/* Read the whole contents of a file. */
+static svn_stringbuf_t *
+read_file_contents(const char *filename, apr_pool_t *pool)
+{
+ svn_error_t *err;
+ svn_stringbuf_t *buffer;
+
+ err = svn_stringbuf_from_file2(&buffer, filename, pool);
+ if (err)
+ {
+ svn_error_clear(err);
+ return NULL;
+ }
+
+ return buffer;
+}
+
+/* Strip everything but the first line from a stringbuf. */
+static void
+stringbuf_first_line_only(svn_stringbuf_t *buffer)
+{
+ char *eol = strchr(buffer->data, '\n');
+ if (eol)
+ {
+ *eol = '\0';
+ buffer->len = 1 + eol - buffer->data;
+ }
+ svn_stringbuf_strip_whitespace(buffer);
+}
+
+/* Look at /etc/redhat_release to detect RHEL/Fedora/CentOS. */
+static const char *
+redhat_release(apr_pool_t *pool)
+{
+ svn_stringbuf_t *buffer = read_file_contents("/etc/redhat-release", pool);
+ if (buffer)
+ {
+ stringbuf_first_line_only(buffer);
+ return buffer->data;
+ }
+ return NULL;
+}
+
+/* Look at /etc/SuSE-release to detect non-LSB SuSE. */
+static const char *
+suse_release(apr_pool_t *pool)
+{
+ const char *release = NULL;
+ const char *codename = NULL;
+
+ svn_stringbuf_t *buffer = read_file_contents("/etc/SuSE-release", pool);
+ svn_stringbuf_t *line;
+ svn_stream_t *stream;
+ svn_boolean_t eof;
+ svn_error_t *err;
+ if (!buffer)
+ return NULL;
+
+ stream = svn_stream_from_stringbuf(buffer, pool);
+ err = svn_stream_readline(stream, &line, "\n", &eof, pool);
+ if (err || eof)
+ {
+ svn_error_clear(err);
+ return NULL;
+ }
+
+ svn_stringbuf_strip_whitespace(line);
+ release = line->data;
+
+ for (;;)
+ {
+ const char *key;
+
+ err = svn_stream_readline(stream, &line, "\n", &eof, pool);
+ if (err || eof)
+ {
+ svn_error_clear(err);
+ break;
+ }
+
+ key = stringbuf_split_key(line, '=');
+ if (!key)
+ continue;
+
+ if (0 == strncmp(key, "CODENAME", 8))
+ codename = line->data;
+ }
+
+ return apr_psprintf(pool, "%s%s%s%s",
+ release,
+ (codename ? " (" : ""),
+ (codename ? codename : ""),
+ (codename ? ")" : ""));
+}
+
+/* Look at /etc/debian_version to detect non-LSB Debian. */
+static const char *
+debian_release(apr_pool_t *pool)
+{
+ svn_stringbuf_t *buffer = read_file_contents("/etc/debian_version", pool);
+ if (!buffer)
+ return NULL;
+
+ stringbuf_first_line_only(buffer);
+ return apr_pstrcat(pool, "Debian ", buffer->data, NULL);
+}
+
+/* Try to find the Linux distribution name, or return info from uname. */
+static const char *
+linux_release_name(apr_pool_t *pool)
+{
+ const char *uname_release = release_name_from_uname(pool);
+
+ /* Try anything that has /usr/bin/lsb_release.
+ Covers, for example, Debian, Ubuntu and SuSE. */
+ const char *release_name = lsb_release(pool);
+
+ /* Try RHEL/Fedora/CentOS */
+ if (!release_name)
+ release_name = redhat_release(pool);
+
+ /* Try Non-LSB SuSE */
+ if (!release_name)
+ release_name = suse_release(pool);
+
+ /* Try non-LSB Debian */
+ if (!release_name)
+ release_name = debian_release(pool);
+
+ if (!release_name)
+ return uname_release;
+
+ if (!uname_release)
+ return release_name;
+
+ return apr_psprintf(pool, "%s [%s]", release_name, uname_release);
+}
+#endif /* __linux__ */
+
+
#ifdef WIN32
typedef DWORD (WINAPI *FNGETNATIVESYSTEMINFO)(LPSYSTEM_INFO);
typedef BOOL (WINAPI *FNENUMPROCESSMODULES) (HANDLE, HMODULE, DWORD, LPDWORD);
@@ -487,12 +811,12 @@ file_version_number(const wchar_t *filen
}
/* List the shared libraries loaded by the current process. */
-static const char *
+static const apr_array_header_t *
win32_shared_libs(apr_pool_t *pool)
{
+ apr_array_header_t *array = NULL;
wchar_t buffer[MAX_PATH + 1];
HMODULE *handles = enum_loaded_modules(pool);
- char *libinfo = "";
HMODULE *module;
for (module = handles; module && *module; ++module)
@@ -506,28 +830,31 @@ win32_shared_libs(apr_pool_t *pool)
filename = wcs_to_utf8(buffer, pool);
if (filename)
{
+ svn_version_ext_loaded_lib_t *lib;
char *truename;
+
if (0 == apr_filepath_merge(&truename, "", filename,
APR_FILEPATH_NATIVE
| APR_FILEPATH_TRUENAME,
pool))
filename = truename;
- if (version)
- libinfo = apr_pstrcat(pool, libinfo, " - ", filename,
- " (", version, ")\n", NULL);
- else
- libinfo = apr_pstrcat(pool, libinfo, " - ", filename,
- "\n", NULL);
+
+ if (!array)
+ {
+ array = apr_array_make(pool, 32, sizeof(*lib));
+ }
+ lib = &APR_ARRAY_PUSH(array, svn_version_ext_loaded_lib_t);
+ lib->name = filename;
+ lib->version = version;
}
}
}
- if (*libinfo)
- return libinfo;
- return NULL;
+ return array;
}
#endif /* WIN32 */
+
#ifdef SVN_HAVE_MACOS_PLIST
/* Load the SystemVersion.plist or ServerVersion.plist file into a
property list. Set SERVER to TRUE if the file read was
@@ -711,3 +1038,93 @@ macos_release_name(apr_pool_t *pool)
return NULL;
}
#endif /* SVN_HAVE_MACOS_PLIST */
+
+#ifdef SVN_HAVE_MACHO_ITERATE
+/* List the shared libraries loaded by the current process.
+ Ignore frameworks and system libraries, they're just clutter. */
+static const apr_array_header_t *
+macos_shared_libs(apr_pool_t *pool)
+{
+ static const char slb_prefix[] = "/usr/lib/system/";
+ static const char fwk_prefix[] = "/System/Library/Frameworks/";
+ static const char pfk_prefix[] = "/System/Library/PrivateFrameworks/";
+
+ const size_t slb_prefix_len = strlen(slb_prefix);
+ const size_t fwk_prefix_len = strlen(fwk_prefix);
+ const size_t pfk_prefix_len = strlen(pfk_prefix);
+
+ apr_array_header_t *result = NULL;
+ apr_array_header_t *dylibs = NULL;
+
+ uint32_t i;
+ for (i = 0;; ++i)
+ {
+ const struct mach_header *header = _dyld_get_image_header(i);
+ const char *filename = _dyld_get_image_name(i);
+ const char *version;
+ char *truename;
+ svn_version_ext_loaded_lib_t *lib;
+
+ if (!(header && filename))
+ break;
+
+ switch (header->cputype)
+ {
+ case CPU_TYPE_I386: version = _("Intel"); break;
+ case CPU_TYPE_X86_64: version = _("Intel 64-bit"); break;
+ case CPU_TYPE_POWERPC: version = _("PowerPC"); break;
+ case CPU_TYPE_POWERPC64: version = _("PowerPC 64-bit"); break;
+ default:
+ version = NULL;
+ }
+
+ if (0 == apr_filepath_merge(&truename, "", filename,
+ APR_FILEPATH_NATIVE
+ | APR_FILEPATH_TRUENAME,
+ pool))
+ filename = truename;
+ else
+ filename = apr_pstrdup(pool, filename);
+
+ if (0 == strncmp(filename, slb_prefix, slb_prefix_len)
+ || 0 == strncmp(filename, fwk_prefix, fwk_prefix_len)
+ || 0 == strncmp(filename, pfk_prefix, pfk_prefix_len))
+ {
+ /* Ignore frameworks and system libraries. */
+ continue;
+ }
+
+ if (header->filetype == MH_EXECUTE)
+ {
+ /* Make sure the program filename is first in the list */
+ if (!result)
+ {
+ result = apr_array_make(pool, 32, sizeof(*lib));
+ }
+ lib = &APR_ARRAY_PUSH(result, svn_version_ext_loaded_lib_t);
+ }
+ else
+ {
+ if (!dylibs)
+ {
+ dylibs = apr_array_make(pool, 32, sizeof(*lib));
+ }
+ lib = &APR_ARRAY_PUSH(dylibs, svn_version_ext_loaded_lib_t);
+ }
+
+ lib->name = filename;
+ lib->version = version;
+ }
+
+ /* Gather results into one array. */
+ if (dylibs)
+ {
+ if (result)
+ apr_array_cat(result, dylibs);
+ else
+ result = dylibs;
+ }
+
+ return result;
+}
+#endif /* SVN_HAVE_MACHO_ITERATE */
Propchange: subversion/branches/javahl-ra/subversion/libsvn_subr/sysinfo.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/sysinfo.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/sysinfo.h?rev=1425508&r1=1425507&r2=1425508&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/sysinfo.h (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/sysinfo.h Sun Dec 23 18:34:14 2012
@@ -25,6 +25,7 @@
#define SVN_LIBSVN_SUBR_SYSINFO_H
#include <apr_pools.h>
+#include <apr_tables.h>
#ifdef __cplusplus
extern "C" {
@@ -44,13 +45,22 @@ const char *svn_sysinfo__canonical_host(
*/
const char *svn_sysinfo__release_name(apr_pool_t *pool);
-/* Return a string containing a list of shared libraries loaded by the
- * running process, including their versions where applicable, or NULL
- * if the information is not available.
+/* Return an array of svn_version_linked_lib_t of descriptions of the
+ * link-time and run-time versions of dependent libraries, or NULL of
+ * the info is not available.
*
* All allocations are done in POOL.
*/
-const char *svn_sysinfo__loaded_libs(apr_pool_t *pool);
+const apr_array_header_t *svn_sysinfo__linked_libs(apr_pool_t *pool);
+
+/* Return an array of svn_version_loaded_lib_t of descriptions of
+ * shared libraries loaded by the running process, including their
+ * versions where applicable, or NULL if the information is not
+ * available.
+ *
+ * All allocations are done in POOL.
+ */
+const apr_array_header_t *svn_sysinfo__loaded_libs(apr_pool_t *pool);
#ifdef __cplusplus
}
Propchange: subversion/branches/javahl-ra/subversion/libsvn_subr/sysinfo.h
------------------------------------------------------------------------------
svn:eol-style = native
Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/temp_serializer.c?rev=1425508&r1=1425507&r2=1425508&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/temp_serializer.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/temp_serializer.c Sun Dec 23 18:34:14 2012
@@ -51,7 +51,9 @@ typedef struct source_stack_t
/* offset within the target buffer to where the structure got copied */
apr_size_t target_offset;
- /* parent stack entry. Will be NULL for the root entry. */
+ /* parent stack entry. Will be NULL for the root entry.
+ * Items in the svn_temp_serializer__context_t recycler will use this
+ * to link to the next unused item. */
struct source_stack_t *upper;
} source_stack_t;
@@ -70,6 +72,9 @@ struct svn_temp_serializer__context_t
* process has been finished. However, it is not necessarily NULL when
* the application end serialization. */
source_stack_t *source;
+
+ /* unused stack elements will be put here for later reuse. */
+ source_stack_t *recycler;
};
/* Make sure the serialized data len is a multiple of the default alignment,
@@ -110,6 +115,7 @@ svn_temp_serializer__init(const void *so
svn_temp_serializer__context_t *context = apr_palloc(pool, sizeof(*context));
context->pool = pool;
context->buffer = svn_stringbuf_create_ensure(init_size, pool);
+ context->recycler = NULL;
/* If a source struct has been given, make it the root struct. */
if (source_struct)
@@ -168,6 +174,9 @@ svn_temp_serializer__init_append(void *b
context->source->target_offset = (char *)source_struct - (char *)buffer;
context->source->upper = NULL;
+ /* initialize the RECYCLER */
+ context->recycler = NULL;
+
/* done */
return context;
}
@@ -219,9 +228,16 @@ svn_temp_serializer__push(svn_temp_seria
apr_size_t struct_size)
{
const void *source = *source_struct;
+ source_stack_t *new;
- /* create a new entry for the structure stack */
- source_stack_t *new = apr_palloc(context->pool, sizeof(*new));
+ /* recycle an old entry or create a new one for the structure stack */
+ if (context->recycler)
+ {
+ new = context->recycler;
+ context->recycler = new->upper;
+ }
+ else
+ new = apr_palloc(context->pool, sizeof(*new));
/* the serialized structure must be properly aligned */
if (source)
@@ -250,11 +266,17 @@ svn_temp_serializer__push(svn_temp_seria
void
svn_temp_serializer__pop(svn_temp_serializer__context_t *context)
{
+ source_stack_t *old = context->source;
+
/* we may pop the original struct but not further */
assert(context->source);
/* one level up the structure stack */
context->source = context->source->upper;
+
+ /* put the old stack element into the recycler for later reuse */
+ old->upper = context->recycler;
+ context->recycler = old;
}
/* Serialize a string referenced from the current structure within the
Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/utf.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/utf.c?rev=1425508&r1=1425507&r2=1425508&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/utf.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/utf.c Sun Dec 23 18:34:14 2012
@@ -939,7 +939,7 @@ svn_utf_cstring_from_utf8(const char **d
xlate_handle_node_t *node;
svn_error_t *err;
- SVN_ERR(check_utf8(src, strlen(src), pool));
+ SVN_ERR(check_cstring_utf8(src, pool));
SVN_ERR(get_uton_xlate_handle_node(&node, pool));
err = convert_cstring(dest, src, node, pool);
@@ -960,7 +960,7 @@ svn_utf_cstring_from_utf8_ex2(const char
const char *convset_key = get_xlate_key(topage, SVN_APR_UTF8_CHARSET,
pool);
- SVN_ERR(check_utf8(src, strlen(src), pool));
+ SVN_ERR(check_cstring_utf8(src, pool));
SVN_ERR(get_xlate_handle_node(&node, topage, SVN_APR_UTF8_CHARSET,
convset_key, pool));
Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/utf_validate.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/utf_validate.c?rev=1425508&r1=1425507&r2=1425508&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/utf_validate.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/utf_validate.c Sun Dec 23 18:34:14 2012
@@ -57,6 +57,8 @@
*/
#include "private/svn_utf_private.h"
+#include "private/svn_eol_private.h"
+#include "private/svn_dep_compat.h"
/* Lookup table to categorise each octet in the string. */
static const char octet_category[256] = {
@@ -249,12 +251,92 @@ static const char machine [9][14] = {
FSM_ERROR}, /* 0xf5-0xff */
};
+/* Scan MAX_LEN bytes in *DATA for chars that are not in the octet
+ * category 0 (FSM_START). Return the position of the first such char
+ * or DATA + MAX_LEN if all were cat 0.
+ */
+static const char *
+first_non_fsm_start_char(const char *data, apr_size_t max_len)
+{
+#if !SVN_UNALIGNED_ACCESS_IS_OK
+
+ /* On some systems, we need to make sure that buf is properly aligned
+ * for chunky data access.
+ */
+ if ((apr_uintptr_t)data & (sizeof(apr_uintptr_t)-1))
+ {
+ apr_size_t len = (~(apr_uintptr_t)data) & (sizeof(apr_uintptr_t)-1);
+ if (len > max_len)
+ len = max_len;
+ max_len -= len;
+
+ for (; len > 0; ++data, --len)
+ if (*data < 0 || *data >= 0x80)
+ return data;
+ }
+
+#endif
+
+ /* Scan the input one machine word at a time. */
+ for (; max_len > sizeof(apr_uintptr_t)
+ ; data += sizeof(apr_uintptr_t), max_len -= sizeof(apr_uintptr_t))
+ if (*(const apr_uintptr_t *)data & SVN__BIT_7_SET)
+ break;
+
+ /* The remaining odd bytes will be examined the naive way: */
+ for (; max_len > 0; ++data, --max_len)
+ if (*data < 0 || *data >= 0x80)
+ break;
+
+ return data;
+}
+
+/* Scan the C string in *DATA for chars that are not in the octet
+ * category 0 (FSM_START). Return the position of either the such
+ * char or of the terminating NUL.
+ */
+static const char *
+first_non_fsm_start_char_cstring(const char *data)
+{
+ /* We need to make sure that BUF is properly aligned for chunky data
+ * access because we don't know the string's length. Unaligned chunk
+ * read access beyond the NUL terminator could therefore result in a
+ * segfault.
+ */
+ for (; (apr_uintptr_t)data & (sizeof(apr_uintptr_t)-1); ++data)
+ if (*data <= 0 || *data >= 0x80)
+ return data;
+
+ /* Scan the input one machine word at a time. */
+ for (; ; data += sizeof(apr_uintptr_t))
+ {
+ /* Check for non-ASCII chars: */
+ apr_uintptr_t chunk = *(const apr_uintptr_t *)data;
+ if (chunk & SVN__BIT_7_SET)
+ break;
+
+ /* This is the well-known strlen test: */
+ chunk |= (chunk & SVN__LOWER_7BITS_SET) + SVN__LOWER_7BITS_SET;
+ if ((chunk & SVN__BIT_7_SET) != SVN__BIT_7_SET)
+ break;
+ }
+
+ /* The remaining odd bytes will be examined the naive way: */
+ for (; ; ++data)
+ if (*data <= 0 || *data >= 0x80)
+ break;
+
+ return data;
+}
const char *
svn_utf__last_valid(const char *data, apr_size_t len)
{
- const char *start = data, *end = data + len;
+ const char *start = first_non_fsm_start_char(data, len);
+ const char *end = data + len;
int state = FSM_START;
+
+ data = start;
while (data < end)
{
unsigned char octet = *data++;
@@ -270,6 +352,8 @@ svn_boolean_t
svn_utf__cstring_is_valid(const char *data)
{
int state = FSM_START;
+ data = first_non_fsm_start_char_cstring(data);
+
while (*data)
{
unsigned char octet = *data++;
@@ -284,6 +368,8 @@ svn_utf__is_valid(const char *data, apr_
{
const char *end = data + len;
int state = FSM_START;
+ data = first_non_fsm_start_char(data, len);
+
while (data < end)
{
unsigned char octet = *data++;
@@ -296,8 +382,11 @@ svn_utf__is_valid(const char *data, apr_
const char *
svn_utf__last_valid2(const char *data, apr_size_t len)
{
- const char *start = data, *end = data + len;
+ const char *start = first_non_fsm_start_char(data, len);
+ const char *end = data + len;
int state = FSM_START;
+
+ data = start;
while (data < end)
{
unsigned char octet = *data++;
Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/version.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/version.c?rev=1425508&r1=1425507&r2=1425508&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/version.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/version.c Sun Dec 23 18:34:14 2012
@@ -26,7 +26,9 @@
#include "svn_error.h"
#include "svn_version.h"
+#include "sysinfo.h"
#include "svn_private_config.h"
+#include "private/svn_subr_private.h"
const svn_version_t *
svn_subr_version(void)
@@ -96,3 +98,181 @@ svn_ver_check_list(const svn_version_t *
return err;
}
+
+
+struct svn_version_extended_t
+{
+ const char *build_date; /* Compilation date */
+ const char *build_time; /* Compilation time */
+ const char *build_host; /* Build canonical host name */
+ const char *copyright; /* Copyright notice (localized) */
+ const char *runtime_host; /* Runtime canonical host name */
+ const char *runtime_osname; /* Running OS release name */
+
+ /* Array of svn_version_ext_linked_lib_t describing dependent
+ libraries. */
+ const apr_array_header_t *linked_libs;
+
+ /* Array of svn_version_ext_loaded_lib_t describing loaded shared
+ libraries. */
+ const apr_array_header_t *loaded_libs;
+};
+
+
+const svn_version_extended_t *
+svn_version_extended(svn_boolean_t verbose,
+ apr_pool_t *pool)
+{
+ svn_version_extended_t *info = apr_pcalloc(pool, sizeof(*info));
+
+ info->build_date = __DATE__;
+ info->build_time = __TIME__;
+ info->build_host = SVN_BUILD_HOST;
+ info->copyright = apr_pstrdup
+ (pool, _("Copyright (C) 2012 The Apache Software Foundation.\n"
+ "This software consists of contributions made by many people;\n"
+ "see the NOTICE file for more information.\n"
+ "Subversion is open source software, see "
+ "http://subversion.apache.org/\n"));
+
+ if (verbose)
+ {
+ info->runtime_host = svn_sysinfo__canonical_host(pool);
+ info->runtime_osname = svn_sysinfo__release_name(pool);
+ info->linked_libs = svn_sysinfo__linked_libs(pool);
+ info->loaded_libs = svn_sysinfo__loaded_libs(pool);
+ }
+
+ return info;
+}
+
+
+const char *
+svn_version_ext_build_date(const svn_version_extended_t *ext_info)
+{
+ return ext_info->build_date;
+}
+
+const char *
+svn_version_ext_build_time(const svn_version_extended_t *ext_info)
+{
+ return ext_info->build_time;
+}
+
+const char *
+svn_version_ext_build_host(const svn_version_extended_t *ext_info)
+{
+ return ext_info->build_host;
+}
+
+const char *
+svn_version_ext_copyright(const svn_version_extended_t *ext_info)
+{
+ return ext_info->copyright;
+}
+
+const char *
+svn_version_ext_runtime_host(const svn_version_extended_t *ext_info)
+{
+ return ext_info->runtime_host;
+}
+
+const char *
+svn_version_ext_runtime_osname(const svn_version_extended_t *ext_info)
+{
+ return ext_info->runtime_osname;
+}
+
+const apr_array_header_t *
+svn_version_ext_linked_libs(const svn_version_extended_t *ext_info)
+{
+ return ext_info->linked_libs;
+}
+
+const apr_array_header_t *
+svn_version_ext_loaded_libs(const svn_version_extended_t *ext_info)
+{
+ return ext_info->loaded_libs;
+}
+
+svn_error_t *
+svn_version__parse_version_string(svn_version_t **version_p,
+ const char *version_string,
+ apr_pool_t *result_pool)
+{
+ svn_error_t *err;
+ svn_version_t *version;
+ apr_array_header_t *pieces =
+ svn_cstring_split(version_string, ".", FALSE, result_pool);
+
+ if ((pieces->nelts < 2) || (pieces->nelts > 3))
+ return svn_error_create(SVN_ERR_MALFORMED_VERSION_STRING, NULL, NULL);
+
+ version = apr_pcalloc(result_pool, sizeof(*version));
+ version->tag = "";
+
+ /* Parse the major and minor integers strictly. */
+ err = svn_cstring_atoi(&(version->major),
+ APR_ARRAY_IDX(pieces, 0, const char *));
+ if (err)
+ return svn_error_create(SVN_ERR_MALFORMED_VERSION_STRING, err, NULL);
+ err = svn_cstring_atoi(&(version->minor),
+ APR_ARRAY_IDX(pieces, 1, const char *));
+ if (err)
+ return svn_error_create(SVN_ERR_MALFORMED_VERSION_STRING, err, NULL);
+
+ /* If there's a third component, we'll parse it, too. But we don't
+ require that it be present. */
+ if (pieces->nelts == 3)
+ {
+ const char *piece = APR_ARRAY_IDX(pieces, 2, const char *);
+ char *hyphen = strchr(piece, '-');
+ if (hyphen)
+ {
+ version->tag = apr_pstrdup(result_pool, hyphen + 1);
+ *hyphen = '\0';
+ }
+ err = svn_cstring_atoi(&(version->patch), piece);
+ if (err)
+ return svn_error_create(SVN_ERR_MALFORMED_VERSION_STRING,
+ err, NULL);
+ }
+
+ *version_p = version;
+ return SVN_NO_ERROR;
+}
+
+
+svn_boolean_t
+svn_version__at_least(svn_version_t *version,
+ int major,
+ int minor,
+ int patch)
+{
+ /* Compare major versions. */
+ if (version->major < major)
+ return FALSE;
+ if (version->major > major)
+ return TRUE;
+
+ /* Major versions are the same. Compare minor versions. */
+ if (version->minor < minor)
+ return FALSE;
+ if (version->minor > minor)
+ return TRUE;
+
+ /* Major and minor versions are the same. Compare patch
+ versions. */
+ if (version->patch < patch)
+ return FALSE;
+ if (version->patch > patch)
+ return TRUE;
+
+ /* Major, minor, and patch versions are identical matches. But tags
+ in our schema are always used for versions not yet quite at the
+ given patch level. */
+ if (version->tag && version->tag[0])
+ return FALSE;
+
+ return TRUE;
+}
Modified: subversion/branches/javahl-ra/subversion/libsvn_subr/win32_crypto.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_subr/win32_crypto.c?rev=1425508&r1=1425507&r2=1425508&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_subr/win32_crypto.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_subr/win32_crypto.c Sun Dec 23 18:34:14 2012
@@ -145,7 +145,7 @@ windows_password_decrypter(svn_boolean_t
SVN_ERR(svn_auth__simple_password_get(done, &in, creds, realmstring, username,
parameters, non_interactive, pool));
- if (!done)
+ if (!*done)
return SVN_NO_ERROR;
orig = svn_base64_decode_string(svn_string_create(in, pool), pool);
@@ -270,7 +270,7 @@ windows_ssl_client_cert_pw_decrypter(svn
SVN_ERR(svn_auth__ssl_client_cert_pw_get(done, &in, creds, realmstring,
username, parameters,
non_interactive, pool));
- if (!done)
+ if (!*done)
return SVN_NO_ERROR;
orig = svn_base64_decode_string(svn_string_create(in, pool), pool);
Modified: subversion/branches/javahl-ra/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_wc/adm_ops.c?rev=1425508&r1=1425507&r2=1425508&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_wc/adm_ops.c Sun Dec 23 18:34:14 2012
@@ -1019,6 +1019,7 @@ check_can_add_node(svn_node_kind_t *kind
const char *base_name = svn_dirent_basename(local_abspath, scratch_pool);
svn_boolean_t is_wc_root;
svn_node_kind_t kind;
+ svn_boolean_t is_special;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
SVN_ERR_ASSERT(!copyfrom_url || (svn_uri_is_canonical(copyfrom_url,
@@ -1035,7 +1036,8 @@ check_can_add_node(svn_node_kind_t *kind
SVN_ERR(svn_path_check_valid(local_abspath, scratch_pool));
/* Make sure something's there; set KIND and *KIND_P. */
- SVN_ERR(svn_io_check_path(local_abspath, &kind, scratch_pool));
+ SVN_ERR(svn_io_check_special_path(local_abspath, &kind, &is_special,
+ scratch_pool));
if (kind == svn_node_none)
return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
_("'%s' not found"),
@@ -1097,14 +1099,20 @@ check_can_add_node(svn_node_kind_t *kind
SVN_ERR_ASSERT(!is_wc_root);
break;
case svn_wc__db_status_normal:
- if (copyfrom_url)
- {
- SVN_ERR(svn_wc__check_wc_root(&is_wc_root, NULL, NULL,
- db, local_abspath,
- scratch_pool));
+ SVN_ERR(svn_wc__db_is_wcroot(&is_wc_root, db, local_abspath,
+ scratch_pool));
- if (is_wc_root)
- break;
+ if (is_wc_root && copyfrom_url)
+ {
+ /* Integrate a sub working copy in a parent working copy
+ (legacy behavior) */
+ break;
+ }
+ else if (is_wc_root && is_special)
+ {
+ /* Adding a symlink to a working copy root.
+ (special_tests.py 23: externals as symlink targets) */
+ break;
}
/* else: Fall through in default error */
Modified: subversion/branches/javahl-ra/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_wc/conflicts.c?rev=1425508&r1=1425507&r2=1425508&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_wc/conflicts.c Sun Dec 23 18:34:14 2012
@@ -1600,6 +1600,10 @@ eval_text_conflict_func_result(svn_skel_
FALSE /* record_fileinfo */,
result_pool, scratch_pool));
*work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
+
+ SVN_ERR(svn_wc__wq_build_sync_file_flags(&work_item, db, local_abspath,
+ result_pool, scratch_pool));
+ *work_items = svn_wc__wq_merge(*work_items, work_item, result_pool);
if (remove_source)
{
@@ -1679,7 +1683,6 @@ save_merge_result(svn_skel_t **work_item
db, local_abspath,
source, edited_copy_abspath,
result_pool, scratch_pool));
-
return SVN_NO_ERROR;
}
@@ -1907,10 +1910,164 @@ svn_wc__conflict_invoke_resolver(svn_wc_
return SVN_NO_ERROR;
}
+/* Read all property conflicts contained in CONFLICT_SKEL into
+ * individual conflict descriptions, and append those descriptions
+ * to the CONFLICTS array.
+ *
+ * If NOT create_tempfiles, always create a legacy property conflict
+ * descriptor.
+ *
+ * Allocate results in RESULT_POOL. SCRATCH_POOL is used for temporary
+ * allocations. */
+static svn_error_t *
+read_prop_conflicts(apr_array_header_t *conflicts,
+ svn_wc__db_t *db,
+ const char *local_abspath,
+ svn_skel_t *conflict_skel,
+ svn_boolean_t create_tempfiles,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ const char *prop_reject_file;
+ apr_hash_t *my_props;
+ apr_hash_t *their_old_props;
+ apr_hash_t *their_props;
+ apr_hash_t *conflicted_props;
+ apr_hash_index_t *hi;
+ apr_pool_t *iterpool;
+
+ SVN_ERR(svn_wc__conflict_read_prop_conflict(&prop_reject_file,
+ &my_props,
+ &their_old_props,
+ &their_props,
+ &conflicted_props,
+ db, local_abspath,
+ conflict_skel,
+ scratch_pool, scratch_pool));
+
+ if ((! create_tempfiles) || apr_hash_count(conflicted_props) == 0)
+ {
+ /* Legacy prop conflict with only a .reject file. */
+ svn_wc_conflict_description2_t *desc;
+
+ desc = svn_wc_conflict_description_create_prop2(local_abspath,
+ svn_node_unknown,
+ "", result_pool);
+
+ /* ### This should be changed. The prej file should be stored
+ * ### separately from the other files. We need to rev the
+ * ### conflict description struct for this. */
+ desc->their_abspath = apr_pstrdup(result_pool, prop_reject_file);
+
+ APR_ARRAY_PUSH(conflicts, svn_wc_conflict_description2_t*) = desc;
+
+ return SVN_NO_ERROR;
+ }
+
+ iterpool = svn_pool_create(scratch_pool);
+ for (hi = apr_hash_first(scratch_pool, conflicted_props);
+ hi;
+ hi = apr_hash_next(hi))
+ {
+ const char *propname = svn__apr_hash_index_key(hi);
+ svn_string_t *old_value;
+ svn_string_t *my_value;
+ svn_string_t *their_value;
+ svn_wc_conflict_description2_t *desc;
+
+ svn_pool_clear(iterpool);
+
+ desc = svn_wc_conflict_description_create_prop2(local_abspath,
+ svn_node_unknown,
+ propname,
+ result_pool);
+
+ desc->property_name = apr_pstrdup(result_pool, propname);
+
+ my_value = apr_hash_get(my_props, propname, APR_HASH_KEY_STRING);
+ their_value = apr_hash_get(their_props, propname,
+ APR_HASH_KEY_STRING);
+
+ /* Compute the incoming side of the conflict ('action'). */
+ if (their_value == NULL)
+ desc->action = svn_wc_conflict_action_delete;
+ else if (my_value == NULL)
+ desc->action = svn_wc_conflict_action_add;
+ else
+ desc->action = svn_wc_conflict_action_edit;
+
+ /* Compute the local side of the conflict ('reason'). */
+ if (my_value == NULL)
+ desc->reason = svn_wc_conflict_reason_deleted;
+ else if (their_value == NULL)
+ desc->reason = svn_wc_conflict_reason_added;
+ else
+ desc->reason = svn_wc_conflict_reason_edited;
+
+ /* ### This should be changed. The prej file should be stored
+ * ### separately from the other files. We need to rev the
+ * ### conflict description struct for this. */
+ desc->their_abspath = apr_pstrdup(result_pool, prop_reject_file);
+
+ /* ### This should be changed. The conflict description for
+ * ### props should contain these values as svn_string_t,
+ * ### rather than in temporary files. We need to rev the
+ * ### conflict description struct for this. */
+ if (my_value)
+ {
+ svn_stream_t *s;
+ apr_size_t len;
+
+ SVN_ERR(svn_stream_open_unique(&s, &desc->my_abspath, NULL,
+ svn_io_file_del_on_pool_cleanup,
+ result_pool, iterpool));
+ len = my_value->len;
+ SVN_ERR(svn_stream_write(s, my_value->data, &len));
+ SVN_ERR(svn_stream_close(s));
+ }
+
+ if (their_value)
+ {
+ svn_stream_t *s;
+ apr_size_t len;
+
+ /* ### Currently, their_abspath is used for the prop reject file.
+ * ### Put their value into merged instead...
+ * ### We need to rev the conflict description struct to fix this. */
+ SVN_ERR(svn_stream_open_unique(&s, &desc->merged_file, NULL,
+ svn_io_file_del_on_pool_cleanup,
+ result_pool, iterpool));
+ len = their_value->len;
+ SVN_ERR(svn_stream_write(s, their_value->data, &len));
+ SVN_ERR(svn_stream_close(s));
+ }
+
+ old_value = apr_hash_get(their_old_props, propname, APR_HASH_KEY_STRING);
+ if (old_value)
+ {
+ svn_stream_t *s;
+ apr_size_t len;
+
+ SVN_ERR(svn_stream_open_unique(&s, &desc->base_abspath, NULL,
+ svn_io_file_del_on_pool_cleanup,
+ result_pool, iterpool));
+ len = old_value->len;
+ SVN_ERR(svn_stream_write(s, old_value->data, &len));
+ SVN_ERR(svn_stream_close(s));
+ }
+
+ APR_ARRAY_PUSH(conflicts, svn_wc_conflict_description2_t*) = desc;
+ }
+ svn_pool_destroy(iterpool);
+
+ return SVN_NO_ERROR;
+}
+
svn_error_t *
svn_wc__read_conflicts(const apr_array_header_t **conflicts,
svn_wc__db_t *db,
const char *local_abspath,
+ svn_boolean_t create_tempfiles,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
@@ -1942,21 +2099,9 @@ svn_wc__read_conflicts(const apr_array_h
sizeof(svn_wc_conflict_description2_t*));
if (prop_conflicted)
- {
- svn_wc_conflict_description2_t *desc;
- desc = svn_wc_conflict_description_create_prop2(local_abspath,
- svn_node_unknown,
- "",
- result_pool);
-
- SVN_ERR(svn_wc__conflict_read_prop_conflict(&desc->their_abspath,
- NULL, NULL, NULL, NULL,
- db, local_abspath,
- conflict_skel,
- result_pool, scratch_pool));
-
- APR_ARRAY_PUSH(cflcts, svn_wc_conflict_description2_t*) = desc;
- }
+ SVN_ERR(read_prop_conflicts(cflcts, db, local_abspath, conflict_skel,
+ create_tempfiles,
+ result_pool, scratch_pool));
if (text_conflicted)
{
@@ -2207,6 +2352,11 @@ resolve_conflict_on_node(svn_boolean_t *
&work_item, db, local_abspath,
auto_resolve_src, local_abspath, pool, pool));
work_items = svn_wc__wq_merge(work_items, work_item, pool);
+
+ SVN_ERR(svn_wc__wq_build_sync_file_flags(&work_item, db,
+ local_abspath,
+ pool, pool));
+ work_items = svn_wc__wq_merge(work_items, work_item, pool);
}
/* Legacy behavior: Only report text conflicts as resolved when at least
@@ -2266,10 +2416,8 @@ resolve_conflict_on_node(svn_boolean_t *
apr_hash_t *their_old_props;
apr_hash_t *their_props;
apr_hash_t *conflicted_props;
-#if SVN_WC__VERSION >= SVN_WC__USES_CONFLICT_SKELS
apr_hash_t *old_props;
apr_hash_t *resolve_from = NULL;
-#endif
SVN_ERR(svn_wc__conflict_read_prop_conflict(&prop_reject_file,
&mine_props, &their_old_props,
@@ -2277,7 +2425,6 @@ resolve_conflict_on_node(svn_boolean_t *
db, local_abspath, conflicts,
scratch_pool, scratch_pool));
-#if SVN_WC__VERSION >= SVN_WC__USES_CONFLICT_SKELS
if (operation == svn_wc_operation_merge)
SVN_ERR(svn_wc__db_read_pristine_props(&old_props, db, local_abspath,
scratch_pool, scratch_pool));
@@ -2341,7 +2488,6 @@ resolve_conflict_on_node(svn_boolean_t *
FALSE, NULL, NULL,
scratch_pool));
}
-#endif
/* Legacy behavior: Only report property conflicts as resolved when the
property reject file exists
@@ -2437,7 +2583,7 @@ conflict_status_walker(void *baton,
iterpool = svn_pool_create(scratch_pool);
- SVN_ERR(svn_wc__read_conflicts(&conflicts, db, local_abspath,
+ SVN_ERR(svn_wc__read_conflicts(&conflicts, db, local_abspath, TRUE,
scratch_pool, iterpool));
for (i = 0; i < conflicts->nelts; i++)
Modified: subversion/branches/javahl-ra/subversion/libsvn_wc/conflicts.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_wc/conflicts.h?rev=1425508&r1=1425507&r2=1425508&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_wc/conflicts.h (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_wc/conflicts.h Sun Dec 23 18:34:14 2012
@@ -260,6 +260,8 @@ svn_wc__conflict_skel_resolve(svn_boolea
*
* Output arguments can be NULL if the value is not necessary.
*
+ * ### stsp asks: what is LOCATIONS?
+ *
* TEXT_, PROP_ and TREE_CONFLICTED (when not NULL) will be set to TRUE
* when the conflict contains the specified kind of conflict, otherwise
* to false.
Modified: subversion/branches/javahl-ra/subversion/libsvn_wc/copy.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_wc/copy.c?rev=1425508&r1=1425507&r2=1425508&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_wc/copy.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_wc/copy.c Sun Dec 23 18:34:14 2012
@@ -36,6 +36,7 @@
#include "wc.h"
#include "workqueue.h"
#include "props.h"
+#include "conflicts.h"
#include "svn_private_config.h"
#include "private/svn_wc_private.h"
@@ -206,7 +207,6 @@ copy_versioned_file(svn_wc__db_t *db,
if (!metadata_only)
{
const char *my_src_abspath = NULL;
- int i;
svn_boolean_t handle_as_unversioned = FALSE;
/* By default, take the copy source as given. */
@@ -214,26 +214,27 @@ copy_versioned_file(svn_wc__db_t *db,
if (conflicted)
{
- const apr_array_header_t *conflicts;
- const char *conflict_working = NULL;
+ svn_skel_t *conflict;
+ const char *conflict_working;
+ svn_error_t *err;
/* Is there a text conflict at the source path? */
- SVN_ERR(svn_wc__read_conflicts(&conflicts, db, src_abspath,
+ SVN_ERR(svn_wc__db_read_conflict(&conflict, db, src_abspath,
scratch_pool, scratch_pool));
- for (i = 0; i < conflicts->nelts; i++)
- {
- const svn_wc_conflict_description2_t *desc;
-
- desc = APR_ARRAY_IDX(conflicts, i,
- const svn_wc_conflict_description2_t*);
+ err = svn_wc__conflict_read_text_conflict(&conflict_working, NULL, NULL,
+ db, src_abspath, conflict,
+ scratch_pool,
+ scratch_pool);
- if (desc->kind == svn_wc_conflict_kind_text)
- {
- conflict_working = desc->my_abspath;
- break;
- }
+ if (err && err->apr_err == SVN_ERR_WC_MISSING)
+ {
+ /* not text conflicted */
+ svn_error_clear(err);
+ conflict_working = NULL;
}
+ else
+ SVN_ERR(err);
if (conflict_working)
{
@@ -287,7 +288,9 @@ copy_versioned_file(svn_wc__db_t *db,
otherwise copy both the versioned metadata and the filesystem nodes (even
if they are the wrong kind, and including unversioned children).
If IS_MOVE is true, record move information in working copy meta
- data in addition to copying the directory.
+ data in addition to copying the directory. If IS_MOVE is TRUE and
+ ALLOW_MIXED_REVISIONS is FALSE, raise an error if a move of a
+ mixed-revision subtree is attempted.
WITHIN_ONE_WC is TRUE if the copy/move is within a single working copy (root)
*/
@@ -299,6 +302,7 @@ copy_versioned_dir(svn_wc__db_t *db,
const char *tmpdir_abspath,
svn_boolean_t metadata_only,
svn_boolean_t is_move,
+ svn_boolean_t allow_mixed_revisions,
svn_boolean_t within_one_wc,
svn_cancel_func_t cancel_func,
void *cancel_baton,
@@ -315,6 +319,24 @@ copy_versioned_dir(svn_wc__db_t *db,
svn_node_kind_t disk_kind;
apr_pool_t *iterpool;
+ if (is_move && !allow_mixed_revisions)
+ {
+ svn_revnum_t min_rev;
+ svn_revnum_t max_rev;
+
+ /* Verify that the move source is a single-revision subtree. */
+ SVN_ERR(svn_wc__db_min_max_revisions(&min_rev, &max_rev, db,
+ src_abspath, FALSE, scratch_pool));
+ if (SVN_IS_VALID_REVNUM(min_rev) && SVN_IS_VALID_REVNUM(max_rev) &&
+ min_rev != max_rev)
+ return svn_error_createf(SVN_ERR_WC_MIXED_REVISIONS, NULL,
+ _("Cannot move mixed-revision subtree '%s' "
+ "[%lu:%lu]; try updating it first"),
+ svn_dirent_local_style(src_abspath,
+ scratch_pool),
+ min_rev, max_rev);
+ }
+
/* Prepare a temp copy of the single filesystem node (usually a dir). */
if (!metadata_only)
{
@@ -412,7 +434,8 @@ copy_versioned_dir(svn_wc__db_t *db,
SVN_ERR(copy_versioned_dir(db,
child_src_abspath, child_dst_abspath,
dst_op_root_abspath, tmpdir_abspath,
- metadata_only, is_move, within_one_wc,
+ metadata_only, is_move,
+ allow_mixed_revisions, within_one_wc,
cancel_func, cancel_baton, NULL, NULL,
iterpool));
else
@@ -523,6 +546,7 @@ copy_or_move(svn_wc_context_t *wc_ctx,
const char *dst_abspath,
svn_boolean_t metadata_only,
svn_boolean_t is_move,
+ svn_boolean_t allow_mixed_revisions,
svn_cancel_func_t cancel_func,
void *cancel_baton,
svn_wc_notify_func2_t notify_func,
@@ -737,8 +761,8 @@ copy_or_move(svn_wc_context_t *wc_ctx,
else
{
err = copy_versioned_dir(db, src_abspath, dst_abspath, dst_abspath,
- tmpdir_abspath,
- metadata_only, is_move, within_one_wc,
+ tmpdir_abspath, metadata_only, is_move,
+ allow_mixed_revisions, within_one_wc,
cancel_func, cancel_baton,
notify_func, notify_baton,
scratch_pool);
@@ -773,6 +797,7 @@ svn_wc_copy3(svn_wc_context_t *wc_ctx,
{
return svn_error_trace(copy_or_move(wc_ctx, src_abspath, dst_abspath,
metadata_only, FALSE /* is_move */,
+ TRUE /* allow_mixed_revisions */,
cancel_func, cancel_baton,
notify_func, notify_baton,
scratch_pool));
@@ -792,75 +817,40 @@ remove_node_conflict_markers(svn_wc__db_
const char *node_abspath,
apr_pool_t *scratch_pool)
{
- const apr_array_header_t *conflicts;
+ svn_skel_t *conflict;
- SVN_ERR(svn_wc__read_conflicts(&conflicts, db, src_abspath,
+ SVN_ERR(svn_wc__db_read_conflict(&conflict, db, src_abspath,
scratch_pool, scratch_pool));
/* Do we have conflict markers that should be removed? */
- if (conflicts != NULL)
+ if (conflict != NULL)
{
+ const apr_array_header_t *markers;
int i;
const char *src_dir = svn_dirent_dirname(src_abspath, scratch_pool);
const char *dst_dir = svn_dirent_dirname(node_abspath, scratch_pool);
- /* No iterpool: Maximum number of possible conflict markers is 4 */
+ SVN_ERR(svn_wc__conflict_read_markers(&markers, db, src_abspath,
+ conflict,
+ scratch_pool, scratch_pool));
- for (i = 0; i < conflicts->nelts; i++)
+ /* No iterpool: Maximum number of possible conflict markers is 4 */
+ for (i = 0; markers && (i < markers->nelts); i++)
{
- const svn_wc_conflict_description2_t *desc;
+ const char *marker_abspath;
const char *child_relpath;
const char *child_abpath;
- desc = APR_ARRAY_IDX(conflicts, i,
- const svn_wc_conflict_description2_t*);
-
- if (desc->kind != svn_wc_conflict_kind_text
- && desc->kind != svn_wc_conflict_kind_property)
- continue;
-
- if (desc->base_abspath != NULL)
- {
- child_relpath = svn_dirent_is_child(src_dir, desc->base_abspath,
- NULL);
+ marker_abspath = APR_ARRAY_IDX(markers, i, const char *);
- if (child_relpath)
- {
- child_abpath = svn_dirent_join(dst_dir, child_relpath,
- scratch_pool);
+ child_relpath = svn_dirent_is_child(src_dir, marker_abspath, NULL);
- SVN_ERR(svn_io_remove_file2(child_abpath, TRUE,
- scratch_pool));
- }
- }
- if (desc->their_abspath != NULL)
+ if (child_relpath)
{
- child_relpath = svn_dirent_is_child(src_dir, desc->their_abspath,
- NULL);
-
- if (child_relpath)
- {
- child_abpath = svn_dirent_join(dst_dir, child_relpath,
- scratch_pool);
+ child_abpath = svn_dirent_join(dst_dir, child_relpath,
+ scratch_pool);
- SVN_ERR(svn_io_remove_file2(child_abpath, TRUE,
- scratch_pool));
- }
- }
- if (desc->my_abspath != NULL)
- {
- child_relpath = svn_dirent_is_child(src_dir, desc->my_abspath,
- NULL);
-
- if (child_relpath)
- {
- child_abpath = svn_dirent_join(dst_dir, child_relpath,
- scratch_pool);
-
- /* ### Copy child_abspath to node_abspath if it exists? */
- SVN_ERR(svn_io_remove_file2(child_abpath, TRUE,
- scratch_pool));
- }
+ SVN_ERR(svn_io_remove_file2(child_abpath, TRUE, scratch_pool));
}
}
}
@@ -928,21 +918,23 @@ remove_all_conflict_markers(svn_wc__db_t
}
svn_error_t *
-svn_wc_move(svn_wc_context_t *wc_ctx,
- const char *src_abspath,
- const char *dst_abspath,
- svn_boolean_t metadata_only,
- svn_cancel_func_t cancel_func,
- void *cancel_baton,
- svn_wc_notify_func2_t notify_func,
- void *notify_baton,
- apr_pool_t *scratch_pool)
+svn_wc__move2(svn_wc_context_t *wc_ctx,
+ const char *src_abspath,
+ const char *dst_abspath,
+ svn_boolean_t metadata_only,
+ svn_boolean_t allow_mixed_revisions,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ svn_wc_notify_func2_t notify_func,
+ void *notify_baton,
+ apr_pool_t *scratch_pool)
{
svn_wc__db_t *db = wc_ctx->db;
SVN_ERR(copy_or_move(wc_ctx, src_abspath, dst_abspath,
TRUE /* metadata_only */,
TRUE /* is_move */,
+ allow_mixed_revisions,
cancel_func, cancel_baton,
notify_func, notify_baton,
scratch_pool));
Modified: subversion/branches/javahl-ra/subversion/libsvn_wc/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_wc/deprecated.c?rev=1425508&r1=1425507&r2=1425508&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_wc/deprecated.c Sun Dec 23 18:34:14 2012
@@ -3269,7 +3269,7 @@ svn_wc_get_update_editor4(const svn_delt
target_revision,
wc_ctx,
anchor_abspath,
- target_basename,
+ target_basename, NULL,
use_commit_times,
depth, depth_is_sticky,
allow_unver_obstructions,
@@ -3455,7 +3455,7 @@ svn_wc_get_switch_editor4(const svn_delt
target_revision,
wc_ctx,
anchor_abspath, target_basename,
- switch_url,
+ switch_url, NULL,
use_commit_times,
depth, depth_is_sticky,
allow_unver_obstructions,
@@ -4463,3 +4463,22 @@ svn_wc_crop_tree(svn_wc_adm_access_t *an
return svn_error_trace(svn_wc_context_destroy(wc_ctx));
}
+
+svn_error_t *
+svn_wc_move(svn_wc_context_t *wc_ctx,
+ const char *src_abspath,
+ const char *dst_abspath,
+ svn_boolean_t metadata_only,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ svn_wc_notify_func2_t notify_func,
+ void *notify_baton,
+ apr_pool_t *scratch_pool)
+{
+ return svn_error_trace(svn_wc__move2(wc_ctx, src_abspath, dst_abspath,
+ metadata_only,
+ TRUE, /* allow_mixed_revisions */
+ cancel_func, cancel_baton,
+ notify_func, notify_baton,
+ scratch_pool));
+}
Modified: subversion/branches/javahl-ra/subversion/libsvn_wc/entries.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_wc/entries.c?rev=1425508&r1=1425507&r2=1425508&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_wc/entries.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_wc/entries.c Sun Dec 23 18:34:14 2012
@@ -455,6 +455,7 @@ read_one_entry(const svn_wc_entry_t **ne
SVN_ERR(svn_wc__read_conflicts(&child_conflicts,
db, child_abspath,
+ FALSE /* create tempfiles */,
scratch_pool, scratch_pool));
for (j = 0; j < child_conflicts->nelts; j++)
@@ -874,37 +875,53 @@ read_one_entry(const svn_wc_entry_t **ne
if (conflicted)
{
- const apr_array_header_t *conflicts;
- int j;
- SVN_ERR(svn_wc__read_conflicts(&conflicts, db, entry_abspath,
- scratch_pool, scratch_pool));
-
- for (j = 0; j < conflicts->nelts; j++)
- {
- const svn_wc_conflict_description2_t *cd;
- cd = APR_ARRAY_IDX(conflicts, j,
- const svn_wc_conflict_description2_t *);
+ svn_skel_t *conflict;
+ svn_boolean_t text_conflicted;
+ svn_boolean_t prop_conflicted;
+ SVN_ERR(svn_wc__db_read_conflict(&conflict, db, entry_abspath,
+ scratch_pool, scratch_pool));
- switch (cd->kind)
- {
- case svn_wc_conflict_kind_text:
- if (cd->base_abspath)
- entry->conflict_old = svn_dirent_basename(cd->base_abspath,
- result_pool);
- if (cd->their_abspath)
- entry->conflict_new = svn_dirent_basename(cd->their_abspath,
- result_pool);
- if (cd->my_abspath)
- entry->conflict_wrk = svn_dirent_basename(cd->my_abspath,
- result_pool);
- break;
- case svn_wc_conflict_kind_property:
- entry->prejfile = svn_dirent_basename(cd->their_abspath,
- result_pool);
- break;
- case svn_wc_conflict_kind_tree:
- break;
- }
+ SVN_ERR(svn_wc__conflict_read_info(NULL, NULL, &text_conflicted,
+ &prop_conflicted, NULL,
+ db, dir_abspath, conflict,
+ scratch_pool, scratch_pool));
+
+ if (text_conflicted)
+ {
+ const char *my_abspath;
+ const char *their_old_abspath;
+ const char *their_abspath;
+ SVN_ERR(svn_wc__conflict_read_text_conflict(&my_abspath,
+ &their_old_abspath,
+ &their_abspath,
+ db, dir_abspath,
+ conflict, scratch_pool,
+ scratch_pool));
+
+ if (my_abspath)
+ entry->conflict_wrk = svn_dirent_basename(my_abspath, result_pool);
+
+ if (their_old_abspath)
+ entry->conflict_old = svn_dirent_basename(their_old_abspath,
+ result_pool);
+
+ if (their_abspath)
+ entry->conflict_new = svn_dirent_basename(their_abspath,
+ result_pool);
+ }
+
+ if (prop_conflicted)
+ {
+ const char *prej_abspath;
+
+ SVN_ERR(svn_wc__conflict_read_prop_conflict(&prej_abspath, NULL,
+ NULL, NULL, NULL,
+ db, dir_abspath,
+ conflict, scratch_pool,
+ scratch_pool));
+
+ if (prej_abspath)
+ entry->prejfile = svn_dirent_basename(prej_abspath, result_pool);
}
}
@@ -1459,7 +1476,7 @@ insert_node(svn_sqlite__db_t *sdb,
else if (node->presence == svn_wc__db_status_excluded)
SVN_ERR(svn_sqlite__bind_text(stmt, 8, "excluded"));
else if (node->presence == svn_wc__db_status_server_excluded)
- SVN_ERR(svn_sqlite__bind_text(stmt, 8, "absent"));
+ SVN_ERR(svn_sqlite__bind_text(stmt, 8, "server-excluded"));
if (node->kind == svn_node_none)
SVN_ERR(svn_sqlite__bind_text(stmt, 10, "unknown"));
@@ -1508,9 +1525,7 @@ insert_actual_node(svn_sqlite__db_t *sdb
apr_pool_t *scratch_pool)
{
svn_sqlite__stmt_t *stmt;
-#if SVN_WC__VERSION >= SVN_WC__USES_CONFLICT_SKELS
svn_skel_t *conflict_data = NULL;
-#endif
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_INSERT_ACTUAL_NODE));
@@ -1525,22 +1540,6 @@ insert_actual_node(svn_sqlite__db_t *sdb
if (actual_node->changelist)
SVN_ERR(svn_sqlite__bind_text(stmt, 5, actual_node->changelist));
-#if SVN_WC__VERSION < SVN_WC__USES_CONFLICT_SKELS
- if (actual_node->conflict_old
- || actual_node->conflict_new
- || actual_node->conflict_working)
- {
- SVN_ERR(svn_sqlite__bind_text(stmt, 7, actual_node->conflict_old));
- SVN_ERR(svn_sqlite__bind_text(stmt, 8, actual_node->conflict_new));
- SVN_ERR(svn_sqlite__bind_text(stmt, 9, actual_node->conflict_working));
- }
-
- if (actual_node->prop_reject)
- SVN_ERR(svn_sqlite__bind_text(stmt, 10, actual_node->prop_reject));
-
- if (actual_node->tree_conflict_data)
- SVN_ERR(svn_sqlite__bind_text(stmt, 11, actual_node->tree_conflict_data));
-#else
SVN_ERR(svn_wc__upgrade_conflict_skel_from_raw(
&conflict_data,
db, wri_abspath,
@@ -1559,7 +1558,6 @@ insert_actual_node(svn_sqlite__db_t *sdb
SVN_ERR(svn_sqlite__bind_blob(stmt, 6, data->data, data->len));
}
-#endif
/* Execute and reset the insert clause. */
return svn_error_trace(svn_sqlite__insert(NULL, stmt));
Modified: subversion/branches/javahl-ra/subversion/libsvn_wc/externals.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_wc/externals.c?rev=1425508&r1=1425507&r2=1425508&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_wc/externals.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_wc/externals.c Sun Dec 23 18:34:14 2012
@@ -381,6 +381,10 @@ struct edit_baton
/* List of incoming propchanges */
apr_array_header_t *propchanges;
+ /* Array of svn_prop_inherited_item_t * structures representing the
+ properties inherited by the base node at LOCAL_ABSPATH. */
+ apr_array_header_t *iprops;
+
/* The last change information */
svn_revnum_t changed_rev;
apr_time_t changed_date;
@@ -810,6 +814,7 @@ close_file(void *file_baton,
eb->repos_uuid,
*eb->target_revision,
new_pristine_props,
+ eb->iprops,
eb->changed_rev,
eb->changed_date,
eb->changed_author,
@@ -825,6 +830,12 @@ close_file(void *file_baton,
all_work_items,
pool));
+ /* close_edit may also update iprops for switched files, catching
+ those for which close_file is never called (e.g. an update of a
+ file external with no changes). So as a minor optimization we
+ clear the iprops so as not to set them again in close_edit. */
+ eb->iprops = NULL;
+
SVN_ERR(svn_wc__wq_run(eb->db, eb->wri_abspath,
eb->cancel_func, eb->cancel_baton, pool));
}
@@ -864,8 +875,18 @@ close_edit(void *edit_baton,
{
struct edit_baton *eb = edit_baton;
- if (!eb->file_closed)
+ if (!eb->file_closed
+ || eb->iprops)
{
+ apr_hash_t *wcroot_iprops = NULL;
+
+ if (eb->iprops)
+ {
+ wcroot_iprops = apr_hash_make(pool);
+ apr_hash_set(wcroot_iprops, eb->local_abspath, APR_HASH_KEY_STRING,
+ eb->iprops);
+ }
+
/* The node wasn't updated, so we just have to bump its revision */
SVN_ERR(svn_wc__db_op_bump_revisions_post_update(eb->db,
eb->local_abspath,
@@ -873,6 +894,7 @@ close_edit(void *edit_baton,
NULL, NULL, NULL,
*eb->target_revision,
apr_hash_make(pool),
+ wcroot_iprops,
pool));
}
@@ -889,6 +911,7 @@ svn_wc__get_file_external_editor(const s
const char *url,
const char *repos_root_url,
const char *repos_uuid,
+ apr_array_header_t *iprops,
svn_boolean_t use_commit_times,
const char *diff3_cmd,
const apr_array_header_t *preserved_exts,
@@ -924,6 +947,8 @@ svn_wc__get_file_external_editor(const s
eb->repos_root_url = apr_pstrdup(edit_pool, repos_root_url);
eb->repos_uuid = apr_pstrdup(edit_pool, repos_uuid);
+ eb->iprops = iprops;
+
eb->use_commit_times = use_commit_times;
eb->ext_patterns = preserved_exts;
eb->diff3cmd = diff3_cmd;
Modified: subversion/branches/javahl-ra/subversion/libsvn_wc/info.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_wc/info.c?rev=1425508&r1=1425507&r2=1425508&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_wc/info.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_wc/info.c Sun Dec 23 18:34:14 2012
@@ -281,6 +281,7 @@ build_info_for_node(svn_wc__info2_t **in
if (conflicted)
SVN_ERR(svn_wc__read_conflicts(&wc_info->conflicts, db,
local_abspath,
+ TRUE /* ### create tempfiles */,
result_pool, scratch_pool));
else
wc_info->conflicts = NULL;
@@ -475,25 +476,25 @@ svn_wc__get_info(svn_wc_context_t *wc_ct
&& fetch_actual_only
&& err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
{
- const svn_wc_conflict_description2_t *root_tree_conflict;
+ svn_boolean_t tree_conflicted;
svn_error_t *err2;
- err2 = svn_wc__get_tree_conflict(&root_tree_conflict,
- wc_ctx, local_abspath,
- scratch_pool, iterpool);
+ err2 = svn_wc__internal_conflicted_p(NULL, NULL, &tree_conflicted,
+ wc_ctx->db, local_abspath,
+ iterpool);
if ((err2 && err2->apr_err == SVN_ERR_WC_PATH_NOT_FOUND))
{
svn_error_clear(err2);
return svn_error_trace(err);
}
- else if (err2 || !root_tree_conflict)
+ else if (err2 || !tree_conflicted)
return svn_error_compose_create(err, err2);
svn_error_clear(err);
apr_hash_set(fe_baton.tree_conflicts, local_abspath,
- APR_HASH_KEY_STRING, root_tree_conflict);
+ APR_HASH_KEY_STRING, "");
}
else
SVN_ERR(err);
@@ -526,6 +527,7 @@ svn_wc__get_info(svn_wc_context_t *wc_ct
SVN_ERR(svn_wc__read_conflicts(&info->wc_info->conflicts,
wc_ctx->db, this_abspath,
+ TRUE /* ### create tempfiles */,
iterpool, iterpool));
if (! info->wc_info->conflicts || ! info->wc_info->conflicts->nelts)
Modified: subversion/branches/javahl-ra/subversion/libsvn_wc/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_wc/lock.c?rev=1425508&r1=1425507&r2=1425508&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_wc/lock.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_wc/lock.c Sun Dec 23 18:34:14 2012
@@ -97,7 +97,8 @@ svn_wc__internal_check_wc(int *wc_format
{
svn_node_kind_t kind;
- if (err->apr_err != SVN_ERR_WC_MISSING)
+ if (err->apr_err != SVN_ERR_WC_MISSING &&
+ err->apr_err != SVN_ERR_WC_UNSUPPORTED_FORMAT)
return svn_error_trace(err);
svn_error_clear(err);