As of version 2012.1, Perforce supports the P4IGNORE
environment variable. I updated my answer to this question about ignoring directories with an explanation of how it works. Then I noticed this answer, which is now superfluous I guess.
Assuming you have a client named "CLIENT", a directory named "foo" (located at your project root), and you wish to ignore all .dll files in that directory tree, you can add the following lines to your workspace view to accomplish this:
-//depot/foo/*.dll //CLIENT/foo/*.dll
-//depot/foo/.../*.dll //CLIENT/foo/.../*.dll
The first line removes them from the directory "foo" and the second line removes them from all sub directories. Now, when you 'Reconcile Offline Work...', all the .dll files will be moved into "Excluded Files" folders at the bottom of the folder diff display. They will be out of your way, but can still view and manipulate them if you really need to.
You can also do it another way, which will reduce your "Excluded Files" folder to just one, but you won't be able to manipulate any of the files it contains because the path will be corrupt (but if you just want them out of your way, it doesn't matter).
-//depot/foo.../*.dll //CLIENT/foo.../*.dll
As of version 2012.1, Perforce supports the P4IGNORE
environment variable. This allows you to specify files and directories to ignore when using the commands that search for or add new files (p4 add
, p4 status
, and p4 reconcile
).
To use an ignore file, create a file in the root of your workspace and give it some meaningful name. The convention seems to be something like .ignore or .p4ignore, but anything will do (I used p4ignore.txt so that I can edit it with a simple double-click). Then fill it with your ignore rules. The following will ignore the the unwanted debris generated by Visual Studio:
# directories
bin
obj
# files
*.suo
*.user
After you have created this file, set the P4IGNORE
environment variable to point to it. At the command line, type something along the lines of this:
p4 set P4IGNORE=C:\somepath\p4ignore.txt
Be sure to use an absolute path! The Perforce documentation doesn't specify this and my first attempt did not work (on Windows anyway) because I didn't specify an absolute path.
After doing this, any attempt to add files or directories that are in the ignore list will be rejected and you'll see a warning such as this (which they do give you the option to suppress):
If you are using a version of the Perforce server previous to 2012.1, you can still do this in your client spec. The syntax of your exclusion rules is just a little off. What you want is this:
-//depot/Foo.../*.user //Client/Foo.../*.user
-//depot/Foo...bin/... //Client/Foo...bin/...
-//depot/Foo...obj/... //Client/Foo...obj/...
Note the missing slashes after "Foo" and before "bin" and "obj".
Best Answer
I had exactly the same problem.
The solution for me was obscure but trivial.
I simply changed the root directory of my client workspace from "C:\depot" to "c:\depot".
Yes, that's right, all I did was to change the drive letter from uppercase to lowercase. And, yes, I verified that changing the drive letter back to uppercase breaks it again and that changing the drive letter back to lowercase again fixes it again. So, this is not just a coincidence.
This is almost certainly a bug in the Perforce reconcile feature.
If you look closely at the reconcile paths, they all appear with a lowercase drive letter, even if you specify an uppercase drive letter, so my guess is that the matching algorithm is simply doing a case-sensitive comparison on the file paths. This is appropriate for everything but the drive letter. Their file lister probably always sets the drive letter to lowercase, so an uppercase drive letter on your client workspace root will never match.