[PATCH] destroy_repository.py and empty/non-empty revisions

Jon Foster <[email protected]> Fri, 26 Feb 2010 15:27:54 -0000
Newsgroups gmane.comp.version-control.subversion.cvs2svn.devel
Message-ID <[email protected]>
Hi,

With CVS, you can use "cvs commit -f" to commit a file that hasn't
actually changed.  This generates a new revision in the repository,
with an empty diff.  I'm working on a patch for cvs2svn to allow these
no-op CVS commits to be ignored.

I want to use contrib/destroy_repository.py to make test cases, but
it replaces every diff with an empty one.  This means that every
revision (except adds and deletes) looks like a no-op CVS commit.

The attached patch to contrib/destroy_repository.py makes it preserve
the empty/non-empty state, while still destroying the actual data.
The patch is against cvs2svn trunk.

Kind regards,

Jon Foster
--


**********************************************************************
This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Cabot Communications Ltd.

If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone.

Cabot Communications Limited
Verona House, Filwood Road, Bristol BS16 3RY, UK
+44 (0) 1179584232

Co. Registered in England number 02817269

Please contact the sender if you believe you have received this email in error.

**********************************************************************


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

------------------------------------------------------
http://cvs2svn.tigris.org/ds/viewMessage.do?dsForumId=1667&dsMessageId=2452581

To unsubscribe from this discussion, e-mail: [[email protected]].
cvs2svn_nonempty_data_patch.txt (text/plain, 1.6 KB)
Index: contrib/destroy_repository.py
===================================================================
--- contrib/destroy_repository.py	(revision 5065)
+++ contrib/destroy_repository.py	(working copy)
@@ -297,7 +297,30 @@
 
     def set_revision_info(self, revision, log, text):
         if destroy['data']:
-            text = ''
+            # If this is a no-op revision, preserve that fact.
+            # (It might be relied on by cvs2svn).
+            #
+            # Otherwise, replace the data.
+            if text != '':
+                # We either need fulltext or an RCS patch, depending on
+                # historical information we don't have easy access to here.
+                # However... an RCS patch is valid fulltext.
+                #
+                # So we just need an RCS patch that will work regardless
+                # of the thing we're patching.  We choose to use a simple
+                # patch that adds a new line to the start of the file.
+                #
+                # So the contents of the HEAD revision will be:
+                #     a 0 1
+                #     data
+                # the next-oldest will be:
+                #     data
+                #     a 0 1
+                #     data
+                # etc, with a new 'data' line being added at the start of the
+                # file for every step we take away from HEAD.
+                #
+                text = 'a 0 1\ndata\n'
         if destroy['metadata'] or destroy['symbols'] or destroy['filenames']:
             log = self.log_substituter.get_substitution(log)
         FilterSink.set_revision_info(self, revision, log, text)