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

Re: svn commit: r19626 - trunk/contrib/client-side

From: Blair Zajac <blair_at_orcaware.com>
Date: 2006-05-12 19:43:22 CEST

giovannibajo@tigris.org wrote:
> Author: giovannibajo
> Date: Fri May 12 09:33:18 2006
> New Revision: 19626
>
> Modified:
> trunk/contrib/client-side/svnmerge.py
>
> Log:
> Fix a bug with XML regexp parsing: the path information interpolated within
> the regular expression must be correctly escaped.
>
> * contrib/client-side/svnmerge.py:
> (get_copyfrom): Use re.escape to interpolate the path within the regular
> expression.
>
>
> Modified: trunk/contrib/client-side/svnmerge.py
> URL: http://svn.collab.net/viewvc/svn/trunk/contrib/client-side/svnmerge.py?pathrev=19626&r1=19625&r2=19626
> ==============================================================================
> --- trunk/contrib/client-side/svnmerge.py (original)
> +++ trunk/contrib/client-side/svnmerge.py Fri May 12 09:33:18 2006
> @@ -712,7 +712,8 @@
> split_lines=False)
> out = out.replace("\n", " ")
> try:
> - m = re.search(r'(<path\s[^>]*action="A"[^>]*>%s</path>)' % rlpath, out)
> + m = re.search(r'(<path\s[^>]*action="A"[^>]*>%s</path>)'
> + % re.escape(rlpath), out)
> head = re.search(r'copyfrom-path="([^"]*)"', m.group(1)).group(1)
> rev = re.search(r'copyfrom-rev="([^"]*)"', m.group(1)).group(1)
> return head,rev

I'm thinking instead of using regex's over the XML, which granted is fast, a
cleaner approach may be to use an XML parsing library. I'm thinking of
xmltramp, which generates a nice tree of dictionaries and lists using the XML,
which then we could iterate over.

http://www.aaronsw.com/2002/xmltramp/

xmltramp has been around for a while, so it probably has support for older
versions of Python.

Regards,
Blair

-- 
Blair Zajac, Ph.D.
<blair@orcaware.com>
Subversion training, consulting and support
http://www.orcaware.com/svn/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri May 12 19:43:50 2006

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.