[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1075942 - in /subversion/trunk: notes/wc-ng/pristine-store subversion/libsvn_wc/wc_db.h subversion/libsvn_wc/wc_db_pristine.c subversion/tests/libsvn_wc/pristine-store-test.c

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Wed, 2 Mar 2011 05:44:14 +0200

julianfoad_at_apache.org wrote on Tue, Mar 01, 2011 at 17:47:05 -0000:
> * notes/wc-ng/pristine-store
> * subversion/libsvn_wc/wc_db_pristine.c

:-)

> +/* Check that the store rejects an attempt to replace an existing pristine
> + * text with different text.
> + *
> + * White-box knowledge: The implementation compares the file sizes but
> + * doesn't compare the text itself, so in this test we ensure the second
> + * text is a different size. */
> +static svn_error_t *
> +reject_mismatching_text(const svn_test_opts_t *opts,
> + apr_pool_t *pool)
> +{
> + svn_wc__db_t *db;
> + const char *repos_url;
> + const char *wc_abspath;
> + const char *pristine_tmp_dir;
> +
> + const char data[] = "Blah";
> + svn_checksum_t *data_sha1, *data_md5;
> +
> + const char data2[] = "Baz";
> +
> + SVN_ERR(create_repos_and_wc(&repos_url, &wc_abspath, &db,
> + "reject_mismatching_text", opts, pool));
> +
> + SVN_ERR(svn_wc__db_pristine_get_tempdir(&pristine_tmp_dir, db,
> + wc_abspath, pool, pool));
> +
> + /* Install a pristine text. */
> + {
> + const char *path;
> +
> + SVN_ERR(write_and_checksum_temp_file(&path, &data_sha1, &data_md5,
> + data, pristine_tmp_dir, pool));
> + SVN_ERR(svn_wc__db_pristine_install(db, path, data_sha1, data_md5, pool));
> + }
> +
> + /* Try to install the wrong pristine text against the same checksum.
> + * Should fail. */
> + {
> + svn_error_t *err;
> + const char *path;
> +
> + SVN_ERR(write_and_checksum_temp_file(&path, NULL, NULL,
> + data2, pristine_tmp_dir, pool));
> + err = svn_wc__db_pristine_install(db, path, data_sha1, data_md5, pool);
> + SVN_TEST_ASSERT(err != NULL);
> + SVN_TEST_ASSERT(err->apr_err == SVN_ERR_WC_CORRUPT_TEXT_BASE);

The error being checked for here won't get thrown if SVN_DEBUG
is not defined.

> + svn_error_clear(err);
> + }
> +
> + return SVN_NO_ERROR;
> +}
Received on 2011-03-02 04:51:49 CET

This is an archived mail posted to the Subversion Dev mailing list.