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

[PATCH] cvs2svn.py - Always return / in make_path()

From: Francois Beausoleil <fbos_at_users.sourceforge.net>
Date: 2003-07-24 20:30:23 CEST

Hi !

This is a patch to be able to use cvs2svn.py on Win32. This patch
converts from backslashes to forward-slashes, which SVN expects.

LOG:
* tools/cvs2svn/cvs2svn.py (make_path):
  Convert from using platform default path separator to forward slashes
  in all cases. If left alone, conversion on Win32 would generate
  filenames with forward slashes in them, which could not be checked
  out. svnshell.py would also be unable to cat the file's content.

Index: cvs2svn.py
===================================================================
--- cvs2svn.py (revision 6562)
+++ cvs2svn.py (working copy)
@@ -77,6 +77,12 @@
 # official restrictions anyway).
 symbolic_name_re = re.compile('^[a-zA-Z][^/\\\\]*$')
 
+# A regular expression to split a path that contains both forward and
back
+# slashes. This is important on Win32 because the paths will use the
+# platform default, but SVN must receive forward slashes. See the
+# make_path() return value for more information on usage.
+slash_split_re = re.compile("/\\\\|\\\\|:")
+
 class CollectData(rcsparse.Sink):
   def __init__(self, cvsroot, log_fname_base):
     self.cvsroot = cvsroot
@@ -306,20 +312,22 @@
 
   if branch_name:
     if path:
- return ctx.branches_base + '/' + branch_name + '/' + path
+ target_path = ctx.branches_base + '/' + branch_name + '/' + path
     else:
- return ctx.branches_base + '/' + branch_name
+ target_path = ctx.branches_base + '/' + branch_name
   elif tag_name:
     if path:
- return ctx.tags_base + '/' + tag_name + '/' + path
+ target_path = ctx.tags_base + '/' + tag_name + '/' + path
     else:
- return ctx.tags_base + '/' + tag_name
+ target_path = ctx.tags_base + '/' + tag_name
   else:
     if path:
- return ctx.trunk_base + '/' + path
+ target_path = ctx.trunk_base + '/' + path
     else:
- return ctx.trunk_base
+ target_path = ctx.trunk_base
 
+ # Convert from back-slashes to forward-slashes
+ return string.join(slash_split_re.split(target_path), "/")
 
 def relative_name(cvsroot, fname):
   l = len(cvsroot)
Developer of Java Gui Builder
http://jgb.sourceforge.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Jul 24 20:33:59 2003

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.