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

Re: [PATCH]commit from multiple wc

From: Stefan Sperling <stsp_at_elego.de>
Date: Thu, 16 Jul 2009 14:30:39 +0100

On Thu, Jul 16, 2009 at 07:17:42PM +0800, HuiHuang wrote:
> Hey,
>
> My patch does not use the new function svn_wc__adm_open_in_context(),
> but I will make a new patch which use the new function instead of
> svn_wc_adm_open3() as soon as possible.

OK, I've applied the three patches you sent and this time they
applied fine and everything compiled well.

When I run the tests I get failures, however.
Do you get these failures, too?

$ ./commit_tests.py commit_multiple_wc_nested commit_multiple_wc
subversion/svn/commit-cmd.c:144: (apr_err=200000)
subversion/libsvn_client/commit.c:2015: (apr_err=200000)
subversion/libsvn_client/commit.c:1669: (apr_err=200000)
subversion/libsvn_client/commit.c:1637: (apr_err=200000)
svn: '/home/stsp/svn/svn-trunk/subversion/tests/cmdline/svn-test-work/working_copies/commit_tests-25/A/wc2' cannot be locked
Traceback (most recent call last):
  File "/home/stsp/svn/svn-trunk/subversion/tests/cmdline/svntest/main.py", line 1149, in run
    rc = self.pred.run(sandbox)
  File "/home/stsp/svn/svn-trunk/subversion/tests/cmdline/svntest/testcase.py", line 129, in run
    return self.func(sandbox)
  File "./commit_tests.py", line 1399, in commit_multiple_wc_nested
    wc_dir, wc2_dir)
  File "/home/stsp/svn/svn-trunk/subversion/tests/cmdline/svntest/actions.py", line 207, in run_and_verify_svn
    expected_exit, *varargs)
  File "/home/stsp/svn/svn-trunk/subversion/tests/cmdline/svntest/actions.py", line 240, in run_and_verify_svn2
    exit_code, out, err = main.run_svn(want_err, *varargs)
  File "/home/stsp/svn/svn-trunk/subversion/tests/cmdline/svntest/main.py", line 587, in run_svn
    *(_with_auth(_with_config_dir(varargs))))
  File "/home/stsp/svn/svn-trunk/subversion/tests/cmdline/svntest/main.py", line 365, in run_command
    None, *varargs)
  File "/home/stsp/svn/svn-trunk/subversion/tests/cmdline/svntest/main.py", line 520, in run_command_stdin
    raise Failure
Failure
FAIL: commit_tests.py 25: commit from two nested working copies
subversion/svn/commit-cmd.c:144: (apr_err=200000)
subversion/libsvn_client/commit.c:2003: (apr_err=200000)
subversion/libsvn_client/commit.c:1669: (apr_err=200000)
subversion/libsvn_client/commit.c:1637: (apr_err=200000)
svn: '/home/stsp/svn/svn-trunk/subversion/tests/cmdline/svn-test-work/working_copies/commit_tests-26/wc1' cannot be locked
Traceback (most recent call last):
  File "/home/stsp/svn/svn-trunk/subversion/tests/cmdline/svntest/main.py", line 1149, in run
    rc = self.pred.run(sandbox)
  File "/home/stsp/svn/svn-trunk/subversion/tests/cmdline/svntest/testcase.py", line 129, in run
    return self.func(sandbox)
  File "./commit_tests.py", line 1448, in commit_multiple_wc
    wc1_dir, wc2_dir)
  File "/home/stsp/svn/svn-trunk/subversion/tests/cmdline/svntest/actions.py", line 207, in run_and_verify_svn
    expected_exit, *varargs)
  File "/home/stsp/svn/svn-trunk/subversion/tests/cmdline/svntest/actions.py", line 240, in run_and_verify_svn2
    exit_code, out, err = main.run_svn(want_err, *varargs)
  File "/home/stsp/svn/svn-trunk/subversion/tests/cmdline/svntest/main.py", line 587, in run_svn
    *(_with_auth(_with_config_dir(varargs))))
  File "/home/stsp/svn/svn-trunk/subversion/tests/cmdline/svntest/main.py", line 365, in run_command
    None, *varargs)
  File "/home/stsp/svn/svn-trunk/subversion/tests/cmdline/svntest/main.py", line 520, in run_command_stdin
    raise Failure
Failure
FAIL: commit_tests.py 26: commit from two working copies

It seems to be a problem with the locking :(

I'm not sure how this can be fixed. If you need help to figure out what
causes this, please ask for help in a separate dev@ thread, explaining
the problem as you understand it, and then wait a while and see what
information comes back from the list.

> Index: subversion/include/svn_client.h
> ===================================================================
> --- subversion/include/svn_client.h (revision 38429)
> +++ subversion/include/svn_client.h (working copy)
> @@ -1705,54 +1705,75 @@
> */
>
> /**
> - * Commit files or directories into repository, authenticating with
> - * the authentication baton cached in @a ctx, and using
> - * @a ctx->log_msg_func3/@a ctx->log_msg_baton3 to obtain the log message.
> - * Set @a *commit_info_p to the results of the commit, allocated in @a pool.
> +* Commit files or directories into repository, authenticating with
> +* the authentication baton cached in @a ctx, and using
> +* @a ctx->log_msg_func3/@a ctx->log_msg_baton3 to obtain the log message.

[snip]

> +* When @a allow_multiple_working_copies is TRUE, commits from multiple
> +* working copies are allowed, one commit for each working copy.
> +* Essentially:
> +* svn commit wc1; svn commit wc2; ...; svn commit wcN;
> +* When @a allow_multiple_working_copies is FALSE, only commit from one
> +* single working copy is allowed.

(Language tweak -- don't worry too much about getting the language
right all the time, the code is more important!
I'll just correct some grammer mistakes and put the sentences in a style
which more closely matches the style native speakers of English would use.)

  * If @a allow_multiple_working_copies is TRUE, allow commits from multiple
  * working copies. Do a separate commit from each working copy, essentially:
  * svn commit wc1; svn commit wc2; ...; svn commit wcN;
  * If @a allow_multiple_working_copies is FALSE, throw an error if the
  * @a targets do not all come from the same working copy.
  *
  * Return in @a commit_info_p an array of svn_commit_info_t objects,
  * allocated in @a pool. Each svn_commit_info_t describes a successful commit.

Also, please add an @since marker to the docstring:

  * @since New in 1.7.

This tells people reading the API documentation when the new function
was introduced.

> +*/
> +svn_error_t *
> +svn_client_commit5(apr_array_header_t **commit_info_p,
> + const apr_array_header_t *targets,
> + svn_depth_t depth,

[snip]

> @@ -1277,10 +1309,390 @@
> return SVN_NO_ERROR;
> }
>
> +static svn_error_t *
> +do_one_single_commit(svn_commit_info_t **commit_info_p,
> + svn_wc_adm_access_t *base_dir_access,
> + const char *base_dir,
> + const apr_array_header_t *rel_targets,

The rel_targets parameter should not be const, because otherwise
we get a compiler warning at the point where rel_targets is passed
down to svn_client__harvest_committables().

> + svn_depth_t depth,
> + svn_boolean_t keep_locks,
> + svn_boolean_t keep_changelists,
> + const apr_array_header_t *changelists,
> + const apr_hash_t *revprop_table,
> + svn_client_ctx_t *ctx,
> + apr_pool_t *pool)

[snip]

> + APR_ARRAY_PUSH(commit_packet->rel_targets, const char *)
> + = apr_pstrdup(result_pool, rel_target);
> + found_parent = TRUE;
> + break;
> + }
> + svn_pool_destroy(iterpool1);
> +
> + /* If no suitable working copy root was found for the current target path.
> + * Walk the current target path downwards, starting from the common

(Language tweak)

  /* If no suitable working copy root was found for the current target path,
   * then walk the current target path downwards, starting from the common

> + * root (the root which we could not lock, in the code this is often
> + * called the "base_dir").
> + * Try to lock the current directory at each step.
> + * If locking succeeds, we have found a new WC root!
> + * Store its access baton in the set of known working copy roots.
> + * Put the current target path into the group of the root we just found.
> + */
> + if (! found_parent)
> + {
> + new_base_dir = apr_pstrdup(iterpool, base_dir);
> + rel_target = svn_dirent_is_child(new_base_dir, target,
> + iterpool);
> +
> + /* If the wc are nested, we should lock from the root( base_dir here).
> + * So we add "" to the components firstly.

(Language tweak)

  /* If the WCs are nested, we should lock from the root (base_dir here).
   * So we add "" to the components first.

> + */
> + components = apr_array_make(iterpool, 1, sizeof (const char *));
> + APR_ARRAY_PUSH(components, const char *) = "";
> + if (rel_target)
> + {
> + apr_array_header_t *temp_components
> + = svn_path_decompose(rel_target, iterpool);
> + for (j = 0; j < temp_components->nelts; j++)
> + {
> + component = APR_ARRAY_IDX(temp_components, j, const char *);
> + if(component)

There's a space missing after 'if' here, it should say "if (component)".

We'll need to get the test failures fixed next.

Stefan
Received on 2009-07-16 15:32:53 CEST

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.