Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you "ignore" a directory in P4V?

Tags:

perforce

We use Visual Studio, which generates lots of bin and obj directories. When I use P4V's "Reconcile Offline Work" feature, these appear in the "Local files not in depot" list.

I'd like to exclude them. I found this question, but that talks about files, and when I try what it suggests (adding the following to my workspace view), it doesn't work:

//depot/Foo/... //Client/Foo/... -//depot/Foo/.../*.user //Client/Foo/.../*.user -//depot/Foo/.../bin/... //Client/Foo/.../bin/... -//depot/Foo/.../obj/... //Client/Foo/.../obj/... 

It doesn't actually seem to work for files, either: the foo.csproj.user files are still displayed in the list.

Can I exclude directories from P4V? If so, how? What am I doing wrong?

like image 673
Roger Lipscombe Avatar asked Jun 23 '10 06:06

Roger Lipscombe


People also ask

How do I edit P4V files?

To define an editor: choose Tools > Preferences, click the Editor tab, and specify the desired editor for the file type.) Using the editor associated with the file type, make your changes. To place your revised version in the depot so other users can have access to it, right-click the file and choose Submit​.

What is P4IGNORE?

Specify a list of files that contain lists of rules for ignoring files when adding files to the depot and reconciling workspaces.

How do I search for a file in P4V?

Go to Search > Find File. The Find File tab opens in the right pane. On the Find File tab in the right pane, under Search in, enter the directory path you want to search. You can drag and drop the file path from the Depot or Workspace Tree in the Tree pane.

What does perforce checkout do?

From "Perforce Basic Concepts": Get Latest ( p4 sync ) is about transferring files from the depot to your workspace. Check-out ( p4 edit ) is about getting the latest version from the depot for editing. When files are checked out for edit, their permissions are set to read-write.


1 Answers

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):

P4V 'ignored' files message


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".

like image 189
raven Avatar answered Sep 28 '22 04:09

raven