You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Dave Huang <kh...@azeotrope.org> on 2010/01/09 01:09:27 UTC

Question about excessive mergeinfo

Hi, I'm using svn 1.6.6 to merge a single revision from trunk to a branch, 
and am getting a bunch of seemingly-unneeded mergeinfo. I've read 
http://blogs.open.collab.net/svn/2009/11/where-did-that-mergeinfo-come-from.html 
, but as far as I can tell, it doesn't address what I'm seeing.

Trunk has a bit of mergeinfo, which seems related to some renames that were 
done a while back:

. - /branches/B1:20664-20666
Data\File.zip - /branches/B1/Data/file.zip:20664-20666
Other Data\File.zip - /branches/B1/Other Data/file.zip:20664-20666
Reports\SummaryByPeriod.rpt - 
/branches/B1/Reports/SummaryByMonth.rpt:20664-20666
Other Reports\TopNSalesSummary.rpt - /branches/B1/Other 
Reports/TopNCustomersSales.rpt:20664-20666
Reports\TopNSalesSummary.rpt - 
/branches/B1/Reports/TopNCustomersSales.rpt:20664-20666
Other Reports\SummaryByPeriod.rpt - /branches/B1/Other 
Reports/SummaryByMonth.rpt:20664-20666

The branch, NewBranch, was recently created, and the mergeinfo looks the same:

. - /branches/B1:20664-20666
Data\File.zip - /branches/B1/Data/file.zip:20664-20666
Other Data\File.zip - /branches/B1/Other Data/file.zip:20664-20666
Reports\SummaryByPeriod.rpt - 
/branches/B1/Reports/SummaryByMonth.rpt:20664-20666
Other Reports\TopNSalesSummary.rpt - /branches/B1/Other 
Reports/TopNCustomersSales.rpt:20664-20666
Reports\TopNSalesSummary.rpt - 
/branches/B1/Reports/TopNCustomersSales.rpt:20664-20666
Other Reports\SummaryByPeriod.rpt - /branches/B1/Other 
Reports/SummaryByMonth.rpt:20664-20666

Now, I cd into NewBranch's WC and do:

svn merge -c 26096 ^/trunk .

--- Merging r26096 into '.':
U    Installers\Projects\CA\CA.ism

I now have a ton of mergeinfo on files that previously didn't have any.

svn propget svn:mergeinfo -R . [extra line breaks added to hopefully make it 
easier to read]

Other Data\Stored Procedures - /trunk/Other Data/Stored Procedures:26096*
/branches/B1/Other Data/Stored Procedures:20664-20666

. - /trunk:26096
/branches/B1:20664-20666

Data\Views\v1.sql - /trunk/Data/Views/v1.sql:26096
/branches/B1/Data/Views/v1.sql:20664-20666

Other Data\Views\flatten.bat - /trunk/Other Data/Views/flatten.bat:26096

Other Data\Views\v2.sql - /trunk/Other Data/Views/v2.sql:26096
/branches/B1/Other Data/Views/v2.sql:20664-20666

Other Data\Views\v3.sql - /trunk/Other Data/Views/v3.sql:26096
/branches/B1/Other Data/Views/v3.sql:20664-20666
   [ ... a bunch more in Other Data\Views ... ]

Data\Views\v4.sql - /trunk/Data/Views/v4.sql:26096
/branches/B1/Data/Views/v4.sql:20664-20666
   [ ... a bunch more in Data\Views ... ]

Other Data\Stored Procedures\sp1.sql - /trunk/Other Data/Stored 
Procedures/sp1.sql:26096
/branches/B1/Other Data/Stored Procedures/sp1.sql:20664-20666
   [ ... a bunch more in Other Data\Stored Procedures ... ]

Data\Stored Procedures\flatten.bat - /trunk/Data/Stored 
Procedures/flatten.bat:26096
Data/Stored Procedures/sp2.sql:26096
/branches/B1/Other Data/Stored Procedures/sp2.sql:20664-20666
   [ ... a bunch more in Data\Stored Procedures ... ]

Other Data\Stored Procedures\flatten.bat - /trunk/Other Data/Stored 
Procedures/flatten.bat:26096

Other Data\Views\flattenall.bat - /trunk/Other Data/Views/flattenall.bat:26096

Data\Stored Procedures\flatten_a.sed - /trunk/Data/Stored 
Procedures/flatten_a.sed:26096

Data\Stored Procedures\flatten_b.sed - /trunk/Data/Stored 
Procedures/flatten_b.sed:26096

Other Data\Stored Procedures\flatten_a.sed - /trunk/Other Data/Stored 
Procedures/flatten_a.sed:26096

Other Data\Stored Procedures\flatten_b.sed - /trunk/Other Data/Stored 
Procedures/flatten_b.sed:26096

Data\Views - /trunk/Data/Views:26096*
/branches/B1/Data/Views:20664-20666

Data\Views\flatten_a.sed - /trunk/Data/Views/flatten_a.sed:26096

Data\Views\flatten_b.sed - /trunk/Data/Views/flatten_b.sed:26096

Other Data\Views - /trunk/Other Data/Views:26096*
/branches/B1/Other Data/Views:20664-20666

Other Data\Views\flatten_a.sed - /trunk/Other Data/Views/flatten_a.sed:26096

Other Data\Views\flatten_b.sed - /trunk/Other Data/Views/flatten_b.sed:26096

Data\Views\flattenall.bat - /trunk/Data/Views/flattenall.bat:26096

Data\Stored Procedures - /trunk/Data/Stored Procedures:26096*
/branches/B1/Data/Stored Procedures:20664-20666

Data\Views\flatten.bat - /trunk/Data/Views/flatten.bat:26096

Data\File.zip - /trunk/Data/File.zip:26096
/branches/B1/Data/file.zip:20664-20666

Other Data\File.zip - /trunk/Other Data/File.zip:26096
/branches/B1/Other Data/file.zip:20664-20666

Other Reports\SummaryByPeriod.rpt - /trunk/Other 
Reports/SummaryByPeriod.rpt:26096
/branches/B1/Other Reports/SummaryByMonth.rpt:20664-20666

Reports\SummaryByPeriod.rpt - /trunk/Reports/SummaryByPeriod.rpt:26096
/branches/B1/Reports/SummaryByMonth.rpt:20664-20666

Reports\TopNSalesSummary.rpt - /trunk/Reports/TopNSalesSummary.rpt:26096
/branches/B1/Reports/TopNCustomersSales.rpt:20664-20666

Other Reports\TopNSalesSummary.rpt - /trunk/Other 
Reports/TopNSalesSummary.rpt:26096
/branches/B1/Other Reports/TopNCustomersSales.rpt:20664-20666

It's probably relevant to note that the various flatten* files are externals:

Other Data\Stored Procedures - -r26096 
^/Build%20Scripts/flattensp/flatten.bat flatten.bat
-r26096 ^/Build%20Scripts/flattensp/flatten_a.sed flatten_a.sed
-r26096 ^/Build%20Scripts/flattensp/flatten_b.sed flatten_b.sed

Other Data\Views - -r26096 ^/Build%20Scripts/flattenview/flatten.bat flatten.bat
-r26096 ^/Build%20Scripts/flattenview/flatten_a.sed flatten_a.sed
-r26096 ^/Build%20Scripts/flattenview/flatten_b.sed flatten_b.sed
-r26096 ^/Build%20Scripts/flattenview/flattenall.bat flattenall.bat

Data\Stored Procedures - -r26096 ^/Build%20Scripts/flattensp/flatten.bat 
flatten.bat
-r26096 ^/Build%20Scripts/flattensp/flatten_a.sed flatten_a.sed
-r26096 ^/Build%20Scripts/flattensp/flatten_b.sed flatten_b.sed

Data\Views - -r26096 ^/Build%20Scripts/flattenview/flatten.bat flatten.bat
-r26096 ^/Build%20Scripts/flattenview/flatten_a.sed flatten_a.sed
-r26096 ^/Build%20Scripts/flattenview/flatten_b.sed flatten_b.sed
-r26096 ^/Build%20Scripts/flattenview/flattenall.bat flattenall.bat

The externals originally didn't have the "-r26096"; I added that in both 
trunk and the branch to see if it'd change anything, but it didn't. It seems 
that the extra mergeinfo has something to do with the externals though... 
each directory that has an external definition gets non-inheritable 
mergeinfo for /trunk, and every file in that directory gets inheritable 
mergeinfo for the same revision.

Why is svn doing that? Putting non-inheritable mergeinfo on the directory, 
then putting the same mergeinfo on the files in that directory seems to be 
the equivalent of just putting inheritable mergeinfo on the directory. Is it 
to prevent mergeinfo from propagating down to any new files/directories that 
are added later? Not really sure what the purpose of that would be though...

In any case, is there something I can do to have it not touch a bunch of 
mergeinfo each time I merge to this branch?

Re: copying from another branch [Question about excessive mergeinfo]

Posted by Stein Somers <ss...@opnet.com>.
On 12/01/2010 10:40, Ulrich Eckhardt wrote:
> Why only merge a part of the initial changeset?

Well, you said I should merge, and I only want a part!

Okay, first of all, I have no question. I just brought this up to 
illustrate that excessive mergeinfo exists and you shouldn't assume 
you're doing something wrong and you can prevent it from being 
committed. I did find your point interesting, but now I don't think you 
were making the point I read. But in case you were, here is my 
illustration elaborated.

I want a copy of some kind of file set that was shipped to customers, 
called /branches/fancy_release/sample_input

I want a copy called /trunk/sample_input_of_fancy_release so I can add 
test code to insure that the software is backwards compatibility, at 
least for the input I already shipped myself.

I said: URL -> WC copy, but that adds duplicate mergeinfo. You said, 
merge the addition. But the changeset that originally added sample_input 
contains other stuff I'm not interested in, and I want the final version 
of sample_input. So, quite a complicated 2-stage merge process it seemed.

-- 
Stein

Re: Question about excessive mergeinfo

Posted by Ulrich Eckhardt <ec...@satorlaser.com>.
On Monday 11 January 2010, Stein Somers wrote:
> > I think SVN wants you to not copy the file/dir but instead to merge the
> > revision where it was added to the branch.
>
> Interesting idea, but as far as I get it it seems a complicated process:
>   - In the WC's target directory, merge a part of the changeset that
> created (or last moved) the wanted subdirectory. So now we're no longer
> only merging root directories.
>   - Inside the new subdirectory, merge the rest of the history of the
> source subdirectory.


Why only merge a part of the initial changeset? Did it contain multiple 
unrelated changes? If so, that's IMHO the first sin, one changeset should 
only contain one logical change, otherwise merging becomes a b1tch.

> And why would SVN not like copies? Forget that I wrote "from another
> branch", it happens inside a branch too (i.e. if the only active
> mergeinfo is in a parent directory shared by source and target of the
> copy). If you do a simple WC -> WC copy, you get no additional
> mergeinfo. If you do a URL -> WC copy on the same paths and revisions,
> you get explicit/excessive mergeinfo on top. I'm pretty sure that's a
> bug. But never mind, I can elide it myself. We'll see in 1.7.

Actually, if I merge a revision that only touches a subdir but don't target 
the root but the subdir instead, I also get explicit mergeinfo. If SVN was 
better, it would see that merging to the root would be the same and put the 
mergeinfo there. Alas, this feature is not implemented yet. However, I 
wouldn't call it a bug that SVN can't read my mind. And I'm sure some people 
would object when I merge to a subdir and suddenly SVN changes its parent's 
mergeinfo.


Cheers!

Uli

-- 
ML: http://subversion.tigris.org/mailing-list-guidelines.html
FAQ: http://subversion.tigris.org/faq.html
Docs: http://svnbook.red-bean.com/

Sator Laser GmbH, Fangdieckstraße 75a, 22547 Hamburg, Deutschland
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

**************************************************************************************
Sator Laser GmbH, Fangdieckstraße 75a, 22547 Hamburg, Deutschland
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
**************************************************************************************
           Visit our website at <http://www.satorlaser.de/>
**************************************************************************************
Diese E-Mail einschließlich sämtlicher Anhänge ist nur für den Adressaten bestimmt und kann vertrauliche Informationen enthalten. Bitte benachrichtigen Sie den Absender umgehend, falls Sie nicht der beabsichtigte Empfänger sein sollten. Die E-Mail ist in diesem Fall zu löschen und darf weder gelesen, weitergeleitet, veröffentlicht oder anderweitig benutzt werden.
E-Mails können durch Dritte gelesen werden und Viren sowie nichtautorisierte Änderungen enthalten. Sator Laser GmbH ist für diese Folgen nicht verantwortlich.
**************************************************************************************

Re: Question about excessive mergeinfo

Posted by Stein Somers <ss...@opnet.com>.
> I think SVN wants you to not copy the file/dir but instead to merge the
> revision where it was added to the branch.

Interesting idea, but as far as I get it it seems a complicated process:
  - In the WC's target directory, merge a part of the changeset that 
created (or last moved) the wanted subdirectory. So now we're no longer 
only merging root directories.
  - Inside the new subdirectory, merge the rest of the history of the 
source subdirectory.

And why would SVN not like copies? Forget that I wrote "from another 
branch", it happens inside a branch too (i.e. if the only active 
mergeinfo is in a parent directory shared by source and target of the 
copy). If you do a simple WC -> WC copy, you get no additional 
mergeinfo. If you do a URL -> WC copy on the same paths and revisions, 
you get explicit/excessive mergeinfo on top. I'm pretty sure that's a 
bug. But never mind, I can elide it myself. We'll see in 1.7.

-- 
Stein

Re: Question about excessive mergeinfo

Posted by Ulrich Eckhardt <ec...@satorlaser.com>.
On Monday 11 January 2010, Stein Somers wrote:
> No explanation here, and not the same symptoms, but you're not the only
> one struggling with it. I have a pre-commit hook to detect mergeinfo
> below root, and remove it whenever it occurs, which is rare.

Doh. Wish I had had that idea earlier.

> When copying by URL a subdirectory from another branch to somewhere in a
> WC, the new subdirectory always gets a mergeinfo property. Its value is
> a copy of the mergeinfo of the root of the source branch (where this
> "root" is an interpretation of course; more accurately, it is the
> nearest (and only) higher directory that has a mergeinfo property,
> relative to the copied subdirectory).

Technically, a missing mergeinfo implicitly means that a dir or file has its 
parent dir's mergeinfo. This is even documented. So, the source dir doesn't 
actually get a new and different mergeinfo, it is only set on the dir 
explicitly now while it was implicit before.

> Not surprisingly, the new mergeinfo is a subset of the mergeinfo of the
> current working copy root: fewer branches listed, fewer revisions listed.
> In my interpretation of the rules, this mergeinfo is entirely useless.
> So no thank you, I don't commit it.

I think SVN wants you to not copy the file/dir but instead to merge the 
revision where it was added to the branch. Yes, a simple copy is easier to 
explain in some cases, though it doesn't capture all possible changes in a 
branch.

Cheers!

Uli

-- 
ML: http://subversion.tigris.org/mailing-list-guidelines.html
FAQ: http://subversion.tigris.org/faq.html
Docs: http://svnbook.red-bean.com/

Sator Laser GmbH, Fangdieckstraße 75a, 22547 Hamburg, Deutschland
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

**************************************************************************************
Sator Laser GmbH, Fangdieckstraße 75a, 22547 Hamburg, Deutschland
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
**************************************************************************************
           Visit our website at <http://www.satorlaser.de/>
**************************************************************************************
Diese E-Mail einschließlich sämtlicher Anhänge ist nur für den Adressaten bestimmt und kann vertrauliche Informationen enthalten. Bitte benachrichtigen Sie den Absender umgehend, falls Sie nicht der beabsichtigte Empfänger sein sollten. Die E-Mail ist in diesem Fall zu löschen und darf weder gelesen, weitergeleitet, veröffentlicht oder anderweitig benutzt werden.
E-Mails können durch Dritte gelesen werden und Viren sowie nichtautorisierte Änderungen enthalten. Sator Laser GmbH ist für diese Folgen nicht verantwortlich.
**************************************************************************************

Re: Question about excessive mergeinfo

Posted by Geoff Rowell <ge...@gmail.com>.
On Thu, Jan 14, 2010 at 7:58 AM, Javier Sanz <js...@gmail.com> wrote:
> That's an awesome hook to limit svn:mergeinfo propagation, but
> unfortunately it is not viable for complex repositories :(.
>
> Let's hope Subversion 1.7 helps us with this.
>
> On Wed, Jan 13, 2010 at 11:46 AM, Stein Somers <ss...@opnet.com> wrote:
>>> I have a pre-commit hook to detect mergeinfo
>>> below root, and remove it whenever it occurs
>>
>> For clarity: the pre-commit hook detects and rejects. The one removing the
>> mergeinfo is me, using svn propdel.
>>
>> Someone asked for the hook code, here it is. It's not my submission for a
>> beauty contest and there are some unrelated checks in there. I use the SVN
>> command line instead of python bindings because I can't find the slightest
>> explanation on them.
>>
>> --8>----------------------------------------------------
>>
>> #!/usr/bin/python
>>
>> # PRE-COMMIT HOOK
>> SVNLOOK = '/usr/bin/svnlook'
>>
>> import subprocess
>> import sys
>>
>> repos, txn = sys.argv[1:]
>>
>> rc = 0
>>
>> """
>> logmsg = subprocess.Popen([SVNLOOK, 'log', repos, '--transaction', txn],
>> stdout=subprocess.PIPE).stdout.read()
>> if logmsg.isspace():
>>        sys.stderr.write("Empty log message\n")
>>        rc = 1
>> """
>>
>> changes = subprocess.Popen([SVNLOOK, 'changed', repos, '--transaction',
>> txn], stdout=subprocess.PIPE).stdout.readlines()
>> for change in changes:
>>        action = change[0]
>>        assert(change[3] == ' ')
>>        path = change[4:-1] # strip 2 leading change type characters followed
>> by a space, and strip trailing newline
>>        is_dir = path.endswith('/')
>>        is_top_dir = False
>>        if is_dir:
>>                path_parts = path.split('/')
>>                assert(path_parts[-1] == '')
>>                if len(path_parts) == 2 and path_parts[0] == 'trunk':
>>                        is_top_dir = True
>>                if len(path_parts) == 3 and path_parts[0] in ('branches',
>> 'tags'):
>>                        is_top_dir = True
>>
>>        if action != 'D': # Delete
>>                props = []
>>                for entry in subprocess.Popen([SVNLOOK, 'proplist', repos,
>> '--transaction', txn, path], stdout=subprocess.PIPE).stdout:
>>                        assert(entry.startswith('  '))
>>                        prop = entry[2:-1]
>>                        props.append(prop)
>>
>>                if is_top_dir and not 'svn:mergeinfo' in props:
>>                        sys.stderr.write(path + ": missing svn:mergeinfo\n")
>>                        rc = 1
>>                if not is_top_dir and 'svn:mergeinfo' in props:
>>                        sys.stderr.write(path + ": unexpected
>> svn:mergeinfo\n")
>>                        rc = 1
>>                if not is_top_dir and 'bugtraq:url' in props:
>>                        sys.stderr.write(path + ": unexpected bugtraq:url\n")
>>                        rc = 1
>>                if not is_top_dir and 'bugtraq:logregex' in props:
>>                        sys.stderr.write(path + ": unexpected
>> bugtraq:logregex\n")
>>                        rc = 1
>>                if not is_dir and not 'svn:mimetype' in props: # then it's
>> some kind of text file
>>                        for line in subprocess.Popen([SVNLOOK, 'cat', repos,
>> '--transaction', txn, path], stdout=subprocess.PIPE).stdout:
>>                                if "DO_NOT_COMMIT" in line:
>>                                        sys.stderr.write(path + ": found
>> DO_NOT_COMMIT\n")
>>                                        rc = 1
>>                                        break
>>
>> sys.exit(rc)
>>
>> --8>----------------------------------------------------
>>
The Subversion Hook Framework wiki
(http://sourceforge.net/apps/mediawiki/svnhook) has an example
pre-commit action for this.

<FilterCommitList>
  <PathRegex>(?i)/(branches|tags|trunk)/</PathRegex>
  <FilterPath>
    <PathRegex sense="false">(?i)/(trunk|branches/[^/]+|tags/[^/]+)/$</PathRegex>
    <FilterPropList>
      <PropNameRegex>^svn:mergeinfo$</PropNameRegex>
      <SendError>
        Merge info not allowed on path "${Path}"!
        Please revert the changes and merge at the root level.
      </SendError>
    </FilterPropList>
  </FilterPath>
</FilterCommitList>

Could be read as - look for anything under branches/tags/trunk and
prevent setting mergeinfo anywhere but at the root.
--
Geoff Rowell
geoff.rowell@gmail.com

Re: Question about excessive mergeinfo

Posted by Javier Sanz <js...@gmail.com>.
That's an awesome hook to limit svn:mergeinfo propagation, but
unfortunately it is not viable for complex repositories :(.

Let's hope Subversion 1.7 helps us with this.

On Wed, Jan 13, 2010 at 11:46 AM, Stein Somers <ss...@opnet.com> wrote:
>> I have a pre-commit hook to detect mergeinfo
>> below root, and remove it whenever it occurs
>
> For clarity: the pre-commit hook detects and rejects. The one removing the
> mergeinfo is me, using svn propdel.
>
> Someone asked for the hook code, here it is. It's not my submission for a
> beauty contest and there are some unrelated checks in there. I use the SVN
> command line instead of python bindings because I can't find the slightest
> explanation on them.
>
> --8>----------------------------------------------------
>
> #!/usr/bin/python
>
> # PRE-COMMIT HOOK
> SVNLOOK = '/usr/bin/svnlook'
>
> import subprocess
> import sys
>
> repos, txn = sys.argv[1:]
>
> rc = 0
>
> """
> logmsg = subprocess.Popen([SVNLOOK, 'log', repos, '--transaction', txn],
> stdout=subprocess.PIPE).stdout.read()
> if logmsg.isspace():
>        sys.stderr.write("Empty log message\n")
>        rc = 1
> """
>
> changes = subprocess.Popen([SVNLOOK, 'changed', repos, '--transaction',
> txn], stdout=subprocess.PIPE).stdout.readlines()
> for change in changes:
>        action = change[0]
>        assert(change[3] == ' ')
>        path = change[4:-1] # strip 2 leading change type characters followed
> by a space, and strip trailing newline
>        is_dir = path.endswith('/')
>        is_top_dir = False
>        if is_dir:
>                path_parts = path.split('/')
>                assert(path_parts[-1] == '')
>                if len(path_parts) == 2 and path_parts[0] == 'trunk':
>                        is_top_dir = True
>                if len(path_parts) == 3 and path_parts[0] in ('branches',
> 'tags'):
>                        is_top_dir = True
>
>        if action != 'D': # Delete
>                props = []
>                for entry in subprocess.Popen([SVNLOOK, 'proplist', repos,
> '--transaction', txn, path], stdout=subprocess.PIPE).stdout:
>                        assert(entry.startswith('  '))
>                        prop = entry[2:-1]
>                        props.append(prop)
>
>                if is_top_dir and not 'svn:mergeinfo' in props:
>                        sys.stderr.write(path + ": missing svn:mergeinfo\n")
>                        rc = 1
>                if not is_top_dir and 'svn:mergeinfo' in props:
>                        sys.stderr.write(path + ": unexpected
> svn:mergeinfo\n")
>                        rc = 1
>                if not is_top_dir and 'bugtraq:url' in props:
>                        sys.stderr.write(path + ": unexpected bugtraq:url\n")
>                        rc = 1
>                if not is_top_dir and 'bugtraq:logregex' in props:
>                        sys.stderr.write(path + ": unexpected
> bugtraq:logregex\n")
>                        rc = 1
>                if not is_dir and not 'svn:mimetype' in props: # then it's
> some kind of text file
>                        for line in subprocess.Popen([SVNLOOK, 'cat', repos,
> '--transaction', txn, path], stdout=subprocess.PIPE).stdout:
>                                if "DO_NOT_COMMIT" in line:
>                                        sys.stderr.write(path + ": found
> DO_NOT_COMMIT\n")
>                                        rc = 1
>                                        break
>
> sys.exit(rc)
>
> --8>----------------------------------------------------
>
> --
> Stein
>



-- 
Un saludo,

    Javier

Re: Question about excessive mergeinfo

Posted by Stein Somers <ss...@opnet.com>.
> I have a pre-commit hook to detect mergeinfo
> below root, and remove it whenever it occurs

For clarity: the pre-commit hook detects and rejects. The one removing 
the mergeinfo is me, using svn propdel.

Someone asked for the hook code, here it is. It's not my submission for 
a beauty contest and there are some unrelated checks in there. I use the 
SVN command line instead of python bindings because I can't find the 
slightest explanation on them.

--8>----------------------------------------------------

#!/usr/bin/python

# PRE-COMMIT HOOK
SVNLOOK = '/usr/bin/svnlook'

import subprocess
import sys

repos, txn = sys.argv[1:]

rc = 0

"""
logmsg = subprocess.Popen([SVNLOOK, 'log', repos, '--transaction', txn], 
stdout=subprocess.PIPE).stdout.read()
if logmsg.isspace():
         sys.stderr.write("Empty log message\n")
         rc = 1
"""

changes = subprocess.Popen([SVNLOOK, 'changed', repos, '--transaction', 
txn], stdout=subprocess.PIPE).stdout.readlines()
for change in changes:
         action = change[0]
         assert(change[3] == ' ')
         path = change[4:-1] # strip 2 leading change type characters 
followed by a space, and strip trailing newline
         is_dir = path.endswith('/')
         is_top_dir = False
         if is_dir:
                 path_parts = path.split('/')
                 assert(path_parts[-1] == '')
                 if len(path_parts) == 2 and path_parts[0] == 'trunk':
                         is_top_dir = True
                 if len(path_parts) == 3 and path_parts[0] in 
('branches', 'tags'):
                         is_top_dir = True

         if action != 'D': # Delete
                 props = []
                 for entry in subprocess.Popen([SVNLOOK, 'proplist', 
repos, '--transaction', txn, path], stdout=subprocess.PIPE).stdout:
                         assert(entry.startswith('  '))
                         prop = entry[2:-1]
                         props.append(prop)

                 if is_top_dir and not 'svn:mergeinfo' in props:
                         sys.stderr.write(path + ": missing 
svn:mergeinfo\n")
                         rc = 1
                 if not is_top_dir and 'svn:mergeinfo' in props:
                         sys.stderr.write(path + ": unexpected 
svn:mergeinfo\n")
                         rc = 1
                 if not is_top_dir and 'bugtraq:url' in props:
                         sys.stderr.write(path + ": unexpected 
bugtraq:url\n")
                         rc = 1
                 if not is_top_dir and 'bugtraq:logregex' in props:
                         sys.stderr.write(path + ": unexpected 
bugtraq:logregex\n")
                         rc = 1
                 if not is_dir and not 'svn:mimetype' in props: # then 
it's some kind of text file
                         for line in subprocess.Popen([SVNLOOK, 'cat', 
repos, '--transaction', txn, path], stdout=subprocess.PIPE).stdout:
                                 if "DO_NOT_COMMIT" in line:
                                         sys.stderr.write(path + ": 
found DO_NOT_COMMIT\n")
                                         rc = 1
                                         break

sys.exit(rc)

--8>----------------------------------------------------

-- 
Stein

Re: Question about excessive mergeinfo

Posted by Geoff Rowell <ge...@gmail.com>.
On Mon, Jan 11, 2010 at 8:28 AM, Stein Somers <ss...@opnet.com> wrote:
> No explanation here, and not the same symptoms, but you're not the only one
> struggling with it. I have a pre-commit hook to detect mergeinfo below root,
> and remove it whenever it occurs, which is rare. The repository has only
> mergeinfo on root directories, merges are done only on roots, no switched or
> shallow WC. No externals either. Still, svn 1.6.6 tries to push excessive
> mergeinfo your way. Luckily only plain and simple recursive mergeinfo.
>
> When copying by URL a subdirectory from another branch to somewhere in a WC,
> the new subdirectory always gets a mergeinfo property. Its value is a copy
> of the mergeinfo of the root of the source branch (where this "root" is an
> interpretation of course; more accurately, it is the nearest (and only)
> higher directory that has a mergeinfo property, relative to the copied
> subdirectory). Not surprisingly, the new mergeinfo is a subset of the
> mergeinfo of the current working copy root: fewer branches listed, fewer
> revisions listed. In my interpretation of the rules, this mergeinfo is
> entirely useless. So no thank you, I don't commit it.
>
Yes. My developers have seen this unwanted addition of mergeinfo from
URL copying, too.

The mergeinfo restriction in the hook has proven invaluable in
preventing a commit of it.
--
Geoff Rowell
geoff.rowell@gmail.com

Re: Question about excessive mergeinfo

Posted by Stein Somers <ss...@opnet.com>.
No explanation here, and not the same symptoms, but you're not the only 
one struggling with it. I have a pre-commit hook to detect mergeinfo 
below root, and remove it whenever it occurs, which is rare. The 
repository has only mergeinfo on root directories, merges are done only 
on roots, no switched or shallow WC. No externals either. Still, svn 
1.6.6 tries to push excessive mergeinfo your way. Luckily only plain and 
simple recursive mergeinfo.

When copying by URL a subdirectory from another branch to somewhere in a 
WC, the new subdirectory always gets a mergeinfo property. Its value is 
a copy of the mergeinfo of the root of the source branch (where this 
"root" is an interpretation of course; more accurately, it is the 
nearest (and only) higher directory that has a mergeinfo property, 
relative to the copied subdirectory). Not surprisingly, the new 
mergeinfo is a subset of the mergeinfo of the current working copy root: 
fewer branches listed, fewer revisions listed. In my interpretation of 
the rules, this mergeinfo is entirely useless. So no thank you, I don't 
commit it.

--
Stein

Re: Question about excessive mergeinfo

Posted by Dave Huang <kh...@azeotrope.org>.
On 1/9/2010 11:36 AM, David Huang wrote:
>
> On Jan 9, 2010, at 7:58 AM, Geoff Rowell wrote:
>> I follow a few rules to avoid this:
>> 1) Remove obsolete merge info as part of the branch creation process
>> (svn pd -R svn:mergeinfo /my/branch).
>
> I don't do that regularly (but have done it once or twice), but from my understanding, that fixes the "problem"/annoyance where existing subtree mergeinfo gets updated every time a merge is done, even if the merge doesn't affect the files with mergeinfo. That's not the same issue as what I'm seeing though; in my case, mergeinfo is being created on files that didn't have it before.

FWIW, I made a backup of my repo, then in the backup, removed all mergeinfo 
from trunk and made a new branch off of trunk. I confirmed that the branch 
also has no mergeinfo. I then made a commit to the trunk and merged that 
commit to the branch. It caused the same problem where mergeinfo was added 
to every file in those 4 directories that have externals.

As a second test, I removed all the external definitions from trunk, made 
yet another branch off of trunk, committed a change to trunk, then merged 
the change to the branch. Mergeinfo was created on the root of the branch, 
but nowhere else--which is what I wanted and expected.

So, it seems to have something to do with the externals, but I don't know what.

Re: Question about excessive mergeinfo

Posted by David Huang <kh...@azeotrope.org>.
On Jan 9, 2010, at 7:58 AM, Geoff Rowell wrote:
> I follow a few rules to avoid this:
> 1) Remove obsolete merge info as part of the branch creation process
> (svn pd -R svn:mergeinfo /my/branch).

I don't do that regularly (but have done it once or twice), but from my understanding, that fixes the "problem"/annoyance where existing subtree mergeinfo gets updated every time a merge is done, even if the merge doesn't affect the files with mergeinfo. That's not the same issue as what I'm seeing though; in my case, mergeinfo is being created on files that didn't have it before.

> 2) Only allow recording of merge info at the root level. This means
> that all merges must take place to and from the root of branches and
> the trunk. (In fact, a pre-commit hook prevents saving merge info
> anywhere else.)

I do always merge at the root.

> 3) Remove merge info from trunk when a branch is no longer under
> active development.

This also seems to address the issue of updates on existing mergeinfo, but not creation of new mergeinfo.