仅从在线 SVN 存储库中手动删除最新版本?
Manually deleting only the latest revision from online SVN repository?
这样做:git svn dcommit committing wrong file?, now I have one - the latest - revision on the SVN server-side repository wrong; I'd like to delete it. I am aware I could do svnadmin dump/filter/load as per How do I fix a repository with one broken revision?,但我希望有一个更简单的解决方案。
所以我尝试了这个测试:
cd /tmp
svnadmin create newRepo
svn co file:///tmp/newRepo newRepo-checkout
# Checked out revision 0.
cd newRepo-checkout/
echo aaa > AA.txt
svn add AA.txt
# A AA.txt
svn ci -m 'first commit'
# Adding AA.txt
# Transmitting file data .
# Committed revision 1.
echo bbb > BB.txt
svn ci -m '2ns commit'
svn add BB.txt
# A BB.txt
svn ci -m '2nd commit'
# Adding BB.txt
# Transmitting file data .
# Committed revision 2.
echo ccc > CC.txt
svn add CC.txt
# A CC.txt
svn ci -m '3rd commit'
# Adding CC.txt
# Transmitting file data .
# Committed revision 3.
现在,如果我只删除 db/revs 和 db/revprops 中最新修订版 (3) 的相应文件,我会得到:
$ cd ../newRepo
$ svnadmin verify .
* Verified revision 0.
* Verified revision 1.
* Verified revision 2.
* Verified revision 3.
$ ls db/revprops/0/
0 1 2 3
$ ls db/revs/0/
0 1 2 3
$ rm db/revs/0/3
$ rm db/revprops/0/3
$ svnadmin verify .
* Verified revision 0.
* Verified revision 1.
* Verified revision 2.
svnadmin: No such revision 3
经过一些 grepping 后发现有文件 ./db/txn-current
和 ./db/current
的内容为“3”,所以我尝试更改它:
$ echo 2 > ./db/current
$ echo 2 > ./db/txn-current
$ svnadmin verify .
* Verified revision 0.
* Verified revision 1.
* Verified revision 2.
... 而且 svn co file:///tmp/newRepo newRepo-checkout2
似乎也有效。
所以我的问题是 - 这是否相当安全,或者是否有更多关于在 SVN 服务器中存储修订的信息?
没有。手动编辑存储库数据库文件永远不会 "reasonably safe"。使用 svn 工具 dump/filter/load 更安全,而且最终可能更容易。
这样做:git svn dcommit committing wrong file?, now I have one - the latest - revision on the SVN server-side repository wrong; I'd like to delete it. I am aware I could do svnadmin dump/filter/load as per How do I fix a repository with one broken revision?,但我希望有一个更简单的解决方案。
所以我尝试了这个测试:
cd /tmp
svnadmin create newRepo
svn co file:///tmp/newRepo newRepo-checkout
# Checked out revision 0.
cd newRepo-checkout/
echo aaa > AA.txt
svn add AA.txt
# A AA.txt
svn ci -m 'first commit'
# Adding AA.txt
# Transmitting file data .
# Committed revision 1.
echo bbb > BB.txt
svn ci -m '2ns commit'
svn add BB.txt
# A BB.txt
svn ci -m '2nd commit'
# Adding BB.txt
# Transmitting file data .
# Committed revision 2.
echo ccc > CC.txt
svn add CC.txt
# A CC.txt
svn ci -m '3rd commit'
# Adding CC.txt
# Transmitting file data .
# Committed revision 3.
现在,如果我只删除 db/revs 和 db/revprops 中最新修订版 (3) 的相应文件,我会得到:
$ cd ../newRepo
$ svnadmin verify .
* Verified revision 0.
* Verified revision 1.
* Verified revision 2.
* Verified revision 3.
$ ls db/revprops/0/
0 1 2 3
$ ls db/revs/0/
0 1 2 3
$ rm db/revs/0/3
$ rm db/revprops/0/3
$ svnadmin verify .
* Verified revision 0.
* Verified revision 1.
* Verified revision 2.
svnadmin: No such revision 3
经过一些 grepping 后发现有文件 ./db/txn-current
和 ./db/current
的内容为“3”,所以我尝试更改它:
$ echo 2 > ./db/current
$ echo 2 > ./db/txn-current
$ svnadmin verify .
* Verified revision 0.
* Verified revision 1.
* Verified revision 2.
... 而且 svn co file:///tmp/newRepo newRepo-checkout2
似乎也有效。
所以我的问题是 - 这是否相当安全,或者是否有更多关于在 SVN 服务器中存储修订的信息?
没有。手动编辑存储库数据库文件永远不会 "reasonably safe"。使用 svn 工具 dump/filter/load 更安全,而且最终可能更容易。