Perforce: Integrate into earlier revision of target branch - perforce-integrate

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.

Related

How to download files from a specific git pull request?

I have a Pull Request on an azure devops remote git repository in format like this https://project-domain/project-name/_git/repo-name/pullrequest/xxxxx
Is there an easy way to just download the files which are part of this pull request without having to clone the entire repository?
If i have to use commit ids which are part of this pull request, that's alright with me. please let me know if anyone has done this before
In Azure DevOps, when viewing a Pull Request, on the Files tab, next to each file is a menu with three dots (...) with an option for "Download". You can do that for any file you wish to download.
However, it's very important to realize that the file you are downloading is the file from the point of view of the source branch. If the source branch is not up to date with the target branch, then you might not be downloading the final version of that file that will exist at the time the PR is completed. If you wish to download the future version of the file after PR is completed, then you should select the three dots (...) button next to the Complete button, and select "View Merge Commit". From there you can download each of the files the same way as previously described, and now you'll get the version of the files that would exist if you completed the PR right now. Obviously if that file gets modified on the target branch between now and when the PR is actually completed, the file would change yet again.
Side note, if you have many files in the PR that you wish to download, as far as I know you cannot download them all together in one shot from the UI, though you can probably automate it using the API (or by cloning and doing a diff which you said you wanted to avoid).

Perforce integrate files when target has been moved/renamed

How to integrate a branch back to trunk when files in the trunk have been moved or renamed while files in the branch have been changed?
The question Integrating moved files in perforce explains similar issue in reverse order, i.e. integrating trunk into branch where files have been moved. However, the answer does not help.
I am unable to use p4 integrate -3 in my scenario, and perforce always asks to specify -D or -Dt flag, which if specified, always creates new files instead of merging them into the existing moved files. Note that I am using latest Perforce client 2014.1.
If at all possible I'd recommend upgrading your server; I'm inferring from the fact that you're unable to use "p4 integrate -3" that you're on a fairly old release. With the latest server release the "integrate -3" functionality is enabled by default, without having to use an extra flag or anything, per this blog post:
http://www.perforce.com/blog/130806/quality-life-improvements-renamed-files
Having this functionality is a pretty big deal since it makes the scenario you describe "just work" -- all you have to do is integrate and resolve as normal.
Without that functionality, you have to do some work -- either modify a branchspec to line the current versions of the files up and use that to integrate the content, or manually recreate the same rename operations in the branch so that the files line up normally.
Note that this functionality requires a new server in addition to a new client, so a 2014.1 client on its own (with an old server) won't do the trick -- a server upgrade is necessary. If you're on an old release you'll need to do a restore from checkpoint as part of the upgrade, per the instructions in the administrator's guide:
http://www.perforce.com/perforce/doc.current/manuals/p4sag/chapter.install.html#d0e1167
but I would recommend you don't let that deter you; you'll be getting a lot of improvements. :)

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.

How do you revert a file to a revision within an integration in 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.

subversion merge trunk -> branch: trunk changes not recognized

I'm in a pickle. I'm using SVN 1.5 at Beanstalk and Tortoise SVN client 1.6.11 x64 on Windows 7.
I'm developing on a branch and have been merging changes from the Trunk into my branch at least once a week. I recently noticed some things weren't working as trunk changes didn't make it into my branch. When I try to do a merge, Tortoise acts as though there are no changes in the trunk to merge. The Test Merge shows no files being added or updated.
I tried to merge my branch back to the trunk, but got a message saying that my branch wasn't up to date and told me to merge a range of revisions from the trunk.
I really don't want to do this by hand. How can I tell Tortoise and/or SVN that my branch is not up to date?
I still don't know what caused this to happen, but I did manage a work around. I instead did a backwards "reintegrate a branch into the trunk". This seemed to work good enough, but not perfect.

Resources