简体   繁体   English

如何撤消'svn copy'

[英]How to undo an 'svn copy'

I've accidentally overwritten an old branch by copying trunk over it using 'svn copy'. 我不小心通过使用'svn copy'复制trunk来覆盖旧分支。 More specifically, for every release, trunk is branched and kept as a tag, using: 更具体地说,对于每个版本,主干都是分支的并保留为标签,使用:

svn copy svn://machine/REPOS/trunk svn://machine/REPOS/tags/$RELEASENR

But this time the value of 'RELEASENR' was that of an old existing branch instead of a new one. 但这次'RELEASENR'的价值是旧的现有分支而不是新分支的价值。 Anybody have any ideas on how to undo this mistake? 有人对如何撤消这个错误有任何想法吗? Thanks already! 谢谢!

Subversion doesn't work that way. Subversion无法正常工作。 You haven't actually overwritten it. 你还没有真正覆盖它。 If the target of the copy or a move exists and is a directory, then the copied or moved item is placed in that directory: 如果复制的目标或移动存在且是一个目录,然后复制或移动的项目被放置该目录

svn copy svn://machine/REPOS/trunk svn://machine/REPOS/tags/EXISTS_ALREADY

If you look, you should find: 如果你看,你应该找到:

svn://machine/REPOS/tags/EXISTS_ALREADY/trunk 

Which is a copy of the trunk you just tried to tag. 这是您刚尝试标记的主干的副本。 The fix in this case is easy: 在这种情况下修复很容易:

svn mv svn://machine/REPOS/tags/EXISTS_ALREADY/trunk \
       svn://machine/REPOS/tags/CORRECT_TAG_NAME

(In case you're not *nix conversant: The \\ means I've broken one logical line into two physical lines to spare your horizontal scrollbar from overwork.) (如果你不是* nix熟悉的话:\\意味着我已经将一条逻辑线分成两条物理线,以免水平滚动条过度工作。)

In order to undo 为了撤消

svn cp OLDFOLDER NEWFOLDER

if the change has not yet been committed, just use 如果尚未提交更改,请使用

svn revert NEWFOLDER --depth=infinity

You can undo your last revision by merging back to the previous revision. 您可以通过合并回上一版本来撤消上一版本。 See http://anilsaldhana.blogspot.com/2007/11/svn-undo-change.html 请参见http://anilsaldhana.blogspot.com/2007/11/svn-undo-change.html

svn merge --revision 92:91 .

and then commit 然后提交

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM