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

Re: [BUG] Merging to a branch with sparsely checked out files fails without error

From: Peter Samuelson <peter_at_p12n.org>
Date: Wed, 25 Mar 2009 18:49:49 -0500

> > 1) You have a repos structured like this:
> >
> > trunk
> > trunk/src
> > trunk/docs
> >
> > 2) Copy trunk_at_99 to branches/branch-1 in r100
> >
> > 3) Checkout branches/branch-1 such that the docs subtree is missing
> > due to a shallow checkout:
> >
> > branches (depth infinity)
> > branches/src (depth infinity)
> > branches/docs (depth empty)
> >
> > 4) Make some changes under both trunk/src and trunk/docs in r101-123.
> >
> > 5) In r124-r125 we make some changes to branches/branch-1
> >
> > 6) Merge all available revisions (i.e. now -r or -c option is
> > specified) from trunk to branches/branch-1.
> >
> > Mergeinfo is set as follows:
> >
> > branches/branch-1 '/trunk:101-125'
> > branches/branch-1/docs '/trunk:101-125*'
> >
> > Before committing this merge as r126 we delete the mergeinfo set on
> > 'docs'.
> >
> > 6) Now we reintegrate branches/branch-1 back to trunk. Under the
> > covers reintegrate is doing the following 2-URL merge:
> >
> > svn merge trunk_URL_at_125 branch-1_URL_at_126 trunk_working_copy
> >
> > But wait! The merge we did in #6 never brought the changes to the
> > docs subtree that we made in #4 (because the subtree wasn't present to
> > receive them). So branch-1_URL/docs_at_126 is the same as
> > trunk_URL/docs@*99*. The 2-URL merge will actually revert those
> > changes to trunk/docs that we made in #4, which is almost certainly
> > not what we intended. Does that make sense?

[Kari Granö]
> Yes, if the trunk changes get silently reverted, then this is really dangerous.
>
> But could the merge be smarter here? I mean, the last change on
> branch-1/docs is at r99 (it was never changed in branch-1 since it is
> sparse in the working copy).

Well ... Subversion knows (or could know) that branch-1/docs has not
been updated, but it does not know _why_. You assume that this is
because whoever worked in branch-1 used a sparse checkout. But perhaps
whoever merged from trunk r101-123 really did merge the docs/
directory, but then looked at it and decided the changes were
incorrect. So he reverted the whole directory before committing the
merge.

The 'merge --reintegrate' is not necessarily done from the same
checkout where the branch work was done. In fact it doesn't need a
branch checkout at all, only a trunk checkout. So Subversion can't
assume anything about whether the previous trunk -> branch-1 merge was
done in a sparse checkout.

-- 
Peter Samuelson | org-tld!p12n!peter | http://p12n.org/
Received on 2009-03-26 00:50:06 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.