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

RE: Issue 2784 Work In Progress Patch

From: Paul Burba <pburba_at_collab.net>
Date: 2007-05-25 23:54:28 CEST

> -----Original Message-----
> From: Jeremy Whitlock [mailto:jcscoobyrs@gmail.com]
> Sent: Friday, May 25, 2007 5:16 PM
> To: Subversion-Dev
> Subject: Issue 2784 Work In Progress Patch
>
> Hi All,
> While working on issue 2784:
>
> http://subversion.tigris.org/issues/show_bug.cgi?id=2784
>
> I have gotten to the second phase of my unit test only to run
> into something weird. When comparing the tree structures as
> part of an update, I get the following:
>
> =============================================================
> Expected '__SVN_ROOT_NODE' and actual '__SVN_ROOT_NODE' are different!
> =============================================================
> EXPECTED NODE TO BE:
> =============================================================
> * Node name: __SVN_ROOT_NODE
> Path: __SVN_ROOT_NODE
> Contents: N/A (node is a directory)
> Properties: {}
> Attributes: {}
> Children: 1
> =============================================================
> ACTUAL NODE FOUND:
> =============================================================
> * Node name: __SVN_ROOT_NODE
> Path: __SVN_ROOT_NODE
> Contents: None
> Properties: {}
> Attributes: {}
> Children: N/A (node is a file)
> Unequal Types: one Node is a file, the other is a directory
> EXCEPTION: SVNTreeUnequal
> FAIL: basic_tests.py 38: automatic conflict resolution
>
> It doesn't make any sense as to why the root node of the
> actual tree, which was just used in a test higher up the
> chain, is the problematic node. I have attached my work in
> progress patch to see if anyone else could help. Please
> remember that this patch is incomplete.
>
> Take care,
>
> Jeremy

Jeremy and I went over this on IRC, comments in-line below:

> Index: subversion/tests/cmdline/basic_tests.py
> ===================================================================
> --- subversion/tests/cmdline/basic_tests.py (revision 25134)
> +++ subversion/tests/cmdline/basic_tests.py (working copy)
> @@ -1935,8 +1935,164 @@
> expected_output,
> expected_disk,
> expected_status)
> +
> +#------------------------------------------------------------
> ----------
>
> +def automatic_conflict_resolution(sbox):
> + "automatic conflict resolution"
>
> + sbox.build()
> + wc_dir = sbox.wc_dir
> +
> + # Make a backup copy of the working copy wc_backup =
> + sbox.add_wc_path('backup') svntest.actions.duplicate_dir(wc_dir,
> + wc_backup)
> +
> + # Make a couple of local mods to files which will be committed
> + mu_path = os.path.join(wc_dir, 'A', 'mu') lambda_path =
> + os.path.join(wc_dir, 'A', 'B', 'lambda') rho_path =
> + os.path.join(wc_dir, 'A', 'D', 'G', 'rho')
> + svntest.main.file_append(mu_path, 'Original appended text
> for mu\n')
> + svntest.main.file_append(lambda_path, 'Original appended text for
> + lambda\n') svntest.main.file_append(rho_path, 'Original
> appended text
> + for rho\n')
> +
> + # Make a couple of local mods to files which will be conflicted
> + mu_path_backup = os.path.join(wc_backup, 'A', 'mu')
> + lambda_path_backup = os.path.join(wc_backup, 'A', 'B', 'lambda')
> + rho_path_backup = os.path.join(wc_backup, 'A', 'D', 'G', 'rho')
> + svntest.main.file_append(mu_path_backup,
> + 'Conflicting appended text for mu\n')
> + svntest.main.file_append(lambda_path_backup,
> + 'Conflicting appended text for
> lambda\n')
> + svntest.main.file_append(rho_path_backup,
> + 'Conflicting appended text for rho\n')
> +
> + # Created expected output tree for 'svn ci'
> + expected_output = wc.State(wc_dir, {
> + 'A/mu' : Item(verb='Sending'),
> + 'A/B/lambda' : Item(verb='Sending'),
> + 'A/D/G/rho' : Item(verb='Sending'),
> + })
> +
> + # Create expected status tree; all local revisions should
> be at 1, #
> + but lambda, mu and rho should be at revision 2.
> + expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
> + expected_status.tweak('A/mu', 'A/B/lambda', 'A/D/G/rho', wc_rev=2)
> +
> + # Commit.
> + svntest.actions.run_and_verify_commit(wc_dir, expected_output,
> + expected_status, None,
> + None, None, None,
> None, wc_dir)
> +
> + # Create expected output tree for an update of the wc_backup.
> + expected_output = wc.State(wc_backup, {
> + 'A/mu' : Item(status='C '),
> + 'A/B/lambda' : Item(status='C '),
> + 'A/D/G/rho' : Item(status='C '),
> + })

You assign a value to expected_output here...

> + # Create expected disk tree for the update.
> + expected_disk = svntest.main.greek_state.copy()
> + expected_disk.tweak('A/mu', contents="""This is the file 'mu'.
> +<<<<<<< .mine
> +Conflicting appended text for mu
> +=======
> +Original appended text for mu
> +>>>>>>> .r2
> +""")
> + expected_disk.tweak('A/B/lambda', contents="""This is the
> file 'lambda'.
> +<<<<<<< .mine
> +Conflicting appended text for lambda
> +=======
> +Original appended text for lambda
> +>>>>>>> .r2
> +""")
> + expected_disk.tweak('A/D/G/rho', contents="""This is the
> file 'rho'.
> +<<<<<<< .mine
> +Conflicting appended text for rho
> +=======
> +Original appended text for rho
> +>>>>>>> .r2
> +""")
> +
> + # Create expected status tree for the update.
> + expected_status =
> svntest.actions.get_virginal_state(wc_backup, '2')
> + expected_status.tweak('A/mu', 'A/B/lambda', 'A/D/G/rho',
> status='C ')
> +
> + # "Extra" files that we expect to result from the conflicts.
> + # These are expressed as list of regexps. What a cool
> system! :-)
> + extra_files = ['mu.*\.r1', 'mu.*\.r2', 'mu.*\.mine',
> + 'lambda.*\.r1', 'lambda.*\.r2', 'lambda.*\.mine',
> + 'rho.*\.r1', 'rho.*\.r2', 'rho.*\.mine',]
> +
> + # Do the update and check the results in three ways.
> + # All "extra" files are passed to detect_conflict_files().
> + svntest.actions.run_and_verify_update(wc_backup,
> + expected_output,
> + expected_disk,
> + expected_status,
> + None,

...use it here, looks good...
                                      
> svntest.tree.detect_conflict_files,
> + extra_files)
> +
> + # verify that the extra_files list is now empty.
> + if len(extra_files) != 0:
> + # Because we want to be a well-behaved test, we silently raise if
> + # the test fails. However, these two print statements would
> + # probably reveal the cause for the failure, if they were
> + # uncommented:
> + #
> + # print "Not all extra reject files have been accounted for:"
> + # print extra_files
> + ### we should raise a less generic error here. which?
> + raise svntest.Failure
> +
> + # So now lambda, mu and rho are all in a "conflicted" state. Run
> + 'svn # resolved' with the respective
> "--accept[mine|orig|repo]" flag.
> +
> + # Run 'svn resolved --accept=orig. Using lambda for the test.
> + svntest.actions.run_and_verify_svn("Resolved command", None, [],
> + 'resolved',
> + '--accept=orig',
> + lambda_path_backup)
> +
> + # Run 'svn resolved --accept=mine. Using mu for the test.
> + svntest.actions.run_and_verify_svn("Resolved command", None, [],
> + 'resolved',
> + '--accept=mine',
> + mu_path_backup)
> +
> + # Run 'svn resolved --accept=repo. Using rho for the test.
> + svntest.actions.run_and_verify_svn("Resolved command", None, [],
> + 'resolved',
> + '--accept=repo',
> + rho_path_backup)
> +
> + # Set the expected disk contents for the test expected_disk =
> + svntest.main.greek_state.copy()
> +
> + expected_disk.tweak('A/B/lambda', contents="This is the file
> + 'lambda'.\n") expected_disk.tweak('A/mu', contents="This
> is the file 'mu'.\n"
> + "Conflicting appended text for mu\n")
> + expected_disk.tweak('A/D/G/rho', contents="This is the file
> 'rho'.\n"
> + "Original appended text for rho\n")
> +
> + # Set the expected status for the test expected_status =
> + svntest.actions.get_virginal_state(wc_backup, '2')
> +
> + expected_status.tweak('A/mu', status='M ')
> + expected_status.tweak('A/B/lambda', status='M ')
> + expected_status.tweak('A/D/G/rho', status=' ')
> +
> + # Do the update and check the results in three ways.
> + svntest.actions.run_and_verify_update(wc_backup,
> + expected_output,
> + expected_disk,
> + expected_status)

...then use it here again. But you don't expect any output since you
already updated. As you already know you can't pass "None" to
run_and_verify_update(). Instead, redefine expected_out to expect
nothing:

expected_output = wc.State(wc_backup, {})

The odd error you were getting is due to tree.build_tree_from_checkout()
in actions.run_and_verify_update(). It tries to build a tree out of the
non-existant output from the update and compare it to the
expected_output tree you passed in. Yes, the error message is less than
worthless, but nobody has gotten around to fixing it yet.

Paul B.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri May 25 23:54:55 2007

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.