Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does here any plan to support incremental convert? #124

Open
conhaifeng opened this issue May 21, 2021 · 1 comment
Open

Does here any plan to support incremental convert? #124

conhaifeng opened this issue May 21, 2021 · 1 comment

Comments

@conhaifeng
Copy link

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
Copy link

eeijlar commented May 31, 2021

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
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants