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

Re: svn commit: r29770 - trunk/contrib/client-side/svnmerge

From: C. Michael Pilato <cmpilato_at_collab.net>
Date: Mon, 10 Mar 2008 11:49:35 -0400

Paul Burba wrote:
> On Fri, Mar 7, 2008 at 1:18 PM, <cmpilato_at_tigris.org> wrote:
>
>> Author: cmpilato
>> Date: Fri Mar 7 10:18:08 2008
>> New Revision: 29770
>>
>> Log:
>> Teach svnmerge-migrate-history.py to handle the differences between
>> the svnmerge tracking info format and the format used by Subversion
>> for its own merge tracking info.
>>
>> * contrib/client-side/svnmerge/svnmerge-migrate-history.py
>> (Migrator.add_to_mergeinfo): Convert svnmerge property values into
>> Subversion mergeinfo format before slamming them through APIs that
>> expect the latter.
>>
>> Modified:
>> trunk/contrib/client-side/svnmerge/svnmerge-migrate-history.py
>>
>> Modified: trunk/contrib/client-side/svnmerge/svnmerge-migrate-history.py
>> URL: http://svn.collab.net/viewvc/svn/trunk/contrib/client-side/svnmerge/svnmerge-migrate-history.py?pathrev=29770&r1=29769&r2=29770
>> ==============================================================================
>> --- trunk/contrib/client-side/svnmerge/svnmerge-migrate-history.py (original)
>> +++ trunk/contrib/client-side/svnmerge/svnmerge-migrate-history.py Fri Mar 7 10:18:08 2008
>> @@ -21,6 +21,7 @@
>> import os
>> import sre
>> import getopt
>> +import urllib
>> try:
>> my_getopt = getopt.gnu_getopt
>> except AttributeError:
>> @@ -191,11 +192,35 @@
>>
>> def add_to_mergeinfo(self, svnmerge_prop_val, mergeinfo_prop_val):
>> if svnmerge_prop_val is not None:
>> + # Convert svnmerge-* property value (which uses any whitespace
>> + # for delimiting sources and stores source paths URI-encoded)
>> + # into a svn:mergeinfo syntax (which is newline-separated with
>> + # URI-decoded paths).
>> + sources = svnmerge_prop_val.split()
>> + svnmerge_prop_val = ''
>> + for source in sources:
>> + pieces = source.split(':')
>> + if len(pieces) > 2:
>
> Hi Mike,
>
> What valid svnmerge-integrated property value would cause len(pieces) > 2?

Probably none -- I was just coding flexibly.

>> + pieces = [pieces[:-1].join(':'), pieces[-1]]
>
> And if we do get here, pieces[:-1] is a list object, which has no join
> method, so wouldn't this toss an AttributeError? Am I grossly
> misunderstanding something?

No, I just keep making the same mistake with string joining. That should be:

     pieces = [':'.join(pieces[:-1]), pieces[-1]]

But maybe the following is better. I mean, we probably don't need to
support paths with colons in them, right?

Index: contrib/client-side/svnmerge/svnmerge-migrate-history.py
===================================================================
--- contrib/client-side/svnmerge/svnmerge-migrate-history.py (revision 29819)
+++ contrib/client-side/svnmerge/svnmerge-migrate-history.py (working copy)
@@ -200,8 +200,6 @@
        svnmerge_prop_val = ''
        for source in sources:
          pieces = source.split(':')
- if len(pieces) > 2:
- pieces = [pieces[:-1].join(':'), pieces[-1]]
          if len(pieces) != 2:
            continue
          pieces[0] = urllib.unquote(pieces[0])

-- 
C. Michael Pilato <cmpilato_at_collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

Received on 2008-03-10 16:49:56 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.