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

[PATCH] svn_wc_add3(): handles depth on add (was Re: [PATCH] Fix --depth behavior for svn add)

From: Rui, Guo <timmyguo_at_mail.ustc.edu.cn>
Date: Sun, 4 May 2008 21:26:33 +0800

On Mon, Apr 28, 2008 at 05:57:52PM -0400, Karl Fogel wrote:
>
> Basically, I think just adding depth to the regular add API is okay.
>
Here comes the patch that introduce a new svn_wc_add3() to handle depth on add
correctly.

svn_add3.diff:
[[[
Introduced a new svn_wc_add3() to handle depth correctly. This makes the
--depth option in 'svn add' works in the same way as ci, up etc.

* subversion/include/svn_wc.h
  (svn_wc_add3): New, accept depth parameters and ignore it for files.
  (svn_wc_add2): Now deprecated.

* subversion/libsvn_wc/adm_ops.c
  (svn_wc_add3): New, accept depth parameters and ignore it for files.
    svn_depth_infinity will be used upon invalid depth value. Obsolete comment
    deleted.
  (svn_wc_add2): Deprecated. Now calls svn_wc_add3 with a default
    svn_depth_infinity.
    
* subversion/libsvn_wc/copy.c
  (copy_added_file_administratively,
  copy_added_dir_administratively,
  copy_dir_administratively): Switch to svn_wc_add3, with a default
    svn_depth_infinity depth.

* subversion/libsvn_client/merge.c
  (merge_dir_added): Switch to svn_wc_add3, with a default svn_depth_infinity
    depth.

* subversion/libsvn_client/copy.c
  (repos_to_wc_copy_single): Switch to svn_wc_add3, with a default
    svn_depth_infinity depth.

* subversion/libsvn_client/add.c
  (add_file, add_dir_recursive,
  add, add_parent_dirs): Switch to svn_wc_add3, with a default
    svn_depth_infinity depth.
  (add): Pass all directory target to add_dir_recursive, otherwise adjustment
    will also be needed here.

* subversion/tests/cmdline/depth_tests.py
  (add_tree_with_depth_files): Renamed to add_tree_with_depth to reflect the
    new content: depth verified & new tests added for the --force & --parents
    situation
  (test_list): update according to the rename.
]]]

svn_add3_cleanup.diff
[[[
Some cleanups:
* subversion/include/svn_client.h
  (svn_client_add3): Update the document that -N is mapped to svn_depth_empty

* subversion/libsvn_client/add.c
  (svn_client_add4): Fold up duplicated code in both path of a branch
  (svn_client_add3): Map the -N to svn_depth_empty, make it consistent with
    the mapping in svn/main.c
]]]

Some questions about the svn_wc__do_update_cleanup() call in the original
svn_wc_add2(). This function is called only when add-with-history and will
recursively tweak the children entries. However, the svn_wc_add2() adds only
the single item specified in the parameter, rather than the whole tree. So, to
put a sub-tree under version control, we have to crawl the tree and call
svn_wc_add2() many times. If we call svn_wc_add2() in a root-first favor, the
svn_wc__do_update_cleanup() call does nothing more than tweak 'this_dir'; if
we call svn_wc_add2() in a root_last favor (I really doubt this), the
svn_wc__do_update_cleanup() call will tweak each children many times. Why do
we have to call this function?

Rui, Guo

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org

Received on 2008-05-04 15:27:17 CEST

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.