Here's a fix for issue 554. (The suggestion from Ben Collins-Sussman
in the issue was indeed the correct fix.)
Provide a more useful error message for the case when we're commiting
something inside a directory that is scheduled for addition. This
fixes issue #554.
* subversion/include/svn_error_codes.h
(SVN_ERR_CL_COMMIT_IN_ADDED_DIR): new error for when we try to
commit a file inside a directory scheduled for addition.
* subversion/libsvn_client/commit.c
(svn_client_commit): if the entry for our base_dir was copied, error
out, because it means we're committing something inside a directory
that was scheduled for addition.
* subversion/tests/clients/cmdline/commit_tests.py
(commit_in_dir_scheduled_for_addition): new test for the case where
we're commiting a file inside a directory scheduled for addition.
Index: ./subversion/include/svn_error_codes.h
===================================================================
--- ./subversion/include/svn_error_codes.h
+++ ./subversion/include/svn_error_codes.h Sun Jan 13 19:12:27 2002
@@ -377,6 +377,9 @@
SVN_ERRDEF (SVN_ERR_CL_LOG_MESSAGE_IS_VERSIONED_FILE,
"The log message file is under version control.")
+ SVN_ERRDEF (SVN_ERR_CL_COMMIT_IN_ADDED_DIR,
+ "Commiting in directory scheduled for addition")
+
/* END Client errors */
Index: ./subversion/libsvn_client/commit.c
===================================================================
--- ./subversion/libsvn_client/commit.c
+++ ./subversion/libsvn_client/commit.c Sun Jan 13 19:37:15 2002
@@ -517,6 +517,10 @@
/* Construct full URL from PATH. */
SVN_ERR (svn_wc_entry (&entry, base_dir, pool));
url = entry->url;
+
+ if (entry->copied)
+ return svn_error_create(SVN_ERR_CL_COMMIT_IN_ADDED_DIR, 0, NULL,
+ pool, "");
}
/* Make sure our log message at least exists, even if empty. */
Index: ./subversion/tests/clients/cmdline/commit_tests.py
===================================================================
--- ./subversion/tests/clients/cmdline/commit_tests.py
+++ ./subversion/tests/clients/cmdline/commit_tests.py Sun Jan 13 20:24:33 2002
@@ -1211,6 +1211,29 @@
return 1
return 0
+def commit_in_dir_scheduled_for_addition():
+ "commit a file inside a directory that's already scheduled to be added"
+
+ # Bootstrap: make independent repo and working copy.
+ sbox = sandbox(commit_deleted_edited)
+ wc_dir = os.path.join(svntest.main.general_wc_dir, sbox)
+
+ if svntest.actions.make_repo_and_wc(sbox): return 1
+
+ A_path = os.path.join(wc_dir, 'A')
+ Z_path = os.path.join(wc_dir, 'Z')
+ mu_path = os.path.join(wc_dir, 'Z', 'mu')
+
+ svntest.main.run_svn(None, 'move', A_path, Z_path)
+
+ was_cwd = os.getcwd()
+
+ out, err = svntest.main.run_svn(1, 'commit', mu_path)
+
+ if len(err) == 0:
+ return 1
+
+ return 0
########################################################################
# Run the tests
@@ -1233,7 +1256,8 @@
## hook_test,
merge_mixed_revisions,
commit_uri_unsafe,
- commit_deleted_edited
+ commit_deleted_edited,
+ commit_in_dir_scheduled_for_addition,
]
if __name__ == '__main__':
--
garrett rooney Unix was not designed to stop you from
rooneg@electricjellyfish.net doing stupid things, because that would
http://electricjellyfish.net/ stop you from doing clever things.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:56 2006