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

[PATCH] cvs2svn.py - add error checking to pass3 and Windows workaround

From: Francois Beausoleil <fbos_at_users.sourceforge.net>
Date: 2003-10-14 21:17:34 CEST

Hi !

This is a fix that allows the output to be sorted on Windows too.
The old code always failed and did not create the expected output
file. Besides, the code was missing a small amount of error
checking.

Maybe this should have been two patches ?

Thanks,
François

PS: Attached the patch too.

Log Message:
* tools/cvs2svn/cvs2svn.py
  (pass3):
    Fix problem sorting on Windows. See embedded comments for more
    information. Additionnaly, added a test to make sure the sort
    command ran successfully, and bail out if not.

Index: tools/cvs2svn/cvs2svn.py
===================================================================
--- tools/cvs2svn/cvs2svn.py (revision 7422)
+++ tools/cvs2svn/cvs2svn.py (working copy)
@@ -2004,11 +2004,22 @@

 def pass3(ctx):
+ # On Windows, redirection does not seem to work when called from
Python.
+ # So, in this case, we tell the sort command to output into a named
file,
+ # instead of going to stdout. In addition, sort is supposed to be
faster
+ # when *not* redirecting.
+ if os.name == 'nt':
+ outputparam = '/O'
+ else:
+ outputparam = '>'
+
   # sort the log files
- os.system('sort %s > %s' % (ctx.log_fname_base + CLEAN_REVS_SUFFIX,
+ rval = os.system('sort %s %s %s' % (ctx.log_fname_base +
CLEAN_REVS_SUFFIX,
+ outputparam,
                               ctx.log_fname_base + SORTED_REVS_SUFFIX))
+ if rval != 0:
+ raise RuntimeError, ('Sort program unavailable. Return value is %s'
% rval)

-
 def pass4(ctx):
   sym_tracker = SymbolicNameTracker()
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 Tue Oct 14 21:21:54 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.