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

Re: svn commit: r33994 - in trunk/subversion: libsvn_client libsvn_repos tests/cmdline

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Mon, 03 Nov 2008 23:42:17 +0000

On Sat, 2008-11-01 at 09:44 -0700, sbutler_at_tigris.org wrote:
> Author: sbutler
> Date: Sat Nov 1 09:44:45 2008
> New Revision: 33994
>
> Log:
> In the client commit code, convert a "not found" error to the more
> helpful "out of date" error.
>
> This follows up on work done on the double-delete branch, which was
> merged to trunk in r32901.
>
> * subversion/tests/cmdline/commit_tests.py
> (commit_out_of_date_deletions): Expect "out of date" instead of
> "File not found: transaction".

This is commit_tests 28, and is failing ove RA-svn though it passes over
RA-local.

I've just been digging a bit but can't find where the problem is.

Here's the bit of output from commit_tests 28 over RA-svn. The first
commit of "A/C" correctly fails with "out of date"; the second commit of
"A/I" fails with "File not found..." which is not the error message we
want:

[[[
CMD: svn ci -m "log msg" svn-test-work/working_copies/commit_tests-28.backup/A/C --config-dir /home/julianfoad/build/subversion-tc3/subversion/tests/cmdline/svn-test-work/local_tmp/config --password rayjandom --no-auth-cache --username jrandom
Deleting svn-test-work/working_copies/commit_tests-28.backup/A/C
/home/julianfoad/src/subversion-tc3/subversion/libsvn_client/commit.c:864: (apr_err=160028)
svn: Commit failed (details follow):
/home/julianfoad/src/subversion-tc3/subversion/libsvn_repos/commit.c:124: (apr_err=160028)
svn: Directory '/A/C' is out of date
CMD: svn ci -m "log msg" svn-test-work/working_copies/commit_tests-28.backup/A/I --config-dir /home/julianfoad/build/subversion-tc3/subversion/tests/cmdline/svn-test-work/local_tmp/config --password rayjandom --no-auth-cache --username jrandom CMD: /home/julianfoad/src/subversion-tc3/bin/svn ci -m "log msg" svn-test-work/working_copies/commit_tests-28.backup/A/I --config-dir /home/julianfoad/build/subversion-tc3/subversion/tests/cmdline/svn-test-work/local_tmp/config --password rayjandom --no-auth-cache --username jrandom exited with 1
Sending svn-test-work/working_copies/commit_tests-28.backup/A/I
/home/julianfoad/src/subversion-tc3/subversion/libsvn_client/commit.c:864: (apr_err=160013)
svn: Commit failed (details follow):
/home/julianfoad/src/subversion-tc3/subversion/libsvn_fs_fs/tree.c:661: (apr_err=160013)
svn: File not found: transaction '3-4', path '/A/I'
]]]

I have a question in line below...

> * subversion/libsvn_client/commit_util.c
> (fixup_out_of_date_error): New function.
> (item_commit): Convert certain RA errors to "out of date".
>
> * subversion/libsvn_repos/commit.c
> (out_of_date): Minor tweak to error text.
>
> Modified:
> trunk/subversion/libsvn_client/commit_util.c
> trunk/subversion/libsvn_repos/commit.c
> trunk/subversion/tests/cmdline/commit_tests.py
>
> Modified: trunk/subversion/libsvn_client/commit_util.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_client/commit_util.c?pathrev=33994&r1=33993&r2=33994
> ==============================================================================
> --- trunk/subversion/libsvn_client/commit_util.c Sat Nov 1 08:06:53 2008 (r33993)
> +++ trunk/subversion/libsvn_client/commit_util.c Sat Nov 1 09:44:45 2008 (r33994)
> @@ -44,6 +44,22 @@
> #define SVN_CLIENT_COMMIT_DEBUG
> */
>
> +/* Wrap an RA error in an out-of-date error if warranted. */
> +static svn_error_t *
> +fixup_out_of_date_error(const char *path,
> + svn_node_kind_t kind,
> + svn_error_t *err)
> +{
> + if (err->apr_err == SVN_ERR_FS_NOT_FOUND
> + || err->apr_err == SVN_ERR_RA_DAV_PATH_NOT_FOUND)
> + return svn_error_createf(SVN_ERR_WC_NOT_UP_TO_DATE, err,
> + (kind == svn_node_dir
> + ? _("Directory '%s' is out of date")
> + : _("File '%s' is out of date")),
> + path);
> + else
> + return err;
> +}
>
>
> /*** Harvesting Commit Candidates ***/
> @@ -1068,6 +1084,7 @@ do_item_commit(void **dir_baton,
> const svn_delta_editor_t *editor = cb_baton->editor;
> apr_hash_t *file_mods = cb_baton->file_mods;
> svn_client_ctx_t *ctx = cb_baton->ctx;
> + svn_error_t *err = SVN_NO_ERROR;
>
> /* Do some initializations. */
> *dir_baton = NULL;
> @@ -1167,8 +1184,11 @@ do_item_commit(void **dir_baton,
> if (item->state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE)
> {
> SVN_ERR_ASSERT(parent_baton);
> - SVN_ERR(editor->delete_entry(path, item->revision,
> - parent_baton, pool));
> + err = editor->delete_entry(path, item->revision,
> + parent_baton, pool);
> +
> + if (err)
> + return fixup_out_of_date_error(path, item->kind, err);
> }
>
> /* If this item is supposed to be added, do so. */
> @@ -1224,9 +1244,12 @@ do_item_commit(void **dir_baton,
> if (! file_baton)
> {
> SVN_ERR_ASSERT(parent_baton);
> - SVN_ERR(editor->open_file(path, parent_baton,
> - item->revision,
> - file_pool, &file_baton));
> + err = editor->open_file(path, parent_baton,
> + item->revision,
> + file_pool, &file_baton);
> +
> + if (err)
> + return fixup_out_of_date_error(path, kind, err);
> }
> }
> else
> @@ -1249,6 +1272,18 @@ do_item_commit(void **dir_baton,
> }
>
> SVN_ERR(svn_wc_entry(&tmp_entry, item->path, adm_access, TRUE, pool));
> +
> + /* When committing a directory that no longer exists in the
> + repository, a "not found" error does not occur immediately
> + upon opening the directory. It appears here during the delta
> + transmisssion. */
> + err = svn_wc_transmit_prop_deltas
> + (item->path, adm_access, tmp_entry, editor,
> + (kind == svn_node_dir) ? *dir_baton : file_baton, NULL, pool);
> +
> + if (err)
> + return fixup_out_of_date_error(path, kind, err);
> +
> SVN_ERR(svn_wc_transmit_prop_deltas
> (item->path, adm_access, tmp_entry, editor,
> (kind == svn_node_dir) ? *dir_baton : file_baton, NULL, pool));

I'll query this: was that addition meant to replace, rather than
duplicate, the "svn_wc_transmit_prop_deltas(...)" call which now appears
twice?

> @@ -1288,9 +1323,12 @@ do_item_commit(void **dir_baton,
> if (! file_baton)
> {
> SVN_ERR_ASSERT(parent_baton);
> - SVN_ERR(editor->open_file(path, parent_baton,
> + err = editor->open_file(path, parent_baton,
> item->revision,
> - file_pool, &file_baton));
> + file_pool, &file_baton);
> +
> + if (err)
> + return fixup_out_of_date_error(path, item->kind, err);
> }
>
> /* Add this file mod to the FILE_MODS hash. */
>
> Modified: trunk/subversion/libsvn_repos/commit.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_repos/commit.c?pathrev=33994&r1=33993&r2=33994
> ==============================================================================
> --- trunk/subversion/libsvn_repos/commit.c Sat Nov 1 08:06:53 2008 (r33993)
> +++ trunk/subversion/libsvn_repos/commit.c Sat Nov 1 09:44:45 2008 (r33994)
> @@ -126,7 +126,7 @@ out_of_date(const char *path, svn_node_k
> ? _("Directory '%s' is out of date")
> : kind == svn_node_file
> ? _("File '%s' is out of date")
> - : _("File or directory '%s' is out of date")),
> + : _("'%s' is out of date")),
> path);
> }
>
>
> Modified: trunk/subversion/tests/cmdline/commit_tests.py
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/tests/cmdline/commit_tests.py?pathrev=33994&r1=33993&r2=33994
> ==============================================================================
> --- trunk/subversion/tests/cmdline/commit_tests.py Sat Nov 1 08:06:53 2008 (r33993)
> +++ trunk/subversion/tests/cmdline/commit_tests.py Sat Nov 1 09:44:45 2008 (r33994)
> @@ -1697,12 +1697,12 @@ def commit_out_of_date_deletions(sbox):
> # A commit of any one of these files or dirs should fail
> error_re = "out of date"
> commit(wc_backup, None, None, error_re, C_path)
> - commit(wc_backup, None, None, "File not found: transaction", I_path)
> + commit(wc_backup, None, None, error_re, I_path)
> commit(wc_backup, None, None, error_re, F_path)
> commit(wc_backup, None, None, error_re, omega_path)
> commit(wc_backup, None, None, error_re, alpha_path)
> - commit(wc_backup, None, None, "File not found: transaction", chi_path)
> - commit(wc_backup, None, None, "File not found: transaction", beta_path)
> + commit(wc_backup, None, None, error_re, chi_path)
> + commit(wc_backup, None, None, error_re, beta_path)
> commit(wc_backup, None, None, error_re, psi_path)
                                         

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-11-04 00:42:36 CET

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.