One of the key features of the 2012/2 PureCM release is the introduction of pcmignore files. I want to explain what they are and how they can make life easier for you. If you are familiar with gitignore files then we have some good news - they are identical.
The Problem – The Ignore File Paths Policy
More often than not there are files in a workspace which you do not want to control. These might include user option files or build files. The previous way of handling this in PureCM was to update the 'Ignore File Paths' policy. So the policy might include the pattern '*.obj' to ensure object files are not added to PureCM.
This policy will carry on working the same as before so if this is working well for you there is no need to change anything. But you may not like this way of working for one or more of these reasons:
- It is difficult to maintain the 'Ignore File Paths' policy, especially if you have different patterns for different streams. If you decide you want to add a new pattern you have to update this policy in each policyset.
- Users need to access the Administration view to update the policy. It is unreasonable to expect all developer to become familiar with PureCM policies.
- Users need to be a Policy Administrator to update the policy. It is very common that an Administrator would not want all users to be able to update all policies.
- You cannot specify complicated rules. For example you could not say "Exclude all files in a 'Debug' directory except the files in '/src/Debug'".
For these reasons many users have stopped using the 'Ignore File Paths' policy preferring to manually remember which files to not add. But this approach is not recommended for the following reasons:
- New developers might not know which files to exclude.
- You are less likely to run the Check Consistency Wizard which makes it more likely that you will forget to add a new file.
- You cannot use the 'Monitor the workspace for file changes' feature which will automatically add files to your workspace when you create them.
Better in Every Way - pcmignore Files
Using pcmignore files will resolves all these issues. A pcmignore file specifies any number of exclude and include patterns. This is similar to the 'Ignore File Paths' patterns but you can specify include patterns the same as exclude.
When you put the pcmignore file in a folder, the include and exclude rules are applied to that folder and any subfolders. So it is easy to specify complex rules like "Exclude all files in a 'Debug' directory except the files in '/src/Debug'". The root pcmignore file will have a rule to exclude all files in a Debug directory. The 'src' directory has a pcmignore file with a rule to include the Debug directory.
The pcmignore files are submitted to PureCM the same as any other file. Other developers start using the new pcmignore rules after they update their workspace. Developers can add new rules or update existing rules easily by checking out the pcmignore file, updating it and submitting the change.
Hopefully you are eager to start using the new pcmignore files. To get going you need to add a file with the name '.pcmignore' at the root of your workspace. This file contains all the exclude and include rules which apply to all folders in the workspace. You can download a good starting point from here.
Note: If you create a new stream from scratch then the default .pcmignore file is added automatically.
There are many example gitignore files which you can download here. pcmignore files and gitignore files are identical, you can even call the file .gitignore.
After adding the root pcmignore file you can go through each entry in the 'Ignore File Paths' and add any useful patterns to the pcmignore file.
The best approach is then to clear your 'Ignore File Paths' policy and run check consistency on a workspace where everything has been built. Look at the files which PureCM wants to add and add them to the pcmignore file. Keep doing this until running check consistency finds no new files.