Java IntelliJ 和 SVN:提交时“未检测到更改”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6590842/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
IntelliJ and SVN: "no changes detected" upon commit
提问by Luigi Plinge
I'm trying to share a project between my desktop and laptop using Subversion. The project has 3 modules. I've imported the project folder into a repository in a shared folder that my laptop can access over the network.
我正在尝试使用 Subversion 在我的台式机和笔记本电脑之间共享一个项目。该项目有3个模块。我已将项目文件夹导入共享文件夹中的存储库,我的笔记本电脑可以通过网络访问该文件夹。
I checked the project out on my laptop and then tried to open the project. None of the modules are visible, only the project's .iml file, as in the screenshot below.
我在笔记本电脑上检查了该项目,然后尝试打开该项目。没有任何模块是可见的,只有项目的 .iml 文件,如下面的屏幕截图所示。
I notice that the .iml file has a line for "content url", which refers to a location on my desktop. Maybe this is the problem. What can I do about it? Do I have to create a new project on the laptop and import the modules - so there would be 2 different top level .iml files, one for the desktop and one for the laptop? Am I going about this the wrong way?
我注意到 .iml 文件有一行表示“内容 url”,它指的是我桌面上的一个位置。也许这就是问题所在。我该怎么办?我是否必须在笔记本电脑上创建一个新项目并导入模块 - 所以会有 2 个不同的顶级 .iml 文件,一个用于台式机,一个用于笔记本电脑?我会以错误的方式解决这个问题吗?
UPDATE: The problem seems to be with committing. When I make a change in a file, save, and hit Commit Changes, I get a popup saying "No changes detected". This is the same on both laptop and desktop, and meant that I downloaded the wrong version onto my laptop before. I deleted the repository and created a new one, and my project works on my laptop now, but I can't commit changes from within IntelliJ (only with TortoiseSVN via file manager). Also, when I imported my project into version control from my desktop computer, the working copy wasn't put under version control. So I can't update from my desktop unless I check it out to a different folder.
更新:问题似乎与提交有关。当我对文件进行更改、保存并点击“提交更改”时,会弹出一个提示“未检测到更改”。这在笔记本电脑和台式机上都是一样的,这意味着我之前在笔记本电脑上下载了错误的版本。我删除了存储库并创建了一个新存储库,我的项目现在可以在我的笔记本电脑上运行,但是我无法从 IntelliJ 中提交更改(仅通过文件管理器使用 TortoiseSVN)。此外,当我将我的项目从台式计算机导入版本控制时,工作副本并未置于版本控制之下。因此,除非我将其检出到其他文件夹,否则我无法从桌面进行更新。
I think there is something wrong with the SVN plugin with this version of IntelliJ (10.5.1). Does anyone else have problems with committing changes?
我认为这个版本的 IntelliJ (10.5.1) 的 SVN 插件有问题。有没有其他人在提交更改时遇到问题?
RESOLUTIONI needed to 1) Update Settings | Version Control to map Subversion to the working directory 2) Import into Version Control 3) Check it out again
解决方案我需要 1) 更新设置 | 版本控制将 Subversion 映射到工作目录 2) 导入到版本控制 3) 再次检查
It may possibly have been caused by the fact that the modules were originally standalone projects which were in separate repositories. Whatever the cause, IntelliJ's "No changes detected" dialog isn't the most helpful.
这可能是因为这些模块最初是位于不同存储库中的独立项目。无论是什么原因,IntelliJ 的“未检测到更改”对话框都不是最有帮助的。
采纳答案by CrazyCoder
Please refer to the FAQ.
请参阅常见问题解答。
As for the content root, make sure that it's located under the project root or module root, in this case the path will be stored relatively to the project/modile root inside the iml file. If the fixed system specific path is used in the iml, such module will not work on other systems.
至于内容根,请确保它位于项目根或模块根下,在这种情况下,路径将相对于项目/模块根存储在 iml 文件中。如果在 iml 中使用固定的系统特定路径,则此类模块将无法在其他系统上工作。
UPDATE: Make an explicit mapping between the actual working directory and Subversion in Settings | Version Control dialog. If you are using the default placeholder and your project files are not under the checkout root, it could be the case.
更新:在实际工作目录和设置中的 Subversion 之间进行显式映射 | 版本控制对话框。如果您使用的是默认占位符并且您的项目文件不在 checkout 根目录下,则可能是这种情况。
After performing the initial import you need to do a checkout in order to use version control in IDEA.
执行初始导入后,您需要进行检出才能在 IDEA 中使用版本控制。
回答by Max P Magee
I just ran into this today- checked out an existing project and had to update the SVN scheme from 1.6 (I think) to 1.8. That seemed to make Subversion not recognize that it was wrong it its belief- even though I could DIFF and see changes relative to the latest repository version- that "No Changes Detected."
我今天刚遇到这个 - 检查了一个现有的项目,不得不将 SVN 方案从 1.6(我认为)更新到 1.8。这似乎让 Subversion 没有意识到它的信念是错误的——即使我可以 DIFF 并看到相对于最新存储库版本的更改——“未检测到更改”。
I got so fed up that I shut down Intellij...on a whim I reopened it, and the file in question appeared blue...hmmm...yep, now it detected the changes.
我受够了,以至于我关闭了 Intellij ……我一时兴起重新打开它,有问题的文件显示为蓝色……嗯……是的,现在它检测到了更改。
回答by Stoffe
VCS -> Refresh File Status solved this for me, when Intellij suddenly stopped noticing changes.
当 Intellij 突然停止注意到变化时,VCS -> Refresh File Status 为我解决了这个问题。
回答by TetraDev
Sometimes doing VCS -> Refresh File Status
works for me.
有时做VCS -> Refresh File Status
对我有用。
Other times, it does nothing.
其他时候,它什么都不做。
A solution is to
一个解决办法是
- COPY all your file contents to clipboard / external notepad (for backup)
- Choose Rollback on the file which needs updating. Now it is up-to-date with the server and does not contain your new changes.
- Edit file again (checkout), and PASTE your original file contents.
- Attempt to commit changes. It should detect them now.
- 将所有文件内容复制到剪贴板/外部记事本(用于备份)
- 在需要更新的文件上选择回滚。现在它与服务器保持同步,并且不包含您的新更改。
- 再次编辑文件(结帐),并粘贴原始文件内容。
- 尝试提交更改。它现在应该检测到它们。
回答by Shravan Ramamurthy
I got into the similar issue today and I tried VCS -> Refresh File Status
, but it didn't help me. When i looked at Version Control->Subversion Working Copies Information
, i found an svn error The working copy at /home/project is too old to work with svn client 1.9.4
. First i ran svn upgrade
and then doing VCS -> Refresh File Status
resolved my issue and i was able to commit my changes.
我今天遇到了类似的问题,我试过了VCS -> Refresh File Status
,但没有帮助我。当我查看时Version Control->Subversion Working Copies Information
,我发现了一个 svn 错误The working copy at /home/project is too old to work with svn client 1.9.4
。首先我跑了svn upgrade
然后做VCS -> Refresh File Status
解决了我的问题,我能够提交我的更改。
回答by Panu Logic
I had the same issue it seems it may have been caused by having a file with the same name in two different GIT-repositories.
我遇到了同样的问题,这似乎是由于在两个不同的 GIT 存储库中具有相同名称的文件引起的。
I was able to fix it by opening File -> Settings -> Version Control and then un-assigning and re-assigning GIT as the VCS of the two directories which both had the file. First the directory in which there was no changes in the file then the other active one which did have changes (but which did not detect them before).
我能够通过打开文件 -> 设置 -> 版本控制,然后取消分配并重新分配 GIT 作为两个都有该文件的目录的 VCS 来修复它。首先是文件中没有更改的目录,然后是另一个有更改的活动目录(但之前没有检测到它们)。