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

[PATCH] branches/cvs2svn-kfogel/tools/cvs2svn/cvs2svn.py

From: Michael Wood <mwood_at_its.uct.ac.za>
Date: 2003-04-29 11:15:13 CEST

I don't know if the code in Dump.start_revision() is going to be
scrapped in favour of "back patching" as is done in
Dump.add_or_change_path(). Here's a patch in case it's not.

Fix up the format of the Revision part of the dump file written by the
new cvs2svn.py.

* branches/cvs2svn-kfogel/tools/cvs2svn/cvs2svn.py:
  (Dump.start_revision): Fix the Prop-content-length and
    Content-length calculation. Move the code that outputs
    PROPS-END out of the loop.

Index: branches/cvs2svn-kfogel/tools/cvs2svn/cvs2svn.py
===================================================================
--- branches/cvs2svn-kfogel/tools/cvs2svn/cvs2svn.py (revision 5755)
+++ branches/cvs2svn-kfogel/tools/cvs2svn/cvs2svn.py (working copy)
@@ -401,12 +401,12 @@
     # are always the same for revisions.
     
     # Calculate the total length of the props section.
- total_len = 0
+ total_len = len('PROPS-END\n')
     for pname in props.keys():
- klen = len(pname) + 1
- klen_len = int(math.ceil(math.log10(klen))) + 1
- plen = len(props[pname]) + 1
- plen_len = int(math.ceil(math.log10(plen))) + 1
+ klen = len(pname) + 1 # pname + '\n'
+ klen_len = int(math.ceil(math.log10(klen))) + 3 # 'K ' + klen + '\n'
+ plen = len(props[pname]) + 1 # prop + '\n'
+ plen_len = int(math.ceil(math.log10(plen))) + 3 # 'V ' + klen + '\n'
       total_len = total_len + klen + klen_len + plen + plen_len
         
     # Print the revision header and props
@@ -419,8 +419,8 @@
       self.dumpfile.write('%s\n' % pname)
       self.dumpfile.write('V %d\n' % len(props[pname]))
       self.dumpfile.write('%s\n' % props[pname])
- self.dumpfile.write('PROPS-END\n')
- self.dumpfile.write('\n')
+ self.dumpfile.write('PROPS-END\n')
+ self.dumpfile.write('\n')
 
   def end_revision(self):
     old_rev = self.revision

-- 
Michael Wood <mwood@its.uct.ac.za>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Apr 29 11:16:48 2003

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