“未找到文件"在 Subversion 中恢复已删除的目录时

问题描述:

我想将我的项目回滚到更早的阶段,所以我尝试了这个:

I wanted to roll back my project to an earlier stage, so I tried this:

svn rm -m "clear out mistakes rolling back" ^/MyProject/trunk
svn copy -m "roll back" -r 165 ^/MyProject/trunk ^/MyProject/trunk

但我一直收到错误找不到文件:修订版 265,路径 '/MyProject/trunk'".265 是 HEAD,但我不知道为什么它会在现有修订中寻找目标目录,而不是简单地创建它.

But I kept getting the error "File not found: revision 265, path '/MyProject/trunk'". 265 is HEAD, but I don't know why it would be looking for the target directory in an existing revision, rather than simply creating it.

显然问题出在 ^ 符号上,因为使用完整的 URL 可以正常工作:

Apparently the problem was with the ^ notation, because using complete URLs worked OK:

svn copy -m "roll back" <full URL>/MyProject/trunk@165 <full URL>/MyProject/trunk

但我最近使用 ^ 符号通过类似的复制操作创建了一个分支.(客户端是命令行 svn 1.6.17.)那么,为什么在这种情况下它不起作用?

But I've used the ^ notation recently to make a branch via a similar copy operation. (The client is command-line svn 1.6.17.) So, why did it not work in this case?

我认为问题在于-r"和@rev":它们的含义不同.

I think the problem is with "-r " and "@rev": they have different meaning.

-r rev <path> --- 操作修订 --- 表示 @HEAD 处于修订版rev"的状态(例如,如果 @HEAD 不存在,则命令失败;如果它是从修订版 > rev 中的某个路径 2 替换/复制的,则状态为 path2@rev)

-r rev <path> --- operative revision --- means the state in which was @HEAD was at revision "rev" (e.g. if @HEAD doesn't exist the command fails; if it was replaced/copied from some path2 in revision > rev, then the state is path2@rev)

path@rev ---peg revision --- 表示路径的状态正好在修订版上(那么路径是否存在于 HEAD 并不重要,即使 path@HEAD 是由path2替换,状态为path@rev).

path@rev ---peg revision --- means the state of path exactly at revision rev (then it doesn't matter if path exists at HEAD, and even if path@HEAD is replaced from path2, the state is path@rev).

在此处查看更多信息 http://svnbook.red-bean.com/en/1.6/svn.advanced.pegrevs.html