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

[PATCH]XFail testcase to show the problems with partial access to merge source and destination.

From: Kamesh Jayachandran <kamesh_at_collab.net>
Date: 2007-05-12 06:04:10 CEST

Hi All,
Find the attached patch and log.

With regards
Kamesh Jayachandran

[[[
XFail Test to show the merge failures because of partial access to both merge
source and destination.

* subversion/tests/cmdline/merge_tests.py
  (global): import skip_test_when_no_authz_available,
            write_restrictive_svnserve_conf, write_authz_file.
  (merge_with_partial_access_to_merge_src_and_dest): New Function.
  (test_list): include 'merge_with_partial_access_to_merge_src_and_dest'.

Found by: pburba
]]]

Index: subversion/tests/cmdline/merge_tests.py
===================================================================
--- subversion/tests/cmdline/merge_tests.py (revision 25001)
+++ subversion/tests/cmdline/merge_tests.py (working copy)
@@ -29,6 +29,9 @@
 Skip = svntest.testcase.Skip
 
 from svntest.main import SVN_PROP_MERGE_INFO
+from svntest.main import skip_test_when_no_authz_available
+from svntest.main import write_restrictive_svnserve_conf
+from svntest.main import write_authz_file
 
 def shorten_path_kludge(path):
   '''Search for the comment entitled "The Merge Kluge" elsewhere in
@@ -5799,6 +5802,121 @@
   finally:
     os.chdir(saved_cwd)
 
+def merge_with_partial_access_to_merge_src_and_dest(sbox):
+ "merge with partial access to merge src/dest"
+
+ skip_test_when_no_authz_available()
+
+ # Copy /A/D/G to /A/D/copy_of_G r2.
+ # Checkout /A/D/copy_of_G to WC.
+ # Add one extra line each to WC/{pi, rho, tau}, commit. It results in r3.
+ # Remove WC.
+ # Setup authorization in such a way that svntest.main.wc_author can only read
+ # /A/D/G/pi, /A/D/G/rho, /A/D/copy_of_G/pi and /A/D/copy_of_G/tau.
+ # Checkout as 'svntest.main.wc_author' /A/D/G to WC.
+ # Merge /A/D/copy_of_G r3 to WC, this should merge only changes to pi
+ # leaving rho as it is.
+
+ # It fails at this point. It does not even record the merge info on /A/D/G.
+ # Once we fix this we should implement the following.
+
+ # Commit. It results in r4.
+ # Remove the above partial authorization.
+ # Remove WC.
+ # Checkout as 'svntest.main.wc_author' /A/D/G to WC.
+ # Merge /A/D/copy_of_G r3 to WC, this should merge only changes to rho and
+ # tau.
+
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ A_path = os.path.join(wc_dir, 'A')
+ A_D_path = os.path.join(A_path, 'D')
+ A_D_G_path = os.path.join(A_D_path, 'G')
+ A_D_copy_of_G_path = os.path.join(A_D_path, 'copy_of_G')
+ A_D_copy_of_G_URL = sbox.repo_url + '/A/D/copy_of_G'
+ A_D_G_URL = sbox.repo_url + '/A/D/G'
+
+ svntest.main.run_svn(None, "cp", A_D_G_path, A_D_copy_of_G_path)
+
+ expected_output = svntest.wc.State(wc_dir, {
+ 'A/D/copy_of_G' : Item(verb='Adding'),
+ })
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
+ expected_status.add({
+ 'A/D/copy_of_G' : Item(status=' ', wc_rev=2),
+ 'A/D/copy_of_G/pi' : Item(status=' ', wc_rev=2),
+ 'A/D/copy_of_G/rho' : Item(status=' ', wc_rev=2),
+ 'A/D/copy_of_G/tau' : Item(status=' ', wc_rev=2),
+ })
+ svntest.actions.run_and_verify_commit(wc_dir, expected_output,
+ expected_status, None,
+ None, None, None, None, wc_dir)
+ svntest.main.safe_rmtree(wc_dir)
+ svntest.actions.run_and_verify_svn(None, None, [], 'checkout',
+ A_D_copy_of_G_URL, wc_dir)
+ copy_of_G_pi_path = os.path.join(wc_dir, 'pi')
+ copy_of_G_rho_path = os.path.join(wc_dir, 'rho')
+ copy_of_G_tau_path = os.path.join(wc_dir, 'tau')
+ additional_text = 'This is additional line\n'
+ svntest.main.file_append(copy_of_G_pi_path, additional_text)
+ svntest.main.file_append(copy_of_G_rho_path, additional_text)
+ svntest.main.file_append(copy_of_G_tau_path, additional_text)
+ expected_output = svntest.wc.State(wc_dir, {
+ 'pi' : Item(verb='Sending'),
+ 'rho' : Item(verb='Sending'),
+ 'tau' : Item(verb='Sending'),
+ })
+ expected_status = wc.State(wc_dir,
+ { '' : Item(wc_rev=2, status=' '),
+ 'pi' : Item(wc_rev=3, status=' '),
+ 'rho' : Item(wc_rev=3, status=' '),
+ 'tau' : Item(wc_rev=3, status=' '),
+ })
+ svntest.actions.run_and_verify_commit(wc_dir, expected_output,
+ expected_status, None,
+ None, None, None, None, wc_dir)
+ svntest.main.safe_rmtree(wc_dir)
+ write_restrictive_svnserve_conf(sbox.repo_dir)
+ write_authz_file(sbox, {"/A/D/G": svntest.main.wc_author +"=rw",
+ "/A/D/G/tau": svntest.main.wc_author +"=",
+ "/A/D/copy_of_G": svntest.main.wc_author +"=rw",
+ "/A/D/copy_of_G/rho": svntest.main.wc_author +"="})
+ svntest.actions.run_and_verify_svn(None, None, [], 'checkout',
+ '--username', svntest.main.wc_author,
+ '--password', svntest.main.wc_passwd,
+ A_D_G_URL, wc_dir)
+
+ short_wcdir_path = shorten_path_kludge(wc_dir)
+ expected_output = wc.State(wc_dir,
+ {'pi' : Item(status='G ')})
+ expected_disk = wc.State(wc_dir, {
+ '' : Item(props={SVN_PROP_MERGE_INFO : '/A/D/copy_of_G:3'}),
+ 'pi' : Item("This is the file 'pi'.\n" + additional_text),
+ 'rho' : Item("This is the file 'rho'.\n")
+ })
+ expected_status = wc.State(wc_dir,
+ { '' : Item(wc_rev=3, status=' M'),
+ 'pi' : Item(wc_rev=3, status='M '),
+ 'rho' : Item(wc_rev=3, status=' '),
+ })
+
+ expected_skip = wc.State(wc_dir, { })
+ saved_cwd = os.getcwd()
+ try:
+ os.chdir(svntest.main.work_dir)
+ svntest.actions.run_and_verify_merge(short_wcdir_path, '2', '3',
+ A_D_copy_of_G_URL,
+ expected_output,
+ expected_disk,
+ expected_status,
+ expected_skip)
+ finally:
+ os.chdir(saved_cwd)
+
+
+
+
 ########################################################################
 # Run the tests
 
@@ -5855,6 +5973,7 @@
               XFail(merge_to_target_with_copied_children),
               merge_to_switched_path,
               XFail(merge_to_path_with_switched_children),
+ XFail(merge_with_partial_access_to_merge_src_and_dest),
              ]
 
 if __name__ == '__main__':

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat May 12 06:04:12 2007

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