/* Wrap svn_fs_fs__parse_representation(), extracting its TXN_ID from our NODEREV_ID, and adding an error message. */ static svn_error_t * read_rep_offsets(representation_t **rep_p, char *string, const svn_fs_id_t *noderev_id, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { svn_error_t *err = svn_fs_fs__parse_representation(rep_p, svn_stringbuf_create_wrap(string, scratch_pool), result_pool, scratch_pool); if (err) { const svn_string_t *id_unparsed; const char *where; id_unparsed = svn_fs_fs__id_unparse(noderev_id, scratch_pool); where = apr_psprintf(scratch_pool, _("While reading representation offsets " "for node-revision '%s':"), noderev_id ? id_unparsed->data : "(null)"); return svn_error_quick_wrap(err, where); } if ((*rep_p)->revision == SVN_INVALID_REVNUM) if (noderev_id) (*rep_p)->txn_id = *svn_fs_fs__id_txn_id(noderev_id); return SVN_NO_ERROR; }
/* Inspect the data and/or prop reps of revision REVNUM in FS. Store * reference count tallies in passed hashes (allocated in RESULT_POOL). * * If PROP_REPS or DATA_REPS is NULL, the respective kind of reps are not * tallied. * * Print progress report to STDERR unless QUIET is true. * * Use SCRATCH_POOL for temporary allocations. */ static svn_error_t * process_one_revision(svn_fs_t *fs, svn_revnum_t revnum, svn_boolean_t quiet, apr_hash_t *prop_reps, apr_hash_t *data_reps, apr_hash_t *both_reps, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { svn_fs_root_t *rev_root; apr_hash_t *paths_changed; apr_hash_index_t *hi; if (! quiet) SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool, "processing r%ld\n", revnum)); /* Get the changed paths. */ SVN_ERR(svn_fs_revision_root(&rev_root, fs, revnum, scratch_pool)); SVN_ERR(svn_fs_paths_changed2(&paths_changed, rev_root, scratch_pool)); /* Iterate them. */ /* ### use iterpool? */ for (hi = apr_hash_first(scratch_pool, paths_changed); hi; hi = apr_hash_next(hi)) { const char *path; const svn_fs_path_change2_t *change; const svn_fs_id_t *node_rev_id1, *node_rev_id2; const svn_fs_id_t *the_id; node_revision_t *node_rev; path = svn__apr_hash_index_key(hi); change = svn__apr_hash_index_val(hi); if (! quiet) SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool, "processing r%ld:%s\n", revnum, path)); if (change->change_kind == svn_fs_path_change_delete) /* Can't ask for reps of PATH at REVNUM if the path no longer exists * at that revision! */ continue; /* Okay, we have two node_rev id's for this change: the txn one and * the revision one. We'll use the latter. */ node_rev_id1 = change->node_rev_id; SVN_ERR(svn_fs_node_id(&node_rev_id2, rev_root, path, scratch_pool)); SVN_ERR_ASSERT(svn_fs_fs__id_txn_id(node_rev_id1) != NULL); SVN_ERR_ASSERT(svn_fs_fs__id_rev(node_rev_id2) != SVN_INVALID_REVNUM); the_id = node_rev_id2; /* Get the node_rev using the chosen node_rev_id. */ SVN_ERR(svn_fs_fs__get_node_revision(&node_rev, fs, the_id, scratch_pool)); /* Maybe record the sha1's. */ SVN_ERR(record(prop_reps, node_rev->prop_rep, result_pool)); SVN_ERR(record(data_reps, node_rev->data_rep, result_pool)); SVN_ERR(record(both_reps, node_rev->prop_rep, result_pool)); SVN_ERR(record(both_reps, node_rev->data_rep, result_pool)); } return SVN_NO_ERROR; }
svn_boolean_t svn_fs_fs__dag_check_mutable(const dag_node_t *node) { return (svn_fs_fs__id_txn_id(svn_fs_fs__dag_get_id(node)) != NULL); }