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

📄 replay.c

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 C
📖 第 1 页 / 共 2 页
字号:
              SVN_ERR(cb->authz_read_func(&src_readable, copyfrom_root,                                          copyfrom_path,                                          cb->authz_read_baton, pool));            }        }      /* Save away the copyfrom path in case we null it out below. */      real_copyfrom_path = copyfrom_path;      /* If we have a copyfrom path, and we can't read it or we're just         ignoring it, or the copyfrom rev is prior to the low water mark         then we just null them out and do a raw add with no history at         all. */      if (copyfrom_path          && (! src_readable              || ! is_within_base_path(copyfrom_path + 1, base_path,                                       base_path_len)              || cb->low_water_mark > copyfrom_rev))        {          copyfrom_path = NULL;          copyfrom_rev = SVN_INVALID_REVNUM;        }      /* Do the right thing based on the path KIND. */      if (kind == svn_node_dir)        {          /* If this is a copy, but we can't represent it as such,             then we just do a recursive add of the source path             contents. */          if (real_copyfrom_path && ! copyfrom_path)            {              SVN_ERR(add_subdir(copyfrom_root, root, editor, edit_baton,                                 path, parent_baton, real_copyfrom_path,                                 cb->authz_read_func, cb->authz_read_baton,                                 pool, dir_baton));            }          else            {              SVN_ERR(editor->add_directory(path, parent_baton,                                            copyfrom_path, copyfrom_rev,                                            pool, dir_baton));            }        }      else        {          SVN_ERR(editor->add_file(path, parent_baton, copyfrom_path,                                   copyfrom_rev, pool, &file_baton));        }      /* If we represent this as a copy... */      if (copyfrom_path)        {          /* If it is a directory, make sure descendants get the correct             delta source by remembering that we are operating inside a             (possibly nested) copy operation. */          if (kind == svn_node_dir)            {              struct copy_info *info = &APR_ARRAY_PUSH(cb->copies,                                                       struct copy_info);              info->path = apr_pstrdup(cb->pool, path);              info->copyfrom_path = apr_pstrdup(cb->pool, copyfrom_path);              info->copyfrom_rev = copyfrom_rev;            }          /* Save the source so that we can use it later, when we             need to generate text and prop deltas. */          source_root = copyfrom_root;          source_path = copyfrom_path;        }      else        /* Else, we are an add without history... */        {          /* If an ancestor is added with history, we need to forget about             that here, go on with life and repeat all the mistakes of our             past... */          if (kind == svn_node_dir && cb->copies->nelts > 0)            {              struct copy_info *info = &APR_ARRAY_PUSH(cb->copies,                                                       struct copy_info);              info->path = apr_pstrdup(cb->pool, path);              info->copyfrom_path = NULL;              info->copyfrom_rev = SVN_INVALID_REVNUM;            }          source_root = NULL;          source_path = NULL;        }    }  else if (! do_delete)    {      /* Do the right thing based on the path KIND (and the presence         of a PARENT_BATON). */      if (kind == svn_node_dir)        {          if (parent_baton)            {              SVN_ERR(editor->open_directory(path, parent_baton,                                              SVN_INVALID_REVNUM,                                             pool, dir_baton));            }          else            {              SVN_ERR(editor->open_root(edit_baton, SVN_INVALID_REVNUM,                                         pool, dir_baton));            }        }      else        {          SVN_ERR(editor->open_file(path, parent_baton, SVN_INVALID_REVNUM,                                    pool, &file_baton));        }      /* If we are inside an add with history, we need to adjust the         delta source. */      if (cb->copies->nelts > 0)        {          struct copy_info *info = &APR_ARRAY_IDX(cb->copies,                                                  cb->copies->nelts - 1,                                                  struct copy_info);          if (info->copyfrom_path)            {              SVN_ERR(svn_fs_revision_root(&source_root,                                           svn_fs_root_fs(root),                                           info->copyfrom_rev, pool));              source_path = svn_path_join(info->copyfrom_path,                                          svn_path_is_child(info->path, path,                                                            pool), pool);            }          else            {              /* This is an add without history, nested inside an                 add with history.  We have no delta source in this case. */              source_root = NULL;              source_path = NULL;            }        }    }  /* Handle property modifications. */  if (! do_delete || do_add)    {      if (change->prop_mod)        {          if (cb->compare_root)            {              apr_array_header_t *prop_diffs;              apr_hash_t *old_props;              apr_hash_t *new_props;              int i;              if (source_root)                SVN_ERR(svn_fs_node_proplist                        (&old_props, source_root, source_path, pool));              else                old_props = apr_hash_make(pool);              SVN_ERR(svn_fs_node_proplist(&new_props, root, path, pool));              SVN_ERR(svn_prop_diffs(&prop_diffs, new_props, old_props,                                     pool));              for (i = 0; i < prop_diffs->nelts; ++i)                {                  svn_prop_t *pc = &APR_ARRAY_IDX(prop_diffs, i, svn_prop_t);                   if (kind == svn_node_dir)                     SVN_ERR(editor->change_dir_prop(*dir_baton, pc->name,                                                     pc->value, pool));                   else if (kind == svn_node_file)                     SVN_ERR(editor->change_file_prop(file_baton, pc->name,                                                      pc->value, pool));                }            }          else            {              /* Just do a dummy prop change to signal that there are *any*                 propmods. */              if (kind == svn_node_dir)                SVN_ERR(editor->change_dir_prop(*dir_baton, "", NULL,                                                pool));              else if (kind == svn_node_file)                SVN_ERR(editor->change_file_prop(file_baton, "", NULL,                                                 pool));            }        }      /* Handle textual modifications.         Note that this needs to happen in the "copy from a file we         aren't allowed to see" case since otherwise the caller will         have no way to actually get the new file's contents, which         they are apparently allowed to see. */      if (kind == svn_node_file          && (change->text_mod || (real_copyfrom_path && ! copyfrom_path)))        {          svn_txdelta_window_handler_t delta_handler;          void *delta_handler_baton;          const char *checksum = NULL;          if (cb->compare_root && source_root && source_path)            {              unsigned char digest[APR_MD5_DIGESTSIZE];              SVN_ERR(svn_fs_file_md5_checksum(digest,                                               source_root,                                               source_path,                                               pool));              checksum = svn_md5_digest_to_cstring(digest, pool);            }          SVN_ERR(editor->apply_textdelta(file_baton, checksum, pool,                                           &delta_handler,                                           &delta_handler_baton));          if (cb->compare_root)            {              svn_txdelta_stream_t *delta_stream;              SVN_ERR(svn_fs_get_file_delta_stream                      (&delta_stream, source_root, source_path,                       root, path, pool));              SVN_ERR(svn_txdelta_send_txstream(delta_stream,                                                delta_handler,                                                delta_handler_baton,                                                pool));            }          else            SVN_ERR(delta_handler(NULL, delta_handler_baton));        }    }  /* Close the file baton if we opened it. */  if (file_baton)    {      unsigned char digest[APR_MD5_DIGESTSIZE];      SVN_ERR(svn_fs_file_md5_checksum(digest, root, path, pool));      SVN_ERR(editor->close_file(file_baton,                                  svn_md5_digest_to_cstring(digest, pool),                                 pool));    }  return SVN_NO_ERROR;}svn_error_t *svn_repos_replay2(svn_fs_root_t *root,                  const char *base_path,                  svn_revnum_t low_water_mark,                  svn_boolean_t send_deltas,                  const svn_delta_editor_t *editor,                  void *edit_baton,                  svn_repos_authz_func_t authz_read_func,                  void *authz_read_baton,                  apr_pool_t *pool){  apr_hash_t *fs_changes;  apr_hash_t *changed_paths;  apr_hash_index_t *hi;  apr_array_header_t *paths;  struct path_driver_cb_baton cb_baton;  int base_path_len;  /* Fetch the paths changed under ROOT. */  SVN_ERR(svn_fs_paths_changed(&fs_changes, root, pool));  if (! base_path)    base_path = "";  else if (base_path[0] == '/')    ++base_path;  base_path_len = strlen(base_path);  /* Make an array from the keys of our CHANGED_PATHS hash, and copy     the values into a new hash whose keys have no leading slashes. */  paths = apr_array_make(pool, apr_hash_count(fs_changes),                         sizeof(const char *));  changed_paths = apr_hash_make(pool);  for (hi = apr_hash_first(pool, fs_changes); hi; hi = apr_hash_next(hi))    {      const void *key;      void *val;      apr_ssize_t keylen;      const char *path;      svn_fs_path_change_t *change;      svn_boolean_t allowed = TRUE;      apr_hash_this(hi, &key, &keylen, &val);      path = key;      change = val;      if (authz_read_func)        SVN_ERR(authz_read_func(&allowed, root, path, authz_read_baton,                                pool));      if (allowed)        {          if (path[0] == '/')            {              path++;              keylen--;            }          /* If the base_path doesn't match the top directory of this path             we don't want anything to do with it... */          if (is_within_base_path(path, base_path, base_path_len))            {              APR_ARRAY_PUSH(paths, const char *) = path;              apr_hash_set(changed_paths, path, keylen, change);            }        }    }  /* If we were not given a low water mark, assume that everything is there,     all the way back to revision 0. */   if (! SVN_IS_VALID_REVNUM(low_water_mark))    low_water_mark = 0;   /* Initialize our callback baton. */  cb_baton.editor = editor;  cb_baton.edit_baton = edit_baton;  cb_baton.root = root;  cb_baton.changed_paths = changed_paths;  cb_baton.authz_read_func = authz_read_func;  cb_baton.authz_read_baton = authz_read_baton;  cb_baton.base_path = base_path;  cb_baton.base_path_len = base_path_len;  cb_baton.low_water_mark = low_water_mark;  if (send_deltas)    {      svn_revnum_t revision = svn_fs_revision_root_revision(root);      svn_revnum_t compare_root_revision;      if (! SVN_IS_VALID_REVNUM(revision))        {          svn_fs_txn_t *txn;          const char *txn_name = svn_fs_txn_root_name(root, pool);          SVN_ERR(svn_fs_open_txn(&txn, svn_fs_root_fs(root),                                  txn_name, pool));          compare_root_revision = svn_fs_txn_base_revision(txn);        }      else        compare_root_revision = revision - 1;      SVN_ERR(svn_fs_revision_root(&cb_baton.compare_root,                                   svn_fs_root_fs(root),                                   compare_root_revision,                                   pool));    }  else    cb_baton.compare_root = NULL;  cb_baton.copies = apr_array_make(pool, 4, sizeof(struct copy_info));  cb_baton.pool = pool;  /* Determine the revision to use throughout the edit, and call     EDITOR's set_target_revision() function.  */  if (svn_fs_is_revision_root(root))    {      svn_revnum_t revision = svn_fs_revision_root_revision(root);      SVN_ERR(editor->set_target_revision(edit_baton, revision, pool));    }  /* Call the path-based editor driver. */  SVN_ERR(svn_delta_path_driver(editor, edit_baton,                                 SVN_INVALID_REVNUM, paths,                                 path_driver_cb_func, &cb_baton, pool));    return SVN_NO_ERROR;}svn_error_t *svn_repos_replay(svn_fs_root_t *root,                 const svn_delta_editor_t *editor,                 void *edit_baton,                 apr_pool_t *pool){  return svn_repos_replay2(root,                           "" /* the whole tree */,                           SVN_INVALID_REVNUM, /* no low water mark */                           FALSE /* no text deltas */,                           editor, edit_baton,                           NULL /* no authz func */,                           NULL /* no authz baton */,                           pool);}

⌨️ 快捷键说明

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