My intellij java project can't find misc.xml - mercurial

I have a java project in Intellij and use Hg/Mercurial for version control. I ignored some files with this .hgignore file
syntax: glob
target/*
.idea/*
*.iml
and deleted all these files which was committed before. but now I can't execute my project, cause it can not find the file misc.xml.
What should I do?

Updated answer for IntelliJ 14+: File-> New-> Project from Existing Sources... (choose your project directory) and follow the wizard Q&A.

Restarting Intellij should fix the problem. Just make sure you click on the "Import Project" pop-up that appears on the top right.

At first, you shouldn't really ignore everything under .idea but instead only .idea/workspace.xml and .idea/tasks.xml, as it JetBrains states: http://devnet.jetbrains.com/docs/DOC-1186
To solve your problem and get your project back to working state there are possibly two solutions:
Checkout the last commit that contains the files under .idea folder with
hg checkout SHA,
where SHA is the commit id.
After that reset your working space to the head:
hg reset HEAD
Edit your .hgignore in the way that was recommended before, add project files to stage, and commit them:
hg commit -am "Reverted project settings"
If there is no commit with the project settings, you can just import your code back.
Start Intellij IDEA and choose "Import Project". Choose the folder with your code, and choose the appropriate SDK after.

I met this problem when I did rm -rf project command, then when I git clone a new project to my working space, maybe quit the idea and then import the project again. This can easily solve this

I have found that for this error and also for some other cases where the IDE project behavior is inconsistent with command line behavior, the following often helps: close the project's Intellij IDEA window, delete .idea/, and open the project again. IntelliJ often flashes up a message saying it didn't find a project root but generally this disappears after a few seconds and IntelliJ automatically rebuilds the .idea directory.

Recreating the .idea folder
File -> Close project
File -> Open -> Choose pom.xml under the project folder -> Open as project -> Delete existing project and import

Related

File doesn't belong to this project - PhpStorm

UPDATE
Asked the question on the PhpStorm site.
When I press Ctr + Shift + N to navigate in my project files it can only find some off my files in the directory. So most off the files do not belong to the project. How to make it so my directory with all the files becomes 1 project again?
Also it looks like some off the files are on C:\Users\Username\Projects\Website and other files are on Z:\Projects\Website
It's a short question I hope I explained it right, and if I need to give more information about something ask/tell me. (also I don't know which tags I have to use)
If someone is experiencing this problem with the PhpStorm 2021 version, try these steps:
Close the IDE.
Go the project directory and delete .idea folder.
Restart the IDE.
For me, the IDE created a new .idea folder and recognized all files as the part of the project.
Did you try reopening the project? That sometimes does solve my problems.

Recover deleted file from PhpStorm and SourceTree

I have an open project in PhpStorm that I manage using SourceTree. I was trying to remove some image files from a commit using SourceTree, but accidentally selected a file that should not be deleted. I haven't changed anything (in either PhpStorm or SourceTree) since deleting the file. I tried to do Ctrl+Z in SourceTree but nothing happened. I then checked in PhpStorm Vcs -> local history, but it didn't show the file. How can I recover this file?
Try to right click on project main folder in phpStorm and select Local history / Show History in context menu (not vcs / local history). The file should be at the list as "Deleting".
This is documented by JetBrains here
TL;DR

How to disable version control in phpstorm?

I am playing around with phpstorm and somehow I activated version control. I don't need it. Now all my tabs are different: orange text on gray background. All files in the file view are orange. How do I disable version control?
Go to Settings -> Version Control and remove the folder from which you would like to remove version control tracking (coloring tabs etc.) It will naturally not remove version control from your project (as in deleting the .git/ folder for instance).
The ultimate way is to disable all version control plugins (under Settings -> Plugins): CVS Integration, Git Integration, GitHub, hg4idea, Perforce Integration, Subversion Integration. After restarting PhpStorm Settings -> Version Control tab will be gone.
Note that this will disable version control for all of your projects.
You can just remove vcs.xml from .idea folder and then restart PhpStorm
In phpStorm 2022.1.3+, go to
Preferences > Version Control > Directory Mappings
Then remove the directories you don't want to watch, as Greg suggested.
Go to Settings -> Version Control and remove the folder from which you would liek to remove version control.
I have not enough reputation to +1 Greg's answer or comment, but... for those who are interrested : the same goes for Webstorm.
I had this problem and I used from 2 of notes in these answers in these page together.
As Greg has mentioned in one of replies, your git repository is in .git sub directory inside directory that you want to manage it with version control system. When you define a git repository, PhpStorm automatically generate it and with creating this sub directory, it adds a file for handling mapping between itself and version control system. It calls vcs.xml and it's located in .idea sub directory.
It's not enough to remove only .git directory. When you remove .git, you will get an error in PhpStorm every time that you open your project due to not matching vcs.xml for mapping between PhpStorm and git repository of your project. So after removing .git directory, you must also remove vcs.xml files from .idea and now you won't have any error or warning in your PhpStorm.
It doesn't need to restart PhpStorm at all and after this, colors of all of files that was mentioned in questions return to normal colors in PhpStorm.

What is .rds_delta file?

I see a file in the root folder of my Tizen project called .rds_delta that contains what appears to be change commands for something. A Google search reveals nothing. Does anyone know what this file is for and if it should be kept in the Git repository, or should we add this to .gitignore?
.rds_delta file:
#delete
#add
#modify
res/wgt/author-signature.xml
res/wgt/config.xml
res/wgt/signature1.xml
It was a file that inform application installer what is changed in your app between one package build and second one. This is needed to quick application install from SDK.
Some official link: https://developer.tizen.org/development/training/native-application/application-development-process/running-applications
In my opinion it shouldn't be throw into Git repository.

solving Mercurial and IntelliJ IDEA project root mismatch?

I have a mercurial repository which has several projects (from an IntelliJ IDEA sense) within it. for example, I might have:
foo/
projects/
project1/
.idea/
project2/
.idea/
I can push,pull,commit etc fine with command-line and TortoiseHG. I've enabled Mercurial (hg4idea plugin) within IntelliJ yet almost nothing seems to be working. If I add a source code file it doesn't get added, for files I've added manually they show no changes. In IntelliJ the Mercurial menu is enabled but "add to VCS" is always greyed out. However, IntelliJ correctly lists available changesets from a remote repository.
In the Version Control window for commands like "hg status" I get errors like:
abort: repository C:/foo/projects/project1 not found!
Commands like "hg incoming" seem to be succeeding.
I suspect this might be because the project root (project1) is below the repository root (foo). Does anyone know how to resolve this problem? Is there a configuration change I can make? If so, where in the settings is it?
I'm using the latest (10.0.3) IntelliJ IDEA Community edition.
I managed to work this one out myself. When you enable the project for Mercurial, IntelliJ sets the project root by default as the mercurial repository directory. With the help of this help page I worked out this was what I needed to change.
Go to the Settings dialog (File-Settings)
Choose Version Control
At the top level it shows a list of Directories and VCS's, mine said "project root" and "Mercurial"
Click "Remove" to remove the existing mapping.
Click "Add" to add a mapping, and use the "..." button to choose the mercurial root - "foo" in the example above.
This changes the vcs.xml file in the .idea directory.
The steps provided by Nick work for me in a similar setup with multiple projects living in the same Mercurial repository.
I was worried that IDEA would use absolute paths in vcs.xml but it's more intelligent:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="hg4idea" />
</component>
</project>