You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Francois Beausoleil <fb...@users.sourceforge.net> on 2004/01/20 20:45:22 UTC

[PATCH] Make cvs2svn.py cleanup after itself

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)

Re: [PATCH] Make cvs2svn.py cleanup after itself

Posted by Francois Beausoleil <fb...@users.sourceforge.net>.
On 20 Jan 2004 15:39:33 -0600, kfogel@collab.net said:
> Great!  I was planning to make a change like this.  I'll save this
> mail; if you want to file an issue with it, that'd be great, but no
> pressing need.
> 
[snip]

Filed as issue 1712
http://subversion.tigris.org/issues/show_bug.cgi?id=1712

I also added a comment about run-tests.  It should probably clean up if
all the tests are run, but not if a single test is run ?

Bye !
François
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


Re: [PATCH] Make cvs2svn.py cleanup after itself

Posted by kf...@collab.net.
Great!  I was planning to make a change like this.  I'll save this
mail; if you want to file an issue with it, that'd be great, but no
pressing need.

-K

"Francois Beausoleil" <fb...@users.sourceforge.net> writes:
> 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)
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org