Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
136 views
in Technique[技术] by (71.8m points)

Android Studio - unable to merge from SVN branch

We have decided to follow the process of creating a new SVN branch for every new feature that we add to our mobile app. The ultimate goal behind this is to preserve the history for every single code change (this doesn't happen when we manually copy project folders into SVN instead of creating & merging branches).

My problem is that so far I am unable to merge changes from one branch to another.

I have already referred the following posts without success:

Here is what I have tried so far:

I have two feature branches as can be seen below in Tortoise SVN:

enter image description here

I want to merge the changes in the branch Feature_A3 into branch Feature_A2. To do this, I am using the Merge from option in Android Studio's VCS from the A2 working copy:

enter image description here

It then asks me to select the branch to merge from (A3) or configure other branches:

enter image description here

I click on Configure Branches, just to show you the existing branch config:

enter image description here

As you can see, A2 is the Trunk and A3 is the Branch. Is this correct?

It then asks me what part of A3 I want to merge into A2. I select the /src directory (where the relevant changes are present):

enter image description here

It then generously gives me three different ways to perform the merge operation:

enter image description here

I select the third option as it directly gives me the changes I need to merge:

enter image description here

I click on Merge Selected and BAM!!! I get this error every time:

enter image description here

There is no clue as to what the "unresolved conflicts" or "skipped items" are. Why am I getting this error, and what should I do to merge the changes in A3 into A2 ??? Can someone please help ? All answers will be appreciated. Thanks ...

I have been following the official Intellij IDEA documentation below:

Please note that:

  • Currently I am using Subversion, not Git.

  • The directory structure of my local working copies is not exactly identical to that of the SVN repos. Could this be the cause of the error ?

THE ANSWER ...

Thanks to Peter Parker and especially Yoav Aharoni for their valuable feedback. As Yoav correctly pointed out, it was indeed the manner in which the branch locations folder was specified. It needs to be the folder containing the branches, not the branch folders themselves: And as Peter rightly said, checking "Include merged revisions" shows the merged history. I am now able to merge from within the IDE itself, and view the merged history in TortoiseSVN. NO command line! YAY!!!

However, one last problem is that I am unable to view the merged history in Android Studio (Intellij IDEA) as described in Viewing Merge Sources. Does anyone know how to achieve this in Android Studio?

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Phew, haven't used SVN in a while... :)

But from what I can remember Branch locations should be the folder containing your branches folders (and not each individual branch folder).

You see, typically a SVN repo follows a standard naming convention and folder structure:

trunk/
branches/
  Feature_A2/
  Feature_A3/
tags/
  v1.01/
  v1.02/

and so on...

trunk is where the main development takes place, and branches are for features, long-term or risky projects, or for different stages (such as QA and pre-prod).

So, as far as I remember, Android Studio expects you to set Branch locations to branches folder. In your case I think it should be http://192.168.0.64/svn/.../Android/Feature.

Also, your trunk is not Feature_A2 - Feature_A2 is just another branch.
Although I can't see the content, I think http://192.168.0.64/svn/.../Android/Development might be your trunk.

Which shouldn't bother you much, since you don't have to merge to your trunk, you can also merge between branches (e.g. merge Feature_A3 into Feature_A2).

So, to recap:

  1. Although not mandatory, I recommend renaming your folders to match the conventions (you can easily do it by right clicking in Tortoise SVN, but only AFTER all teammates commit, otherwise merge will be a HELL for them).
  2. Try setting Branch locations to http://192.168.0.64/svn/.../Android/Feature
  3. And Trunk to http://192.168.0.64/svn/.../Android/Development (only if it indeed contains sources, similar to Feature_A2/3)
  4. Consider "tagging" your releases in a tags folder (it's pretty much just copying the trunk/branch folder to tags, but you have a command for that).

    If you do so, you can also add tags folder to Branch locations, that way you'll be able to compare your current source with any previous release (which is handy).

P.S: "unresolved conflicts" error can also mean you have unresolved conflicts (duh :)). Conflicts are are usually created when both you and a teammate change the same lines in file (or if he deletes a file you changed) and you update to get his changes.

SVN won't let you merge until you manually resolve these conflicts/changes.

You can find conflicts in the Version Control tab at the bottom, they'll be mark in red.
(But I don't think that was the problem in your case)


Let me know if that works for you!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...