How to merge the changes in a branch to the trunk

Addev

I'm new in working with branches in SVN and I'm having a problem (maybe is a concept issue) I can't understand when trying to merge the changes of a branch into the trunk.

I will develop a full example in order to explain the full problem. I'm working with Eclipse/Android and Subversive:

I created a new project with the structure shown in the Picture 1 and commit it as the Revision #1 to https://mysubversionhost/Tests/SVNTests/trunk (ignoring gen and bin folders)

Picture 1:

enter image description here

At this point the MainActivity.java is

package com.example.svntests;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

public class MainActivity extends FragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }
}

Then I continue working in the project and update the MainActivity.java commiting it as the Revision #2:

package com.example.svntests;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

public class MainActivity extends FragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        codeA();
        codeB();
        codeC();
        System.out.println("This is a bug!");
        codeA();
        codeB();
        codeC();
    }

    private void codeA() {
        // CODE A
    }

    private void codeB() {
        // CODE A
    }

    private void codeC() {
        // CODE A
    }

}

At this point I decide to make a release and create a tag name Release1.0. The SVN structure at this point is shown in the Picture 2 (Revision #3)

Picture 2:

enter image description here

Then I continue working in the trunk and removing the calls to codeA() and adding a class OtherActivity.class in the com.example.svntests. Commiting the Revision #4 MainActivity.java at this point is:

package com.example.svntests;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

public class MainActivity extends FragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        codeB();
        codeC();
        System.out.println("This is a bug!");
        codeB();
        codeC();
    }

    private void codeB() {
        // CODE A
    }

    private void codeC() {
        // CODE A
    }

}

Then I detect the bug "This is a bug!" and want to patch it in production. So I switch to the tag Release 1.0 and fix it (removing the print line and adding a class MainController.java to the same package) and commit it Revision #5

At this point I want to continue working with the Revision #4 with the bug fixed. So I switch to the trunk and use the merge wizard to bring the changes from the branch to the trunk:

enter image description here

I was expecting to get in my working copy the classes:

- MainActivity.java (With conflicts)
- OtherActivity.java
- MainController.java

But instead I get conflicted files that were not modified. See image below

enter image description here

The final state after the merge is:

enter image description here

What do I am missing?

Lazy Badger

Well, you have some misunderstanding in SVN common (I'm too lazy to adopt some of it to Eclipse GUI)

  • /tags subtree, by convention, is "write-once" - and all|each tag must not have history of changes inside /tags/. When you want to bugfix some tag, you have (in ideal world):
    • Copy tag to /branches/
    • Patch branch
    • If branch's code went to production - tag branch as new tag (Release 1.1, probably)
  • In order to bring only bugfix changes into trunk from location-of-bugfix, you'll better merge only revisions, related to bugfix, not the whole history ("cherry-pick merge" instead of "sync merge")(choice 3 "Revisions", enter just 5 in your sample)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Move committed changes from trunk to branch

From Dev

Reintegrating from branch to trunk, then merge back into branch in SVN .. what happens?

From Dev

GitFlow: safely merge develop changes to a feature branch

From Dev

Tortoise SVN - Merge Trunk into Branch - Tree Conflict

From Dev

svn to merge trunk into branch

From Dev

SVN automatic merge from trunk to branch by specifying JIRA ticket id

From Dev

Svn can't merge a directory move operation from trunk to branch

From Dev

git merge changes both local and remote branch

From Dev

How to merge SVN branch to trunk?

From Dev

GIT: How to pull changes from branch after a reverted merge

From Dev

How do merge specific svn revisions from branch to trunk in Android Studio 2.0

From Dev

How to git merge changes from main branch to orphan branch without adding to orphan's history?

From Dev

git: Merge newer branch into older branch without picking trunk chnages

From Dev

files changes when merge branch to master

From Dev

git branch merge, changes in both side

From Dev

git merge into master removing changes from branch

From Dev

SVN Merge branch to trunk with ignored versioned files

From Dev

svn to merge trunk into branch

From Dev

github. How would one merge all changes from the master branch into another branch?

From Dev

SVN Branch To Trunk Merge Issue

From Dev

How can I automatically merge updated changes from a repository to my trunk?

From Dev

How to merge branch into master with accepting branch's changes

From Dev

How skip SVN commit of branch from trunk

From Dev

GIT Branch / Merge Strategy (No Junk In The Trunk)

From Dev

How to merge changes from one branch to another in git

From Dev

How to update changes done by others in the main trunk to my local working copy situated in a branch?

From Dev

How to re-merge all of my changes from a previous branch

From Dev

How to "reset" the changes up to "merge from parent branch"?

From Dev

How to merge a forked branch

Related Related

  1. 1

    Move committed changes from trunk to branch

  2. 2

    Reintegrating from branch to trunk, then merge back into branch in SVN .. what happens?

  3. 3

    GitFlow: safely merge develop changes to a feature branch

  4. 4

    Tortoise SVN - Merge Trunk into Branch - Tree Conflict

  5. 5

    svn to merge trunk into branch

  6. 6

    SVN automatic merge from trunk to branch by specifying JIRA ticket id

  7. 7

    Svn can't merge a directory move operation from trunk to branch

  8. 8

    git merge changes both local and remote branch

  9. 9

    How to merge SVN branch to trunk?

  10. 10

    GIT: How to pull changes from branch after a reverted merge

  11. 11

    How do merge specific svn revisions from branch to trunk in Android Studio 2.0

  12. 12

    How to git merge changes from main branch to orphan branch without adding to orphan's history?

  13. 13

    git: Merge newer branch into older branch without picking trunk chnages

  14. 14

    files changes when merge branch to master

  15. 15

    git branch merge, changes in both side

  16. 16

    git merge into master removing changes from branch

  17. 17

    SVN Merge branch to trunk with ignored versioned files

  18. 18

    svn to merge trunk into branch

  19. 19

    github. How would one merge all changes from the master branch into another branch?

  20. 20

    SVN Branch To Trunk Merge Issue

  21. 21

    How can I automatically merge updated changes from a repository to my trunk?

  22. 22

    How to merge branch into master with accepting branch's changes

  23. 23

    How skip SVN commit of branch from trunk

  24. 24

    GIT Branch / Merge Strategy (No Junk In The Trunk)

  25. 25

    How to merge changes from one branch to another in git

  26. 26

    How to update changes done by others in the main trunk to my local working copy situated in a branch?

  27. 27

    How to re-merge all of my changes from a previous branch

  28. 28

    How to "reset" the changes up to "merge from parent branch"?

  29. 29

    How to merge a forked branch

HotTag

Archive