svn merge within idea trouble

Hey all,

So I think this is something we're not doing right, and the docs are not clear on it either, so I thought I'd post here and see what come out.

We use SVN. We often have 2-3 branches going at the same time. When a branch is released (deployed and code frozen) we want to merge it into the trunk. To do that the only option I've seen is integrate, but integrate doesn't do what I want it to do, it seems to remove files that shouldn't be removed from the trunk. People are generally developing in the trunk as well.

What we'd like to do is simply take the changes from the branch's head, and merge them into the trunk... what's the trick? on command line svn we do svn merge head:head URL, how is this done in idea I don't see an svn merge command anywhere. Reason I want to do it in idea and not svn command line is so that we can see any conflicts and resolve them.

Thanks, I'm sure this is likely going to be a lame and duh moment, but hey I had to ask.

R

0
19 comments
Avatar
Permanently deleted user

Hello Robert,

Generally, there are two ways of merging back to trunk:
- integrate project (merging all differencies between branches/URLs)
- integrate to trunk step-by-step, revision by revision, through Changes | Repository | Subversion | Integrate To Branch context menu.

Second way is more predictable for big projects, as far as I understand, but it requires more manual work.
This way you can control results and resolve conflicts dealing with fewer portions of changes, and changes each time are logically connected.

Concerning the first way - in Subversion 1.5 command line (if your repository is 1.5 version too) you can specify --reintegrate option, that will automatically take for merge only revisions that originally was created in source branch. (Please check Subversion documentation for details)
Unfortunately, this option was not added to Integrate Project jet.

I am not sure about what to answer about files "removed by integration". It would be great to get some detailed description.

It is possible to do merge from command line, and deal with conflicts resolving in IDEA: IDEA would correctly show "conflict" status, and use can use context menu: Subversion | Resolve text conflict

0
Avatar
Permanently deleted user

Hi Irina, thanks for answering. I am looking at your second option and I don't see a way to integrate to branch... from the Changes pane. I clicked on Changes, then clicked on the Repository tab, I clicked refresh but that shows me the changes in the trunk right now (which is where the project is opened to)... then I looked for integrate to branch and I don't see it anywhere.

Can you clarify please?

Thanks
R

0
Avatar
Permanently deleted user

Never mind. If I reverse it and open the branch project, look at changes for x amount of time, then I can integrate to branch.

Thanks, I think that is what we wanted.

Might want to add that to the docs, because I certainly didn't step on it while reading the docs and did a search on merge or integrate. This is and incredibly useful feature!

R

Edited by: Robert S. Sfeir on Sep 3, 2008 1:34 PM

0
Avatar
Permanently deleted user

I have having a bit of trouble with this at the moment. Based on Robert's post, I am working in my branch project. Whenever I attempt to "Integrate to Branch" back to the trunk, all of the files that are part of the given change list end up up red and flagged as skipped. In this case, some new development occurred in the branch and so the majority of what needs to be merged back into the trunk are new files. Anyone have any tips on getting this to work with IntelliJ? For the record I am using 8.0M1.

0
Avatar
Permanently deleted user

I'm having the same problem since upgrading to 8.0.  I have had to resort to using 'create patch' switching to the trunk, and applying the patch.  Very annoying, pls post if someone knows what is going wrong with intgrating from the branch back to the trunk.  Integrating from trunk to branch seems to work ok.

0
Avatar
Permanently deleted user

Hello Matthew,

I think you've a problem with settings.
Your target local folder does not match Url from which merge is done (Url is calculated by IDEA from its branches settings) - so Subversion could not merge.

Please check what you have in "Configure branches", and what path you set for target working copy.

I'll give an example of how it should be:

For instance, I have Subversion working copy with WC root: C:\Projects\trunk; which is IDEA Project base directory;
it was checked out from Url: "REPO/PROJECT/TRUNK".
And I have another working copy, checked out from Url: REPO/PROJECT/BRANCHES/BRANCH_1.0.
And that branch working copy path is: C:\Projects\branch.

So, say I want to merge revision #222 done in trunk into branch # 1.0.

In trunk project, I should first go to Changes | Repository, and in revision list context menu, do Subversion | Configure Branches.
There I should
- set trunk = "REPO/PROJECT/TRUNK"
- set branch location path: "REPO/PROJECT/BRANCHES" - the Url of remote directory, that contain branches.

Then I should select revision #222 in the list, choose Subversion | Integrate To Branch,
select branch in a popup (first I would select "BRANCHES..." and then "BRANCH_1.0"; if I don't see any branches, I can use "Refresh Branches" item, and the list would appear);

and in options dialog I should set "C:\Projects\branch" as target working copy path.

0
Avatar
Permanently deleted user

Hi,

In defense of Michael, I have to say that even with IDEA 8 the svn merge support is poor.  The interface to merge is very hard to understand.  Source 1 and Source 2 really mean nothing if we're merging into the local directory you've already checked out.  Typically when you merge with subversion you merge into the local directory.  This while Source 1 and Source 2 is confusing and if you look at the documentation all we get is:

"

  1.                  In the Source 1 and Source 2 fields, specify the sources to be merged, and the desired                  revision:                  
    • In the text fields, type repository locations for both                      sources, or click the browse button to open the Select                      Repository Location dialog box.
    • Specify the revisions to be integrated; if you click the Specified radio-button, type revision number, or click the browse                      button and select the desired revision from the Changes                      Browser.

"

What does this mean?  Are we taking 2 source paths and integrating them into the current project?  Is the first source path going into source 2?  Are we summing source 1 plus source 2?  If so then why is it that switching sources (source 1 to 2 and 2 to 1) produce different results?

Merging seems to always override files it's not supposed to, and it seems to always want to restore deleted files although clearly it was deleted in the location we want to merge TO. 


Further, IDEA's amazing refactoring features don't integrate well with what happens after you've refactored a project and now you want to merge.  For example:

If I go through the exercise of refactoring packages in trunk while the team is working in branch.  Once we're done working in branch and we want to merge changes, try it, IDEA causes a massive mess, putting a bunch of files in the wrong places, not merging files because it can't find the original or anything.  So it's a big mess.  Now perhaps it's not IDEA's job to do that, but with svn 1.5's reintegrate, certainly some of these things are doable.

My team has completely stopped doing merges with IDEA, and we simply go to the command line, generate a report of changes, figure out which files were changed, and then either reintegrate when possible, or generate diffs and merge the files manually.  We simply don't trust IDEA with that process at all.

The documentation on svn and merging is poor at best, and quite honestly unusable.

I'm a HUGE long time fan of IDEA and JetBrains, and I think just about everything else in IDEA 8 is great (the new preference panel excepted) but SVN support has gone quickly down hill and is a total disappointment.

R

0

I agree with everything said here - we have also attempted to use the SVN merge functionality on several occasions (even after some assistance from Jetbrains members), and I've posted on here about it in the past, but we no longer even attempt to use it - it just gets stuff wrong,  and the merge is wrong.  More than likely we are probably telling it to do the merge wrong, but the fact that we cant figure out how to make it work means that its terrible to use.

Furthemore, its not at all obvious which changes have been merged, and which haven't, since everything is always seems to be tagged as "not-yet-merged".

I've also created JIRA issues about IDEA and SVN when renaming / moving packages around - this is also something that Ive stopped doing now - stuff just gets broken when you do this.
I've damaged my repo / working copies enough that its just not worth the risk anymore so I do the moves from the command line or using Tortoise.


The merge process should be clear, simple, and understandable.


I have a project view on trunk, I should be able to select an arbitrary branch, and click "Merge into working copy" (i.e. trunk).

The inverse should be true if Im working out on a long running branch, and I want to bring my branch up to the latest trunk revision.

Having the dual selection of "from" and "to" is a little weird. I'm working on one branch/trunk in my IDEA project.  I want to get changes from somewhere else in to my current working copy - rarely, if ever, I will want to put changes from my working copy branch in to anywhere else - thats a fire and forget process that just seems riddled with potential merge errors, compilation problems and test failures. It should be as simple as 1.) Select source branch, 2.) select revisions (or better if they were auto-selected based on the new 1.5 merge support), 3.) click merge.  Done.
IDEA already knows what source URL my current working copy is based on.

I'm sure the functionality is there, but we cant find it, and we no longer waste time trying to roll back bad merges - we just do it outside the branch merge functionality.

0
Avatar
Permanently deleted user

The problem I have is only when I'm trying to integrate from the branch back to the trunk.  It is inconsistent, sometimes it works, and sometimes it doesn't.  Integrating from the trunk to the branch seems to work fine as long as I have my 'configure branches' set up correctly.

What I was trying to do was take a branch changelist, and integrate it to the trunk, so I clicked on the changelist, and selected 'integrate to branch' and pointed it at the trunk.  On one change list it worked fine, on the other, it had the source path wrong.

I want to integrate from /branches/1_24-branch -> /trunk

It was trying to integrate from /branches -> /trunk which did not work.  What is puzzling is that it does seem to work fine for some changelists and not for others.

-Lkb

0
Avatar
Permanently deleted user

Thank you all for messages, it will help to improve our merge integration and make it more understandable.=)

I agree that we should
- add reintegrate option into "Integrate Directory/Project"
- add merge into working copy action
- rework some UI related to merge, since there is indeed a problem for users

Concerning "Integrate Directory/Project" action,
right now it just imitates one of "svn merge" variants.
So I don't inderstand why subversion help is clear and IDEA is not, they both operate "source1" and "source2" terms.

> svn help merge

merge: Apply the differences between two sources to a working copy path.
usage: 1. merge sourceURL1[@N] sourceURL2[@M] [WCPATH]
       2. merge
sourceWCPATH1@N sourceWCPATH2@M [WCPATH]
       3. merge [-c M[,N...] | -r N:M ...] SOURCE[@REV] [WCPATH]

  1. In the first form, the source URLs are specified at revisions
     N and M.  These are the two sources to be compared.  The revisions
     default to HEAD if omitted.

...

Concerning merge status highlighting, please note it requires Subversion 1.5 version both in your working copy and on the server.
Bug reports are welcome.
For merge highlighting, I need information about settings, branches (what is copied from where), and "svn propget -R" result in target WC.

0

irengrig wrote:

Thank you all for messages, it will help to improve our merge integration and make it more understandable.=)


I agree that we should
- add reintegrate option into "Integrate Directory/Project"
- add merge into working copy action
- rework some UI related to merge, since there is indeed a problem for users


Concerning "Integrate Directory/Project" action,
right now it just imitates one of "svn merge" variants.
So I don't inderstand why subversion help is clear and IDEA is not, they both operate "source1" and "source2" terms.
...
       3. merge [-c M[,N...] | -r N:M ...] SOURCE[@REV] [WCPATH]


...

I think the confusion is that in 90% of cases, folks fall back to using the "3rd form."  For the workflow, see:  http://blog.red-bean.com/sussman/?p=92

I think the main issue (for me at least) is that I want my IDE to *hide* some of that complexity.  Sure, you can still use the two-url merge style, but that's obviously error prone and confusing as evinced by the previous posts.

The 1.5 style single-URL merging is essentially:

<update/commit the branch>

svn merge trunkURL

svn switch trunkURL

svn merge --reintegrate branchURL

svn commit

It's never a good situation when the IDE forces you into a *more* complex model than using the CL tool...  

Regards,

ian

0
Avatar
Permanently deleted user

I resolved my issue.  by default intellij had added /branches and /tags to the list of branch options.  Removing those so that the only options i have in the configure branches dialog are the trunk and the one branch I'm working with has made the right-click 'integrate to branch' feature on a particular changelist in the changes view work consistently.

0

Ok, how about this:

The two most common use cases:

1. I'm working on a long running branch, and I'd like to update my branch with changes from the trunk/main-line on a frequent basis to keep up to date.

I'd like a simple GUI (possibly all the other options are hidden away in an advanced tab/expanded mode).
IDEA knows what branch my working copy is based on.
I'd like a "Merge recent changes from trunk" button. (IDEA knows I'm on a branch)
If using SVN 1.5, this should be almost magical, and should only bring in changes since I last ran this operation.
If I have not run this operation before, IDEA should be able to figure out when I branched from trunk, and offer to bring me up to date with all changes from branch point to trunk/HEAD

2. I've made a patch/release (or finished a long running branch) and I'd like to get all changes in to trunk/main-line

I always do this merge in to a working copy based on trunk. This allows me to compile and test after the merge to ensure I havent broken anything and then commit.
So, I checkout a copy of trunk in to a new project, and then click on "Merge branch in to trunk" (IDEA knows I'm on trunk..).
IDEA pops up a list of the URLs of the most recent branches in the repo (it knows this since I told IDEA what remote repo directory my branches are stored in - most often "branches") (say 5 are shown - all others available on request via a click of a button).  Im asking for 5 since we branch for every release, and we release often. Many other SVN operations in IDEA take far too long since they try and pull the entire history in in one go, rather than a paging mechanism whereby history/info is obtained in chunks, but I'm straying from the point here.
I select the branch that I want to merge in to trunk.
I click "Merge"
Again, if using SVN 1.5, magic happens - IDEA merges all changes that were done on the branch from the branch point up to the HEAD revision on the branch.
If a previous merge has been done from the branch in to trunk, then IDEA only merges changes since the last merge.


For safety (and to rebuild confidence amongst the IDEA developers) before either operation proceeds, how about a summary dialog stating the exact operations that IDEA is about to perform, along with svn commands.


Note that there's no real need for separate merge/branch functionality in IDEA (for SVN 1.5) since its all embedded in the above operations.
If I'm not using 1.5 throughout, then IDEA can simply popup a dialog stating so, and then ask for the revisions to merge.
It would be nice if IDEA remembered what revisions I selected (for non 1.5 operations), so that for subsequent operations (especially use case #1) it can prompt me.

I asked the development team here if they have ever done any other branch/merge operations, and these two cases cover most of them (the only other being a branch-branch merge (i.e. not involving trunk), but in my experience thats a CM nightmare waiting to happen, so we dont do it).  I've used and supported branch strategies for large development teams in both Rational Clearcase and SVN - these are the most common branch merge operations I've encountered. Now, Im sure that others have specific needs to merge from branch A in to branch B etc., so provide this functionality in an advanced GUI where all the From/To URLs and revisions can be configured, but please keep the common cases simple.

Regards

Nick

0
Avatar
Permanently deleted user

+1


1. I'm working on a long running branch, and I'd like to update my branch with changes from the trunk/main-line on a frequent basis to keep up to date.



 


2. I've made a patch/release (or finished a long running branch) and I'd like to get all changes in to trunk/main-line


I agree these are the two most common.  There should some dialog/option that makes it clear this is what I'm doing and just do it.  All other options should be "advanced". 

Or even a menu option under Version Control "Merge from trunk" and/or "Merge to trunk" -- that are there only if I'm working in a branch.


0
Avatar
Permanently deleted user

+1 Also

In addition, since these are the two activities I do most often, and I can't come close to figuring out how IDEA performs these operations, can we get clear instructions on how to perform these two tasks using version 8.0 of the IDE?

For example, to update my branch to pick up the latest changes in the trunk, I can simply:
svn merge http://my.project.url/trunk

But, I don't know how to do this in IDEA.

Thanks.

0
Avatar
Permanently deleted user

+1

Was there ever an answer to the question

can we get clear instructions on how to perform these two tasks using version 8.0 of the IDE?

0
Avatar
Permanently deleted user

+1   I've added IDEA-22730 which requests better support for Nick's use cases, including the svn merge --reintegrate option. Add your votes!



0
Avatar
Permanently deleted user

In the cold weather, the UGG boots are considered as the best shoes.More and more people like wearing the UGG boots such as the http://sell-ugg.com/UGG-Classic-Metallic-5812/c9/index.html.With its development ,the UGG boots have lauched different kinds of boots into the fashion market,including the http://uggboots-euro.com/UGG-Classic-Short-Boots/c3/index.html and the http://uggboots-euro.com/UGG-Women%27s-ighkoo/c23/index.html.However,in the fashion world,if you want to be more attractive and elegant,the beautiful shoes are not enough.You have to choose the best stylish handbag to match your shoes.Therefor,the designer replica handbags are very necessary.If you want to buy the best designer cheap handbags,i would like to introduce two famous brand handbags to you.I think there must be one handbag is your favorite.One is the famous brand http://www.famousbrandbag.com/Versace/c40/index.html,the other is the Ferragamo Handbags.Both of them are the famous brand in the world.Their quality are very good.

---
Original message URL: http://www.jetbrains.net/devnet/message/5254893#5254893

0

Please sign in to leave a comment.