How do you revert a file to a revision within an integration in Perforce? - perforce

I have two branches, let's call them mainline and dev1. I regularly integrate a file from mainline to dev1. The last-but-one time I integrated the file, it was at revision 3 in mainline. The last time, it was at revision 5.
Now for mysterious reasons lost to the sands of time, I want to work in dev1 with revision 4 of the file from mainline. Is that possible?
I can't integrate it across as P4V complains that all revisions have already been integrated.
I've tried right-click->get this revision on the revision graph, but that only updates which version of the file I have in mainline, not in dev1.

You can force an integration regardless of the integration history. On the Integrate options dialog there is a button labeled "Advanced Options".
On the Advanced Options dialog, check the option to "Force integration on all revisions, disregarding integration history (-f)". This will allow you to get revision 4 of that file from mainline into dev1.

Related

Perforce: Integrate into earlier revision of target branch

usually perforce integration is to merge code from some revision of source branch to LATEST revision of target branch.
Is there a way to merge code to a specific earlier revision of target branch?
Of course, it's still needed to sync to latest revision for submitting the code.
I think you can sync to the revision you want to integrate to, then run an integrate -h (have revision). Should be one of the checkboxes in the integrate dialog. Or just do it from commandline.
Then once you've done the integrate and resolve, you'll likely have a sync to head and another resolve to go through, but that ought to get you were you want to go.

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

Missing perforce reconcile command in p4 tool

I downloaded latest p4 tool, but it missing reconcile command:
$ p4 -V
Perforce - The Fast Software Configuration Management System.
Copyright 1995-2012 Perforce Software. All rights reserved.
This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/)
See 'p4 help legal' for full OpenSSL license information
Version of OpenSSL Libraries: OpenSSL 1.0.1c 10 May 2012
Rev. P4/LINUX26X86_64/2012.2/536738 (2012/10/16).
here is list of supported commands (I removed some lines):
$ p4 help commands
Perforce client commands:
add Open a new file to add it to the depot
admin Perform administrative operations on the server
annotate Print file lines along with their revisions
archive Archive obsolete revisions to archive depots.
...
pull Cause satellite to pull journal or file data from master
rename Explains how to rename files
reopen Change the type or changelist number of an opened file
replicate Poll for journal changes and apply to another server
resolve Merge open files with other revisions or files
resolved Show files that have been merged but not submitted
restore Restore archived revisions to their original location.
revert Discard changes from an opened file
review List and track changelists (for the review daemon)
reviews Show what users are subscribed to review files
set Set variables in the registry (Windows only)
shelve Store files from a pending changelist into the depot
sizes Display size information for files in the depot
submit Submit open files to the depot
sync Synchronize the client with its view of the depot
tag Tag files with a label
tickets Display list of session tickets for this user
...
workspaces Display list of known clients
where Show how file names map through the client view
Commands reconcile and status are missing. Server version is 2010.2/347035 and it can't be upgraded since it located at customer side and manages hundreds depots.
From my point of view - reconcile command should be completely client-side, so it shouldn't depend on server version. Or I'm wrong? What is the reason why these commands are missing?
EDIT: In P4V client I'm able to run similar command Reconcile offline work and it works on our servers.
Some Perforce features only require an updated server; some require an updated client; some require both. Each new feature's requirements are described in the release notes here:
http://www.perforce.com/perforce/doc.current/user/relnotes.txt
The release notes use a coding mechanism, where a new feature is marked with 1, 2, or 3 asterisks. As noted in the release notes:
* -- requires new p4 client program
** -- requires new p4d server program
*** -- requires new p4p proxy program
So, in the case of reconcile, the release notes list it as follows:
#367753 (Bug #68, #889, #989) ** *
A new command 'p4 reconcile' allows users to reconcile client
with offline work. The command ...
Note that this line shows "** *" at the end; namely, both a new client and a new server are required. The 367753 at the front of the note indicates that both the server and client must be at version 367753 or later.
So that's how you can tell whether you need a new client, or a new server, or both, for a particular Perforce feature.
That's because your P4 version is too old. reconcile was introduced in a 2012 release.
http://www.perforce.com/blog/120126/new-20121-p4reconcile-p4status
I believe you need both the server and the client side to support a new feature - I could be wrong, but since you have a later client, and I have experienced similar "this should just be a client thing" that require the server to support it as well (it was 4 years since I used perforce, so excuse me if I don't remember exactly which feature it was that didn't work because although the client supported it, the server didnt)

Reintegrate Partially Reverted Changes in Perforce

I have these branches:
//mainline
//branch1
//branch2
branch1 is a large set of changes to mainline.
branch2 was created from:
Integrated from mainline
Integrated from branch1 to get the large changes
The files were resolved
Many files were reverted because I just wanted a subset of the changes from branch1
The changes were submitted
Eventually branch2 was integrated back into mainline.
branch2 was deleted
Now I need to integrate branch1 into mainline. When I do the integrate in p4v, it misses many of the files because it thinks they were already integrated from branch2 (even though I reverted them). If I "force" integration it thinks every single file (of 8000+) has changed.
How do I make perforce integrate all the changes in branch1?
You can choose the range that you want to integrate, in combination with the "force" integration option. You need to expand the "Limit the range of the integration" section in the Integrate dialog.

What are the advantages/disadvantages of perforce “jobs” over an external bug tracking system?

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.

Resources