[Svnmerge] Re: svn commit: r19626 - trunk/contrib/client-side

Blair Zajac blair at orcaware.com
Fri May 12 10:43:22 PDT 2006


giovannibajo at 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 at orcaware.com>
Subversion training, consulting and support
http://www.orcaware.com/svn/



More information about the Svnmerge mailing list