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

patch to cvs2svn.py (David Summers' problem)

From: <kfogel_at_collab.net>
Date: 2003-05-11 06:19:54 CEST

David (and Robert), please try out this patch. It should fix David's
problem; I don't know if it will fix Robert's.

I haven't committed it yet, as I still want to mull on it, but it will
be useful to know if it makes the problem go away for you (David).

-Karl

--------------------8-<-------cut-here---------8-<-----------------------

Handle case reported by David Summers, where a CVS file is first added
on a branch, so the RCS file starts out in the Attic, with revision
1.1 in state "dead":

* tools/cvs2svn/cvs2svn.py
  (Commit.commit): Don't try to delete revision 1.1 of a file, and
    don't output a revision unless there was some activity.

Index: cvs2svn.py
===================================================================
--- cvs2svn.py (revision 5881)
+++ cvs2svn.py (working copy)
@@ -696,13 +696,28 @@
       print 'Try rerunning with (for example) \"--encoding=latin1\".'
       sys.exit(1)
 
- dump.start_revision(props)
+ ### FIXME: Until we handle branches and tags, there's a
+ ### possibility that none of the code below will get used. For
+ ### example, if the CVS file was added on a branch, then its
+ ### revision 1.1 will start out in state "dead", and the RCS file
+ ### will be in the Attic/. If that file is the only item in the
+ ### commit, then we won't hit the `self.changes' case at all, and
+ ### we won't do anything in the `self.deletes' case, since we
+ ### don't handle the branch right now, and we special-case
+ ### revision 1.1.
+ ###
+ ### So this variable helps make sure we don't write a no-op
+ ### revision to the dumpfile.
+ started_revision = 0
 
     for rcs_file, cvs_rev, br, tags, branches in self.changes:
       # compute a repository path, dropping the ,v from the file name
       cvs_path = relative_name(ctx.cvsroot, rcs_file[:-2])
       svn_path = branch_path(ctx, br) + cvs_path
       print ' adding or changing %s : %s' % (cvs_rev, svn_path)
+ if not started_revision:
+ dump.start_revision(props)
+ started_revision = 1
       dump.add_or_change_path(cvs_path, svn_path, cvs_rev, rcs_file)
 
     for rcs_file, cvs_rev, br, tags, branches in self.deletes:
@@ -710,10 +725,17 @@
       cvs_path = relative_name(ctx.cvsroot, rcs_file[:-2])
       svn_path = branch_path(ctx, br) + cvs_path
       print ' deleting %s : %s' % (cvs_rev, svn_path)
- dump.delete_path(svn_path)
+ if cvs_rev != '1.1':
+ if not started_revision:
+ dump.start_revision(props)
+ started_revision = 1
+ dump.delete_path(svn_path)
 
- previous_rev = dump.end_revision()
- print ' new revision:', previous_rev
+ if started_revision:
+ previous_rev = dump.end_revision()
+ print ' new revision:', previous_rev
+ else:
+ print ' no new revision created, as nothing to do'
 
 
 # ### This stuff left in temporarily, as a reference:

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun May 11 07:02:18 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.