[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH][Issue 2295]"svn mkdir URL" gives poor error message when directory exists

From: Kamesh Jayachandran <kamesh_at_collab.net>
Date: 2006-01-29 16:06:10 CET

Hi All,
I hereby attach the patch for #2295.

With regards
Kamesh Jayachandran

[[[
Fix issue #2295, "svn mkdir URL" gives poor error message when directory
exists

* subversion/mod_dav_svn/repos.c
  (dav_svn_get_resource): Populating the request->status_line to
  '409 Directory already exists'.

* subversion/tests/cmdline/basic_tests.py
  (duplicate_mkdir_over_dav_url): New testcase to test #2295.
  (test_list): Run the new test.

]]]

Index: subversion/tests/cmdline/basic_tests.py
===================================================================
--- subversion/tests/cmdline/basic_tests.py (revision 18117)
+++ subversion/tests/cmdline/basic_tests.py (working copy)
@@ -1695,6 +1695,25 @@
                                      'ls', '--verbose', rho_url + '@1')
   
 
+#----------------------------------------------------------------------
+# Issue #2295.
+def duplicate_mkdir_over_dav_url(sbox):
+ "Duplicate mkdir of directory/file over DAV URL should give meaningful \
+ error message"
+
+ sbox.build()
+ url = svntest.main.current_repo_url
+ scheme = url[:string.find(url, ":")]
+ if scheme == 'http' or scheme == 'https':
+ Duplicate_url_path = url + '/Duplicate'
+
+ svntest.actions.run_and_verify_svn("mkdir DAV_URL/DUPLICATE",
+ ["\n", "Committed revision 2.\n"], [],
+ 'mkdir', '-m', 'log_msg', Duplicate_url_path)
+
+ svntest.actions.run_and_verify_svn("mkdir DAV_URL/DUPLICATE",
+ [], '.*409 Directory already exists.*',
+ 'mkdir', '-m', 'log_msg', Duplicate_url_path)
 ########################################################################
 # Run the tests
 
@@ -1729,7 +1748,8 @@
               repos_root,
               basic_peg_revision,
               info_nonhead,
- ls_nonhead
+ ls_nonhead,
+ duplicate_mkdir_over_dav_url
               ### todo: more tests needed:
               ### test "svn rm http://some_url"
               ### not sure this file is the right place, though.
Index: subversion/mod_dav_svn/repos.c
===================================================================
--- subversion/mod_dav_svn/repos.c (revision 18117)
+++ subversion/mod_dav_svn/repos.c (working copy)
@@ -1544,6 +1544,11 @@
                            "trailing slash on the URI.");
     }
 
+ if ((strcmp(r->method, "MKCOL") == 0) && comb->res.exists)
+ {
+ r->status_line = apr_pstrdup(r->pool, "409 Directory already exists");
+ }
+
   *resource = &comb->res;
   return NULL;
 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Jan 29 16:02:40 2006

This is an archived mail posted to the Subversion Dev mailing list.