什么是“切换文件”?关于 SVN/IntelliJ?

发布于 2024-12-11 06:56:09 字数 550 浏览 0 评论 0原文

我有一个现有的 Maven 项目,我用它来创建一个新的 IntelliJ 项目(“从外部模型导入项目”选项)。我更改了一些文件并提交了它们。

然后我意识到我走错了分支(我们称之为错误)。我退出了IDEA,使用Tortoise SVN切换到正确的分支(我们称之为right),然后重新打开IDEA。一切似乎都很好,除了,我现在在“更改”窗口的“本地”选项卡中有一个名为“切换文件”的组。这个“交换的文件”有一个名为“branches/wrong”的子组,它似乎包含整个存储库中的所有文件!这些文件与right 中检查的文件没有什么不同,并且其中大多数文件与wrong 中的文件也没有不同。然而它们在我的“更改”窗口中。

此外,这些文件不会显示在 Tortoise“提交”窗口中,但它们会显示在 Tortoise“检查修改”窗口中。但同样,据我所知,这些文件没有被修改,它们的任何属性也没有被修改。

什么是“切换文件”以及如何简单地将所有内容恢复到正确分支?

I have an existing Maven project, which I used to create a new IntelliJ project (the "Import project from external model" option). I changed a few files and committed them.

Then I realized I was on the wrong branch (let's call it wrong). I exited IDEA, used Tortoise SVN to switch to the correct branch (let's call it right), and then re-opened IDEA. Everything seems fine, except that I now have a group in the Local tab of the Changes window called "Switched Files." This "Switched Files" has a subgroup called "branches/wrong" which appears to contain ALL the files in the entire repository! These files do not differ from the ones checked into right, and most of them do not differ from the ones in wrong, either. Yet here they are in my Changes window.

Moreover, these files do not show up in a Tortoise "Commit" window, but they do show up in a Tortoise "Check for modifications" window. But again, these files have not been modified, nor have any of their properties been modified, so far as I can tell.

What are "Switched Files" and how do I simply revert everything to the right branch?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

时光病人 2024-12-18 06:56:09

显然这只是 Subversion 的事情。我不知道“交换”文件的概念。您可以使用命令行判断某些文件是否已切换:

$ svn st
    S  file1.txt
    S  file2.txt

“已切换”的文件将标有“S”。如果您对这些文件之一执行 svn info,您将看到列出的 URL 与当前分支的 URL 不匹配。有关更多信息,请参阅这篇文章信息。

我仍然不知道它的真正含义是什么,也不知道它是如何通过执行“Tortoise -> Switch...”进入该状态的,但我确实知道如何修复它:

$ svn switch URL

Where URL是您要切换到的分支的 svn:// URL。这应该递归扫描所有文件并将它们牢固地放在“正确”分支上。

Apparently this is just a Subversion thing. I was unaware of the concept of "switched" files. You can tell if some of your files are switched by using the command line:

$ svn st
    S  file1.txt
    S  file2.txt

The "switched" files will be marked with an 'S'. If you execute svn info on one of these files, you will see that the URL listed does not match the URL of your current branch. See this SO post for more info.

I still don't know what it means really, or how it got into that state just by doing "Tortoise -> Switch...", but I do know how to fix it:

$ svn switch URL

Where URL is the svn:// URL of the branch that you want to switch to. That should recursively scan all files and put them firmly on the "right" branch.

顾铮苏瑾 2024-12-18 06:56:09

我刚刚遇到了一个类似的问题,在切换分支后,一个文件由于某种原因被标记为“已切换”。

我能够通过 IDEA 解决这个问题,方法是确保我没有进行任何本地更改,切换回“错误”分支,然后再次切换到“正确”分支。

请注意,我使用 IDEA 进行切换,而不是 Tortoise。

I just had a similar issue where after switching branches, one file was marked as "switched" for some reason.

I was able to fix this through IDEA by making sure I didn't any local changes, switching back to the "wrong" branch, then again switching to the "right" branch.

Note that I'm using IDEA to switch, rather than Tortoise.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文