Perforce stream - can you exclude a directory but include specific files in that directory? - perforce

I have a Perforce stream where I am excluding certain binary folders, as in
exclude Binaries/Win64/...
But there are a couple of files in that directory that I do want in the stream. Is there a way to list exceptions to the exclusion?

You can always override a more general rule with a more specific one:
share ...
exclude Binaries/Win64/...
share Binaries/Win64/foo
share Binaries/Win64/bar

Related

How to exclude folder from stream temporarily then include it later on

I want to download a stream to a workspace and exclude certain folder(because it's too large)
then when I am done downloading I want to download it to my workspace
so
1- how to exclude a folder from stream
2- how to include the same folder without messing anything
If you only want to exclude it from your initial sync operation, you don't necessarily need to modify the stream at all. (Modifying the stream may potentially impact other workspaces using the same stream, which you don't want.)
Edit your client to point at the new stream (in this instance you don't want to use p4 switch since that auto-syncs the new stream), and then sync only the folders that you need (i.e. enumerate all the top-level folders except for the big folder in your sync command).
The next time you do an unrestricted sync, it will pick up everything that hasn't been downloaded, including the big folder that you avoided the first time around.

Excluding Files and Folders from dupFinder

I'm trying to use dupFinder to scan for duplications in a .NET codebase. I have certain files and folders that I want to exclude from the scan but I'm struggling to get it working.
The command I'm running is:
dupfinder.exe --show-text --output="dupReport.xml" --exclude="Some.Folder.*;*Resource.designer.cs" MyCode.sln
So what I'm trying to do is:
Scan the MyCode.sln solution.
Ignore all folders matching the pattern Some.Folder.* e.g. Some.Folder.Code and Some.Folder.Tests (these folders are in the root of the repository alongside the solution file).
Ignore all files matching the pattern *Resource.designer.cs in any folder i.e. MyCode.Resource.designer.cs.
I'm sure I'm just doing something wrong but the dupFinder documentation doesn't show an example of using the exclude option.
I have eventually managed to get this working, the conclusion I've drawn is that you can't exclude folders only files.
I think because my original exclude pattern was trying to ignore folders the whole thing wasn't working.
I know this is an old question but I also searched for this.
To exclude complete folders you should use double *
e.g.
--exclude="**\Tests\**;**\Resource.designer.cs"
excludes all Files in all Tests folders and Resource.designer.cs in whatever folder.
Edit:
Tested and still working on JetBrains.ReSharper.CommandLineTools.2020.3.4. Which was the current version when I wrote the answer.
Current version seems to have a bug again and not excluding at all.

Perforce streams, exclude files from merge/copy

I have following perforce streams structure: main branch and 2 development branches linked to it dev_v1 and dev_v2. Both development streams has some build control files where version specific variables are located. Any change in these files will be reflected in Perforce Streams Graph and the system will ask me to merge them into main and then from main into other development branch.
How to exclude specific set of files in Perforce so that in case of any change the system will no show any difference between streams and will not ask to merge/copy them.
If those build files should never be integrated you should set that path in the stream view to be 'isolate' instead of public. That will add the files to client views for that stream, but will exclude them from any generate branch maps. That will cause them to fall out of the integration calculation and Perforce will stop trying to integrate them.
Isolate was specifically put in streams to handle build files that are unique to each stream, so this is the perfect use.
When you merge you can select which change lists you want to include in the merge, and which you want to exclude. If you are using P4V when you get into the merge window you can choose which changelists to merge into the other code line. Most of our items are set up as streams...if you are a using a standard depot the functionality to should be similar...if you have troubles let me know I can set up another depot on my dev server.

Only branching specific folders and preserving their directory structure

I'm trying to create a branch spec that only pulls down specific folders from a repository, but preserves the directory structure.
For instance, in the repo the project looks like this:
project
->1.0
->Common
->ProjectSpecific
->Project1
.Project specific files
->Project2
.Project specific files
->2.0
.
.
.
->_env
.
.
.
->c
.
.
.
->setup
.
.
.
.general project files
What I'm trying to do is create a branch for each project that pulls down all folders, except in the 1.0/Project sub directory, it should only pull down the Project folder specific to that folder. I'm guessing this isn't possible purely with a branch spec (I've tried and always end up with everything in the same directory or other problems). I've tried creating a seperate codeline with a client view, mapping every directory under project, and beign sure to only map the Project specific folder, but it didn't work, and I'd really like to avoid having to create a new codeline for every project.
Is their a way to do this from a branch spec? Alternatively, is there a way to blacklist folders? Then I could simply map the whole project directory and just blacklist the projects I'm not interested in. Any help would be appreciated. If I'm not being clear, let me know and I'll add more detail.
Thanks
You can blacklist folders by adding a minus to the beginning of the line for the mapping in the branch spec.
See the Perforce documentation on Views for the gory details.
Right, you can use branch specs to include/exclude what you want. Streams provide an even simpler way to specify the files you want.

Pass a Directory Query to <cfzip>?

I need to zip files from a directory, but not all the files in the directory. I determine the files that need to be zipped by running a query on the directory listing.
Currently, I'm looping over the query results to add each file to the archive individually, but this can take a while in a large directory.
Is there any way to do this outside of a loop? I couldn't find anything in the CF docs that would indicate that you can pass some sort of list to cfzip.
Unfortunately, no. You can pass it an entire directory to zip up, but not a query of files.

Resources