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

[PATCH] Make cvs2svn.py cleanup after itself

From: Francois Beausoleil <fbos_at_users.sourceforge.net>
Date: 2004-01-20 21:45:22 CET

Hi,

Just a quick addition to cvs2svn.py to make it cleanup after itself.

I made the default to clean the files, but during development, you might
want to reverse this ? To allow a developer to check the intermediate
files ?

I am also attaching the patch, since my mailer will probably clobber the
patch.

Thanks !
François

[[[
* tools/cvs3svn/cvs2svn.py(pass5, usage, main):
  Added a fifth pass, to make the poor slob cleanup after itself.
  This patch also introduces a new parameter: --skip-cleanup.
]]]
Index: tools/cvs2svn/cvs2svn.py
===================================================================
--- tools/cvs2svn/cvs2svn.py (revision 8398)
+++ tools/cvs2svn/cvs2svn.py (working copy)
@@ -2141,12 +2141,18 @@
   if ctx.verbose:
     print count, 'commits processed.'
 
+def pass5(ctx):
+ if ctx.skip_cleanup: return
+ for filename in os.listdir('.'):
+ if filename[0:8] == 'cvs2svn-' and filename[-4:] != 'dump':
+ os.unlink(filename)
 
 _passes = [
   pass1,
   pass2,
   pass3,
   pass4,
+ pass5,
   ]
 
 
@@ -2193,6 +2199,8 @@
         % ctx.encoding
   print ' --username=NAME default name when CVS repos has no name
   (default: %s)' \
         % ctx.username
+ print ' --skip-cleanup prevent the deletion of intermediate files
(default: %s)' \
+ % ctx.skip_cleanup
 
 
 def main():
@@ -2215,6 +2223,7 @@
   ctx.svnadmin = "svnadmin"
   ctx.username = "unknown"
   ctx.print_help = 0
+ ctx.skip_cleanup = 0
 
   start_pass = 1
 
@@ -2224,7 +2233,8 @@
                                  "username=",
                                  "branches=", "tags=", "encoding=",
                                  "trunk-only", "no-prune",
- "dump-only", "dumpfile=", "svnadmin="])
+ "dump-only", "dumpfile=", "svnadmin=",
+ "skip-cleanup"])
   except getopt.GetoptError, e:
     sys.stderr.write(error_prefix + ': ' + str(e) + '\n\n')
     usage(ctx)
@@ -2268,6 +2278,8 @@
       ctx.encoding = value
     elif opt == '--username':
       ctx.username = value
+ elif opt == '--skip-cleanup':
+ ctx.skip_cleanup = 1
 
   if ctx.print_help:
     usage(ctx)

Index: tools/cvs2svn/cvs2svn.py
===================================================================
--- tools/cvs2svn/cvs2svn.py (revision 8398)
+++ tools/cvs2svn/cvs2svn.py (working copy)
@@ -2141,12 +2141,18 @@
   if ctx.verbose:
     print count, 'commits processed.'
 
+def pass5(ctx):
+ if ctx.skip_cleanup: return
+ for filename in os.listdir('.'):
+ if filename[0:8] == 'cvs2svn-' and filename[-4:] != 'dump':
+ os.unlink(filename)
 
 _passes = [
   pass1,
   pass2,
   pass3,
   pass4,
+ pass5,
   ]
 
 
@@ -2193,6 +2199,8 @@
         % ctx.encoding
   print ' --username=NAME default name when CVS repos has no name (default: %s)' \
         % ctx.username
+ print ' --skip-cleanup prevent the deletion of intermediate files (default: %s)' \
+ % ctx.skip_cleanup
 
 
 def main():
@@ -2215,6 +2223,7 @@
   ctx.svnadmin = "svnadmin"
   ctx.username = "unknown"
   ctx.print_help = 0
+ ctx.skip_cleanup = 0
 
   start_pass = 1
 
@@ -2224,7 +2233,8 @@
                                  "username=",
                                  "branches=", "tags=", "encoding=",
                                  "trunk-only", "no-prune",
- "dump-only", "dumpfile=", "svnadmin="])
+ "dump-only", "dumpfile=", "svnadmin=",
+ "skip-cleanup"])
   except getopt.GetoptError, e:
     sys.stderr.write(error_prefix + ': ' + str(e) + '\n\n')
     usage(ctx)
@@ -2268,6 +2278,8 @@
       ctx.encoding = value
     elif opt == '--username':
       ctx.username = value
+ elif opt == '--skip-cleanup':
+ ctx.skip_cleanup = 1
 
   if ctx.print_help:
     usage(ctx)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Jan 20 21:45:55 2004

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