svn-all-fast-export / svn2git

:octopus: A fast-import based converter for an svn repo to git repos
GNU General Public License v3.0
262 stars 100 forks source link

Does here any plan to support incremental convert? #124

Open conhaifeng opened 3 years ago

conhaifeng commented 3 years ago

I have a large svn repo, many projects, and most of projects each contains 1W+ revisions. when converting, maybe someone commit new code, how to convert these new code to git? does here any plan to support incremental convert? I know git-svn support it by command "git svn fetch", but it's too slow, so i prefer svn2git. hope so, thanks.

eeijlar commented 3 years ago

I converted a svn repo with over 500k commits, and 20 years of history. I did this by doing one large big bang convert from svn to git. This meant that I had a live svn and a repaired copy ( in some cases history had been corrupted and > 50GB files had been checked in) of it, which I kept up to date prior to migrating a project. I did the conversion one project at a time, and svn remained live throughout the migration.

svnadmin is useful here, here is the snippet I used to take the latest changes:


function updateMasterRepo() {
    latestCommit=`svn info -r HEAD file:///${svnMasterRepo}/ | grep Revision | awk '{print $2}'`
    latestCommitFromSvn=`svn info -r HEAD svn://svn.company.lan/svn/product | grep Revision | awk '{print $2}'`

    if [ "$latestCommit" -eq "$latestCommitFromSvn" ]; then
       echo "Repos are in sync ... skipping incr"
    else 
    echo "Incrementing commit number by 1 commit from rev: ${latestCommit}"
    latestCommit=`expr $latestCommit + 1`
    echo "New rev: ${latestCommit}"
    read -p "Starting dump with commit [REV: ${latestCommit}] - Proceed? [y/n] " -n 1 -r
    echo "" 
        if [[ $REPLY =~ ^[Yy]$ ]]; then
        $debug $svncmd dump $pathToSvn --incremental -r${latestCommit}:HEAD > "$pathToTemp/product_r${latestCommit}_HEAD.dmp"
        $debug svnadmin load --bypass-prop-validation $svnMasterRepo < "$pathToTemp/product_r${latestCommit}_HEAD.dmp"
        notice "$latestCommit:HEAD loaded to master repository [$svnMasterRepo]"
        notice "Done!"
         else
                notice ""
            notice "Exiting..."
        fi
    fi
}