You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by sv...@apache.org on 2014/04/08 06:01:38 UTC

svn commit: r1585644 - in /subversion/branches/1.8.x: ./ STATUS subversion/libsvn_repos/fs-wrap.c subversion/tests/cmdline/commit_tests.py

Author: svn-role
Date: Tue Apr  8 04:01:37 2014
New Revision: 1585644

URL: http://svn.apache.org/r1585644
Log:
Merge r1583977 from trunk:

 * r1583977
   Do not leave dead transaction if commit was blocked by start-commit hook.
   Justification:
     Leaving dead transaction is not good thing. Regression from 1.7.
   Votes:
     +1: ivan, rhuijben, kotkov

Modified:
    subversion/branches/1.8.x/   (props changed)
    subversion/branches/1.8.x/STATUS
    subversion/branches/1.8.x/subversion/libsvn_repos/fs-wrap.c
    subversion/branches/1.8.x/subversion/tests/cmdline/commit_tests.py

Propchange: subversion/branches/1.8.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1583977

Modified: subversion/branches/1.8.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1585644&r1=1585643&r2=1585644&view=diff
==============================================================================
--- subversion/branches/1.8.x/STATUS (original)
+++ subversion/branches/1.8.x/STATUS Tue Apr  8 04:01:37 2014
@@ -377,10 +377,3 @@ Veto-blocked changes:
 
 Approved changes:
 =================
-
- * r1583977
-   Do not leave dead transaction if commit was blocked by start-commit hook.
-   Justification:
-     Leaving dead transaction is not good thing. Regression from 1.7.
-   Votes:
-     +1: ivan, rhuijben, kotkov

Modified: subversion/branches/1.8.x/subversion/libsvn_repos/fs-wrap.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_repos/fs-wrap.c?rev=1585644&r1=1585643&r2=1585644&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_repos/fs-wrap.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_repos/fs-wrap.c Tue Apr  8 04:01:37 2014
@@ -117,6 +117,8 @@ svn_repos_fs_begin_txn_for_commit2(svn_f
   const char *txn_name;
   svn_string_t *author = svn_hash_gets(revprop_table, SVN_PROP_REVISION_AUTHOR);
   apr_hash_t *hooks_env;
+  svn_error_t *err;
+  svn_fs_txn_t *txn;
 
   /* Parse the hooks-env file (if any). */
   SVN_ERR(svn_repos__parse_hooks_env(&hooks_env, repos->hooks_env_path,
@@ -124,21 +126,30 @@ svn_repos_fs_begin_txn_for_commit2(svn_f
 
   /* Begin the transaction, ask for the fs to do on-the-fly lock checks.
      We fetch its name, too, so the start-commit hook can use it.  */
-  SVN_ERR(svn_fs_begin_txn2(txn_p, repos->fs, rev,
+  SVN_ERR(svn_fs_begin_txn2(&txn, repos->fs, rev,
                             SVN_FS_TXN_CHECK_LOCKS, pool));
-  SVN_ERR(svn_fs_txn_name(&txn_name, *txn_p, pool));
+  err = svn_fs_txn_name(&txn_name, txn, pool);
+  if (err)
+    return svn_error_compose_create(err, svn_fs_abort_txn(txn, pool));
 
   /* We pass the revision properties to the filesystem by adding them
      as properties on the txn.  Later, when we commit the txn, these
      properties will be copied into the newly created revision. */
   revprops = svn_prop_hash_to_array(revprop_table, pool);
-  SVN_ERR(svn_repos_fs_change_txn_props(*txn_p, revprops, pool));
+  err = svn_repos_fs_change_txn_props(txn, revprops, pool);
+  if (err)
+    return svn_error_compose_create(err, svn_fs_abort_txn(txn, pool));
 
   /* Run start-commit hooks. */
-  SVN_ERR(svn_repos__hooks_start_commit(repos, hooks_env,
-                                        author ? author->data : NULL,
-                                        repos->client_capabilities, txn_name,
-                                        pool));
+  err = svn_repos__hooks_start_commit(repos, hooks_env,
+                                      author ? author->data : NULL,
+                                      repos->client_capabilities, txn_name,
+                                      pool);
+  if (err)
+    return svn_error_compose_create(err, svn_fs_abort_txn(txn, pool));
+
+  /* We have API promise that *TXN_P is unaffected on faulure. */
+  *txn_p = txn;
   return SVN_NO_ERROR;
 }
 

Modified: subversion/branches/1.8.x/subversion/tests/cmdline/commit_tests.py
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/tests/cmdline/commit_tests.py?rev=1585644&r1=1585643&r2=1585644&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/tests/cmdline/commit_tests.py (original)
+++ subversion/branches/1.8.x/subversion/tests/cmdline/commit_tests.py Tue Apr  8 04:01:37 2014
@@ -2545,6 +2545,16 @@ def start_commit_hook_test(sbox):
                                            'STDERR',
                                            expected_stderr, actual_stderr)
 
+  # Now list the txns in the repo. The list should be empty.
+  exit_code, output, errput = svntest.main.run_svnadmin('lstxns',
+                                                        sbox.repo_dir)
+  svntest.verify.compare_and_display_lines(
+    "Error running 'svnadmin lstxns'.",
+    'STDERR', [], errput)
+  svntest.verify.compare_and_display_lines(
+    "Output of 'svnadmin lstxns' is unexpected.",
+    'STDOUT', [], output)
+
 #----------------------------------------------------------------------
 @Issue(3553)
 def pre_commit_hook_test(sbox):