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 22:56:05 UTC
svn commit: r984206 [11/35] - in /subversion/branches/ignore-mergeinfo: ./
build/ build/generator/ build/generator/templates/ build/hudson/
build/hudson/jobs/subversion-1.6.x-solaris/
build/hudson/jobs/subversion-1.6.x-ubuntu/ build/hudson/jobs/subvers...
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_base/revs-txns.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_base/revs-txns.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_base/revs-txns.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_base/revs-txns.c Tue Aug 10 20:55:56 2010
@@ -992,7 +992,8 @@ txn_body_cleanup_txn(void *baton, trail_
static svn_error_t *
txn_body_cleanup_txn_copy(void *baton, trail_t *trail)
{
- svn_error_t *err = svn_fs_bdb__delete_copy(trail->fs, baton, trail,
+ const char *copy_id = *(const char **)baton;
+ svn_error_t *err = svn_fs_bdb__delete_copy(trail->fs, copy_id, trail,
trail->pool);
/* Copy doesn't exist? No sweat. */
@@ -1008,7 +1009,9 @@ txn_body_cleanup_txn_copy(void *baton, t
static svn_error_t *
txn_body_cleanup_txn_changes(void *baton, trail_t *trail)
{
- return svn_fs_bdb__changes_delete(trail->fs, baton, trail, trail->pool);
+ const char *key = *(const char **)baton;
+
+ return svn_fs_bdb__changes_delete(trail->fs, key, trail, trail->pool);
}
@@ -1122,7 +1125,9 @@ delete_txn_tree(svn_fs_t *fs,
static svn_error_t *
txn_body_delete_txn(void *baton, trail_t *trail)
{
- return svn_fs_bdb__delete_txn(trail->fs, baton, trail, trail->pool);
+ const char *txn_id = *(const char **)baton;
+
+ return svn_fs_bdb__delete_txn(trail->fs, txn_id, trail, trail->pool);
}
@@ -1151,7 +1156,7 @@ svn_fs_base__purge_txn(svn_fs_t *fs,
/* Kill the transaction's changes (which should gracefully recover
if...). */
SVN_ERR(svn_fs_base__retry_txn(fs, txn_body_cleanup_txn_changes,
- (void *)txn_id, TRUE, pool));
+ &txn_id, TRUE, pool));
/* Kill the transaction's copies (which should gracefully...). */
if (txn->copies)
@@ -1160,14 +1165,14 @@ svn_fs_base__purge_txn(svn_fs_t *fs,
{
SVN_ERR(svn_fs_base__retry_txn
(fs, txn_body_cleanup_txn_copy,
- (void *)APR_ARRAY_IDX(txn->copies, i, const char *),
+ &APR_ARRAY_IDX(txn->copies, i, const char *),
TRUE, pool));
}
}
/* Kill the transaction itself (which ... just kidding -- this has
no graceful failure mode). */
- return svn_fs_base__retry_txn(fs, txn_body_delete_txn, (void *)txn_id,
+ return svn_fs_base__retry_txn(fs, txn_body_delete_txn, &txn_id,
TRUE, pool);
}
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_base/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_base/tree.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_base/tree.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_base/tree.c Tue Aug 10 20:55:56 2010
@@ -664,7 +664,6 @@ open_path(parent_path_t **parent_path_p,
apr_pool_t *pool)
{
svn_fs_t *fs = root->fs;
- const svn_fs_id_t *id;
dag_node_t *here; /* The directory we're currently looking at. */
parent_path_t *parent_path; /* The path from HERE up to the root. */
const char *rest; /* The portion of PATH we haven't traversed yet. */
@@ -674,7 +673,6 @@ open_path(parent_path_t **parent_path_p,
/* Make a parent_path item for the root node, using its own current
copy id. */
SVN_ERR(root_node(&here, root, trail, pool));
- id = svn_fs_base__dag_get_id(here);
parent_path = make_parent_path(here, 0, 0, pool);
parent_path->copy_inherit = copy_id_inherit_self;
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_fs/fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_fs/fs.h?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_fs/fs.h (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_fs/fs.h Tue Aug 10 20:55:56 2010
@@ -30,6 +30,7 @@
#include "svn_fs.h"
#include "svn_config.h"
+#include "private/svn_atomic.h"
#include "private/svn_cache.h"
#include "private/svn_fs_private.h"
#include "private/svn_sqlite.h"
@@ -118,12 +119,12 @@ extern "C" {
/* The minimum format number that supports packed shards. */
#define SVN_FS_FS__MIN_PACKED_FORMAT 4
- /* The minimum format number that supports packed revprop shards. */
-#define SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT 5
-
/* The minimum format number that stores node kinds in changed-paths lists. */
#define SVN_FS_FS__MIN_KIND_IN_CHANGED_FORMAT 4
+/* The minimum format number that supports packed revprop shards. */
+#define SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT 5
+
/* Private FSFS-specific data shared between all svn_txn_t objects that
relate to a particular transaction in a filesystem (as identified
by transaction id and filesystem UUID). Objects of this type are
@@ -245,6 +246,9 @@ typedef struct
/* The sqlite database used for rep caching. */
svn_sqlite__db_t *rep_cache_db;
+ /* Thread-safe boolean */
+ svn_atomic_t rep_cache_db_opened;
+
/* The sqlite database used for revprops. */
svn_sqlite__db_t *revprop_db;
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_fs/fs_fs.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_fs/fs_fs.c Tue Aug 10 20:55:56 2010
@@ -1498,6 +1498,14 @@ svn_fs_fs__hotcopy(const char *src_path,
/* Copy the config. */
SVN_ERR(svn_io_dir_file_copy(src_path, dst_path, PATH_CONFIG, pool));
+ /* Copy the rep cache before copying the rev files to make sure all
+ cached references will be present in the copy. */
+ src_subdir = svn_dirent_join(src_path, REP_CACHE_DB_NAME, pool);
+ dst_subdir = svn_dirent_join(dst_path, REP_CACHE_DB_NAME, pool);
+ SVN_ERR(svn_io_check_path(src_subdir, &kind, pool));
+ if (kind == svn_node_file)
+ SVN_ERR(svn_sqlite__hotcopy(src_subdir, dst_subdir, pool));
+
/* Copy the min unpacked rev, and read its value. */
if (format >= SVN_FS_FS__MIN_PACKED_FORMAT)
{
@@ -1597,8 +1605,11 @@ svn_fs_fs__hotcopy(const char *src_path,
/* Copy the packed revprop db. */
if (format >= SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT)
{
- SVN_ERR(svn_io_dir_file_copy(src_subdir, dst_subdir, PATH_REVPROPS_DB,
- pool));
+ const char *src_file = svn_dirent_join(src_subdir, PATH_REVPROPS_DB,
+ pool);
+ const char *dst_file = svn_dirent_join(dst_subdir, PATH_REVPROPS_DB,
+ pool);
+ SVN_ERR(svn_sqlite__hotcopy(src_file, dst_file, pool));
}
for (rev = min_unpacked_revprop; rev <= youngest; rev++)
@@ -1658,12 +1669,6 @@ svn_fs_fs__hotcopy(const char *src_path,
PATH_NODE_ORIGINS_DIR, TRUE, NULL,
NULL, pool));
- /* Now copy the rep cache. */
- src_subdir = svn_dirent_join(src_path, REP_CACHE_DB_NAME, pool);
- SVN_ERR(svn_io_check_path(src_subdir, &kind, pool));
- if (kind == svn_node_file)
- SVN_ERR(svn_io_dir_file_copy(src_path, dst_path, REP_CACHE_DB_NAME, pool));
-
/* Copy the txn-current file. */
if (format >= SVN_FS_FS__MIN_TXN_CURRENT_FORMAT)
SVN_ERR(svn_io_dir_file_copy(src_path, dst_path, PATH_TXN_CURRENT, pool));
@@ -3823,16 +3828,13 @@ fold_change(apr_hash_t *changes,
{
apr_pool_t *pool = apr_hash_pool_get(changes);
svn_fs_path_change2_t *old_change, *new_change;
- const char *path = NULL;
+ const char *path;
if ((old_change = apr_hash_get(changes, change->path, APR_HASH_KEY_STRING)))
{
/* This path already exists in the hash, so we have to merge
this change into the already existing one. */
- /* Since the path already exists in the hash, we don't have to
- dup the allocation for the path itself. */
- path = change->path;
/* Sanity check: only allow NULL node revision ID in the
`reset' case. */
if ((! change->noderev_id) && (change->kind != svn_fs_path_change_reset))
@@ -3955,13 +3957,18 @@ fold_change(apr_hash_t *changes,
new_change->copyfrom_rev = SVN_INVALID_REVNUM;
new_change->copyfrom_path = NULL;
}
- path = apr_pstrdup(pool, change->path);
}
if (new_change)
new_change->node_kind = change->node_kind;
- /* Add (or update) this path. */
+ /* Add (or update) this path.
+
+ Note: this key might already be present, and it would be nice to
+ re-use its value, but there is no way to fetch it. The API makes no
+ guarantees that this (new) key will not be retained. Thus, we (again)
+ copy the key into the target pool to ensure a proper lifetime. */
+ path = apr_pstrdup(pool, change->path);
apr_hash_set(changes, path, APR_HASH_KEY_STRING, new_change);
/* Update the copyfrom cache, if any. */
@@ -6329,7 +6336,7 @@ svn_fs_fs__create(svn_fs_t *fs,
fs_fs_data_t *ffd = fs->fsap_data;
fs->path = apr_pstrdup(pool, path);
- /* See if we had an explicitly requested pre-1.4- or pre-1.5-compatible. */
+ /* See if compatibility with older versions was explicitly requested. */
if (fs->config)
{
if (apr_hash_get(fs->config, SVN_FS_CONFIG_PRE_1_4_COMPATIBLE,
@@ -6341,6 +6348,9 @@ svn_fs_fs__create(svn_fs_t *fs,
else if (apr_hash_get(fs->config, SVN_FS_CONFIG_PRE_1_6_COMPATIBLE,
APR_HASH_KEY_STRING))
format = 3;
+ else if (apr_hash_get(fs->config, SVN_FS_CONFIG_PRE_1_7_COMPATIBLE,
+ APR_HASH_KEY_STRING))
+ format = 4;
}
ffd->format = format;
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_fs/rep-cache.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_fs/rep-cache.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_fs/rep-cache.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_fs/rep-cache.c Tue Aug 10 20:55:56 2010
@@ -38,18 +38,15 @@
REP_CACHE_DB_SQL_DECLARE_STATEMENTS(statements);
-svn_error_t *
-svn_fs_fs__open_rep_cache(svn_fs_t *fs,
- apr_pool_t *pool)
+static svn_error_t *
+open_rep_cache(void *baton,
+ apr_pool_t *pool)
{
+ svn_fs_t *fs = baton;
fs_fs_data_t *ffd = fs->fsap_data;
const char *db_path;
int version;
- /* Be idempotent. */
- if (ffd->rep_cache_db)
- return SVN_NO_ERROR;
-
/* Open (or create) the sqlite database. It will be automatically
closed when fs->pool is destoyed. */
db_path = svn_dirent_join(fs->path, REP_CACHE_DB_NAME, pool);
@@ -71,6 +68,15 @@ svn_fs_fs__open_rep_cache(svn_fs_t *fs,
}
svn_error_t *
+svn_fs_fs__open_rep_cache(svn_fs_t *fs,
+ apr_pool_t *pool)
+{
+ fs_fs_data_t *ffd = fs->fsap_data;
+ return svn_error_return(svn_atomic__init_once(&ffd->rep_cache_db_opened,
+ open_rep_cache, fs, pool));
+}
+
+svn_error_t *
svn_fs_fs__get_rep_reference(representation_t **rep,
svn_fs_t *fs,
svn_checksum_t *checksum,
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_fs/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_fs/tree.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_fs_fs/tree.c Tue Aug 10 20:55:56 2010
@@ -589,7 +589,6 @@ open_path(parent_path_t **parent_path_p,
apr_pool_t *pool)
{
svn_fs_t *fs = root->fs;
- const svn_fs_id_t *id;
dag_node_t *here; /* The directory we're currently looking at. */
parent_path_t *parent_path; /* The path from HERE up to the root. */
const char *rest; /* The portion of PATH we haven't traversed yet. */
@@ -599,7 +598,6 @@ open_path(parent_path_t **parent_path_p,
/* Make a parent_path item for the root node, using its own current
copy id. */
SVN_ERR(root_node(&here, root, pool));
- id = svn_fs_fs__dag_get_id(here);
parent_path = make_parent_path(here, 0, 0, pool);
parent_path->copy_inherit = copy_id_inherit_self;
@@ -1573,12 +1571,9 @@ merge_changes(dag_node_t *ancestor_node,
apr_pool_t *pool)
{
dag_node_t *txn_root_node;
- const svn_fs_id_t *source_id;
svn_fs_t *fs = txn->fs;
const char *txn_id = txn->id;
- source_id = svn_fs_fs__dag_get_id(source_node);
-
SVN_ERR(svn_fs_fs__dag_txn_root(&txn_root_node, fs, txn_id, pool));
if (ancestor_node == NULL)
@@ -2132,7 +2127,8 @@ fs_copy(svn_fs_root_t *from_root,
const char *to_path,
apr_pool_t *pool)
{
- return copy_helper(from_root, from_path, to_root, to_path, TRUE, pool);
+ return svn_error_return(copy_helper(from_root, from_path, to_root, to_path,
+ TRUE, pool));
}
@@ -2148,7 +2144,8 @@ fs_revision_link(svn_fs_root_t *from_roo
if (! to_root->is_txn_root)
return SVN_FS__NOT_TXN(to_root);
- return copy_helper(from_root, path, to_root, path, FALSE, pool);
+ return svn_error_return(copy_helper(from_root, path, to_root, path,
+ FALSE, pool));
}
@@ -3132,7 +3129,6 @@ history_prev(void *baton, apr_pool_t *po
parent_path_t *parent_path;
dag_node_t *node;
svn_fs_root_t *root;
- const svn_fs_id_t *node_id;
svn_boolean_t reported = fhd->is_interesting;
svn_boolean_t retry = FALSE;
svn_revnum_t copyroot_rev;
@@ -3161,7 +3157,6 @@ history_prev(void *baton, apr_pool_t *po
goodies. */
SVN_ERR(open_path(&parent_path, root, path, 0, NULL, pool));
node = parent_path->node;
- node_id = svn_fs_fs__dag_get_id(node);
commit_path = svn_fs_fs__dag_get_created_path(node);
SVN_ERR(svn_fs_fs__dag_get_revision(&commit_rev, node, pool));
@@ -3198,7 +3193,6 @@ history_prev(void *baton, apr_pool_t *po
/* Replace NODE and friends with the information from its
predecessor. */
SVN_ERR(svn_fs_fs__dag_get_node(&node, fs, pred_id, pool));
- node_id = svn_fs_fs__dag_get_id(node);
commit_path = svn_fs_fs__dag_get_created_path(node);
SVN_ERR(svn_fs_fs__dag_get_revision(&commit_rev, node, pool));
}
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_ra/compat.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_ra/compat.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_ra/compat.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_ra/compat.c Tue Aug 10 20:55:56 2010
@@ -660,7 +660,6 @@ svn_ra__file_revs_from_log(svn_ra_sessio
struct fr_log_message_baton lmb;
struct rev *rev;
apr_hash_t *last_props;
- const char *last_path;
svn_stream_t *last_stream;
apr_pool_t *currpool, *lastpool;
@@ -705,7 +704,6 @@ svn_ra__file_revs_from_log(svn_ra_sessio
/* We want the first txdelta to be against the empty file. */
last_props = apr_hash_make(lastpool);
- last_path = NULL;
last_stream = svn_stream_empty(lastpool);
/* Walk the revision list in chronological order, downloading each fulltext,
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/lock.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/lock.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/lock.c Tue Aug 10 20:55:56 2010
@@ -300,14 +300,16 @@ do_lock(svn_lock_t **lock,
if (err)
goto cleanup;
+ err = svn_ra_neon__check_parse_error("LOCK", lck_parser, url);
+ if (err)
+ goto cleanup;
+
/*###FIXME: we never verified whether we have received back the type
of lock we requested: was it shared/exclusive? was it write/otherwise?
How many did we get back? Only one? */
err = lock_from_baton(lock, req, fs_path.data, lrb, pool);
cleanup:
- svn_ra_neon__request_destroy(req);
-
/* 405 == Method Not Allowed (Occurs when trying to lock a working
copy path which no longer exists at HEAD in the repository. */
if (code == 405)
@@ -317,6 +319,8 @@ do_lock(svn_lock_t **lock,
_("Lock request failed: %d %s"),
code, req->code_desc);
}
+ svn_ra_neon__request_destroy(req);
+
return err;
}
@@ -548,6 +552,10 @@ svn_ra_neon__get_lock_internal(svn_ra_ne
goto cleanup;
}
+ err = svn_ra_neon__check_parse_error("PROPFIND", lck_parser, url);
+ if (err)
+ goto cleanup;
+
/*###FIXME We assume here we only got one lock response. The WebDAV
spec makes no such guarantees. How to make sure we grab the one we need? */
err = lock_from_baton(lock, req, fs_path.data, lrb, pool);
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/mergeinfo.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/mergeinfo.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/mergeinfo.c Tue Aug 10 20:55:56 2010
@@ -116,12 +116,16 @@ end_element(void *baton, int state, cons
if (mb->curr_info && mb->curr_path)
{
svn_mergeinfo_t path_mergeinfo;
+ const char *path;
SVN_ERR_ASSERT(mb->curr_path->data);
+ path = apr_pstrdup(mb->pool, mb->curr_path->data);
SVN_ERR((mb->err = svn_mergeinfo_parse(&path_mergeinfo,
mb->curr_info->data,
mb->pool)));
- apr_hash_set(mb->catalog, apr_pstrdup(mb->pool, mb->curr_path->data),
+ /* Correct for naughty servers that send "relative" paths
+ with leading slashes! */
+ apr_hash_set(mb->catalog, path[0] == '/' ? path + 1 : path,
APR_HASH_KEY_STRING, path_mergeinfo);
}
}
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/options.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/options.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/options.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/options.c Tue Aug 10 20:55:56 2010
@@ -256,7 +256,6 @@ svn_ra_neon__exchange_capabilities(svn_r
svn_error_t *err = SVN_NO_ERROR;
ne_xml_parser *parser = NULL;
options_ctx_t oc = { 0 };
- const char *msg;
int status_code;
oc.pool = pool;
@@ -285,15 +284,9 @@ svn_ra_neon__exchange_capabilities(svn_r
goto cleanup;
/* Was there an XML parse error somewhere? */
- msg = ne_xml_get_error(parser);
- if (msg && *msg)
- {
- err = svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
- _("The %s request returned invalid XML "
- "in the response: %s (%s)"),
- "OPTIONS", msg, ras->url->data);
- goto cleanup;
- }
+ err = svn_ra_neon__check_parse_error("OPTIONS", parser, ras->url->data);
+ if (err)
+ goto cleanup;
/* We asked for, and therefore expect, to have found an activity
collection in the response. */
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/ra_neon.h
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/ra_neon.h?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/ra_neon.h (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/ra_neon.h Tue Aug 10 20:55:56 2010
@@ -722,6 +722,14 @@ svn_ra_neon__parsed_request(svn_ra_neon_
apr_pool_t *pool);
+/* If XML_PARSER found an XML parse error, then return a Subversion error
+ * saying that the error was found in the response to the DAV request METHOD
+ * for the URL URL. Otherwise, return SVN_NO_ERROR. */
+svn_error_t *
+svn_ra_neon__check_parse_error(const char *method,
+ ne_xml_parser *xml_parser,
+ const char *url);
+
/* ### add SVN_RA_NEON_ to these to prefix conflicts with (sys) headers? */
enum {
/* Redefine Neon elements */
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/session.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/session.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/session.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/session.c Tue Aug 10 20:55:56 2010
@@ -753,7 +753,7 @@ parse_url(ne_uri *uri, const char *url)
/* Initializer function matching the prototype accepted by
svn_atomic__init_once(). */
static svn_error_t *
-initialize_neon(apr_pool_t *ignored_pool)
+initialize_neon(void *baton, apr_pool_t *ignored_pool)
{
if (ne_sock_init() != 0)
return svn_error_create(SVN_ERR_RA_DAV_SOCK_INIT, NULL,
@@ -766,7 +766,7 @@ initialize_neon(apr_pool_t *ignored_pool
static svn_error_t *
ensure_neon_initialized(void)
{
- return svn_atomic__init_once(&neon_initialized, initialize_neon, NULL);
+ return svn_atomic__init_once(&neon_initialized, initialize_neon, NULL, NULL);
}
static svn_error_t *
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/util.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/util.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_neon/util.c Tue Aug 10 20:55:56 2010
@@ -1084,13 +1084,10 @@ wrapper_endelm_cb(void *baton,
return 0;
}
-/* If XML_PARSER found an XML parse error, then return a Subversion error
- * saying that the error was found in the response to the DAV request METHOD
- * for the URL URL. Otherwise, return SVN_NO_ERROR. */
-static svn_error_t *
-check_parse_error(const char *method,
- ne_xml_parser *xml_parser,
- const char *url)
+svn_error_t *
+svn_ra_neon__check_parse_error(const char *method,
+ ne_xml_parser *xml_parser,
+ const char *url)
{
const char *msg = ne_xml_get_error(xml_parser);
if (msg != NULL && *msg != '\0')
@@ -1124,8 +1121,9 @@ wrapper_reader_cb(void *baton, const cha
{
/* Pass XML parser error. */
SVN_RA_NEON__REQ_ERR(pwb->req,
- check_parse_error(pwb->req->method, pwb->parser,
- pwb->req->url));
+ svn_ra_neon__check_parse_error(pwb->req->method,
+ pwb->parser,
+ pwb->req->url));
}
return parser_status;
@@ -1287,7 +1285,7 @@ parsed_request(svn_ra_neon__request_t *r
}
}
- SVN_ERR(check_parse_error(method, success_parser, url));
+ SVN_ERR(svn_ra_neon__check_parse_error(method, success_parser, url));
return SVN_NO_ERROR;
}
@@ -1499,6 +1497,8 @@ svn_ra_neon__request_dispatch(int *code_
/* Any other errors? Report them */
SVN_ERR(req->err);
+ SVN_ERR(svn_ra_neon__check_parse_error(req->method, error_parser, req->url));
+
/* We either have a neon error, or some other error
that we didn't expect. */
return generate_error(req, pool);
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_serf/commit.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_serf/commit.c Tue Aug 10 20:55:56 2010
@@ -1328,6 +1328,12 @@ delete_entry(const char *path,
{
svn_error_clear(err);
+#if SERF_VERSION_AT_LEAST(0, 4, 0)
+ /* An error has been registered on the connection. Reset the thing
+ so that we can use it again. */
+ serf_connection_reset(handler->conn->conn);
+#endif
+
handler->body_delegate = create_delete_body;
handler->body_delegate_baton = delete_ctx;
handler->body_type = "text/xml";
@@ -1749,8 +1755,6 @@ apply_textdelta(void *file_baton,
void **handler_baton)
{
file_context_t *ctx = file_baton;
- const svn_ra_callbacks2_t *wc_callbacks;
- void *wc_callback_baton;
/* Store the stream in a temporary file; we'll give it to serf when we
* close this file.
@@ -1760,8 +1764,6 @@ apply_textdelta(void *file_baton,
* that returns EAGAIN until we receive the done call? But, when
* would we run through the serf context? Grr.
*/
- wc_callbacks = ctx->commit->session->wc_callbacks;
- wc_callback_baton = ctx->commit->session->wc_callback_baton;
SVN_ERR(svn_io_open_unique_file3(&ctx->svndiff, NULL, NULL,
svn_io_file_del_on_pool_cleanup,
@@ -2031,6 +2033,12 @@ abort_edit(void *edit_baton,
if (! (ctx->activity_url || ctx->txn_url))
return SVN_NO_ERROR;
+#if SERF_VERSION_AT_LEAST(0, 4, 0)
+ /* An error occurred on conns[0]. serf 0.4.0 remembers that the connection
+ had a problem. We need to reset it, in order to use it again. */
+ serf_connection_reset(ctx->session->conns[0]->conn);
+#endif
+
/* DELETE our aborted activity */
handler = apr_pcalloc(pool, sizeof(*handler));
handler->method = "DELETE";
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_serf/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_serf/mergeinfo.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_serf/mergeinfo.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_serf/mergeinfo.c Tue Aug 10 20:55:56 2010
@@ -119,14 +119,18 @@ end_element(svn_ra_serf__xml_parser_t *p
if (mergeinfo_ctx->curr_info && mergeinfo_ctx->curr_path)
{
svn_mergeinfo_t path_mergeinfo;
+ const char *path;
SVN_ERR_ASSERT(mergeinfo_ctx->curr_path->data);
+ path = apr_pstrdup(mergeinfo_ctx->pool,
+ mergeinfo_ctx->curr_path->data);
SVN_ERR(svn_mergeinfo_parse(&path_mergeinfo,
mergeinfo_ctx->curr_info->data,
mergeinfo_ctx->pool));
+ /* Correct for naughty servers that send "relative" paths
+ with leading slashes! */
apr_hash_set(mergeinfo_ctx->result_catalog,
- apr_pstrdup(mergeinfo_ctx->pool,
- mergeinfo_ctx->curr_path->data),
+ path[0] == '/' ? path + 1 : path,
APR_HASH_KEY_STRING, path_mergeinfo);
}
svn_ra_serf__xml_pop_state(parser);
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_serf/update.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_serf/update.c Tue Aug 10 20:55:56 2010
@@ -2185,7 +2185,6 @@ finish_report(void *report_baton,
svn_ra_serf__xml_parser_t *parser_ctx;
svn_ra_serf__list_t *done_list;
const char *report_target;
- apr_hash_t *props;
apr_status_t status;
svn_boolean_t closed_root;
int status_code, i;
@@ -2193,8 +2192,6 @@ finish_report(void *report_baton,
svn_ra_serf__add_close_tag_buckets(report->buckets, report->sess->bkt_alloc,
"S:update-report");
- props = apr_hash_make(pool);
-
SVN_ERR(svn_ra_serf__report_resource(&report_target, sess, NULL, pool));
/* create and deliver request */
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_serf/win32_auth_sspi.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_serf/win32_auth_sspi.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_serf/win32_auth_sspi.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_serf/win32_auth_sspi.c Tue Aug 10 20:55:56 2010
@@ -89,7 +89,7 @@ sspi_get_credentials(char *token, apr_si
* Accepted by svn_atomic__init_once()
*/
static svn_error_t *
-initialize_sspi(apr_pool_t* pool)
+initialize_sspi(void *baton, apr_pool_t* pool)
{
sspi = InitSecurityInterface();
@@ -135,7 +135,8 @@ svn_ra_serf__init_sspi_connection(svn_ra
apr_size_t tmp_len;
serf_sspi_context_t *sspi_context;
- SVN_ERR(svn_atomic__init_once(&sspi_initialized, initialize_sspi, pool));
+ SVN_ERR(svn_atomic__init_once(&sspi_initialized,
+ initialize_sspi, NULL, pool));
sspi_context = apr_palloc(pool, sizeof(*sspi_context));
sspi_context->ctx.dwLower = 0;
@@ -348,7 +349,8 @@ svn_ra_serf__init_proxy_sspi_connection(
apr_size_t tmp_len;
serf_sspi_context_t *sspi_context;
- SVN_ERR(svn_atomic__init_once(&sspi_initialized, initialize_sspi, pool));
+ SVN_ERR(svn_atomic__init_once(&sspi_initialized,
+ initialize_sspi, NULL, pool));
sspi_context = apr_palloc(pool, sizeof(*sspi_context));
sspi_context->ctx.dwLower = 0;
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_svn/client.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_svn/client.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_svn/client.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_svn/client.c Tue Aug 10 20:55:56 2010
@@ -453,6 +453,7 @@ static void handle_child_process_error(a
conn = svn_ra_svn_create_conn(NULL, in_file, out_file, pool);
err = svn_error_wrap_apr(status, _("Error in child process: %s"), desc);
svn_error_clear(svn_ra_svn_write_cmd_failure(conn, pool, err));
+ svn_error_clear(err);
svn_error_clear(svn_ra_svn_flush(conn, pool));
}
@@ -1156,7 +1157,10 @@ static svn_error_t *ra_svn_get_mergeinfo
SVN_ERR(svn_ra_svn_parse_tuple(elt->u.list, pool, "cc",
&path, &to_parse));
SVN_ERR(svn_mergeinfo_parse(&for_path, to_parse, pool));
- apr_hash_set(*catalog, path, APR_HASH_KEY_STRING, for_path);
+ /* Correct for naughty servers that send "relative" paths
+ with leading slashes! */
+ apr_hash_set(*catalog, path[0] == '/' ? path + 1 : path,
+ APR_HASH_KEY_STRING, for_path);
}
}
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_svn/cyrus_auth.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_svn/cyrus_auth.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_svn/cyrus_auth.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_ra_svn/cyrus_auth.c Tue Aug 10 20:55:56 2010
@@ -168,7 +168,7 @@ apr_status_t svn_ra_svn__sasl_common_ini
return apr_err;
}
-static svn_error_t *sasl_init_cb(apr_pool_t *pool)
+static svn_error_t *sasl_init_cb(void *baton, apr_pool_t *pool)
{
if (svn_ra_svn__sasl_common_init(pool) != APR_SUCCESS
|| sasl_client_init(NULL) != SASL_OK)
@@ -179,7 +179,8 @@ static svn_error_t *sasl_init_cb(apr_poo
svn_error_t *svn_ra_svn__sasl_init(void)
{
- SVN_ERR(svn_atomic__init_once(&svn_ra_svn__sasl_status, sasl_init_cb, NULL));
+ SVN_ERR(svn_atomic__init_once(&svn_ra_svn__sasl_status,
+ sasl_init_cb, NULL, NULL));
return SVN_NO_ERROR;
}
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_repos/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_repos/deprecated.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_repos/deprecated.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_repos/deprecated.c Tue Aug 10 20:55:56 2010
@@ -428,6 +428,95 @@ svn_repos_dump_fs(svn_repos_t *repos,
cancel_baton, pool);
}
+/* Baton for repos_progress_handler */
+struct notify_baton
+{
+ svn_boolean_t dumping;
+ svn_stream_t *feedback_stream;
+};
+
+/* Implementation of svn_repos_notify_func_t to wrap the output to a
+ response stream for svn_repos_dump_fs2() and svn_repos_verify_fs() */
+static svn_error_t *
+repos_progress_handler(void * baton,
+ svn_revnum_t revision,
+ const char *warning_text,
+ apr_pool_t *scratch_pool)
+{
+ struct notify_baton *nb = baton;
+
+ if (warning_text != NULL)
+ {
+ apr_size_t len = strlen(warning_text);
+ SVN_ERR(svn_stream_write(nb->feedback_stream, warning_text, &len));
+ }
+ else
+ SVN_ERR(svn_stream_printf(nb->feedback_stream, scratch_pool,
+ nb->dumping
+ ? _("* Dumped revision %ld.\n")
+ : _("* Verified revision %ld.\n"),
+ revision));
+
+ return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
+svn_repos_dump_fs2(svn_repos_t *repos,
+ svn_stream_t *stream,
+ svn_stream_t *feedback_stream,
+ svn_revnum_t start_rev,
+ svn_revnum_t end_rev,
+ svn_boolean_t incremental,
+ svn_boolean_t use_deltas,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *pool)
+{
+ struct notify_baton nb;
+ nb.dumping = (stream != NULL); /* Show verify messages if stream is NULL */
+ nb.feedback_stream = feedback_stream;
+
+ return svn_error_return(svn_repos_dump_fs3(repos,
+ stream,
+ start_rev,
+ end_rev,
+ incremental,
+ use_deltas,
+ feedback_stream
+ ? repos_progress_handler
+ : NULL,
+ &nb,
+ cancel_func,
+ cancel_baton,
+ pool));
+}
+
+svn_error_t *
+svn_repos_verify_fs(svn_repos_t *repos,
+ svn_stream_t *feedback_stream,
+ svn_revnum_t start_rev,
+ svn_revnum_t end_rev,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *pool)
+{
+ struct notify_baton nb;
+ nb.dumping = FALSE;
+ nb.feedback_stream = feedback_stream;
+
+ return svn_error_return(svn_repos_verify_fs2(repos,
+ start_rev,
+ end_rev,
+ feedback_stream
+ ? repos_progress_handler
+ : NULL,
+ &nb,
+ cancel_func,
+ cancel_baton,
+ pool));
+}
+
/*** From load.c ***/
static svn_repos_parser_fns_t *
fns_from_fns2(const svn_repos_parse_fns2_t *fns2,
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_repos/dump.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_repos/dump.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_repos/dump.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_repos/dump.c Tue Aug 10 20:55:56 2010
@@ -34,6 +34,7 @@
#include "svn_checksum.h"
#include "svn_props.h"
+#include "private/svn_mergeinfo_private.h"
#define ARE_VALID_COPY_ARGS(p,r) ((p) && SVN_IS_VALID_REVNUM(r))
@@ -180,7 +181,8 @@ struct edit_baton
svn_stream_t *stream;
/* Send feedback here, if non-NULL */
- svn_stream_t *feedback_stream;
+ svn_repos_notify_func_t notify_func;
+ void *notify_baton;
/* The fs revision root, so we can read the contents of paths. */
svn_fs_root_t *fs_root;
@@ -195,6 +197,14 @@ struct edit_baton
/* The first revision dumped in this dumpstream. */
svn_revnum_t oldest_dumped_rev;
+ /* Set to true if any references to revisions older than
+ OLDEST_DUMPED_REV were found in the dumpstream. */
+ svn_boolean_t found_old_reference;
+
+ /* Set to true if any mergeinfo was dumped which contains revisions
+ older than OLDEST_DUMPED_REV. */
+ svn_boolean_t found_old_mergeinfo;
+
/* reusable buffer for writing file contents */
char buffer[SVN__STREAM_CHUNK_SIZE];
apr_size_t bufsize;
@@ -416,15 +426,21 @@ dump_node(struct edit_baton *eb,
}
else
{
- if (!eb->verify && cmp_rev < eb->oldest_dumped_rev)
- SVN_ERR(svn_stream_printf
- (eb->feedback_stream, pool,
+ if (!eb->verify && cmp_rev < eb->oldest_dumped_rev
+ && eb->notify_func)
+ {
+ const char *warning = apr_psprintf(
+ pool,
_("WARNING: Referencing data in revision %ld,"
" which is older than the oldest\n"
"WARNING: dumped revision (%ld). Loading this dump"
" into an empty repository\n"
"WARNING: will fail.\n"),
- cmp_rev, eb->oldest_dumped_rev));
+ cmp_rev, eb->oldest_dumped_rev);
+ eb->found_old_reference = TRUE;
+ SVN_ERR(eb->notify_func(eb->notify_baton,
+ eb->oldest_dumped_rev, warning, pool));
+ }
SVN_ERR(svn_stream_printf(eb->stream, pool,
SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV
@@ -493,6 +509,43 @@ dump_node(struct edit_baton *eb,
apr_size_t proplen;
SVN_ERR(svn_fs_node_proplist(&prophash, eb->fs_root, path, pool));
+
+ /* If this is a partial dump, then issue a warning if we dump mergeinfo
+ properties that refer to revisions older than the first revision
+ dumped. */
+ if (eb->notify_func && eb->oldest_dumped_rev > 1)
+ {
+ svn_string_t *mergeinfo_str = apr_hash_get(prophash,
+ SVN_PROP_MERGEINFO,
+ APR_HASH_KEY_STRING);
+ if (mergeinfo_str)
+ {
+ svn_mergeinfo_t mergeinfo, old_mergeinfo;
+
+ SVN_ERR(svn_mergeinfo_parse(&mergeinfo, mergeinfo_str->data,
+ pool));
+ SVN_ERR(svn_mergeinfo__filter_mergeinfo_by_ranges(
+ &old_mergeinfo, mergeinfo,
+ eb->oldest_dumped_rev - 1, 0,
+ TRUE, pool, pool));
+ if (apr_hash_count(old_mergeinfo))
+ {
+ const char *warning = apr_psprintf(
+ pool,
+ _("WARNING: Mergeinfo referencing revision(s) prior "
+ "to the oldest dumped revision (%ld).\n"
+ "WARNING: Loading this dump may result in invalid "
+ "mergeinfo.\n"),
+ eb->oldest_dumped_rev);
+
+ eb->found_old_mergeinfo = TRUE;
+ SVN_ERR(eb->notify_func(eb->notify_baton,
+ SVN_INVALID_REVNUM,
+ warning, pool));
+ }
+ }
+ }
+
if (eb->use_deltas && compare_root)
{
/* Fetch the old property hash to diff against and output a header
@@ -845,7 +898,8 @@ get_dump_editor(const svn_delta_editor_t
svn_revnum_t to_rev,
const char *root_path,
svn_stream_t *stream,
- svn_stream_t *feedback_stream,
+ svn_repos_notify_func_t notify_func,
+ void *notify_baton,
svn_revnum_t oldest_dumped_rev,
svn_boolean_t use_deltas,
svn_boolean_t verify,
@@ -859,7 +913,8 @@ get_dump_editor(const svn_delta_editor_t
/* Set up the edit baton. */
eb->stream = stream;
- eb->feedback_stream = feedback_stream;
+ eb->notify_func = notify_func;
+ eb->notify_baton = notify_baton;
eb->oldest_dumped_rev = oldest_dumped_rev;
eb->bufsize = sizeof(eb->buffer);
eb->path = apr_pstrdup(pool, root_path);
@@ -953,26 +1008,28 @@ write_revision_record(svn_stream_t *stre
/* The main dumper. */
svn_error_t *
-svn_repos_dump_fs2(svn_repos_t *repos,
+svn_repos_dump_fs3(svn_repos_t *repos,
svn_stream_t *stream,
- svn_stream_t *feedback_stream,
svn_revnum_t start_rev,
svn_revnum_t end_rev,
svn_boolean_t incremental,
svn_boolean_t use_deltas,
+ svn_repos_notify_func_t notify_func,
+ void *notify_baton,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *pool)
{
const svn_delta_editor_t *dump_editor;
- void *dump_edit_baton;
+ void *dump_edit_baton = NULL;
svn_revnum_t i;
svn_fs_t *fs = svn_repos_fs(repos);
apr_pool_t *subpool = svn_pool_create(pool);
svn_revnum_t youngest;
const char *uuid;
int version;
- svn_boolean_t dumping = (stream != NULL);
+ svn_boolean_t found_old_reference = FALSE;
+ svn_boolean_t found_old_mergeinfo = FALSE;
/* Determine the current youngest revision of the filesystem. */
SVN_ERR(svn_fs_youngest_rev(&youngest, fs, pool));
@@ -984,8 +1041,6 @@ svn_repos_dump_fs2(svn_repos_t *repos,
end_rev = youngest;
if (! stream)
stream = svn_stream_empty(pool);
- if (! feedback_stream)
- feedback_stream = svn_stream_empty(pool);
/* Validate the revisions. */
if (start_rev > end_rev)
@@ -1068,8 +1123,8 @@ svn_repos_dump_fs2(svn_repos_t *repos,
non-incremental dump. */
use_deltas_for_rev = use_deltas && (incremental || i != start_rev);
SVN_ERR(get_dump_editor(&dump_editor, &dump_edit_baton, fs, to_rev,
- "/", stream, feedback_stream, start_rev,
- use_deltas_for_rev, FALSE, subpool));
+ "/", stream, notify_func, notify_baton,
+ start_rev, use_deltas_for_rev, FALSE, subpool));
/* Drive the editor in one way or another. */
SVN_ERR(svn_fs_revision_root(&to_root, fs, to_rev, subpool));
@@ -1100,11 +1155,41 @@ svn_repos_dump_fs2(svn_repos_t *repos,
}
loop_end:
- SVN_ERR(svn_stream_printf(feedback_stream, pool,
- dumping
- ? _("* Dumped revision %ld.\n")
- : _("* Verified revision %ld.\n"),
- to_rev));
+ if (notify_func)
+ SVN_ERR(notify_func(notify_baton, to_rev, NULL, subpool));
+
+ if (dump_edit_baton) /* We never get an edit baton for r0. */
+ {
+ if (((struct edit_baton *)dump_edit_baton)->found_old_reference)
+ found_old_reference = TRUE;
+ if (((struct edit_baton *)dump_edit_baton)->found_old_mergeinfo)
+ found_old_mergeinfo = TRUE;
+ }
+ }
+
+ if (notify_func)
+ {
+ /* Did we issue any warnings about references to revisions older than
+ the oldest dumped revision? If so, then issue a final generic
+ warning, since the inline warnings already issued might easily be
+ missed. */
+ if (found_old_reference)
+ SVN_ERR(notify_func(notify_baton, SVN_INVALID_REVNUM,
+ _("WARNING: The range of revisions dumped "
+ "contained references to\n"
+ "WARNING: copy sources outside that "
+ "range.\n"),
+ subpool));
+
+ /* Ditto if we issued any warnings about old revisions referenced
+ in dumped mergeinfo. */
+ if (found_old_mergeinfo)
+ SVN_ERR(notify_func(notify_baton, SVN_INVALID_REVNUM,
+ _("WARNING: The range of revisions dumped "
+ "contained mergeinfo\n"
+ "WARNING: which reference revisions outside "
+ "that range.\n"),
+ subpool));
}
svn_pool_destroy(subpool);
@@ -1176,13 +1261,14 @@ verify_close_directory(void *dir_baton,
}
svn_error_t *
-svn_repos_verify_fs(svn_repos_t *repos,
- svn_stream_t *feedback_stream,
- svn_revnum_t start_rev,
- svn_revnum_t end_rev,
- svn_cancel_func_t cancel_func,
- void *cancel_baton,
- apr_pool_t *pool)
+svn_repos_verify_fs2(svn_repos_t *repos,
+ svn_revnum_t start_rev,
+ svn_revnum_t end_rev,
+ svn_repos_notify_func_t notify_func,
+ void *notify_baton,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *pool)
{
svn_fs_t *fs = svn_repos_fs(repos);
svn_revnum_t youngest;
@@ -1197,8 +1283,6 @@ svn_repos_verify_fs(svn_repos_t *repos,
start_rev = 0;
if (! SVN_IS_VALID_REVNUM(end_rev))
end_rev = youngest;
- if (! feedback_stream)
- feedback_stream = svn_stream_empty(pool);
/* Validate the revisions. */
if (start_rev > end_rev)
@@ -1226,7 +1310,8 @@ svn_repos_verify_fs(svn_repos_t *repos,
/* Get cancellable dump editor, but with our close_directory handler. */
SVN_ERR(get_dump_editor((const svn_delta_editor_t **)&dump_editor,
&dump_edit_baton, fs, rev, "",
- svn_stream_empty(pool), feedback_stream,
+ svn_stream_empty(pool),
+ notify_func, notify_baton,
start_rev,
FALSE, TRUE, /* use_deltas, verify */
iterpool));
@@ -1242,9 +1327,9 @@ svn_repos_verify_fs(svn_repos_t *repos,
cancel_editor, cancel_edit_baton,
NULL, NULL, iterpool));
SVN_ERR(svn_fs_revision_proplist(&props, fs, rev, iterpool));
- SVN_ERR(svn_stream_printf(feedback_stream, iterpool,
- _("* Verified revision %ld.\n"),
- rev));
+
+ if (notify_func)
+ SVN_ERR(notify_func(notify_baton, rev, NULL, iterpool));
}
svn_pool_destroy(iterpool);
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_repos/load.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_repos/load.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_repos/load.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_repos/load.c Tue Aug 10 20:55:56 2010
@@ -62,11 +62,14 @@ struct parse_baton
contents are allocated in POOL. */
apr_hash_t *rev_map;
- /* The oldest and youngest old revisions loaded so far from the dump
- stream. If no revisions have been loaded yet, then both are set to
+ /* The most recent (youngest) revision from the dump stream mapped in
+ REV_MAP. If no revisions have been mapped yet, this is set to
SVN_INVALID_REVNUM. */
+ svn_revnum_t last_rev_mapped;
+
+ /* The oldest old revision loaded from the dump stream. If no revisions
+ have been loaded yet, this is set to SVN_INVALID_REVNUM. */
svn_revnum_t oldest_old_rev;
- svn_revnum_t youngest_old_rev;
};
struct revision_baton
@@ -265,10 +268,9 @@ prefix_mergeinfo_paths(svn_string_t **me
}
-/* Examine the mergeinfo in INITIAL_VAL, if necessary remove revisions that
- refer to history outside of the dump stream and renumber mergeinfo
- rangelists to point to the appropriate revisions in the loaded repository.
- Return the (possibly new) mergeinfo in *FINAL_VAL (allocated from POOL). */
+/* Examine the mergeinfo in INITIAL_VAL, renumber revisions in rangelists
+ as appropriate, and return the (possibly new) mergeinfo in *FINAL_VAL
+ (allocated from POOL). */
static svn_error_t *
renumber_mergeinfo_revs(svn_string_t **final_val,
const svn_string_t *initial_val,
@@ -281,16 +283,6 @@ renumber_mergeinfo_revs(svn_string_t **f
apr_hash_index_t *hi;
SVN_ERR(svn_mergeinfo_parse(&mergeinfo, initial_val->data, subpool));
-
- /* Issue #3020: If the dump stream represents only part of a repository,
- then mergeinfo in the stream may refer to revisions outside of the
- stream. Remove any such invalid ranges before renumbering. */
- SVN_ERR(svn_mergeinfo__filter_mergeinfo_by_ranges(
- &mergeinfo, mergeinfo,
- rb->pb->youngest_old_rev, rb->pb->oldest_old_rev - 1,
- TRUE, /* Allow only references to revs that exist in the load stream. */
- subpool, subpool));
-
for (hi = apr_hash_first(subpool, mergeinfo); hi; hi = apr_hash_next(hi))
{
const char *merge_source;
@@ -321,7 +313,7 @@ renumber_mergeinfo_revs(svn_string_t **f
/* Since the start revision of svn_merge_range_t are not
inclusive there is one possible valid start revision that
won't be found in the PB->REV_MAP mapping of load stream
- revisions to loaded revisions: The revision immediately
+ revsions to loaded revisions: The revision immediately
preceeding the oldest revision from the load stream.
This is a valid revision for mergeinfo, but not a valid
copy from revision (which PB->REV_MAP also maps for) so it
@@ -335,6 +327,18 @@ renumber_mergeinfo_revs(svn_string_t **f
if (rev_from_map && SVN_IS_VALID_REVNUM(*rev_from_map))
range->start = *rev_from_map - 1;
}
+ else
+ {
+ /* If we can't remap the start revision then don't even bother
+ trying to remap the end revision. It's possible we might
+ actually succeed at the latter, which can result in invalid
+ mergeinfo with a start rev > end rev. If that gets into the
+ repository then a world of bustage breaks loose anytime that
+ bogus mergeinfo is parsed. See
+ http://subversion.tigris.org/issues/show_bug.cgi?id=3020#desc16.
+ */
+ continue;
+ }
rev_from_map = apr_hash_get(pb->rev_map, &range->end,
sizeof(svn_revnum_t));
@@ -344,8 +348,17 @@ renumber_mergeinfo_revs(svn_string_t **f
apr_hash_set(final_mergeinfo, merge_source,
APR_HASH_KEY_STRING, rangelist);
}
-
SVN_ERR(svn_mergeinfo_sort(final_mergeinfo, subpool));
+
+ /* Mergeinfo revision sources for r0 and r1 are invalid; you can't merge r0
+ or r1. However, svndumpfilter can be abused to produce r1 merge source
+ revs. So if we encounter any, then strip them out, no need to put them
+ into the load target. */
+ SVN_ERR(svn_mergeinfo__filter_mergeinfo_by_ranges(&final_mergeinfo,
+ final_mergeinfo,
+ 1, 0, FALSE,
+ subpool, subpool));
+
SVN_ERR(svn_mergeinfo_to_string(final_val, final_mergeinfo, pool));
svn_pool_destroy(subpool);
@@ -1250,31 +1263,19 @@ set_node_property(void *baton,
if (strcmp(name, SVN_PROP_MERGEINFO) == 0)
{
- /* If we haven't yet committed any revisions then *any* mergeinfo
- will refer to the wrong revisions or revisions that don't exist.
- Either way none of this mergeinfo can be valid, so remove it all. */
- if (apr_hash_count(rb->pb->rev_map) == 0)
- {
- value = NULL;
- }
- else
+ /* Renumber mergeinfo as appropriate. */
+ svn_string_t *renumbered_mergeinfo;
+ SVN_ERR(renumber_mergeinfo_revs(&renumbered_mergeinfo, value, rb,
+ nb->pool));
+ value = renumbered_mergeinfo;
+ if (parent_dir)
{
- /* Renumber mergeinfo as appropriate. */
- svn_string_t *renumbered_mergeinfo;
-
- SVN_ERR(renumber_mergeinfo_revs(&renumbered_mergeinfo, value, rb,
- nb->pool));
- value = renumbered_mergeinfo;
- if (parent_dir)
- {
- /* Prefix the merge source paths with PARENT_DIR. */
- /* ASSUMPTION: All source paths are included in the dump
- stream. */
- svn_string_t *mergeinfo_val;
- SVN_ERR(prefix_mergeinfo_paths(&mergeinfo_val, value,
- parent_dir, nb->pool));
- value = mergeinfo_val;
- }
+ /* Prefix the merge source paths with PARENT_DIR. */
+ /* ASSUMPTION: All source paths are included in the dump stream. */
+ svn_string_t *mergeinfo_val;
+ SVN_ERR(prefix_mergeinfo_paths(&mergeinfo_val, value, parent_dir,
+ nb->pool));
+ value = mergeinfo_val;
}
}
@@ -1410,12 +1411,9 @@ close_revision(void *baton)
return svn_error_return(err);
}
- /* Update the youngest revision committed from the load stream (or both
- if this is the first revision committed). */
- if (SVN_IS_VALID_REVNUM(pb->youngest_old_rev))
- pb->youngest_old_rev = *old_rev;
- else
- pb->oldest_old_rev = pb->youngest_old_rev = *old_rev;
+ /* Stash the oldest "old" revision committed from the load stream. */
+ if (!SVN_IS_VALID_REVNUM(pb->oldest_old_rev))
+ pb->oldest_old_rev = *old_rev;
/* Run post-commit hook, if so commanded. */
if (pb->use_post_commit_hook)
@@ -1431,6 +1429,31 @@ close_revision(void *baton)
correct repository revision to copy from. */
apr_hash_set(pb->rev_map, old_rev, sizeof(svn_revnum_t), new_rev);
+ /* If the incoming dump stream has non-contiguous revisions (e.g. from
+ using svndumpfilter --drop-empty-revs without --renumber-revs) then
+ we must account for the missing gaps in PB->REV_MAP. Otherwise we
+ might not be able to map all mergeinfo source revisions to the correct
+ revisions in the target repos. */
+ if (pb->last_rev_mapped != SVN_INVALID_REVNUM
+ && *old_rev != pb->last_rev_mapped + 1)
+ {
+ int i;
+
+ /* Map all dropped revisions between PB->LAST_REV_MAPPED and OLD_REV. */
+ for (i = pb->last_rev_mapped + 1; i < *old_rev; i++)
+ {
+ svn_revnum_t *gap_rev_old = apr_palloc(pb->pool,
+ sizeof(*gap_rev_old));
+ svn_revnum_t *gap_rev_new = apr_palloc(pb->pool,
+ sizeof(*gap_rev_new));
+ *gap_rev_old = i;
+ *gap_rev_new = pb->last_rev_mapped;
+ apr_hash_set(pb->rev_map, gap_rev_old, sizeof(svn_revnum_t),
+ gap_rev_new);
+ }
+ }
+ pb->last_rev_mapped = *old_rev;
+
/* Deltify the predecessors of paths changed in this revision. */
SVN_ERR(svn_fs_deltify_revision(pb->fs, *new_rev, rb->pool));
@@ -1498,7 +1521,8 @@ svn_repos_get_fs_build_parser2(const svn
pb->parent_dir = parent_dir;
pb->pool = pool;
pb->rev_map = apr_hash_make(pool);
- pb->youngest_old_rev = pb->oldest_old_rev = SVN_INVALID_REVNUM;
+ pb->oldest_old_rev = SVN_INVALID_REVNUM;
+ pb->last_rev_mapped = SVN_INVALID_REVNUM;
*callbacks = parser;
*parse_baton = pb;
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_repos/reporter.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_repos/reporter.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_repos/reporter.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_repos/reporter.c Tue Aug 10 20:55:56 2010
@@ -807,8 +807,8 @@ update_entry(report_baton_t *b, svn_revn
&& (!info || (!info->start_empty && !info->lock_token))
&& (requested_depth <= wc_depth || t_entry->kind == svn_node_file))
return SVN_NO_ERROR;
- else if (distance != -1 || b->ignore_ancestry)
- related = TRUE;
+
+ related = (distance != -1 || b->ignore_ancestry);
}
/* If there's a source and it's not related to the target, nuke it. */
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_repos/repos.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_repos/repos.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_repos/repos.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_repos/repos.c Tue Aug 10 20:55:56 2010
@@ -1110,9 +1110,16 @@ create_conf(svn_repos_t *repos, apr_pool
"### Visit http://subversion.apache.org/ for more information." NL
"" NL
"[general]" NL
-"### These options control access to the repository for unauthenticated" NL
-"### and authenticated users. Valid values are \"write\", \"read\"," NL
-"### and \"none\". The sample settings below are the defaults." NL
+"### The anon-access and auth-access options control access to the" NL
+"### repository for unauthenticated (a.k.a. anonymous) users and" NL
+"### authenticated users, respectively." NL
+"### Valid values are \"write\", \"read\", and \"none\"." NL
+"### Setting the value to \"none\" prohibits both reading and writing;" NL
+"### \"read\" allows read-only access, and \"write\" allows complete " NL
+"### read/write access to the repository." NL
+"### The sample settings below are the defaults and specify that anonymous" NL
+"### users have read-only access to the repository, while authenticated" NL
+"### users have read and write access to the repository." NL
"# anon-access = read" NL
"# auth-access = write" NL
"### The password-db option controls the location of the password" NL
Propchange: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Aug 10 20:55:56 2010
@@ -8,3 +8,4 @@ Debug
*~
.*~
libsvn_subr.def
+internal_statements.h
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/atomic.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/atomic.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/atomic.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/atomic.c Tue Aug 10 20:55:56 2010
@@ -31,7 +31,9 @@
svn_error_t*
svn_atomic__init_once(volatile svn_atomic_t *global_status,
- svn_error_t *(*init_func)(apr_pool_t*), apr_pool_t* pool)
+ svn_error_t *(*init_func)(void*,apr_pool_t*),
+ void *baton,
+ apr_pool_t* pool)
{
/* !! Don't use localizable strings in this function, because these
!! might cause deadlocks. This function can be used to initialize
@@ -46,7 +48,7 @@ svn_atomic__init_once(volatile svn_atomi
if (status == SVN_ATOMIC_UNINITIALIZED)
{
- svn_error_t *err = init_func(pool);
+ svn_error_t *err = init_func(baton, pool);
if (err)
{
#if APR_HAS_THREADS
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/checksum.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/checksum.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/checksum.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/checksum.c Tue Aug 10 20:55:56 2010
@@ -29,6 +29,7 @@
#include "svn_checksum.h"
#include "svn_error.h"
+#include "svn_ctype.h"
#include "sha1.h"
#include "md5.h"
@@ -206,12 +207,15 @@ svn_checksum_parse_hex(svn_checksum_t **
for (i = 0; i < len; i++)
{
- if ((! isxdigit(hex[i * 2])) || (! isxdigit(hex[i * 2 + 1])))
+ if ((! svn_ctype_isxdigit(hex[i * 2])) ||
+ (! svn_ctype_isxdigit(hex[i * 2 + 1])))
return svn_error_create(SVN_ERR_BAD_CHECKSUM_PARSE, NULL, NULL);
((unsigned char *)(*checksum)->digest)[i] =
- (( isalpha(hex[i*2]) ? hex[i*2] - 'a' + 10 : hex[i*2] - '0') << 4) |
- ( isalpha(hex[i*2+1]) ? hex[i*2+1] - 'a' + 10 : hex[i*2+1] - '0');
+ ((svn_ctype_isalpha(hex[i*2]) ? hex[i*2] - 'a' + 10
+ : hex[i*2] - '0') << 4) |
+ (svn_ctype_isalpha(hex[i*2+1]) ? hex[i*2+1] - 'a' + 10
+ : hex[i*2+1] - '0');
is_zeros |= (*checksum)->digest[i];
}
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/cmdline.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/cmdline.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/cmdline.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/cmdline.c Tue Aug 10 20:55:56 2010
@@ -31,6 +31,8 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
+#else
+#include <crtdbg.h>
#endif
#include <apr_errno.h> /* for apr_strerror */
@@ -124,7 +126,27 @@ svn_cmdline_init(const char *progname, F
#ifdef SVN_USE_WIN32_CRASHHANDLER
/* Attach (but don't load) the crash handler */
SetUnhandledExceptionFilter(svn__unhandled_exception_filter);
-#endif
+
+#if _MSC_VER >= 1400
+ /* ### This should work for VC++ 2002 (=1300) and later */
+ /* Show the abort message on STDERR instead of a dialog to allow
+ scripts (e.g. our testsuite) to continue after an abort without
+ user intervention. Allow overriding for easier debugging. */
+ if (!getenv("SVN_CMDLINE_USE_DIALOG_FOR_ABORT"))
+ {
+ /* In release mode: Redirect abort() errors to stderr */
+ _set_error_mode(_OUT_TO_STDERR);
+
+ /* In _DEBUG mode: Redirect all debug output (E.g. assert() to stderr.
+ (Ignored in releas builds) */
+ _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ }
+#endif /* _MSC_VER >= 1400 */
+
+#endif /* SVN_USE_WIN32_CRASHHANDLER */
#endif /* WIN32 */
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/deprecated.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/deprecated.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/deprecated.c Tue Aug 10 20:55:56 2010
@@ -127,7 +127,8 @@ svn_subst_translate_stream3(svn_stream_t
dst_stream = svn_subst_stream_translated(dst_stream, eol_str, repair,
keywords, expand, pool);
- return svn_stream_copy3(src_stream, dst_stream, NULL, NULL, pool);
+ return svn_error_return(svn_stream_copy3(src_stream, dst_stream,
+ NULL, NULL, pool));
}
svn_error_t *
@@ -141,7 +142,8 @@ svn_subst_translate_stream2(svn_stream_t
{
apr_hash_t *kh = kwstruct_to_kwhash(keywords, pool);
- return svn_subst_translate_stream3(s, d, eol_str, repair, kh, expand, pool);
+ return svn_error_return(svn_subst_translate_stream3(s, d, eol_str, repair,
+ kh, expand, pool));
}
svn_error_t *
@@ -156,7 +158,7 @@ svn_subst_translate_stream(svn_stream_t
svn_error_t *err = svn_subst_translate_stream2(s, d, eol_str, repair,
keywords, expand, pool);
svn_pool_destroy(pool);
- return err;
+ return svn_error_return(err);
}
svn_error_t *
@@ -170,8 +172,9 @@ svn_subst_translate_cstring(const char *
{
apr_hash_t *kh = kwstruct_to_kwhash(keywords, pool);
- return svn_subst_translate_cstring2(src, dst, eol_str, repair,
- kh, expand, pool);
+ return svn_error_return(svn_subst_translate_cstring2(src, dst, eol_str,
+ repair, kh, expand,
+ pool));
}
svn_error_t *
@@ -183,8 +186,9 @@ svn_subst_copy_and_translate(const char
svn_boolean_t expand,
apr_pool_t *pool)
{
- return svn_subst_copy_and_translate2(src, dst, eol_str, repair, keywords,
- expand, FALSE, pool);
+ return svn_error_return(svn_subst_copy_and_translate2(src, dst, eol_str,
+ repair, keywords,
+ expand, FALSE, pool));
}
svn_error_t *
@@ -199,12 +203,30 @@ svn_subst_copy_and_translate2(const char
{
apr_hash_t *kh = kwstruct_to_kwhash(keywords, pool);
- return svn_subst_copy_and_translate3(src, dst, eol_str,
- repair, kh, expand, special,
- pool);
+ return svn_error_return(svn_subst_copy_and_translate3(src, dst, eol_str,
+ repair, kh, expand,
+ special, pool));
}
svn_error_t *
+svn_subst_copy_and_translate3(const char *src,
+ const char *dst,
+ const char *eol_str,
+ svn_boolean_t repair,
+ apr_hash_t *keywords,
+ svn_boolean_t expand,
+ svn_boolean_t special,
+ apr_pool_t *pool)
+{
+ return svn_error_return(svn_subst_copy_and_translate4(src, dst, eol_str,
+ repair, keywords,
+ expand, special,
+ NULL, NULL,
+ pool));
+}
+
+
+svn_error_t *
svn_subst_stream_translated_to_normal_form(svn_stream_t **stream,
svn_stream_t *source,
svn_subst_eol_style_t eol_style,
@@ -246,10 +268,11 @@ svn_subst_stream_detranslated(svn_stream
when the returned stream is closed. */
SVN_ERR(svn_stream_open_readonly(&src_stream, src, pool, pool));
- return svn_subst_stream_translated_to_normal_form(stream_p, src_stream,
- eol_style, eol_str,
- always_repair_eols,
- keywords, pool);
+ return svn_error_return(svn_subst_stream_translated_to_normal_form(
+ stream_p, src_stream,
+ eol_style, eol_str,
+ always_repair_eols,
+ keywords, pool));
}
svn_error_t *
@@ -269,13 +292,14 @@ svn_subst_translate_to_normal_form(const
|| eol_style == svn_subst_eol_style_none))
return svn_error_create(SVN_ERR_IO_UNKNOWN_EOL, NULL, NULL);
- return svn_subst_copy_and_translate3(src, dst, eol_str,
- eol_style == svn_subst_eol_style_fixed
- || always_repair_eols,
- keywords,
- FALSE /* contract keywords */,
- special,
- pool);
+ return svn_error_return(svn_subst_copy_and_translate3(
+ src, dst, eol_str,
+ eol_style == svn_subst_eol_style_fixed
+ || always_repair_eols,
+ keywords,
+ FALSE /* contract keywords */,
+ special,
+ pool));
}
@@ -418,7 +442,8 @@ svn_opt_args_to_target_array3(apr_array_
const apr_array_header_t *known_targets,
apr_pool_t *pool)
{
- return svn_opt__args_to_target_array(targets_p, os,known_targets, pool);
+ return svn_error_return(svn_opt__args_to_target_array(targets_p, os,
+ known_targets, pool));
}
svn_error_t *
@@ -498,17 +523,17 @@ svn_opt_print_help2(apr_getopt_t *os,
const char *footer,
apr_pool_t *pool)
{
- return svn_opt_print_help3(os,
- pgm_name,
- print_version,
- quiet,
- version_footer,
- header,
- cmd_table,
- option_table,
- NULL,
- footer,
- pool);
+ return svn_error_return(svn_opt_print_help3(os,
+ pgm_name,
+ print_version,
+ quiet,
+ version_footer,
+ header,
+ cmd_table,
+ option_table,
+ NULL,
+ footer,
+ pool));
}
svn_error_t *
@@ -603,10 +628,10 @@ svn_io_open_unique_file2(apr_file_t **fi
const char *filename;
svn_path_split(path, &dirpath, &filename, pool);
- return svn_io_open_uniquely_named(file, temp_path,
- dirpath, filename, suffix,
- delete_when,
- pool, pool);
+ return svn_error_return(svn_io_open_uniquely_named(file, temp_path,
+ dirpath, filename, suffix,
+ delete_when,
+ pool, pool));
}
svn_error_t *
@@ -617,12 +642,12 @@ svn_io_open_unique_file(apr_file_t **fil
svn_boolean_t delete_on_close,
apr_pool_t *pool)
{
- return svn_io_open_unique_file2(file, temp_path,
- path, suffix,
- delete_on_close
- ? svn_io_file_del_on_close
- : svn_io_file_del_none,
- pool);
+ return svn_error_return(svn_io_open_unique_file2(file, temp_path,
+ path, suffix,
+ delete_on_close
+ ? svn_io_file_del_on_close
+ : svn_io_file_del_none,
+ pool));
}
svn_error_t *
@@ -641,9 +666,11 @@ svn_io_run_diff(const char *dir,
{
SVN_ERR(svn_path_cstring_to_utf8(&diff_cmd, diff_cmd, pool));
- return svn_io_run_diff2(dir, user_args, num_user_args, label1, label2,
- from, to, pexitcode, outfile, errfile, diff_cmd,
- pool);
+ return svn_error_return(svn_io_run_diff2(dir, user_args, num_user_args,
+ label1, label2,
+ from, to, pexitcode,
+ outfile, errfile, diff_cmd,
+ pool));
}
svn_error_t *
@@ -662,9 +689,11 @@ svn_io_run_diff3_2(int *exitcode,
{
SVN_ERR(svn_path_cstring_to_utf8(&diff3_cmd, diff3_cmd, pool));
- return svn_io_run_diff3_3(exitcode, dir, mine, older, yours, mine_label,
- older_label, yours_label, merged, diff3_cmd,
- user_args, pool);
+ return svn_error_return(svn_io_run_diff3_3(exitcode, dir,
+ mine, older, yours,
+ mine_label, older_label,
+ yours_label, merged,
+ diff3_cmd, user_args, pool));
}
svn_error_t *
@@ -680,16 +709,17 @@ svn_io_run_diff3(const char *dir,
const char *diff3_cmd,
apr_pool_t *pool)
{
- return svn_io_run_diff3_2(exitcode, dir, mine, older, yours,
- mine_label, older_label, yours_label,
- merged, diff3_cmd, NULL, pool);
+ return svn_error_return(svn_io_run_diff3_2(exitcode, dir, mine, older, yours,
+ mine_label, older_label,
+ yours_label,
+ merged, diff3_cmd, NULL, pool));
}
svn_error_t *
svn_io_remove_file(const char *path,
apr_pool_t *scratch_pool)
{
- return svn_io_remove_file2(path, FALSE, scratch_pool);
+ return svn_error_return(svn_io_remove_file2(path, FALSE, scratch_pool));
}
/*** From constructors.c ***/
@@ -715,7 +745,8 @@ svn_cmdline_prompt_user(const char **res
const char *prompt_str,
apr_pool_t *pool)
{
- return svn_cmdline_prompt_user2(result, prompt_str, NULL, pool);
+ return svn_error_return(svn_cmdline_prompt_user2(result, prompt_str, NULL,
+ pool));
}
svn_error_t *
@@ -730,10 +761,11 @@ svn_cmdline_setup_auth_baton(svn_auth_ba
void *cancel_baton,
apr_pool_t *pool)
{
- return svn_cmdline_create_auth_baton(ab, non_interactive,
- auth_username, auth_password,
- config_dir, no_auth_cache, FALSE,
- cfg, cancel_func, cancel_baton, pool);
+ return svn_error_return(svn_cmdline_create_auth_baton(
+ ab, non_interactive,
+ auth_username, auth_password,
+ config_dir, no_auth_cache, FALSE,
+ cfg, cancel_func, cancel_baton, pool));
}
/*** From dso.c ***/
@@ -837,17 +869,19 @@ svn_error_t *svn_stream_copy2(svn_stream
void *cancel_baton,
apr_pool_t *scratch_pool)
{
- return svn_stream_copy3(svn_stream_disown(from, scratch_pool),
- svn_stream_disown(to, scratch_pool),
- cancel_func, cancel_baton, scratch_pool);
+ return svn_error_return(svn_stream_copy3(
+ svn_stream_disown(from, scratch_pool),
+ svn_stream_disown(to, scratch_pool),
+ cancel_func, cancel_baton, scratch_pool));
}
svn_error_t *svn_stream_copy(svn_stream_t *from, svn_stream_t *to,
apr_pool_t *scratch_pool)
{
- return svn_stream_copy3(svn_stream_disown(from, scratch_pool),
- svn_stream_disown(to, scratch_pool),
- NULL, NULL, scratch_pool);
+ return svn_error_return(svn_stream_copy3(
+ svn_stream_disown(from, scratch_pool),
+ svn_stream_disown(to, scratch_pool),
+ NULL, NULL, scratch_pool));
}
svn_stream_t *
@@ -918,8 +952,9 @@ svn_mergeinfo_inheritable(svn_mergeinfo_
svn_revnum_t end,
apr_pool_t *pool)
{
- return svn_mergeinfo_inheritable2(output, mergeinfo, path, start, end,
- TRUE, pool, pool);
+ return svn_error_return(svn_mergeinfo_inheritable2(output, mergeinfo, path,
+ start, end,
+ TRUE, pool, pool));
}
svn_error_t *
@@ -929,7 +964,8 @@ svn_rangelist_inheritable(apr_array_head
svn_revnum_t end,
apr_pool_t *pool)
{
- return svn_rangelist_inheritable2(inheritable_rangelist, rangelist,
- start, end, TRUE, pool, pool);
+ return svn_error_return(svn_rangelist_inheritable2(inheritable_rangelist,
+ rangelist,
+ start, end, TRUE,
+ pool, pool));
}
-
Modified: subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/dirent_uri.c
URL: http://svn.apache.org/viewvc/subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/dirent_uri.c?rev=984206&r1=984205&r2=984206&view=diff
==============================================================================
--- subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/branches/ignore-mergeinfo/subversion/libsvn_subr/dirent_uri.c Tue Aug 10 20:55:56 2010
@@ -28,12 +28,15 @@
#include <ctype.h>
#include <apr_uri.h>
+#include <apr_lib.h>
#include "svn_private_config.h"
#include "svn_string.h"
#include "svn_dirent_uri.h"
#include "svn_path.h"
+#include "dirent_uri.h"
+
/* The canonical empty path. Can this be changed? Well, change the empty
test below and the path library will work, not so sure about the fs/wc
libraries. */
@@ -54,7 +57,7 @@ typedef enum {
type_relpath
} path_type_t;
-
+
/**** Internal implementation functions *****/
/* Return an internal-style new path based on PATH, allocated in POOL.
@@ -149,7 +152,7 @@ canonicalize_to_lower(char c)
else
return c - 'A' + 'a';
}
-#if defined(WIN32) || defined(__CYGWIN__)
+
/* Locale insensitive toupper() for converting parts of dirents and urls
while canonicalizing */
static char
@@ -160,7 +163,6 @@ canonicalize_to_upper(char c)
else
return c - 'a' + 'A';
}
-#endif
/* Calculates the length of the dirent absolute or non absolute root in
DIRENT, return 0 if dirent is not rooted */
@@ -344,6 +346,7 @@ canonicalize(path_type_t type, const cha
apr_size_t schemelen = 0;
apr_size_t canon_segments = 0;
svn_boolean_t url = FALSE;
+ char *schema_data = NULL;
/* "" is already canonical, so just return it; note that later code
depends on path not being zero-length. */
@@ -408,6 +411,7 @@ canonicalize(path_type_t type, const cha
{
src++;
dst++;
+ schema_data = dst;
}
canon_segments = 1;
@@ -527,6 +531,97 @@ canonicalize(path_type_t type, const cha
}
#endif /* WIN32 or Cygwin */
+ /* Check the normalization of characters in a uri */
+ if (schema_data)
+ {
+ int need_extra = 0;
+ src = schema_data;
+
+ while (*src)
+ {
+ switch (*src)
+ {
+ case '/':
+ break;
+ case '%':
+ if (!apr_isxdigit(*(src+1)) || !apr_isxdigit(*(src+2)))
+ need_extra += 2;
+ else
+ src += 2;
+ break;
+ default:
+ if (!svn_uri__char_validity[(unsigned char)*src])
+ need_extra += 2;
+ break;
+ }
+ src++;
+ }
+
+ if (need_extra > 0)
+ {
+ apr_size_t pre_schema_size = (apr_size_t)(schema_data - canon);
+
+ dst = apr_palloc(pool, (apr_size_t)(src - canon) + need_extra + 1);
+ memcpy(dst, canon, pre_schema_size);
+ canon = dst;
+
+ dst += pre_schema_size;
+ }
+ else
+ dst = schema_data;
+
+ src = schema_data;
+
+ while (*src)
+ {
+ switch (*src)
+ {
+ case '/':
+ *(dst++) = '/';
+ break;
+ case '%':
+ if (!apr_isxdigit(*(src+1)) || !apr_isxdigit(*(src+2)))
+ {
+ *(dst++) = '%';
+ *(dst++) = '2';
+ *(dst++) = '5';
+ }
+ else
+ {
+ char digitz[3];
+ int val;
+
+ digitz[0] = *(++src);
+ digitz[1] = *(++src);
+ digitz[2] = 0;
+
+ val = (int)strtol(digitz, NULL, 16);
+
+ if (svn_uri__char_validity[(unsigned char)val])
+ *(dst++) = (char)val;
+ else
+ {
+ *(dst++) = '%';
+ *(dst++) = canonicalize_to_upper(digitz[0]);
+ *(dst++) = canonicalize_to_upper(digitz[1]);
+ }
+ }
+ break;
+ default:
+ if (!svn_uri__char_validity[(unsigned char)*src])
+ {
+ apr_snprintf(dst, 4, "%%%02X", (unsigned char)*src);
+ dst += 3;
+ }
+ else
+ *(dst++) = *src;
+ break;
+ }
+ src++;
+ }
+ *dst = '\0';
+ }
+
return canon;
}
@@ -1687,6 +1782,7 @@ svn_boolean_t
svn_uri_is_canonical(const char *uri, apr_pool_t *pool)
{
const char *ptr = uri, *seg = uri;
+ const char *schema_data = NULL;
/* URI is canonical if it has:
* - no '.' segments
@@ -1737,6 +1833,8 @@ svn_uri_is_canonical(const char *uri, ap
return FALSE;
ptr++;
}
+
+ schema_data = ptr;
}
else
{
@@ -1747,7 +1845,7 @@ svn_uri_is_canonical(const char *uri, ap
}
#if defined(WIN32) || defined(__CYGWIN__)
- if (*ptr == '/')
+ if (schema_data && *ptr == '/')
{
/* If this is a file url, ptr now points to the third '/' in
file:///C:/path. Check that if we have such a URL the drive
@@ -1780,10 +1878,45 @@ svn_uri_is_canonical(const char *uri, ap
ptr++;
seg = ptr;
+
while (*ptr && (*ptr != '/'))
ptr++;
}
+ if (schema_data)
+ {
+ ptr = schema_data;
+
+ while (*ptr)
+ {
+ if (*ptr == '%')
+ {
+ char digitz[3];
+ int val;
+
+ /* Can't use apr_isxdigit() because lower case letters are
+ not in our canonical format */
+ if (((*(ptr+1) < '0' || (*ptr+1) > '9'))
+ && (*(ptr+1) < 'A' || (*ptr+1) > 'F'))
+ return FALSE;
+ else if (((*(ptr+2) < '0' || (*ptr+2) > '9'))
+ && (*(ptr+2) < 'A' || (*ptr+2) > 'F'))
+ return FALSE;
+
+ digitz[0] = *(++ptr);
+ digitz[1] = *(++ptr);
+ digitz[2] = '\0';
+ val = (int)strtol(digitz, NULL, 16);
+
+ if (svn_uri__char_validity[val])
+ return FALSE; /* Should not have been escaped */
+ }
+ else if (*ptr != '/' && !svn_uri__char_validity[(unsigned char)*ptr])
+ return FALSE; /* Character should have been escaped */
+ ptr++;
+ }
+ }
+
return TRUE;
}
@@ -1817,6 +1950,7 @@ svn_dirent_condense_targets(const char *
/* Early exit when there's only one dirent to work on. */
if (targets->nelts == 1)
{
+ *pcommon = apr_pstrdup(result_pool, *pcommon);
if (pcondensed_targets)
*pcondensed_targets = apr_array_make(result_pool, 0,
sizeof(const char *));