Subversion:从云 SVN 存储库迁移到本地 SVN 存储库...丢失历史记录?

发布于 2024-08-20 18:47:56 字数 4055 浏览 0 评论 0原文

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

svnsync init DEST SRC
svnsync sync DEST
svnsync checkout DEST

结帐成功,我从原始 SVN 存储库中获取了所有文件,这绝对是一件好事!

但是当我这样做时:

svn log

我收到的只是消息:

svn: Item is not readable

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

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

我按照我认为最好的说明进行操作我可以...


ps 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)

I created my own SVN repo locally. Then used:

svnsync init DEST SRC
svnsync sync DEST
svnsync checkout DEST

The checkout worked successfully and I got all the files from the original SVN repo and that is definitely a good thing!

But when I did:

svn log

All I get is the message:

svn: Item is not readable

Does the file not have any history?

Did I migrate the SVN repo incorrectly?

I followed the instructions I found as best as I could...


p.s. FWIW here is the commands I executed in the form of a bash shell script:

#!/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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

作死小能手 2024-08-27 18:47:56

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

无论如何,它可以通过更改“svnserve.conf”文件中的行来修复:

[general]
anon-access = none

另一种解决方案仅更改“auzh”文件中的行:

[/]
* = r

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

for SVN log trouble: You have bad configuration (or Subversion has a bug:)).

Anyway it can be fixed by changing in "svnserve.conf" file the line:

[general]
anon-access = none

Another solution to change only "auzh" file the line:

[/]
* = r

That solution is given anonymous reads your repository that is not good.
If you need to use only authorization repository than use the first solution. (was tested with svn 1.6.17, but think it does not depend from version)

冷了相思 2024-08-27 18:47:56

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

Did you set up/migrate the permission settings?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文