You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2012/02/21 00:37:52 UTC

svn commit: r1291520 - /subversion/trunk/subversion/tests/cmdline/svntest/actions.py

Author: philip
Date: Mon Feb 20 23:37:51 2012
New Revision: 1291520

URL: http://svn.apache.org/viewvc?rev=1291520&view=rev
Log:
Tweak a regression test so that it does not depend on APR's hash order.

* subversion/tests/cmdline/svntest/actions.py
  (run_and_verify_merge): Allow for different number of duplicate lines
   between real and dry-run merge caused by APR hash order differences.

Modified:
    subversion/trunk/subversion/tests/cmdline/svntest/actions.py

Modified: subversion/trunk/subversion/tests/cmdline/svntest/actions.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/actions.py?rev=1291520&r1=1291519&r2=1291520&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/actions.py Mon Feb 20 23:37:51 2012
@@ -1092,11 +1092,22 @@ def run_and_verify_merge(dir, rev1, rev2
     # real merge operations did the same thing, but the output came in
     # a different order.  Let's see if maybe that's the case.
     #
-    # NOTE:  Would be nice to limit this dance to serf tests only, but...
+    # This now happens for other RA layers with modern APR because the
+    # hash order now varies.
     out_copy = merge_diff_out[:]
     out_dry_copy = out_dry[:]
     out_copy.sort()
     out_dry_copy.sort()
+
+    # The different orders of the real and dry-run merges may cause
+    # the "Merging rX through rY into" lines to be duplicated a
+    # different number of times in the two outputs.  The list-set-list
+    # conversion removes duplicates so these differences are ignored.
+    # It also removes "U some/path" duplicate lines.  Perhaps we
+    # should avoid that?
+    out_copy = list(set(out_copy))
+    out_dry_copy = list(set(out_dry_copy))
+
     if out_copy != out_dry_copy:
       print("=============================================================")
       print("Merge outputs differ")



AW: svn commit: r1291520 - /subversion/trunk/subversion/tests/cmdline/svntest/actions.py

Posted by Markus Schaber <m....@3s-software.com>.
Hi, Philip,

Von: Philip Martin [mailto:philip.martin@wandisco.com] 
>Daniel Shahaf <d....@daniel.shahaf.name> writes:
>
>> philip@apache.org wrote on Mon, Feb 20, 2012 at 23:37:52 -0000:
>>> +    # The different orders of the real and dry-run merges may cause
>>> +    # the "Merging rX through rY into" lines to be duplicated a
>>> +    # different number of times in the two outputs.  The list-set-list
>>> +    # conversion removes duplicates so these differences are ignored.
>>> +    # It also removes "U some/path" duplicate lines.  Perhaps we
>>> +    # should avoid that?
>>> +    out_copy = list(set(out_copy))
>>> +    out_dry_copy = list(set(out_dry_copy))
>>> +
>>>      if out_copy != out_dry_copy:
>>
>> You're converting sets->lists and then comparing them.  Shouldn't you 
>> either sort the new lists before comparing them, or just avoid the 
>> list step altogether?

>Indeed, I realised that last night.  I don't think I need to sort them at all, simply >convert the unsorted lists with duplicates into sets and compare them.  That's assuming >Python allows me to compare sets.

Using ActivePython 2.7.2.5:
>>> d = {1:2,3:4}
>>> e = {3:4,1:2}
>>> f = {1:2,3:4,5:6}
>>> d == d
True
>>> d == e
True
>>> d == f
False


--
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com

Best regards

Markus Schaber
-- 
___________________________
We software Automation.

3S-Smart Software Solutions GmbH
Markus Schaber | Developer
Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax +49-831-54031-50

Email: m.schaber@3s-software.com | Web: http://www.3s-software.com 
CoDeSys internet forum: http://forum.3s-software.com
Download CoDeSys sample projects: http://www.3s-software.com/index.shtml?sample_projects

Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915 

Re: svn commit: r1291520 - /subversion/trunk/subversion/tests/cmdline/svntest/actions.py

Posted by Philip Martin <ph...@wandisco.com>.
Daniel Shahaf <d....@daniel.shahaf.name> writes:

> philip@apache.org wrote on Mon, Feb 20, 2012 at 23:37:52 -0000:
>> +    # The different orders of the real and dry-run merges may cause
>> +    # the "Merging rX through rY into" lines to be duplicated a
>> +    # different number of times in the two outputs.  The list-set-list
>> +    # conversion removes duplicates so these differences are ignored.
>> +    # It also removes "U some/path" duplicate lines.  Perhaps we
>> +    # should avoid that?
>> +    out_copy = list(set(out_copy))
>> +    out_dry_copy = list(set(out_dry_copy))
>> +
>>      if out_copy != out_dry_copy:
>
> You're converting sets->lists and then comparing them.  Shouldn't you
> either sort the new lists before comparing them, or just avoid the list
> step altogether?

Indeed, I realised that last night.  I don't think I need to sort them
at all, simply convert the unsorted lists with duplicates into sets and
compare them.  That's assuming Python allows me to compare sets.

-- 
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com

Re: svn commit: r1291520 - /subversion/trunk/subversion/tests/cmdline/svntest/actions.py

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
philip@apache.org wrote on Mon, Feb 20, 2012 at 23:37:52 -0000:
> +    # The different orders of the real and dry-run merges may cause
> +    # the "Merging rX through rY into" lines to be duplicated a
> +    # different number of times in the two outputs.  The list-set-list
> +    # conversion removes duplicates so these differences are ignored.
> +    # It also removes "U some/path" duplicate lines.  Perhaps we
> +    # should avoid that?
> +    out_copy = list(set(out_copy))
> +    out_dry_copy = list(set(out_dry_copy))
> +
>      if out_copy != out_dry_copy:

You're converting sets->lists and then comparing them.  Shouldn't you
either sort the new lists before comparing them, or just avoid the list
step altogether?

  sorted(list(set(x))) == sorted(list(set(y)))
  set(x) == set(y)

>        print("=============================================================")
>        print("Merge outputs differ")
> 
> 

Re: svn commit: r1291520 - /subversion/trunk/subversion/tests/cmdline/svntest/actions.py

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
philip@apache.org wrote on Mon, Feb 20, 2012 at 23:37:52 -0000:
> +    # The different orders of the real and dry-run merges may cause
> +    # the "Merging rX through rY into" lines to be duplicated a
> +    # different number of times in the two outputs.  The list-set-list
> +    # conversion removes duplicates so these differences are ignored.
> +    # It also removes "U some/path" duplicate lines.  Perhaps we
> +    # should avoid that?
> +    out_copy = list(set(out_copy))
> +    out_dry_copy = list(set(out_dry_copy))
> +
>      if out_copy != out_dry_copy:

You're converting sets->lists and then comparing them.  Shouldn't you
either sort the new lists before comparing them, or just avoid the list
step altogether?

  sorted(list(set(x))) == sorted(list(set(y)))
  set(x) == set(y)

>        print("=============================================================")
>        print("Merge outputs differ")
> 
>