From 2594854b41c298ac89a1b9de34664db83b85ea7c Mon Sep 17 00:00:00 2001 From: mhagger Date: Mon, 8 Mar 2010 15:41:04 +0000 Subject: [PATCH] destroy_repository.py: Preserve empty/non-empty revisions. Patch by: Jon Foster 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. This change makes contrib/destroy_repository.py preserve the empty/non-empty state, while still destroying the actual data. git-svn-id: http://cvs2svn.tigris.org/svn/cvs2svn/trunk@5066 be7e6eca-30d4-0310-a8e5-ac0d63af7087 --- contrib/destroy_repository.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/contrib/destroy_repository.py b/contrib/destroy_repository.py index 461a1894..200caee9 100755 --- a/contrib/destroy_repository.py +++ b/contrib/destroy_repository.py @@ -297,7 +297,30 @@ class DestroyerFilterSink(FilterSink): 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) -- 2.11.4.GIT