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

📄 fs-test.c

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 C
📖 第 1 页 / 共 5 页
字号:
    SVN_ERR(svn_fs_commit_txn(&conflict, &after_rev, txn, subpool));    /* Carefully validate that tree in the new revision, now. */    SVN_ERR(svn_fs_revision_root(&revision_root, fs, after_rev, subpool));    SVN_ERR(svn_test__validate_tree(revision_root, expected_entries, 20,                                     subpool));  }  svn_pool_destroy(subpool);  /* In a new txn, modify the greek tree. */  subpool = svn_pool_create(pool);  {    static svn_test__tree_entry_t expected_entries[] = {      /* path, contents (0 = dir) */      { "iota",          "This is a new version of 'iota'.\n" },      { "A",             0 },      { "A/B",           0 },      { "A/B/lambda",    "This is the file 'lambda'.\n" },      { "A/B/E",         0 },      { "A/B/E/alpha",   "This is the file 'alpha'.\n" },      { "A/B/E/beta",    "This is the file 'beta'.\n" },      { "A/B/F",         0 },      { "A/C",           0 },      { "A/C/kappa",     "This is the file 'kappa'.\n" },      { "A/D",           0 },      { "A/D/gamma",     "This is the file 'gamma'.\n" },      { "A/D/H",         0 },      { "A/D/H/chi",     "This is the file 'chi'.\n" },      { "A/D/H/psi",     "This is the file 'psi'.\n" },      { "A/D/H/omega",   "This is the file 'omega'.\n" },      { "A/D/I",         0 },      { "A/D/I/delta",   "This is the file 'delta'.\n" },      { "A/D/I/epsilon", "This is the file 'epsilon'.\n" }    };    SVN_ERR(svn_fs_begin_txn(&txn, fs, after_rev, subpool));    SVN_ERR(svn_fs_txn_root(&txn_root, txn, subpool));    SVN_ERR(svn_test__set_file_contents             (txn_root, "iota", "This is a new version of 'iota'.\n",              subpool));    SVN_ERR(svn_fs_delete(txn_root, "A/mu", subpool));                SVN_ERR(svn_fs_delete(txn_root, "A/D/G", subpool));                SVN_ERR(svn_fs_make_dir(txn_root, "A/D/I", subpool));    SVN_ERR(svn_fs_make_file(txn_root, "A/D/I/delta", subpool));    SVN_ERR(svn_test__set_file_contents             (txn_root, "A/D/I/delta", "This is the file 'delta'.\n",              subpool));    SVN_ERR(svn_fs_make_file(txn_root, "A/D/I/epsilon", subpool));    SVN_ERR(svn_test__set_file_contents             (txn_root, "A/D/I/epsilon", "This is the file 'epsilon'.\n",              subpool));    SVN_ERR(svn_fs_make_file(txn_root, "A/C/kappa", subpool));    SVN_ERR(svn_test__set_file_contents             (txn_root, "A/C/kappa", "This is the file 'kappa'.\n",              subpool));    /* Carefully validate that tree in the transaction. */    SVN_ERR(svn_test__validate_tree(txn_root, expected_entries, 19,                                     subpool));        /* Go ahead and commit the tree, and destroy the txn object.  */    SVN_ERR(svn_fs_commit_txn(&conflict, &after_rev, txn, subpool));    /* Carefully validate that tree in the new revision, now. */    SVN_ERR(svn_fs_revision_root(&revision_root, fs, after_rev, subpool));    SVN_ERR(svn_test__validate_tree(revision_root, expected_entries,                                    19, subpool));  }  svn_pool_destroy(subpool);  return SVN_NO_ERROR;}/* Commit with merging (committing against non-youngest). */ static svn_error_t *merging_commit(const char **msg,               svn_boolean_t msg_only,               svn_test_opts_t *opts,               apr_pool_t *pool){  svn_fs_t *fs;  svn_fs_txn_t *txn;  svn_fs_root_t *txn_root, *revision_root;  svn_revnum_t after_rev;  svn_revnum_t revisions[24];  apr_size_t i;  svn_revnum_t revision_count;  *msg = "merging commit";  if (msg_only)    return SVN_NO_ERROR;  /* Prepare a filesystem. */  SVN_ERR(svn_test__create_fs(&fs, "test-repo-merging-commit",                              opts->fs_type, pool));  /* Initialize our revision number stuffs. */  for (i = 0;       i < ((sizeof(revisions)) / (sizeof(svn_revnum_t)));       i++)    revisions[i] = SVN_INVALID_REVNUM;  revision_count = 0;  revisions[revision_count++] = 0; /* the brand spankin' new revision */  /***********************************************************************/  /* REVISION 0 */  /***********************************************************************/  /* In one txn, create and commit the greek tree. */  SVN_ERR(svn_fs_begin_txn(&txn, fs, 0, pool));  SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));  SVN_ERR(svn_test__create_greek_tree(txn_root, pool));  SVN_ERR(test_commit_txn(&after_rev, txn, NULL, pool));  /***********************************************************************/  /* REVISION 1 */  /***********************************************************************/  {    static svn_test__tree_entry_t expected_entries[] = {      /* path, contents (0 = dir) */      { "iota",        "This is the file 'iota'.\n" },      { "A",           0 },      { "A/mu",        "This is the file 'mu'.\n" },      { "A/B",         0 },      { "A/B/lambda",  "This is the file 'lambda'.\n" },      { "A/B/E",       0 },      { "A/B/E/alpha", "This is the file 'alpha'.\n" },      { "A/B/E/beta",  "This is the file 'beta'.\n" },      { "A/B/F",       0 },      { "A/C",         0 },      { "A/D",         0 },      { "A/D/gamma",   "This is the file 'gamma'.\n" },      { "A/D/G",       0 },      { "A/D/G/pi",    "This is the file 'pi'.\n" },      { "A/D/G/rho",   "This is the file 'rho'.\n" },      { "A/D/G/tau",   "This is the file 'tau'.\n" },      { "A/D/H",       0 },      { "A/D/H/chi",   "This is the file 'chi'.\n" },      { "A/D/H/psi",   "This is the file 'psi'.\n" },      { "A/D/H/omega", "This is the file 'omega'.\n" }    };    SVN_ERR(svn_fs_revision_root(&revision_root, fs, after_rev, pool));     SVN_ERR(svn_test__validate_tree(revision_root, expected_entries,                                     20, pool));  }  revisions[revision_count++] = after_rev;  /* Let's add a directory and some files to the tree, and delete      'iota' */  SVN_ERR(svn_fs_begin_txn(&txn, fs, revisions[revision_count-1], pool));  SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));  SVN_ERR(svn_fs_make_dir(txn_root, "A/D/I", pool));  SVN_ERR(svn_fs_make_file(txn_root, "A/D/I/delta", pool));  SVN_ERR(svn_test__set_file_contents           (txn_root, "A/D/I/delta", "This is the file 'delta'.\n", pool));  SVN_ERR(svn_fs_make_file(txn_root, "A/D/I/epsilon", pool));  SVN_ERR(svn_test__set_file_contents           (txn_root, "A/D/I/epsilon", "This is the file 'epsilon'.\n", pool));  SVN_ERR(svn_fs_make_file(txn_root, "A/C/kappa", pool));  SVN_ERR(svn_test__set_file_contents           (txn_root, "A/C/kappa", "This is the file 'kappa'.\n", pool));  SVN_ERR(svn_fs_delete(txn_root, "iota", pool));  SVN_ERR(test_commit_txn(&after_rev, txn, NULL, pool));  /***********************************************************************/  /* REVISION 2 */  /***********************************************************************/  {    static svn_test__tree_entry_t expected_entries[] = {      /* path, contents (0 = dir) */      { "A",             0 },      { "A/mu",          "This is the file 'mu'.\n" },      { "A/B",           0 },      { "A/B/lambda",    "This is the file 'lambda'.\n" },      { "A/B/E",         0 },      { "A/B/E/alpha",   "This is the file 'alpha'.\n" },      { "A/B/E/beta",    "This is the file 'beta'.\n" },      { "A/B/F",         0 },      { "A/C",           0 },      { "A/C/kappa",     "This is the file 'kappa'.\n" },      { "A/D",           0 },      { "A/D/gamma",     "This is the file 'gamma'.\n" },      { "A/D/G",         0 },      { "A/D/G/pi",      "This is the file 'pi'.\n" },      { "A/D/G/rho",     "This is the file 'rho'.\n" },      { "A/D/G/tau",     "This is the file 'tau'.\n" },      { "A/D/H",         0 },      { "A/D/H/chi",     "This is the file 'chi'.\n" },      { "A/D/H/psi",     "This is the file 'psi'.\n" },      { "A/D/H/omega",   "This is the file 'omega'.\n" },      { "A/D/I",         0 },      { "A/D/I/delta",   "This is the file 'delta'.\n" },      { "A/D/I/epsilon", "This is the file 'epsilon'.\n" }    };    SVN_ERR(svn_fs_revision_root(&revision_root, fs, after_rev, pool));     SVN_ERR(svn_test__validate_tree(revision_root, expected_entries,                                     23, pool));  }  revisions[revision_count++] = after_rev;  /* We don't think the A/D/H directory is pulling its weight...let's     knock it off.  Oh, and let's re-add iota, too. */  SVN_ERR(svn_fs_begin_txn(&txn, fs, revisions[revision_count-1], pool));  SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));  SVN_ERR(svn_fs_delete(txn_root, "A/D/H", pool));  SVN_ERR(svn_fs_make_file(txn_root, "iota", pool));  SVN_ERR(svn_test__set_file_contents           (txn_root, "iota", "This is the new file 'iota'.\n", pool));  SVN_ERR(test_commit_txn(&after_rev, txn, NULL, pool));  /***********************************************************************/  /* REVISION 3 */  /***********************************************************************/  {    static svn_test__tree_entry_t expected_entries[] = {      /* path, contents (0 = dir) */      { "iota",          "This is the new file 'iota'.\n" },      { "A",             0 },      { "A/mu",          "This is the file 'mu'.\n" },      { "A/B",           0 },      { "A/B/lambda",    "This is the file 'lambda'.\n" },      { "A/B/E",         0 },      { "A/B/E/alpha",   "This is the file 'alpha'.\n" },      { "A/B/E/beta",    "This is the file 'beta'.\n" },      { "A/B/F",         0 },      { "A/C",           0 },      { "A/C/kappa",     "This is the file 'kappa'.\n" },      { "A/D",           0 },      { "A/D/gamma",     "This is the file 'gamma'.\n" },      { "A/D/G",         0 },      { "A/D/G/pi",      "This is the file 'pi'.\n" },      { "A/D/G/rho",     "This is the file 'rho'.\n" },      { "A/D/G/tau",     "This is the file 'tau'.\n" },      { "A/D/I",         0 },      { "A/D/I/delta",   "This is the file 'delta'.\n" },      { "A/D/I/epsilon", "This is the file 'epsilon'.\n" }    };    SVN_ERR(svn_fs_revision_root(&revision_root, fs, after_rev, pool));     SVN_ERR(svn_test__validate_tree(revision_root, expected_entries,                                     20, pool));  }  revisions[revision_count++] = after_rev;  /* Delete iota (yet again). */  SVN_ERR(svn_fs_begin_txn(&txn, fs, revisions[revision_count-1], pool));  SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));  SVN_ERR(svn_fs_delete(txn_root, "iota", pool));   SVN_ERR(test_commit_txn(&after_rev, txn, NULL, pool));  /***********************************************************************/  /* REVISION 4 */  /***********************************************************************/  {    static svn_test__tree_entry_t expected_entries[] = {      /* path, contents (0 = dir) */      { "A",             0 },      { "A/mu",          "This is the file 'mu'.\n" },      { "A/B",           0 },      { "A/B/lambda",    "This is the file 'lambda'.\n" },      { "A/B/E",         0 },      { "A/B/E/alpha",   "This is the file 'alpha'.\n" },      { "A/B/E/beta",    "This is the file 'beta'.\n" },      { "A/B/F",         0 },      { "A/C",           0 },      { "A/C/kappa",     "This is the file 'kappa'.\n" },      { "A/D",           0 },      { "A/D/gamma",     "This is the file 'gamma'.\n" },      { "A/D/G",         0 },      { "A/D/G/pi",      "This is the file 'pi'.\n" },      { "A/D/G/rho",     "This is the file 'rho'.\n" },      { "A/D/G/tau",     "This is the file 'tau'.\n" },      { "A/D/I",         0 },      { "A/D/I/delta",   "This is the file 'delta'.\n" },      { "A/D/I/epsilon", "This is the file 'epsilon'.\n" }    };    SVN_ERR(svn_fs_revision_root(&revision_root, fs, after_rev, pool));     SVN_ERR(svn_test__validate_tree(revision_root, expected_entries,                                     19, pool));  }  revisions[revision_count++] = after_rev;  /***********************************************************************/  /* GIVEN:  A and B, with common ancestor ANCESTOR, where A and B     directories, and E, an entry in either A, B, or ANCESTOR.     For every E, the following cases exist:      - E exists in neither ANCESTOR nor A.      - E doesn't exist in ANCESTOR, and has been added to A.      - E exists in ANCESTOR, but has been deleted from A.      - E exists in both ANCESTOR and A ...        - but refers to different node revisions.        - and refers to the same node revision.     The same set of possible relationships with ANCESTOR holds for B,     so there are thirty-six combinations.  The matrix is symmetrical     with A and B reversed, so we only have to describe one triangular     half, including the diagonal --- 21 combinations.     Our goal here is to test all the possible scenarios that can     occur given the above boolean logic table, and to make sure that     the results we get are as expected.       The test cases below have the following features:     - They run straight through the scenarios as described in the       `structure' document at this time.     - In each case, a txn is begun based on some revision (ANCESTOR),       is modified into a new tree (B), and then is attempted to be       committed (which happens against the head of the tree, A).     - If the commit is successful (and is *expected* to be such),       that new revision (which exists now as a result of the       successful commit) is thoroughly tested for accuracy of tree       entries, and in the case of files, for their contents.  It is       important to realize that these successful commits are       advancing the head of the tree, and each one effective becomes       the new `A' described in further test cases.  */  /***********************************************************************/  /* (6) E exists in neither ANCESTOR nor A. */  {    /* (1) E exists in neither ANCESTOR nor B.  Can't occur, by       assumption that E exists in either A, B, or ancestor. */    /* (1) E has been added to B.  Add E in the merged result. */    SVN_ERR(svn_fs_begin_txn(&txn, fs, revisions[0], pool));    SVN_ERR(svn_fs_txn_root(&txn_root, txn, pool));    SVN_ERR(svn_fs_make_file(txn_root, "theta", pool));    SVN_ERR(svn_test__set_file_contents             (txn_root, "theta", "This is the file 'theta'.\n", pool));    SVN_ERR(test_commit_txn(&after_rev, txn, NULL, pool));    /*********************************************************************/    /* REVISION 5 */    /*********************************************************************/    {      static svn_test__tree_entry_t expected_entries[] = {        /* path, contents (0 = dir) */        { "theta",         "This is the file 'theta'.\n" },        { "A",             0 },        { "A/mu",          "This is the file 'mu'.\n" },        { "A/B",           0 },        { "A/B/lambda",    "This is the file 'lambda'.\n" },        { "A/B/E",         0 },        { "A/B/E/alpha",   "This is the file 'alpha'.\n" },        { "A/B/E/beta",    "This is the file 'beta'.\n" },        { "A/B/F",         0 },        { "A/C",           0 },        { "A/C/kappa",     "This is the file 'kappa'.\n" },        { "A/D",           0 },        { "A/D/gamma",     "This is the file 'gamma'.\n" },        { "A/D/G",         0 },        { "A/D/G/pi",      "This is the file 'pi'.\n" },        { "A/D/G/rho",     "This is the file 'rho'.\n" },        { "A/D/G/tau",     "This is the file 'tau'.\n" },        { "A/D/I",         0 },        { "A/D/I/delta",   "This is the file 'delta'.\n" },        { "A/D/I/epsilon", "This is the file 'epsilon'.\n" }      };

⌨️ 快捷键说明

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