代码之家  ›  专栏  ›  技术社区  ›  StackedCrooked

如何还原本地删除的文件夹?

svn
  •  23
  • StackedCrooked  · 技术社区  · 15 年前

    本地删除一个文件,然后进行SVN更新,将还原该文件的本地副本。但是,这似乎不适用于文件夹。有什么方法可以使它也适用于文件夹吗?

    编辑: 控制台输出如下所示:

    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.
    

    编辑2: 我使用SVN已经两年多了,以前从未出现过这种错误。但我没有更改任何设置。我能想到的唯一一件事是,今天我在外部硬盘上用Tortoise SVN创建了一个本地存储库来备份一些不相关的旧东西。但这不应该是问题的原因,因为这种行为既发生在本地存储库的本地副本上,也发生在我的Google项目宿主代码上。

    EdTe3: 如果我突然再也不能复制这个错误了。现在一切正常。但我什么都没改变。

    编辑4: 在edit1中,该文件似乎被标记为已删除,但这并不是因为svn commit命令什么都没有做。乌龟也没有检查任何修改列表。

    注意:当问题仍然出现时,完全递归的更新确实恢复了文件夹。

    5 回复  |  直到 8 年前
        1
  •  68
  •   Rory O'Kane Erce    13 年前

    我今天用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.
    
        2
  •  13
  •   tschaible    15 年前

    您可能希望使用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
    
        3
  •  6
  •   knittl    15 年前

    使用 svn revert (-R) foldername 把它带回来。您已使用删除它 svn rm svn up 不会为您重新创建它,因为它仍标记为已删除

        4
  •  3
  •   Siarhei Kuchuk    13 年前

    我用于意外删除文件夹命令

    支持向量机更新

    在父文件夹上

        5
  •  0
  •   Alex    9 年前
    svn status|grep ^D|^Ct -c9-|xargs -n1 svn revert