Migrating VCS: Difference between revisions
Created page with "Some notes on migrating between version control systems. '''WORK IN PROGRESS'''. '''To migrate a Bazaar repository to Git''' Source: http://librelist.com/browser/cville/2010..." |
No edit summary |
||
| (9 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
Some notes on migrating between version control systems. '''WORK IN PROGRESS'''. | Some notes on migrating between version control systems. '''WORK IN PROGRESS'''. | ||
===To migrate a Bazaar repository to Git=== | |||
Source: http://librelist.com/browser/cville/2010/2/9/migrate-repository-bzr-to-git/ | Source: http://librelist.com/browser/cville/2010/2/9/migrate-repository-bzr-to-git/ | ||
To convert a bzr repository to git | To convert a bzr repository (<tt>repo-bzr</tt>) to git: | ||
cd repo-bzr | |||
git init && | |||
bzr fast-export `pwd` | git fast-import && | bzr fast-export `pwd` | git fast-import && | ||
rm -r .bzr && | rm -r .bzr && | ||
| Line 24: | Line 25: | ||
git reset HEAD | git reset HEAD | ||
===Try to replay a Git repo into a new Subversion repo=== | |||
Source: http://stackoverflow.com/questions/498110/converting-a-repository-from-git-to-subversion | Source: http://stackoverflow.com/questions/498110/converting-a-repository-from-git-to-subversion | ||
Assume we have a 'bare' Git repository at < | This approach uses [http://www.subgit.com/ SubGit], which is free to use for open source/academic or 'import' applications. | ||
Assume we have a 'bare' Git repository at <tt>/path/to/repo.git</tt>: | |||
svnadmin create svn-repo | svnadmin create svn-repo | ||
| Line 37: | Line 40: | ||
subgit install svn.repo | subgit install svn.repo | ||
This was tested with a 'linear' repository -- no branches in the original bzr repository. | This final step is the one that takes the time -- took about 10 minutes for our repository of ~3000 commits. This process was tested with a 'linear' repository -- no branches in the original bzr repository. The resulting svn repository has several 'tags' but no 'branches', as expected. | ||
=== To recreate a branch in SVN when only the HEAD code from the branch is available === | |||
After a server failure, we lost the revision history of several branches in our repository, but because of working copies on other machines, we still had the HEAD revision code. | |||
To recreate a branch and import this old working-copy code (assumed to be located in <tt>~/oldwc</tt>), you can use the following steps: | |||
svn cp http://example.com/svn/repo/trunk http://example.com/svn/repo/branches/b1 | |||
svn co http://example.com/svn/repo/branches/b1 | |||
cd b1 | |||
rsync -Cva --delete ~/oldwc/ ./ | |||
Then, using a tool such as [http://meldmerge.org/ Meld], open the <tt>b1</tt> directory and any files marked 'missing' can be removed (ie <tt>svn rm</tt>). You can do this easily using Meld, and also quickly review the changes made relative to the trunk code to make sure the <tt>rsync</tt> process worked correctly. Any unversioned files present in the <tt>b1</tt> should also be added (ie <tt>svn add</tt>) since they were present in the <tt>~/oldwc</tt> working copy and should now be included in the new <tt>b1</tt> branch. | |||
Once the new files are added and missing files removed, you can complete the process using\ | |||
svn ci | |||
And make a comment to record what has been done. | |||
[[Category:Miscellany]] | |||
Latest revision as of 01:52, 5 March 2015
Some notes on migrating between version control systems. WORK IN PROGRESS.
To migrate a Bazaar repository to Git
Source: http://librelist.com/browser/cville/2010/2/9/migrate-repository-bzr-to-git/
To convert a bzr repository (repo-bzr) to git:
cd repo-bzr git init && bzr fast-export `pwd` | git fast-import && rm -r .bzr && git reset HEAD
This will take your current working directory, build git history, and destroy bzr history. Do not run this on any important bzr branch, as it will get eaten.
But I wanted a 'bare' repository, for future reasons:
cp -R repo-bzr repo.git cd repo.git git init --base bzr fast-export `pwd` | git fast-import rm -r .bzr git reset HEAD
Try to replay a Git repo into a new Subversion repo
Source: http://stackoverflow.com/questions/498110/converting-a-repository-from-git-to-subversion
This approach uses SubGit, which is free to use for open source/academic or 'import' applications.
Assume we have a 'bare' Git repository at /path/to/repo.git:
svnadmin create svn-repo subgit configure svn-repo
Edit the svn.repo/conf/subgit.conf file and in section [git "default"], adjust the repository to give repository = /path/to/repo.git. Then,
subgit install svn.repo
This final step is the one that takes the time -- took about 10 minutes for our repository of ~3000 commits. This process was tested with a 'linear' repository -- no branches in the original bzr repository. The resulting svn repository has several 'tags' but no 'branches', as expected.
To recreate a branch in SVN when only the HEAD code from the branch is available
After a server failure, we lost the revision history of several branches in our repository, but because of working copies on other machines, we still had the HEAD revision code.
To recreate a branch and import this old working-copy code (assumed to be located in ~/oldwc), you can use the following steps:
svn cp http://example.com/svn/repo/trunk http://example.com/svn/repo/branches/b1 svn co http://example.com/svn/repo/branches/b1 cd b1 rsync -Cva --delete ~/oldwc/ ./
Then, using a tool such as Meld, open the b1 directory and any files marked 'missing' can be removed (ie svn rm). You can do this easily using Meld, and also quickly review the changes made relative to the trunk code to make sure the rsync process worked correctly. Any unversioned files present in the b1 should also be added (ie svn add) since they were present in the ~/oldwc working copy and should now be included in the new b1 branch.
Once the new files are added and missing files removed, you can complete the process using\
svn ci
And make a comment to record what has been done.