a life of coding

Friday, December 16, 2005

Troubling SVN Error

There is a somewhat rare subversion error out there, in which you can import files but not add them. This is rather infuriating, as you often add your whole project to source control, work on it for a month, and then try to add a file and find that subversion has just broke. Really, it didn't just break, it was always broken and you never knew it. Googling for the answer won't help (well, maybe it will now), because no one seems to know the answer. But, lucky you! I have your answer!

Here's the situation: you are running a website package (like drupal). This package puts up fancy 404 error pages, possibly sends you to the root page. When you type in http://www.mywebsite.com/this_page_doesnt_exist.html, instead of an ugly "404 Document Not Found", you get a pretty "302 Found http://www.mywebsite.com/404.html", which causes your browser to redirect. This is good for users - people don't get much out of the traditional error message. This is bad for svn - when you say "svn add" and then commit, it says "Hi! This file already exists!", which causes svn to tell you: "svn propfind request failed", "302 Found"... less than useful.

So, you already see the answer now, cunning user: go to your apache subversion config, and add the simple statement: "ErrorDocument 404 default" (and reload apache). Users get pretty errors, subversion gets less confused, you get to add files. Server defenestration averted.

Thats it! You're done! Go and add new files with abandon!

15 Comments:

  • After a few hours of searching/testing/failing... the answer! Many thanks!!!

    By Anonymous Anonymous, At 9/20/06 11:22 PM  

  • You, my friend, have saved me a lot of grey hairs. Thanks!

    By Blogger method, At 2/26/07 11:26 AM  

  • THANK YOU!

    What a horrible, horrible error.

    Afflicted version: 1.1.4 RHEL4, Mar 2007

    By Anonymous Anonymous, At 3/2/07 7:03 PM  

  • Great, save the my day

    By Anonymous Anonymous, At 3/26/07 7:14 PM  

  • thank you VERY VERY much!!
    posts like this one are invaluable..
    thank you again and again and again and again and again and again...
    and tomorrow too :D

    By Anonymous Anonymous, At 4/16/07 11:16 AM  

  • Yeeeha!

    Thank you very much. After an hour of searching or so I finally found your post and it worked :D

    By Anonymous buzz, At 7/11/07 12:01 PM  

  • that took me two hours until I found your page on google. I was about to pull my hair out!!!

    By Blogger Matt, At 9/21/07 6:35 PM  

  • Thanks for the fix. Unlike the others who have commented, I found your site after only a few minutes of searching. I was not even close to upset. But I am glad you saved me some pain.

    By Anonymous Jason Dean, At 4/13/08 10:57 PM  

  • google code does this when it decides that svn client is a spyware and should show a captcha page instead of sending files. Happened after I cancelled an update - went to resume the update and now 302 every time.

    By Blogger David, At 4/23/08 11:29 AM  

  • Thank you, that solved it for me too.

    By Anonymous Anonymous, At 6/12/08 7:10 AM  

  • Thank you! Saved me many hours.

    By Blogger hQuse, At 11/13/08 2:58 AM  

  • My hero!

    I was having this problem for hours as well (have drupal in there)

    Works wonders.

    If there is anyone else out there not sure what 'apache subversion config' is, it is your httpd.conf file generally located in /etc/apache2/ . This is where you setup apache to redirect to your repository in the first place.

    By Blogger chrisabbato, At 10/1/09 9:37 PM  

  • Thank you so much! It took a long time for me to find your solution. Cheers!

    By Blogger dh, At 2/25/10 10:31 AM  

  • I have the same problem but when trying to import. My command is:
    svn import -m "First import" distillation/ http://[hostname]:/srv/svn/slowcontrol/
    and the response I receive:
    svn: PROPFIND request failed on '/srv/svn/slowcontrol'
    svn: PROPFIND of '/srv/svn/slowcontrol': 302 Found (http://[hostname])
    Does anyone know what the reason might be?

    By Blogger Pablito, At 3/29/10 7:51 PM  

  • i have testet further:
    You dont have to use standard-404. only give correct 404-headers out with relative paths and all works.

    in htaccess: ErrorDocument 404 /myfail404.php

    in php: header("HTTP/1.0 404 Not Found");

    By Blogger timi_loader, At 4/29/10 7:28 AM  

Post a Comment



<$I18N$LinksToThisPost>:

Create a Link

<< Home