[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: Paul Burba <ptburba_at_gmail.com>
Date: Mon, 10 Mar 2008 10:34:59 -0500

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?

> + 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?

Paul

>
> + if len(pieces) != 2:
> + continue
> + pieces[0] = urllib.unquote(pieces[0])
> + print "PIECES = " + str(pieces)
> + svnmerge_prop_val = svnmerge_prop_val + '%s\n' % (':'.join(pieces))
> +
> + # If there is Subversion mergeinfo to merge with, do so.
> + # Otherwise, our svnmerge info simply becomes our new mergeinfo.
> if mergeinfo_prop_val:
> mergeinfo = svn.core.svn_mergeinfo_parse(mergeinfo_prop_val)
> + for key, val in mergeinfo.items():
> + print "ORIG_MERGEINFO(%s) = %s" \
> + % (key, map(lambda x: "(%d, %d)" % (x.start, x.end), val))
> to_migrate = svn.core.svn_mergeinfo_parse(svnmerge_prop_val)
> - mergeinfo = svn.core.svn_mergeinfo_merge(mergeinfo, to_migrate)
> - mergeinfo_prop_val = svn.core.svn_mergeinfo_to_string(mergeinfo)
> + for key, val in to_migrate.items():
> + print "MERGED_MERGEINFO(%s) = %s" \
> + % (key, map(lambda x: "(%d, %d)" % (x.start, x.end), val))
> + mergeinfo_prop_val = svn.core.svn_mergeinfo_to_string(
> + svn.core.svn_mergeinfo_merge(mergeinfo, to_migrate))
> else:
> mergeinfo_prop_val = svnmerge_prop_val
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe_at_subversion.tigris.org
> For additional commands, e-mail: svn-help_at_subversion.tigris.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-03-10 16:35:12 CET

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