Я думал о переписывании истории в моем хранилище Subversion, но Subversion в данный момент не очень хороша в этом.Одним из вариантов может быть преобразование в Git (что, как я понимаю, в этом смысле значительно лучше), переписывание и последующее преобразование в Subversion.Что, если вообще что-то может потеряться в таком переводе (кроме частей истории, которые предполагается потеряться)?
И на всякий случай, если кому-то захочется предложитьПредположение, что я просто переключусь на Git навсегда, ответ: нет, я не хочу этого делать: -)
Код, который я использовал, следует ниже.Это зависит от установки $ REPO_SVN AND $ REPO_SVN_CLONE в набор репозиториев Subversion, один с исходным и один (почти) пустой репозиторий для хранения клона.(Основано на статье кода Google об импорте из Git ):
# Create first git repository, containing all my data
git svn clone $REPO_SVN RepoGitA
# Create a svn repository to hold the end product
# It must hold one revision, according to Google Code
# svn propset svn:git:svn 1 WCSvnOut
# svnadmin create RepoSvnOut
# svn co file://`pwd`/RepoSvnOut WCSvnOut
# echo "placeholder" > WCSvnOut/placeholder.txt
# svn add WCSvnOut/placeholder.txt
# svn ci -m "Initial commit of svn-git-svn roundtrip" WCSvnOut
# Create second git repository, connected to the new svn repo
# git svn clone file://`pwd`/RepoSvnOut RepoGitB
git svn clone $REPO_SVN_CLONE RepoGitB
# FROM NOW ON, WORK HAPPENS IN THE SECOND GIT REPOSITORY
cd RepoGitB
# Fetch all the data from the first git repository
git fetch ../RepoGitA
# Create a temporary branch for the fetched repository, and tag its head
git branch tmp $(cut -b-40 .git/FETCH_HEAD)
git tag -a -m "Last fetch" last tmp
# Apply initial commit
# Unfortunately, Git treats the initial commit specially,
# and in particular, cannot rebase it. Work around this as follows:
INIT_COMMIT=$(git log tmp --pretty=format:%H | tail -1)
git checkout $INIT_COMMIT .
git commit -C $INIT_COMMIT
# Rebase:
# Apply all the other commits to the temporary branch,
# and make it the new master branch:
git rebase master tmp
git branch -M tmp master
# Here I could do some more work to rewrite the repo history
# Lastly, commit the changes to the fresh svn repo
git svn dcommit