Subversion:从云SVN repo迁移到本地SVN repo ...丢失了历史记录?

时间:2010-02-08 04:05:55

标签: svn version-control migration

我在本地创建了自己的SVN repo。然后使用:

svnsync init DEST SRC
svnsync sync DEST
svnsync checkout DEST

结帐工作成功,我从原来的SVN回购获得了所有文件,这绝对是件好事!

但是当我这样做的时候:

svn log

我得到的只是信息:

svn: Item is not readable

该文件没有任何历史记录吗?

我是否错误地迁移了SVN仓库?

我遵循了尽可能最好的指示......


P.S。这里的FWIW是我以bash shell脚本的形式执行的命令:

#!/bin/bash
#===============================================================================
#= Function: Script to migrate an old svn repository to a new svn repository
#= Purpose:  The process is kinda tricky... need to write it down to prevent 
#=           reinventing the wheel
#===============================================================================

# User input parameters for this script
DEFAULT_REPO_PATH = "srv/svn/repos";
NEW_REPO_NAME = "name";
SRC_REPOSITORY_URL = "https://example.googlecode.com/svn";

# Create the folder for all your svn repositories before creating the repository
sudo mkdir --parents /$(DEFAULT_REPO_PATH)/$(NEW_REPO_NAME)/

# Create the new repository
sudo svnadmin create /$(DEFAULT_REPO_PATH)/$(NEW_REPO_NAME)/

# -- The new repository is not ready for receiving the old repository.
# -- There are a number of actions that need to be completed before you can 
#    load the old repository onto the new repository.

# 1.) Setup the pre-revprop-change hook
cd /$(DEFAULT_REPO_PATH)/$(NEW_REPO_NAME)/hooks/
sudo touch pre-revprop-change
sudo chmod +x pre-revprop-change

# 2.) Eventually we are calling svnsync init $(SRC_URL) $(SRC_URL) but 
#     the new repository is not accessible via any URL because there is 
#     no server setup 
#     
#     Example URLS:
#     -- svn://$(SERVER)/$(SRC_REPO_NAME)
#     -- ssh+svn://$(SERVER)/$(SRC_REPO_NAME)
#     -- https://$(SERVER)/$(SRC_REPO_NAME)
#
#     To make the new repository accesible via URL I will setup an svn 
#     server using the built in "svnserve" command.
#
#     Svnserve command line switches:
#     -d, --daemon
#         Causes svnserve to  run  in  daemon  mode.   svnserve  backgrounds
#         itself  and  accepts and serves TCP/IP connections on the svn port
#         (3690, by default).
#     -r root, --root=root
#         Sets the virtual root for repositories served  by  svnserve.   The
#         pathname  in URLs provided by the client will be interpreted rela‐
#         tive to this root, and will not be allowed to escape this root.
svnserve -d -r /$(DEFAULT_REPO_PATH)/

# 3.) Almost ready, the last step is to give write permission to the new repository
#    
#     By default a new repository is read only.
#
#   3.1) To give write permission you have to edit both the 
#   3.2) "svnserve.conf" and 
#   3.3) "passwd" file
#     /$(DEFAULT_REPO_PATH)/$(NEW_REPO_NAME)/conf/svnserve.conf file
sudo vim /$(DEFAULT_REPO_PATH)/$(NEW_REPO_NAME)/conf/svnserve.conf
#   3.4) uncomment: "anon-access = read"
#   3.5) uncomment: "auth-access = write"
#   3.6) uncomment: "authz-db = authz"
sudo vim /$(DEFAULT_REPO_PATH)/$(NEW_REPO_NAME)/conf/passwd
#   3.9) add a line for the new authorized user
#        "
#        $(USER1) = $(USER1_PASSWD)
#        "
#   3.10) add a line for the authorization permissions 
#         (groups... like anonymous or authorized get... or set up 
#         specific permissions for specific users or groups)
#         "
#         [/]
#         $authenticated = rw 
#         "
#   3.11) You have to enable the new svnserve settings by restarting the svn 
#         server. To do this you "kill" the svn server.
sudo kill $(PID_OF_SVNSERVE)
#   3.12) Restart the svn server by calling svnserve again
svnserve -d -r /$(DEFAULT_REPO_PATH)/

# 4.) Synchronize the new repository with the old repository
# NOTE: It took about 0.5 seconds for each revision... I only had about 
sudo svnsync init svn://$(DEFAULT_REPO_PATH)/$(NEW_REPO_NAME) $(SRC_REPOSITORY_URL)
sudo svnsync sync svn://$(DEFAULT_REPO_PATH)/$(NEW_REPO_NAME)

2 个答案:

答案 0 :(得分:2)

对于SVN日志问题:您的配置错误(或Subversion有错误:))。

无论如何,可以通过在“svnserve.conf”文件中更改行:

来修复它
[general]
anon-access = none

另一种解决方案只改变“auzh”文件行:

[/]
* = r

该解决方案被匿名读取您的存储库并不好。 如果您只需要使用授权存储库而不是使用第一个解决方案。 (用svn 1.6.17测试过,但认为它不依赖于版本)

答案 1 :(得分:1)

您是否设置/迁移了权限设置?