daveslab
daveslab

Reputation: 10330

Move working SVN working copy into new directory and tagging current checkin?

This question comes to you from someone who's been burned by SVN before and am henceforward afraid of it. So I have a little problem because I was stupid when I was working on my SVN repo. I was developing a project, let's say containing one file, that I just released as a first minor version. So my svn repo looked like this:

project/
--> main.py (v1)

Notice, that I did not create the usual trunk, branch, and tags folders as I should've. Now, I need to, but the problem is that I have since edited the file! Is there a way I can go from this:

Hard drive:
project/
--> main.py (v2)

SVN repo:
project/
--> main.py (v1)

to this:

Hard drive and SVN repo:
project/
--> trunk/
    --> main.py (v2)
--> tags/
    --> v1/
        --> main.py (v1)
--> branch/

Thanks for any/all help!

PS Please note that "Switch to git!" is not an acceptable answer :)

Upvotes: 0

Views: 2686

Answers (1)

Dmitry Yudakov
Dmitry Yudakov

Reputation: 15744

You can use svn move and copy commands. They can work with URLs, which means that you can do changes on server-side.

You could copy or move main.py (v1) to tags/v1/ using URL->URL method.

svn move --parents http://svn/project/main.py http://svn/project/tags/v1/main.py

Then you can copy main.py (v2) to trunk/ using WC->URL method.

svn copy --parents main.py  http://svn/project/trunk/main.py

Since you don't have the directories trunk and tags, you may use --parents parameter, it will create the directories missing in the path.

See svn help copy and svn help move for more info about these commands

P.S. Just in case make a backup of your working copy.

Upvotes: 2

Related Questions