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

Re: [PATCH]svn_wc__find_wc_root

From: HuiHuang <yellow.flying_at_yahoo.com.cn>
Date: Sun, 28 Jun 2009 10:29:32 +0800

>Hmmm.... wait...

>I think we're trying to do things the wrong way around.

>I don't think that opening an access baton like this will work while
>a commit is in progress. It will work while no commit is in progress,
>so in your testing the function has suceeded so far.

>But it will fail during a commit because the root directory of the
>working copy directory might already be locked for writing.
>See libsvn_client/commit.c, line 1518:

> SVN_ERR(svn_wc_adm_open3(&base_dir_access, NULL, base_dir,
> TRUE, /* Write lock */
I call svn_wc__find_wc_root() before that line is executed, so there
in no lock conflict. But it is not important now, I think the new plan
you proposed below is great:)
>So I think we'll need to change the logic.
>Let's start again from the top.

>Recall again what we want to achieve:

>== Goal ==
>We want to get a set of access batons, one for the root of each
>working copy involved in a commit. As input, we get a list
>of paths that are part of an arbitrary amount of working copies.
>We also want to group those paths by their working copy root.

>Then we want to make a commit from each working copy root.

>Doing a single commit for all working copies at once is too hard.
>See svn_client__do_commit and follow the use of its base_dir_access,
>which is the root of the working copy the commit is made from.
>There is so much code that assumes a single access baton for
>the root that you would run out of time for your gsoc project
>before you are anywhere near done changing it all.
Actually what I want to do is to do a single commit for all working
copies from one repository. It is a little differcult for me right now,
and I am tring my best but not sure whether I can finish it before
deadline of GOCS.

I have saw the purpose of GOCS you write, these days there are
lots of controversy on my work, and I know that my work may not
be used in subversion. So I think the most important thing for me is
to be familiar with subversion code and Writing code is a way
to achieve this goal. This is preparation for my future work on
subversion and I wish I can work on subversion for a long time.

Do I understand the right thing?

>== What's there now ==
>Currently, the code "condenses" all target paths, which means it
>tries to find a common root for them, and then it tries to lock that
>common root. If the common root is not a working copy, locking the
>common root fails and the commit is simply aborted ("svn: <common root>
>is not a working copy").

>== What we can do instead ==
>So let's say we did the following instead of aborting the commit:

> If locking the common root failed:
You mean we failed at this line, right?
SVN_ERR(svn_wc_adm_open3(&base_dir_access, NULL, base_dir,
                           TRUE, /* Write lock */
I know it may be a littel trivial to ask these kind of details, I just
want to make sure that I understand the right thing.

> For each target path we got:

> For each working copy root we already know (initially we don't
> know any working copy roots):
> Check if the current target path is below the working copy root.
> If it is, put it into this root's group ("commit packet")
> and continue with the next target path.

> If we end up here, no suitable working copy root was found
> for the current target path.
> Walk the current target path downwards, starting from the common
> root (the root which we could not lock).
Do you mean 'common root' as base_dir here?
> 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.

> Now run a commit for each working copy root we found.
> This is done just like before when the code only knew about
> a single root, but it's done for each root in turn.
So I can reuse original code to commit for each root, right?
> Also, make svn_client_commit() return an array of svn_commit_info_t
> objects, one for each commit made, instead of just a single
> svn_commit_info_t object.

>If you agree to this plan, I'm sorry that your current
>svn_wc__find_wc_root() patch might not be committed after all.
>But at least for me, the patch helped me a lot to actually
>understand the problem :)
That is Ok, I have learnt a lot by writing this patch, too.:) What I have
learnt is the true progress I make, isn't it?

>Should we update the notes/ file with the new plan?
After I am clear of the new plan detaily I will update the notes/file.


Thank you very much, Stefan~~
Best Wishes!




Received on 2009-06-28 04:29:59 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.