[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: retroactive branch?

From: Marc Haisenko <haisenko_at_comdasys.com>
Date: 2007-08-08 14:10:23 CEST

On Wednesday 08 August 2007 13:43, Noam Tamim wrote:
> Hi,
> A user has started a big change. He didn't create his own branch first, so
> he's in the trunk. His work is still ongoing, but he needs to commit.
> However in the current state, a commit will break the trunk.
>
> Is it possible to somehow retroactively branch his work, and later merge
> everything to the trunk?
>
> Thanks, Noam.

I think you can do it something like this way:

# Create branch
svn cp -r $REV_WHERE_BIG_CHANGE_STARTED-1 $REPO/path $REPO/branchpath

# Check it out
svn co $REPO/branchpath

# Merge the big changes up to now
cd branchpath
svn merge $REPO/path -r $REV_WHERE_BIG_CHANGE_STARTED:HEAD
svn commit

# Switch working copy with uncommited changes to branch; the uncommitted
# changes are not lost !
cd ../path
svn switch $REPO/branchpath

# Commit the changes in the branch; you can now do "svn up" in the working
# copy for "branchpath"
svn commit

# Switch back to the "normal" branch
svn switch $REPO/path

# Now you have this: $REPO/path and $REPO/branchpath are the same, except that
# $REPO/branchpath now also contains the changes that were not committed
# because of fear of breakage. Now you can revert the stuff from the big
# change in the main branch.
svn merge -r HEAD:$REV_WHERE_BIG_CHANGE_STARTED
svn commit

This all assumes that between $REV_WHERE_BIG_CHANGE_STARTED and HEAD only
commits regarding the big change where done to $REPO/path (commits to other
branches are fine).

Take with care, this is just a quick shot and not tried out.
        Marc

-- 
Marc Haisenko
Comdasys AG
Rüdesheimer Straße 7
D-80686 München
Tel:   +49 (0)89 - 548 433 321
e-mail: haisenko@comdasys.com
http://www.comdasys.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Aug 8 14:09:36 2007

This is an archived mail posted to the Subversion Users mailing list.