views:

25

answers:

2

A little background, because this might be kind of confusing: the project I'm working on is one where most of the code is the same, but there are some files that change based on the platform we're deploying to. For this, the root folder has all of the "core" files that don't change, and then there is a directory for each platform with the files that change. So there's a baz/foo.c and a bar/foo.c, because foo.c changes depending on whether it's deployed to baz or bar. Makefiles and such make all this magic work.

The quesiton is, I'm working on a new platform (we'll say qux) that is based on bar, so I've been working in a branch, and making modifications in the bar directory. Now I want to rename that directory to qux, but preserve the original bar in the trunk when it comes time to merge, because that platform still exists. So my ultimate goal is to, in the trunk after merge, have baz and bar as they were before my meddling, and a new folder qux with my changes (which are currently in the branch under the folder bar, and are based on the original bar).

Is there an easy way to do this? If I rename bar to qux in my branch, it seems like it'll try to delete bar when I merge it back into trunk, which isn't what I want to happen. Do I need to do something like create a new folder qux in my branch, copy files into it from bar, and then revert bar back to its original state? Or is there a better way to do this?

Edit: To be clear, there are changes already in the bar folder that need to be reverted if I copy the files into a new folder.

A: 

Might be missing something, but it sounds like you should:

  1. Leave the branch as is, you're done developing on it but you can refer back to its history if need be.
  2. Make a clean checkout of the trunk
  3. Copy your modified bar folder as a new "qux" folder under the trunk
  4. Add qux to the trunk
  5. Commit
Rob
I'm not done developing on `qux` yet, and I am not in charge of merging things - so I'd prefer to make it so that the merger doesn't have to have special understanding of what to do with my changes.
cincodenada
+1  A: 

Since bar isn't going away in the trunk, don't rename it. Leave it as is, and create a new qux folder, then copy the contents of the bar folder into it. Copying won't remove anything from bar. Modify in qux as appropriate for the new platform. Then when you merge the feature branch back to trunk, you'll have your original, unchanged, bar and your new qux.

If you create the copy with Subversion (as opposed to a plain filesystem copy), you'll even have the prior history of the qux files, though you may not need that.

Carl Raymond
I've already made changes in `bar` that need to be preserved - but sounds like if I do what you said and then check out a previous revision into `bar` (after copying files out to `qux`) then it should do what I want?
cincodenada
That should work. You could also revert `bar`, if you haven't checked in any changes yet.
Carl Raymond
Thanks! I ended up doing just that.
cincodenada