Mark Rutz wrote on Mon, 01 Feb 2021 19:21 +00:00:
> Does anyone have procedures or tools for converting Micro Focus 
> StarTeam repositories to Subversion?  We would like to convert the main 
> branch with history for each repository.

For converting a single branch from any external VCS, the fallback
strategy (if no preëxisting tool is available) is a plain old "checkout
each commit in the history in sequence and re-commit it" loop.  I hope
you won't need to resort to it in your case, but I don't think we have a
write-up of it, so I'll outline it here.

The basic idea is (using svn syntax for both the old and new
VCS's, since that's the only syntax everyone on this list is
guaranteed to speak):

% mkdir wc
% $oldvcs checkout -r0 $oldURL wc
% svnadmin create foo
% printf '#!/bin/sh\ntrue\n' > foo/hooks/pre-revprop-change
% chmod +x foo/hooks/pre-revprop-change
% svn co file://$PWD/foo wc --force # --force suppresses a "Directory not 
empty" error
% cd wc
% # At this point, wc/ is a working copy of both $oldvcs and svn, both of them 
at r0 (an empty tree).
% i=0
% while [ $i -le `$oldvcs info --show-item=revision ./` ]; do
    svn cleanup && # purge pristines
    $oldvcs up -r $((++i)) &&
    svn-addremove &&
    svn revert -R ./.$oldvcs &&
    svn ci -m "Re-committing r$i" &&
    for propname in svn:date svn:author ; do svn ps --revprop -r $i -- 
$propname "$($oldvcs pg --revprop -r $i -- $propname)" ; done
done
% 

where svn-addremove(1) should be a script that does «svn add»
for all files that are '?' in `svn status` (= unversioned) and «svn rm»
for all files that are '!' in `svn status` (= missing), like the
eponymous hg(1) subcommand.  There's an implementation in
https://svn.apache.org/repos/asf/subversion/branches/addremove, but I
don't know its status, and in any case it may be easier to find a script
implementation or write one.

There is no requirement to use file:// syntax; I only did that to make
the example self-contained.

Cheers,

Daniel

Reply via email to