5

I spoke too soon in my previous post about breaking things.

I am trying to revert back to revision 1124 using the command svn update -r 1124 but I keep getting an error message as follows:

[prague]$ svn update -r1024
U    app/webroot/css/group_themes/green.css
U    app/webroot/css/style.css
Skipped 'app/webroot/index.php'
svn: Failed to add directory 'app/webroot/images/users': an unversioned directory of the same name already exists

We got some stuff back up but still not the exact version which I know I had checked out last night... I thought it would be much easier to just revert back to a specific revision :(

adam
  • 2,830
  • 5
  • 31
  • 37
  • Posting the error message might help ... – J.N. Mar 02 '11 at 08:37
  • btw- I think i hit "svn update 124" right before that so now i just want to force it back to 1124... i have the local copy on my machine but thought i could just "tell" svn to "undo" so to speak – adam Mar 02 '11 at 08:44
  • latest error based on comments below [prague]$ svn update -r 1124 Skipped 'app/webroot/index.php' svn: Failed to add directory 'app/webroot/images/users': an unversioned directory of the same name already exists [prague]$ – adam Mar 02 '11 at 09:05

3 Answers3

13

Without commit

Try to checkout revision 1124 in a new empty directory, so you won't have conflicts with already existing directories.

So svn checkout -r 1124 in a new directory.

With commit

According to the svn manual, if you want to commit a previous revision, you need to use reverse merging. See http://svnbook.red-bean.com/en/1.0/ch04s04.html, 'Undoing Changes'.

svn merge -c -1124 http://svn.example.com/repos/calc/trunk followed by

svn commit -m "Rollback merge to revision 1124"

red
  • 833
  • 1
  • 7
  • 13
  • and once its checked out anew i should be able to just commit version 1124 in the command line? – adam Mar 02 '11 at 08:51
  • 1
    Agreed. (Re?)moving the directory works, but using another directory to checkout from altogether might even be easier to do. – Berry Langerak Mar 02 '11 at 08:55
  • is there a second step... i checked out the new version into a new folder on my local machine... is there a step in between – adam Mar 02 '11 at 09:04
  • i now have a fresh directory on my local- but still cant commit – adam Mar 02 '11 at 09:07
  • latest error based on comments below [prague]$ svn update -r 1124 Skipped 'app/webroot/index.php' svn: Failed to add directory 'app/webroot/images/users': an unversioned directory of the same name already exists [prague]$ – adam 9 mins ago (sorry i added it to the question not to this thread) – adam Mar 02 '11 at 09:18
  • If checking out a new revision also didn't work, try reverse merging like this: svn merge -c -1124 /path/to/repo and then svn commit. I will update my answer if this works for you. – red Mar 02 '11 at 09:22
  • but Skipped 'app/webroot/index.php' svn: Failed to add directory 'app/webroot/images/users': an unversioned directory of the same name already exists [prague]$ – adam Mar 02 '11 at 09:29
  • I updated my answer. Check the link I provided when you want to commit reverted changes, it should work ;). – red Mar 02 '11 at 09:47
  • i REALLY though we were there it "took" when i got the right url/path but now its asking for a password:) – adam Mar 02 '11 at 11:17
  • Authentication realm: Private Area Username: neighborrow Password for 'neighborrow': svn: OPTIONS of 'http://svn.neighborrow.com/trac/repos/calc/trunk': authorization failed (http://svn.neighborrow.com) [prague]$ svn merge -c 1124 http://svn.neighborrow.com/trac/repos/calc/trunk Authentication realm: Private Area Password for 'neighborrow': Authentication realm: Private Area Username: adam Password for 'adam': svn: 'http://svn.neighborrow.com/trac/repos/calc/trunk' path not found [prague]$ – adam Mar 02 '11 at 11:18
  • The URL needs to point to your specific repository. The one I provided was just an example. That's why it says: path not found, because the directory doesn't exist. Does it work when you omit the url? – red Mar 02 '11 at 11:40
  • svn.neighborrow.com/trac IS the repository afaik - i knew to replace the example.com part – adam Mar 02 '11 at 13:26
  • and thanks for being patient- if we dont get it soon my team will probably be up by now to take a look themselves... i just get a kick out of trying to do it myself – adam Mar 02 '11 at 13:26
  • [prague]$ svn merge -c 1124 http://svn.neighborrow.com/trac/calc/trunk Authentication realm: Private Area Password for 'neighborrow': Authentication realm: Private Area Username: adam Password for 'adam': svn: 'http://svn.neighborrow.com/trac/calc/trunk' path not found [prague]$ – adam Mar 02 '11 at 14:25
  • didnt catch that extra /repos/ thought that was finally going to do it – adam Mar 02 '11 at 14:26
  • Hmm I'm out of ideas, sorry! I thought it would work because I think I did exactly this to roll back my repo. Update your progress in your question so it gets bumped. – red Mar 02 '11 at 14:41
  • no apologies needed- i just wanted to see if we could get there! i have my team working on it ill have them post the solution shortly – adam Mar 02 '11 at 14:51
3

Failed to add directory 'app/webroot/images/users': an unversioned directory of the same name already exists

Sounds clear to me: there already is a directory with that name, and it's not versioned. You can opt for two things: either remove the directory and update again, or rename (probably smartest) and update again.

 $ mv app/webroot/images/users app/webroot/images/users.orig/
 $ svn update -r1024

As an aside, do yourself a favour and look at some of the alternatives to SVN, such as Mercurial, Bazaar or Git. I've found the switch to be very pleasant ;)

Berry Langerak
  • 18,561
  • 4
  • 45
  • 58
  • thanks for the tips... ill definitely try those- i thought SVN/tortoise was my license to mess with code... but all it has done is taken away my fear of breaking things without really making it easy to revert things - even my team who knows this stuff doesnt love it – adam Mar 02 '11 at 08:58
0

You can simply do an update to revision using

svn up -r 1124 

But this will not let you commit the changes as SVN needs you to update your working copy to HEAD before you can commit. What you can do instead is

svn merge -r HEAD:1124 yourFile
svn ci yourFile -m "Reverting back to rev 1124 "
Aniket Thakur
  • 66,731
  • 38
  • 279
  • 289