Bobson
Bobson

Reputation: 13696

Indicate that new file in subversion is actually a copy

Say that I have a file in my Subversion repository called MyClass.cs. Over time, MyClass has grown to the point that I want to split it into two separate files, but I need to preserve the history of each line of code.

One option available to me is to do a SVN copy to MyClass2.cs, and then delete half the code from one file and half from the other. This works reasonably well, provided I delete the right things from each.

However, what can I do if I've done all the work to separate the files, and then realized (before committing) that I didn't do the copy. Is there a way to indicate that "this existing new file" is a copy of "this other known file"?

I'm using TortoiseSVN, so a mechinism in that would be ideal, but I'm comfortable with the command line if neccesary.

This other question addresses retroactively adding the change far in the past, but I'm just looking for a pre-commit answer.

Upvotes: 1

Views: 63

Answers (2)

NTyler
NTyler

Reputation: 1427

Here's what I would do: Copy your edits somewhere else. Revert the old file. SVN copy to new file. Overwrite the old and new files with your edits. Commit.

Upvotes: 3

Lee Meador
Lee Meador

Reputation: 12985

Rename the new file to save it.

Make the SVN copy preserving the history. (Possibly in the Repo Browser)

Replace the copy with the saved one. (Windows "copy" or Linux "cp")

You should have all the history and can commit.

Upvotes: 3

Related Questions