[patch] add tests for rmdir directory versioning
From: Martin Pool <mbp_at_sourcefrog.net>
Date: 2002-08-04 07:37:57 CEST
This patch adds a test suite that tries to recreate some of the
I have some notes on other variations that used to cause trouble, and
I am happy to assign copyright to Collab if that is necessary.
-- Martin --- /dev/null 2002-07-14 13:30:44.000000000 +1000 +++ subversion/tests/clients/cmdline/rmdir_tests.py 2002-08-04 15:32:08.000000000 +1000 @@ -0,0 +1,142 @@ +#!/usr/bin/env python +# +# rmdir_tests.py: test for bugs relating to removing directories +# +# Subversion is a tool for revision control. +# See http://subversion.tigris.org for more information. +# +# ==================================================================== +# Copyright (c) 2002 CollabNet. All rights reserved. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://subversion.tigris.org/license-1.html. +# If newer versions of this license are posted there, you may use a +# newer version instead, at your option. +# +###################################################################### + +# General modules +import string, sys, os, shutil + +# Our testing module +import svntest + + +# (abbreviation) +Item = svntest.wc.StateItem + + +###################################################################### +# Utilities +# + +###################################################################### +# Tests +# +# Each test must return 0 on success or non-zero on failure. + +#---------------------------------------------------------------------- + +def rmdir_and_commit(sbox): + "rm directory and commit" + + if sbox.build(): + return 1 + + wc_dir = sbox.wc_dir + + # in the greek tree, 'A/C' is an empty directory; let's delete it and + # commit and make sure it's gone. + C_path = os.path.join(wc_dir, 'A', 'C') + stdout_lines, stderr_lines = svntest.main.run_svn(None, 'rm', C_path) + + # All local revisions should be at 1, except A/C, which is no longer visible. + # Note that although A has been comitted, our wc_rev is still 1. + expected_dir = svntest.actions.get_virginal_state(wc_dir, 2) + expected_dir.tweak(wc_rev=1) + expected_dir.remove('A/C') + + expected_output = svntest.wc.State(wc_dir, { + 'A/C' : Item(verb='Deleting'), + }) + + if svntest.actions.run_and_verify_commit(wc_dir, + expected_output, + expected_dir, + None, None, None, None, None, + wc_dir): + return 1 + + expected_output = svntest.wc.State(wc_dir, {}) + expected_disk = svntest.main.greek_state.copy() + expected_disk.remove('A/C') + expected_status = svntest.actions.get_virginal_state(wc_dir, 2) + expected_status.remove('A/C') + + if svntest.actions.run_and_verify_update(wc_dir, + expected_output, + expected_disk, + # None): + expected_status): + return 1 + + + +#---------------------------------------------------------------------- + +def rmdir_and_update(sbox): + "rm directory and update while deletion is pending" + + if sbox.build(): + return 1 + + wc_dir = sbox.wc_dir + + # in the greek tree, 'A/C' is an empty directory; let's delete it and + # commit and make sure it's gone. + C_path = os.path.join(wc_dir, 'A', 'C') + stdout_lines, stderr_lines = svntest.main.run_svn(None, 'rm', C_path) + + # This is the expected wc after the update + expected_disk = svntest.main.greek_state.copy() + + # There is no output from running an update in this directory because, + # unlike CVS, Subversion's update command only tells you about + # changes coming from the repository, not about changes you have made + # locally... + expected_output = svntest.wc.State(wc_dir, {}) + + # ... and we expect to be told about them here. + expected_status = svntest.actions.get_virginal_state(wc_dir, 1) + expected_status.tweak('A/C', status='D ') + + if svntest.actions.run_and_verify_status(wc_dir, expected_status): + print "status check failed" + return 1 + + return svntest.actions.run_and_verify_update(wc_dir, + expected_output, + expected_disk, + expected_status) + + +######################################################################## +# Run the tests + + +# list all tests here, starting with None: +test_list = [ None, + rmdir_and_commit, + rmdir_and_update, + ] + +if __name__ == '__main__': + svntest.main.run_tests(test_list) + # NOTREACHED + + +### End of file. +# local variables: +# eval: (load-file "../../../../tools/dev/svn-dev.el") +# end: --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org For additional commands, e-mail: dev-help@subversion.tigris.orgReceived on Sun Aug 4 07:39:32 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.