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

Re: Mergeinfo not inherited due to file externals

From: Paul Burba <ptburba_at_gmail.com>
Date: Tue, 3 Aug 2010 16:50:21 -0400

On Mon, Jul 26, 2010 at 4:50 AM, Brandt, Servatius (External)
<servatius.brandt.external_at_ts.fujitsu.com> wrote:
> A merge into a directory with a file external shows the following
> problems:
>
> 1) mergeinfo at the directory is not inherited (and all files and
>   subdirectories get their own inheritable mergeinfo).
>
> 2) mergeinfo is added to the external file.
>
> The mergeinfo at the external file is just wrong and useless, and 1)
> will cause problems on a reintegrate merge.  A use case and an example
> are following.

Hi Servatius,

What's happening here is that the merge tracking logic erroneously
treats externals the same as switched subtrees and sets mergeinfo to
segregate the "switched" subtree, so if it is later unswitched, it
doesn't inherit mergeinfo from the root of the branch which was never
actually merged. This is fine for switched subtrees, but I agree with
you, it doesn't make much sense for externals (which might not even be
from the same repository!).

Your second issue goes away in 1.7 because we only set mergeinfo on
paths affected by the merge, which the external never will be.

The first problem still exists however. I think we can safely ignore
externals in the merge target as far as recording mergeinfo describing
the merge goes. I'll look into this right now.

Paul

> Use case:
>
> I would like to place different types of branches into different
> directories, e.g. ^/branches/feature/my-feature, ^/branches/release/1.0.
> The developers should follow different codeline policies on each type of
> branch, and the correct codeline policy should be automatically added to
> each working copy of a new branch.  The policies are stored as:
>
> ^/CodelinePolicy.txt (trunk codeline policy)
> ^/branches/feature/CodelinePolicy.txt
> ^/branches/release/CodelinePolicy.txt
>
> svn ps svn:externals '../CodelinePolicy.txt CodelinePolicy.txt' trunk
>
> would do the trick.  Whenever a new branch is being created:
>
> svn cp ^/trunk ^/branches/feature/new-feature-branch
> svn cp ^/trunk ^/branches/release/new-release-branch
>
> the correct CodelinePolicy would be shown in each WC of the new
> branches.
>
> Currently, this would cause non-inheritable mergeinfo on the root
> directory of each branch so that a reintegrate merge of a feature branch
> to the trunk will fail with "Missing ranges".
>
> Example:
>
> $ svn -q --version
> 1.6.12
>
> $ svn mkdir trunk trunk/dir
> A         trunk
> A         trunk\dir
>
> $ echo x >trunk/x.txt
>
> $ echo d >trunk/dir/d.txt
>
> $ svn add trunk/x.txt trunk/dir/d.txt
> A         trunk\x.txt
> A         trunk\dir\d.txt
>
> $ svn ci -m 'initial trunk'
> Adding         trunk
> Adding         trunk\dir
> Adding         trunk\dir\d.txt
> Adding         trunk\x.txt
> Transmitting file data ..
> Committed revision 1.
>
> $ echo e >e.txt
>
> $ svn add e.txt
> A         e.txt
>
> $ svn ps svn:externals '../e.txt r.txt' trunk
> property 'svn:externals' set on 'trunk'
>
> $ svn ci -m 'file external r.txt on trunk referring to e.txt in parent dir'
> Adding         e.txt
> Sending        trunk
> Transmitting file data .
> Committed revision 2.
>
> $ svn cp trunk branch
> A         branch
>
> $ svn ci -m 'branch created from trunk'
> Adding         branch
> Adding         branch\dir
> Adding         branch\x.txt
>
> Committed revision 3.
>
> $ svn up
>
> Fetching external item into 'trunk\r.txt'
> E    trunk\r.txt
> Updated external to revision 3.
>
>
> Fetching external item into 'branch\r.txt'
> E    branch\r.txt
> Updated external to revision 3.
>
> Updated to revision 3.
>
> $ cd trunk
>
> $ echo xx >>x.txt
>
> $ svn ci -m 'trunk/x.txt changed'
> Sending        trunk\x.txt
> Transmitting file data .
> Committed revision 4.
>
> $ cd ../branch
>
> $ svn merge ^/trunk
> --- Merging r3 through r4 into 'x.txt':
> U    x.txt
>
> $ svn st
>  M      .
>  M  X   r.txt
> MM      x.txt
>  M      dir
>
> $ svn diff
>
> Property changes on: .
> ___________________________________________________________________
> Added: svn:mergeinfo
>   Merged /trunk:r3-4*
>
>
> Property changes on: r.txt
> ___________________________________________________________________
> Added: svn:mergeinfo
>   Merged /trunk/r.txt:r3-4
>
> Index: x.txt
> ===================================================================
> --- x.txt       (revision 3)
> +++ x.txt       (working copy)
> @@ -1 +1,2 @@
>  x
> +xx
>
> Property changes on: x.txt
> ___________________________________________________________________
> Added: svn:mergeinfo
>   Merged /trunk/x.txt:r3-4
>
>
> Property changes on: dir
> ___________________________________________________________________
> Added: svn:mergeinfo
>   Merged /trunk/dir:r3-4
>
>
> $ svn ci -m 'merge of trunk to branch, strange mergeinfo'
> Sending        branch
> Sending        branch\dir
> Sending        branch\x.txt
> Sending        branch\r.txt
> Transmitting file data .
> Committed revision 5.
>
> $ svn diff -c 5
> Index: x.txt
> ===================================================================
> --- x.txt       (revision 4)
> +++ x.txt       (revision 5)
> @@ -1 +1,2 @@
>  x
> +xx
>
> Property changes on: x.txt
> ___________________________________________________________________
> Added: svn:mergeinfo
>   Merged /trunk/x.txt:r3-4
>
>
> Property changes on: dir
> ___________________________________________________________________
> Added: svn:mergeinfo
>   Merged /trunk/dir:r3-4
>
>
> Property changes on: .
> ___________________________________________________________________
> Added: svn:mergeinfo
>   Merged /trunk:r3-4*
>
>
> $ svn diff -c 5 ../e.txt
>
> Property changes on: ..\e.txt
> ___________________________________________________________________
> Added: svn:mergeinfo
>   Merged /trunk/r.txt:r3-4
>
>
> $
>
>
Received on 2010-08-03 22:51:02 CEST

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