1027
1028
return SVN_NO_ERROR;
1031
static svn_error_t *
1032
base_node_relation(svn_fs_node_relation_t *relation,
1033
svn_fs_root_t *root_a, const char *path_a,
1034
svn_fs_root_t *root_b, const char *path_b,
1037
const svn_fs_id_t *id_a, *id_b;
1039
/* Paths from different repository are never related. */
1040
if (root_a->fs != root_b->fs)
1042
*relation = svn_fs_node_unrelated;
1043
return SVN_NO_ERROR;
1046
/* Naive implementation. */
1047
SVN_ERR(base_node_id(&id_a, root_a, path_a, pool));
1048
SVN_ERR(base_node_id(&id_b, root_b, path_b, pool));
1050
*relation = svn_fs_base__id_compare(id_a, id_b);
1052
return SVN_NO_ERROR;
1031
1056
struct node_created_rev_args {
1032
1057
svn_revnum_t revision;
1379
1420
struct things_changed_args *args = baton;
1380
1421
dag_node_t *node1, *node2;
1422
apr_hash_t *proplist1, *proplist2;
1382
1424
SVN_ERR(get_dag(&node1, args->root1, args->path1, trail, trail->pool));
1383
1425
SVN_ERR(get_dag(&node2, args->root2, args->path2, trail, trail->pool));
1384
return svn_fs_base__things_different(args->changed_p, NULL,
1385
node1, node2, trail, trail->pool);
1426
SVN_ERR(svn_fs_base__things_different(args->changed_p, NULL,
1427
node1, node2, trail, trail->pool));
1429
/* Is there a potential false positive and do we want to correct it? */
1430
if (!args->strict || !*args->changed_p)
1431
return SVN_NO_ERROR;
1433
/* Different representations. They might still have equal contents. */
1434
SVN_ERR(svn_fs_base__dag_get_proplist(&proplist1, node1,
1435
trail, trail->pool));
1436
SVN_ERR(svn_fs_base__dag_get_proplist(&proplist2, node2,
1437
trail, trail->pool));
1439
*args->changed_p = !svn_fs__prop_lists_equal(proplist1, proplist2,
1441
return SVN_NO_ERROR;
1561
1619
return SVN_NO_ERROR;
1622
static svn_error_t *
1623
base_dir_optimal_order(apr_array_header_t **ordered_p,
1624
svn_fs_root_t *root,
1625
apr_hash_t *entries,
1626
apr_pool_t *result_pool,
1627
apr_pool_t *scratch_pool)
1629
/* 1:1 copy of entries with no differnce in ordering */
1630
apr_hash_index_t *hi;
1631
apr_array_header_t *result
1632
= apr_array_make(result_pool, apr_hash_count(entries),
1633
sizeof(svn_fs_dirent_t *));
1634
for (hi = apr_hash_first(scratch_pool, entries); hi; hi = apr_hash_next(hi))
1635
APR_ARRAY_PUSH(result, svn_fs_dirent_t *) = apr_hash_this_val(hi);
1637
*ordered_p = result;
1638
return SVN_NO_ERROR;
1566
1643
/* Merges and commits. */
3292
3370
return SVN_NO_ERROR;
3294
3372
/* If NODE's copy-ID is the same as that of its predecessor... */
3295
if (svn_fs_base__key_compare(svn_fs_base__id_copy_id(node_id),
3296
svn_fs_base__id_copy_id(pred_id)) != 0)
3373
if (strcmp(svn_fs_base__id_copy_id(node_id),
3374
svn_fs_base__id_copy_id(pred_id)) != 0)
3298
3376
/* ... then NODE was either the target of a copy operation,
3299
3377
a copied subtree item. We examine the actual copy record
3943
4021
struct things_changed_args *args = baton;
3944
4022
dag_node_t *node1, *node2;
4023
svn_checksum_t *checksum1, *checksum2;
4024
svn_stream_t *stream1, *stream2;
3946
4027
SVN_ERR(get_dag(&node1, args->root1, args->path1, trail, trail->pool));
3947
4028
SVN_ERR(get_dag(&node2, args->root2, args->path2, trail, trail->pool));
3948
return svn_fs_base__things_different(NULL, args->changed_p,
3949
node1, node2, trail, trail->pool);
4029
SVN_ERR(svn_fs_base__things_different(NULL, args->changed_p,
4030
node1, node2, trail, trail->pool));
4032
/* Is there a potential false positive and do we want to correct it? */
4033
if (!args->strict || !*args->changed_p)
4034
return SVN_NO_ERROR;
4036
/* Different representations. They might still have equal contents. */
4038
/* Compare MD5 checksums. These should be readily accessible. */
4039
SVN_ERR(svn_fs_base__dag_file_checksum(&checksum1, svn_checksum_md5,
4040
node1, trail, trail->pool));
4041
SVN_ERR(svn_fs_base__dag_file_checksum(&checksum2, svn_checksum_md5,
4042
node2, trail, trail->pool));
4044
/* Different MD5 checksums -> different contents */
4045
if (!svn_checksum_match(checksum1, checksum2))
4046
return SVN_NO_ERROR;
4048
/* Paranoia. Compare SHA1 checksums because that's the level of
4049
confidence we require for e.g. the working copy. */
4050
SVN_ERR(svn_fs_base__dag_file_checksum(&checksum1, svn_checksum_sha1,
4051
node1, trail, trail->pool));
4052
SVN_ERR(svn_fs_base__dag_file_checksum(&checksum2, svn_checksum_sha1,
4053
node2, trail, trail->pool));
4055
/* Different SHA1 checksums -> different contents */
4056
if (checksum1 && checksum2)
4058
*args->changed_p = !svn_checksum_match(checksum1, checksum2);
4059
return SVN_NO_ERROR;
4062
/* SHA1 checksums are not available for very old reps / repositories. */
4063
SVN_ERR(svn_fs_base__dag_get_contents(&stream1, node1, trail, trail->pool));
4064
SVN_ERR(svn_fs_base__dag_get_contents(&stream2, node2, trail, trail->pool));
4065
SVN_ERR(svn_stream_contents_same2(&same, stream1, stream2, trail->pool));
4067
/* Now, it's definitive. */
4068
*args->changed_p = !same;
4069
return SVN_NO_ERROR;
4117
4240
return svn_error_create(SVN_ERR_FS_NOT_REVISION_ROOT, NULL, NULL);
4119
4242
/* And we require that the path exist in the root. */
4120
SVN_ERR(base_check_path(&kind, root, path, pool));
4243
SVN_ERR(base_check_path(&kind, root, path, scratch_pool));
4121
4244
if (kind == svn_node_none)
4122
4245
return SVN_FS__NOT_FOUND(root, path);
4124
4247
/* Okay, all seems well. Build our history object and return it. */
4125
4248
*history_p = assemble_history(root->fs,
4126
svn_fs__canonicalize_abspath(path, pool),
4249
svn_fs__canonicalize_abspath(path,
4127
4251
root->rev, FALSE, NULL,
4128
SVN_INVALID_REVNUM, pool);
4252
SVN_INVALID_REVNUM, result_pool);
4129
4253
return SVN_NO_ERROR;
4391
4515
if (! bhd->is_interesting)
4392
4516
prev_history = assemble_history(fs, "/", bhd->revision,
4393
1, NULL, SVN_INVALID_REVNUM, pool);
4517
1, NULL, SVN_INVALID_REVNUM,
4394
4519
else if (bhd->revision > 0)
4395
4520
prev_history = assemble_history(fs, "/", bhd->revision - 1,
4396
1, NULL, SVN_INVALID_REVNUM, pool);
4521
1, NULL, SVN_INVALID_REVNUM,