📄 repos_diff.c
字号:
NULL instead. */static svn_error_t *get_path_access(svn_wc_adm_access_t **path_access, svn_wc_adm_access_t *adm_access, const char *path, svn_boolean_t lenient, apr_pool_t *pool){ if (! adm_access) *path_access = NULL; else { svn_error_t *err = svn_wc_adm_retrieve(path_access, adm_access, path, pool); if (err) { if (! lenient) return err; svn_error_clear(err); *path_access = NULL; } } return SVN_NO_ERROR;} /* Like get_path_access except the returned access baton, in *PARENT_ACCESS, is for the parent of PATH rather than for PATH itself. */static svn_error_t *get_parent_access(svn_wc_adm_access_t **parent_access, svn_wc_adm_access_t *adm_access, const char *path, svn_boolean_t lenient, apr_pool_t *pool){ if (! adm_access) *parent_access = NULL; /* Avoid messing around with paths */ else { const char *parent_path = svn_path_dirname(path, pool); SVN_ERR(get_path_access(parent_access, adm_access, parent_path, lenient, pool)); } return SVN_NO_ERROR;}/* Get the empty file associated with the edit baton. This is cached so * that it can be reused, all empty files are the same. */static svn_error_t *get_empty_file(struct edit_baton *b, const char **empty_file){ /* Create the file if it does not exist */ /* Note that we tried to use /dev/null in r17220, but that won't work on Windows: it's impossible to stat NUL */ if (!b->empty_file) SVN_ERR(create_empty_file(NULL, &(b->empty_file), b->adm_access, svn_io_file_del_on_pool_cleanup, b->pool)); *empty_file = b->empty_file; return SVN_NO_ERROR;}/* An editor function. The root of the comparison hierarchy */static svn_error_t *set_target_revision(void *edit_baton, svn_revnum_t target_revision, apr_pool_t *pool){ struct edit_baton *eb = edit_baton; eb->target_revision = target_revision; return SVN_NO_ERROR;}/* An editor function. The root of the comparison hierarchy */static svn_error_t *open_root(void *edit_baton, svn_revnum_t base_revision, apr_pool_t *pool, void **root_baton){ struct edit_baton *eb = edit_baton; struct dir_baton *b = make_dir_baton("", NULL, eb, FALSE, pool); /* Override the wcpath in our baton. */ b->wcpath = eb->target ? apr_pstrdup(pool, eb->target) : ""; SVN_ERR(get_dirprops_from_ra(b)); *root_baton = b; return SVN_NO_ERROR;}/* An editor function. */static svn_error_t *delete_entry(const char *path, svn_revnum_t base_revision, void *parent_baton, apr_pool_t *pool){ struct dir_baton *pb = parent_baton; struct edit_baton *eb = pb->edit_baton; svn_node_kind_t kind; svn_wc_adm_access_t *adm_access; svn_wc_notify_state_t state = svn_wc_notify_state_inapplicable; svn_wc_notify_action_t action = svn_wc_notify_skip; /* We need to know if this is a directory or a file */ SVN_ERR(svn_ra_check_path(pb->edit_baton->ra_session, path, pb->edit_baton->revision, &kind, pool)); SVN_ERR(get_path_access(&adm_access, eb->adm_access, pb->wcpath, TRUE, pool)); if ((! eb->adm_access) || adm_access) { switch (kind) { case svn_node_file: { const char *mimetype1, *mimetype2; struct file_baton *b; /* Compare a file being deleted against an empty file */ b = make_file_baton(path, FALSE, pb->edit_baton, pool); SVN_ERR(get_file_from_ra(b)); SVN_ERR(get_empty_file(b->edit_baton, &(b->path_end_revision))); get_file_mime_types(&mimetype1, &mimetype2, b); SVN_ERR(pb->edit_baton->diff_callbacks->file_deleted (adm_access, &state, b->wcpath, b->path_start_revision, b->path_end_revision, mimetype1, mimetype2, b->pristine_props, b->edit_baton->diff_cmd_baton)); break; } case svn_node_dir: { SVN_ERR(pb->edit_baton->diff_callbacks->dir_deleted (adm_access, &state, svn_path_join(eb->target, path, pool), pb->edit_baton->diff_cmd_baton)); break; } default: break; } if ((state != svn_wc_notify_state_missing) && (state != svn_wc_notify_state_obstructed)) { action = svn_wc_notify_update_delete; if (eb->dry_run) { /* Remember what we _would've_ deleted (issue #2584). */ const char *wcpath = svn_path_join(eb->target, path, pb->pool); apr_hash_set(svn_client__dry_run_deletions(eb->diff_cmd_baton), wcpath, APR_HASH_KEY_STRING, wcpath); /* ### TODO: if (kind == svn_node_dir), record all ### children as deleted to avoid collisions from ### subsequent edits. */ } } } if (pb->edit_baton->notify_func) { svn_wc_notify_t *notify = svn_wc_create_notify(svn_path_join(eb->target, path, pool), action, pool); notify->kind = kind; notify->content_state = notify->prop_state = state; notify->lock_state = svn_wc_notify_lock_state_inapplicable; (*pb->edit_baton->notify_func)(pb->edit_baton->notify_baton, notify, pool); } return SVN_NO_ERROR;}/* An editor function. */static svn_error_t *add_directory(const char *path, void *parent_baton, const char *copyfrom_path, svn_revnum_t copyfrom_revision, apr_pool_t *pool, void **child_baton){ struct dir_baton *pb = parent_baton; struct edit_baton *eb = pb->edit_baton; struct dir_baton *b; svn_wc_adm_access_t *adm_access; svn_wc_notify_state_t state; svn_wc_notify_action_t action; /* ### TODO: support copyfrom? */ b = make_dir_baton(path, pb, pb->edit_baton, TRUE, pool); b->pristine_props = pb->edit_baton->empty_hash; *child_baton = b; SVN_ERR(get_path_access(&adm_access, pb->edit_baton->adm_access, pb->wcpath, TRUE, pool)); SVN_ERR(pb->edit_baton->diff_callbacks->dir_added (adm_access, &state, b->wcpath, eb->target_revision, pb->edit_baton->diff_cmd_baton)); if ((state == svn_wc_notify_state_missing) || (state == svn_wc_notify_state_obstructed)) action = svn_wc_notify_skip; else action = svn_wc_notify_update_add; if (pb->edit_baton->notify_func) { svn_wc_notify_t *notify = svn_wc_create_notify(b->wcpath, action, pool); notify->kind = svn_node_dir; (*pb->edit_baton->notify_func)(pb->edit_baton->notify_baton, notify, pool); } return SVN_NO_ERROR;}/* An editor function. */static svn_error_t *open_directory(const char *path, void *parent_baton, svn_revnum_t base_revision, apr_pool_t *pool, void **child_baton){ struct dir_baton *pb = parent_baton; struct dir_baton *b; b = make_dir_baton(path, pb, pb->edit_baton, FALSE, pool); *child_baton = b; SVN_ERR(get_dirprops_from_ra(b)); return SVN_NO_ERROR;}/* An editor function. */static svn_error_t *add_file(const char *path, void *parent_baton, const char *copyfrom_path, svn_revnum_t copyfrom_revision, apr_pool_t *pool, void **file_baton){ struct dir_baton *pb = parent_baton; struct file_baton *b; /* ### TODO: support copyfrom? */ b = make_file_baton(path, TRUE, pb->edit_baton, pool); *file_baton = b; SVN_ERR(get_empty_file(b->edit_baton, &(b->path_start_revision))); b->pristine_props = pb->edit_baton->empty_hash; return SVN_NO_ERROR;}/* An editor function. */static svn_error_t *open_file(const char *path, void *parent_baton, svn_revnum_t base_revision, apr_pool_t *pool, void **file_baton){ struct dir_baton *pb = parent_baton; struct file_baton *b; b = make_file_baton(path, FALSE, pb->edit_baton, pool); *file_baton = b; SVN_ERR(get_file_from_ra(b)); return SVN_NO_ERROR;}/* Do the work of applying the text delta. */static svn_error_t *window_handler(svn_txdelta_window_t *window, void *window_baton){ struct file_baton *b = window_baton; SVN_ERR(b->apply_handler(window, b->apply_baton)); if (!window) { SVN_ERR(svn_io_file_close(b->file_start_revision, b->pool)); SVN_ERR(svn_io_file_close(b->file_end_revision, b->pool)); } return SVN_NO_ERROR;}/* An editor function. */static svn_error_t *apply_textdelta(void *file_baton, const char *base_checksum, apr_pool_t *pool, svn_txdelta_window_handler_t *handler, void **handler_baton){ struct file_baton *b = file_baton;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -