I sometimes forget to commit offline work in perforce as you cannot see them in the pending changelist.
Does anyone know how to force user to put offline work into pending
list or can it be done automatically?
If I were going to force reconcile to be run before submit I would create a custom submit dialog in P4V. The API is detailed here:
http://www.perforce.com/perforce/doc.current/manuals/p4jsapi/p4jsapi.pdf
Try to get yourself in the habit of reconciling even when you know exactly which files you worked on and they're already in a changelist.
Personally, I'm currently working with an IDE that claims to integrate with Perforce but in fact does not actually do anything, so I have to reconcile before any changes are picked up. I remember to scan for changes because it's indispensable.
Related
So, to give some context. Recently i had to delete the whole project from my personal computer for some reasons. Now i want to download the whole project back onto my PC but don't know how. I assume that the clone button would do that (since that's what it does on Git) but seems to not be the case. I then tried to force update all the files thinking it would download the missing ones. It kinda works, i think but it takes awfully long. It took around 16 hours to update a folder that was about 20GB in size.
The project in question is a UE4 project, in case that's important
Now the question. How can i, most easily, download the whole project from perforce onto my PC? Thank you for your help in advance!
In the future, you can simplify this by using Perforce's "remove from workspace" or p4 sync #none command to delete the project from your PC. If you use Perforce's commands to clean up the workspace, it will:
not delete anything that isn't backed up to Perforce (i.e. files you didn't add to Perforce will be safe)
keep track of what you deleted (so the next time you do a normal "sync" it will just put it all back, without the force flag)
In the situation you found yourself in, an option apart from "force download" is the p4 clean command, which will reset your workspace's state to whatever you last synced to. Note that this will not necessarily preserve any local changes, but if you delete the entire workspace root this isn't a concern.
The time it takes to re-sync a folder is largely a function of your network speed to the Perforce server, but in some cases can be improved by parallelization (I believe P4V will do this automatically, and it's easy to enable via the command line, but if you're syncing via the UE4 plugin this may not be the case). https://community.perforce.com/s/article/9064
So, I created a new file and copied it over the one in the workspace. Then I selected "reconcile offline work" from the context menu of the directory containing the file, after I've updated the directory and made sure the workspace has the new version of the file - but Perforce says that no files have changed.
There is one more weirdness in this: Despite having the latest version of the program, both the p4 and p4v clients, perhaps, because of the server version, I don't have reconcile command available (I don't know what version is the server, and don't know how to find it out).
So, it would help if you could tell how to do the same thing as reconcile, while not having this command (it seems to be a newish addition, but I cannot imagine a workflow that doesn't require you to use it, or something that does the same thing). The VCS is practically useless if it cannot figure out on its own what files had changed since the last version...
If your server is older, and doesn't support reconcile, there are other ways to accomplish these tasks. Start here for all the details: http://answers.perforce.com/articles/KB_Article/Working-Disconnected-From-The-Perforce-Server
If you added a file to Perforce and copied it to another workspace you will need "p4 sync -k //depot/path/to/file" to reflect the change.
I am trying to understand what perforce “jobs” provide over an external bug tracking system and just putting the bug ID in the check-in comment.
I was hoping that "job" could help with How do I see if a branch contains a bug fix in Perforce?
Nothing. Take it from someone who endured years of aggravation working with the Perforce/FogBugz integration mechanisms (the latest being the Perforce Defect Tracking Gateway which uses Perforce jobs as part of the integration). They provide very little return on a significant investment in time setting them up and then trying to figure what went wrong when they stop working (which is often).
I now do just what you suggest. I simply put the FogBugz case number in the Perforce check-in comment, then add that Perforce changelist number to the FogBugz case upon resolving it. As simple and reliable as it gets.
We put the issue ID in the comment but also have a Perforce trigger that updates the issue database (JIRA) with the changelist number. During the next build the automated build process also updates the issue with the actual build number.
A very nice part of this implantation is that the trigger gives an error if the issue is not marked as in progress or the developer doing the check-in is not working on the issue. Therefore it is uncommon for a miss-typed issues ID number to get past the checks.
As a bugtracker, Perforce jobs are somewhat basic. They can be created and modified with the P4V GUI client or using p4 job and p4 jobs on the command line.
The idea is for them to serve as a link (a connector as Perforce calls it or an interface as a developer might look at it) to a third party issue management system and basically provide the information which changelists were committed for which issue. The issue management system can then tap into this information using the Perforce Defect Tracking Gateway (PDF documentation here) and generate bugfix charts or statistics for management or whatever.
We are using this with Jira in both directions with some success. The basics worked pretty much straight out of the box, more advanced use cases (such as e.g. which bugs were fixes in which release ?) or integration with other bugtrackers may require modification of the Perforce job model.
One of the advantages over tracking changelist and issue numbers using commit comments is that you can select the job/issue from a dropdown box when you commit a changelist using P4V.
In practice, developers tend to forget to add the job information when they commit a changelist. This can be enforced using Perforce triggers.
I had a pending changelist in my workspace.
By mistake I reverted one of the files by reverting to depot. Eclipse wiped off the local history. I am not sure if perforce keeps any history for pending changelists.
Is it possible to recover such file?
The simple answer (to my knowledge) is "no". Perforce doesn't keep a history for (non-submitted) changelists.
Unless you happen to be on an operating system that offers snapshots (or your file-server does), you are out of luck.
Another thing you might try for the future is to get in the habit (e.g., by defining a local alias) of always using 'p4 revert -a'. It would be nice if 'p4 revert -a' had been the default, and you had needed to pass a special flag to indicate that you wanted to revert a file that you had locally changed, but that's not the way it currently is, unfortunately.
I was also facing the same issue. my workspace over written from cvs by mistake and I lost all the changes in some of my local files.I found that in eclipse UI resource history has shown as blank for the files but the history file created by the eclipse still exist in *$eclipse-workspace.metadata.plugins\org.eclipse.core.resources.history* folder. Use any text editor like notepad++ to search for the name of your file in all the folders and you can easily recover the file from there. I just did the same to recover my files.
If Visual studio is the IDE undo under edit menu recovers the files
Drive snapshots are your best bet to prevent this in the future. For my personal non important projects, I use a Git for checkins; but dropbox for easy multi-machine work and snapshotting of non checked in code (even to local repo)
The only solution is having backups/snapshots. If you're in a corporate environment, contact your IT department.
If you are in a unix corporate environment, you might have a ~/.snapshot directory that keeps hourly snapshots of all your files for the last few days.
I have made some changes in one perforce client, but haven't submitted them. I want to propagate these changes to another perforce client, without submitting the changes in the first client.
Is it possible? If yes how?
Thanks
You cannot do this from within Perforce itself. You will need to perform a manual process:
sync and resolve any conflicts with the changes on Client A
sync Client B
check out target files on Client B
copy files from Client A to Client B
This process could be automated by using commands like p4 changes and p4 describe and OS tools to parse the output (like for in DOS), but this would be overkill in most cases.
check out the new shelving feature in the perforce 9.2 release (currently available in beta)- you can cache your modified files on the server, without having to check them in as a versioned change.
http://blog.perforce.com/blog/?p=1872
Although I didn't work with git-p4, the answer to this question seems to refer to your use case as well: git-p4 and pulling from other repos