void setColour(int r, int g, int b) { ensure_state(STATE_REGISTER, "set_colour"); colour_r = clamp(r, 0, 255); colour_g = clamp(g, 0, 255); colour_b = clamp(b, 0, 255); }
/* Implements svn_wc_status_func3_t */ static svn_error_t * diff_status_callback(void *baton, const char *local_abspath, const svn_wc_status3_t *status, apr_pool_t *scratch_pool) { struct diff_baton *eb = baton; svn_wc__db_t *db = eb->db; if (! status->versioned) return SVN_NO_ERROR; /* unversioned (includes dir externals) */ if (status->node_status == svn_wc_status_conflicted && status->text_status == svn_wc_status_none && status->prop_status == svn_wc_status_none) { /* Node is an actual only node describing a tree conflict */ return SVN_NO_ERROR; } /* Not text/prop modified, not copied. Easy out */ if (status->node_status == svn_wc_status_normal && !status->copied) return SVN_NO_ERROR; /* Mark all directories where we are no longer inside as closed */ while (eb->cur && !svn_dirent_is_ancestor(eb->cur->local_abspath, local_abspath)) { struct node_state_t *ns = eb->cur; if (!ns->skip) { if (ns->propchanges) SVN_ERR(eb->processor->dir_changed(ns->relpath, ns->left_src, ns->right_src, ns->left_props, ns->right_props, ns->propchanges, ns->baton, eb->processor, ns->pool)); else SVN_ERR(eb->processor->dir_closed(ns->relpath, ns->left_src, ns->right_src, ns->baton, eb->processor, ns->pool)); } eb->cur = ns->parent; svn_pool_clear(ns->pool); } SVN_ERR(ensure_state(eb, svn_dirent_dirname(local_abspath, scratch_pool), FALSE, scratch_pool)); if (eb->cur && eb->cur->skip_children) return SVN_NO_ERROR; if (eb->changelist_hash != NULL && (!status->changelist || ! svn_hash_gets(eb->changelist_hash, status->changelist))) return SVN_NO_ERROR; /* Filtered via changelist */ /* This code does about the same thing as the inner body of walk_local_nodes_diff() in diff_editor.c, except that it is already filtered by the status walker, doesn't have to account for remote changes (and many tiny other details) */ { svn_boolean_t repos_only; svn_boolean_t local_only; svn_wc__db_status_t db_status; svn_boolean_t have_base; svn_node_kind_t base_kind; svn_node_kind_t db_kind = status->kind; svn_depth_t depth_below_here = svn_depth_unknown; const char *child_abspath = local_abspath; const char *child_relpath = svn_dirent_skip_ancestor(eb->anchor_abspath, local_abspath); repos_only = FALSE; local_only = FALSE; /* ### optimize away this call using status info. Should be possible in almost every case (except conflict, missing, obst.)*/ SVN_ERR(svn_wc__db_read_info(&db_status, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &have_base, NULL, NULL, eb->db, local_abspath, scratch_pool, scratch_pool)); if (!have_base) { local_only = TRUE; /* Only report additions */ } else if (db_status == svn_wc__db_status_normal) { /* Simple diff */ base_kind = db_kind; } else if (db_status == svn_wc__db_status_deleted) { svn_wc__db_status_t base_status; repos_only = TRUE; SVN_ERR(svn_wc__db_base_get_info(&base_status, &base_kind, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, eb->db, local_abspath, scratch_pool, scratch_pool)); if (base_status != svn_wc__db_status_normal) return SVN_NO_ERROR; } else { /* working status is either added or deleted */ svn_wc__db_status_t base_status; SVN_ERR(svn_wc__db_base_get_info(&base_status, &base_kind, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, eb->db, local_abspath, scratch_pool, scratch_pool)); if (base_status != svn_wc__db_status_normal) local_only = TRUE; else if (base_kind != db_kind || !eb->ignore_ancestry) { repos_only = TRUE; local_only = TRUE; } } if (repos_only) { /* Report repository form deleted */ if (base_kind == svn_node_file) SVN_ERR(svn_wc__diff_base_only_file(db, child_abspath, child_relpath, SVN_INVALID_REVNUM, eb->processor, eb->cur ? eb->cur->baton : NULL, scratch_pool)); else if (base_kind == svn_node_dir) SVN_ERR(svn_wc__diff_base_only_dir(db, child_abspath, child_relpath, SVN_INVALID_REVNUM, depth_below_here, eb->processor, eb->cur ? eb->cur->baton : NULL, eb->cancel_func, eb->cancel_baton, scratch_pool)); } else if (!local_only) { /* Diff base against actual */ if (db_kind == svn_node_file) { SVN_ERR(svn_wc__diff_base_working_diff(db, child_abspath, child_relpath, SVN_INVALID_REVNUM, eb->changelist_hash, eb->processor, eb->cur ? eb->cur->baton : NULL, FALSE, eb->cancel_func, eb->cancel_baton, scratch_pool)); } else if (db_kind == svn_node_dir) { SVN_ERR(ensure_state(eb, local_abspath, FALSE, scratch_pool)); if (status->prop_status != svn_wc_status_none && status->prop_status != svn_wc_status_normal) { apr_array_header_t *propchanges; SVN_ERR(svn_wc__db_base_get_props(&eb->cur->left_props, eb->db, local_abspath, eb->cur->pool, scratch_pool)); SVN_ERR(svn_wc__db_read_props(&eb->cur->right_props, eb->db, local_abspath, eb->cur->pool, scratch_pool)); SVN_ERR(svn_prop_diffs(&propchanges, eb->cur->right_props, eb->cur->left_props, eb->cur->pool)); eb->cur->propchanges = propchanges; } } } if (local_only && (db_status != svn_wc__db_status_deleted)) { if (db_kind == svn_node_file) SVN_ERR(svn_wc__diff_local_only_file(db, child_abspath, child_relpath, eb->processor, eb->cur ? eb->cur->baton : NULL, eb->changelist_hash, FALSE, eb->cancel_func, eb->cancel_baton, scratch_pool)); else if (db_kind == svn_node_dir) SVN_ERR(svn_wc__diff_local_only_dir(db, child_abspath, child_relpath, depth_below_here, eb->processor, eb->cur ? eb->cur->baton : NULL, eb->changelist_hash, FALSE, eb->cancel_func, eb->cancel_baton, scratch_pool)); } if (db_kind == svn_node_dir && (local_only || repos_only)) SVN_ERR(ensure_state(eb, local_abspath, TRUE /* skip */, scratch_pool)); } return SVN_NO_ERROR; }
/* Recursively opens directories on the stack in EB, until LOCAL_ABSPATH is reached. If RECURSIVE_SKIP is TRUE, don't open LOCAL_ABSPATH itself, but create it marked with skip+skip_children. */ static svn_error_t * ensure_state(struct diff_baton *eb, const char *local_abspath, svn_boolean_t recursive_skip, apr_pool_t *scratch_pool) { struct node_state_t *ns; apr_pool_t *ns_pool; if (!eb->cur) { if (!svn_dirent_is_ancestor(eb->anchor_abspath, local_abspath)) return SVN_NO_ERROR; SVN_ERR(ensure_state(eb, svn_dirent_dirname(local_abspath,scratch_pool), FALSE, scratch_pool)); } else if (svn_dirent_is_child(eb->cur->local_abspath, local_abspath, NULL)) SVN_ERR(ensure_state(eb, svn_dirent_dirname(local_abspath,scratch_pool), FALSE, scratch_pool)); else return SVN_NO_ERROR; if (eb->cur && eb->cur->skip_children) return SVN_NO_ERROR; ns_pool = svn_pool_create(eb->cur ? eb->cur->pool : eb->pool); ns = apr_pcalloc(ns_pool, sizeof(*ns)); ns->pool = ns_pool; ns->local_abspath = apr_pstrdup(ns_pool, local_abspath); ns->relpath = svn_dirent_skip_ancestor(eb->anchor_abspath, ns->local_abspath); ns->parent = eb->cur; eb->cur = ns; if (recursive_skip) { ns->skip = TRUE; ns->skip_children = TRUE; return SVN_NO_ERROR; } { svn_revnum_t revision; svn_error_t *err; err = svn_wc__db_base_get_info(NULL, NULL, &revision, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, eb->db, local_abspath, scratch_pool, scratch_pool); if (err) { if (err->apr_err != SVN_ERR_WC_PATH_NOT_FOUND) return svn_error_trace(err); svn_error_clear(err); revision = 0; /* Use original revision? */ } ns->left_src = svn_diff__source_create(revision, ns->pool); ns->right_src = svn_diff__source_create(SVN_INVALID_REVNUM, ns->pool); SVN_ERR(eb->processor->dir_opened(&ns->baton, &ns->skip, &ns->skip_children, ns->relpath, ns->left_src, ns->right_src, NULL /* copyfrom_source */, ns->parent ? ns->parent->baton : NULL, eb->processor, ns->pool, scratch_pool)); } return SVN_NO_ERROR; }
void setName(const char* name) { // CLIENT ensure_state(STATE_REGISTER, "setName"); valcpy(names, name); }