You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/08/10 19:03:37 UTC
svn commit: r984122 [22/40] - in /subversion/branches/ignore-mergeinfo: ./
build/ build/ac-macros/ build/generator/ build/generator/swig/
build/generator/templates/ build/generator/util/ build/hudson/
build/hudson/jobs/ build/hudson/jobs/subversion-1.6...
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/io.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/io.c Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* io.c: shared file reading, writing, and probing code.
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
@@ -468,19 +468,6 @@ svn_io_open_uniquely_named(apr_file_t **
}
svn_error_t *
-svn_io_open_unique_file3(apr_file_t **file,
- const char **temp_path,
- const char *dirpath,
- svn_io_file_del_t delete_when,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
-{
- return svn_io_open_uniquely_named(file, temp_path,
- dirpath, "tempfile", ".tmp",
- delete_when, result_pool, scratch_pool);
-}
-
-svn_error_t *
svn_io_create_unique_link(const char **unique_name_p,
const char *path,
const char *dest,
@@ -651,7 +638,9 @@ init_temp_dir(apr_pool_t *scratch_pool)
SVN_ERR(cstring_to_utf8(&dir, dir, scratch_pool));
- temp_dir = svn_dirent_internal_style(dir, global_pool);
+ dir = svn_dirent_internal_style(dir, scratch_pool);
+
+ SVN_ERR(svn_dirent_get_absolute(&temp_dir, dir, global_pool));
return SVN_NO_ERROR;
}
@@ -807,34 +796,47 @@ svn_io_copy_perms(const char *src,
const char *dst,
apr_pool_t *pool)
{
- /* ### FIXME: apr_file_copy with perms may fail on Win32. We need a
- platform-specific implementation to get the permissions right. */
+ /* ### On Windows, apr_file_perms_set always returns APR_ENOTIMPL,
+ and the path passed to apr_file_perms_set must be encoded
+ in the platform-specific path encoding; not necessary UTF-8.
+ We need a platform-specific implementation to get the
+ permissions right. */
#ifndef WIN32
{
apr_file_t *src_file;
+ apr_file_t *dst_file;
apr_finfo_t finfo;
- const char *dst_apr;
- apr_status_t apr_err;
+ svn_error_t *err;
+
+ /* If DST is a symlink, don't bother copying permissions. */
+ SVN_ERR(svn_io_file_open(&dst_file, dst, APR_READ, APR_OS_DEFAULT, pool));
+ SVN_ERR(svn_io_file_info_get(&finfo, APR_FINFO_TYPE, dst_file, pool));
+ SVN_ERR(svn_io_file_close(dst_file, pool));
+ if (finfo.filetype == APR_LNK)
+ return SVN_NO_ERROR;
SVN_ERR(svn_io_file_open(&src_file, src, APR_READ, APR_OS_DEFAULT, pool));
SVN_ERR(svn_io_file_info_get(&finfo, APR_FINFO_PROT, src_file, pool));
SVN_ERR(svn_io_file_close(src_file, pool));
-
- SVN_ERR(cstring_from_utf8(&dst_apr, dst, pool));
- apr_err = apr_file_perms_set(dst_apr, finfo.protection);
-
- /* We shouldn't be able to get APR_INCOMPLETE or APR_ENOTIMPL
- here under normal circumstances, because the perms themselves
- came from a call to apr_file_info_get(), and we already know
- this is the non-Win32 case. But if it does happen, it's not
- an error. */
- if (apr_err != APR_SUCCESS
- && apr_err != APR_INCOMPLETE
- && apr_err != APR_ENOTIMPL)
+ err = svn_io_file_perms_set(dst, finfo.protection, pool);
+ if (err)
{
- return svn_error_wrap_apr(apr_err, _("Can't set permissions on '%s'"),
- svn_dirent_local_style(dst, pool));
+ /* We shouldn't be able to get APR_INCOMPLETE or APR_ENOTIMPL
+ here under normal circumstances, because the perms themselves
+ came from a call to apr_file_info_get(), and we already know
+ this is the non-Win32 case. But if it does happen, it's not
+ an error. */
+ if (APR_STATUS_IS_INCOMPLETE(err->apr_err) ||
+ APR_STATUS_IS_ENOTIMPL(err->apr_err))
+ svn_error_clear(err);
+ else
+ {
+ const char *message;
+ message = apr_psprintf(pool, _("Can't set permissions on '%s'"),
+ svn_dirent_local_style(dst, pool));
+ return svn_error_quick_wrap(err, message);
+ }
}
}
#endif /* ! WIN32 */
@@ -1244,24 +1246,21 @@ reown_file(const char *path,
return svn_error_return(svn_io_remove_file2(unique_name, FALSE, pool));
}
-/* Determine what the read-write PERMS for PATH should be by ORing
- together the permissions of PATH and the permissions of a temporary
- file that we create. Unfortunately, this is the only way to
- determine which combination of write bits (User/Group/World) should
- be set to restore a file from read-only to read-write. Make
- temporary allocations in POOL. */
+/* Determine what the PERMS for a new file should be by looking at the
+ permissions of a temporary file that we create.
+ Unfortunately, umask() as defined in POSIX provides no thread-safe way
+ to get at the current value of the umask, so what we're doing here is
+ the only way we have to determine which combination of write bits
+ (User/Group/World) should be set by default.
+ Make temporary allocations in SCRATCH_POOL. */
static svn_error_t *
-get_default_file_perms(const char *path, apr_fileperms_t *perms,
- apr_pool_t *pool)
+get_default_file_perms(apr_fileperms_t *perms, apr_pool_t *scratch_pool)
{
- apr_status_t status;
- apr_finfo_t tmp_finfo, finfo;
+ apr_finfo_t finfo;
apr_file_t *fd;
- const char *tmp_path;
- const char *apr_path;
- /* Get the perms for a newly created file to find out what write
- bits should be set.
+ /* Get the perms for a newly created file to find out what bits
+ should be set.
NOTE: normally del_on_close can be problematic because APR might
delete the file if we spawned any child processes. In this case,
@@ -1270,34 +1269,35 @@ get_default_file_perms(const char *path,
NOTE: not so fast, shorty. if some other thread forks off a child,
then the APR cleanups run, and the file will disappear. sigh.
+
+ Using svn_io_open_uniquely_named() here because other tempfile
+ creation functions tweak the permission bits of files they create.
*/
- SVN_ERR(svn_io_open_unique_file3(&fd, &tmp_path,
- svn_dirent_dirname(path, pool),
- svn_io_file_del_on_pool_cleanup,
- pool, pool));
- status = apr_stat(&tmp_finfo, tmp_path, APR_FINFO_PROT, pool);
- if (status)
- return svn_error_wrap_apr(status, _("Can't get default file perms "
- "for file at '%s' (file stat error)"),
- path);
- apr_file_close(fd);
-
- /* Get the perms for the original file so we'll have any other bits
- * that were already set (like the execute bits, for example). */
- SVN_ERR(cstring_from_utf8(&apr_path, path, pool));
- status = apr_file_open(&fd, apr_path, APR_READ | APR_BINARY,
- APR_OS_DEFAULT, pool);
- if (status)
- return svn_error_wrap_apr(status, _("Can't open file at '%s'"), path);
+ SVN_ERR(svn_io_open_uniquely_named(&fd, NULL, NULL, "svn-tempfile", ".tmp",
+ svn_io_file_del_on_pool_cleanup,
+ scratch_pool, scratch_pool));
+ SVN_ERR(svn_io_file_info_get(&finfo, APR_FINFO_PROT, fd, scratch_pool));
+ SVN_ERR(svn_io_file_close(fd, scratch_pool));
- status = apr_stat(&finfo, apr_path, APR_FINFO_PROT, pool);
- if (status)
- return svn_error_wrap_apr(status, _("Can't get file perms for file at "
- "'%s' (file stat error)"), path);
- apr_file_close(fd);
+ *perms = finfo.protection;
+ return SVN_NO_ERROR;
+}
+
+/* OR together permission bits of the file FD and the default permissions
+ of a file as determined by get_default_file_perms(). Do temporary
+ allocations in SCRATCH_POOL. */
+static svn_error_t *
+merge_default_file_perms(apr_file_t *fd, apr_fileperms_t *perms,
+ apr_pool_t *scratch_pool)
+{
+ apr_finfo_t finfo;
+ apr_fileperms_t default_perms;
+
+ SVN_ERR(get_default_file_perms(&default_perms, scratch_pool));
+ SVN_ERR(svn_io_file_info_get(&finfo, APR_FINFO_PROT, fd, scratch_pool));
/* Glom the perms together. */
- *perms = tmp_finfo.protection | finfo.protection;
+ *perms = default_perms | finfo.protection;
return SVN_NO_ERROR;
}
@@ -1343,7 +1343,16 @@ io_set_file_perms(const char *path,
if (change_readwrite)
{
if (enable_write) /* Make read-write. */
- SVN_ERR(get_default_file_perms(path, &perms_to_set, pool));
+ {
+ apr_file_t *fd;
+
+ /* Get the perms for the original file so we'll have any other bits
+ * that were already set (like the execute bits, for example). */
+ SVN_ERR(svn_io_file_open(&fd, path, APR_READ | APR_BINARY,
+ APR_OS_DEFAULT, pool));
+ SVN_ERR(merge_default_file_perms(fd, &perms_to_set, pool));
+ SVN_ERR(svn_io_file_close(fd, pool));
+ }
else
{
if (finfo.protection & APR_UREAD)
@@ -1747,7 +1756,7 @@ stringbuf_from_aprfile(svn_stringbuf_t *
}
}
-
+
/* XXX: We should check the incoming data for being of type binary. */
res = svn_stringbuf_create_ensure(res_initial_len, pool);
@@ -1904,17 +1913,12 @@ svn_io_remove_dir(const char *path, apr_
Similar problem has been observed on FreeBSD.
- See http://subversion.tigris.org/issues/show_bug.cgi?id=1896 for more
- discussion and an initial solution.
+ The workaround is to delete the files only _after_ the initial
+ directory scan. A previous workaround involving rewinddir is
+ problematic on Win32 and some NFS clients, notably NetBSD.
- To work around the problem, we do a rewinddir after we delete all files
- and see if there's anything left. We repeat the steps untill there's
- nothing left to delete.
-
- This workaround causes issues on Windows where delete's are asynchronous,
- however, so we never rewind if we're on Windows (the delete says it is
- complete, we rewind, we see the same file and try to delete it again,
- we fail.
+ See http://subversion.tigris.org/issues/show_bug.cgi?id=1896 and
+ http://subversion.tigris.org/issues/show_bug.cgi?id=3501.
*/
/* Neither windows nor unix allows us to delete a non-empty
@@ -1926,13 +1930,10 @@ svn_io_remove_dir2(const char *path, svn
svn_cancel_func_t cancel_func, void *cancel_baton,
apr_pool_t *pool)
{
- apr_status_t status;
- apr_dir_t *this_dir;
- apr_finfo_t this_entry;
+ svn_error_t *err;
apr_pool_t *subpool;
- apr_int32_t flags = APR_FINFO_TYPE | APR_FINFO_NAME;
- const char *path_apr;
- int need_rewind;
+ apr_hash_t *dirents;
+ apr_hash_index_t *ent;
/* Check for pending cancellation request.
If we need to bail out, do so early. */
@@ -1940,112 +1941,50 @@ svn_io_remove_dir2(const char *path, svn
if (cancel_func)
SVN_ERR((*cancel_func)(cancel_baton));
- /* Convert path to native here and call apr_dir_open directly,
- instead of just using svn_io_dir_open, because we're going to
- need path_apr later anyway when we remove the dir itself. */
-
- if (path[0] == '\0')
- /* APR doesn't like "" directories; use "." instead. */
- SVN_ERR(cstring_from_utf8(&path_apr, ".", pool));
- else
- SVN_ERR(cstring_from_utf8(&path_apr, path, pool));
+ subpool = svn_pool_create(pool);
- status = apr_dir_open(&this_dir, path_apr, pool);
- if (status)
+ err = svn_io_get_dirents2(&dirents, path, subpool);
+ if (err)
{
/* if the directory doesn't exist, our mission is accomplished */
- if (ignore_enoent && APR_STATUS_IS_ENOENT(status))
- return SVN_NO_ERROR;
- else
- return svn_error_wrap_apr(status,
- _("Can't open directory '%s'"),
- svn_dirent_local_style(path, pool));
+ if (ignore_enoent && APR_STATUS_IS_ENOENT(err->apr_err))
+ {
+ svn_error_clear(err);
+ return SVN_NO_ERROR;
+ }
+ return err;
}
- subpool = svn_pool_create(pool);
-
- do
+ for (ent = apr_hash_first(subpool, dirents); ent; ent = apr_hash_next(ent))
{
- need_rewind = FALSE;
-
- for (status = apr_dir_read(&this_entry, flags, this_dir);
- status == APR_SUCCESS;
- status = apr_dir_read(&this_entry, flags, this_dir))
- {
- svn_pool_clear(subpool);
- if ((this_entry.filetype == APR_DIR)
- && ((this_entry.name[0] == '.')
- && ((this_entry.name[1] == '\0')
- || ((this_entry.name[1] == '.')
- && (this_entry.name[2] == '\0')))))
- {
- continue;
- }
- else /* something other than "." or "..", so proceed */
- {
- const char *fullpath, *entry_utf8;
-
-#ifndef WIN32
- need_rewind = TRUE;
-#endif
-
- SVN_ERR(entry_name_to_utf8(&entry_utf8, this_entry.name,
- path_apr, subpool));
-
- fullpath = svn_dirent_join(path, entry_utf8, subpool);
-
- if (this_entry.filetype == APR_DIR)
- {
- /* Don't check for cancellation, the callee
- will immediately do so */
- SVN_ERR(svn_io_remove_dir2(fullpath, FALSE,
- cancel_func, cancel_baton,
- subpool));
- }
- else
- {
- svn_error_t *err;
-
- if (cancel_func)
- SVN_ERR((*cancel_func)(cancel_baton));
-
- err = svn_io_remove_file2(fullpath, FALSE, subpool);
- if (err)
- return svn_error_createf
- (err->apr_err, err, _("Can't remove '%s'"),
- svn_dirent_local_style(fullpath, subpool));
- }
- }
+ const void *key;
+ void *val;
+ char *fullpath;
+
+ apr_hash_this(ent, &key, NULL, &val);
+ fullpath = svn_dirent_join(path, key, subpool);
+ if (((svn_io_dirent_t *)val)->kind == svn_node_dir)
+ {
+ /* Don't check for cancellation, the callee will immediately do so */
+ SVN_ERR(svn_io_remove_dir2(fullpath, FALSE, cancel_func,
+ cancel_baton, subpool));
}
-
- if (need_rewind)
+ else
{
- status = apr_dir_rewind(this_dir);
- if (status)
- return svn_error_wrap_apr(status, _("Can't rewind directory '%s'"),
- svn_dirent_local_style(path, pool));
+ if (cancel_func)
+ SVN_ERR((*cancel_func)(cancel_baton));
+
+ err = svn_io_remove_file2(fullpath, FALSE, subpool);
+ if (err)
+ return svn_error_createf
+ (err->apr_err, err, _("Can't remove '%s'"),
+ svn_dirent_local_style(fullpath, subpool));
}
}
- while (need_rewind);
svn_pool_destroy(subpool);
- if (!APR_STATUS_IS_ENOENT(status))
- return svn_error_wrap_apr(status, _("Can't read directory '%s'"),
- svn_dirent_local_style(path, pool));
-
- status = apr_dir_close(this_dir);
- if (status)
- return svn_error_wrap_apr(status, _("Error closing directory '%s'"),
- svn_dirent_local_style(path, pool));
-
- status = apr_dir_remove(path_apr, pool);
- WIN32_RETRY_LOOP(status, apr_dir_remove(path_apr, pool));
- if (status)
- return svn_error_wrap_apr(status, _("Can't remove '%s'"),
- svn_dirent_local_style(path, pool));
-
- return APR_SUCCESS;
+ return svn_io_dir_remove_nonrecursive(path, pool);
}
svn_error_t *
@@ -2869,11 +2808,11 @@ svn_error_t *
svn_io_file_write(apr_file_t *file, const void *buf,
apr_size_t *nbytes, apr_pool_t *pool)
{
- return do_io_file_wrapper_cleanup
- (file, apr_file_write(file, buf, nbytes),
+ return svn_error_return(do_io_file_wrapper_cleanup(
+ file, apr_file_write(file, buf, nbytes),
N_("Can't write to file '%s'"),
N_("Can't write to stream"),
- pool);
+ pool));
}
@@ -2903,11 +2842,11 @@ svn_io_file_write_full(apr_file_t *file,
#undef MAXBUFSIZE
#endif
- return do_io_file_wrapper_cleanup
- (file, rv,
+ return svn_error_return(do_io_file_wrapper_cleanup(
+ file, rv,
N_("Can't write to file '%s'"),
N_("Can't write to stream"),
- pool);
+ pool));
}
@@ -3018,17 +2957,16 @@ svn_io_file_rename(const char *from_path
status = apr_file_rename(from_path_apr, to_path_apr, pool);
#ifdef WIN32
- if (status)
+ if (APR_STATUS_IS_EACCES(status))
{
/* Set the destination file writable because Windows will not
- allow us to rename over files that are read-only. */
+ allow us to rename when to_path is read-only, but will
+ allow renaming when from_path is read only. */
SVN_ERR(svn_io_set_file_read_write(to_path, TRUE, pool));
status = apr_file_rename(from_path_apr, to_path_apr, pool);
-
- WIN32_RETRY_LOOP(status,
- apr_file_rename(from_path_apr, to_path_apr, pool));
}
+ WIN32_RETRY_LOOP(status, apr_file_rename(from_path_apr, to_path_apr, pool));
#endif /* WIN32 */
if (status)
@@ -3630,22 +3568,41 @@ svn_io_file_name_get(const char **filena
return svn_error_return(cstring_to_utf8(filename, fname_apr, pool));
}
+/* Wrapper for apr_file_perms_set(). */
+svn_error_t *
+svn_io_file_perms_set(const char *fname, apr_fileperms_t perms,
+ apr_pool_t *pool)
+{
+ const char *fname_apr;
+ apr_status_t status;
+
+ SVN_ERR(cstring_from_utf8(&fname_apr, fname, pool));
+
+ status = apr_file_perms_set(fname_apr, perms);
+ if (status)
+ return svn_error_wrap_apr(status, _("Can't set permissions on '%s'"),
+ fname);
+ else
+ return SVN_NO_ERROR;
+}
+
svn_error_t *
-svn_io_mktemp(apr_file_t **file,
- const char **unique_path,
- const char *dirpath,
- const char *filename,
- svn_io_file_del_t delete_when,
- apr_pool_t *result_pool,
- apr_pool_t *scratch_pool)
+svn_io_open_unique_file3(apr_file_t **file,
+ const char **unique_path,
+ const char *dirpath,
+ svn_io_file_del_t delete_when,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
apr_file_t *tempfile;
+ const char *tempname;
char *path;
- const char *x = "XXXXXX";
- char *template;
struct temp_file_cleanup_s *baton = NULL;
apr_int32_t flags = (APR_READ | APR_WRITE | APR_CREATE | APR_EXCL |
APR_BUFFERED | APR_BINARY);
+#ifndef WIN32
+ apr_fileperms_t perms;
+#endif
SVN_ERR_ASSERT(file || unique_path);
if (file)
@@ -3655,12 +3612,8 @@ svn_io_mktemp(apr_file_t **file,
if (dirpath == NULL)
SVN_ERR(svn_io_temp_dir(&dirpath, scratch_pool));
- if (filename == NULL)
- template = apr_pstrdup(scratch_pool, x);
- else
- template = apr_pstrcat(scratch_pool, filename, "-", x, NULL);
-
- path = svn_dirent_join(dirpath, template, scratch_pool);
+
+ path = svn_dirent_join(dirpath, "svn-XXXXXX", scratch_pool);
switch (delete_when)
{
@@ -3687,24 +3640,37 @@ svn_io_mktemp(apr_file_t **file,
}
SVN_ERR(svn_io_file_mktemp(&tempfile, path, flags, result_pool));
+ SVN_ERR(svn_io_file_name_get(&tempname, tempfile, scratch_pool));
+
+#ifndef WIN32
+ /* ### svn_io_file_mktemp() creates files with mode 0600.
+ * ### As of r40264, tempfiles created by svn_io_open_unique_file3()
+ * ### often end up being copied or renamed into the working copy.
+ * ### This will cause working files having mode 0600 while users might
+ * ### expect to see 644 or 664. Ideally, permissions should be tweaked
+ * ### by our callers after installing tempfiles in the WC, but until
+ * ### that's done we need to avoid breaking pre-r40264 behaviour.
+ * ### So we tweak perms of the tempfile here, but only if the umask
+ * ### allows it. */
+ SVN_ERR(merge_default_file_perms(tempfile, &perms, scratch_pool));
+ SVN_ERR(svn_io_file_perms_set(tempname, perms, scratch_pool));
+#endif
if (file)
*file = tempfile;
+ else
+ SVN_ERR(svn_io_file_close(tempfile, scratch_pool));
- if (unique_path || baton)
- {
- const char *name;
- SVN_ERR(svn_io_file_name_get(&name, tempfile, result_pool));
+ if (unique_path)
+ *unique_path = apr_pstrdup(result_pool, tempname);
+ if (baton)
+ {
if (unique_path)
- *unique_path = name;
-
- if (baton)
- baton->name = name;
+ baton->name = *unique_path;
+ else
+ baton->name = apr_pstrdup(result_pool, tempname);
}
- if (!file)
- SVN_ERR(svn_io_file_close(tempfile, scratch_pool));
-
return SVN_NO_ERROR;
}
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/iter.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/iter.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/iter.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/iter.c Tue Aug 10 17:03:06 2010
@@ -1,10 +1,10 @@
/* iter.c : iteration drivers
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/kitchensink.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/kitchensink.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/kitchensink.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/kitchensink.c Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* kitchensink.c : When no place else seems to fit...
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/lock.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/lock.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/lock.c Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* lock.c: routines for svn_lock_t objects.
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/log.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/log.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/log.c Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* log.c : Functions for logging Subversion operations
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/macos_keychain.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/macos_keychain.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/macos_keychain.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/macos_keychain.c Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* macos_keychain.c: Mac OS keychain providers for SVN_AUTH_*
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/md5.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/md5.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/md5.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/md5.c Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* md5.c: checksum routines
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/md5.h
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/md5.h?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/md5.h (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/md5.h Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* md5.h: Converting and comparing MD5 checksums
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/mergeinfo.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/mergeinfo.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/mergeinfo.c Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* mergeinfo.c: Mergeinfo parsing and handling
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
@@ -73,8 +73,10 @@ combine_ranges(svn_merge_range_t *output
/* pathname -> PATHNAME */
static svn_error_t *
-parse_pathname(const char **input, const char *end,
- svn_stringbuf_t **pathname, apr_pool_t *pool)
+parse_pathname(const char **input,
+ const char *end,
+ svn_stringbuf_t **pathname,
+ apr_pool_t *pool)
{
const char *curr = *input;
const char *last_colon = NULL;
@@ -96,7 +98,18 @@ parse_pathname(const char **input, const
return svn_error_create(SVN_ERR_MERGEINFO_PARSE_ERROR, NULL,
_("No pathname preceding ':'"));
- *pathname = svn_stringbuf_ncreate(*input, last_colon - *input, pool);
+ /* Tolerate relative repository paths, but convert them to absolute. */
+ if (**input == '/')
+ {
+ *pathname = svn_stringbuf_ncreate(*input, last_colon - *input, pool);
+ }
+ else
+ {
+ const char *repos_rel_path = apr_pstrndup(pool, *input,
+ last_colon - *input);
+ *pathname = svn_stringbuf_createf(pool, "/%s", repos_rel_path);
+ }
+
*input = last_colon;
return SVN_NO_ERROR;
@@ -131,12 +144,12 @@ get_type_of_intersection(const svn_merge
{
SVN_ERR_ASSERT(r1);
SVN_ERR_ASSERT(r2);
-
+
/* Why not use SVN_IS_VALID_REVNUM here? Because revision 0
is described START = -1, END = 0. See svn_merge_range_t. */
SVN_ERR_ASSERT(r1->start >= -1);
SVN_ERR_ASSERT(r2->start >= -1);
-
+
SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(r1->end));
SVN_ERR_ASSERT(SVN_IS_VALID_REVNUM(r2->end));
SVN_ERR_ASSERT(r1->start < r1->end);
@@ -283,10 +296,10 @@ combine_with_lastrange(const svn_merge_r
intersect but have differing inheritability. Check for the
first case as that is easy to handle. */
intersection_type_t intersection_type;
-
+
SVN_ERR(get_type_of_intersection(new_range, lastrange,
&intersection_type));
-
+
switch (intersection_type)
{
case svn__no_intersection:
@@ -338,7 +351,7 @@ combine_with_lastrange(const svn_merge_r
r2->start = r1->end;
else
r1->end = r2->start;
-
+
/* Push everything back onto RANGELIST. */
APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) = r1;
APR_ARRAY_PUSH(rangelist, svn_merge_range_t *) = r2;
@@ -564,6 +577,7 @@ parse_revision_line(const char **input,
apr_pool_t *pool)
{
svn_stringbuf_t *pathname;
+ apr_array_header_t *existing_rangelist;
apr_array_header_t *rangelist = apr_array_make(pool, 1,
sizeof(svn_merge_range_t *));
@@ -634,6 +648,17 @@ parse_revision_line(const char **input,
lastrange = APR_ARRAY_IDX(rangelist, i, svn_merge_range_t *);
}
}
+
+ /* Handle any funky mergeinfo with relative merge source paths that
+ might exist due to issue #3547. It's possible that this issue allowed
+ the creation of mergeinfo with path keys that differ only by a
+ leading slash, e.g. "trunk:4033\n/trunk:4039-4995". In the event
+ we encounter this we merge the rangelists together under a single
+ absolute path key. */
+ existing_rangelist = apr_hash_get(hash, pathname->data, APR_HASH_KEY_STRING);
+ if (existing_rangelist)
+ svn_rangelist_merge(&rangelist, existing_rangelist, pool);
+
apr_hash_set(hash, pathname->data, APR_HASH_KEY_STRING, rangelist);
return SVN_NO_ERROR;
@@ -1362,7 +1387,9 @@ svn_rangelist_to_string(svn_string_t **o
/* Converts a mergeinfo INPUT to an unparsed mergeinfo in OUTPUT. If PREFIX
is not NULL then prepend PREFIX to each line in OUTPUT. If INPUT contains
- no elements, return the empty string.
+ no elements, return the empty string. If INPUT contains any merge source
+ path keys that are relative then convert these to absolute paths in
+ *OUTPUT.
*/
static svn_error_t *
mergeinfo_to_stringbuf(svn_stringbuf_t **output,
@@ -1384,11 +1411,13 @@ mergeinfo_to_stringbuf(svn_stringbuf_t *
svn_string_t *revlist;
SVN_ERR(svn_rangelist_to_string(&revlist, elt.value, pool));
- svn_stringbuf_appendcstr(*output,
- apr_psprintf(pool, "%s%s:%s",
- prefix ? prefix : "",
- (const char *) elt.key,
- revlist->data));
+ svn_stringbuf_appendcstr(
+ *output,
+ apr_psprintf(pool, "%s%s%s:%s",
+ prefix ? prefix : "",
+ *((const char *) elt.key) == '/' ? "" : "/",
+ (const char *) elt.key,
+ revlist->data));
if (i < sorted->nelts - 1)
svn_stringbuf_appendcstr(*output, "\n");
}
@@ -1974,3 +2003,49 @@ svn_mergeinfo__filter_mergeinfo_by_range
}
return SVN_NO_ERROR;
}
+
+svn_boolean_t
+svn_mergeinfo__is_noninheritable(svn_mergeinfo_t mergeinfo,
+ apr_pool_t *scratch_pool)
+{
+ if (mergeinfo)
+ {
+ apr_hash_index_t *hi;
+
+ for (hi = apr_hash_first(scratch_pool, mergeinfo);
+ hi;
+ hi = apr_hash_next(hi))
+ {
+ apr_array_header_t *rangelist = svn_apr_hash_index_val(hi);
+ int i;
+
+ for (i = 0; i < rangelist->nelts; i++)
+ {
+ svn_merge_range_t *range = APR_ARRAY_IDX(rangelist, i,
+ svn_merge_range_t *);
+ if (!range->inheritable)
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+
+svn_error_t *
+svn_mergeinfo__string_has_noninheritable(svn_boolean_t *is_noninheritable,
+ const char *mergeinfo_str,
+ apr_pool_t *scratch_pool)
+{
+ *is_noninheritable = FALSE;
+
+ if (mergeinfo_str)
+ {
+ svn_mergeinfo_t mergeinfo;
+
+ SVN_ERR(svn_mergeinfo_parse(&mergeinfo, mergeinfo_str, scratch_pool));
+ *is_noninheritable = svn_mergeinfo__is_noninheritable(mergeinfo,
+ scratch_pool);
+ }
+
+ return SVN_NO_ERROR;
+}
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/nls.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/nls.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/nls.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/nls.c Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* nls.c : Helpers for NLS programs.
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/opt.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/opt.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/opt.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/opt.c Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* opt.c : option and argument parsing for Subversion command lines
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
@@ -1004,12 +1004,12 @@ svn_opt__print_version_info(const char *
SVN_ERR(svn_cmdline_printf(pool, _("%s, version %s\n"
" compiled %s, %s\n\n"), pgm_name,
SVN_VERSION, __DATE__, __TIME__));
- SVN_ERR(svn_cmdline_fputs(_("Copyright (C) 2009 The Subversion Corporation.\n"
+ SVN_ERR(svn_cmdline_fputs(_("Copyright (C) 2010 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.tigris.org/\n\n"),
+ " http://subversion.apache.org/\n\n"),
stdout, pool));
if (footer)
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/opt.h
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/opt.h?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/opt.h (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/opt.h Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* opt.h: share svn_opt__* functions
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/path.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/path.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/path.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/path.c Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* paths.c: a path manipulation library using svn_stringbuf_t
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
@@ -769,14 +769,13 @@ uri_escape(const char *path, const char
svn_stringbuf_appendbytes(retstr, path + copied,
i - copied);
- /* Now, sprintf() in our escaped character, making sure our
- buffer is big enough to hold the '%' and two digits. We cast
- the C to unsigned char here because the 'X' format character
- will be tempted to treat it as an unsigned int...which causes
- problem when messing with 0x80-0xFF chars. We also need space
- for a null as sprintf will write one. */
+ /* Now, write in our escaped character, consisting of the
+ '%' and two digits. We cast the C to unsigned char here because
+ the 'X' format character will be tempted to treat it as an unsigned
+ int...which causes problem when messing with 0x80-0xFF chars.
+ We also need space for a null as apr_snprintf will write one. */
svn_stringbuf_ensure(retstr, retstr->len + 4);
- sprintf(retstr->data + retstr->len, "%%%02X", (unsigned char)c);
+ apr_snprintf(retstr->data + retstr->len, 4, "%%%02X", (unsigned char)c);
retstr->len += 3;
/* Finally, update our copy counter. */
@@ -791,7 +790,7 @@ uri_escape(const char *path, const char
if (i - copied)
svn_stringbuf_appendbytes(retstr, path + copied, i - copied);
- /* retstr is null-terminated either by sprintf or the svn_stringbuf
+ /* retstr is null-terminated either by apr_snprintf or the svn_stringbuf
functions. */
return retstr->data;
@@ -1031,7 +1030,7 @@ illegal_path_escape(const char *path, ap
/*### The backslash separator doesn't work too great with Windows,
but it's what we'll use for consistency with invalid utf8
formatting (until someone has a better idea) */
- sprintf(retstr->data + retstr->len, "\\%03o", (unsigned char)c);
+ apr_snprintf(retstr->data + retstr->len, 5, "\\%03o", (unsigned char)c);
retstr->len += 4;
/* Finally, update our copy counter. */
@@ -1046,7 +1045,7 @@ illegal_path_escape(const char *path, ap
if (i - copied)
svn_stringbuf_appendbytes(retstr, path + copied, i - copied);
- /* retstr is null-terminated either by sprintf or the svn_stringbuf
+ /* retstr is null-terminated either by apr_snprintf or the svn_stringbuf
functions. */
return retstr->data;
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/pool.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/pool.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/pool.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/pool.c Tue Aug 10 17:03:06 2010
@@ -1,10 +1,10 @@
/* pool.c: pool wrappers for Subversion
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/prompt.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/prompt.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/prompt.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/prompt.c Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* prompt.c -- ask the user for authentication information.
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
@@ -49,18 +49,10 @@
static apr_status_t wait_for_input(apr_file_t *f,
apr_pool_t *pool)
{
+#ifndef WIN32
apr_pollfd_t pollset;
int srv, n;
-/* APR specs say things that are unimplemented are supposed to return
- * APR_ENOTIMPL. But when trying to use APR_POLL_FILE with apr_poll
- * on Windows it returns APR_EBADF instead. So just return APR_ENOTIMPL
- * ourselves here.
- */
-#ifdef WIN32
- return APR_ENOTIMPL;
-#endif /* WIN32 */
-
pollset.desc_type = APR_POLL_FILE;
pollset.desc.f = f;
pollset.p = pool;
@@ -72,6 +64,14 @@ static apr_status_t wait_for_input(apr_f
return APR_SUCCESS;
return srv;
+#else
+ /* APR specs say things that are unimplemented are supposed to return
+ * APR_ENOTIMPL. But when trying to use APR_POLL_FILE with apr_poll
+ * on Windows it returns APR_EBADF instead. So just return APR_ENOTIMPL
+ * ourselves here.
+ */
+ return APR_ENOTIMPL;
+#endif
}
/* Set @a *result to the result of prompting the user with @a
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/properties.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/properties.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/properties.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/properties.c Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* properties.c: stuff related to Subversion properties
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/quoprint.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/quoprint.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/quoprint.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/quoprint.c Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* quoprint.c: quoted-printable encoding and decoding functions
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/sha1.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/sha1.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/sha1.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/sha1.c Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* sha1.c: SHA1 checksum routines
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/sha1.h
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/sha1.h?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/sha1.h (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/sha1.h Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* sha1.h: Converting and comparing SHA1 checksums
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/simple_providers.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/simple_providers.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/simple_providers.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/simple_providers.c Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* simple_providers.c: providers for SVN_AUTH_CRED_SIMPLE
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/skel.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/skel.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/skel.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/skel.c Tue Aug 10 17:03:06 2010
@@ -1,10 +1,10 @@
/* skel.c --- parsing and unparsing skeletons
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
@@ -658,7 +658,7 @@ apr_int64_t svn_skel__parse_int(const sv
svn_error_t *
svn_skel__parse_proplist(apr_hash_t **proplist_p,
const svn_skel_t *skel,
- apr_pool_t *pool)
+ apr_pool_t *pool /* result_pool */)
{
apr_hash_t *proplist = NULL;
svn_skel_t *elt;
@@ -668,8 +668,7 @@ svn_skel__parse_proplist(apr_hash_t **pr
return skel_err("proplist");
/* Create the returned structure */
- if (skel->children)
- proplist = apr_hash_make(pool);
+ proplist = apr_hash_make(pool);
for (elt = skel->children; elt; elt = elt->next->next)
{
svn_string_t *value = svn_string_ncreate(elt->next->data,
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/sorts.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/sorts.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/sorts.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/sorts.c Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* sorts.c: all sorts of sorts
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/sqlite.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/sqlite.c Tue Aug 10 17:03:06 2010
@@ -1,10 +1,10 @@
/* sqlite.c
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
@@ -36,6 +36,9 @@
#include "private/svn_skel.h"
#include "private/svn_token.h"
+#ifdef SQLITE3_DEBUG
+#include "private/svn_debug.h"
+#endif
#ifdef SVN_SQLITE_INLINE
/* Include sqlite3 inline, making all symbols private. */
@@ -69,6 +72,7 @@ struct svn_sqlite__stmt_t
{
sqlite3_stmt *s3stmt;
svn_sqlite__db_t *db;
+ svn_boolean_t needs_reset;
};
@@ -125,6 +129,10 @@ svn_sqlite__get_statement(svn_sqlite__st
db->result_pool));
*stmt = db->prepared_stmts[stmt_idx];
+
+ if ((*stmt)->needs_reset);
+ return svn_error_return(svn_sqlite__reset(*stmt));
+
return SVN_NO_ERROR;
}
@@ -134,6 +142,7 @@ svn_sqlite__prepare(svn_sqlite__stmt_t *
{
*stmt = apr_palloc(result_pool, sizeof(**stmt));
(*stmt)->db = db;
+ (*stmt)->needs_reset = FALSE;
SQLITE_ERR(sqlite3_prepare_v2(db->db3, text, -1, &(*stmt)->s3stmt, NULL), db);
@@ -188,6 +197,7 @@ svn_sqlite__step(svn_boolean_t *got_row,
}
*got_row = (sqlite_result == SQLITE_ROW);
+ stmt->needs_reset = TRUE;
return SVN_NO_ERROR;
}
@@ -204,6 +214,18 @@ svn_sqlite__insert(apr_int64_t *row_id,
return svn_error_return(svn_sqlite__reset(stmt));
}
+svn_error_t *
+svn_sqlite__update(int *affected_rows, svn_sqlite__stmt_t *stmt)
+{
+ SVN_ERR(step_with_expectation(stmt, FALSE));
+
+ if (affected_rows)
+ *affected_rows = sqlite3_changes(stmt->db->db3);
+
+ return svn_error_return(svn_sqlite__reset(stmt));
+}
+
+
static svn_error_t *
vbindf(svn_sqlite__stmt_t *stmt, const char *fmt, va_list ap)
{
@@ -430,10 +452,11 @@ svn_sqlite__column_properties(apr_hash_t
return SVN_NO_ERROR;
}
- return svn_error_return(svn_skel__parse_proplist(
- props,
- svn_skel__parse(val, len, scratch_pool),
- result_pool));
+ SVN_ERR(svn_skel__parse_proplist(props,
+ svn_skel__parse(val, len, scratch_pool),
+ result_pool));
+
+ return SVN_NO_ERROR;
}
svn_error_t *
@@ -471,6 +494,7 @@ svn_sqlite__reset(svn_sqlite__stmt_t *st
{
SQLITE_ERR(sqlite3_reset(stmt->s3stmt), stmt->db);
SQLITE_ERR(sqlite3_clear_bindings(stmt->s3stmt), stmt->db);
+ stmt->needs_reset = FALSE;
return SVN_NO_ERROR;
}
@@ -600,7 +624,7 @@ svn_sqlite__read_schema_version(int *ver
static svn_error_t *
check_format(svn_sqlite__db_t *db,
int latest_schema,
- const char * const *upgrade_sql,
+ const char * const *upgrade_sql,
apr_pool_t *scratch_pool)
{
int current_schema;
@@ -850,7 +874,7 @@ svn_sqlite__open(svn_sqlite__db_t **db,
sqlite3_trace((*db)->db3, sqlite_tracer, (*db)->db3);
#endif
- SVN_ERR(exec_sql(*db,
+ SVN_ERR(exec_sql(*db,
"PRAGMA case_sensitive_like=1;"
/* Disable synchronization to disable the explicit disk flushes
that make Sqlite up to 50 times slower; especially on small
@@ -866,6 +890,13 @@ svn_sqlite__open(svn_sqlite__db_t **db,
scopes */
"PRAGMA synchronous=OFF;"));
+#if SQLITE_VERSION_AT_LEAST(3,6,19) && defined(SVN_DEBUG)
+ /* When running in debug mode, enable the checking of foreign key
+ constraints. This has possible performance implications, so we don't
+ bother to do it for production...for now. */
+ SVN_ERR(exec_sql(*db, "PRAGMA foreign_keys=ON;"));
+#endif
+
/* Validate the schema, upgrading if necessary. */
SVN_ERR(check_format(*db, latest_schema, upgrade_sql, scratch_pool));
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/ssl_client_cert_providers.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/ssl_client_cert_providers.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/ssl_client_cert_providers.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/ssl_client_cert_providers.c Tue Aug 10 17:03:06 2010
@@ -3,10 +3,10 @@
* SVN_AUTH_CRED_SSL_CLIENT_CERT
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/ssl_client_cert_pw_providers.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/ssl_client_cert_pw_providers.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/ssl_client_cert_pw_providers.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/ssl_client_cert_pw_providers.c Tue Aug 10 17:03:06 2010
@@ -3,10 +3,10 @@
* SVN_AUTH_CRED_SSL_CLIENT_CERT_PW
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/ssl_server_trust_providers.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/ssl_server_trust_providers.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/ssl_server_trust_providers.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/ssl_server_trust_providers.c Tue Aug 10 17:03:06 2010
@@ -3,10 +3,10 @@
* SVN_AUTH_CRED_SSL_SERVER_TRUST
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/stream.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/stream.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/stream.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/stream.c Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* stream.c: svn_stream operations
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
@@ -42,6 +42,7 @@
#include "svn_utf.h"
#include "svn_checksum.h"
#include "svn_path.h"
+#include "private/svn_eol_private.h"
struct svn_stream_t {
@@ -50,10 +51,19 @@ struct svn_stream_t {
svn_write_fn_t write_fn;
svn_close_fn_t close_fn;
svn_io_reset_fn_t reset_fn;
+ svn_io_mark_fn_t mark_fn;
+ svn_io_seek_fn_t seek_fn;
svn_io_line_filter_cb_t line_filter_cb;
svn_io_line_transformer_cb_t line_transformer_cb;
};
+/* A type which represents a mark on a stream. */
+struct svn_stream_mark_t {
+ union {
+ apr_off_t apr;
+ apr_size_t stringbuf;
+ } m;
+};
/*** Generic streams. ***/
@@ -67,8 +77,10 @@ svn_stream_create(void *baton, apr_pool_
stream->baton = baton;
stream->read_fn = NULL;
stream->write_fn = NULL;
- stream->reset_fn = NULL;
stream->close_fn = NULL;
+ stream->reset_fn = NULL;
+ stream->mark_fn = NULL;
+ stream->seek_fn = NULL;
stream->line_filter_cb = NULL;
stream->line_transformer_cb = NULL;
return stream;
@@ -96,15 +108,27 @@ svn_stream_set_write(svn_stream_t *strea
}
void
+svn_stream_set_close(svn_stream_t *stream, svn_close_fn_t close_fn)
+{
+ stream->close_fn = close_fn;
+}
+
+void
svn_stream_set_reset(svn_stream_t *stream, svn_io_reset_fn_t reset_fn)
{
stream->reset_fn = reset_fn;
}
void
-svn_stream_set_close(svn_stream_t *stream, svn_close_fn_t close_fn)
+svn_stream_set_mark(svn_stream_t *stream, svn_io_mark_fn_t mark_fn)
{
- stream->close_fn = close_fn;
+ stream->mark_fn = mark_fn;
+}
+
+void
+svn_stream_set_seek(svn_stream_t *stream, svn_io_seek_fn_t seek_fn)
+{
+ stream->seek_fn = seek_fn;
}
void
@@ -147,6 +171,24 @@ svn_stream_reset(svn_stream_t *stream)
return stream->reset_fn(stream->baton);
}
+svn_error_t *
+svn_stream_mark(svn_stream_t *stream, svn_stream_mark_t **mark,
+ apr_pool_t *pool)
+{
+ if (stream->mark_fn == NULL)
+ return svn_error_create(SVN_ERR_STREAM_SEEK_NOT_SUPPORTED, NULL, NULL);
+
+ return stream->mark_fn(stream->baton, mark, pool);
+}
+
+svn_error_t *
+svn_stream_seek(svn_stream_t *stream, svn_stream_mark_t *mark)
+{
+ if (stream->seek_fn == NULL)
+ return svn_error_create(SVN_ERR_STREAM_SEEK_NOT_SUPPORTED, NULL, NULL);
+
+ return stream->seek_fn(stream->baton, mark);
+}
svn_error_t *
svn_stream_close(svn_stream_t *stream)
@@ -238,16 +280,55 @@ line_transformer(svn_stream_t *stream, s
return SVN_NO_ERROR;
}
-svn_error_t *
-svn_stream_readline(svn_stream_t *stream,
- svn_stringbuf_t **stringbuf,
- const char *eol,
- svn_boolean_t *eof,
- apr_pool_t *pool)
+/* Scan STREAM for an end-of-line indicatior, and return it in *EOL.
+ * Set *EOL to NULL if the stream runs out before an end-of-line indicator
+ * is found. */
+static svn_error_t *
+scan_eol(const char **eol, svn_stream_t *stream, apr_pool_t *pool)
+{
+ const char *eol_str;
+ svn_stream_mark_t *mark;
+
+ SVN_ERR(svn_stream_mark(stream, &mark, pool));
+
+ eol_str = NULL;
+ while (! eol_str)
+ {
+ char buf[512];
+ apr_size_t len;
+
+ len = sizeof(buf);
+ SVN_ERR(svn_stream_read(stream, buf, &len));
+ if (len == 0)
+ break; /* EOF */
+ eol_str = svn_eol__detect_eol(buf, buf + len);
+ }
+
+ SVN_ERR(svn_stream_seek(stream, mark));
+
+ *eol = eol_str;
+
+ return SVN_NO_ERROR;
+}
+
+/* Guts of svn_stream_readline() and svn_stream_readline_detect_eol().
+ * Returns the line read from STREAM in *STRINGBUF, and indicates
+ * end-of-file in *EOF. If DETECT_EOL is TRUE, the end-of-line indicator
+ * is detected automatically and returned in *EOL.
+ * If DETECT_EOL is FALSE, *EOL must point to the desired end-of-line
+ * indicator. STRINGBUF is allocated in POOL. */
+static svn_error_t *
+stream_readline(svn_stringbuf_t **stringbuf,
+ svn_boolean_t *eof,
+ const char **eol,
+ svn_stream_t *stream,
+ svn_boolean_t detect_eol,
+ apr_pool_t *pool)
{
svn_stringbuf_t *str;
apr_pool_t *iterpool;
svn_boolean_t filtered;
+ const char *eol_str;
*eof = FALSE;
@@ -266,8 +347,22 @@ svn_stream_readline(svn_stream_t *stream
80 chars. */
str = svn_stringbuf_create_ensure(80, iterpool);
+ if (detect_eol)
+ {
+ SVN_ERR(scan_eol(&eol_str, stream, iterpool));
+ if (eol)
+ *eol = eol_str;
+ if (! eol_str)
+ {
+ /* No newline until EOF, EOL_STR can be anything. */
+ eol_str = APR_EOL_STR;
+ }
+ }
+ else
+ eol_str = *eol;
+
/* Read into STR up to and including the next EOL sequence. */
- match = eol;
+ match = eol_str;
while (*match)
{
numbytes = 1;
@@ -278,7 +373,7 @@ svn_stream_readline(svn_stream_t *stream
*eof = TRUE;
/* We know we don't have a whole EOL sequence, but ensure we
* don't chop off any partial EOL sequence that we may have. */
- match = eol;
+ match = eol_str;
/* Process this short (or empty) line just like any other
* except with *EOF set. */
break;
@@ -287,12 +382,12 @@ svn_stream_readline(svn_stream_t *stream
if (c == *match)
match++;
else
- match = eol;
+ match = eol_str;
svn_stringbuf_appendbytes(str, &c, 1);
}
- svn_stringbuf_chop(str, match - eol);
+ svn_stringbuf_chop(str, match - eol_str);
SVN_ERR(line_filter(stream, &filtered, str->data, iterpool));
}
@@ -308,11 +403,33 @@ svn_stream_readline(svn_stream_t *stream
*stringbuf = svn_stringbuf_dup(str, pool);
/* Done. RIP iterpool. */
- svn_pool_destroy(iterpool);
+ svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
}
+svn_error_t *
+svn_stream_readline(svn_stream_t *stream,
+ svn_stringbuf_t **stringbuf,
+ const char *eol,
+ svn_boolean_t *eof,
+ apr_pool_t *pool)
+{
+ return svn_error_return(stream_readline(stringbuf, eof, &eol, stream,
+ FALSE, pool));
+}
+
+svn_error_t *
+svn_stream_readline_detect_eol(svn_stream_t *stream,
+ svn_stringbuf_t **stringbuf,
+ const char **eol,
+ svn_boolean_t *eof,
+ apr_pool_t *pool)
+{
+ return svn_error_return(stream_readline(stringbuf, eof, eol, stream,
+ TRUE, pool));
+}
+
svn_error_t *svn_stream_copy3(svn_stream_t *from, svn_stream_t *to,
svn_cancel_func_t cancel_func,
@@ -336,18 +453,18 @@ svn_error_t *svn_stream_copy3(svn_stream
if (err)
break;
}
-
+
err = svn_stream_read(from, buf, &len);
if (err)
break;
-
+
if (len > 0)
err = svn_stream_write(to, buf, &len);
if (err || (len != SVN__STREAM_CHUNK_SIZE))
break;
}
-
+
err2 = svn_error_compose_create(svn_stream_close(from),
svn_stream_close(to));
@@ -407,6 +524,18 @@ reset_handler_empty(void *baton)
return SVN_NO_ERROR;
}
+static svn_error_t *
+mark_handler_empty(void *baton, svn_stream_mark_t **mark, apr_pool_t *pool)
+{
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+seek_handler_empty(void *baton, svn_stream_mark_t *mark)
+{
+ return SVN_NO_ERROR;
+}
+
svn_stream_t *
svn_stream_empty(apr_pool_t *pool)
@@ -417,10 +546,68 @@ svn_stream_empty(apr_pool_t *pool)
svn_stream_set_read(stream, read_handler_empty);
svn_stream_set_write(stream, write_handler_empty);
svn_stream_set_reset(stream, reset_handler_empty);
+ svn_stream_set_mark(stream, mark_handler_empty);
+ svn_stream_set_seek(stream, seek_handler_empty);
return stream;
}
+
+/*** Stream duplication support ***/
+struct baton_tee {
+ svn_stream_t *out1;
+ svn_stream_t *out2;
+};
+
+
+static svn_error_t *
+write_handler_tee(void *baton, const char *data, apr_size_t *len)
+{
+ struct baton_tee *bt = baton;
+
+ SVN_ERR(svn_stream_write(bt->out1, data, len));
+ SVN_ERR(svn_stream_write(bt->out2, data, len));
+
+ return SVN_NO_ERROR;
+}
+
+
+static svn_error_t *
+close_handler_tee(void *baton)
+{
+ struct baton_tee *bt = baton;
+
+ SVN_ERR(svn_stream_close(bt->out1));
+ SVN_ERR(svn_stream_close(bt->out2));
+
+ return SVN_NO_ERROR;
+}
+
+
+svn_stream_t *
+svn_stream_tee(svn_stream_t *out1,
+ svn_stream_t *out2,
+ apr_pool_t *pool)
+{
+ struct baton_tee *baton;
+ svn_stream_t *stream;
+
+ if (out1 == NULL)
+ return out2;
+
+ if (out2 == NULL)
+ return out1;
+
+ baton = apr_palloc(pool, sizeof(*baton));
+ baton->out1 = out1;
+ baton->out2 = out2;
+ stream = svn_stream_create(baton, pool);
+ svn_stream_set_write(stream, write_handler_tee);
+ svn_stream_set_close(stream, close_handler_tee);
+
+ return stream;
+}
+
/*** Ownership detaching stream ***/
@@ -443,6 +630,17 @@ reset_handler_disown(void *baton)
return svn_stream_reset(baton);
}
+static svn_error_t *
+mark_handler_disown(void *baton, svn_stream_mark_t **mark, apr_pool_t *pool)
+{
+ return svn_stream_mark(baton, mark, pool);
+}
+
+static svn_error_t *
+seek_handler_disown(void *baton, svn_stream_mark_t *mark)
+{
+ return svn_stream_seek(baton, mark);
+}
svn_stream_t *
svn_stream_disown(svn_stream_t *stream, apr_pool_t *pool)
@@ -452,6 +650,8 @@ svn_stream_disown(svn_stream_t *stream,
svn_stream_set_read(s, read_handler_disown);
svn_stream_set_write(s, write_handler_disown);
svn_stream_set_reset(s, reset_handler_disown);
+ svn_stream_set_mark(s, mark_handler_disown);
+ svn_stream_set_seek(s, seek_handler_disown);
return s;
}
@@ -481,7 +681,7 @@ read_handler_apr(void *baton, char *buff
{
/* Get the current file position and make sure it is in range. */
apr_off_t pos;
-
+
pos = 0;
SVN_ERR(svn_io_file_seek(btn->file, APR_CUR, &pos, btn->pool));
if (pos < btn->start)
@@ -501,7 +701,7 @@ read_handler_apr(void *baton, char *buff
{
/* We're in range, but don't read over the end of the range. */
if (pos + *len > btn->end)
- *len = btn->end - pos;
+ *len = btn->end - pos;
}
}
@@ -515,7 +715,6 @@ read_handler_apr(void *baton, char *buff
return err;
}
-
static svn_error_t *
write_handler_apr(void *baton, const char *data, apr_size_t *len)
{
@@ -525,6 +724,14 @@ write_handler_apr(void *baton, const cha
}
static svn_error_t *
+close_handler_apr(void *baton)
+{
+ struct baton_apr *btn = baton;
+
+ return svn_io_file_close(btn->file, btn->pool);
+}
+
+static svn_error_t *
reset_handler_apr(void *baton)
{
apr_off_t offset;
@@ -538,13 +745,22 @@ reset_handler_apr(void *baton)
}
static svn_error_t *
-close_handler_apr(void *baton)
+mark_handler_apr(void *baton, svn_stream_mark_t **mark, apr_pool_t *pool)
{
struct baton_apr *btn = baton;
-
- return svn_io_file_close(btn->file, btn->pool);
+ (*mark) = apr_palloc(pool, sizeof(**mark));
+ (*mark)->m.apr = 0;
+ SVN_ERR(svn_io_file_seek(btn->file, APR_CUR, &(*mark)->m.apr, btn->pool));
+ return SVN_NO_ERROR;
}
+static svn_error_t *
+seek_handler_apr(void *baton, svn_stream_mark_t *mark)
+{
+ struct baton_apr *btn = baton;
+ SVN_ERR(svn_io_file_seek(btn->file, APR_SET, &mark->m.apr, btn->pool));
+ return SVN_NO_ERROR;
+}
svn_error_t *
svn_stream_open_readonly(svn_stream_t **stream,
@@ -621,6 +837,8 @@ svn_stream_from_aprfile2(apr_file_t *fil
svn_stream_set_read(stream, read_handler_apr);
svn_stream_set_write(stream, write_handler_apr);
svn_stream_set_reset(stream, reset_handler_apr);
+ svn_stream_set_mark(stream, mark_handler_apr);
+ svn_stream_set_seek(stream, seek_handler_apr);
if (! disown)
svn_stream_set_close(stream, close_handler_apr);
@@ -661,6 +879,8 @@ svn_stream_from_aprfile_range_readonly(a
stream = svn_stream_create(baton, pool);
svn_stream_set_read(stream, read_handler_apr);
svn_stream_set_reset(stream, reset_handler_apr);
+ svn_stream_set_mark(stream, mark_handler_apr);
+ svn_stream_set_seek(stream, seek_handler_apr);
if (! disown)
svn_stream_set_close(stream, close_handler_apr);
@@ -1189,6 +1409,23 @@ reset_handler_stringbuf(void *baton)
return SVN_NO_ERROR;
}
+static svn_error_t *
+mark_handler_stringbuf(void *baton, svn_stream_mark_t **mark, apr_pool_t *pool)
+{
+ struct stringbuf_stream_baton *btn = baton;
+ (*mark) = apr_palloc(pool, sizeof(**mark));
+ (*mark)->m.stringbuf = btn->amt_read;
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+seek_handler_stringbuf(void *baton, svn_stream_mark_t *mark)
+{
+ struct stringbuf_stream_baton *btn = baton;
+ btn->amt_read = mark->m.stringbuf;
+ return SVN_NO_ERROR;
+}
+
svn_stream_t *
svn_stream_from_stringbuf(svn_stringbuf_t *str,
apr_pool_t *pool)
@@ -1206,6 +1443,8 @@ svn_stream_from_stringbuf(svn_stringbuf_
svn_stream_set_read(stream, read_handler_stringbuf);
svn_stream_set_write(stream, write_handler_stringbuf);
svn_stream_set_reset(stream, reset_handler_stringbuf);
+ svn_stream_set_mark(stream, mark_handler_stringbuf);
+ svn_stream_set_seek(stream, seek_handler_stringbuf);
return stream;
}
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/subst.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/subst.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/subst.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/subst.c Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* subst.c : generic eol/keyword substitution routines
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
@@ -1420,16 +1420,17 @@ svn_subst_copy_and_translate3(const char
SVN_ERR(svn_stream_open_readonly(&src_stream, src, pool, pool));
}
- return create_special_file_from_stream(src_stream, dst, pool);
+ return svn_error_return(create_special_file_from_stream(src_stream,
+ dst, pool));
}
/* else !expand */
- return detranslate_special_file(src, dst, pool);
+ return svn_error_return(detranslate_special_file(src, dst, pool));
}
/* The easy way out: no translation needed, just copy. */
if (! (eol_str || (keywords && (apr_hash_count(keywords) > 0))))
- return svn_io_copy_file(src, dst, FALSE, pool);
+ return svn_error_return(svn_io_copy_file(src, dst, FALSE, pool));
/* Open source file. */
SVN_ERR(svn_stream_open_readonly(&src_stream, src, pool, pool));
@@ -1457,7 +1458,7 @@ svn_subst_copy_and_translate3(const char
}
/* Now that dst_tmp contains the translated data, do the atomic rename. */
- return svn_io_file_rename(dst_tmp, dst, pool);
+ return svn_error_return(svn_io_file_rename(dst_tmp, dst, pool));
}
@@ -1613,7 +1614,7 @@ svn_subst_translate_string(svn_string_t
NULL, /* no keywords */
FALSE, /* no expansion */
scratch_pool));
-
+
*new_value = svn_string_create(val_utf8_lf, pool);
svn_pool_destroy(scratch_pool);
return SVN_NO_ERROR;
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/svn_base64.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/svn_base64.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/svn_base64.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/svn_base64.c Tue Aug 10 17:03:06 2010
@@ -2,10 +2,10 @@
* base64.c: base64 encoding and decoding functions
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/svn_string.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/svn_string.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/svn_string.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/svn_string.c Tue Aug 10 17:03:06 2010
@@ -4,10 +4,10 @@
*
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/target.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/target.c?rev=984122&r1=984121&r2=984122&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/target.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/target.c Tue Aug 10 17:03:06 2010
@@ -3,10 +3,10 @@
* a subversion subcommand.
*
* ====================================================================
- * Licensed to the Subversion Corporation (SVN Corp.) under one
+ * Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
- * regarding copyright ownership. The SVN Corp. licenses this file
+ * regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at