102
117
return SVN_NO_ERROR;
106
120
WC_QUERIES_SQL_DECLARE_STATEMENTS(statements);
109
123
svn_test__create_fake_wc(const char *wc_abspath,
110
124
const char *extra_statements,
111
apr_pool_t *result_pool,
125
const svn_test__nodes_data_t nodes[],
126
const svn_test__actual_data_t actuals[],
112
128
apr_pool_t *scratch_pool)
114
130
const char *dotsvn_abspath = svn_dirent_join(wc_abspath, ".svn",
116
const char *db_abspath = svn_dirent_join(dotsvn_abspath, "wc.db",
118
132
svn_sqlite__db_t *sdb;
119
133
const char **my_statements;
135
svn_sqlite__stmt_t *stmt;
136
const apr_int64_t wc_id = 1;
122
138
/* Allocate MY_STATEMENTS in RESULT_POOL because the SDB will continue to
123
139
* refer to it over its lifetime. */
124
my_statements = apr_palloc(result_pool, 6 * sizeof(const char *));
140
my_statements = apr_palloc(scratch_pool, 7 * sizeof(const char *));
125
141
my_statements[0] = statements[STMT_CREATE_SCHEMA];
126
142
my_statements[1] = statements[STMT_CREATE_NODES];
127
143
my_statements[2] = statements[STMT_CREATE_NODES_TRIGGERS];
128
144
my_statements[3] = statements[STMT_CREATE_EXTERNALS];
129
my_statements[4] = extra_statements;
130
my_statements[5] = NULL;
145
my_statements[4] = statements[STMT_INSTALL_SCHEMA_STATISTICS];
146
my_statements[5] = extra_statements;
147
my_statements[6] = NULL;
132
149
/* Create fake-wc/SUBDIR/.svn/ for placing the metadata. */
133
150
SVN_ERR(svn_io_make_dir_recursively(dotsvn_abspath, scratch_pool));
135
svn_error_clear(svn_io_remove_file2(db_abspath, FALSE, scratch_pool));
136
151
SVN_ERR(svn_wc__db_util_open_db(&sdb, wc_abspath, "wc.db",
137
152
svn_sqlite__mode_rwcreate,
138
FALSE /* exclusive */, my_statements,
139
result_pool, scratch_pool));
153
FALSE /* exclusive */, 0 /* timeout */,
155
scratch_pool, scratch_pool));
140
156
for (i = 0; my_statements[i] != NULL; i++)
141
157
SVN_ERR(svn_sqlite__exec_statements(sdb, /* my_statements[] */ i));
159
SVN_ERR(svn_sqlite__close(sdb));
161
if (!nodes && !actuals)
164
/* Re-open with normal set of statements */
165
SVN_ERR(svn_wc__db_util_open_db(&sdb, wc_abspath, "wc.db",
166
svn_sqlite__mode_readwrite,
167
FALSE /* exclusive */, 0 /* timeout */,
169
scratch_pool, scratch_pool));
173
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
176
for (i = 0; nodes[i].local_relpath; i++)
178
SVN_ERR(svn_sqlite__bindf(stmt, "isdsnnns",
180
nodes[i].local_relpath,
182
nodes[i].local_relpath[0]
183
? svn_relpath_dirname(nodes[i].local_relpath,
188
if (nodes[i].repos_relpath)
190
SVN_ERR(svn_sqlite__bind_int64(stmt, 5, nodes[i].repos_id));
191
SVN_ERR(svn_sqlite__bind_text(stmt, 6, nodes[i].repos_relpath));
192
SVN_ERR(svn_sqlite__bind_revnum(stmt, 7, nodes[i].revision));
196
SVN_ERR(svn_sqlite__bind_text(stmt, 9, nodes[i].depth));
198
if (nodes[i].kind != 0)
199
SVN_ERR(svn_sqlite__bind_token(stmt, 10, kind_map, nodes[i].kind));
201
if (nodes[i].last_author || nodes[i].last_date)
203
SVN_ERR(svn_sqlite__bind_revnum(stmt, 11, nodes[i].last_revision));
204
SVN_ERR(svn_sqlite__bind_int64(stmt, 12, nodes[i].last_date));
205
SVN_ERR(svn_sqlite__bind_text(stmt, 13, nodes[i].last_author));
208
if (nodes[i].checksum)
209
SVN_ERR(svn_sqlite__bind_text(stmt, 14, nodes[i].checksum));
211
if (nodes[i].properties)
212
SVN_ERR(svn_sqlite__bind_text(stmt, 15, nodes[i].properties));
214
if (nodes[i].recorded_size || nodes[i].recorded_time)
216
SVN_ERR(svn_sqlite__bind_int64(stmt, 16, nodes[i].recorded_size));
217
SVN_ERR(svn_sqlite__bind_int64(stmt, 17, nodes[i].recorded_time));
220
/* 18 is DAV cache */
222
if (nodes[i].symlink_target)
223
SVN_ERR(svn_sqlite__bind_text(stmt, 19, nodes[i].symlink_target));
225
if (nodes[i].file_external)
226
SVN_ERR(svn_sqlite__bind_int(stmt, 20, 1));
228
if (nodes[i].moved_to)
229
SVN_ERR(svn_sqlite__bind_text(stmt, 21, nodes[i].moved_to));
231
if (nodes[i].moved_here)
232
SVN_ERR(svn_sqlite__bind_int(stmt, 22, 1));
234
if (nodes[i].inherited_props)
235
SVN_ERR(svn_sqlite__bind_text(stmt, 23, nodes[i].inherited_props));
237
SVN_ERR(svn_sqlite__step_done(stmt));
243
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
244
STMT_INSERT_ACTUAL_NODE));
246
for (i = 0; actuals[i].local_relpath; i++)
248
SVN_ERR(svn_sqlite__bindf(stmt, "isssss",
250
actuals[i].local_relpath,
251
actuals[i].local_relpath[0]
252
? svn_relpath_dirname(actuals[i].local_relpath,
255
actuals[i].properties,
256
actuals[i].changelist,
257
actuals[i].conflict_data));
259
SVN_ERR(svn_sqlite__step_done(stmt));
263
SVN_ERR(svn_sqlite__close(sdb));
143
265
return SVN_NO_ERROR;
602
sbox_wc_resolve_prop(svn_test__sandbox_t *b, const char *path,
603
const char *propname,
604
svn_wc_conflict_choice_t conflict_choice)
606
const char *lock_abspath;
609
SVN_ERR(svn_wc__acquire_write_lock_for_resolve(&lock_abspath, b->wc_ctx,
610
sbox_wc_path(b, path),
612
err = svn_wc__resolve_conflicts(b->wc_ctx, sbox_wc_path(b, path),
618
NULL, NULL, /* conflict func */
619
NULL, NULL, /* cancellation */
620
NULL, NULL, /* notification */
623
err = svn_error_compose_create(err, svn_wc__release_write_lock(b->wc_ctx,
455
631
sbox_wc_move(svn_test__sandbox_t *b, const char *src, const char *dst)
457
633
svn_client_ctx_t *ctx;
458
634
apr_array_header_t *paths = apr_array_make(b->pool, 1,
459
635
sizeof(const char *));
461
SVN_ERR(svn_client_create_context2(&ctx, NULL, b->pool));
462
ctx->wc_ctx = b->wc_ctx;
637
SVN_ERR(svn_test__create_client_ctx(&ctx, b, b->pool));
463
639
APR_ARRAY_PUSH(paths, const char *) = sbox_wc_path(b, src);
464
640
return svn_client_move7(paths, sbox_wc_path(b, dst),
465
641
FALSE /* move_as_child */,