Configure Perforce to only integrate into clean workspace - perforce

I just did a
p4 integrate -r -b Feature-to-Main
followed by
p4 resolve -as
to bring a feature branch up to date. However, I had forgot to commit my changes to the feature branch, so I was asked to resolve conflicts between changes done to Main and my uncommitted changes. Luckily, the changes were not on the default changelist, so I was able to undo all this by reverting the default changelist and choosing "select target" for all conflicts in the remaining changelists.
I do not like this behavior, and I wish that Perforce had not allowed me to execute the first command. Is it possible to configure Perforce to only perform integrations into workspaces with empty changelists?

Related

Perforce: How to mark for delete files present in depot but not in workspace?

We have a code base which is downloaded from internet (GitHub repository). Updating process is following:
p4 Checkout existing version
Download new version from internet and extract it over old version
p4 Revert unchanged files
p4 Submit changes
Problem with this approach is that files which are not present in downloaded repo (removed from GitHub repo) are still present in file system and considered as unchanged. Revert unchanged files will revert them back and keep in depot/workspace. This is particular problem for Java files since we compile by specify root folder. Remaining file is unreferenced in new source but you can't see it.
p4 clean has option -d
Deleted files: Find those files in the depot that do not exist in your workspace and add them to the workspace.
but I am looking for opposite
Find those files in the workspace that do not exist in your depot and delete them from the depot.
If I delete whole folder structure from file system, workspace goes out of sync.
How to find/mark for delete files which are not present in new folder structure?
This is my typically recommended workflow for this use case:
Start with an empty workspace
Extract the current version of the tree into the workspace
p4 flush to the revision you want to use as the base (if you've made no changes to this branch on the Perforce side, you can just use the default #head)
p4 reconcile to open all files for the appropriate action
p4 submit
To elaborate on step 3: the "base" should be whatever revision the two trees were last in sync at. If this is a one-way operation, it's always just the latest revision (which came directly from github). If you're making changes on both sides, you should have a separate branch on the Perforce side for your github imports, and only use it for imports; then do one-way merges from there into your development mainline so you can resolve differences with all the right history tracking.

perfocrce (p4) ; error deleting Perforce worksplace

I am having problem deleting Perforce workspace?
Even i am using P4V gui i am getting Error,
workspace has files opened.( p4 client -d user_workspace)
Client 'user_workspace' has files opened; use -f to force delete.
You can't delete a workspace with any changelists associated with it. Here's how to clear the changes or move them so you can delete the workspace:
Look at the pending changelist view
Find the changes associated with your workspace you want to delete (use the filter if there are too many to sort)
Either revert files in the changelists or shelve the files and associate the changelists with another workspace to clear them from the workspace to be deleted
Verify that the workspace is not locked, or unlock it if needed.
Now you should be able to delete the workspace.

How to check integration history of a Cl

how to check if any changelist of project A is integrated in project B? and also to get corresponding submitted Cl in project B. Please share any perforce command
It's worth pointing out the unit of integration in P4 is files, not changelists, so the p4 commands are mostly focused around telling you which files are integrated or not. You can, however, find out which changelists still have some files that need to be integrated - use the p4 interchanges command. The Perforce docs explain the syntax.
Assuming that you have a branch spec that describes the relationship of project A and project B called projAprojB, then you can get the outstanding changelists with:
p4 interchanges -b projAprojB
You can also get a similar view of outstanding changes in the P4V Merge/Integrate dialog box.
Alternatively, you can use the 'revision graph' in P4V to see the integrations performed on a given file; doing this on a file from the changelist you want to know about will give you the information to work out if it has been integrated into the other project and the changelist for that was.
If this doesn't suit your needs then your only option is to write a script, either with shell scripting using p4 or one of the APIs provided by Perforce

Proper way to ignore source files during Perforce integration

In my primary branch there is a change list with 10 files that I'm trying to integrate into a development branch. All of the outstanding files in the change list should be ignored, and not branched into the target.
What are the steps to do the integration so that Perforce does not create the files in the target branch, and ignores the change list files for all future integrations?
I originally did an integration with -Dt, and then reverted the 10 files I did not want to be created in the target branch. After this, Perforce continues to try and re-integrate these files to the target.
Maybe this is part of the issue or irrelevant, but the source files are not textual edits, but updates to the filetype fields
Integrate the file, then do 'accept yours' when you are resolving. That tells the server that you want to explicitly ignore the change from the other branch, and the server won't subsequently include that change in future integrations.
This worked for me:
p4 integrate -Rb -Rd -b <branch>
Then in P4V, Resolve --> Accept Target.
See here for information on the -Rb and -Rd options.

Integrated files disappear from a pending changelist at p4v

Our user performed an integration between branches.
Integrated files were placed in a pending changelist but they are invisible when I look
at this changelist in p4v.
I can see them when I look on this changelist when I connected to another workspace, I can also see then in Eclipse.
When I choose to Resolve conflicts on this changelist it works too, but
when I try to submit the changes, there is nothing there.
After I installed a new version of p4v, the problematic pending
changelist appeared with a question mark (red triangle with a question
mark).
Any Ideas?
Thanks.
Answer from Perforce support:
This may be a working and locks out of sync
issue. Can you run the following server command:
p4d -r $P4ROOT -xf 925
Where "$P4ROOT" is the location of the db.* files.
P4V.exe allows the user to specify a filter on his workspace. Perhaps the workspace had a filter applied, such that the GUI did not show the files, where the command line client and others (ie Eclipse) would not be privy to this filter and would show the files.
Another possibility is that the user was logged in under a workspace other than his default, and the files were checked out in his default workspace. It would be easy to then find these files in his default by looking at pending changelists for all users.

Resources