本地删除文件后跟svn update会恢复该文件的本地副本。但是,这似乎不适用于文件夹。有没有办法使它适用于文件夹?
编辑: 这就是控制台输出的样子:
C:\svn\Google Project Hosting\xulwin\xulrunnersamples>rmdir /S /Q treeview
C:\svn\Google Project Hosting\xulwin\xulrunnersamples>svn up
D treeview
Updated to revision 50.
EDIT2: 我已经使用svn超过两年了,我之前从未遇到过这个错误。但我没有改变任何设置。我唯一能想到的是,我今天在外部硬盘驱动器上创建了一个带有Tortoise SVN的本地存储库来备份一些不相关的旧东西。但这不应该是问题的原因,因为行为既发生在本地存储库的本地副本上,也发生在我的Google Project Hosting代码中。
EDIT3: WTF我突然无法重现这个bug。这一切都可以正常运作。但我没有改变任何事情。
EDIT4: 在EDIT1中,文件似乎被标记为已删除,但它不是因为svn commit命令没有做任何事情。 Tortoise检查修改是否也没有列出任何内容。
注意:当问题仍然存在时,完全递归更新会恢复文件夹。
答案 0 :(得分:68)
我今天用svn 1.5.6遇到了这个问题。
svn up --force the_dir_path
为我修好了。
重新创建:
$ svn up
Updated to revision X.
$ rm -rf the_dir_path
$ svn up
D the_dir_path
Updated to revision X.
$ svn up
Updated to revision X.
$ svn up --force the_dir_path
A ....
A ....
Updated to revision X.
答案 1 :(得分:13)
您可能希望使用svn revert命令而不是完成删除项目然后更新以还原它们的过程。使用-R开关递归还原文件/目录。
恢复的svn帮助信息如下
revert: Restore pristine working copy file (undo most local edits).
usage: revert PATH...
Note: this subcommand does not require network access, and resolves
any conflicted states. However, it does not restore removed directories.
Valid options:
--targets ARG : pass contents of file ARG as additional args
-R [--recursive] : descend recursively, same as --depth=infinity
--depth ARG : limit operation by depth ARG ('empty', 'files',
'immediates', or 'infinity')
-q [--quiet] : print nothing, or only summary information
--changelist ARG : operate only on members of changelist ARG
[aliases: --cl]
Global options:
--username ARG : specify a username ARG
--password ARG : specify a password ARG
--no-auth-cache : do not cache authentication tokens
--non-interactive : do no interactive prompting
--trust-server-cert : accept unknown SSL server certificates without
prompting (but only with '--non-interactive')
--config-dir ARG : read user configuration files from directory ARG
--config-option ARG : set user configuration option in the format:
FILE:SECTION:OPTION=[VALUE]
For example:
servers:global:http-library=serf
答案 2 :(得分:6)
使用svn revert (-R) foldername
将其恢复。您已使用svn rm
将其删除,svn up
将无法为您重新创建,因为它仍标记为已删除
答案 3 :(得分:3)
我用于意外删除的文件夹命令
SVN UPDATE
在父文件夹
上答案 4 :(得分:0)
svn status|grep ^D|^Ct -c9-|xargs -n1 svn revert