How to revert merging of two branches in perforce p4v client? - perforce

Let's assume this scenario. We have 3 branches a,b,c in our perforce depot. First of all, I merged branch "a" into branch "c". Then I merged branch "b" into branch "c". Then I submitted both the merges.
After that, I came to know that the branch "a" was a faulty branch with errors. That was a mistake to merge the branch "a" with branch "c". I was supposed to merge only branch "b" with branch "c".
We don't use command line tool. We are using p4v GUI client. I have no clue how to revert those two merges and then merge the branch "b" only with branch "c".
Please help me get out of here with some idea. Thanks in advance.
Let me know if anything is not clear.

You can select the Submitted changelist in P4V from the merge of a -> c and right-click and choose 'Rollback'.
For more information about how to undo an integration via the Rollback feature in Perforce, go here:
http://answers.perforce.com/articles/KB_Article/How-To-Rollback-An-Integration
REFERENCES
http://answers.perforce.com/articles/KB_Article/Backing-Out-Submitted-Changelists/

Related

How do I select the common base file manually for P4Merge?

I am trying to merge a file.
I have the main branch and another branch B that was branched from main.
Both branches have changes. The main branch was merged to B at some point; but the merge on B was undid directly afterwards. After some more changes on both branches I'm trying to merge again but perforce selects the incorrect base file revision from the main branch.
I need to be able to select the common base file manually so that it will do the merge correctly. Unfortunately I was unable to find any way of doing this. If anyone knows how to resolve this, that would be much appreciated.
If the merge was undone via the p4 undo command, you should be able to redo it with a regular merge operation by setting the dm.integ.undo configurable:
(p4 help undoc)
dm.integ.undo 0 Enable re-integration of undone changes
With that configurable enabled, the "credit" granted by each integration is considered to be nullified by an "undo" operation, making each previously merged revision eligible for a merge as if it had never been merged previously. (The default behavior is for the undo to be considered the same as an edit, so that it's combined with unmerged changes, but previously merged changes aren't re-merged.)
If that's not an option, the best solution is to use the -f flag. Specify the exact range of changes you want to merge, along with the -f flag, and the revision immediately before that range will be used as the base. E.g.:
p4 integ -f main/...#100,400 B/...
will use main/...#99 as the base for the resolve(s).

How to fully sync two branches in perforce

I want to overwrite all files in branch B with another branch A. The use case is:
I branched B from A
Made some changes on B
Made other changes on A
I want B to be exactly the same as A, all changes on B are discarded
I want all files on B to be exactly the same as A, all additional changes on B are discarded (updated)
Is these a quick way to achieve this?
p4 branch would lead to a new branch C. And p4 integrate would keep the changes on B.
One possible way is, remove all files of B, and copy all files of A to B, and then run p4 reconcile on B. It's a little complicated. Anyone know a quick way? Thanks in advance.
'p4 copy' will copy files from one branch to another:
https://www.perforce.com/perforce/r16.1/manuals/cmdref/p4_copy.html
The previous history of branch B will still remain.
If you wish for it to look as if branch B was always an exact copy of branch A, then you may wish to obliterate it and re-create it.
Note that 'p4 obliterate' completely removes data from Perforce, so should be used with care and backups should be taken before running it.
More information about this command is here:
https://www.perforce.com/perforce/r16.1/manuals/cmdref/p4_obliterate.html
Hope this helps,
Jen.

How tortoise SVN do the Merge?Help Required

I am having a task of SVN Merge. But i am not sure hows SVN perform it.
Details:
we have Trunk & On Revision 99 we cut a branch called "code_2011".
Two different group of developer are working one on Trunk, another on branch.
Respective developer are committing their code.
Now both Trunk and branch has changed.
Now After code freeze we have Trunk on revision 200 and Branch on 299.
Now we want to merge the code on Trunk.
Both repositories are clean, now i right clicked on Trunk folder and clicked merge. but i am unable to understand the terminologies start-URl & Revision then End-URL & Revision. so that i can have final code from both repository on Trunk with all revision history stuff.
Could somebody Tell me how its done. & Is it different when i merge the from Trunk to Branch.
Thanks
It's not logically different when you merge from branch to trunk or vice-verse.
Follow these steps for merging code from branch to trunk (Basic merging)-
Checkout the working copy of the trunk (Destination, where the merge is to be done).
Right Click on the Trunk and select TortoiseSVN > Merge
select the First option "Merge a Range of revisions"
Select the Branch URL to merge from.
For Revision range to merge, click on show log. It will show you the complete change log of the branch. Select all the revision that you want to merge (Ctrl+A) for all of them and select OK.
In the next dialog box, select Test Merge. It will show you the Test merge results, you can check if there are any conflicts or the merge is clean.
Finally, Merge.
This process will merge all the branch changes in your trunk's working copy (Local checkout). You need to commit the code after that.
Also, in case of conflicts, TortoiseSVN will automatically give you option to "Edit Conflicts" to resolve them using SVN Editor or leave them so they you can manually resolve them.
Hope this helps.
Cheers!
Post the merge activity, you can also see the from-branch history in log.
There is an option at the bottom of show-log window: stop on copy/rename. Just deselect it, you will get to see all the affected revisions.

Tortoise SVN Merge: Branch->Trunk with Revision History from both Tree

we cut branch from Trunk. Changes are done on both trees and committed. Now we want to merge branch to trunk with all the revision history from both. Is it possible?
Is manual merge is different from tortoise SVN merge say i have to do 3-4 files?
"Means i manually check the changes then do it on trunk and commit the trunk."
I earlier put a question regarding it but still confused.
Experts comment only.
Thx
You should be able to merge from your branch to trunk by simply right clicking on the target branch and selecting merge. Typically, a reintegrate merge will merge all changes from a branch back into the target branch. I have had failures with that in the past based on the version of svn, how merges have been done in the past, etc. At that point, I simply would do a 'Merge revision range' without specifying a revision. It then picked up the appropriate ranges to merge and successfully pulled those over to trunk.
Once the merge is done, you must commit the merges. Simply put, the merge operation completes on your local working copy. You will then have to commit the changes to your working copy in order for others to pick it up. I recommend doing merges on clean copies of branches/targets (meaning you have no outstanding changes on either branch). Also, make sure you commit any property changes as well.
Lastly, if you just want to merge a specific change, you can specify the revision in which the change was made instead of doing a full merge/reintegration.

Merge branch with trunk

Using TortoiseSVN, I need to take changes I've done in a branch and then merge them with trunk.
I am the only developer on this project, so I know trunk hasn't changed. I am learning SVN so that eventually my team can use it.
Basically, I want my trunk to look exactly like the branch.
In pre-svn world, I would just copy the files in my branch folder, delete the files in the trunk folder, and then copy branch into trunk.
In TortoiseSVN, I've tried Reintegrate a branch, Merge a range of revisions, and Merge two different trees. Nothing seems to actually change trunk. I've also tried branching on top of the trunk. This gives me an error, saying that the trunk already exists.
In your case:
Switch the working copy to the trunk (SVN Switch)
Merge the branch into the working copy (SVN Merge)
Make sure everything still compiles and works
Commit the working copy (the trunk)
Consider killing the branch
In a team environment I would suggest that you first merge the latest modifications from the trunk in your branch, make sure that everything compiles and works, then do the above steps (which will be trivial since you've already tested the changes).
Update
In step 5, I mention killing the branch. That's because once a branch from a feature is in the trunk, it should be considered as part of the trunk. In that case the branch should be killed so that no one keeps working on it. If major modifications are needed for that feature, you should create a new branch for that.
The only branches that I don't kill are maintenance and release branches, unless a particular release is no longer supported.
No matter what, you always have access to every revision so killing a branch is only used to prevent other developers from developing on a dead branch.
I think in TortoiseSVN 1.8.5, Merge | Merge two different trees should work. When you merge a branch/tag back to trunk, the trick is that the From URL is the trunk and the To is the tag/branch. Weird but true.
Source: Merging
For directories that not in your working copy but are in the tag/branch you may get conflict errors. Just accept the conflict and redo the merge.
First switch your working copy to the trunk.
Then do a merge range of revisions, from the branch to trunk.
Once this dialog is complete the differences will be pending changes in your working copy of trunk. You'll need to commit them just as if you manually made the changes on your working copy.
In my usage, its more typical to keep trunk running and spin branches off at the times of builds. So then the only merge I ever need to do is to get a bug fix out of trunk and put it on the latest build branch and re-release that branch. The easiest way for me to do this, since as you have found merging is clumsy at best. Is to keep the latest branch and the trunk checked out to my machine, and to quite literally copy the files from trunk to branch and check both in.
I am using TortoiseSVN 1.9.3, Build 27038.
Follow below steps in order to merge branch into trunk.
1) Right click on trunk working copy and select the below option.
2) In case of Branch Merging into trunk select option second as shown below and click next
3) In the From: field enter the full folder URL of the trunk. This may sound wrong, but remember that the trunk is the start point to which you want to add the branch changes.
In the To: field enter the full folder URL of the feature branch.
4) Click next and do the test merge
5) If test merge is successful then click on Merge button.
6) Once merge is successful then commit the changes on trunk.

Resources