Download revision from SVN repo which has been converted to Git

151 views Asked by At

I have to download a particular version of software (Moses) to run another piece of software.

The install script attempts to run

svn co https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk moses -r 3284

However Moses has converted its repository to Git.

Whilst hoping that revision numbers have been preserved (otherwise I'm quite screwed), what would be the equivalent Git command to download this version? Moses is now hosted on GibHub https://github.com/moses-smt/mosesdecoder.

I attempted to see documentation for Git but I see there's a good learning curve since it's quite different from SVN (of which I have good knowledge). I just need to download the particular revision only from Git.

1

There are 1 answers

0
qqx On

Since that repository was converted with git-svn, and has the git-svn-id lines in the logs, you can use those to identify the git commit which matches up with that svn revision number. You should be able to checkout that commit using:

git clone https://github.com/moses-smt/mosesdecoder.git
cd mosesdecoder
git checkout -b mybranch ':/git-svn-id.*@3284 '

That will create a new branch named mybranch (I'd advise choosing a more descriptive name) which matches that svn revision and then check that branch out into your working tree. This works because :/ is a way to specify the newest commit where the log message matches the following regular expression.

The git-revparse man page has information on this and other ways to specify git commits.