idea9.0.3 commit - intellij-idea

I use idea 9.0.3 and I want to commit few my application's files to SVN.
Please can anyone tell me step by step what I have to do?

you need to add version control to the project, using the 'version control' menu option at the top. I have IDEA 10, so it might be different, but in the menu, there is an 'import into version control' option. So add your SVN repo there.
once you have done that you can right click on any file or directory, go to the 'Subversion' option, and do svn operations on the file.
I use command+k on my mac to automatically start the commit process. The only thing I need to remember is to add files when they are first created, else they don't get committed.
EDIT -- You might have failed to add svn to the project -- did you enter your credentials? I assumed there was already an svn repo for your project. You don't see something like:

Related

IntelliJ - cannot commit file

In IntelliJ, I cannot commit file (right click -> Subversion -> Commit File), the option is grayed out; however - it is possible to Update File.
As a workaround, I am able to commit the file through TortoiseSVN:
Could you help me to find out why is this happening?
I tried to configure project Settings -> Version Control:
And also, according to: Intellij Annotate Option Grayed Out
I tried to uncheck 'Use non-modal commit interface' but it didn't work.
It's not the best, but I found a solution to this problem, if I find anything else, I will definitely update.
From 'Version control -> Directory Mappings' I had to remove the Git repository, and leave only Subversion, then 'Commit File' works, but I can't in turn do anything (e.g. change branch) on the Git project (which is logical).
Then I cleared VCS log caches and indexes.
After that I re-added the Git project to 'Dependency Mappings'.
The problem is, I can't clear VCS log caches and indexes now, because 'Commit File' will stop working again (so again I'd have to remove Git, clear VCS, and add Git after that).
I'm guessing IntelliJ doesn't know which repository this 'Commit File' is for, so this option is greyed out. However, all options are now available.

Unable to add Newly Created Files to SVN

There seems to be a problem adding newly created files to subversion through Intellij, because when I right click on any of them, the option to add them is grayed out and only Revert is accessible:
By the way, this problem only appears with newly added files, the old ones are detectable and can be edited and committed without problem.
Maybe I missed something when I created them?
Any help would be appreciated. Thank you.
The solution was really simple. Here's how I did, hopefully this will help someone else one day:
Leave Intellij (or the IDE you're using) aside and open your command prompt.
CD to the root of your project.
Manually add the files that you have created with the command add.
Example: svn add path/to/your/file.java
Go back to Intellij, you should see all your files which weren't detected before change color from yellow to green.
You can now commit your new files.

IntelliJ: How to create a local Java project copy for backup?

I'm new to JavaFX 8 and the IntelliJ IDE. I have a JavaFX8 project that works but not as I would like. I'd like to try another approach but the substantial changes may not work. I don't want to loose code I have working.
To save code I have working, I've been creating a new project and then locally copying all the folders(.idea, out, src) and files except .iml, of the working project into the appropriate folders in the new project with the newly generated .iml.
This always seems to work but is it proper procedure?
I'm not on a team of developers and have yet to learn Git/GitHub.
Please advise. Thanks.
Maybe you should learn how to use a Version Control System like Git, then you can create a project repository and have different branches for things you want to try out. Keeping the working code in your master branch will prevent you loosing your working code. Also, when using a vcs you can always revert to versions of your code that have been working. The IntelliJ Idea IDE has perfect support for working with all different types of version control systems. If you don't want to learn any forms of vcs then there is no other way to "backup" your working code.
Is it proper procedure? It's probably not how most people would go about achieving what you want to achieve but it's certainly workable. If you wanted to stick with that for simplicity now, I'd copy the whole directory structure, delete the .idea and .iml files, and then create a new project in IntelliJ on that clean copy: IntelliJ will automatically set up folder structure based on the existing source without you having to go through any additional manual setup.
If you're willing to experiment with the git route, to achieve the basics of what you want to achieve is not very complicated and I've written a small quick-start below. IntelliJ offers very good support for Git, and once your repository is created you can do everything you need from the IDE. I'm going to assume you're working on Windows, although the steps shouldn't be too far removed on other platforms.
Install Git
You can download and install Git from https://git-scm.com/download/win, which will install a command shell called Git Bash.
One-off setup for your project
Open up git bash and go into the directory containing your source. Rather than seeing separate drives as Windows does, Git Bash assumes there is a logical 'root' directory under which all your files are accessible. Your C: drive will be /c. To move around you can use cd to change directory (using / instead of ) and ls to list files instead of using dir.
Assuming your source code is in C:\projects\myproject:
cd /c/projects/myproject
git init
The second line above creates a git repository in that directory. This doesn't affect your code, it just creates a folder called .git that contains all of the book-keeping information.
You don't want to have every file under version control - in particular you don't want your build outputs. You need to set up a file in your project directory called .gitignore which tells git which files and directories should be ignored. As a starting point you can copy https://github.com/github/gitignore/blob/master/Java.gitignore and rename the file to .gitignore
Basic Commands and committing your initial version
There are a small number of basic commands:
git status
Running git status will tell you which files have been modified, which are not under version control, and which files have been added to the staging area to be committed next time.
git add path/to/file
This adds a file to the staging area waiting to be committed. You can add multiple files to the staging area before committing them in one go.
git commit -m "description of your change"
This commits all of the staged files as a new version, which the specified commit message.
If you go into your project directory, do a git status and check through the list to make sure there's nothing you don't want to have under version control, then you can do git add . to add everything to the staging area and git commit -m "Check in initial version of the source code" to commit it to the repository.
After you've committed, you can run
git log
To see a history of all of the changes. IntelliJ has a view that will show you the same thing.
Creating an experimental branch
This is where git shines; if you want to try something experimental you can create a branch of your project while allowing git to preserve the original version.
git checkout -b experiment1
Will create and switch to a branch called experiment1. You can delete, rename, move, rewrite and develop whatever you like on this branch. The changes you commit will be independent of your original working version.
You can switch back to your original version (preserving all of the changes you've committed on that branch) using:
git checkout master
Where master is just the name of the default branch created when you ran git init. The experimental version will still be there and can be switched to again using git checkout experiment1 or from IntelliJ using the branch selection in the bottom right corner of the status bar.
If you decide that the changes you've made in experiment1 are to become your new "good" version, you can merge them back into the master branch and repeat the cycle from there.

Intellij Annotate Option Grayed Out

I am trying to look at who changed a line in Intellij 15. I know I can use git blame but I want to learn how to do it correctly in intellij. I am right clicking on the line numbers on the file but when I get the context menu the annotate option is grayed out. What setting am I missing?
I looked at this page and couldn't find an answer. What am I missing?
If you check File > Settings > Version Control and see that your current project is listed under "Unregistered Roots", go to (on the menubar) VCS > Enable Version Control Integration. It will ask you to select the VCS tool you use, then click ok and you'll have all the integrations working (including the annotate feature which uses git blame).
The answer by #activedecay let me in the right direction. In my case, I have a multi-module project - each has a separate git repo - but we're all in the same workspace.
In my case, Intellij IDEA 2017.2, the Preferences -> Version Control (update from 2022: or Preferences > Version Control > Directory Mappings) panel shows a listing of all the project roots. The module with the disabled "Annotate" option was in the "Unregistered Roots" section.
To fix the problem, I selected the module and pressed the "+" icon in the lower toolbar to register the module root with Intellij VCS. The change is immediate and the "Annotate" options becomes available.
Looks like its a fresh project. First configure the Version Control like Git and than commit at least once. After first commit Annotate option will not be grayed out.
Also update git for any new version.
Your VCS is not enabled, hence the issue. Below is the solution for that:
Click on the VCS option in the menu bar
Enable VCS
Select your version control
Done, you should be able to use the annotate option.
Make sure the file is tracked by version control
Add the project to "Version Control" settings
I had the same issue with the Annotate being greyed out however VCS was already set up. Editing the current VCS Directory Mapping fixed the issue for me.
Go to
Settings -> Version Control
Click on the current entry for your
your application listed under projects.
Click the pen icon to edit it
Hit Ok, then ok to close the main dialog
Under the version control setting, make sure to remove any unregistered roots, I had a similar issue where there was a Unregistered roots entry was found, after removing this unwanted entry, I was able to annotate on file.
I the following two screen short will solve your problem:
1.
I hope after those steps you will be able to see who changed a line.
Here are the steps i followed :
Go to VCS -> Checkout from Version Control -> Git -> give the URL for your repository.
The annotate option will be enabled now.
I had exactly the same issue and managed to solve it by updating git.
The reason for that is that I have recent InteliJ Idea and an old 2.1.x git installed.
For Mac:
brew upgrade git
brew link git
followed by IDE restart.
Perhaps you did not check Git Integration while setting up a fresh installation of IntelliJ. It happened to me when I updated to a major release. When I was setting up the new program, I might have unchecked the Git Integration on the wizard installation.
In order to solve this for IntelliJ Community 2019.1, access File > Settings > Plugins, go to the tab Installed and make sure the plugin Git Integration is checked. You should restart the IDE in order to make the Annotate action work.
I had the same issue, but my VCS settings were all configured properly. It turns out that git itself was considering the file as a brand new file and therefore didn't have any history for it. The file was actually not new, but simply renamed. While my rename changes were unstaged, git understood it as two separate files: a deletion of the old file and creation of a new file. However, once I git added the "deleted" file and the "new" file, git understood that it was actually a rename and IntelliJ was able to annotate on the file as expected.
I'm not sure why git didn't understand the rename when it was unstaged, but hopefully this helps someone!

SVN: how to lock a file so that no one can modifiy it?

We are using TortoiseSVN for a project. One file in this project has a special status. It can be modified locally but the SVN version must not be modified.
So, I have locked the file so that noone, unless me, can modify this file. Now I am searching a way so that even me cannot modify this file. Do you know if it is possible and how?
Thanks for your answer.
Add a serverside pre-commit hook that rejects commits touching that file.
See http://wordaligned.org/articles/a-subversion-pre-commit-hook
There is an example function listing all affected files. To make the script reject the commit, write "You cannot modify THENAMEOFTHEFILE" to STDERR and exit with an error code. For example sys.stderr.write("ProjectThingyFile.txt is read-only.\n"); sys.exit(1)
Does it need to be part of the SVN repository as you can ignore it so it will not be committed and can remain unique per users machine.
Find the file right click on it
goto the tortoiseSVN Menu
Unversion and add to ignore list or add to ignore list
This process will stop any changes to that file being committed from any user
Tortoise SVN Documentation on this
Hope this helps
Jason
You could create a dummy user that no one logs in as and have that user lock the file instead of yourself.