tags:

views:

863

answers:

2

I had a private branch that I did a ton of commits to, then I merged it into trunk, and did a few little tweaks there.

Now the trunk maintainer wants a diff off all of my changes incase we need a rollback.

How can I create this? If you need numbers for your examples, assume that

224446

was my main revision where I merged into trunk,

224453 and 224462

were my minor fixes, and I have countless changes when in my private branch.

Solution (via Martin)

svn diff -r 224452:224453 > ~/tmp/diff.1
svn diff -r 224462:224463 > ~/tmp/diff.2
svn up -r224446
patch < ~/tmp/diff.1 -p0
patch < ~/tmp/diff.2 -p0
svn diff -r 224445 > ~/tmp/changes.patch

Then mail ~/tmp/changes.patch to our trunk maintainer for safekeeping.

+3  A: 

One option would be to create a branch at 224446, then merge in 224453 and 224462. Then take a diff between that and 224445 on the trunk. That should be all the changes in one, and you can create it as a patch file should you need to:

# Branch from your initial checkin
svn cp svn://xyz/trunk@224446 svn://xyz/branches/foo

# Check it out
svn checkout svn://xyz/branches/foo tmp

# Merge in the two changes
svn merge -c 224453,224462 svn://xyz/trunk tmp

# Commit the changes
svn commit tmp -m "Extra commits 224453 and 224462"

# Diff the branch from mainline before original
svn diff svn://xyz/trunk@224445 svn://xyz/branches/foo

This is largely the same as Martin's answer, just with different ways of applying the changes and getting the diffs. Note that although in this case I've committed the changes, you don't really have to - you could just do svn diff svn://xyz/trunk@224445 tmp instead of the last two commands. The nice thing about having it in the repository is then anyone can apply the diff in reverse to roll it back, should that be required.

Jon Skeet
sounds great. I'm not very familiar with SVN, can you post some commands?
Paul Tarjan
+1 for Jon's solution. What about when you add another revision? Then whole patch need to be regenerated. Patches are good when you don't have commit acces.
cetnar
+4  A: 

One possible procedure wold be this:

  1. create diffs for 224453 and 224462 (e.g. by svn diff -r 224452:224453).
  2. check out 224446 (svn up -r224446)
  3. apply the diffs (with patch(1))
  4. create a diff of that against 224445 (svn diff -r 224445)
Martin v. Löwis