SVN备忘
拉取部分子目录
- 使用
TortoiseSvn
,Check Out
时,选择only this item
,此时只拉取空目录 - 在目录右键选择
Repo-browser
,浏览代码库,选择想要拉取的目录,右键选择Update item to revision
即可.
本地目录服务 (Windows)
参考
Item is not readable
- Infamous "Item is not readable" for svn log (google.com)
- svn报错Item is not readable svn解决方案 - kerala - 博客园 (cnblogs.com)
- Tony Jewell: svn: E220001: Item is not readable
安装TortoiseSvn
scoop install tortoisesvn
创建svn项目目录
cd E:/Svn
svnadmin create E:/Svn/Material
❯ tree .
Folder PATH listing for volume gagoo
Volume serial number is 0000009C 425C:F9F2
E:\SVN
└───Material
├───conf
├───db
│ ├───revprops
│ │ └───0
│ ├───revs
│ │ └───0
│ ├───transactions
│ └───txn-protorevs
├───hooks
└───locks
修改conf/svnserve.conf
anon-access = read
auth-access = write
password-db = passwd
authz-db = authz
realm = Material
修改conf/passwd
xkyii=123456
修改conf/authz
[/]
xkyii=rw
本地服务
file:///E:/Repo
启动 (svn服务)
svnserve -d -r E:/Repo
- 加入到
$profile
notepad $profile
Function svn_m {
svnserve.exe -d -r E:\Repo\
}
- 或者使用链接(需要管理员权限)
cd $env:USERPROFILE
cmd
mklink Microsoft.PowerShell_profile.ps1 D:\Code\xkyss\xkyss.script\powershell\dev88\Microsoft.PowerShell_profile.ps1
查看
svn list svn://localhost/Material
❯ svn list svn://localhost/Material
Authentication realm: <svn://localhost:3690> Material
Password for 'dev88': ******
之后可以用svn客户端对svn://localhost/Material
迁出操作了
git svn
命令(svn://
):
mkdir proj
cd proj
# 主分支
git svn init --trunk=trunk/proj1 --prefix=svn/ svn://localhost/aaa
git svn fetch
# develop分支
git config --add svn-remote.svn/develop.url svn://localhost/aaa
git config --add svn-remote.svn/develop.fetch branches/develop/proj1:refs/remotes/svn/develop
git svn fetch svn/develop
# 新建分支本地分支develop, 拉取svn/develop
git checkout -b develop svn/develop
# 切换分支 (main主分支已经存在)
git checkout main
- .git/config文件
[svn-remote "svn"]
url = svn://localhost/aaa
fetch = trunk/proj1:refs/remotes/svn/trunk
[svn-remote "svn/develop"]
url = svn://localhost/aaa
fetch = branches/develop/proj1:refs/remotes/svn/develop
命令(file:///
)
mkdir proj
cd proj
# 主分支
git svn init --trunk=trunk/proj1 --prefix=svn/ file:///D/Test/aaa
git svn fetch
# develop分支
git config --add svn-remote.svn/develop.url file:///D/Test/aaa
git config --add svn-remote.svn/develop.fetch branches/develop/proj1:refs/remotes/svn/develop
git svn fetch svn/develop
# 新建分支本地分支develop, 拉取svn/develop
git checkout -b develop svn/develop
# 切换分支 (main主分支已经存在)
git checkout main
- .git/config文件
[svn-remote "svn"]
url = file:///D/Test/aaa
fetch = trunk/proj1:refs/remotes/svn/trunk
[svn-remote "svn/develop"]
url = file:///D/Test/aaa
fetch = branches/develop/proj1:refs/remotes/svn/develop
MaCard
mkdir CaCard
cd MaCard
# 以svn地址初始化git仓库
git svn init --trunk=trunk/xkyii/MaCard --prefix=svn/ file:///E/Repo/Code
# 拉取主分支代码
git svn fetch
# 添加git远程地址
git remote add origin https://github.com/xkyii/MaCard.git
# git remote -v
# 拉取git地址的main分支代码
git fetch origin main
# 合并代码,以origin为主
git merge -Xtheirs -m "Merge to svn" --allow-unrelated-histories origin/main
# 提交到svn
git svn dcommit
## 添加svn develop分支信息
git config --add svn-remote.svn/develop.url file:///E/Repo/Code
git config --add svn-remote.svn/develop.fetch branches/develop/xkyii/MaCard:refs/remotes/svn/develop
# 拉取svn/develop代码
git svn fetch svn/develop
# 以svn/develop创建并切换本地分支
git checkout -b develop svn/develop
# 拉取origin/develop分支代码
git fetch origin develop
# 合并代码,以origin为主
git merge -Xtheirs -m "Merge to svn" --allow-unrelated-histories origin/develop
# 提交到svn
git svn dcommit