Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Revision information mismatch after sccs2svn conversion

I'm trying to convert an existing SCCS repository into SVN format and I've been using the recommended sccs2svn python script. However, it appears to be "shuffling" the revision information as follows:

SCCS prt gives:

 revision 5, date 5, author 5, comment 5
 revision 4, date 4, author 4, comment 4
 revision 3, date 3, author 3, comment 3
 revision 2, date 2, author 2, comment 2
 revision 1, date 1, author 1, comment 1

SVN log gives:

revision 8, today's date, today's author, comment = 'Automated keyword replacement'
revision 7, date 5, today's author, comment = 'Automated property set'
revision 6, today's date, author 5, comment 5
revision 5, date 5, author 4, comment 4
revision 4, date 4, author 3, comment 3
revision 3, date 3, author 2, comment 2
revision 2, date 2, author 1, comment 1
revision 1, date 1, author 1, comment 1

Before I start some detailed digging into sccs2svn.py, has anyone come across this problem before?

like image 605
SonyaH Avatar asked Nov 14 '22 22:11

SonyaH


1 Answers

SonyaH posted this in the question, here it is as a cleaned up answer :

There is an off-by-one error in run(). This code:

mergedVersions = [[versions[0]]]
i = 0
while i < len(versions):
    if versions[i].match(mergedVersions[-1][-1]):
        mergedVersions[-1].append(versions[i])
    else:
        mergedVersions.append([versions[i]])
    i += 1

works better if substituted with

mergedVersions = [[versions[0]]]
for v in versions([1:]):
    if v.match(mergedVersions[-1][-1]):
        mergedVersions[-1].append(v)
    else:
        mergedVersions.append([v])

Additionally, the _commit method in the SVNInterface class had a problem. It changes the date on the latest revision number (as known by sccs2svn) then commits that revision. Unfortunately sccs2svn counts its revision numbers from zero, while Subversion counts from 1. So, if you reverse the order of the function calls as follows everything now matches up:

def _commit(self, rev, date, txn, subpool):
    svn_rev = repos.svn_repos_fs_commit_txn(self.repos_ptr, txn, subpool)
    fs.change_rev_prop(self.fsob, svn_rev, core.SVN_PROP_REVISION_DATE,
                       date, subpool)
    return svn_rev
like image 138
Martin Geisler Avatar answered Dec 27 '22 19:12

Martin Geisler