2
votes

When I add a new (.java) file to my project in IntelliJ, it does not get automatically added to p4, even though it was configured to do it.

When I try to add it manually to p4 (using p4v -> rclick -> add) it says "ignored file can't be added". I have not done anything to mark this file as "ignored". I have also checked the .p4ignore file in my p4 client root dir. It does not have any rules targeting that directory or *.java.

I can go to command line and do p4 reconcile -I, which has the effect of adding the file to p4. But why do I need to do this? Why don't new files get added to p4 automatically, and why does p4 see them as "ignored"?

I am using IntelliJ 13.1.1 Ultimate on Win7 64-bit with the P4 plugin. Using p4v version "2013-09-24". IntelliJ is configured to silently add new files to p4 (File -> Settings -> Version Control -> Confirmation). The IntelliJ-specific list of ignored files contains only IntelliJ-specific files (*.iws, .idea/, etc.).

2
I'd suggest you file an issue to youtrack.jetbrains.com and attach your log (Help | SHow log), p4.output (Settings | Version Control | Perforce | Dump...) and a couple screenshots there.Peter Gromov
Also, make sure you check the entire tree from your p4 root all the way down to the directory containing the .java files. Perforce walks up the tree from the directory containing the file to be checked in all the way to the root when evaluating .p4ignores.gaige
The Idea log has no exceptions related to the these operations. The p4.output contains: 17:54:06 add -f -n C:\dev\...\tests\WhyIsItIgnored.java //BMC/main/src/.../tests/WhyIsItIgnored.java#1 - opened for add C:\dev\...\tests\WhyIsItIgnored.java - ignored file can't be added. 17:54:06 have C:/dev/p4/bmc/src/.../tests/WhyIsItIgnored.java C:/dev/p4/bmc/src/.../tests/WhyIsItIgnored.java - file(s) not on client. 17:54:06 add -f -n C:\dev\...\tests\WhyIsItIgnored.java //BMC/main/src/.../tests/WhyIsItIgnored.java#1 - opened for add C:\dev\...\tests\WhyIsItIgnored.java - ignored file can't be added.radumanolescu
@gaige Good suggestions. I have opened a ticket with IntelliJ.radumanolescu

2 Answers

1
votes

There can be multiple P4IGNORE files in your client workspace, not just the one in the client's root directory. The Perforce client-side software will search the directory containing the file to be added, its parent directory, and so forth, looking for P4IGNORE files which control the file ignoring behaviors.

See: http://www.perforce.com/blog/120214/new-20121-p4ignore

1
votes

Mystery solved. I was adding files with the pattern a\b\c\test\d\e\Fgh.java. There was no directive to ignore *.java. but there was an instruction to ignore test\*. There were no additional p4Ignore files up and down the tree, though it's a good suggestion to check for such things. Works as designed. No issue to report.