My SVN repository contains several folders for different projects. 'Desktop program', 'iOS app', 'Web app' etc. All revision entries are shared between these (as it's under one repository. Revision #100 might be on the 'iOS app' folder, revision #101 on the 'Web app' folder etc).
我的SVN存储库包含几个用于不同项目的文件夹。“桌面程序”、“iOS应用程序”、“Web应用程序”等等。所有的修订条目都在这两个版本之间共享(因为它位于一个存储库之下)。版本号100可能在“iOS应用程序”文件夹中,版本号101可能在“Web应用程序”文件夹中等等。
What I want is to roll back to an earlier version on just one of these folders. Usually this is done with a 'reverse' SVN Merge as it's SVNs job to keep track of all history, even the bad times. I don't want that however. Lets say I have twenty commits on 'iOS app' since revision #5. I want to rid these from history and I want that specific folder to return to revision #5. No one should ever again be able to check those twenty commits as they 'never happened'. Is this even possible?
我想要回滚到其中一个文件夹的早期版本。通常这是通过“反向”SVN合并完成的,因为这是SVNs工作,可以跟踪所有的历史,甚至是糟糕的时期。但我不想那样。假设自从第5版以来,我在iOS应用上提交了20次。我想把这些从历史中删除,我想要那个特定的文件夹返回到修订版#5。任何人都不应该再检查这20次提交,因为它们“从未发生过”。这是可能吗?
I have two different machines I am interacting to SVN with. A Windows PC with VisualSVN and a Mac with Subversion on Terminal level. I would be thankful for a solution on either.
我有两台不同的机器与SVN交互。带有VisualSVN的Windows PC和在终端级别上具有Subversion的Mac。我将感谢这两个问题的解决方案。
2 个解决方案
#1
2
From client side, there is simply no way to do this. No matter if commandline, Tortoise, or any other client.
从客户端来看,根本没有办法做到这一点。无论命令行、乌龟或任何其他客户。
If you have access to the server account that owns the repository, then there is some chance - but it is quite complicated and may involve a nontrivial manual work.
如果您能够访问拥有存储库的服务器帐户,那么就有可能——但是这是非常复杂的,可能需要大量的手工工作。
Roughly, these are the steps:
大致的步骤如下:
- get the repository UUID -
svn info http://svnserver/svn/repo
- see the UUID line - 获取存储库UUID - svn info http://svnserver/svn/repo——请参阅UUID行
- dump the svn repository:
svnadmin dump /path/to/repo > repo.dump
- 转储svn存储库:svnadmin转储/path/ repo > repo.dump
-
edit the dumpfile to exclude the commits
编辑转储文件以排除提交
a) either open it in
vi
and delete your undesired commitsa)在vi中打开它并删除不需要的提交
b) or use
svndumpfilter
command to filter them by pathb)或使用svndumpfilter命令按路径筛选
-
create new repository and import your modified repository into it:
创建新的存储库并将修改后的存储库导入其中:
svnadmin create /path/to/repo2
/ / repo2 svnadmin创建/路径
svnadmin load < repo.dump
svnadmin负荷< repo.dump
svnadmin setuuid /path/to/repo2 THE_ORIGINAL_UUID
svnadmin setuuid /路径/ / repo2 THE_ORIGINAL_UUID
Now, check that repo2 is working fine and has the content that you expect. If so, you can remove repo
and rename repo2
-> repo
.
现在,检查repo2是否正常工作,并具有您所期望的内容。如果是,您可以删除repo并重命名repo2 -> repo。
Keep in mind that manual changes to the dumpfile are extremely prone to errors, and often these errors can be quite difficult to discover. It is usually bad idea to do things like this.
请记住,手动更改dumpfile非常容易出现错误,而且这些错误通常很难发现。做这样的事通常是个坏主意。
#2
1
What I want is to roll back to an earlier version on just one of these folders. Usually this is done with a 'reverse' SVN Merge
我想要回滚到其中一个文件夹的早期版本。通常这是通过“反向”SVN合并完成的
Terrible... In order to return back part of WC-tree into some previous revision you have to cd SUBTREE-ROOT & svn up -r REVNO
(commit from WC-root for this modified WC will create new revision in repo with partially rollbacked tree)
可怕的……为了将WC-tree的一部分返回到以前的一些修订中,您必须使用cd子树root & svn up -r REVNO(来自WC-root的提交将使用部分回滚树在repo中创建新的修订)
No one should ever again be able to check those twenty commits as they 'never happened'
任何人都不应该再检查这20次提交,因为它们“从未发生过”
Cheated and rewritten history in SCM is BAD IDEA. And Subversion history is immutable, you have to change history using svnadmin tools and access-level, as @petr-kozelka wrote
在SCM中被欺骗和重写历史是一个坏主意。Subversion历史是不可变的,您必须使用svnadmin工具和访问级别来改变历史,就像@petr-kozelka所写的那样。
#1
2
From client side, there is simply no way to do this. No matter if commandline, Tortoise, or any other client.
从客户端来看,根本没有办法做到这一点。无论命令行、乌龟或任何其他客户。
If you have access to the server account that owns the repository, then there is some chance - but it is quite complicated and may involve a nontrivial manual work.
如果您能够访问拥有存储库的服务器帐户,那么就有可能——但是这是非常复杂的,可能需要大量的手工工作。
Roughly, these are the steps:
大致的步骤如下:
- get the repository UUID -
svn info http://svnserver/svn/repo
- see the UUID line - 获取存储库UUID - svn info http://svnserver/svn/repo——请参阅UUID行
- dump the svn repository:
svnadmin dump /path/to/repo > repo.dump
- 转储svn存储库:svnadmin转储/path/ repo > repo.dump
-
edit the dumpfile to exclude the commits
编辑转储文件以排除提交
a) either open it in
vi
and delete your undesired commitsa)在vi中打开它并删除不需要的提交
b) or use
svndumpfilter
command to filter them by pathb)或使用svndumpfilter命令按路径筛选
-
create new repository and import your modified repository into it:
创建新的存储库并将修改后的存储库导入其中:
svnadmin create /path/to/repo2
/ / repo2 svnadmin创建/路径
svnadmin load < repo.dump
svnadmin负荷< repo.dump
svnadmin setuuid /path/to/repo2 THE_ORIGINAL_UUID
svnadmin setuuid /路径/ / repo2 THE_ORIGINAL_UUID
Now, check that repo2 is working fine and has the content that you expect. If so, you can remove repo
and rename repo2
-> repo
.
现在,检查repo2是否正常工作,并具有您所期望的内容。如果是,您可以删除repo并重命名repo2 -> repo。
Keep in mind that manual changes to the dumpfile are extremely prone to errors, and often these errors can be quite difficult to discover. It is usually bad idea to do things like this.
请记住,手动更改dumpfile非常容易出现错误,而且这些错误通常很难发现。做这样的事通常是个坏主意。
#2
1
What I want is to roll back to an earlier version on just one of these folders. Usually this is done with a 'reverse' SVN Merge
我想要回滚到其中一个文件夹的早期版本。通常这是通过“反向”SVN合并完成的
Terrible... In order to return back part of WC-tree into some previous revision you have to cd SUBTREE-ROOT & svn up -r REVNO
(commit from WC-root for this modified WC will create new revision in repo with partially rollbacked tree)
可怕的……为了将WC-tree的一部分返回到以前的一些修订中,您必须使用cd子树root & svn up -r REVNO(来自WC-root的提交将使用部分回滚树在repo中创建新的修订)
No one should ever again be able to check those twenty commits as they 'never happened'
任何人都不应该再检查这20次提交,因为它们“从未发生过”
Cheated and rewritten history in SCM is BAD IDEA. And Subversion history is immutable, you have to change history using svnadmin tools and access-level, as @petr-kozelka wrote
在SCM中被欺骗和重写历史是一个坏主意。Subversion历史是不可变的,您必须使用svnadmin工具和访问级别来改变历史,就像@petr-kozelka所写的那样。