[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 13:41:48 -0500

On Mon, Mar 10, 2008 at 10:49 AM, C. Michael Pilato <cmpilato_at_collab.net> wrote:
>
>
>
> 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?

Does any platform besides pre-OSX Mac even support ':' in pathnames?
Does linux? (I can't find it explicitly prohibited nor mentioned as
valid...maybe the answer is painfully obvious to linux folk, but not
to us Win32 losers)

While svnmerge.py seems to support paths with colons, see
svnmerge.py:dict_from_revlist_prop(), it is not currently considered
syntactically valid by svn_mergeinfo_parse(). So even with your
correction a few lines back the migration script will still blow up,
e.g.:

C:\SVN\src-trunk\Release\subversion\tests\cmdline\svn-test-work\working_copies>svnmerge-migrate-history.py
..\repositories\merge_tests-89 --verbose
Examining path 'A' for conversion
No merge history on 'A'
Examining path 'A/C' for conversion
No merge history on 'A/C'
Examining path 'A/B' for conversion
No merge history on 'A/B'
Examining path 'A/B/F' for conversion
No merge history on 'A/B/F'
Examining path 'A/B/E' for conversion
No merge history on 'A/B/E'
Examining path 'A/D' for conversion
No merge history on 'A/D'
Examining path 'A/D/H' for conversion
No merge history on 'A/D/H'
Examining path 'A/D/G' for conversion
No merge history on 'A/D/G'
Examining path 'A_COPY' for conversion
Discovered pre-existing Subversion mergeinfo of '/A:6'
Discovered svnmerge.py mergeinfo of '/A:B:1-6'
Traceback (most recent call last):
  File "C:\SVN\src-trunk\contrib\client-side\svnmerge\svnmerge-migrate-history.py",
line 266, in ?
    main()
  File "C:\SVN\src-trunk\contrib\client-side\svnmerge\svnmerge-migrate-history.py",
line 263, in main
    migrator.run()
  File "C:\SVN\src-trunk\contrib\client-side\svnmerge\svnmerge-migrate-history.py",
line 100, in run
    prefix[len(prefix) - 1] + ".*")
  File "C:\SVN\src-trunk\contrib\client-side\svnmerge\svnmerge-migrate-history.py",
line 115, in process_dir
    if not self.convert_path_history(root, revnum, child_path):
  File "C:\SVN\src-trunk\contrib\client-side\svnmerge\svnmerge-migrate-history.py",
line 146, in convert_path_history
    mergeinfo_prop_val)
  File "C:\SVN\src-trunk\contrib\client-side\svnmerge\svnmerge-migrate-history.py",
line 215, in add_to_mergeinfo
    to_migrate = svn.core.svn_mergeinfo_parse(svnmerge_prop_val)
  File "C:\Python24\lib\site-packages\libsvn\core.py", line 4066, in
svn_mergeinfo_parse
    return apply(_core.svn_mergeinfo_parse, args)
svn.core.SubversionException: ("Could not parse mergeinfo string
'B:1-6\n'", 200020)

> 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]]

I'm +1 on this, unless someone can point to a file system with ':' in
the pathname.

Paul

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

---------------------------------------------------------------------
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 19:42:02 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.