views:

97

answers:

3

I have created an SVN repository for project but now realise that the files initially imported are not the most recent.

When I compare the 2 versions of the project with Beyond Compare, the projects do not have the exact same set of files within them. Both project folders have some files which are unique.

I want to now add the correct files to the repository but am not sure of the best approach.

  • I could delete the repository altogether and start afresh. Although I remember this being problematic in the past as the repositories will have the same name
  • I could try to copy the correct files over the exisitng ones and commit. Although there may be old files which are not overwritten, resulting in old files commited to the new project.

What would be the standard SVN approach in this case?

+2  A: 

Just use your second approach and replace your existing files with the correct files, then commit.

What do you mean with old files which are not overwritten? If they are not overwritten it just means you didn't replace them because they are already the right files.

So, no problem.

If you're talking about files that have been deleted in the newest version then do a folder/file compare with a tool of your choice (like Total Commander) and let the tool delete the files on one side which are not present on the other. Then commit again.

Important: Commit the two steps separately.

tharkun
I think Jon refers to files that are deleted/added.
sbi
Thanks for the hint @sbi, integrated it.
tharkun
@tharkum: I don't know of a folder compare that does `svn remove`/`svn add`. Total Commander's certainly doesn't.
sbi
@sbi: you don't need it to do svn remove, you just delete these files physically on your hard drive and the remove will be done at the next commit automatically
tharkun
A: 

I don't think there's a standard way to do this. This depends on your circumstances - which we know little about.

From what you wrote, you could either change a working copy with the diff between the two versions (and you would then have to deal with addition/removal of files) or you just delete the old project folder and add one containing the new files instead. I think the latter would take at least two commit to succeed (you cannot remove and add the same item in one commit), the former could be done with one commit.

sbi
A: 

I would follow these steps:

1) Get a clean and updated working copy. Clean = no modifications. Updated = you know.

2) Delete all files. Keep the folder structure. Be careful of not deleting any .svn folder nor any file inside those.

3) Copy the new files to the working copy.

4) Commit.

An alternative to 2 and 3 would be:

2b) Copy the new files to the working copy overwriting the old files

3b) Use Beyond Compare to detect which files you have in the working copy that shouldn't be there as they don't belong to the new files. Delete these files until the working copy and the new files folder are identical except for .svn folders (you can filter these out in BC)

tato