zhakov@tigris.org wrote:
> Author: zhakov
> Date: Tue Jan 9 02:20:46 2007
> New Revision: 22940
>
> Log:
> Add option "--keep-local" to svn rm command to keep deleted path in
> current working copy.
>
> To keep files just don't remove them. For directories set keep_local
> flag to TRUE on "this_dir" entry and use it in log_do_commited.
>
> * subversion/include/svn_wc.h
> (svn_wc_delete3): New function declaration.
> (svn_wc_delete2): Deprecate.
> (svn_wc_entry_t): Add new field keep_local.
> * subversion/include/svn_client.h
> (svn_client_delete3): New function.
> (svn_client_delete2): Deprecate.
> * subversion/libsvn_wc/entries.h
> (SVN_WC__ENTRY_ATTR_KEEP_LOCAL): New entry attribute...
> (SVN_WC__ENTRY_MODIFY_KEEP_LOCAL): ...And new modification flag for it.
> (SVN_WC__ENTRY_MODIFY_ALL, SVN_WC__ENTRY_MODIFY_FORCE): Update.
> * subversion/libsvn_wc/entries.c
> (svn_wc__atts_to_entry): Parse 'keep-local'.
> (read_entry, write_entry): Read and write new entry field keep_local.
> (fold_entry): Reset keep_local to FALSE if not scheduled for deletion.
> * subversion/libsvn_wc/wc.h (SVN_WC__KILL_ADM_ONLY): New.
> * subversion/libsvn_wc/log.c
> (log_do_committed): Use svn_wc__make_killme and pass keep_local to it.
> (handle_killme): Destroy only administrative area if kill_adm_only is TRUE.
> (run_log, svn_wc_cleanup2): Check for killme file using
> svn_wc__check_killme and pass kill_adm_only flag to
> handle_killme function.
> * subversion/libsvn_wc/adm_ops.c
> (svn_wc_delete2): Reimplement via wrapper to svn_wc_delete3.
> (svn_wc_delete3): Copied from svn_wc_delete2. Add with keep_local flag
> and pass it to mark_tree. Keep files on disk if keep_local is TRUE.
> (mark_tree): Set keep_local on "this_dir" if requested.
> * subversion/libsvn_wc/adm_files.h
> * subversion/libsvn_wc/adm_files.c
> (svn_wc__make_killme, svn_wc__check_killme): New functions to make
> and check killme file.
> * subversion/libsvn_client/delete.c
> (svn_client__wc_delete): Add keep_local parameter and pass it to
> svn_wc_delete3. Don't check for "awkward" files if keep_local is TRUE.
> (svn_client_delete2): Reimplement via wrapper to svn_client_delete3.
> (svn_client_delete3): New function, takes keep_local.
> * subversion/libsvn_client/client.h
> (svn_client__wc_delete): Add keep_local parameter.
> * subversion/libsvn_client/diff.c
> (merge_file_deleted, merge_dir_deleted): Adjusted calls to
> svn_client__wc_delete.
> * subversion/svn/cl.h
> (svn_cl__longopt_t): Add svn_cl__keep_local_opt.
> (svn_cl__opt_state_t): Add keep_local flag.
> * subversion/svn/delete-cmd.c
> (svn_cl__delete): Use svn_client_delete3 and pass keep_local to it.
> * svn/trunk/subversion/svn/main.c
> (svn_cl__options, svn_opt_subcommand_desc2_t): Add "--keep-local" option
> for delete command.
> (main): Handle '--keep-local' option.
> * subversion/tests/cmdline/basic_tests.py
> (delete_keep_local): New test for deletion with --keep-local.
> (test_list): Add test delete_keep_local.
>
>
> Modified:
> trunk/subversion/include/svn_client.h
> trunk/subversion/include/svn_wc.h
> trunk/subversion/libsvn_client/client.h
> trunk/subversion/libsvn_client/delete.c
> trunk/subversion/libsvn_client/diff.c
> trunk/subversion/libsvn_wc/adm_files.c
> trunk/subversion/libsvn_wc/adm_files.h
> trunk/subversion/libsvn_wc/adm_ops.c
> trunk/subversion/libsvn_wc/entries.c
> trunk/subversion/libsvn_wc/entries.h
> trunk/subversion/libsvn_wc/log.c
> trunk/subversion/libsvn_wc/wc.h
> trunk/subversion/svn/cl.h
> trunk/subversion/svn/delete-cmd.c
> trunk/subversion/svn/main.c
> trunk/subversion/tests/cmdline/basic_tests.py
The copyright notices in these files should probably be updated.
...
> Modified: trunk/subversion/libsvn_wc/adm_files.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/adm_files.c?pathrev=22940&r1=22939&r2=22940
> ==============================================================================
> --- trunk/subversion/libsvn_wc/adm_files.c (original)
> +++ trunk/subversion/libsvn_wc/adm_files.c Tue Jan 9 02:20:46 2007
> @@ -264,6 +264,62 @@
> }
>
>
> +/* Create an killme file in the adm area.
> + *
> + * If ADM_ONLY is non-zero then only administrative area will be removed,
> + * otherwise all directory.
> + */
> +svn_error_t *
> +svn_wc__make_killme(svn_wc_adm_access_t *adm_access,
> + svn_boolean_t adm_only,
> + apr_pool_t *pool)
> +{
> + const char *path;
> +
> + SVN_ERR(svn_wc__adm_write_check(adm_access));
> +
> + path = extend_with_adm_name(svn_wc_adm_access_path(adm_access),
> + NULL, FALSE, pool, SVN_WC__ADM_KILLME, NULL);
> +
> + return svn_io_file_create(path, adm_only ? SVN_WC__KILL_ADM_ONLY : "", pool);
> +}
> +
> +svn_error_t *
> +svn_wc__check_killme(svn_wc_adm_access_t *adm_access,
> + svn_boolean_t *exists,
> + svn_boolean_t *kill_adm_only,
> + apr_pool_t *pool)
> +{
> + const char *path;
> + svn_error_t *err;
> + svn_stringbuf_t *contents;
> +
> + path = extend_with_adm_name(svn_wc_adm_access_path(adm_access),
> + NULL, FALSE, pool, SVN_WC__ADM_KILLME, NULL);
> +
> + /* By default think that killme file exists. */
> + *exists = TRUE;
> + err = svn_stringbuf_from_file(&contents, path, pool);
> +
> + if (err && APR_STATUS_IS_ENOENT(err->apr_err))
> + {
> + /* Killme file doesn't exist. */
> + *exists = FALSE;
> + svn_error_clear(err);
> + }
> + else if (err)
> + {
> + return err;
> + }
> +
> + /* If killme file contains string 'adm-only' then remove only administrative
> + area. */
> + *kill_adm_only = svn_string_compare_stringbuf
> + (svn_string_create(SVN_WC__KILL_ADM_ONLY, pool), contents);
On trunk, I'm running into instances where contents might be null.
Specifically, this happens when running 'svn cleanup', and it is causing
a segfault. My initial reaction was to check for the null case and just
return FALSE before calling svn_string_compare_stringbuf(), but I'm not
familiar enough with the code to know if that's fixing the symptom or
the problem.
> +
> + return SVN_NO_ERROR;
> +}
> +
>
> /*** Syncing files in the adm area. ***/
>
...
-Hyrum
Received on Tue Jan 9 20:13:53 2007