简体   繁体   English

SVN复制到工作副本,无法取消删除文件(在提交之前)

[英]SVN Copy into Working Copy, Can't Un-delete a file (before commit)

I somehow accidentally deleted a file when creating a branch, and I can't figure out how to get it back without losing file history. 创建分支时,我不知何故意外删除了文件,而且我想不出如何在不丢失文件历史记录的情况下取回文件。

What I did 我做了什么

I'm using TortoiseSVN (1.8.2). 我正在使用TortoiseSVN(1.8.2)。 I copied a branch by doing 我通过做复制了一个分支

right-click, drag, release and select "SVN Copy and rename versioned item here"

I thought that I did nothing else (specifically, I have not committed the new branch in my working copy). 我以为我什么也没做(特别是,我尚未在工作副本中提交新分支)。

Something must have happened though - it could be pilot error, I'm not sure - but bottom line, a file (NewBranch/app/web/classes/config.properties) didn't show up in the list. 虽然一定发生了什么-我不确定这可能是飞行员错误-但最重要的是,文件(NewBranch / app / web / classes / config.properties)没有显示在列表中。 Somehow I deleted that file. 我不知何故删除了该文件。

When I checked for modifications 当我检查修改

right-click, TortoiseSVN -> Check for modifications

the files & folders of the branch appeared with status "normal(+)", with two exceptions: 分支的文件和文件夹的状态为“正常(+)”,但有两个例外:

  • the root folder of the branch (NewBranch) appears with status "added(+)" 分支(NewBranch)的根文件夹出现,状态为“添加(+)”
  • this config.properties file shows up with status "deleted(+)" 此config.properties文件显示状态为“已删除(+)”

TortoiseSVN showed a red "!" TortoiseSVN显示红色“!” as the status for the parent folder (NewBranch/app/web/classes) and gave the same status for its parent (web) and its parent (app) and the branch root (NewBranch). 作为父文件夹的状态(NewBranch / app / web / classes),并且为其父文件夹(web)和其父文件夹(app)以及分支根目录(NewBranch)赋予相同的状态。

Fixing it? 修好吗?

  1. I tried "right-click, Revert" on the file in the "Check for modifications" output window - it gave me an error 我在“检查修改”输出窗口中的文件上尝试“右键单击,还原”-它给我一个错误

    "can't revert without reverting parent". “无法还原而不还原父级”。

  2. I tried doing a "Revert" on the parent folder, and its parent, up to the branch root - I don't get an error but the file does not re-appear. 我尝试在父文件夹及其父文件夹(直到分支根)上执行“还原”操作-我没有收到错误,但文件未重新出现。

  3. I tried copying the file from the old branch to this folder - it says I'm adding the file! 我尝试将文件从旧分支复制到此文件夹-它说我正在添加文件!

Arrg. Arrg。

I'd like to have the file not deleted & preserve its history. 我想不删除文件并保留其历史记录。 I'll copy the file in if I must - but, any ideas? 如果需要,我将复制文件-但是有什么想法吗?

As long as you did not commit you did not lose much. 只要您没有承诺,您就不会损失太多。

As fixing ("reverting") the working copy is causing problems, I would start over with a re-checkout: 由于修复(“还原”)工作副本会引起问题,因此我将重新检查:

Just check out the folder you want to branch and choose TortoiseSVN->branch/tag. 只需签出要分支的文件夹,然后选择TortoiseSVN-> branch / tag。 choose the branch/ folder and add your branchname. 选择分支/文件夹并添加您的分支名称。 by this it is much easier to create a branch (without creating it in your workingcopy as well). 这样,创建分支要容易得多(也无需在工作副本中创建分支)。

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

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