[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] Converting a proprietary svn repository to git
From: |
Greg Chicares |
Subject: |
Re: [lmi] Converting a proprietary svn repository to git |
Date: |
Mon, 29 Feb 2016 16:58:42 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0 |
On 2016-02-26 02:01, Vadim Zeitlin wrote:
[...]
> The next step would be to "git push --all" to some bare repository and
> then clone it from somewhere else and verify that everything looks good.
Please help me understand an obstacle that I encountered when trying that.
For clarity and reproducibility, I've put the whole process in a script [0].
It works correctly on GNU/Linux, but fails on Cygwin (versions below[1]).
On GNU/Linux, right after the 'git svn clone' step, branches are thus:
git branch -r
trunk
git branch -a
* master
remotes/trunk
and pushing to a bare repository succeeds.
However, on Cygwin, at the same point branches are instead thus:
$git branch -r
origin/trunk
$git branch -a
* master
remotes/origin/trunk
Then attempting to rename the 'trunk' branch fails:
git branch -m trunk master
error: refname refs/heads/trunk not found
fatal: Branch rename failed
and cloning from the bare repository fails:
git clone file:///tmp/migration/temporary-bare
Cloning into 'temporary-bare'...
warning: remote HEAD refers to nonexistent ref, unable to checkout.
I think I've found the point where it fails, but why is 'origin/'
prepended to 'trunk' on Cygwin, and what's the right way to fix it?
---------
[0] "put the whole process in a script"
Largely adapted from:
http://john.albin.net/git/convert-subversion-to-git
--------------------------8<-----------------------------
#!/bin/bash
# migrate a particular svn repository to git
set -v
# edit the next line to set insurer's domain
export CompanyDomain="REDACTED.com"
[ "example.com" != "$CompanyDomain" ] || { echo "YOU WERE SUPPOSED TO CUSTOMIZE
THAT"; exit 8; }
# make sure the svn tarball is in /tmp
[ -f "/tmp/repository-20160212T2239Z.tar.bz2" ] || { echo "SVN TARBALL NOT
FOUND"; exit 9; }
# do everything in a fresh subdir of /tmp just to see if it all works
rm -rf /tmp/migration
mkdir --parents /tmp/migration
cd /tmp/migration
# unpack svn tarball and verify it
tar -xjvf /tmp/repository-20160212T2239Z.tar.bz2
svnadmin verify repository
# check out an svn working copy...
mkdir --parents svn_working_copy
pushd svn_working_copy
svn checkout \
file:///tmp/migration/repository
popd
# ...for the sole purpose of extracting authors
pushd svn_working_copy/repository
svn log --xml \
| grep author | sort -u \
| sed -e "s/^[^>]*>\([^<]*\)<[^<]*$/\1 = \1 <address@hidden>/" \
>/tmp/migration/authors.txt
popd
# create a transitional git clone of the svn repository
# [GNU/Linux: 2 min; msw-xp: 41 min]
git svn clone \
file:///tmp/migration/repository \
--authors-file=/tmp/migration/authors.txt --no-metadata --trunk=/
./transitional
# list remote branches, and all branches
pushd /tmp/migration/transitional
git branch -r
git branch -a
popd
### The next step would be to "git push --all" to some bare repository and
### then clone it from somewhere else and verify that everything looks good.
# create new bare repository
git init --bare ./temporary-bare
pushd temporary-bare
git symbolic-ref HEAD refs/heads/trunk
popd
# push to bare repository
pushd /tmp/migration/transitional
git remote add bare /tmp/migration/temporary-bare
git config remote.bare.push 'refs/remotes/*:refs/heads/*'
git push bare
popd
# rename 'trunk' to 'master'
pushd /tmp/migration/temporary-bare
git branch -m trunk master
popd
# clone from bare repository
mkdir --parents migrated
pushd migrated
git clone file:///tmp/migration/temporary-bare
popd
--------------------------8<-----------------------------
[1] "versions below":
$uname -a
Linux turgon 3.2.0-4-amd64 #1 SMP Debian 3.2.73-2+deb7u2 x86_64 GNU/Linux
$git --version
git version 1.7.10.4
$svn --version |head -1
svn, version 1.6.17 (r1128011)
$uname -a
CYGWIN_NT-5.1 iluvatar 2.4.1(0.293/5/3) 2016-01-24 11:24 i686 Cygwin
$git --version
git version 2.7.0
$svn --version |head -1
svn, version 1.9.3 (r1718519)
- [lmi] Converting a proprietary svn repository to git, Greg Chicares, 2016/02/25
- Re: [lmi] Converting a proprietary svn repository to git, Vadim Zeitlin, 2016/02/25
- Re: [lmi] Converting a proprietary svn repository to git, Greg Chicares, 2016/02/26
- Re: [lmi] Converting a proprietary svn repository to git, Greg Chicares, 2016/02/26
- Re: [lmi] Converting a proprietary svn repository to git, Vadim Zeitlin, 2016/02/27
- Re: [lmi] Converting a proprietary svn repository to git, Greg Chicares, 2016/02/27
- Re: [lmi] Converting a proprietary svn repository to git, Vadim Zeitlin, 2016/02/27
- Re: [lmi] Converting a proprietary svn repository to git, Greg Chicares, 2016/02/27
Re: [lmi] Converting a proprietary svn repository to git,
Greg Chicares <=
Re: [lmi] Converting a proprietary svn repository to git, Greg Chicares, 2016/02/29