Manually deleting only the latest revision from online SVN repository?

泪湿孤枕 提交于 2019-12-25 02:00:32

问题


In doing this: 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?, but I hoped there was an easier solution.

So I tried this test:

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.

Now, if I just delete the corresponding files to the latest revision (3) in db/revs and db/revprops, I get this:

$ 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

After some grepping it turns out there are files ./db/txn-current and ./db/current with content '3', so I try to change that:

$ echo 2 > ./db/current
$ echo 2 > ./db/txn-current

$ svnadmin verify .
* Verified revision 0.
* Verified revision 1.
* Verified revision 2.

... and also svn co file:///tmp/newRepo newRepo-checkout2 seems to work as well.

So my question is - is this reasonably safe, or is there more to it regarding the storage of a revision in SVN server?


回答1:


No. Manually editing the repository database files is never "reasonably safe". It is much safer, and probably in the end much easier, just to do the dump/filter/load using svn tools.



来源:https://stackoverflow.com/questions/29043797/manually-deleting-only-the-latest-revision-from-online-svn-repository

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!