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

[PATCH] Stop using deprecated functions [was: Still using some of our deprecated functions]

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2006-02-13 15:15:14 CET

Julian Foad wrote:
> We are still using several of our own deprecated functions and types.
[...]
> subversion/libsvn_subr/config.c:0654: svn_config_enumerate_sections
> subversion/libsvn_subr/config.c:0655: svn_config_section_enumerator_t
> subversion/libsvn_subr/config.c:0660: svn_config_section_enumerator_t
> subversion/libsvn_subr/config.c:0719: svn_config_enumerator_t

These are fine: used only in compatibility code.

> subversion/libsvn_repos/dump.c:1038: svn_repos_replay
> subversion/svnlook/main.c:0386: svn_repos_replay
> subversion/tests/libsvn_repos/repos-test.c:0408: svn_repos_replay

Upgraded. (By this I mean: call the new function, just passing default or
backward-compatible values for any new parameters.)

> subversion/libsvn_repos/load.c:0087: svn_repos_parser_fns_t
> subversion/libsvn_repos/load.c:0733: svn_repos_parser_fns_t
> subversion/libsvn_repos/load.c:1247: svn_repos_parser_fns_t
> subversion/libsvn_repos/load.c:1252: svn_repos_get_fs_build_parser
> subversion/libsvn_repos/load.c:1265: svn_repos_parser_fns_t
> subversion/libsvn_repos/load.c:1274: svn_repos_parser_fns_t

These are fine: used only in compatibility code. (The new function is calling
the old one. Generally it should be done the other way round for efficiency
and maintainability, but this isn't frequently called so no big deal.)

> subversion/svndumpfilter/main.c:0740: svn_repos_parser_fns_t

Upgraded.

> subversion/libsvn_client/commit_util.c:0608: svn_wc_walk_entries

Upgraded, adding cancellation to this part of the walk.

> subversion/libsvn_client/diff.c:1748: svn_ra_do_diff
> subversion/libsvn_client/diff.c:2181: svn_ra_do_diff
> subversion/libsvn_client/ra.c:0069: svn_io_open_unique_file

Upgraded.

> subversion/libsvn_wc/adm_ops.c:0511: svn_wc_process_committed

What the heck? This is the "2" version recursing via the original version,
thus losing the "remove_lock" parameter on recursion. Is this a bug or is it
the desired behaviour?

I'm not touching that yet.

> subversion/libsvn_wc/adm_ops.c:0777: svn_io_get_dirents

Upgraded.

> subversion/libsvn_wc/status.c:0798: svn_io_get_dirents

Upgraded. Yikes - this was calling the old function and yet using the new
extended result type; the implementation just happened to be providing it.

> subversion/svnlook/main.c:1154: svn_subst_translate_cstring
> subversion/svnlook/main.c:1502: svn_repos_history
> subversion/svnsync/main.c:0244: svn_io_open_unique_file
> subversion/mod_dav_svn/repos.c:2382: svn_io_get_dirents

Upgraded.

The rest of the calls to deprecated functions were in the tests. I'd say we
needn't upgrade them until we are prepared to make them test some of the new
features of the new APIs. Until then, they might as well ensure that the old
versions continue to work.

Could someone cast an eye over this please?

- Julian

Stop calling deprecated APIs; call the revised versions instead. In most
cases, don't try to use any new features of the new APIs.

* subversion/libsvn_client/commit_util.c
  (harvest_committables): Call the new svn_wc_walk_entries2() and enable
    cancellation in it.

* subversion/libsvn_client/diff.c
  (do_merge, diff_repos_wc): Call the new svn_ra_do_diff2().
* subversion/libsvn_client/ra.c
  (open_tmp_file): Call the new svn_io_open_unique_file2().
* subversion/libsvn_repos/dump.c
  (svn_repos_dump_fs2): Call the new svn_repos_replay2().
* subversion/libsvn_wc/adm_ops.c
  (erase_from_wc): Call the new svn_io_get_dirents2(). (The new part of the
    result is not used.)
* subversion/libsvn_wc/status.c
  (get_dir_status): Call the new svn_io_get_dirents2(). (The new part of the
    result was already being used; the reimplementation of the old function
    happened to provide it.)
* subversion/mod_dav_svn/repos.c
  (dav_svn_deliver): Call the new svn_io_get_dirents2().
* subversion/svndumpfilter/main.c
  (filtering_vtable): Upgrade to svn_repos_parser_fns2_t.
  (do_filter): Call the new svn_repos_parse_dumpstream2().
* subversion/svnlook/main.c
  (generate_delta_tree): Call the new svn_repos_replay2().
  (do_log): Call the new svn_subst_translate_cstring2().
  (do_history): Call the new svn_repos_history2().
* subversion/svnsync/main.c
  (open_tmp_file): Call the new svn_io_open_unique_file2().
* subversion/tests/libsvn_repos/repos-test.c
  (node_tree_delete_under_copy): Call the new svn_repos_replay2().

Index: subversion/libsvn_client/commit_util.c
===================================================================
--- subversion/libsvn_client/commit_util.c (revision 18446)
+++ subversion/libsvn_client/commit_util.c (working copy)
@@ -601,12 +601,13 @@ harvest_committables (apr_hash_t *commit
       svn_pool_destroy (loop_pool);
     }
 
- /* Fetch lock tokens for descendants of deleted directries. */
+ /* Fetch lock tokens for descendants of deleted directories. */
   if (lock_tokens && entry->kind == svn_node_dir
       && (state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE))
     {
- SVN_ERR (svn_wc_walk_entries (path, adm_access, &add_tokens_callbacks,
- lock_tokens, FALSE, pool));
+ SVN_ERR (svn_wc_walk_entries2 (path, adm_access, &add_tokens_callbacks,
+ lock_tokens, FALSE, ctx->cancel_func,
+ ctx->cancel_baton, pool));
     }
 
   return SVN_NO_ERROR;
Index: subversion/libsvn_client/diff.c
===================================================================
--- subversion/libsvn_client/diff.c (revision 18446)
+++ subversion/libsvn_client/diff.c (working copy)
@@ -1745,14 +1745,15 @@ do_merge (const char *initial_URL1,
                                         &diff_edit_baton,
                                         pool));
 
- SVN_ERR (svn_ra_do_diff (ra_session,
- &reporter, &report_baton,
- end_revnum,
- "",
- recurse,
- ignore_ancestry,
- URL2,
- diff_editor, diff_edit_baton, pool));
+ SVN_ERR (svn_ra_do_diff2 (ra_session,
+ &reporter, &report_baton,
+ end_revnum,
+ "",
+ recurse,
+ ignore_ancestry,
+ TRUE, /* text_deltas */
+ URL2,
+ diff_editor, diff_edit_baton, pool));
 
   SVN_ERR (reporter->set_path (report_baton, "", start_revnum, FALSE, NULL,
                                pool));
@@ -2178,14 +2179,15 @@ diff_repos_wc (const apr_array_header_t
            (&rev, ra_session, revision1,
             (path1 == url1) ? NULL : path1, pool));
   callback_baton->revnum1 = rev;
- SVN_ERR (svn_ra_do_diff (ra_session,
- &reporter, &report_baton,
- rev,
- target ? svn_path_uri_decode (target, pool) : NULL,
- recurse,
- ignore_ancestry,
- url1,
- diff_editor, diff_edit_baton, pool));
+ SVN_ERR (svn_ra_do_diff2 (ra_session,
+ &reporter, &report_baton,
+ rev,
+ target ? svn_path_uri_decode (target, pool) : NULL,
+ recurse,
+ ignore_ancestry,
+ TRUE, /* text_deltas */
+ url1,
+ diff_editor, diff_edit_baton, pool));
 
   /* Create a txn mirror of path2; the diff editor will print
      diffs in reverse. :-) */
Index: subversion/libsvn_client/ra.c
===================================================================
--- subversion/libsvn_client/ra.c (revision 18446)
+++ subversion/libsvn_client/ra.c (working copy)
@@ -66,7 +66,8 @@ open_tmp_file (apr_file_t **fp,
   truepath = svn_path_join (truepath, "tempfile", pool);
 
   /* Open a unique file; use APR_DELONCLOSE. */
- SVN_ERR (svn_io_open_unique_file (fp, NULL, truepath, ".tmp", TRUE, pool));
+ SVN_ERR (svn_io_open_unique_file2 (fp, NULL, truepath, ".tmp",
+ svn_io_file_del_on_close, pool));
 
   return SVN_NO_ERROR;
 }
Index: subversion/libsvn_repos/dump.c
===================================================================
--- subversion/libsvn_repos/dump.c (revision 18446)
+++ subversion/libsvn_repos/dump.c (working copy)
@@ -1035,8 +1035,9 @@ svn_repos_dump_fs2 (svn_repos_t *repos,
         }
       else
         {
- SVN_ERR (svn_repos_replay (to_root, dump_editor,
- dump_edit_baton, subpool));
+ SVN_ERR (svn_repos_replay2 (to_root, "", SVN_INVALID_REVNUM, FALSE,
+ dump_editor, dump_edit_baton,
+ NULL, NULL, subpool));
         }
 
     loop_end:
Index: subversion/libsvn_wc/adm_ops.c
===================================================================
--- subversion/libsvn_wc/adm_ops.c (revision 18446)
+++ subversion/libsvn_wc/adm_ops.c (working copy)
@@ -774,7 +774,7 @@ erase_from_wc (const char *path,
           }
 
         /* Now handle any remaining unversioned items */
- SVN_ERR (svn_io_get_dirents (&unver, path, pool));
+ SVN_ERR (svn_io_get_dirents2 (&unver, path, pool));
         for (hi = apr_hash_first (pool, unver); hi; hi = apr_hash_next (hi))
           {
             const void *key;
Index: subversion/libsvn_wc/status.c
===================================================================
--- subversion/libsvn_wc/status.c (revision 18446)
+++ subversion/libsvn_wc/status.c (working copy)
@@ -795,7 +795,7 @@ get_dir_status (struct edit_baton *eb,
   SVN_ERR (svn_wc_entries_read (&entries, adm_access, FALSE, subpool));
 
   /* Read PATH's dirents. */
- SVN_ERR (svn_io_get_dirents (&dirents, path, subpool));
+ SVN_ERR (svn_io_get_dirents2 (&dirents, path, subpool));
 
   /* Get this directory's entry. */
   SVN_ERR (svn_wc_entry (&dir_entry, path, adm_access, FALSE, subpool));
Index: subversion/mod_dav_svn/repos.c
===================================================================
--- subversion/mod_dav_svn/repos.c (revision 18446)
+++ subversion/mod_dav_svn/repos.c (working copy)
@@ -2561,7 +2561,7 @@ static dav_error * dav_svn_deliver(const
         const char *fs_parent_path =
           dav_svn_get_fs_parent_path(resource->info->r);
 
- serr = svn_io_get_dirents(&dirents, fs_parent_path, resource->pool);
+ serr = svn_io_get_dirents2(&dirents, fs_parent_path, resource->pool);
         if (serr != NULL)
           return dav_svn_convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
                                      "couldn't fetch dirents of SVNParentPath",
@@ -2575,18 +2575,18 @@ static dav_error * dav_svn_deliver(const
             const void *key;
             apr_ssize_t klen;
             void *val;
- svn_node_kind_t *path_kind;
+ svn_io_dirent_t *dirent;
             svn_fs_dirent_t *ent = apr_pcalloc(resource->pool, sizeof(*ent));
 
             apr_hash_this(hi, &key, &klen, &val);
- path_kind = val;
+ dirent = val;
 
- if (*path_kind != svn_node_dir)
+ if (dirent->kind != svn_node_dir)
               continue;
 
             ent->name = key;
             ent->id = NULL; /* ### does it matter? */
- ent->kind = *path_kind;
+ ent->kind = dirent->kind;
 
             apr_hash_set(entries, key, APR_HASH_KEY_STRING, ent);
           }
Index: subversion/svndumpfilter/main.c
===================================================================
--- subversion/svndumpfilter/main.c (revision 18446)
+++ subversion/svndumpfilter/main.c (working copy)
@@ -737,15 +737,17 @@ close_revision (void *revision_baton)
 
 
 /* Filtering vtable */
-svn_repos_parser_fns_t filtering_vtable =
+svn_repos_parser_fns2_t filtering_vtable =
   {
     new_revision_record,
     uuid_record,
     new_node_record,
     set_revision_property,
     set_node_property,
+ NULL,
     remove_node_props,
     set_fulltext,
+ NULL,
     close_node,
     close_revision
   };
@@ -958,8 +960,8 @@ do_filter (apr_getopt_t *os,
     }
 
   SVN_ERR (parse_baton_initialize (&pb, opt_state, do_exclude, pool));
- SVN_ERR (svn_repos_parse_dumpstream (pb->in_stream, &filtering_vtable, pb,
- NULL, NULL, pool));
+ SVN_ERR (svn_repos_parse_dumpstream2 (pb->in_stream, &filtering_vtable, pb,
+ NULL, NULL, pool));
 
   /* The rest of this is just reporting. If we aren't reporting, get
      outta here. */
Index: subversion/svnlook/main.c
===================================================================
--- subversion/svnlook/main.c (revision 18446)
+++ subversion/svnlook/main.c (working copy)
@@ -383,7 +383,8 @@ generate_delta_tree (svn_repos_node_t **
                                   base_root, root, pool, edit_pool));
 
   /* Drive our editor. */
- SVN_ERR (svn_repos_replay (root, editor, edit_baton, edit_pool));
+ SVN_ERR (svn_repos_replay2 (root, "", SVN_INVALID_REVNUM, FALSE,
+ editor, edit_baton, NULL, NULL, edit_pool));
 
   /* Return the tree we just built. */
   *tree = svn_repos_node_from_baton (edit_baton);
@@ -1151,9 +1152,9 @@ do_log (svnlook_ctxt_t *c, svn_boolean_t
   /* We immitate what svn_cmdline_printf does here, since we need the byte
      size of what we are going to print. */
 
- SVN_ERR (svn_subst_translate_cstring (prop_value->data, &prop_value_eol,
- APR_EOL_STR, TRUE,
- NULL, FALSE, pool));
+ SVN_ERR (svn_subst_translate_cstring2 (prop_value->data, &prop_value_eol,
+ APR_EOL_STR, TRUE,
+ NULL, FALSE, pool));
 
   err = svn_cmdline_cstring_from_utf8 (&prop_value_native, prop_value_eol,
                                        pool);
@@ -1499,8 +1500,8 @@ do_history (svnlook_ctxt_t *c,
      copies. */
   args.fs = c->fs;
   args.show_ids = show_ids;
- SVN_ERR (svn_repos_history (c->fs, path, print_history, &args,
- 0, c->rev_id, 1, pool));
+ SVN_ERR (svn_repos_history2 (c->fs, path, print_history, &args,
+ NULL, NULL, 0, c->rev_id, 1, pool));
   return SVN_NO_ERROR;
 }
 
Index: subversion/svnsync/main.c
===================================================================
--- subversion/svnsync/main.c (revision 18446)
+++ subversion/svnsync/main.c (working copy)
@@ -252,7 +252,8 @@ open_tmp_file (apr_file_t **fp, void *ca
 
   path = svn_path_join (path, "tempfile", pool);
 
- SVN_ERR (svn_io_open_unique_file (fp, NULL, path, ".tmp", TRUE, pool));
+ SVN_ERR (svn_io_open_unique_file2 (fp, NULL, path, ".tmp",
+ svn_io_file_del_on_close, pool));
 
   return SVN_NO_ERROR;
 }
Index: subversion/tests/libsvn_repos/repos-test.c
===================================================================
--- subversion/tests/libsvn_repos/repos-test.c (revision 18446)
+++ subversion/tests/libsvn_repos/repos-test.c (working copy)
@@ -405,8 +405,9 @@ node_tree_delete_under_copy (const char
   SVN_ERR (svn_repos_node_editor (&editor, &edit_baton, repos,
                                   revision_root, revision_2_root,
                                   pool, subpool));
- SVN_ERR (svn_repos_replay (revision_2_root, editor, edit_baton, subpool));
-
+ SVN_ERR (svn_repos_replay2 (revision_2_root, "", SVN_INVALID_REVNUM, FALSE,
+ editor, edit_baton, NULL, NULL, subpool));
+
   /* Get the root of the generated tree, and cleanup our mess. */
   tree = svn_repos_node_from_baton (edit_baton);
   svn_pool_destroy (subpool);

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Feb 13 15:16:41 2006

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.