Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subversion - how to move some changesets from trunk to a branch?

Tags:

svn

We have a large project with several sub-projects. We're approaching a release of our project, and the new features in one sub-project are not going to be completed before the release as was originally planned. What I'd like to do is move all the changes to that sub project related to the new features into a separate branch to continue work for the next release, but I'm not sure how to best accomplish this.

The situation is basically:

/proj/trunk/A/
/proj/trunk/B/
/proj/trunk/C/

We have revisions a..z checked in since the last release. Revisions d, f, g, and j..n contain work related to a new feature in C which isn't going to be completed in time. Revisions e, h, and q contain unrelated changes in C which need to be in this release. I'd like to create a /proj/branches/new-feature-for-C/ and move changes d, f, g, and j..n there, while keeping e, h, and q in trunk. There is no overlap between changes to be moved to the branch and changes to be kept on the trunk, and none of the changes to be moved to the branch depend on any changes in any other subproject since the last release.

like image 899
Thomee Avatar asked May 19 '09 16:05

Thomee


People also ask

How does SVN compare to trunk and branch?

- A trunk in SVN is main development area, where major development happens. - A branch in SVN is sub development area where parallel development on different functionalities happens. After completion of a functionality, a branch is usually merged back into trunk.

How do I merge two SVN revisions?

Examples. Merge a branch back into the trunk (assuming that you have an up-to-date working copy of the trunk): $ svn merge --reintegrate \ http://svn.example.com/repos/calc/branches/my-calc-branch --- Merging differences between repository URLs into '. ': U button.


1 Answers

This is how I would do it: Copy the trunk to a branch, then reverse merge the change sets.

so if the trunk is at http://svnserver/svn/myrepo/trunk/C and the unwanted change sets are 3, 6 , 9-11

svn copy http://svnserver/svn/myrepo/trunk/C http://svnserver/svn/myrepo/branch/C -m "Branch no completable work"
svn merge -c -3,-6 http://svnserver/svn/myrepo/trunk/C <filepath to root of trunk>
svn merge -r 11:8 http://svnserver/svn/myrepo/trunk/C <filepath to root of trunk>
****CHECK EVERY THING WORKED***
svn commit . -m "Removed some changes that weren't to be finished"

Note that the -r 11:8 is one less than the changeset you want to stop at

like image 84
Andrew Cox Avatar answered Oct 04 '22 02:10

Andrew Cox