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

[PATCH] Issue #763 regression test

From: Scott Lamb <slamb_at_slamb.org>
Date: 2002-07-15 19:52:53 CEST

The attached patch adds a regression test that succeeds with Justin's
patch and fails without it. It will need to be modified slightly when
the error message for this is added, but it at least verifies the state
afterward isn't wrong.

This is my first regression test, not sure I understand how everything
is supposed to work. Specifically, both the "repos_rev" and the "wc_rev"
seem to be one more than I'd expect. When "svn up" says "At revision 1",
they say 2. Why is that?

--
Scott Lamb

Index: ./subversion/tests/clients/cmdline/commit_tests.py
===================================================================
--- ./subversion/tests/clients/cmdline/commit_tests.py
+++ ./subversion/tests/clients/cmdline/commit_tests.py Mon Jul 15 12:47:04 2002
@@ -1309,6 +1309,40 @@
                                            wc_dir):
     return 1
 
+#----------------------------------------------------------------------
+
+def commit_with_bad_postcommit(sbox):
+ """Failed post_commit (issue 763).
+ The working copy should be updated to the new state."""
+
+ if sbox.build():
+ return 1
+ wc_dir = sbox.wc_dir
+ repo_dir = sbox.repo_dir
+
+ # Create a post_commit hook that will error out.
+ # Specifically, it doesn't have executable permissions.
+ post_commit_path = svntest.main.get_post_commit_hook_path(repo_dir)
+ svntest.main.file_append(post_commit_path, '')
+
+ # Add a file, so there's something changed.
+ svntest.main.file_append(os.path.join(wc_dir, 'file'), 'blah')
+ svntest.main.run_svn (None, 'add', os.path.join(wc_dir, 'file'))
+
+ # Now, commit.
+ svntest.main.run_svn (None, 'ci', '-m', 'log msg', '--quiet', wc_dir)
+ # XXX: this should assert that it returns an error condition.
+
+ # Verify commit succeeded.
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+ expected_status.tweak(repos_rev=2)
+ expected_status.add({
+ 'file' : Item(status='_ ', wc_rev=2, repos_rev=2),
+ })
+ if svntest.actions.run_and_verify_status(wc_dir, expected_status):
+ return 1
+
+ return 0
 
 ########################################################################
 # Run the tests
@@ -1338,6 +1372,7 @@
               commit_add_file_twice,
               commit_from_long_dir,
               commit_with_lock,
+ commit_with_bad_postcommit,
              ]
 
 if __name__ == '__main__':

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jul 15 19:56:34 2002

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.