6

I'm wondering if there is a easy way to merge between branches of the same Android project where the package name (and thus directory names) are different. Since I will have many branches and all of them need to be kept up to date, I am looking at the best way to do these merges efficiently.

The directory tree of our Android project looks like this

\assets \libs\... \res\... \src\com\mycompany\mainproject AndroidManifest.xml build.xml myproject.iml myproject.ipr 

When we make a customized version for a client, I would change the package name, such as client1app or client2app. You need different package names if they are to exist in the Android Market as different apps for different clients. So I make separate branches which contains identical filenames and directory structure, except for the src folder name which must be changed to match the package name. So client1app or client2app will have the following directory structure:

\src\com\mycompany\client1app \src\com\mycompany\client2app 

The filesnames under those folders are still identical to mainproject. It's just that the directory name is different. (The file content is mostly identical except for the package clause.)

We use SVN for source control. So when I cherrypick merge from mainproject to client1app, I think I would have to merge the top level files and other directories first, and then perform a merge manually for src\com\mycompany\mainproject to src\com\mycompany\client1app. That's five different merges, (for top level and four subdirectories). If it weren't for the directory names being different, this would be a easy single step merge, and I know how to do that.

Question 1: Is there any configuration I could to tell SVN that \src\com\mycompany\mainproject and \src\com\mycompany\client1app contain the same filenames when merging? Or some other way to cherrypick merge easily between the two branches?

Question 2: Would Git be a better fit for this?

2 Answers 2

2

An Android Library project with the common code would help you the most with this. Then you wouldn't have to do any merging at all.

Sign up to request clarification or add additional context in comments.

Comments

1

Is there any configuration I could to tell SVN that \src\com\mycompany\mainproject and \src\com\mycompany\client1app contain the same filenames when merging?

No. SVN really doesn't track renames as renames, merges of renamed and changed files generate errors "Tree conflict" (I suppose /not tested/, same effect will appear on dir renames)

Would Git be a better fit for this?

Yes, Git or Mercurial or Bazaar have rename-tracking and more easy merge-path as result. I, personally, prefer more Mercurial style of manual selection than Git heuristic, but tastes can differ

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.