dlr tigris.org wrote on 09/27/2006 06:03:14 PM:
> Author: dlr
> Date: Wed Sep 27 15:03:14 2006
> New Revision: 21685
>
> Log:
> Fix issue #2533 (really this time), making 'svn status
-u' show
> remotely changed properties on the root of a working
copy (now without
> pesky double status output for paths at the root of the
WC with
> '-v'!).
>
> This commit reverts portions of r21638.
>
> * subversion/libsvn_wc/status.c
> (close_directory): Store remote prop changes for the
root of our
> working copy as flag's on the edit baton's
anchor_status field,
> rather than as status changes of the current
directory (which
> proved problematic for the algorithms used for
status output).
>
> (tweak_statushash): Undo skip of the test for issue
#2122 on the
> root directory (added by r21638).
>
> * subversion/tests/cmdline/stat_tests.py
> (test_list): Remove the XFail wrapper from the
> status_update_with_incoming_props() test.
>
> Patch by: lgo
> me
> Found by: pburba
>
>
> Modified:
> trunk/subversion/libsvn_wc/status.c
> trunk/subversion/tests/cmdline/stat_tests.py
>
> Modified: trunk/subversion/libsvn_wc/status.c
> URL: http://svn.collab.
> net/viewvc/svn/trunk/subversion/libsvn_wc/status.c?
> pathrev=21685&r1=21684&r2=21685
>
============================================================
==================
> --- trunk/subversion/libsvn_wc/status.c (original)
> +++ trunk/subversion/libsvn_wc/status.c Wed Sep 27
15:03:14 2006
>  -1039,13 +1039,8 
> correctly in the first, that path would
either be mentioned
> as an 'add' or not mentioned at all,
depending on how we
> eventually fix the bugs in non-recursivity.
See issue
> - #2122 for details.
> -
> - This behavior isn't appropriate for the root
directory of our
> - WC, which may have properties which were
changed remotely
> - (see issue #2533). */
> - if ((is_dir_baton && ((struct dir_baton
*) baton)->parent_baton)
&&
> - repos_text_status != svn_wc_status_added)
> + #2122 for details. */
> + if (repos_text_status != svn_wc_status_added)
> return SVN_NO_ERROR;
>
> /* Use the public API to get a statstruct, and
put it into the
hash. */
>  -1583,18 +1578,27 
> repos_prop_status = db->prop_changed ?
svn_wc_status_modified
: 0;
> }
>
> - /* Add this directory's properties to its parent
directory's
> - status hash, or if it's the root of the WC,
to its own status
> - hash. Note that tweak_statushash() won't do
anything if
> - repos_text_status is not svn_wc_status_added.
> -
> - NOTE: When we add directory locking, we need
to find a
> - directory lock here. */
> - SVN_ERR(tweak_statushash((pb ? pb : db), TRUE,
> - eb->adm_access,
> - db->path, TRUE,
> - repos_text_status,
> - repos_prop_status,
NULL));
> + /* Maybe add this directory to its parent's
status hash. Note
> + that tweak_statushash won't do anything if
repos_text_status
> + is not svn_wc_status_added. */
> + if (pb)
> + {
> + /* ### When we add directory locking, we
need to find a
> + ### directory lock here. */
> + SVN_ERR(tweak_statushash(pb, TRUE,
> + eb->adm_access,
> + db->path, TRUE,
> + repos_text_status,
> + repos_prop_status,
NULL));
> + }
> + else
> + {
> + /* We're editing the root dir of the WC. As
its repos
> + status info isn't otherwise set, set it
directly to
> + trigger invocation of the status callback
below. */
> + eb->anchor_status->repos_prop_status =
repos_prop_status;
> + eb->anchor_status->repos_text_status =
repos_text_status;
Hello Gents,
Please don't kill the messenger, but I found another problem
with the
latest fix for issue #2533.
When eb->anchor_status->repos_prop_status and
eb->anchor_status->repos_text_status are set above,
the values of
repos_prop_status repos_text_status may be 0 (from lines
1573, 1577, or
1578). svn_wc_status_kind explicitly starts its enumeration
at 1, so this
value is invalid. The most obvious ill-effect this has is
with svn st -u
-v --xml, which trips the abort() on line 77 in
generate_status_desc() in
svn/status.c.
The attached patch fixes the problem by using
svn_wc_status_none rather
than 0 on lines 1573, 1577, and 1578. I also added a
regression test for
this by expanding status_update_with_incoming_props.
This patch contains one change that is somewhat unrelated to
r21685: In
the compare_unordered_output stat test, the way the output
of
svntest.actions.run_and_verify_svn() is tested for
correctness has
changed. Instead of passing the expected output, I examine
the output
separately, without sensitivity to the order in which status
reports the
paths. For an explanation of why this is necessary see:
ht
tp://svn.haxx.se/dev/archive-2006-08/0669.shtml.
I can remove this from the patch and commit it separately if
you all want,
but the tests won't pass without it for me on XP and it's a
fairly small
change so I thought I'd include it. Ultimately a more
robust solution to
this problem is to add another argument to
run_and_verify_svn() to tell it
if we care about order, but I don't really have time right
now to update
it's 983 callers. It's on my TODO list though.
Anyway, I can commit this later today, but wanted to run it
by you both
since you've been spending some time in libsvn_wc/status.c
lately.
Paul B.
[[[
Fix r21685: svn st -u --xml aborts when root of WC has prop
changes.
* subversion/libsvn_wc/status.c
(close_directory): Don't use 0 when setting
svn_wc_status_kind enums
as this is an invalid value, use svn_wc_status_none
instead.
* subversion/tests/cmdline/stat_tests.py
Import wc from svntest.
(status_update_with_incoming_props): Expand test to check
for svn
st -u --xml abort. Use new compare_unordered_output()
helper to
desensitize the test to the order of paths reported by
status.
* subversion/tests/cmdline/svntest/main.py
(compare_unordered_output): New utility to compare lines
of output
without sensitivity to their order.
]]]
Index: subversion/libsvn_wc/status.c
============================================================
=======
--- subversion/libsvn_wc/status.c (revision 21691)
+++ subversion/libsvn_wc/status.c (working copy)
 -1570,12
+1570,15 
if (db->added)
{
repos_text_status = svn_wc_status_added;
- repos_prop_status = db->prop_changed ?
svn_wc_status_added : 0;
+ repos_prop_status = db->prop_changed ?
svn_wc_status_added
+ : svn_wc_status_none;
}
else
{
- repos_text_status = db->text_changed ?
svn_wc_status_modified : 0;
- repos_prop_status = db->prop_changed ?
svn_wc_status_modified : 0;
+ repos_text_status = db->text_changed ?
svn_wc_status_modified
+ : svn_wc_status_none;
+ repos_prop_status = db->prop_changed ?
svn_wc_status_modified
+ : svn_wc_status_none;
}
/* Maybe add this directory to its parent's status
hash. Note
Index: subversion/tests/cmdline/stat_tests.py
============================================================
=======
--- subversion/tests/cmdline/stat_tests.py (revision 21691)
+++ subversion/tests/cmdline/stat_tests.py (working copy)
 -21,6
+21,7 
# Our testing module
import svntest
+from svntest import wc
# (abbreviation)
 -1058,22
+1059,69 
" * 1 " + wc_dir +
"n",
"Status against revision: 2n" ]
- svntest.actions.run_and_verify_svn(None,
- xout,
- [],
- "status",
"-u", wc_dir)
+ output, errput = svntest.actions.run_and_verify_svn(None,
+ None,
+ [],
+
"status", "-u",
+
wc_dir)
+ svntest.main.compare_unordered_output(xout, output)
+
xout = [" 1 1 jrandom
" +
os.path.join(wc_dir, "iota") +
"n",
" 1 1 jrandom
" + A_path + "n",
" * 1 1 jrandom
" + wc_dir + "n",
"Status against revision: 2n" ]
- svntest.actions.run_and_verify_svn(None,
- xout,
- [],
- "status",
"-uvN", wc_dir)
+ output, errput = svntest.actions.run_and_verify_svn(None,
None, [],
+
"status", "-uvN",
+
wc_dir)
+ svntest.main.compare_unordered_output(xout, output)
+
+ # Retrieve last changed date from svn log
+ output, error = svntest.actions.run_and_verify_svn(None,
None, [],
+ 'log',
wc_dir,
+
'--xml', '-r1')
+
+ info_msg = "<date>"
+ for line in output:
+ if line.find(info_msg) >= 0:
+ time_str = line[:len(line)]
+ break
+ else:
+ raise svntest.Failure
+
+ xout = ["<?xml
version="1.0"?>n",
+ "<status>n",
+ "<targetn",
+ " path="%s">n" %
(wc_dir),
+ "<entryn",
+ " path="%s">n" %
(wc_dir),
+ "<wc-statusn",
+ " props="none"n",
+ " item="normal"n",
+ " revision="1">n",
+ "<commitn",
+ " revision="1">n",
+ "<author>%s</author>n" %
svntest.main.wc_author,
+ time_str,
+ "</commit>n",
+ "</wc-status>n",
+ "<repos-statusn",
+ " props="modified"n",
+ " item="none">n",
+ "</repos-status>n",
+ "</entry>n",
+ "<againstn",
+ " revision="2"/>n",
+ "</target>n",
+ "</status>n",]
+
+ output, error = svntest.actions.run_and_verify_svn (None,
xout, [],
+
'status', wc_dir,
+
'--xml', '-uN')
+
#----------------------------------------------------------
------------
# Test for issue #2468
def status_nonrecursive_update(sbox):
Index: subversion/tests/cmdline/svntest/main.py
============================================================
=======
--- subversion/tests/cmdline/svntest/main.py (revision
21691)
+++ subversion/tests/cmdline/svntest/main.py (working copy)
 -570,6
+570,19 
file_append (hook_path, "#!%sn%s" %
(sys.executable, hook_script_code))
os.chmod (hook_path, 0755)
+
+def compare_unordered_output(expected, actual):
+ """Compare lists of output lines for
equality disregarding the
+ order of the lines"""
+ if len(actual) is not len(expected):
+ raise Failure("Length of expected output not equal
to actual length")
+ for aline in actual:
+ try:
+ i = expected.index(aline)
+ expected.pop(i)
+ except ValueError:
+ raise Failure("Expected output does not match
actual output")
+
###########################################################
###########
# Functions which check the test configuration
# (useful for conditional XFails)
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe subversion.tigris.org
For additional commands, e-mail: dev-help subversion.tigris.org |