You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Paul Burba <pt...@gmail.com> on 2010/08/03 20:50:21 UTC

Re: Mergeinfo not inherited due to file externals

On Mon, Jul 26, 2010 at 4:50 AM, Brandt, Servatius (External)
<se...@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
>
>
> $
>
>

Re: Mergeinfo not inherited due to file externals

Posted by Paul Burba <pt...@gmail.com>.
On Fri, Aug 6, 2010 at 6:52 PM, Paul Burba <pt...@gmail.com> wrote:
> On Wed, Aug 4, 2010 at 4:04 AM, Bert Huijben <be...@qqmail.nl> wrote:
>>
>>
>>> -----Original Message-----
>>> From: Paul Burba [mailto:ptburba@gmail.com]
>>> Sent: dinsdag 3 augustus 2010 22:50
>>> To: Brandt, Servatius (External)
>>> Cc: Subversion Development List
>>> Subject: Re: Mergeinfo not inherited due to file externals
>>>
>>> On Mon, Jul 26, 2010 at 4:50 AM, Brandt, Servatius (External)
>>> <se...@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!).
>>
>> Currently file externals *must* always be from the same repository, because they are just switched files with a bit of special UI on top of them. (See the original introduction text of file externals)
>
> Hi Bert,
>
> What introduction are you speaking of?
>
>> We didn't fix this limitation for WC-NG yet, even though we should be able to describe a new working copy for just a file. (An issue would be that we can't use the normal update editor to describe changes on just a file, but that is easy to work around)
>>
>> I think you can assume that for a file-external no unswitched BASE_NODE exists, while for a normal switched path there most likely is a BASE node.
>
> When I use svn_wc__db_read_info() to query a file or directory
> external from the same repository, I get back have_base=TRUE.  Is this
> what you meant?
>
> The inelegant fix here is to just use
> svn_wc__internal_is_file_external() in svn_wc__check_wc_root() to
> detect file externals masquerading as switched subtrees.  The latter
> function is how the initial walk of the merge target (with
> svn_wc__node_walk_children) detects switched subtrees at the start of
> a merge.  Directory externals are skipped by
> svn_wc__node_walk_children, so this change would be sufficient to make
> svn merge ignore all externals as far as recording mergeinfo
> describing a merge goes, but it would still let
> svn_wc__check_wc_root() report directory externals as switched.

Forget about *any* fix.  The move to a single DB means our walk to
find subtrees of interest (using svn_wc__node_walk_children) never
visits external subtrees.  So we never mistakenly regard these as
switched, heck it never regards them at all!  I added a simple
regression test to catch any changes in this space
(http://svn.apache.org/viewvc?view=revision&revision=992114), but for
now this is fixed in 1.7.

Paul

Re: Mergeinfo not inherited due to file externals

Posted by Paul Burba <pt...@gmail.com>.
On Wed, Aug 4, 2010 at 4:04 AM, Bert Huijben <be...@qqmail.nl> wrote:
>
>
>> -----Original Message-----
>> From: Paul Burba [mailto:ptburba@gmail.com]
>> Sent: dinsdag 3 augustus 2010 22:50
>> To: Brandt, Servatius (External)
>> Cc: Subversion Development List
>> Subject: Re: Mergeinfo not inherited due to file externals
>>
>> On Mon, Jul 26, 2010 at 4:50 AM, Brandt, Servatius (External)
>> <se...@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!).
>
> Currently file externals *must* always be from the same repository, because they are just switched files with a bit of special UI on top of them. (See the original introduction text of file externals)

Hi Bert,

What introduction are you speaking of?

> We didn't fix this limitation for WC-NG yet, even though we should be able to describe a new working copy for just a file. (An issue would be that we can't use the normal update editor to describe changes on just a file, but that is easy to work around)
>
> I think you can assume that for a file-external no unswitched BASE_NODE exists, while for a normal switched path there most likely is a BASE node.

When I use svn_wc__db_read_info() to query a file or directory
external from the same repository, I get back have_base=TRUE.  Is this
what you meant?

The inelegant fix here is to just use
svn_wc__internal_is_file_external() in svn_wc__check_wc_root() to
detect file externals masquerading as switched subtrees.  The latter
function is how the initial walk of the merge target (with
svn_wc__node_walk_children) detects switched subtrees at the start of
a merge.  Directory externals are skipped by
svn_wc__node_walk_children, so this change would be sufficient to make
svn merge ignore all externals as far as recording mergeinfo
describing a merge goes, but it would still let
svn_wc__check_wc_root() report directory externals as switched.

Paul

RE: Mergeinfo not inherited due to file externals

Posted by Bert Huijben <be...@qqmail.nl>.

> -----Original Message-----
> From: Paul Burba [mailto:ptburba@gmail.com]
> Sent: dinsdag 3 augustus 2010 22:50
> To: Brandt, Servatius (External)
> Cc: Subversion Development List
> Subject: Re: Mergeinfo not inherited due to file externals
> 
> On Mon, Jul 26, 2010 at 4:50 AM, Brandt, Servatius (External)
> <se...@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!).

Currently file externals *must* always be from the same repository, because they are just switched files with a bit of special UI on top of them. (See the original introduction text of file externals)

We didn't fix this limitation for WC-NG yet, even though we should be able to describe a new working copy for just a file. (An issue would be that we can't use the normal update editor to describe changes on just a file, but that is easy to work around)

I think you can assume that for a file-external no unswitched BASE_NODE exists, while for a normal switched path there most likely is a BASE node.

	Bert

RE: Mergeinfo not inherited due to file externals

Posted by "Brandt, Servatius (External)" <se...@ts.fujitsu.com>.
Hi Paul,

This sounds reasonable.  Thanks for looking into the issue.

Servatius

> -----Original Message-----
> From: Paul Burba [mailto:ptburba@gmail.com]
> Sent: Tuesday, August 03, 2010 10:50 PM
> To: Brandt, Servatius (External)
> Cc: Subversion Development List
> Subject: Re: Mergeinfo not inherited due to file externals
> 
> On Mon, Jul 26, 2010 at 4:50 AM, Brandt, Servatius (External)
> <se...@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
> >
> >
> > $
> >
> >