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

Re: [PATCH] svn_client_commit2/3 doesn't correctly honor recursive flag anymore

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Sat, 29 Nov 2008 20:17:03 +0200 (Jerusalem Standard Time)

Martin Hauner wrote on Sat, 29 Nov 2008 at 17:59 +0100:
> Hi,
>
> svn_client_commit2/3 (since 1.5.0) does no longer behave like it did before
> (1.4.x).
>

Yes, good catch. But svn/main.c also has to be changed in the same way
(I found this as soon as I tried to reproduce the regression with the
cmdline client). And when I do this, commit_tests 26 breaks:

[[[
CMD: svn.exe ci -m "log msg" -N "svn-test-work\working_copies\commit_tests-26\dirA" --config-dir "F:\Data\Unzip\svn\trunk\Debug\subversion\tests\cmdline\svn-test-work\local_tmp\config" --password rayjandom --no-auth-cache --username jrandom <TIME = 0.203000>
Adding svn-test-work\working_copies\commit_tests-26\dirA

Committed revision 3.
=============================================================
Expected 'dirA' and actual 'dirA' in output tree are different!
=============================================================
EXPECTED NODE TO BE:
=============================================================
 * Node name: dirA
    Path: svn-test-work\working_copies\commit_tests-26\dirA
    Contents: N/A (node is a directory)
    Properties: {}
    Attributes: {'verb': 'Adding'}
    Children: 2
=============================================================
ACTUAL NODE FOUND:
=============================================================
 * Node name: dirA
    Path: svn-test-work\working_copies\commit_tests-26\dirA
    Contents: None
    Properties: {}
    Attributes: {'verb': 'Adding'}
    Children: None (node is probably a file)
Unequal Types: one Node is a file, the other is a directory
Unequal at node commit_tests-26
Unequal at node working_copies
Unequal at node svn-test-work
Output of commit is unexpected
EXPECTED OUTPUT TREE:
ROOT
  +-- svn-test-work
        +-- working_copies
              +-- commit_tests-26
                    +-- dirA
                          |-- fileA
                          +-- fileB
ACTUAL OUTPUT TREE:
ROOT
  +-- svn-test-work
        +-- working_copies
              +-- commit_tests-26
                    +-- dirA
ACTUAL OUTPUT TREE:
svntest.wc.State('svn-test-work\working_copies\commit_tests-26\', {
  'dirA' : Item(verb='Adding'),
})
EXCEPTION: SVNTreeUnequal
Traceback (most recent call last):
  File "F:\Data\Unzip\svn\trunk\subversion\tests\cmdline\svntest\main.py", line 1133, in run
    rc = self.pred.run(**kw)
  File "F:\Data\Unzip\svn\trunk\subversion\tests\cmdline\svntest\testcase.py", line 121, in run
    return self.func(sandbox)
  File "F:\Data\Unzip\svn\trunk\subversion/tests/cmdline/commit_tests.py", line 1609, in commit_nonrecursive
    '-N', os.path.join(wc_dir, dirA_path))
  File "F:\Data\Unzip\svn\trunk\subversion\tests\cmdline\svntest\actions.py", line 1133, in run_and_verify_commit
    tree.compare_trees ("output", actual, output_tree)
  File "F:\Data\Unzip\svn\trunk\subversion\tests\cmdline\svntest\tree.py", line 596, in compare_trees
    singleton_handler_b, b_baton)
  File "F:\Data\Unzip\svn\trunk\subversion\tests\cmdline\svntest\tree.py", line 596, in compare_trees
    singleton_handler_b, b_baton)
  File "F:\Data\Unzip\svn\trunk\subversion\tests\cmdline\svntest\tree.py", line 596, in compare_trees
    singleton_handler_b, b_baton)
  File "F:\Data\Unzip\svn\trunk\subversion\tests\cmdline\svntest\tree.py", line 596, in compare_trees
    singleton_handler_b, b_baton)
  File "F:\Data\Unzip\svn\trunk\subversion\tests\cmdline\svntest\tree.py", line 604, in compare_trees
    raise SVNTreeUnequal
SVNTreeUnequal
FAIL: commit_tests.py 26: commit named targets with -N (issues #1195, #1239)
]]]

It seems that it checks for this specific behaviour. It even has
a comment explaining it:

  ### These days, -N should be equivalent to --depth=files in almost
  ### all cases. There are some exceptions (e.g., status), but commit
  ### is not an exception.

The comment, however, seems inaccurate, since 'svn1.4 ci -N' definitely
does (the equivalent of) svn_depth_empty.

Have the semantics of 'commit' been intentionally changed? Or should we
just fix the test to expect -N to mean svn_depth_empty?

My patch is ...
[[[
Index: subversion/svn/main.c
===================================================================
--- subversion/svn/main.c (revision 34473)
+++ subversion/svn/main.c (working copy)
@@ -1801,7 +1801,8 @@ main(int argc, const char *argv[])
           opt_state.depth = SVN_DEPTH_INFINITY_OR_IMMEDIATES(FALSE);
         }
       else if (subcommand->cmd_func == svn_cl__revert
- || subcommand->cmd_func == svn_cl__add)
+ || subcommand->cmd_func == svn_cl__add
+ || subcommand->cmd_func == svn_cl__commit)
         {
           /* In pre-1.5 Subversion, some commands treated -N like
              --depth=empty, so force that mapping here. Anyway, with
Index: subversion/libsvn_client/deprecated.c
===================================================================
--- subversion/libsvn_client/deprecated.c (revision 34473)
+++ subversion/libsvn_client/deprecated.c (working copy)
@@ -297,7 +297,7 @@ svn_client_commit3(svn_commit_info_t **commit_info
                    svn_client_ctx_t *ctx,
                    apr_pool_t *pool)
 {
- svn_depth_t depth = SVN_DEPTH_INFINITY_OR_FILES(recurse);
+ svn_depth_t depth = SVN_DEPTH_INFINITY_OR_EMPTY(recurse);
 
   return svn_client_commit4(commit_info_p, targets, depth, keep_locks,
                             FALSE, NULL, NULL, ctx, pool);
]]]

Thanks,

Daniel

> I have a folder with a changed property (svn:ignore) and the folder contains a
> few modified files. With 1.4 i could commit just the property change with the
> old api by settings the recursive flag to false. That doesn't work anymore.
> Now it also commits the modified files in the folder. It ignores any changes
> deeper in the tree.
>
> I have attached two patches to fix this on trunk and on the 1.5.x branch. It
> is two patches because the old commit api is in a different file on trunk.
>
>
> [[
> Fixed backward compatibility bug. It is not possible to commit only
> property changes on a folder with modified child items. The commit will
> also include the direct child items (svn_client_commit3 and earlier).
>
> * subversion/libsvn_client/deprecated.c
> (svn_client_commit3): turn non recursive into svn_depth_empty instead
> of svn_depth_files.
> ]]
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-11-29 19:17:23 CET

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.