Preperation for issue #977: convert if-statement to two switch tables.
This change replaces the if-statement of do_diff() by two switch tables
to clarify its meaning. Doing this, I remove each conditional brach of
the if-statement, and make them to be independent 5 helper functions.
This patch doesn't do anything, and MUST NOT DO ANYTHING. Semantically,
it must be _completely_ equivalent to previous implementation(that is
the meaning of 'equivalent'. sorry Karl). If we can confirm it, we may
be able to resolve Issue #977 easily, because all we have to do is
tweaking some entries of the switch tables.
* diff.c (do_diff): convert if-statement to two switch tables.
(do_diff_aux_default): New function. Only called by do_diff.
(do_diff_aux_unspecified): New function. Only called by do_diff.
(do_diff_aux_base_working): New function. Only called by do_diff.
(do_diff_aux_one_atmark): New function. Only called by do_diff.
(do_diff_aux_two_atmarks): New function. Only called by do_diff.
<striker@apache.org> said:
> Could you be a bit more verbose? And with a fairly
> large patch, please describe what the patch does.
Thanks for your good advise. Yes, this patch is very hard to see.
But because I couldn't know how to make much more readable one,
I send the same patch again.
Thanks.
- Tez
Index: subversion/libsvn_client/diff.c
===================================================================
--- subversion/libsvn_client/diff.c (revision 5482)
+++ subversion/libsvn_client/diff.c (working copy)
@@ -1124,19 +1124,50 @@
"that is not yet supported.");
}
+static svn_error_t *
+do_diff_aux_default (const apr_array_header_t *options,
+ const char *path1,
+ const svn_opt_revision_t *revision1,
+ const char *path2,
+ const svn_opt_revision_t *revision2,
+ svn_boolean_t recurse,
+ const svn_wc_diff_callbacks_t *callbacks,
+ struct diff_cmd_baton *callback_baton,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool)
+{
+ return polite_error (NULL, pool);
+}
static svn_error_t *
-do_diff (const apr_array_header_t *options,
- const char *path1,
- const svn_opt_revision_t *revision1,
- const char *path2,
- const svn_opt_revision_t *revision2,
- svn_boolean_t recurse,
- const svn_wc_diff_callbacks_t *callbacks,
- struct diff_cmd_baton *callback_baton,
- svn_client_ctx_t *ctx,
- apr_pool_t *pool)
+do_diff_aux_unspecified (const apr_array_header_t *options,
+ const char *path1,
+ const svn_opt_revision_t *revision1,
+ const char *path2,
+ const svn_opt_revision_t *revision2,
+ svn_boolean_t recurse,
+ const svn_wc_diff_callbacks_t *callbacks,
+ struct diff_cmd_baton *callback_baton,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool)
{
+ /* Sanity check -- ensure that we have valid revisions to look at. */
+ return svn_error_create (SVN_ERR_CLIENT_BAD_REVISION, NULL,
+ "do_diff: not all revisions are specified.");
+}
+
+static svn_error_t *
+do_diff_aux_base_working (const apr_array_header_t *options,
+ const char *path1,
+ const svn_opt_revision_t *revision1,
+ const char *path2,
+ const svn_opt_revision_t *revision2,
+ svn_boolean_t recurse,
+ const svn_wc_diff_callbacks_t *callbacks,
+ struct diff_cmd_baton *callback_baton,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool)
+{
svn_revnum_t start_revnum, end_revnum;
const char *anchor = NULL, *target = NULL;
void *ra_baton, *session;
@@ -1147,278 +1178,395 @@
void *diff_edit_baton;
const char *auth_dir;
- /* Sanity check -- ensure that we have valid revisions to look at. */
- if ((revision1->kind == svn_opt_revision_unspecified)
- || (revision2->kind == svn_opt_revision_unspecified))
- return svn_error_create (SVN_ERR_CLIENT_BAD_REVISION, NULL,
- "do_diff: not all revisions are specified.");
-
/* The simplest use-case. No repository contact required. */
- if ((revision1->kind == svn_opt_revision_base)
- && (revision2->kind == svn_opt_revision_working))
- {
svn_wc_adm_access_t *adm_access;
- /* Sanity check -- path1 and path2 are the same working-copy path. */
- if (strcmp (path1, path2) != 0)
- return polite_error (svn_error_create
- (SVN_ERR_INCORRECT_PARAMS, NULL,
- "do_diff: paths aren't equal!"),
- pool);
- if (svn_path_is_url (path1))
- return polite_error (svn_error_create
- (SVN_ERR_INCORRECT_PARAMS, NULL,
- "do_diff: path isn't a working-copy path."),
- pool);
- SVN_ERR (svn_wc_get_actual_target (path1, &anchor, &target, pool));
- SVN_ERR (svn_wc_adm_open (&adm_access, NULL, anchor, FALSE, recurse,
- pool));
- SVN_ERR (svn_wc_diff (adm_access, target, callbacks, callback_baton,
- recurse, pool));
- SVN_ERR (svn_wc_adm_close (adm_access));
- }
+ /* Sanity check -- path1 and path2 are the same working-copy path. */
+ if (strcmp (path1, path2) != 0)
+ return polite_error (svn_error_create
+ (SVN_ERR_INCORRECT_PARAMS, NULL,
+ "do_diff: paths aren't equal!"),
+ pool);
+ if (svn_path_is_url (path1))
+ return polite_error (svn_error_create
+ (SVN_ERR_INCORRECT_PARAMS, NULL,
+ "do_diff: path isn't a working-copy path."),
+ pool);
+ SVN_ERR (svn_wc_get_actual_target (path1, &anchor, &target, pool));
+ SVN_ERR (svn_wc_adm_open (&adm_access, NULL, anchor, FALSE, recurse,
+ pool));
+ SVN_ERR (svn_wc_diff (adm_access, target, callbacks, callback_baton,
+ recurse, pool));
+ SVN_ERR (svn_wc_adm_close (adm_access));
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+do_diff_aux_one_atmark (const apr_array_header_t *options,
+ const char *path1,
+ const svn_opt_revision_t *revision1,
+ const char *path2,
+ const svn_opt_revision_t *revision2,
+ svn_boolean_t recurse,
+ const svn_wc_diff_callbacks_t *callbacks,
+ struct diff_cmd_baton *callback_baton,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool)
+{
+ svn_revnum_t start_revnum, end_revnum;
+ const char *anchor = NULL, *target = NULL;
+ void *ra_baton, *session;
+ svn_ra_plugin_t *ra_lib;
+ const svn_ra_reporter_t *reporter;
+ void *report_baton;
+ const svn_delta_editor_t *diff_editor;
+ void *diff_edit_baton;
+ const char *auth_dir;
+
/* Next use-case: some repos-revision compared against wcpath@WORKING */
- else if ((revision2->kind == svn_opt_revision_working)
- && (revision1->kind != svn_opt_revision_working)
- && (revision1->kind != svn_opt_revision_base))
+ const char *URL1;
+ const char *url_anchor, *url_target;
+ svn_wc_adm_access_t *adm_access, *dir_access;
+ svn_node_kind_t kind;
+
+ /* Sanity check -- path2 better be a working-copy path. */
+ if (svn_path_is_url (path2))
+ return polite_error (svn_error_create
+ (SVN_ERR_INCORRECT_PARAMS, NULL,
+ "do_diff: path isn't a working-copy path."),
+ pool);
+
+ /* Extract a URL and revision from path1 (if not already a URL) */
+ SVN_ERR (convert_to_url (&URL1, path1, pool));
+
+ /* Trickiness: possibly split up path2 into anchor/target. If
+ we do so, then we must split URL1 as well. We shouldn't go
+ assuming that URL1 is equal to path2's URL, as we used to. */
+ SVN_ERR (svn_wc_get_actual_target (path2, &anchor, &target, pool));
+ if (target)
{
- const char *URL1;
- const char *url_anchor, *url_target;
- svn_wc_adm_access_t *adm_access, *dir_access;
- svn_node_kind_t kind;
+ svn_path_split (URL1, &url_anchor, &url_target, pool);
+ }
+ else
+ {
+ url_anchor = URL1;
+ url_target = NULL;
+ }
- /* Sanity check -- path2 better be a working-copy path. */
- if (svn_path_is_url (path2))
- return polite_error (svn_error_create
- (SVN_ERR_INCORRECT_PARAMS, NULL,
- "do_diff: path isn't a working-copy path."),
- pool);
+ /* Establish RA session to URL1's anchor */
+ SVN_ERR (svn_ra_init_ra_libs (&ra_baton, pool));
+ SVN_ERR (svn_ra_get_ra_library (&ra_lib, ra_baton,
+ url_anchor, pool));
- /* Extract a URL and revision from path1 (if not already a URL) */
- SVN_ERR (convert_to_url (&URL1, path1, pool));
+ SVN_ERR (svn_client__default_auth_dir (&auth_dir, path2, pool));
- /* Trickiness: possibly split up path2 into anchor/target. If
- we do so, then we must split URL1 as well. We shouldn't go
- assuming that URL1 is equal to path2's URL, as we used to. */
- SVN_ERR (svn_wc_get_actual_target (path2, &anchor, &target, pool));
- if (target)
- {
- svn_path_split (URL1, &url_anchor, &url_target, pool);
- }
- else
- {
- url_anchor = URL1;
- url_target = NULL;
- }
+ SVN_ERR (svn_client__open_ra_session (&session, ra_lib, url_anchor,
+ auth_dir,
+ NULL, NULL, FALSE, TRUE,
+ ctx, pool));
+
+ /* Set up diff editor according to path2's anchor/target. */
+ SVN_ERR (svn_wc_adm_open (&adm_access, NULL, anchor, FALSE, TRUE, pool));
+ SVN_ERR (svn_wc_get_diff_editor (adm_access, target,
+ callbacks, callback_baton,
+ recurse,
+ ctx->cancel_func, ctx->cancel_baton,
+ &diff_editor, &diff_edit_baton,
+ pool));
- /* Establish RA session to URL1's anchor */
- SVN_ERR (svn_ra_init_ra_libs (&ra_baton, pool));
- SVN_ERR (svn_ra_get_ra_library (&ra_lib, ra_baton,
- url_anchor, pool));
+ /* Tell the RA layer we want a delta to change our txn to URL1 */
+ SVN_ERR (svn_client__get_revision_number
+ (&start_revnum, ra_lib, session, revision1, path1, pool));
+ callback_baton->revnum1 = start_revnum;
+ SVN_ERR (ra_lib->do_update (session,
+ &reporter, &report_baton,
+ start_revnum,
+ svn_path_uri_decode (url_target, pool),
+ recurse,
+ diff_editor, diff_edit_baton, pool));
- SVN_ERR (svn_client__default_auth_dir (&auth_dir, path2, pool));
+ SVN_ERR (svn_io_check_path (path2, &kind, pool));
+ if (kind == svn_node_dir)
+ SVN_ERR (svn_wc_adm_retrieve (&dir_access, adm_access, path2, pool));
+ else
+ SVN_ERR (svn_wc_adm_retrieve (&dir_access, adm_access,
+ svn_path_dirname (path2, pool),
+ pool));
- SVN_ERR (svn_client__open_ra_session (&session, ra_lib, url_anchor,
- auth_dir,
- NULL, NULL, FALSE, TRUE,
- ctx, pool));
-
- /* Set up diff editor according to path2's anchor/target. */
- SVN_ERR (svn_wc_adm_open (&adm_access, NULL, anchor, FALSE, TRUE, pool));
- SVN_ERR (svn_wc_get_diff_editor (adm_access, target,
- callbacks, callback_baton,
- recurse,
- ctx->cancel_func, ctx->cancel_baton,
- &diff_editor, &diff_edit_baton,
- pool));
+ /* Create a txn mirror of path2; the diff editor will print
+ diffs in reverse. :-) */
+ SVN_ERR (svn_wc_crawl_revisions (path2, dir_access,
+ reporter, report_baton,
+ FALSE, recurse,
+ NULL, NULL, /* notification is N/A */
+ NULL, pool));
- /* Tell the RA layer we want a delta to change our txn to URL1 */
- SVN_ERR (svn_client__get_revision_number
- (&start_revnum, ra_lib, session, revision1, path1, pool));
- callback_baton->revnum1 = start_revnum;
- SVN_ERR (ra_lib->do_update (session,
- &reporter, &report_baton,
- start_revnum,
- svn_path_uri_decode (url_target, pool),
- recurse,
- diff_editor, diff_edit_baton, pool));
+ SVN_ERR (svn_wc_adm_close (adm_access));
- SVN_ERR (svn_io_check_path (path2, &kind, pool));
- if (kind == svn_node_dir)
- SVN_ERR (svn_wc_adm_retrieve (&dir_access, adm_access, path2, pool));
- else
- SVN_ERR (svn_wc_adm_retrieve (&dir_access, adm_access,
- svn_path_dirname (path2, pool),
- pool));
+ return SVN_NO_ERROR;
+}
- /* Create a txn mirror of path2; the diff editor will print
- diffs in reverse. :-) */
- SVN_ERR (svn_wc_crawl_revisions (path2, dir_access,
- reporter, report_baton,
- FALSE, recurse,
- NULL, NULL, /* notification is N/A */
- NULL, pool));
+static svn_error_t *
+do_diff_aux_two_atmarks (const apr_array_header_t *options,
+ const char *path1,
+ const svn_opt_revision_t *revision1,
+ const char *path2,
+ const svn_opt_revision_t *revision2,
+ svn_boolean_t recurse,
+ const svn_wc_diff_callbacks_t *callbacks,
+ struct diff_cmd_baton *callback_baton,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool)
+{
+ svn_revnum_t start_revnum, end_revnum;
+ const char *anchor = NULL, *target = NULL;
+ void *ra_baton, *session;
+ svn_ra_plugin_t *ra_lib;
+ const svn_ra_reporter_t *reporter;
+ void *report_baton;
+ const svn_delta_editor_t *diff_editor;
+ void *diff_edit_baton;
+ const char *auth_dir;
- SVN_ERR (svn_wc_adm_close (adm_access));
- }
-
/* Last use-case: comparing path1@rev1 and path2@rev2, where both revs
require repository contact. */
- else if ((revision2->kind != svn_opt_revision_working)
- && (revision2->kind != svn_opt_revision_base)
- && (revision1->kind != svn_opt_revision_working)
- && (revision1->kind != svn_opt_revision_base))
- {
- const char *URL1, *URL2;
- const char *anchor1, *target1, *anchor2, *target2;
- svn_boolean_t path1_is_url, path2_is_url;
- svn_node_kind_t path2_kind;
- void *session2;
- /* The paths could be *either* wcpaths or urls... */
- SVN_ERR (convert_to_url (&URL1, path1, pool));
- SVN_ERR (convert_to_url (&URL2, path2, pool));
+ const char *URL1, *URL2;
+ const char *anchor1, *target1, *anchor2, *target2;
+ svn_boolean_t path1_is_url, path2_is_url;
+ svn_node_kind_t path2_kind;
+ void *session2;
- path1_is_url = svn_path_is_url (path1);
- path2_is_url = svn_path_is_url (path2);
+ /* The paths could be *either* wcpaths or urls... */
+ SVN_ERR (convert_to_url (&URL1, path1, pool));
+ SVN_ERR (convert_to_url (&URL2, path2, pool));
- /* Open temporary RA sessions to each URL. */
- SVN_ERR (svn_ra_init_ra_libs (&ra_baton, pool));
- SVN_ERR (svn_ra_get_ra_library (&ra_lib, ra_baton, URL1, pool));
- SVN_ERR (svn_client__dir_if_wc (&auth_dir, "", pool));
- SVN_ERR (svn_client__open_ra_session (&session, ra_lib, URL1, auth_dir,
- NULL, NULL, FALSE, TRUE,
- ctx, pool));
- SVN_ERR (svn_client__open_ra_session (&session2, ra_lib, URL2, auth_dir,
- NULL, NULL, FALSE, TRUE,
- ctx, pool));
+ path1_is_url = svn_path_is_url (path1);
+ path2_is_url = svn_path_is_url (path2);
- /* Do the right thing in resolving revisions; if the caller
- does something foolish like pass in URL@committed, then they
- should rightfully get an error when we pass a NULL path below. */
- SVN_ERR (svn_client__get_revision_number
- (&start_revnum, ra_lib, session, revision1,
- path1_is_url ? NULL : path1,
- pool));
- callback_baton->revnum1 = start_revnum;
- SVN_ERR (svn_client__get_revision_number
- (&end_revnum, ra_lib, session2, revision2,
- path2_is_url ? NULL : path2,
- pool));
- callback_baton->revnum2 = end_revnum;
+ /* Open temporary RA sessions to each URL. */
+ SVN_ERR (svn_ra_init_ra_libs (&ra_baton, pool));
+ SVN_ERR (svn_ra_get_ra_library (&ra_lib, ra_baton, URL1, pool));
+ SVN_ERR (svn_client__dir_if_wc (&auth_dir, "", pool));
+ SVN_ERR (svn_client__open_ra_session (&session, ra_lib, URL1, auth_dir,
+ NULL, NULL, FALSE, TRUE,
+ ctx, pool));
+ SVN_ERR (svn_client__open_ra_session (&session2, ra_lib, URL2, auth_dir,
+ NULL, NULL, FALSE, TRUE,
+ ctx, pool));
- /* Now down to the -real- business. We gotta figure out anchors
- and targets, whether things are urls or wcpaths.
+ /* Do the right thing in resolving revisions; if the caller
+ does something foolish like pass in URL@committed, then they
+ should rightfully get an error when we pass a NULL path below. */
+ SVN_ERR (svn_client__get_revision_number
+ (&start_revnum, ra_lib, session, revision1,
+ path1_is_url ? NULL : path1,
+ pool));
+ callback_baton->revnum1 = start_revnum;
+ SVN_ERR (svn_client__get_revision_number
+ (&end_revnum, ra_lib, session2, revision2,
+ path2_is_url ? NULL : path2,
+ pool));
+ callback_baton->revnum2 = end_revnum;
- Like we do in the 2nd use-case, we have PATH1 follow PATH2's
- lead. If PATH2 is split into anchor/target, then so must
- PATH1 (URL1) be.
+ /* Now down to the -real- business. We gotta figure out anchors
+ and targets, whether things are urls or wcpaths.
- Now, at the end of all this, we want ANCHOR2 to be "" if
- PATH2 is a URL, or the actual path anchor otherwise.
- TARGET2, if non-NULL, will be a filesystem path component.
- Likewise, ANCHOR1 will be a URL, and TARGET1, if non-NULL,
- will be a filesystem path component. */
- if (path2_is_url)
+ Like we do in the 2nd use-case, we have PATH1 follow PATH2's
+ lead. If PATH2 is split into anchor/target, then so must
+ PATH1 (URL1) be.
+
+ Now, at the end of all this, we want ANCHOR2 to be "" if
+ PATH2 is a URL, or the actual path anchor otherwise.
+ TARGET2, if non-NULL, will be a filesystem path component.
+ Likewise, ANCHOR1 will be a URL, and TARGET1, if non-NULL,
+ will be a filesystem path component. */
+ if (path2_is_url)
+ {
+ anchor2 = "";
+ SVN_ERR (ra_lib->check_path (&path2_kind, session2, "", end_revnum,
+ pool));
+
+ switch (path2_kind)
{
- anchor2 = "";
- SVN_ERR (ra_lib->check_path (&path2_kind, session2, "", end_revnum,
- pool));
+ case svn_node_file:
+ target2 = svn_path_uri_decode (svn_path_basename (path2, pool),
+ pool);
+ break;
- switch (path2_kind)
- {
- case svn_node_file:
- target2 = svn_path_uri_decode (svn_path_basename (path2, pool),
- pool);
- break;
+ case svn_node_dir:
+ target2 = NULL;
+ break;
- case svn_node_dir:
- target2 = NULL;
- break;
+ default:
+ return svn_error_createf (SVN_ERR_FS_NOT_FOUND, NULL,
+ "'%s' at rev %" SVN_REVNUM_T_FMT
+ " wasn't found in repository.",
+ path2, end_revnum);
+ }
+ }
+ else
+ {
+ SVN_ERR (svn_wc_get_actual_target (path2, &anchor2, &target2, pool));
+ }
- default:
- return svn_error_createf (SVN_ERR_FS_NOT_FOUND, NULL,
- "'%s' at rev %" SVN_REVNUM_T_FMT
- " wasn't found in repository.",
- path2, end_revnum);
- }
- }
- else
- {
- SVN_ERR (svn_wc_get_actual_target (path2, &anchor2, &target2, pool));
- }
+ if (target2)
+ {
+ svn_path_split (URL1, &anchor1, &target1, pool);
+ target1 = svn_path_uri_decode (target1, pool);
+ }
+ else
+ {
+ anchor1 = URL1;
+ target1 = NULL;
+ }
- if (target2)
- {
- svn_path_split (URL1, &anchor1, &target1, pool);
- target1 = svn_path_uri_decode (target1, pool);
- }
- else
- {
- anchor1 = URL1;
- target1 = NULL;
- }
+ /* The main session is opened to the anchor of URL1. */
+ SVN_ERR (svn_client__open_ra_session (&session, ra_lib, anchor1,
+ auth_dir,
+ NULL, NULL, FALSE, TRUE,
+ ctx, pool));
- /* The main session is opened to the anchor of URL1. */
- SVN_ERR (svn_client__open_ra_session (&session, ra_lib, anchor1,
- auth_dir,
- NULL, NULL, FALSE, TRUE,
- ctx, pool));
+ /* Open a second session used to request individual file
+ contents from URL1's anchor. */
+ SVN_ERR (svn_client__open_ra_session (&session2, ra_lib, anchor1,
+ auth_dir,
+ NULL, NULL, FALSE, TRUE,
+ ctx, pool));
- /* Open a second session used to request individual file
- contents from URL1's anchor. */
- SVN_ERR (svn_client__open_ra_session (&session2, ra_lib, anchor1,
- auth_dir,
- NULL, NULL, FALSE, TRUE,
- ctx, pool));
+ /* Set up the repos_diff editor on path2's anchor, assuming
+ path2 is a wc_dir. if path2 is a URL, then we want to anchor
+ the diff editor on "", because we don't want to see any url's
+ in the diff headers. */
+ SVN_ERR (svn_client__get_diff_editor (anchor2,
+ NULL,
+ callbacks,
+ callback_baton,
+ recurse,
+ FALSE, /* does't matter for diff */
+ ra_lib, session2,
+ start_revnum,
+ NULL, /* no notify_func */
+ NULL, /* no notify_baton */
+ ctx->cancel_func,
+ ctx->cancel_baton,
+ &diff_editor,
+ &diff_edit_baton,
+ pool));
- /* Set up the repos_diff editor on path2's anchor, assuming
- path2 is a wc_dir. if path2 is a URL, then we want to anchor
- the diff editor on "", because we don't want to see any url's
- in the diff headers. */
- SVN_ERR (svn_client__get_diff_editor (anchor2,
- NULL,
- callbacks,
- callback_baton,
- recurse,
- FALSE, /* does't matter for diff */
- ra_lib, session2,
- start_revnum,
- NULL, /* no notify_func */
- NULL, /* no notify_baton */
- ctx->cancel_func,
- ctx->cancel_baton,
- &diff_editor,
- &diff_edit_baton,
- pool));
+ /* We want to switch our txn into URL2 */
+ SVN_ERR (ra_lib->do_diff (session,
+ &reporter, &report_baton,
+ end_revnum,
+ target1,
+ recurse,
+ URL2,
+ diff_editor, diff_edit_baton, pool));
- /* We want to switch our txn into URL2 */
- SVN_ERR (ra_lib->do_diff (session,
- &reporter, &report_baton,
- end_revnum,
- target1,
- recurse,
- URL2,
- diff_editor, diff_edit_baton, pool));
+ SVN_ERR (reporter->set_path (report_baton, "", start_revnum, pool));
+ SVN_ERR (reporter->finish_report (report_baton));
- SVN_ERR (reporter->set_path (report_baton, "", start_revnum, pool));
- SVN_ERR (reporter->finish_report (report_baton));
- }
-
- else
- {
- /* can't pigeonhole our inputs into one of the three use-cases. */
- return polite_error (NULL, pool);
- }
-
return SVN_NO_ERROR;
}
+static svn_error_t *
+do_diff (const apr_array_header_t *options,
+ const char *path1,
+ const svn_opt_revision_t *revision1,
+ const char *path2,
+ const svn_opt_revision_t *revision2,
+ svn_boolean_t recurse,
+ const svn_wc_diff_callbacks_t *callbacks,
+ struct diff_cmd_baton *callback_baton,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool)
+{
+ svn_revnum_t start_revnum, end_revnum;
+ const char *anchor = NULL, *target = NULL;
+ void *ra_baton, *session;
+ svn_ra_plugin_t *ra_lib;
+ const svn_ra_reporter_t *reporter;
+ void *report_baton;
+ const svn_delta_editor_t *diff_editor;
+ void *diff_edit_baton;
+ const char *auth_dir;
+/*
+ from subversion/include/svn_opt.h:
+ svn_opt_revision_unspecified, ... 0
+ svn_opt_revision_number, ... 1
+ svn_opt_revision_date, ... 2
+ svn_opt_revision_committed, ... 3
+ svn_opt_revision_previous, ... 4
+ svn_opt_revision_base, ... 5
+ svn_opt_revision_working, ... 6
+ svn_opt_revision_head ... 7
+*/
+
+ int sw[][8] = {
+/*
+ [ 2nd parameter. ]
+ /--------------------------- * unspecified
+ | /------------------------ * number
+ | | /--------------------- * date
+ | | | /------------------ * committed
+ | | | | /--------------- * previous
+ | | | | | /------------ * base
+ | | | | | | /--------- * working
+ | | | | | | | /------ * head
+*/
+ /* [ 1st parameter. ] */
+ { 1, 1, 1, 1, 1, 1, 1, 1 }, /* unspecified */
+ { 1, 4, 4, 4, 4, 0, 3, 4 }, /* number */
+ { 1, 4, 4, 4, 4, 0, 3, 4 }, /* date */
+ { 1, 4, 4, 4, 4, 0, 3, 4 }, /* comitted */
+ { 1, 4, 4, 4, 4, 0, 3, 4 }, /* previous */
+ { 1, 0, 0, 0, 0, 0, 2, 0/*4 (Issue #977)*/}, /* base */
+ { 1, 0, 0, 0, 0, 0, 0, 0 }, /* working */
+ { 1, 4, 4, 4, 4, 0, 3, 4 } /* head */
+ };
+
+ svn_error_t *(*sw2[])(const apr_array_header_t *,
+ const char *,
+ const svn_opt_revision_t *,
+ const char *,
+ const svn_opt_revision_t *,
+ svn_boolean_t,
+ const svn_wc_diff_callbacks_t *,
+ struct diff_cmd_baton *,
+ svn_client_ctx_t *,
+ apr_pool_t *) = {
+
+ do_diff_aux_default, /* 0 */
+ do_diff_aux_unspecified, /* 1 */
+ do_diff_aux_base_working, /* 2 */
+ do_diff_aux_one_atmark, /* 3 */
+ do_diff_aux_two_atmarks /* 4 */
+ };
+
+ int s;
+
+ s = sw[revision1->kind][revision2->kind];
+ return (*sw2[s])(options,
+ path1,
+ revision1,
+ path2,
+ revision2,
+ recurse,
+ callbacks,
+ callback_baton,
+ ctx,
+ pool);
+}
+
+
+
+
/*----------------------------------------------------------------------- */
/*** Public Interfaces. ***/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Mar 28 03:41:00 2003