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 2003/12/23 14:13:13 UTC

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

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


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

Posted by Max Bowsher <ma...@ukf.net>.
> On Tue, 23 Dec 2003 09:13:13 -0500, "Francois Beausoleil" said:
>> 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.
...
Francois Beausoleil wrote:
> Please heed the comments in r6936 about the difference between is and ==.
> 
> The patch should use:
> if self.dumpfile is None: return
> 
> instead of:
> if None == self.dumpfile: return
> 
> Sorry about that.

No problem!

Patch applied.

Thanks!

Max.


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

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

Posted by Francois Beausoleil <fb...@users.sourceforge.net>.
Please heed the comments in r6936 about the difference between is and ==.

The patch should use:
if self.dumpfile is None: return

instead of:
if None == self.dumpfile: return

Sorry about that.

Bye,
François

On Tue, 23 Dec 2003 09:13:13 -0500, "Francois Beausoleil"
<fb...@users.sourceforge.net> said:
> 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
> 

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