⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tree.c

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 C
📖 第 1 页 / 共 5 页
字号:
  if (proplist)    *(args->value_p) = apr_hash_get(proplist, args->propname,                                    APR_HASH_KEY_STRING);  return SVN_NO_ERROR;}static svn_error_t *base_node_prop(svn_string_t **value_p,               svn_fs_root_t *root,               const char *path,               const char *propname,               apr_pool_t *pool){  struct node_prop_args args;  svn_string_t *value;  args.value_p  = &value;  args.root     = root;  args.path     = path;  args.propname = propname;  SVN_ERR(svn_fs_base__retry_txn(root->fs, txn_body_node_prop, &args, pool));  *value_p = value;  return SVN_NO_ERROR;}struct node_proplist_args {  apr_hash_t **table_p;  svn_fs_root_t *root;  const char *path;};static svn_error_t *txn_body_node_proplist(void *baton, trail_t *trail){  struct node_proplist_args *args = baton;  dag_node_t *node;  apr_hash_t *proplist;  SVN_ERR(get_dag(&node, args->root, args->path, trail, trail->pool));  SVN_ERR(svn_fs_base__dag_get_proplist(&proplist, node,                                         trail, trail->pool));  *args->table_p = proplist ? proplist : apr_hash_make(trail->pool);  return SVN_NO_ERROR;}static svn_error_t *base_node_proplist(apr_hash_t **table_p,                   svn_fs_root_t *root,                   const char *path,                   apr_pool_t *pool){  apr_hash_t *table;  struct node_proplist_args args;  args.table_p = &table;  args.root = root;  args.path = path;  SVN_ERR(svn_fs_base__retry_txn(root->fs, txn_body_node_proplist, &args,                                 pool));  *table_p = table;  return SVN_NO_ERROR;}struct change_node_prop_args {  svn_fs_root_t *root;  const char *path;  const char *name;  const svn_string_t *value;};static svn_error_t *txn_body_change_node_prop(void *baton,                          trail_t *trail){  struct change_node_prop_args *args = baton;  parent_path_t *parent_path;  apr_hash_t *proplist;  const char *txn_id = args->root->txn;  SVN_ERR(open_path(&parent_path, args->root, args->path, 0, txn_id,                     trail, trail->pool));  /* Check to see if path is locked; if so, check that we can use it.     Notice that we're doing this non-recursively, regardless of node kind. */  if (args->root->txn_flags & SVN_FS_TXN_CHECK_LOCKS)    SVN_ERR(svn_fs_base__allow_locked_operation             (args->path, FALSE, trail, trail->pool));  SVN_ERR(make_path_mutable(args->root, parent_path, args->path,                             trail, trail->pool));  SVN_ERR(svn_fs_base__dag_get_proplist(&proplist, parent_path->node,                                        trail, trail->pool));  /* If there's no proplist, but we're just deleting a property, exit now. */  if ((! proplist) && (! args->value))    return SVN_NO_ERROR;  /* Now, if there's no proplist, we know we need to make one. */  if (! proplist)    proplist = apr_hash_make(trail->pool);  /* Set the property. */  apr_hash_set(proplist, args->name, APR_HASH_KEY_STRING, args->value);  /* Overwrite the node's proplist. */  SVN_ERR(svn_fs_base__dag_set_proplist(parent_path->node, proplist,                                        txn_id, trail, trail->pool));  /* Make a record of this modification in the changes table. */  SVN_ERR(add_change(args->root->fs, txn_id,                     args->path, svn_fs_base__dag_get_id(parent_path->node),                     svn_fs_path_change_modify, 0, 1, trail, trail->pool));  return SVN_NO_ERROR;}static svn_error_t *base_change_node_prop(svn_fs_root_t *root,                      const char *path,                      const char *name,                      const svn_string_t *value,                      apr_pool_t *pool){  struct change_node_prop_args args;  if (! root->is_txn_root)    return NOT_TXN(root);  args.root  = root;  args.path  = path;  args.name  = name;  args.value = value;  SVN_ERR(svn_fs_base__retry_txn(root->fs, txn_body_change_node_prop, &args,                                 pool));  return SVN_NO_ERROR;}struct things_changed_args{  svn_boolean_t *changed_p;  svn_fs_root_t *root1;  svn_fs_root_t *root2;  const char *path1;  const char *path2;  apr_pool_t *pool;};static svn_error_t *txn_body_props_changed(void *baton, trail_t *trail){  struct things_changed_args *args = baton;  dag_node_t *node1, *node2;  SVN_ERR(get_dag(&node1, args->root1, args->path1, trail, trail->pool));  SVN_ERR(get_dag(&node2, args->root2, args->path2, trail, trail->pool));  SVN_ERR(svn_fs_base__things_different(args->changed_p, NULL,                                        node1, node2, trail, trail->pool));  return SVN_NO_ERROR;}static svn_error_t *base_props_changed(svn_boolean_t *changed_p,                   svn_fs_root_t *root1,                   const char *path1,                   svn_fs_root_t *root2,                   const char *path2,                   apr_pool_t *pool){  struct things_changed_args args;  /* Check that roots are in the same fs. */  if (root1->fs != root2->fs)    return svn_error_create      (SVN_ERR_FS_GENERAL, NULL,       _("Cannot compare property value between two different filesystems"));  args.root1      = root1;  args.root2      = root2;  args.path1      = path1;  args.path2      = path2;  args.changed_p  = changed_p;  args.pool       = pool;  SVN_ERR(svn_fs_base__retry_txn(root1->fs, txn_body_props_changed,                                 &args, pool));  return SVN_NO_ERROR;}/* Getting a directory's entries */struct dir_entries_args{  apr_hash_t **table_p;  svn_fs_root_t *root;  const char *path;};static svn_error_t *txn_body_dir_entries(void *baton,                     trail_t *trail){  struct dir_entries_args *args = baton;  dag_node_t *node;  apr_hash_t *entries;  SVN_ERR(get_dag(&node, args->root, args->path, trail, trail->pool));  /* Get the entries for PARENT_PATH. */  SVN_ERR(svn_fs_base__dag_dir_entries(&entries, node, trail, trail->pool));  /* Potentially initialize the return value to an empty hash. */  *args->table_p = entries ? entries : apr_hash_make(trail->pool);  return SVN_NO_ERROR;}static svn_error_t *base_dir_entries(apr_hash_t **table_p,                 svn_fs_root_t *root,                 const char *path,                 apr_pool_t *pool){  struct dir_entries_args args;  apr_hash_t *table;  svn_fs_t *fs = root->fs;  args.table_p = &table;  args.root    = root;  args.path    = path;  SVN_ERR(svn_fs_base__retry_txn(root->fs, txn_body_dir_entries, &args,                                 pool));  /* Add in the kind data. */  if (table)    {      apr_hash_index_t *hi;      apr_pool_t *subpool = svn_pool_create(pool);      for (hi = apr_hash_first(subpool, table); hi; hi = apr_hash_next(hi))        {          svn_fs_dirent_t *entry;          struct node_kind_args nk_args;          void *val;          /* KEY will be the entry name in ancestor (about which we             simple don't care), VAL the dirent. */          apr_hash_this(hi, NULL, NULL, &val);          entry = val;          nk_args.id = entry->id;          SVN_ERR(svn_fs_base__retry_txn(fs, txn_body_node_kind, &nk_args,                                         pool));          entry->kind = nk_args.kind;        }    }  else    {      table = apr_hash_make(pool);    }  *table_p = table;  return SVN_NO_ERROR;}/* Merges and commits. */struct deltify_committed_args{  svn_fs_t *fs; /* the filesystem */  svn_revnum_t rev; /* revision just committed */  const char *txn_id; /* transaction just committed */};struct txn_deltify_args{  /* The target is what we're deltifying. */  const svn_fs_id_t *tgt_id;  /* The base is what we're deltifying against.  It's not necessarily     the "next" revision of the node; skip deltas mean we sometimes     deltify against a successor many generations away. */  const svn_fs_id_t *base_id;  /* We only deltify props for directories.     ### Didn't we try removing this horrid little optimization once?     ### What was the result?  I would have thought that skip deltas     ### mean directory undeltification is cheap enough now. */  svn_boolean_t is_dir;};static svn_error_t *txn_body_txn_deltify(void *baton, trail_t *trail){  struct txn_deltify_args *args = baton;  dag_node_t *tgt_node, *base_node;  SVN_ERR(svn_fs_base__dag_get_node(&tgt_node, trail->fs, args->tgt_id,                                    trail, trail->pool));  SVN_ERR(svn_fs_base__dag_get_node(&base_node, trail->fs, args->base_id,                                    trail, trail->pool));  SVN_ERR(svn_fs_base__dag_deltify(tgt_node, base_node, args->is_dir,                                   trail, trail->pool));  return SVN_NO_ERROR;}struct txn_pred_count_args{  const svn_fs_id_t *id;  int pred_count;};static svn_error_t *txn_body_pred_count(void *baton, trail_t *trail){  node_revision_t *noderev;  struct txn_pred_count_args *args = baton;  SVN_ERR(svn_fs_bdb__get_node_revision(&noderev, trail->fs,                                        args->id, trail, trail->pool));  args->pred_count = noderev->predecessor_count;  return SVN_NO_ERROR;}struct txn_pred_id_args{  const svn_fs_id_t *id;      /* The node id of for we want the predecessor. */  const svn_fs_id_t *pred_id; /* The returned predecessor id. */  apr_pool_t *pool;           /* The pool in which to allocate pred_id. */};static svn_error_t *txn_body_pred_id(void *baton, trail_t *trail){  node_revision_t *nr;  struct txn_pred_id_args *args = baton;  SVN_ERR(svn_fs_bdb__get_node_revision(&nr, trail->fs, args->id,                                         trail, trail->pool));  if (nr->predecessor_id)    args->pred_id = svn_fs_base__id_copy(nr->predecessor_id, args->pool);  else    args->pred_id = NULL;  return SVN_NO_ERROR;}/* Deltify ID's predecessor iff ID is mutable under TXN_ID in FS.  If   ID is a mutable directory, recurse.  Do this as part of TRAIL. */static svn_error_t *deltify_mutable(svn_fs_t *fs,                svn_fs_root_t *root,                const char *path,                const char *txn_id,                apr_pool_t *pool){  const svn_fs_id_t *id;  apr_hash_t *entries = NULL;  svn_node_kind_t kind;  struct txn_deltify_args td_args;  /* Get the ID for PATH under ROOT. */  SVN_ERR(base_node_id(&id, root, path, pool));  /* Check for mutability.  Not mutable?  Go no further.  This is safe     to do because for items in the tree to be mutable, their parent     dirs must also be mutable.  Therefore, if a directory is not     mutable under TXN_ID, its children cannot be.  */  if (strcmp(svn_fs_base__id_txn_id(id), txn_id))    return SVN_NO_ERROR;  /* Is this a directory?  */  SVN_ERR(base_check_path(&kind, root, path, pool));  /* If this is a directory, read its entries.  */  if (kind == svn_node_dir)    SVN_ERR(base_dir_entries(&entries, root, path, pool));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -