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

[PATCH] cvs2svn in dry-run mode causes Dumper traceback

From: Francois Beausoleil <fbos_at_users.sourceforge.net>
Date: 2003-12-23 15:13:13 CET

Hello everyone !

Just tried cvs2svn again, and found a small bug when dry-run is enabled.
cvs2svn attemps to close the dumpfile, even in none exists.

I used the following command:
cvs2svn.py -n -v -s tmp\jgb --create --trunk-only --username=fbos \
    tmp\jgb-cvsroot

Which resulted in the following traceback:
...
    adding or changing 1.9 :
    trunk/jgb/jgb/src/java/tests/jgb/handlers/swing/TestItemTagHandler.java
    (skipped; dry run enabled)
Finishing tags:
Traceback (most recent call last):
  File "E:\java\svn\tools\cvs2svn\cvs2svn.py", line 2302, in ?
    main()
  File "E:\java\svn\tools\cvs2svn\cvs2svn.py", line 2298, in main
    convert(ctx, start_pass=start_pass)
  File "E:\java\svn\tools\cvs2svn\cvs2svn.py", line 2154, in convert
    _passes[i](ctx)
  File "E:\java\svn\tools\cvs2svn\cvs2svn.py", line 2129, in pass4
    dumper.close()
  File "E:\java\svn\tools\cvs2svn\cvs2svn.py", line 1164, in close
    self.flush_and_remove_dumpfile()
  File "E:\java\svn\tools\cvs2svn\cvs2svn.py", line 889, in
  flush_and_remove_dumpfile
    self.dumpfile.close()
AttributeError: 'NoneType' object has no attribute 'close'

The following patch corrects this exception:
[[[
* tools/cvs2svn/cvs2svn.py (Dumper.flush_and_remove_dumpfile):
  Correct an exception when dry-run is enabled by aborting the method
  when no dump file exists.
]]]

Index: tools/cvs2svn/cvs2svn.py
===================================================================
--- tools/cvs2svn/cvs2svn.py (revision 8072)
+++ tools/cvs2svn/cvs2svn.py (working copy)
@@ -886,6 +886,8 @@
                         '\n')

   def flush_and_remove_dumpfile(self):
+ if None == self.dumpfile: return
+
     self.dumpfile.close()
     print 'loading revision %d into %s' % (self.revision, self.target)
     os.system('%s load -q %s < %s'

Bye !
François

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Dec 23 15:15:25 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.